/* HEHE Lab landing. System fonts only, no external requests. */

:root {
  color-scheme: dark;
  --bg: #0c0c0f;
  --surface: #141419;
  --surface-2: #1d1d24;
  --text: #ece9e2;
  --muted: #a9a69e;
  --line: #26262e;
  --line-strong: #383843;
  --accent: #7c6cf6;
  --accent-ink: #9d90ff;         /* accent used as text on dark */
  --accent-soft: rgba(124, 108, 246, 0.14);
  --btn-bg: #7c6cf6;
  --btn-fg: #0c0c0f;
  --btn-bg-hover: #6a59f0;
  --btn-fg-hover: #ffffff;
  --glow: rgba(124, 108, 246, 0.28);
  --grid-line: rgba(236, 233, 226, 0.05);

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Noto Sans JP", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --gutter: 16px;
  --maxw: 1040px;
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #f8f7f3;
    --surface: #ffffff;
    --surface-2: #efede7;
    --text: #17161a;
    --muted: #5c5a55;
    --line: #e4e1d8;
    --line-strong: #cfcbbf;
    --accent-ink: #5846e0;       /* accent used as text on light */
    --accent-soft: rgba(124, 108, 246, 0.12);
    --btn-bg: #6a59f0;
    --btn-fg: #ffffff;
    --btn-bg-hover: #5846e0;
    --btn-fg-hover: #ffffff;
    --glow: rgba(124, 108, 246, 0.2);
    --grid-line: rgba(23, 22, 26, 0.05);
  }
}

/* Chinese: keep PingFang / Noto SC ahead of the Japanese faces so Han glyph variants are right. */
:lang(zh) {
  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", "Segoe UI", "Hiragino Sans GB", sans-serif;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 16px;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

main { flex: 1 0 auto; }

h1, h2, h3, p, ul, ol { margin: 0; padding: 0; }
ul, ol { list-style: none; }

a { color: inherit; }

svg {
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

:focus-visible {
  outline: 2px solid var(--accent-ink);
  outline-offset: 3px;
  border-radius: 6px;
}

.container {
  width: 100%;
  max-width: calc(var(--maxw) + 2 * var(--gutter));
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

.skip {
  position: absolute;
  left: 16px;
  top: -64px;
  z-index: 10;
  padding: 10px 14px;
  background: var(--surface-2);
  color: var(--text);
  border-radius: 8px;
  font-size: 0.875rem;
  text-decoration: none;
}
.skip:focus { top: 12px; }

/* Header */
.site-header {
  border-bottom: 1px solid var(--line);
}
.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;      /* only wraps on extremely narrow screens (<= ~330px) */
  gap: 8px 10px;
  padding-top: 8px;
  padding-bottom: 8px;
  min-height: 64px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 650;
  font-size: 1rem;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}
.brand svg { width: 24px; height: 24px; color: var(--accent-ink); }
.bar-end { display: flex; align-items: center; gap: 10px; }

.lang {
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}
.lang button {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.8125rem;
  line-height: 1;
  padding: 8px 8px;
  min-height: 32px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 160ms, background-color 160ms;
}
.lang button:hover { color: var(--text); }
.lang button[aria-pressed="true"] {
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 160ms, color 160ms, border-color 160ms;
}
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--btn-bg); color: var(--btn-fg); }
.btn-primary:hover { background: var(--btn-bg-hover); color: var(--btn-fg-hover); }
.btn-ghost {
  min-height: 48px;
  padding: 0 20px;
  border-color: var(--line-strong);
  color: var(--text);
}
.btn-ghost:hover { border-color: var(--accent-ink); color: var(--accent-ink); }

