/* ==========================================================================
   Brits Hotel Karawang — Special Wedding Package Catalog
   Premium interactive flipbook styles
   ========================================================================== */

@font-face {
  font-family: 'Cormorant Garamond';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../assets/fonts/cormorant-garamond-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Cormorant Garamond';
  font-style: italic;
  font-weight: 500;
  font-display: swap;
  src: url('../assets/fonts/cormorant-garamond-italic-500.woff2') format('woff2');
}
@font-face {
  font-family: 'Jost';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../assets/fonts/jost-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Jost';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../assets/fonts/jost-latin.woff2') format('woff2');
}

:root {
  --serif: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --sans: 'Jost', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --ivory: #faf6ee;
  --ivory-deep: #f1e9da;
  --paper: #fffdf9;
  --champagne: #c9ac7c;
  --gold: #a8834f;
  --gold-deep: #7d5e35;
  --ink: #352c21;
  --muted: #7d705d;
  --line: rgba(125, 94, 53, 0.18);
  --line-soft: rgba(125, 94, 53, 0.1);
  --shadow: rgba(61, 44, 22, 0.22);
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  background: var(--ivory);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 400;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button {
  font: inherit;
  color: inherit;
}

a {
  color: inherit;
}

svg {
  display: block;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

/* --------------------------------------------------------------------------
   Shell
   -------------------------------------------------------------------------- */

.app {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  background:
    radial-gradient(1100px 620px at 50% -12%, #fffdf8 0%, rgba(255, 253, 248, 0) 62%),
    radial-gradient(900px 520px at 50% 112%, #efe4d0 0%, rgba(239, 228, 208, 0) 58%),
    var(--ivory);
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 100;
  padding: 12px 18px;
  background: var(--gold-deep);
  color: #fffdf8;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform 0.2s ease;
}

.skip-link:focus {
  transform: translateY(0);
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.site-header {
  position: relative;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: clamp(10px, 2vw, 28px);
  padding: calc(12px + env(safe-area-inset-top)) clamp(14px, 3vw, 36px) 12px;
  background: linear-gradient(to bottom, rgba(250, 246, 238, 0.96), rgba(250, 246, 238, 0.82));
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
  transition: padding 0.25s ease;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(168, 131, 79, 0.55);
  border-radius: 50%;
  background: radial-gradient(circle at 32% 26%, #fffefa, #f3ead9);
  box-shadow: inset 0 0 0 3px rgba(255, 253, 249, 0.75), 0 3px 10px rgba(120, 92, 52, 0.08);
  color: var(--gold-deep);
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 600;
  line-height: 1;
  padding-bottom: 1px;
}

.brand-word {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1;
}

.brand-hotel {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.2em;
  white-space: nowrap;
  color: var(--ink);
}

.brand-city {
  margin-top: 5px;
  font-size: 8.5px;
  font-weight: 400;
  letter-spacing: 0.34em;
  color: var(--muted);
  white-space: nowrap;
}

.catalog-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0;
  text-align: center;
  line-height: 1;
}

.catalog-eyebrow {
  margin-bottom: 5px;
  font-size: 9px;
  font-weight: 400;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--gold-deep);
}

.catalog-name {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(21px, 2.2vw, 28px);
  letter-spacing: 0.01em;
  color: var(--ink);
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 253, 249, 0.55);
  color: var(--gold-deep);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.icon-btn svg {
  width: 17px;
  height: 17px;
}

.icon-btn:hover {
  border-color: var(--gold);
  background: var(--paper);
  box-shadow: 0 6px 16px rgba(120, 92, 52, 0.12);
  transform: translateY(-1px);
}

.icon-collapse {
  display: none;
}

[aria-pressed='true'] .icon-expand {
  display: none;
}

[aria-pressed='true'] .icon-collapse {
  display: block;
}

/* --------------------------------------------------------------------------
   Viewer / stage
   -------------------------------------------------------------------------- */

.viewer {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.viewer::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(255, 255, 255, 0.62) 0%, rgba(255, 255, 255, 0) 58%),
    radial-gradient(ellipse at 50% 118%, rgba(201, 172, 124, 0.16), rgba(201, 172, 124, 0) 62%);
  pointer-events: none;
}

.stage {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(168, 131, 79, 0.42) transparent;
  -webkit-overflow-scrolling: touch;
}

.stage::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.stage::-webkit-scrollbar-track {
  background: transparent;
}

.stage::-webkit-scrollbar-thumb {
  border-radius: 8px;
  background: rgba(168, 131, 79, 0.38);
}

.stage-inner {
  position: relative;
  width: 100%;
  height: 100%;
}

#book {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) translateZ(0);
  min-width: 0 !important;
  min-height: 0 !important;
  transition: opacity 0.4s ease;
}

/* The engine paints its own page shadows; this adds a soft table shadow. */
.book-aura {
  position: absolute;
  z-index: -1;
  border-radius: 2px;
  background: rgba(255, 253, 249, 0.4);
  box-shadow:
    0 34px 64px -26px rgba(56, 40, 20, 0.5),
    0 14px 28px -18px rgba(56, 40, 20, 0.38);
  pointer-events: none;
}

/* StPageFlip base wrapper (the library ships a typo in its own CSS). */
#book .stf__wrapper {
  position: relative;
  width: 100%;
  height: 100%;
}

.page {
  position: relative;
  overflow: hidden;
  background: #fffdfa;
  box-shadow: inset 0 0 0 1px rgba(62, 45, 25, 0.045);
  -webkit-user-select: none;
  user-select: none;
}

.page-image {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.4s ease;
  -webkit-user-drag: none;
}

.page-skeleton {
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, #f4ecdf 18%, #fcf8f0 38%, #f4ecdf 58%);
  background-size: 220% 100%;
  animation: shimmer 1.9s linear infinite;
  transition: opacity 0.45s ease;
}

.page.is-loaded .page-image {
  opacity: 1;
}

.page.is-loaded .page-skeleton {
  opacity: 0;
}

.page.is-failed .page-image {
  display: none;
}

.page.is-failed .page-skeleton {
  opacity: 0;
  animation: none;
}

.page.is-failed::after {
  content: 'This page could not be loaded';
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 12%;
  background: #faf6ee;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-align: center;
  text-transform: uppercase;
}

.page canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fffdfa;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.page.is-loaded canvas {
  opacity: 1;
}

@keyframes shimmer {
  0% { background-position: 120% 0; }
  100% { background-position: -120% 0; }
}

/* --------------------------------------------------------------------------
   Loader
   -------------------------------------------------------------------------- */

.loader {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px;
  text-align: center;
  background:
    radial-gradient(ellipse at 50% 44%, #fffdf8 0%, rgba(255, 253, 248, 0) 62%),
    var(--ivory);
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loader.is-hiding {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-brand {
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.32em;
  color: var(--gold-deep);
}

.loader-brand span {
  letter-spacing: 0.28em;
  color: var(--muted);
}

.loader-ring {
  position: relative;
  width: 56px;
  height: 56px;
  margin: 20px 0 16px;
  border: 1px solid rgba(168, 131, 79, 0.24);
  border-radius: 50%;
}

.loader-ring span {
  position: absolute;
  inset: -1px;
  border: 1px solid transparent;
  border-top-color: var(--gold-deep);
  border-radius: 50%;
  animation: spin 1.15s linear infinite;
}

.loader-ring::after {
  content: 'B';
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 600;
  color: var(--gold);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loader-title {
  margin: 0;
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink);
}

.loader-meta {
  margin: 9px 0 0;
  font-size: 9px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--muted);
}

.loader-bar {
  width: 136px;
  height: 2px;
  margin-top: 22px;
  overflow: hidden;
  background: rgba(125, 94, 53, 0.16);
}

.loader-bar span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--gold);
  transition: width 0.35s ease;
}

/* --------------------------------------------------------------------------
   Error state
   -------------------------------------------------------------------------- */

.error-panel {
  position: absolute;
  inset: 0;
  z-index: 45;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: auto;
  background:
    radial-gradient(ellipse at 50% 42%, #fffdf8 0%, rgba(255, 253, 248, 0) 64%),
    var(--ivory);
}

.error-inner {
  width: min(100%, 460px);
  padding: clamp(28px, 5vw, 44px);
  border: 1px solid var(--line-soft);
  background: rgba(255, 253, 249, 0.72);
  box-shadow: 0 36px 80px -52px rgba(70, 50, 25, 0.55);
  text-align: center;
}

.error-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin: 0 auto 16px;
  border: 1px solid rgba(168, 131, 79, 0.5);
  border-radius: 50%;
  color: var(--gold-deep);
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 600;
}

.error-kicker {
  margin: 0 0 10px;
  font-size: 9px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold-deep);
}

