/* ============================================================================
   闲敲木鱼 / Zen Fish — landing page styles
   Pure CSS, no build, no external fonts. Design tokens mirror the app
   (lib/ui/app_background.dart) and the screenshot generator THEME.
   ========================================================================== */

:root {
  /* palette */
  --bg: #17120d;
  --bg0: #211812;
  --bg1: #0b0806;
  --bg-grad: radial-gradient(120% 85% at 50% 0%, var(--bg0) 0%, var(--bg1) 72%);
  --card: #211a12;
  --border: #3a2e1f;
  --accent: #ffd54f;
  --accent-soft: rgba(255, 213, 79, 0.12);
  --accent-line: rgba(255, 213, 79, 0.45);
  --fg: #f6ecdb;
  --muted: #c3b095;
  --chevron: #8a7a5e;
  --glow: rgba(255, 196, 84, 0.2);

  /* type */
  --serif: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC",
    "Shippori Mincho", "Georgia", serif;
  --sans: "PingFang SC", "Noto Sans SC", "Hiragino Sans GB", "Microsoft YaHei",
    -apple-system, "Helvetica Neue", sans-serif;

  /* layout */
  --maxw: 1160px;
  --gutter: clamp(1.1rem, 4vw, 2.5rem);
  --radius: 18px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--fg);
  background: var(--bg1);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.6;
}

img {
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3 {
  font-family: var(--serif);
  font-weight: 600;
  margin: 0;
  line-height: 1.16;
}

.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  padding-block: clamp(3.5rem, 9vw, 6.5rem);
}

.section-head {
  text-align: center;
  max-width: 38rem;
  margin: 0 auto clamp(2rem, 5vw, 3.25rem);
}

.section-head h2 {
  font-size: clamp(1.7rem, 4.5vw, 2.6rem);
}

.section-head p {
  margin: 0.8rem 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 2.5vw, 1.1rem);
}

/* ----------------------------------------------------------------- nav --- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.7rem var(--gutter);
  background: rgba(18, 13, 9, 0.72);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 600;
}

.brand-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}

.nav-links {
  display: flex;
  gap: clamp(0.8rem, 2.5vw, 1.8rem);
  margin-left: auto;
  font-size: 0.95rem;
  color: var(--muted);
}

.nav-links a:hover,
.nav-links a:focus-visible {
  color: var(--fg);
}

/* visible keyboard focus for text links */
.nav-links a:focus-visible,
.link-privacy:focus-visible,
.footer-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* language switch */
.lang-switch {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.25);
}

.nav .lang-switch {
  margin-left: 0.4rem;
}

.lang-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.35rem 0.8rem;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}

.lang-btn.is-active {
  background: var(--accent-soft);
  color: var(--accent);
}

.lang-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* ---------------------------------------------------------------- hero --- */
.hero {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: -2;
  background: var(--bg-grad);
}

.hero-bg::before {
  /* ink-wash mountain, top-aligned cover */
  content: "";
  position: absolute;
  inset: 0;
  background: url("../assets/bg-ink-mountain.webp") center top / cover no-repeat;
  opacity: 0.55;
  mask-image: linear-gradient(to bottom, #000 0%, #000 55%, transparent 100%);
  -webkit-mask-image: linear-gradient(
    to bottom,
    #000 0%,
    #000 55%,
    transparent 100%
  );
}

.hero-bg::after {
  /* warm glow + vignette */
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(60% 50% at 62% 58%, var(--glow) 0%, transparent 70%),
    radial-gradient(110% 80% at 50% 38%, transparent 55%, rgba(0, 0, 0, 0.5) 100%);
  pointer-events: none;
}

.hero-inner {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  align-items: center;
  gap: clamp(2rem, 5vw, 4rem);
  padding-block: clamp(3rem, 8vw, 6rem);
  min-height: min(86vh, 760px);
}

.hero-head {
  font-size: clamp(2.6rem, 7vw, 4.5rem);
  letter-spacing: 0.01em;
  text-shadow: 0 2px 28px rgba(0, 0, 0, 0.55);
}

.hero-sub {
  margin: 1.2rem 0 0;
  max-width: 30rem;
  font-size: clamp(1.05rem, 2.6vw, 1.3rem);
  color: var(--muted);
}

/* download badges */
.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-top: 2rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.05), rgba(0, 0, 0, 0.2));
  color: var(--fg);
  cursor: pointer;
  transition: border-color 0.18s ease, transform 0.18s ease;
}