/* Eyebrow label */
.eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--accent-ink);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  line-height: 1.4;
  text-transform: uppercase;
}
h2.eyebrow::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* Hero */
.hero {
  position: relative;
  overflow: hidden;
  padding: 64px 0 72px;
}
.hero::before {
  /* soft indigo glow, top right */
  content: "";
  position: absolute;
  top: -160px;
  right: -120px;
  width: 560px;
  height: 560px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--glow) 0%, transparent 68%);
  pointer-events: none;
}
.hero::after {
  /* faint grid, fading out downwards */
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, transparent 85%);
  mask-image: linear-gradient(to bottom, #000 0%, transparent 85%);
  pointer-events: none;
}
.hero .container { position: relative; z-index: 1; }
.hero h1 {
  max-width: 20ch;
  margin-top: 20px;
  font-size: clamp(2.25rem, 1.25rem + 4.6vw, 4rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.035em;
  text-wrap: balance;
}
.lead {
  max-width: 40rem;
  margin-top: 24px;
  color: var(--muted);
  font-size: clamp(1.0625rem, 1rem + 0.35vw, 1.25rem);
  line-height: 1.65;
}
.actions { margin-top: 36px; display: flex; flex-wrap: wrap; gap: 12px; }

/* Sections */
.section { padding: 56px 0; }
.section .eyebrow { margin-bottom: 28px; }

.cards { display: grid; grid-template-columns: 1fr; gap: 16px; }
.card {
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  transition: border-color 200ms;
}
.card:hover { border-color: var(--line-strong); }
.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-bottom: 20px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.icon svg { width: 22px; height: 22px; }
.card h3 {
  font-size: 1.1875rem;
  font-weight: 650;
  line-height: 1.3;
  letter-spacing: -0.015em;
}
.card p { margin-top: 10px; color: var(--muted); font-size: 0.96875rem; }

.steps { display: grid; grid-template-columns: 1fr; gap: 28px; }
.step { padding-top: 20px; border-top: 1px solid var(--line-strong); }
.num {
  display: block;
  margin-bottom: 12px;
  color: var(--accent-ink);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.1em;
}
.step h3 { font-size: 1.25rem; font-weight: 650; line-height: 1.3; letter-spacing: -0.015em; }
.step p { margin-top: 8px; color: var(--muted); font-size: 0.96875rem; }

/* Statement band */
.band-wrap { padding-bottom: 72px; }
.band {
  position: relative;
  overflow: hidden;
  padding: 44px 24px;
  border: 1px solid var(--line-strong);
  border-radius: 24px;
  background:
    radial-gradient(120% 140% at 100% 0%, var(--glow) 0%, transparent 60%),
    var(--surface);
}
.band::before {
  /* concentric rings, decorative */
  content: "";
  position: absolute;
  right: -90px;
  bottom: -90px;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: repeating-radial-gradient(circle at center, transparent 0, transparent 37px, var(--line-strong) 37px, var(--line-strong) 38px);
  pointer-events: none;
}
.band h2, .band p { position: relative; }
.band h2 {
  max-width: 16ch;
  font-size: clamp(2rem, 1rem + 4.6vw, 3.75rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.035em;
  text-wrap: balance;
}
.band p { margin-top: 20px; max-width: 32rem; color: var(--muted); font-size: 1.0625rem; }

/* Footer */
.site-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}
.foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;
}
.foot a { text-decoration: none; padding: 8px 0; }
.foot a:hover { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 4px; }

/* CJK typography */
:lang(ja), :lang(zh) { word-break: normal; overflow-wrap: break-word; }
:lang(ja) body, :lang(zh) body { line-height: 1.75; }
:lang(ja) .hero h1, :lang(zh) .hero h1,
:lang(ja) .band h2, :lang(zh) .band h2 {
  max-width: 14em;
  letter-spacing: 0;
  line-height: 1.28;
}
:lang(ja) .hero h1, :lang(zh) .hero h1 { font-weight: 700; }
:lang(ja) .eyebrow, :lang(zh) .eyebrow { letter-spacing: 0.08em; }
:lang(ja) .card h3, :lang(zh) .card h3,
:lang(ja) .step h3, :lang(zh) .step h3 { letter-spacing: 0; }
:lang(ja) .lead, :lang(zh) .lead { line-height: 1.8; }
/* Phrase-aware line breaking where supported (Chromium); other engines ignore it. */
:lang(ja) { line-break: strict; }
:lang(ja) h1, :lang(ja) h2, :lang(ja) h3, :lang(ja) p,
:lang(zh) h1, :lang(zh) h2, :lang(zh) h3, :lang(zh) p { word-break: auto-phrase; }

/* Tablet and up */
@media (min-width: 720px) {
  :root { --gutter: 24px; }
  .bar { min-height: 72px; gap: 16px; }
  .bar-end { gap: 16px; }
  .lang button { padding: 8px 12px; }
  .btn { padding: 0 18px; }
  .hero { padding: 112px 0 120px; }
  .hero h1 { margin-top: 24px; }
  .section { padding: 80px 0; }
  .cards { grid-template-columns: repeat(3, 1fr); gap: 20px; }
  .steps { grid-template-columns: repeat(3, 1fr); gap: 32px; }
  .band-wrap { padding-bottom: 112px; }
  .band { padding: 72px 56px; }
  .band::before { right: -60px; bottom: -60px; width: 380px; height: 380px; }
}

/* Very narrow phones: keep header on one line */
@media (max-width: 380px) {
  .bar { gap: 6px; }
  .bar-end { gap: 6px; }
  .brand span { font-size: 0.9375rem; }
  .brand svg { width: 20px; height: 20px; }
  .lang button { padding: 8px 6px; font-size: 0.75rem; }
  .btn { padding: 0 12px; font-size: 0.875rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