.error-inner h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(26px, 3.6vw, 32px);
  font-weight: 600;
  line-height: 1.15;
  color: var(--ink);
}

.error-text {
  margin: 14px auto 0;
  max-width: 34ch;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--muted);
}

.error-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 24px;
}

.btn-primary,
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 22px;
  border-radius: 1px;
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.btn-primary {
  border: 1px solid var(--gold-deep);
  background: var(--gold-deep);
  color: #fffdf8;
}

.btn-primary:hover {
  background: #6b4f2b;
  border-color: #6b4f2b;
}

.btn-ghost {
  border: 1px solid var(--line);
  color: var(--gold-deep);
}

.btn-ghost:hover {
  border-color: var(--gold);
  background: rgba(255, 253, 249, 0.8);
}

.noscript {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: grid;
  place-content: center;
  gap: 10px;
  padding: 28px;
  background: var(--ivory);
  text-align: center;
  font-size: 14px;
  line-height: 1.7;
  color: var(--muted);
}

.noscript strong {
  color: var(--ink);
  font-weight: 500;
}

/* --------------------------------------------------------------------------
   Toolbar
   -------------------------------------------------------------------------- */

.toolbar {
  position: relative;
  z-index: 20;
  padding: 10px clamp(12px, 2.5vw, 32px) calc(11px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(248, 242, 232, 0.98), rgba(250, 246, 238, 0.9));
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line-soft);
}