.badge:hover,
.badge:focus-visible {
  border-color: var(--accent-line);
  transform: translateY(-2px);
}

.badge:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.badge svg {
  width: 26px;
  height: 26px;
  flex: none;
  fill: currentColor;
}

.badge-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  text-align: left;
}

.badge-text small {
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  color: var(--accent);
  text-transform: uppercase;
}

.badge-text strong {
  font-size: 1.05rem;
  font-weight: 600;
}

/* ------------------------------------------------------- interactive muyu */
.hero-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.muyu-stage {
  position: relative;
  width: clamp(240px, 32vw, 360px);
  /* in-game fish box aspect (fishW/fishH, kFishAspect=1.2195). The fish fills it
     (object-fit:fill, like the app's BoxFit.fill) so the dart anchor math lands
     the mallet exactly as in muyu_game.dart. */
  aspect-ratio: 1.2195;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  filter: drop-shadow(0 22px 36px rgba(0, 0, 0, 0.5));
}

.muyu-stage:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 12px;
  border-radius: 24px;
}

.muyu-fish {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
  transform-origin: 50% 50%;
  will-change: transform;
}

/* Mallet placed exactly per the dart code (lib/game/muyu_game.dart _layoutMetrics
   + lib/game/strike_alignment.dart hammerPivotFor):
     anchor = bottomRight (the grip), rest angle = 0 (no rotation — head points
     up-left as drawn, handle slopes gently down-right), size 0.68·W × 0.27·W,
     grip placed at pivot = fishCenter + (0.685·W, −0.270·W).
   With the fish box = the stage (W × H, H=W/1.2195) and fishCenter at its centre:
     pivot = (1.185·W, 0.140·W) → box top-left (0.505·W, −0.130·W)
     → left 50.5% (of W), top −15.9% (of H), width 68%, transform-origin grip. */
.muyu-hammer {
  position: absolute;
  top: -15.9%;
  left: 50.5%;
  width: 68%;
  transform-origin: 100% 100%; /* bottom-right grip = pivot (Anchor.bottomRight) */
  transform: rotate(0deg); /* dart rest angle = 0 */
  pointer-events: none;
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.4));
  will-change: transform;
}

.muyu-count {
  position: absolute;
  top: -2.2rem;
  left: 0; /* top-left, clear of the head (top-centre) and handle (right) */
  white-space: nowrap;
  font-size: 0.95rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.muyu-count-num {
  font-family: var(--serif);
  font-size: 1.4rem;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.muyu-floats {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
}

.muyu-float {
  position: absolute;
  left: 50%;
  top: 24%;
  transform: translateX(-50%);
  font-family: var(--serif);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--accent);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
}

.muyu-hint {
  margin: 0;
  font-size: 0.85rem;
  color: #a8957a; /* lighter than --chevron for >5:1 contrast on the dark hero */
}

/* --------------------------------------------------------------- pills --- */
.pills-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.7rem;
  padding: clamp(1.5rem, 4vw, 2.25rem) var(--gutter);
  border-block: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(0, 0, 0, 0.18);
}

.pill {
  font-size: 0.92rem;
  color: var(--fg);
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 0.4rem 1rem;
  white-space: nowrap;
}

/* ------------------------------------------------------------ features --- */
.features {
  background: var(--bg-grad);
}

.feature-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: clamp(1.5rem, 5vw, 4rem);
  margin-block: clamp(2.5rem, 6vw, 4.5rem);
}

.feature-row:nth-child(even) .feature-media {
  order: -1;
}

