:root {
  --bg: #f5f3ef;
  --bg-card: #fbfaf7;
  --ink: #211e1a;
  --muted: #6f6a61;
  --line: #d9d3c8;
  --accent: #8a7a5c;
  --serif: "Cormorant Garamond", "Songti SC", "Noto Serif SC", "Hiragino Mincho ProN", "Yu Mincho", Georgia, serif;
  --sans: "Inter", "PingFang SC", "Hiragino Sans", "Yu Gothic", -apple-system, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.7;
  border-top: 3px solid var(--accent);
}

/* ---------- Header ---------- */

.site-header {
  max-width: 880px;
  margin: 0 auto;
  padding: 28px 24px;
  display: flex;
  align-items: center;
  gap: 32px;
  flex-wrap: wrap;
}

.brand {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--ink);
  text-decoration: none;
}

.site-nav {
  display: flex;
  gap: 24px;
  margin-right: auto;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

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

.site-nav a.active {
  color: var(--ink);
  border-bottom: 1px solid var(--accent);
  padding-bottom: 2px;
}

.lang-switch {
  display: flex;
  gap: 4px;
}

.lang-switch button {
  background: none;
  border: 1px solid transparent;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 13px;
  padding: 4px 9px;
  cursor: pointer;
  border-radius: 2px;
}

.lang-switch button:hover { color: var(--ink); }

.lang-switch button.active {
  color: var(--ink);
  border-color: var(--line);
  background: var(--bg-card);
}

/* ---------- Layout ---------- */

main {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

/* ---------- Hero (spotlight stage) ---------- */

.hero {
  --stage-bg: #16120d;
  --stage-ink: #f2e9d8;
  --stage-muted: #cfc2ab;
  --light-beam: #ffe7bd;
  --light-glow: #ffb84d;
  --beam-dir: 180deg;
  --beam-width: 70deg;
  --pivot-y: 82px;
  position: relative;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  padding: 170px 24px 90px;
  text-align: center;
  background: var(--stage-bg);
  overflow: hidden;
  transition: background 0.6s;
}

/* ---------- Paged navigation (click, don't scroll) ---------- */

body.paged [data-page] { display: none; }
body.paged [data-page].page-active { display: block; }
body.paged.on-home .site-footer { display: none; }
body.paged.on-home main { padding-bottom: 0; }

body.paged .hero.page-active {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: calc(100vh - var(--header-h, 122px));
  box-sizing: border-box;
  padding-top: 130px;
  padding-bottom: 60px;
}

body.paged .section.page-active { min-height: calc(100vh - 300px); }

@media (prefers-reduced-motion: no-preference) {
  body.paged [data-page].page-active {
    animation: pageIn 0.45s ease;
  }
}

@keyframes pageIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}

.section .quote {
  margin: 4px auto 48px;
  padding: 32px 24px;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
}

.hero .eyebrow { color: var(--light-glow); }
.hero h1 { color: var(--stage-ink); }
.hero .subtitle { color: var(--stage-muted); }

.hero .cta {
  color: var(--stage-ink);
  border-color: var(--stage-ink);
}

.hero .cta:hover {
  background: var(--stage-ink);
  color: var(--stage-bg);
}

.spotlight-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  mix-blend-mode: multiply;
  background:
    conic-gradient(
      from calc(var(--beam-dir) - var(--beam-width) / 2) at 50% var(--pivot-y),
      #161310 0deg,
      var(--light-beam) calc(var(--beam-width) * 0.18),
      var(--light-beam) calc(var(--beam-width) * 0.82),
      #161310 var(--beam-width),
      #161310 360deg
    ),
    radial-gradient(circle 1100px at 50% var(--pivot-y),
      #ffffff 0%, #f4efe6 40%, #35302a 100%);
  background-blend-mode: multiply;
  transition: opacity 0.6s;
}

/* Lamp */

.lamp {
  position: absolute;
  z-index: 3;
  top: 0;
  left: 50%;
  width: 160px;
  margin-left: -80px;
  cursor: pointer;
  transform-origin: 50% 0;
}

.lamp svg { display: block; }

.lamp-halo {
  fill: var(--light-glow);
  opacity: 0.6;
  transition: opacity 0.5s;
}

.lamp-mouth {
  fill: var(--light-beam);
  transition: fill 0.5s;
}

.lamp-core {
  fill: #fffdf6;
  opacity: 0.9;
  transition: opacity 0.5s;
}

.hero-hint {
  position: absolute;
  z-index: 3;
  bottom: 20px;
  left: 0;
  right: 0;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(242, 233, 216, 0.4);
}

/* Lights on: spotlight off, hero reverts to daylight */

.hero.lights-on { background: var(--bg); }
.hero.lights-on .spotlight-overlay { opacity: 0; }
.hero.lights-on .eyebrow { color: var(--accent); }
.hero.lights-on h1 { color: var(--ink); }
.hero.lights-on .subtitle { color: var(--muted); }
.hero.lights-on .cta { color: var(--ink); border-color: var(--ink); }
.hero.lights-on .cta:hover { background: var(--ink); color: var(--bg); }
.hero.lights-on .hero-hint { color: var(--muted); opacity: 0.7; }
.hint-mobile { display: none; }
.hero.lights-on .lamp-halo { opacity: 0; }
.hero.lights-on .lamp-core { opacity: 0; }
.hero.lights-on .lamp-mouth { fill: #cfc8bc; }

.eyebrow {
  font-size: 13px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 24px;
}

.hero h1 {
  font-family: var(--serif);
  font-size: clamp(44px, 8vw, 72px);
  font-weight: 500;
  line-height: 1.1;
  margin-bottom: 20px;
}

.subtitle {
  max-width: 560px;
  margin: 0 auto 36px;
  color: var(--muted);
  font-size: 19px;
}

.cta {
  display: inline-block;
  font-size: 14px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  border: 1px solid var(--ink);
  padding: 12px 32px;
  transition: background 0.2s, color 0.2s;
}

.cta:hover {
  background: var(--ink);
  color: var(--bg);
}

/* ---------- Quote ---------- */

.quote {
  margin: 48px auto 96px;
  max-width: 640px;
  text-align: center;
  padding: 48px 24px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.quote p {
  font-family: var(--serif);
  font-size: 26px;
  font-style: italic;
  line-height: 1.5;
  margin-bottom: 16px;
}

.quote cite {
  font-style: normal;
  font-size: 13px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
}

.quote cite::before { content: "— "; }

/* ---------- Sections ---------- */

.section {
  padding: 56px 0;
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.numeral {
  font-family: var(--serif);
  font-size: 20px;
  color: var(--accent);
}

.section h2 {
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 500;
}

.section > p {
  max-width: 640px;
  color: var(--muted);
  margin-bottom: 16px;
}

/* ---------- Cards ---------- */

.grid {
  display: grid;
  gap: 20px;
}

.work-grid { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  padding: 28px 24px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 30px rgba(33, 30, 26, 0.09);
}

.card h3 {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 10px;
}

.card p {
  font-size: 15px;
  color: var(--muted);
}

/* ---------- Notary app showcase ---------- */

.notary-showcase {
  display: flex;
  gap: 48px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.notary-info {
  flex: 1;
  min-width: 280px;
  max-width: 480px;
}

.notary-info p { color: var(--muted); margin-bottom: 16px; }

.app-icon {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  border: 1px solid var(--line);
  margin-bottom: 20px;
}

.cta-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.demo-note {
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.phone-frame {
  width: 300px;
  height: 620px;
  border: 12px solid #23201c;
  border-radius: 44px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 24px 48px rgba(33, 30, 26, 0.14);
  flex-shrink: 0;
  margin: 0 auto;
}

/* Render the app at real iPhone width, scaled to fit the frame,
   so its layout matches an actual phone instead of a narrow viewport */
.phone-frame iframe {
  width: 390px;
  height: 842px;
  border: 0;
  transform: scale(0.7077);
  transform-origin: 0 0;
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--line);
  padding: 32px 24px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

/* ---------- Scroll reveal ---------- */

.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.in {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .card { transition: none; }
}

/* ---------- CJK adjustments ---------- */

html[lang="zh"] .eyebrow,
html[lang="ja"] .eyebrow,
html[lang="zh"] .quote cite,
html[lang="ja"] .quote cite { letter-spacing: 0.14em; }

html[lang="zh"] .site-nav a,
html[lang="ja"] .site-nav a { letter-spacing: 0.08em; }

html[lang="zh"] .quote p,
html[lang="ja"] .quote p { font-style: normal; font-size: 23px; }

/* ---------- Mobile ---------- */

@media (max-width: 640px) {
  .site-header { justify-content: center; text-align: center; }
  .site-nav { margin-right: 0; }

  /* Smaller stage so the beam can cover the text,
     with clearance so the lamp never overlaps the eyebrow */
  .hero {
    --pivot-y: 62px;
    padding: 145px 20px 76px;
  }
  .hero h1 { font-size: clamp(32px, 10vw, 44px); }
  .hero .subtitle { font-size: 16px; }
  .lamp { width: 120px; margin-left: -60px; }
  .lamp svg { width: 120px; height: 83px; }
  .hero-hint { font-size: 10px; padding: 0 12px; }
  .hint-desktop { display: none; }
  .hint-mobile { display: block; }
}
