/* =========================================================
   FORMA — Premium editorial furniture hero
   Light · type-led · smooth GSAP motion
   ========================================================= */

:root {
  --bg: #f4f0e9;
  --paper: #fbf8f3;
  --ink: #14120f;
  --ink-soft: #4f4a42;
  --muted: #8a8378;
  --line: rgba(20, 18, 15, 0.1);
  --line-strong: rgba(20, 18, 15, 0.18);
  --glass: rgba(251, 248, 243, 0.78);
  --white: #fffcf7;
  --accent: #8b6a45;

  --serif: "Cormorant Garamond", "Times New Roman", Georgia, serif;
  --sans: "DM Sans", system-ui, sans-serif;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0.05, 0.36, 1);
  --shadow-soft: 0 20px 60px rgba(20, 18, 15, 0.08);
  --shadow-btn: 0 14px 36px rgba(20, 18, 15, 0.16);
}

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

html,
body {
  height: 100%;
}

body {
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

button {
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

ul {
  list-style: none;
}

.page {
  width: 100%;
  height: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
}

/* ---------- Hero shell ---------- */
.hero {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
  touch-action: none;
  cursor: grab;
}

.hero.is-drag {
  cursor: grabbing;
}

/* ---------- Full-hero 3D stage ---------- */
.stage {
  position: absolute;
  inset: 0;
  z-index: 1;
  perspective: 1800px;
  perspective-origin: 50% 48%;
  background: var(--bg);
}

.stage__viewport {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
}

.slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  will-change: transform, opacity;
}

.slide__media {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #e7e1d6;
}

.slide__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.08);
  will-change: transform;
  filter: saturate(0.94) contrast(1.03) brightness(1.02);
}

/* Soft light wash — editorial, not muddy */
.slide__media::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(
      105deg,
      rgba(244, 240, 233, 0.94) 0%,
      rgba(244, 240, 233, 0.78) 18%,
      rgba(244, 240, 233, 0.32) 38%,
      rgba(244, 240, 233, 0.05) 55%,
      transparent 68%
    ),
    linear-gradient(
      0deg,
      rgba(244, 240, 233, 0.55) 0%,
      transparent 28%
    ),
    linear-gradient(
      180deg,
      rgba(244, 240, 233, 0.25) 0%,
      transparent 18%
    );
}

/* ---------- UI layer ---------- */
.ui {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}

/* Editorial content panel */
.panel {
  position: absolute;
  left: clamp(1.25rem, 5vw, 4.5rem);
  top: 50%;
  width: min(34rem, calc(100% - 2.5rem));
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  pointer-events: auto;
}

.panel__label {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1.35rem;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
}

.panel__label-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(139, 106, 69, 0.12);
}

.panel__title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(3.15rem, 7.5vw, 5.75rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
  color: var(--ink);
}

/* Extra room so Cormorant italic/descenders never get cut by the reveal mask */
.panel__mask {
  display: block;
  overflow: hidden;
  padding: 0.12em 0.12em 0.18em 0.04em;
  margin: -0.08em -0.12em -0.1em -0.04em;
}

.panel__title-line {
  display: block;
  padding-bottom: 0.06em;
  will-change: transform;
  /* Keep glyphs fully painted during GSAP transforms */
  backface-visibility: hidden;
  -webkit-font-smoothing: antialiased;
}

.panel__title-line--soft {
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.015em;
  color: #3a342c;
  /* Italic overhangs need a little more horizontal room */
  padding-right: 0.08em;
}

.panel__desc {
  max-width: 32ch;
  margin-top: 1.35rem;
  font-size: clamp(0.9375rem, 1.15vw, 1.0625rem);
  font-weight: 400;
  line-height: 1.7;
  letter-spacing: -0.01em;
  color: var(--ink-soft);
}

.panel__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 1.25rem;
}

