/* ========================================================
   ROeN Residence — Luxury Flipbook
   Clean / Transparent theme · No third-party branding
   ======================================================== */

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --gold: #c9a96e;
  --gold-glow: rgba(201, 169, 110, 0.12);
  --bg: transparent;
  --ctrl-h: 58px;
  --text: #111111;
  --text-dim: rgba(0, 0, 0, 0.45);
  --border: rgba(201, 169, 110, 0.18);
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: transparent;
  color: var(--text);
  font-family: 'Montserrat', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Loading Screen */
#loading-screen {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.8s ease;
}

#loading-screen.ls-out {
  opacity: 0;
  pointer-events: none;
}

.ls-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  user-select: none;
}

.ls-waves {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 60px;
}

.lw {
  display: block;
  width: 2px;
  min-height: 6px;
  border-radius: 2px;
  background: linear-gradient(
    180deg,
    var(--gold) 0%,
    rgba(201, 169, 110, 0.2) 100%
  );
  animation: lw-pulse 1.7s ease-in-out infinite;
  animation-delay: calc(var(--i) * 0.07s);
}

@keyframes lw-pulse {
  0%, 100% {
    height: 7px;
    opacity: 0.25;
  }

  50% {
    height: 54px;
    opacity: 1;
  }
}

.ls-logo {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(2.6rem, 6vw, 4rem);
  font-weight: 300;
  letter-spacing: 0.30em;
  color: var(--text);
  line-height: 1;
}

.ls-bar-wrap {
  width: 180px;
  height: 1px;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 1px;
  overflow: hidden;
  margin-top: 4px;
}

.ls-bar {
  height: 100%;
  width: 0%;
  background: var(--gold);
  border-radius: 1px;
  transition: width 0.4s ease;
}

.ls-label {
  font-size: 0.60rem;
  font-weight: 300;
  letter-spacing: 0.38em;
  text-transform: uppercase;
  color: var(--text-dim);
  transition: opacity 0.4s ease;
}

/* App Shell */
#app {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: transparent;
  transition: opacity 0.5s ease;
}

#app.app-hidden {
  display: none;
  opacity: 0;
}

#app.app-visible {
  display: flex;
  opacity: 1;
}

/* Book Area */
#book-area {
  flex: 1;
  min-height: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: transparent;
  contain: layout style paint;
}

#book-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  transform-origin: center center;
  will-change: transform;
  transition: transform 0.22s ease;
  background: transparent;
}

#book {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  background: transparent;
  box-shadow: none;
}

/* Controls */
#controls {
  height: var(--ctrl-h);
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.92);
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 20px;
  transition: opacity 0.3s ease;
  z-index: 9999;
}

#controls.ctrl-dim {
  opacity: 1;
}

#controls:hover {
  opacity: 1 !important;
}

.ctrl-group {
  display: flex;
  align-items: center;
  gap: 2px;
}

.ctrl-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  width: 34px;
  height: 34px;
  border-radius: 4px;
  color: rgba(0, 0, 0, 0.68);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.18s ease, background 0.18s ease, transform 0.1s ease;
  outline: none;
}

.ctrl-btn:hover {
  color: var(--gold);
  background: var(--gold-glow);
}

.ctrl-btn:active {
  transform: scale(0.90);
}

.ctrl-btn:focus-visible {
  outline: 1px solid var(--gold);
  outline-offset: 2px;
}

.ctrl-btn:disabled {
  opacity: 0.22;
  cursor: default;
  pointer-events: none;
}

.ctrl-btn svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ctrl-divider {
  width: 1px;
  height: 18px;
  background: rgba(0, 0, 0, 0.08);
  margin: 0 8px;
}

.page-counter {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 300;
  letter-spacing: 0.07em;
  color: rgba(0, 0, 0, 0.65);
  min-width: 68px;
  justify-content: center;
}

.pg-sep {
  color: rgba(0, 0, 0, 0.25);
}

.zoom-label {
  font-size: 0.62rem;
  font-weight: 300;
  letter-spacing: 0.05em;
  color: rgba(0, 0, 0, 0.55);
  min-width: 36px;
  text-align: center;
}

/* Page Elements */
.pf-page {
  width: 100%;
  height: 100%;
  margin: 0 !important;
  padding: 0 !important;
  background: transparent;
  overflow: hidden;
}

.pf-page img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

/* StPageFlip internals */
.stf__parent {
  touch-action: none !important;
}

.stf__item,
.stf__block,
.stf__wrapper,
.stf__page,
.stf__hardShadow,
.stf__outerShadow {
  background: transparent !important;
}

.stf__block,
.stf__item {
  margin: 0 !important;
  padding: 0 !important;
}

.stf__block {
  gap: 0 !important;
}

/* Responsive */
@media (max-width: 768px) {
  :root {
    --ctrl-h: 52px;
  }

  #ctrl-zoom,
  #div-zoom {
    display: none !important;
  }
}

@media (max-width: 380px) {
  .ls-logo {
    font-size: 2.2rem;
  }

  .ctrl-btn {
    width: 30px;
    height: 30px;
  }

  .page-counter {
    font-size: 0.66rem;
    min-width: 56px;
  }
}

/* Fullscreen */
:fullscreen #book-area,
:-webkit-full-screen #book-area {
  background: transparent;
}

:fullscreen #controls,
:-webkit-full-screen #controls {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
}

/* Final Mobile Fixes */
@media (max-width: 768px) {
  html,
  body {
    overflow: hidden !important;
  }

  #book-area {
    width: 100vw !important;
    overflow: hidden !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
  }

  #book-wrap {
    width: 100%;
    max-width: 100vw !important;
    overflow: hidden !important;
    transform-origin: center center !important;
  }

  #book {
    max-width: 100vw !important;
    box-shadow: none !important;
  }

  .pf-page,
  .pf-page img,
  .stf__item,
  .stf__block,
  .stf__page {
    margin: 0 !important;
    padding: 0 !important;
    object-fit: contain !important;
  }

  .pf-page img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    display: block !important;
  }

  .stf__item,
  .stf__block,
  .stf__wrapper,
  .stf__page,
  .stf__hardShadow,
  .stf__outerShadow {
    background: transparent !important;
  }

  .stf__block {
    gap: 0 !important;
  }

  #controls {
    display: flex !important;
    position: fixed !important;
    bottom: 12px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: auto !important;
    height: 54px !important;
    padding: 0 14px !important;
    border-radius: 999px !important;
    background: rgba(255, 255, 255, 0.92) !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    z-index: 999999 !important;
    opacity: 1 !important;
  }

  #controls.ctrl-dim {
    opacity: 1 !important;
  }

  #btn-prev,
  #btn-next {
    display: flex !important;
  }

  #ctrl-zoom,
  #div-zoom,
  #div-fs,
  #btn-fullscreen {
    display: none !important;
  }

  .ctrl-btn {
    color: rgba(0, 0, 0, 0.75) !important;
  }

  .page-counter {
    color: rgba(0, 0, 0, 0.65) !important;
    min-width: 62px !important;
  }
}