.toolbar-inner {
  display: flex;
  align-items: center;
  gap: clamp(10px, 1.8vw, 24px);
  max-width: 1600px;
  margin: 0 auto;
}

.nav-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.round-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid rgba(168, 131, 79, 0.3);
  border-radius: 50%;
  background: rgba(255, 253, 249, 0.6);
  color: var(--gold-deep);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.round-btn svg {
  width: 18px;
  height: 18px;
}

.round-btn:hover:not(:disabled) {
  border-color: var(--gold);
  background: var(--paper);
  box-shadow: 0 7px 18px rgba(120, 92, 52, 0.13);
  transform: translateY(-1px);
}

.round-btn:disabled {
  opacity: 0.28;
  cursor: default;
}

.page-counter {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  min-width: 82px;
  margin: 0;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.page-current {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
  color: var(--gold-deep);
}

.page-total {
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.slider-wrap {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  min-width: 70px;
}

.page-slider {
  --fill: 0%;
  width: 100%;
  height: 28px;
  margin: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.page-slider:disabled {
  cursor: default;
  opacity: 0.45;
}

.page-slider::-webkit-slider-runnable-track {
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(
    to right,
    var(--gold) 0,
    var(--gold) var(--fill),
    rgba(125, 94, 53, 0.2) var(--fill),
    rgba(125, 94, 53, 0.2) 100%
  );
}

.page-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -6px;
  border: 1.5px solid var(--gold);
  border-radius: 50%;
  background: var(--ivory);
  box-shadow: 0 2px 7px rgba(90, 65, 35, 0.25);
}

.page-slider::-moz-range-track {
  height: 2px;
  border-radius: 2px;
  background: rgba(125, 94, 53, 0.2);
}

.page-slider::-moz-range-progress {
  height: 2px;
  border-radius: 2px;
  background: var(--gold);
}

.page-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 1.5px solid var(--gold);
  border-radius: 50%;
  background: var(--ivory);
}

.zoom-group {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-left: clamp(10px, 1.6vw, 20px);
  border-left: 1px solid var(--line-soft);
}

.zoom-label {
  margin-right: 6px;
  font-size: 8.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.zoom-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--gold-deep);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.zoom-btn:hover:not(:disabled) {
  border-color: var(--line);
  background: rgba(255, 253, 249, 0.8);
}

.zoom-btn:disabled {
  opacity: 0.28;
  cursor: default;
}

.zoom-value {
  min-width: 42px;
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.05em;
  text-align: center;
  color: var(--muted);
}

.zoom-fit {
  margin-left: 4px;
  padding: 6px 8px;
  border: 0;
  background: transparent;
  color: var(--gold-deep);
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
}

.zoom-fit:hover:not(:disabled) {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.zoom-fit:disabled {
  opacity: 0.28;
  cursor: default;
}

.fs-bottom {
  flex: 0 0 auto;
}

/* --------------------------------------------------------------------------
   iOS immersive fullscreen fallback
   -------------------------------------------------------------------------- */

html.is-immersive .site-header {
  display: none;
}

html.is-immersive .app {
  height: 100vh;
  height: 100dvh;
}

.immersive-exit {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  right: calc(env(safe-area-inset-right, 0px) + 12px);
  z-index: 80;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(250, 246, 238, 0.94);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: var(--gold-deep);
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
}

.immersive-exit svg {
  width: 13px;
  height: 13px;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 980px) {
  .zoom-label {
    display: none;
  }
}

@media (max-width: 700px) {
  .site-header {
    padding-top: calc(10px + env(safe-area-inset-top));
    padding-bottom: 10px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
    font-size: 19px;
  }

  .brand-hotel {
    font-size: 10px;
    letter-spacing: 0.16em;
  }

  .brand-city {
    font-size: 8px;
    letter-spacing: 0.28em;
  }

  .catalog-eyebrow {
    font-size: 8px;
    letter-spacing: 0.2em;
  }

  .catalog-name {
    font-size: 21px;
  }

  .icon-btn {
    width: 36px;
    height: 36px;
  }

  .icon-btn svg {
    width: 16px;
    height: 16px;
  }

  .toolbar {
    padding-top: 8px;
  }

  .toolbar-inner {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-areas:
      'nav counter fs'
      'slider slider zoom';
    gap: 4px 10px;
  }

  .nav-group {
    grid-area: nav;
  }

  .page-counter {
    grid-area: counter;
    justify-self: center;
    min-width: 0;
  }

  .slider-wrap {
    grid-area: slider;
    min-width: 0;
    padding: 0 2px;
  }

  .zoom-group {
    grid-area: zoom;
    justify-self: end;
    padding-left: 0;
    border-left: 0;
  }

  .fs-bottom {
    grid-area: fs;
    justify-self: end;
  }

  .round-btn {
    width: 38px;
    height: 38px;
  }

  .round-btn svg {
    width: 17px;
    height: 17px;
  }

  .zoom-fit {
    display: none;
  }

  .page-current {
    font-size: 16px;
  }
}

@media (max-width: 480px) {
  .brand-word {
    display: none;
  }

  .catalog-name {
    font-size: 20px;
  }

  .brand-mark {
    width: 32px;
    height: 32px;
    font-size: 18px;
  }

  .site-header {
    gap: 8px;
    padding-left: 12px;
    padding-right: 12px;
  }

  .error-inner {
    padding: 28px 22px;
  }

  .error-text {
    font-size: 13px;
  }
}

@media (max-width: 380px) {
  .catalog-eyebrow {
    display: none;
  }

  .catalog-name {
    font-size: 19px;
  }

  .zoom-value {
    min-width: 36px;
  }

  .zoom-btn {
    width: 27px;
  }

  .toolbar-inner {
    gap: 3px 8px;
  }

  .page-total {
    letter-spacing: 0.06em;
  }
}

@media (max-height: 600px) and (orientation: landscape) {
  .site-header {
    padding-top: calc(6px + env(safe-area-inset-top));
    padding-bottom: 6px;
  }

  .catalog-eyebrow {
    display: none;
  }

  .brand-mark {
    width: 30px;
    height: 30px;
    font-size: 17px;
  }

  .toolbar {
    padding-top: 6px;
    padding-bottom: calc(6px + env(safe-area-inset-bottom));
  }

  .nav-group,
  .zoom-group,
  .fs-bottom {
    display: none;
  }

  .toolbar-inner {
    display: flex;
    gap: 12px;
  }

  .slider-wrap {
    order: 2;
  }

  .page-counter {
    order: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* --------------------------------------------------------------------------
   Empty state (no catalog PDF supplied yet)
   -------------------------------------------------------------------------- */

html.is-empty .toolbar {
  display: none;
}

.empty-state {
  position: absolute;
  inset: 0;
  z-index: 35;
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  align-items: center;
  justify-items: center;
  gap: clamp(24px, 4vw, 64px);
  padding: clamp(20px, 4vw, 56px);
  overflow: auto;
  background:
    radial-gradient(900px 520px at 12% 8%, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0) 60%),
    radial-gradient(760px 480px at 92% 104%, rgba(201, 172, 124, 0.2), rgba(201, 172, 124, 0) 66%),
    var(--ivory);
}

.empty-visual {
  position: relative;
  width: min(100%, 400px);
  max-height: 72vh;
  aspect-ratio: 703 / 1012;
  margin: 0;
  justify-self: end;
}

.empty-cover {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 1px solid rgba(168, 131, 79, 0.35);
  box-shadow:
    0 36px 70px -34px rgba(56, 40, 20, 0.62),
    0 12px 26px -16px rgba(56, 40, 20, 0.4);
  transform: rotate(-1.2deg);
}

.empty-frame {
  position: absolute;
  inset: -14px;
  border: 1px solid rgba(168, 131, 79, 0.28);
  pointer-events: none;
}

.empty-visual.no-cover {
  display: none;
}

.empty-card {
  position: relative;
  z-index: 1;
  width: min(100%, 470px);
  padding: clamp(28px, 4vw, 50px);
  border: 1px solid var(--line-soft);
  background: rgba(255, 253, 249, 0.86);
  box-shadow: 0 40px 90px -62px rgba(70, 50, 25, 0.6);
  text-align: center;
}

.empty-kicker {
  margin: 0 0 14px;
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--gold-deep);
}

.empty-title {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(28px, 3.2vw, 40px);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink);
}

.empty-title::after {
  content: '';
  display: block;
  width: 46px;
  height: 1px;
  margin: 18px auto 0;
  background: var(--gold);
  opacity: 0.6;
}

.empty-sub {
  margin: 16px 0 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 17px;
  line-height: 1.5;
  color: var(--muted);
}

.empty-cta {
  width: 100%;
  min-height: 50px;
  margin-top: 26px;
}

.empty-hint {
  margin: 14px 0 0;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--muted);
}

