/* ==========================================================================
   食跡 Moments — landing site styles
   Tokens copied 1:1 from moments-v2-repo/theme/tokens.css (the app's own
   design system). Two-color core: brand red + forest green. No new hues.
   ========================================================================== */

:root {
  /* Surfaces */
  --background: #F9F7F5;
  --foreground: #181D25;
  --card: #F4F2F0;
  --muted: #ECEAE8;
  --muted-foreground: #697181;
  --border: #E5E0DC;
  --secondary: #E7E6DA;

  /* Brand */
  --brand-red: #A8362F;   /* splash / hero ground */
  --primary: #476D1D;     /* forest green — primary CTAs / links */
  --primary-hover: #3C5D18;
  --accent: #F40000;      /* pure red — use sparingly */
  --success: #2BAB6F;
  --warning: #F4C433;
  --ring: #E86131;        /* terracotta focus ring */
  --charcoal: #121212;    /* footer (dark theme bg) */
  --charcoal-card: #1F1F1F;
  --dark-red: #993333;    /* the dark-theme highlight */

  /* Type */
  --font-serif: "DM Serif Display", "Noto Serif TC", Georgia, serif;
  --font-sans: "DM Sans", "Noto Sans TC", ui-sans-serif, system-ui, sans-serif;

  --radius: 12px;
  --radius-lg: 16px;
  --radius-img: 28px;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-elevated: 0 10px 28px rgba(0, 0, 0, 0.12);

  --maxw: 1080px;
}