.feature-label {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 0.7rem;
}

.feature-head {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
}

.feature-desc {
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 2.4vw, 1.12rem);
  max-width: 26rem;
}

.feature-media {
  display: flex;
  justify-content: center;
}

/* CSS phone frame */
.phone-frame {
  width: 250px;
  max-width: 72vw;
  border-radius: 2rem;
  padding: 0.5rem;
  background: linear-gradient(160deg, #2a2118 0%, #140f0a 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 213, 79, 0.16),
    0 22px 55px rgba(0, 0, 0, 0.55);
}

.phone-frame img {
  display: block;
  width: 100%;
  aspect-ratio: 1080 / 2304;
  object-fit: cover;
  object-position: top;
  border-radius: 1.5rem;
  background: var(--bg1);
}

/* ------------------------------------------------------------- gallery --- */
.gallery {
  background: var(--bg1);
}

.gallery-track {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: clamp(0.8rem, 2vw, 1.4rem);
}

.gallery-track .phone-frame {
  width: 100%;
  border-radius: 1.4rem;
  padding: 0.35rem;
}

.gallery-track .phone-frame img {
  border-radius: 1.05rem;
}

/* --------------------------------------------------------------- trust --- */
.trust {
  background: radial-gradient(130% 90% at 50% 0%, #1a120d 0%, #070504 78%);
  text-align: center;
}

.trust-inner {
  max-width: 40rem;
  margin-inline: auto;
}

.trust h2 {
  font-size: clamp(1.7rem, 4.5vw, 2.5rem);
}

.trust-list {
  list-style: none;
  margin: 1.8rem 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.7rem 1rem;
}

.trust-list li {
  position: relative;
  padding-left: 1.6rem;
  color: var(--muted);
  font-size: 1.02rem;
}

.trust-list li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 700;
}

.link-privacy {
  display: inline-block;
  margin-top: 1.8rem;
  color: var(--accent);
  border-bottom: 1px solid var(--accent-line);
  padding-bottom: 2px;
  font-size: 1rem;
}

.link-privacy:hover,
.link-privacy:focus-visible {
  color: var(--fg);
  border-color: var(--fg);
}

/* ----------------------------------------------------------------- cta --- */
.cta {
  background: var(--bg-grad);
  text-align: center;
}

.cta-icon {
  width: 84px;
  height: 84px;
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.cta-name {
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  margin-top: 1rem;
}

.cta-sub {
  margin: 0.7rem 0 0;
  color: var(--muted);
}

.cta .badges {
  justify-content: center;
}

/* -------------------------------------------------------------- footer --- */
.footer {
  background: var(--bg1);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-block: 2rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.8rem 1.4rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.footer-tagline {
  font-family: var(--serif);
  color: var(--fg);
}

.footer-link:hover,
.footer-link:focus-visible {
  color: var(--accent);
}

.footer .lang-switch {
  background: transparent;
}

/* ------------------------------------------------------------ responsive */
@media (max-width: 860px) {
  .hero-inner {
    grid-template-columns: 1fr;
    text-align: center;
    min-height: 0;
  }

  .hero-sub {
    margin-inline: auto;
  }

  .badges {
    justify-content: center;
  }

  .hero-stage {
    order: -1;
  }

  .feature-row {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .feature-row:nth-child(even) .feature-media {
    order: 0;
  }

  .feature-desc {
    margin-inline: auto;
  }

  .gallery-track {
    grid-auto-flow: column;
    grid-auto-columns: minmax(200px, 60vw);
    grid-template-columns: none;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 0.6rem;
    -webkit-overflow-scrolling: touch;
  }

  .gallery-track .phone-frame {
    scroll-snap-align: center;
  }
}

@media (max-width: 560px) {
  .nav-links {
    display: none;
  }

  .muyu-stage {
    width: min(72vw, 300px);
  }
}

/* --------------------------------------------------- reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .badge:hover,
  .badge:focus-visible {
    transform: none;
  }
}
