:root {
  --ink: #1a1510;
  --ink-soft: #3d342c;
  --paper: #f3ebe0;
  --paper-deep: #e8dccb;
  --lacquer: #8b1e1e;
  --lacquer-hover: #6e1616;
  --wash: rgba(26, 21, 16, 0.06);
  --line: rgba(26, 21, 16, 0.18);
  --font-display: "Cormorant Garamond", "Songti SC", "Noto Serif SC", serif;
  --font-body: "Source Serif 4", "Iowan Old Style", "Palatino Linotype", serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --phone-w: 10.5rem;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--font-body);
  font-size: 1.125rem;
  line-height: 1.55;
  position: relative;
  overflow-x: hidden;
}

a {
  color: var(--lacquer);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--lacquer-hover);
}

.ink-wash {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 90% 55% at 8% -10%, rgba(26, 21, 16, 0.11), transparent 55%),
    radial-gradient(ellipse 70% 45% at 92% 15%, rgba(139, 30, 30, 0.07), transparent 50%),
    radial-gradient(ellipse 60% 40% at 70% 95%, rgba(26, 21, 16, 0.08), transparent 55%),
    linear-gradient(165deg, var(--paper) 0%, var(--paper-deep) 100%);
}

.ink-wash::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.45'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

.brush-mark {
  position: fixed;
  right: -0.05em;
  top: 12vh;
  font-family: var(--font-display);
  font-size: clamp(10rem, 28vw, 22rem);
  font-weight: 600;
  line-height: 1;
  color: var(--ink);
  opacity: 0.045;
  pointer-events: none;
  z-index: 0;
  user-select: none;
  transform: rotate(-6deg);
}

.site-header,
main,
.site-footer {
  position: relative;
  z-index: 1;
}

.site-header {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
  padding: 1.5rem clamp(1.25rem, 4vw, 3.5rem) 0;
  max-width: 72rem;
  margin: 0 auto;
}