.empty-drop-hint {
  margin: 7px 0 0;
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
}

.empty-note {
  margin: 18px 0 0;
  padding: 10px 12px;
  border: 1px solid rgba(168, 131, 79, 0.32);
  background: rgba(255, 253, 249, 0.9);
  font-size: 12px;
  line-height: 1.6;
  color: var(--ink);
}

.empty-privacy {
  margin: 20px 0 0;
  font-size: 9.5px;
  letter-spacing: 0.08em;
  color: var(--muted);
  opacity: 0.85;
}

/* --------------------------------------------------------------------------
   PDF preview dialog
   -------------------------------------------------------------------------- */

.pdf-preview {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: clamp(14px, 3vw, 36px);
  overflow: auto;
  background: rgba(44, 33, 20, 0.56);
  -webkit-backdrop-filter: blur(7px);
  backdrop-filter: blur(7px);
}

.preview-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  width: min(940px, 100%);
  margin: auto;
  border: 1px solid rgba(255, 253, 249, 0.4);
  background: var(--paper);
  box-shadow: 0 50px 120px -40px rgba(30, 20, 8, 0.75);
}

.preview-media {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 340px;
  padding: clamp(16px, 3vw, 30px);
  background:
    radial-gradient(420px 320px at 50% 30%, #fffdf8, rgba(255, 253, 248, 0) 70%),
    linear-gradient(160deg, #f4ecdf, #ece0cc);
}

.preview-media canvas {
  display: block;
  max-width: 100%;
  max-height: min(64vh, 580px);
  width: auto;
  height: auto;
  background: #fff;
  box-shadow: 0 22px 44px -26px rgba(56, 40, 20, 0.6);
}

.preview-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 20px;
  background: rgba(250, 246, 238, 0.9);
  text-align: center;
}

.preview-spinner {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(168, 131, 79, 0.28);
  border-top-color: var(--gold-deep);
  border-radius: 50%;
  animation: spin 1.05s linear infinite;
}

.preview-loading-text {
  font-size: 9px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--muted);
}