.panel__tags li {
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(251, 248, 243, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.panel__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem 1.75rem;
  margin-top: 1.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  width: 100%;
  max-width: 28rem;
}

.panel__price {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 5.5rem;
}

.panel__price-label {
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.panel__price-value {
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.panel__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  height: 3rem;
  padding: 0 1.25rem;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition:
    transform 0.45s var(--ease-out),
    background 0.35s ease,
    border-color 0.35s ease,
    box-shadow 0.45s var(--ease-out),
    color 0.3s ease;
}

.btn__icon {
  display: grid;
  place-items: center;
  transition: transform 0.45s var(--ease-out);
}

.btn--fill {
  background: var(--ink);
  color: var(--white);
  box-shadow: var(--shadow-btn);
}

.btn--fill:hover {
  transform: translateY(-2px);
  background: #000;
  box-shadow: 0 18px 44px rgba(20, 18, 15, 0.22);
}

.btn--fill:hover .btn__icon {
  transform: translateX(3px);
}

.btn--ghost {
  border: 1px solid var(--line-strong);
  background: rgba(251, 248, 243, 0.5);
  backdrop-filter: blur(8px);
  color: var(--ink);
}

.btn--ghost:hover {
  border-color: var(--ink);
  background: var(--white);
}

/* ---------- Controls — bottom right, compact ---------- */
.controls {
  position: absolute;
  right: clamp(1.25rem, 4vw, 3rem);
  bottom: clamp(1.35rem, 3.5vh, 2.5rem);
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.55rem 0.55rem 0.55rem 1.15rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--glass);
  backdrop-filter: blur(16px) saturate(1.1);
  -webkit-backdrop-filter: blur(16px) saturate(1.1);
  box-shadow: var(--shadow-soft);
  pointer-events: auto;
  width: max-content;
}

.odometer {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  user-select: none;
}

.odometer__window {
  position: relative;
  height: 1.55rem;
  overflow: hidden;
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 500;
  line-height: 1.55rem;
  letter-spacing: 0.02em;
  color: var(--ink);
}

.odometer__wheel {
  display: flex;
  flex-direction: column;
  will-change: transform;
}

.odometer__wheel span {
  display: block;
  height: 1.55rem;
  line-height: 1.55rem;
  font-variant-numeric: tabular-nums;
}

.odometer__sep {
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.08em;
}

.odometer__total {
  font-family: var(--serif);
  font-size: 0.9375rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  padding-right: 0.15rem;
}

.controls__nav {
  display: flex;
  gap: 0.35rem;
}

.ctrl {
  width: 2.65rem;
  height: 2.65rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: rgba(255, 252, 247, 0.85);
  color: var(--ink);
  transition:
    transform 0.4s var(--ease-out),
    background 0.3s ease,
    border-color 0.3s ease;
}

.ctrl:hover {
  background: var(--white);
  border-color: var(--ink);
  transform: scale(1.06);
}

.ctrl:active {
  transform: scale(0.94);
}

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .panel {
    top: auto;
    bottom: 6.5rem;
    transform: none;
    width: calc(100% - 2.5rem);
  }

  .panel__title {
    font-size: clamp(2.5rem, 11vw, 3.25rem);
  }

  .panel__desc {
    max-width: 100%;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .panel__foot {
    margin-top: 1.25rem;
    padding-top: 1.15rem;
    gap: 1rem;
  }

  .btn--ghost {
    display: none;
  }

  .controls {
    right: 1rem;
    bottom: 1.1rem;
    padding: 0.45rem 0.45rem 0.45rem 0.95rem;
  }

  .slide__media::after {
    background:
      linear-gradient(
        180deg,
        rgba(244, 240, 233, 0.4) 0%,
        transparent 22%
      ),
      linear-gradient(
        0deg,
        rgba(244, 240, 233, 0.92) 0%,
        rgba(244, 240, 233, 0.75) 30%,
        rgba(244, 240, 233, 0.25) 55%,
        transparent 72%
      );
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