.brand-mark {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark:hover {
  color: var(--lacquer);
}

.brand-zi {
  font-family: var(--font-display);
  font-size: 1.1rem;
  opacity: 0.45;
}

.hero {
  max-width: 72rem;
  margin: 0 auto;
  padding: clamp(2.5rem, 8vh, 5.5rem) clamp(1.25rem, 4vw, 3.5rem) clamp(3rem, 8vh, 5rem);
  display: grid;
  gap: clamp(2.5rem, 5vw, 4rem);
  align-items: center;
}

@media (min-width: 960px) {
  .hero {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    gap: 2rem 3rem;
  }
}

.hero-pinyin {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  letter-spacing: 0.22em;
  text-transform: lowercase;
  color: var(--ink-soft);
  opacity: 0;
  transform: translateY(12px);
  animation: rise 0.9s var(--ease) 0.1s forwards;
}

.hero-brand {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(4rem, 12vw, 7.5rem);
  font-weight: 600;
  line-height: 0.92;
  letter-spacing: -0.02em;
  opacity: 0;
  transform: translateY(18px);
  animation: rise 1s var(--ease) 0.2s forwards;
}

.hero-line {
  margin: 1.35rem 0 0;
  max-width: 22ch;
  font-family: var(--font-display);
  font-size: clamp(1.55rem, 3.2vw, 2.05rem);
  font-weight: 500;
  line-height: 1.25;
  opacity: 0;
  transform: translateY(14px);
  animation: rise 1s var(--ease) 0.35s forwards;
}

.hero-support {
  margin: 1rem 0 0;
  max-width: 34rem;
  color: var(--ink-soft);
  font-size: 1.05rem;
  opacity: 0;
  transform: translateY(14px);
  animation: rise 1s var(--ease) 0.45s forwards;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-top: 2rem;
  opacity: 0;
  transform: translateY(14px);
  animation: rise 1s var(--ease) 0.55s forwards;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0.7rem 1.45rem;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  border: 1.5px solid var(--ink);
  text-decoration: none;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.2s var(--ease);
}

.btn-primary {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.btn-primary:hover {
  background: var(--lacquer);
  border-color: var(--lacquer);
  color: var(--paper);
}

.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  border-style: dashed;
  border-color: var(--line);
  cursor: default;
}

.btn-sm {
  min-height: 2.6rem;
  padding: 0.55rem 1.15rem;
  font-size: 0.95rem;
}

.install-hint {
  margin: 1.1rem 0 0;
  max-width: 34rem;
  font-size: 0.88rem;
  color: var(--ink-soft);
  opacity: 0;
  animation: rise 1s var(--ease) 0.7s forwards;
}

/* —— Phone deck (auto-rotating) —— */
.hero-visual {
  justify-self: center;
  width: 100%;
  max-width: 22rem;
  opacity: 0;
  transform: translateY(20px);
  animation: rise 1.1s var(--ease) 0.4s forwards;
  overflow: visible;
}

.phone-deck {
  position: relative;
  width: var(--phone-w);
  aspect-ratio: 320 / 652;
  margin: 1.5rem auto 0;
  padding: 0 2.75rem 1.25rem;
  box-sizing: content-box;
  overflow: visible;
}

.phone-card {
  position: absolute;
  top: 0;
  left: 2.75rem;
  width: var(--phone-w);
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
  filter: drop-shadow(0 12px 20px rgba(26, 21, 16, 0.28));
  transition: transform 0.55s var(--ease), filter 0.55s var(--ease), opacity 0.55s var(--ease);
  -webkit-tap-highlight-color: transparent;
  will-change: transform;
}

.phone-card img {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  pointer-events: none;
  user-select: none;
}

/* fan positions: 0 = front, 1 = mid-right, 2 = mid-left, 3 = back */
.phone-card[data-stack="0"] {
  z-index: 4;
  transform: translate(0, 0) rotate(-1.2deg) scale(1);
  opacity: 1;
}

.phone-card[data-stack="1"] {
  z-index: 3;
  transform: translate(1.7rem, 0.4rem) rotate(6deg) scale(0.93);
  opacity: 0.96;
}

.phone-card[data-stack="2"] {
  z-index: 2;
  transform: translate(-1.7rem, 0.55rem) rotate(-7deg) scale(0.9);
  opacity: 0.92;
}

.phone-card[data-stack="3"] {
  z-index: 1;
  transform: translate(0.45rem, 0.85rem) rotate(3.5deg) scale(0.87);
  opacity: 0.88;
}

.phone-card[data-stack="4"] {
  z-index: 0;
  transform: translate(-0.55rem, 1.1rem) rotate(-4deg) scale(0.82);
  opacity: 0.72;
}

.deck-caption {
  margin: 1rem 0 0;
  text-align: center;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.deck-progress {
  width: min(100%, 11rem);
  height: 2px;
  margin: 0.7rem auto 0;
  background: rgba(26, 21, 16, 0.12);
  overflow: hidden;
  border-radius: 999px;
}

.deck-progress-bar {
  width: 0%;
  height: 100%;
  background: var(--lacquer);
  transform-origin: left center;
}

.deck-progress-bar.is-running {
  animation: deck-progress linear forwards;
}

.deck-progress-bar.is-paused {
  animation-play-state: paused;
}

.deck-dots {
  display: flex;
  justify-content: center;
  gap: 0.45rem;
  margin-top: 0.7rem;
}

.deck-dot {
  width: 0.5rem;
  height: 0.5rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(26, 21, 16, 0.22);
  cursor: pointer;
  transition: background 0.2s var(--ease), transform 0.2s var(--ease);
}

.deck-dot.is-active {
  background: var(--lacquer);
  transform: scale(1.2);
}

@keyframes deck-progress {
  from { width: 0%; }
  to { width: 100%; }
}

/* —— Lightbox —— */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 1.25rem;
}

.lightbox[hidden] {
  display: none !important;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  margin: 0;
  padding: 0;
  background: rgba(18, 14, 10, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  cursor: pointer;
}

.lightbox-dialog {
  position: relative;
  z-index: 1;
  max-width: min(22rem, 92vw);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: lightbox-in 0.28s var(--ease);
}

.lightbox-img {
  display: block;
  width: 100%;
  height: auto;
  max-height: calc(92vh - 3.5rem);
  object-fit: contain;
  filter: drop-shadow(0 24px 48px rgba(0, 0, 0, 0.45));
  user-select: none;
}

.lightbox-caption {
  margin: 0.85rem 0 0;
  color: rgba(243, 235, 224, 0.88);
  font-size: 0.95rem;
  text-align: center;
}

.lightbox-close {
  position: absolute;
  top: -0.35rem;
  right: -0.35rem;
  z-index: 2;
  width: 2.4rem;
  height: 2.4rem;
  border: 0;
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-size: 1.45rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

.lightbox-close:hover {
  background: var(--lacquer);
  color: var(--paper);
}

body.is-lightbox-open {
  overflow: hidden;
}

@keyframes lightbox-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.about,
.platforms,
.wishlist {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 4vw, 3.5rem) clamp(3.5rem, 9vh, 6rem);
}

.about h2,
.platforms h2,
.wishlist h2 {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 600;
  border-top: 1px solid var(--line);
  padding-top: 2.25rem;
}

.about-lead {
  margin: 0 0 2rem;
  max-width: 38rem;
  color: var(--ink-soft);
}

.features {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1.75rem;
}

@media (min-width: 720px) {
  .features {
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
  }
}

.features li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.85rem;
  align-items: start;
}

.feat-glyph {
  font-family: var(--font-display);
  font-size: 2.35rem;
  line-height: 1;
  color: var(--ink);
  opacity: 0.7;
}

.features strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.features p {
  margin: 0;
  font-size: 0.98rem;
  color: var(--ink-soft);
}

.platform-row {
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 640px) {
  .platform-row {
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
  }
}

.platform h3 {
  margin: 0 0 0.4rem;
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 600;
}

.platform p {
  margin: 0 0 1rem;
  color: var(--ink-soft);
  font-size: 1rem;
}

.platform-soon {
  opacity: 0.85;
}

.soon-badge {
  display: inline-block;
  padding: 0.4rem 0.85rem;
  border: 1.5px dashed var(--line);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.wishlist-form {
  max-width: 28rem;
  display: grid;
  gap: 1rem;
}

.wishlist-form .field {
  display: grid;
  gap: 0.35rem;
}

.wishlist-form .field span {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.wishlist-form input {
  width: 100%;
  min-height: 2.85rem;
  padding: 0.65rem 0.85rem;
  border: 1.5px solid var(--line);
  background: rgba(255, 255, 255, 0.35);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}

.wishlist-form input:focus {
  border-color: var(--ink);
  background: rgba(255, 255, 255, 0.55);
}

.wishlist-form .btn {
  justify-self: start;
  margin-top: 0.25rem;
}

.wishlist-form .btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.wishlist-msg {
  margin: 0;
  min-height: 1.35em;
  font-size: 0.95rem;
  color: var(--ink-soft);
}

.wishlist-msg.is-ok {
  color: #2f6f5e;
}

.wishlist-msg.is-err {
  color: var(--lacquer);
}

.site-footer {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 4vw, 3.5rem) 2.5rem;
}

.site-footer p {
  margin: 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  font-size: 0.92rem;
  color: var(--ink-soft);
}

.site-footer a {
  color: var(--ink);
}

@keyframes rise {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-pinyin,
  .hero-brand,
  .hero-line,
  .hero-support,
  .cta-row,
  .install-hint,
  .hero-visual,
  .lightbox-dialog {
    animation: none;
    opacity: 1;
    transform: none;
  }

  .phone-card {
    transition: none;
  }
}

@media (max-width: 480px) {
  :root {
    --phone-w: 9rem;
  }

  .phone-deck {
    padding: 0 2.2rem 1rem;
  }

  .phone-card {
    left: 2.2rem;
  }

  .phone-card[data-stack="1"] {
    transform: translate(1.3rem, 0.35rem) rotate(5deg) scale(0.93);
  }

  .phone-card[data-stack="2"] {
    transform: translate(-1.3rem, 0.5rem) rotate(-6deg) scale(0.9);
  }
}