.preview-body {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(26px, 4vw, 46px);
}

.preview-kicker {
  margin: 0 0 8px;
  font-size: 9px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold-deep);
}

.preview-title {
  margin: 0;
  padding-right: 28px;
  font-family: var(--serif);
  font-size: clamp(24px, 2.6vw, 32px);
  font-weight: 600;
  line-height: 1.15;
  color: var(--ink);
}

.preview-meta {
  display: grid;
  gap: 0;
  margin: 20px 0 0;
  border-top: 1px solid var(--line-soft);
}

.preview-meta > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-soft);
}

.preview-meta dt {
  flex: 0 0 auto;
  font-size: 8.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.preview-meta dd {
  margin: 0;
  max-width: 64%;
  overflow-wrap: anywhere;
  font-size: 12.5px;
  text-align: right;
  color: var(--ink);
}

.preview-error {
  margin: 16px 0 0;
  padding: 10px 12px;
  border: 1px solid rgba(138, 59, 44, 0.28);
  background: rgba(138, 59, 44, 0.07);
  font-size: 12px;
  line-height: 1.6;
  color: #7c3426;
}

.preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.preview-actions .btn-primary,
.preview-actions .btn-ghost {
  flex: 1 1 150px;
}

.preview-close {
  position: absolute;
  top: 10px;
  right: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 253, 249, 0.7);
  color: var(--gold-deep);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.preview-close:hover {
  border-color: var(--gold);
  background: var(--paper);
}

.preview-close svg {
  width: 14px;
  height: 14px;
}

/* --------------------------------------------------------------------------
   Drag overlay + toast
   -------------------------------------------------------------------------- */

.drop-curtain {
  position: fixed;
  inset: 0;
  z-index: 85;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(250, 246, 238, 0.82);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  pointer-events: none;
}

.drop-curtain-inner {
  padding: clamp(28px, 5vw, 52px) clamp(34px, 7vw, 76px);
  border: 2px dashed rgba(168, 131, 79, 0.7);
  background: rgba(255, 253, 249, 0.92);
  text-align: center;
}

.drop-mark {
  display: inline-grid;
  place-items: center;
  width: 54px;
  height: 66px;
  border: 1px solid var(--gold);
  color: var(--gold-deep);
  font-size: 10px;
  letter-spacing: 0.16em;
}

.drop-curtain-inner p {
  margin: 16px 0 0;
  font-family: var(--serif);
  font-size: 20px;
  color: var(--ink);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 90px);
  z-index: 95;
  width: max-content;
  max-width: min(92vw, 480px);
  margin: 0;
  padding: 12px 18px;
  transform: translateX(-50%);
  background: #392e21;
  color: #fdf9f1;
  font-size: 12px;
  line-height: 1.55;
  text-align: center;
  box-shadow: 0 18px 40px -18px rgba(30, 20, 8, 0.7);
}