/* --- Reset / base --------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--foreground);
  background: var(--background);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-serif); font-weight: 400; line-height: 1.12; margin: 0 0 .4em; }
h1 { font-size: clamp(2.2rem, 6vw, 3.5rem); }
h2 { font-size: clamp(1.7rem, 4vw, 2.4rem); }
h3 { font-size: clamp(1.15rem, 2.4vw, 1.4rem); }
p { margin: 0 0 1rem; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; border-radius: 4px; }

.container { max-width: var(--maxw); margin-inline: auto; padding-inline: 20px; }
.eyebrow {
  font-size: .8rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  color: var(--primary); margin: 0 0 .6rem;
}
.lede { font-size: 1.15rem; color: var(--muted-foreground); max-width: 56ch; }
.section { padding: clamp(3.5rem, 8vw, 6rem) 0; }
.section--muted { background: var(--card); }
.center { text-align: center; }
.center .lede, .center .eyebrow { margin-inline: auto; }

/* --- Buttons (pill) ------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font-family: var(--font-sans); font-size: 1rem; font-weight: 600;
  padding: .85rem 1.6rem; border-radius: 9999px; border: 1.5px solid transparent;
  cursor: pointer; transition: transform .12s ease, background .15s ease, opacity .15s ease;
  text-decoration: none; line-height: 1;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn--primary { background: var(--primary); color: #fff; }
.btn--primary:hover { background: var(--primary-hover); }
.btn--light { background: #fff; color: var(--brand-red); }
.btn--ghost-light { background: transparent; color: #fff; border-color: rgba(255,255,255,.6); }
.btn--ghost-light:hover { background: rgba(255,255,255,.12); }
.btn--block { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; transform: none; }

/* --- Top bar -------------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(249, 247, 245, .85); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar__inner { display: flex; align-items: center; gap: 1rem; height: 60px; }
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 600; color: var(--foreground); }
.brand:hover { text-decoration: none; }
.brand img { width: 32px; height: 32px; border-radius: 22%; }
.brand b { font-family: var(--font-serif); font-weight: 400; font-size: 1.25rem; }
.topbar__spacer { flex: 1; }
.navlink { color: var(--muted-foreground); font-weight: 500; font-size: .95rem; }
.topbar .navlink { display: none; }
@media (min-width: 760px) { .topbar .navlink { display: inline; } }

/* Language toggle */
.langtoggle { display: inline-flex; border: 1px solid var(--border); border-radius: 9999px; overflow: hidden; background: #fff; }
.langtoggle button {
  font: inherit; font-size: .85rem; font-weight: 600; border: 0; background: transparent;
  color: var(--muted-foreground); padding: .35rem .7rem; cursor: pointer;
}
.langtoggle button[aria-pressed="true"] { background: var(--primary); color: #fff; }

/* --- Hero (brand red) ----------------------------------------------------- */
.hero {
  position: relative; overflow: hidden;
  background: var(--brand-red); color: #fff;
  padding: clamp(3.5rem, 9vw, 6.5rem) 0 clamp(4rem, 9vw, 7rem);
}
/* Signature: faint dotted "trace" paths in the hero ground */
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .14;
  background-image:
    radial-gradient(circle, #fff 1.4px, transparent 1.6px),
    radial-gradient(circle, #fff 1.4px, transparent 1.6px);
  background-size: 26px 26px, 26px 26px;
  background-position: 0 0, 13px 13px;
  -webkit-mask-image: linear-gradient(115deg, transparent 18%, #000 40%, transparent 72%);
          mask-image: linear-gradient(115deg, transparent 18%, #000 40%, transparent 72%);
}
.hero__inner { position: relative; display: grid; gap: 2.5rem; align-items: center; }
@media (min-width: 880px) { .hero__inner { grid-template-columns: 1.1fr .9fr; } }
.hero__logo { width: 84px; height: 84px; border-radius: 22%; box-shadow: var(--shadow-elevated); margin-bottom: 1.4rem; }
.hero h1 { color: #fff; letter-spacing: .01em; }
.hero__tagline { font-size: 1.3rem; color: rgba(255,255,255,.92); margin-bottom: .4rem; }
.hero__sub { color: rgba(255,255,255,.82); max-width: 48ch; }
.hero__cta { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1.8rem; }
.hero__note { margin-top: 1rem; font-size: .85rem; color: rgba(255,255,255,.72); }

/* Phone frame */
.phone {
  --bezel: 10px;
  width: 100%; max-width: 300px; margin-inline: auto;
  background: #0e0e0e; border-radius: 38px; padding: var(--bezel);
  box-shadow: var(--shadow-elevated); border: 1px solid rgba(0,0,0,.2);
}
.phone img { border-radius: 28px; width: 100%; aspect-ratio: 390 / 844; object-fit: cover; background: var(--muted); }
.hero .phone { transform: rotate(2.5deg); }

/* --- Trace divider (signature, used between sections) --------------------- */
.trace { display: flex; align-items: center; justify-content: center; gap: .75rem; color: var(--border); padding: .5rem 0; }
.trace::before, .trace::after {
  content: ""; height: 0; flex: 1; max-width: 160px;
  border-top: 2px dotted color-mix(in srgb, var(--brand-red) 35%, var(--border));
}
.trace svg { width: 20px; height: 20px; color: var(--brand-red); flex: none; }

/* --- Feature grid --------------------------------------------------------- */
.grid { display: grid; gap: 1.5rem; }
.features { grid-template-columns: 1fr; }
@media (min-width: 620px) { .features { grid-template-columns: 1fr 1fr; } }
@media (min-width: 940px) { .features { grid-template-columns: repeat(3, 1fr); } }
.card {
  background: var(--background); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 1.5rem; box-shadow: var(--shadow-card);
}
.section--muted .card { background: #fff; }
.card__ic {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary); margin-bottom: .9rem;
}
.card__ic svg { width: 24px; height: 24px; }
.card h3 { margin-bottom: .35rem; }
.card p { color: var(--muted-foreground); margin: 0; font-size: .97rem; }

/* --- How-it-works (alternating rows) -------------------------------------- */
.steps { display: grid; gap: clamp(2.5rem, 6vw, 4.5rem); margin-top: 3rem; }
.step { display: grid; gap: 2rem; align-items: center; }
@media (min-width: 820px) {
  .step { grid-template-columns: 1fr 1fr; }
  .step:nth-child(even) .step__media { order: 2; }
}
.step__num {
  display: inline-grid; place-items: center; width: 2.2rem; height: 2.2rem; border-radius: 9999px;
  background: var(--brand-red); color: #fff; font-weight: 700; font-size: 1rem; margin-bottom: .8rem;
}
.step h3 { font-size: clamp(1.4rem, 3vw, 1.9rem); }
.step p { color: var(--muted-foreground); }

/* --- Beta steps ----------------------------------------------------------- */
.betacard {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: clamp(1.5rem, 4vw, 2.5rem); box-shadow: var(--shadow-card);
}
.betalist { list-style: none; counter-reset: s; margin: 0; padding: 0; display: grid; gap: 1.3rem; }
.betalist li { display: grid; grid-template-columns: auto 1fr; gap: 1rem; align-items: start; }
.betalist li::before {
  counter-increment: s; content: counter(s);
  width: 2rem; height: 2rem; border-radius: 9999px; background: var(--primary); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: .95rem;
}
.betalist h3 { font-family: var(--font-sans); font-weight: 700; font-size: 1.05rem; margin: .15rem 0 .2rem; }
.betalist p { margin: 0; color: var(--muted-foreground); font-size: .97rem; }
.callout {
  margin-top: 1.5rem; padding: 1rem 1.2rem; border-radius: var(--radius);
  background: color-mix(in srgb, var(--warning) 18%, var(--background));
  border: 1px solid color-mix(in srgb, var(--warning) 45%, var(--border)); font-size: .95rem;
}

/* --- Signup form ---------------------------------------------------------- */
.signup { max-width: 560px; margin-inline: auto; }
.field { margin-bottom: 1rem; text-align: left; }
.field label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: .35rem; }
.field input[type="email"], .field input[type="text"] {
  width: 100%; font: inherit; padding: .8rem 1rem; border: 1px solid var(--border);
  border-radius: var(--radius); background: #fff; color: var(--foreground);
}
.field input:focus { outline: 3px solid var(--ring); outline-offset: 1px; border-color: var(--ring); }
.consent { display: flex; gap: .6rem; align-items: flex-start; font-size: .9rem; color: var(--muted-foreground); text-align: left; }
.consent input { margin-top: .25rem; width: 1.05rem; height: 1.05rem; accent-color: var(--primary); flex: none; }
.formnote { font-size: .85rem; color: var(--muted-foreground); margin-top: 1rem; }
.form-status { margin-top: 1rem; font-weight: 600; min-height: 1.4em; }
.form-status[data-state="ok"] { color: var(--success); }
.form-status[data-state="err"] { color: var(--accent); }

/* --- Contact / feedback cards --------------------------------------------- */
.contact-grid { grid-template-columns: 1fr; }
@media (min-width: 720px) { .contact-grid { grid-template-columns: 1fr 1fr; } }

/* --- Footer (charcoal) ---------------------------------------------------- */
.footer { background: var(--charcoal); color: #cfcfcf; padding: 3rem 0 2.5rem; }
.footer a { color: #e6e6e6; }
.footer__top { display: grid; gap: 1.5rem; grid-template-columns: 1fr; }
@media (min-width: 720px) { .footer__top { grid-template-columns: 2fr 1fr 1fr; } }
.footer h4 { font-family: var(--font-sans); font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; color: #8f8f8f; margin: 0 0 .8rem; }
.footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.footer .brand b { color: #fff; }
.footer__legal { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid #2a2a2a; font-size: .85rem; color: #8f8f8f; display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; justify-content: space-between; }

/* --- Legal pages ---------------------------------------------------------- */
.legal { max-width: 800px; }
.legal h1 { font-size: clamp(2rem, 5vw, 2.8rem); }
.legal h2 { font-size: 1.4rem; margin-top: 2.2rem; }
.legal h3 { font-size: 1.1rem; font-family: var(--font-sans); font-weight: 700; margin-top: 1.4rem; }
.legal p, .legal li { color: #2c333d; }
.legal ul { padding-left: 1.2rem; }
.legal li { margin-bottom: .4rem; }
.legal .updated { color: var(--muted-foreground); font-size: .92rem; }
.draft-banner {
  background: color-mix(in srgb, var(--warning) 20%, #fff);
  border: 1px solid color-mix(in srgb, var(--warning) 55%, var(--border));
  border-radius: var(--radius); padding: 1rem 1.2rem; margin: 1.5rem 0 2rem; font-size: .95rem;
}
.legal table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: .95rem; }
.legal th, .legal td { border: 1px solid var(--border); padding: .6rem .7rem; text-align: left; vertical-align: top; }
.legal th { background: var(--card); font-family: var(--font-sans); }

/* --- i18n toggle visibility ---------------------------------------------- */
html[data-lang="en"] .lang-zh { display: none; }
html[data-lang="zh"] .lang-en { display: none; }
/* Chinese text uses the Noto fallback via the font stack automatically. */
[lang="zh-Hant"] { letter-spacing: .01em; }

/* --- utilities ------------------------------------------------------------ */
.mt-0 { margin-top: 0; }
.skip-link {
  position: absolute; left: -9999px; top: 0; background: var(--primary); color: #fff;
  padding: .6rem 1rem; border-radius: 0 0 8px 0; z-index: 100;
}
.skip-link:focus { left: 0; }