.file-input {
  position: fixed;
  top: -12px;
  left: -12px;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   Empty state / preview — responsive
   -------------------------------------------------------------------------- */

@media (max-width: 860px) {
  .empty-state {
    grid-template-columns: minmax(0, 1fr);
    align-content: center;
    padding: 24px 18px calc(24px + env(safe-area-inset-bottom));
  }

  .empty-state::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: var(--empty-cover, none);
    background-size: cover;
    background-position: center 30%;
    opacity: 0.09;
    pointer-events: none;
  }

  .empty-visual {
    display: none;
  }

  .empty-card {
    width: min(100%, 520px);
  }

  .preview-card {
    grid-template-columns: minmax(0, 1fr);
    max-height: 92vh;
    overflow: auto;
  }

  .preview-media {
    min-height: 210px;
    padding: 18px;
  }

  .preview-media canvas {
    max-height: 34vh;
  }

  .preview-body {
    padding: 24px 22px 30px;
  }
}

@media (max-height: 640px) and (orientation: landscape) {
  .empty-state {
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
    gap: 24px;
    padding: 14px 20px;
  }

  .empty-visual {
    max-height: 82vh;
  }

  .empty-card {
    padding: 22px 26px;
  }

  .empty-cta {
    min-height: 44px;
    margin-top: 18px;
  }

  .empty-sub {
    margin-top: 10px;
  }

  .empty-hint,
  .empty-drop-hint,
  .empty-privacy {
    margin-top: 8px;
  }

  .preview-card {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    max-height: 94vh;
  }

  .preview-media canvas {
    max-height: 78vh;
  }
}
