/* ---------- Tokens ---------- */
:root {
  --paper: #F5F2EC;
  --paper-2: #EDE8DF;
  --ink: #1F1D1A;
  --ink-soft: #57524A;
  --ink-faint: #8E877B;
  --line: #D9D2C5;
  --shu: #B0412A;          /* vermilion, used sparingly */
  --card: #FBF9F5;

  --serif: "Cormorant Garamond", "Shippori Mincho", serif;
  --sans: "Inter", "Zen Kaku Gothic New", system-ui, sans-serif;

  --wrap: 1120px;
  --gutter: clamp(16px, 4vw, 40px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #161513;
    --paper-2: #1D1B18;
    --ink: #ECE7DE;
    --ink-soft: #B3AB9E;
    --ink-faint: #7D766B;
    --line: #34302A;
    --shu: #D0614A;
    --card: #1B1A17;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #161513;
  --paper-2: #1D1B18;
  --ink: #ECE7DE;
  --ink-soft: #B3AB9E;
  --ink-faint: #7D766B;
  --line: #34302A;
  --shu: #D0614A;
  --card: #1B1A17;
  color-scheme: dark;
}

/* Per-language typography */
html[lang="ja"]      { --serif: "Shippori Mincho", serif;              --sans: "Zen Kaku Gothic New", sans-serif; }
html[lang="zh-Hans"] { --serif: "Noto Serif SC", "Songti SC", serif;    --sans: "Noto Sans SC", "PingFang SC", sans-serif; }
html[lang="zh-Hant"] { --serif: "Noto Serif TC", "Songti TC", serif;    --sans: "Noto Sans TC", "PingFang TC", sans-serif; }
html[lang="ko"]      { --serif: "Nanum Myeongjo", serif;                --sans: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif; }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
html:not([lang="en"]) body { line-height: 1.95; letter-spacing: .02em; }
img { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; margin: 0; line-height: 1.25; }
p { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }

/* Subtle paper grain */
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 100;
  opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s;
}
.site-header.scrolled { border-bottom-color: var(--line); }
.header-inner { display: flex; align-items: center; gap: 32px; height: 72px; }

.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-mark { width: 34px; height: 23px; color: var(--ink); }
.brand-name {
  font-family: "Cormorant Garamond", serif;
  font-size: 21px; font-weight: 500; letter-spacing: .01em; white-space: nowrap;
}
.brand-name em { font-style: italic; font-weight: 400; color: var(--ink-soft); }

.nav { display: flex; gap: 28px; margin-left: auto; }
.nav a {
  font-size: 13px; letter-spacing: .12em; text-transform: uppercase;
  text-decoration: none; color: var(--ink-soft);
  position: relative; padding: 4px 0;
}
.nav a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: var(--ink); transform: scaleX(0); transform-origin: left; transition: transform .35s ease;
}
.nav a:hover { color: var(--ink); }
.nav a:hover::after { transform: scaleX(1); }

.lang select {
  appearance: none; -webkit-appearance: none;
  font: inherit; font-size: 13px; color: var(--ink);
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%238E877B' stroke-width='1.2'/%3E%3C/svg%3E") no-repeat right 12px center;
  border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 32px 6px 14px; cursor: pointer;
}
.lang select:hover { border-color: var(--ink-faint); }
.lang select option { background: var(--paper); color: var(--ink); }

/* ---------- Hero ---------- */
.hero { position: relative; padding: clamp(80px, 14vh, 160px) 0 clamp(80px, 12vh, 140px); }
.hero-inner { position: relative; }
.eyebrow {
  font-size: 12px; letter-spacing: .22em; text-transform: uppercase; color: var(--ink-faint);
  display: flex; align-items: center; gap: 14px;
}
.eyebrow::before { content: ""; width: 36px; height: 1px; background: var(--ink-faint); }
.hero-title {
  margin-top: 28px;
  font-size: clamp(48px, 8.4vw, 104px);
  line-height: 1.05; letter-spacing: -.015em;
  max-width: 14ch;
}
html:not([lang="en"]) .hero-title { font-size: clamp(38px, 6.4vw, 80px); line-height: 1.3; letter-spacing: .02em; max-width: none; }
.hero-lead { margin-top: 32px; max-width: 34em; color: var(--ink-soft); font-size: 17px; }

.hero-stats {
  margin-top: 64px; padding-top: 28px;
  border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px;
  max-width: 720px;
}
.hero-stats strong {
  display: block; font-family: "Cormorant Garamond", serif; font-weight: 500;
  font-size: 34px; line-height: 1.1; color: var(--ink);
}
.hero-stats span { display: block; margin-top: 6px; font-size: 13px; color: var(--ink-faint); }

.hero-seal {
  position: absolute; right: var(--gutter); top: 4px;
  width: 64px; height: 64px;
  border: 1.5px solid var(--shu); border-radius: 6px;
  display: grid; place-items: center;
  color: var(--shu); font-family: "Shippori Mincho", serif; font-size: 36px; line-height: 1;
  transform: rotate(-4deg); opacity: .85;
}
.hero-bird {
  position: absolute; right: calc(var(--gutter) + 20px); top: 46%;
  width: clamp(160px, 26vw, 340px); height: auto; aspect-ratio: 3 / 2;
  color: var(--ink); opacity: .07;
  transform: rotate(-12deg);
  animation: glide 9s ease-in-out infinite;
  pointer-events: none;
}
@keyframes glide {
  0%, 100% { transform: translate(0, 0) rotate(-12deg); }
  50% { transform: translate(-14px, -18px) rotate(-9deg); }
}

/* ---------- Sections ---------- */
.section { padding: clamp(80px, 12vw, 140px) 0; border-top: 1px solid var(--line); }
.section--tint { background: var(--paper-2); }
.section-head { display: grid; grid-template-columns: 80px 1fr; column-gap: 24px; align-items: baseline; margin-bottom: 64px; }
.section-head h2 { font-size: clamp(34px, 4.6vw, 54px); }
.section-head p { grid-column: 2; margin-top: 12px; color: var(--ink-soft); }
.section-num {
  font-family: "Cormorant Garamond", serif; font-style: italic;
  font-size: 26px; color: var(--shu);
}

/* ---------- Apps ---------- */
.app-icon {
  width: 96px; height: 96px; border-radius: 22.5%;
  box-shadow: 0 1px 2px rgba(0,0,0,.06), 0 8px 24px -8px rgba(31,29,26,.18);
}
.app-icon--lg { width: 160px; height: 160px; }
.app-cat { font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-faint); }
.app-desc { color: var(--ink-soft); }

.app-feature {
  display: grid; grid-template-columns: 200px 1fr; gap: 48px; align-items: center;
  padding: 48px; margin-bottom: 32px;
  background: var(--card); border: 1px solid var(--line); border-radius: 4px;
}
.app-feature .app-icon { justify-self: center; }
.app-feature h3 { font-size: clamp(30px, 3.4vw, 40px); margin: 8px 0 16px; }
.app-feature .app-desc { max-width: 38em; }
.app-meta { margin-top: 18px; font-size: 13px; color: var(--ink-faint); }
.app-source { margin-top: 4px; font-size: 11px; color: var(--ink-faint); opacity: .8; }
.stars { color: var(--shu); font-weight: 500; margin-right: 6px; }

.app-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px; }
.app-card {
  display: flex; flex-direction: column;
  padding: 36px 32px 32px;
  background: var(--card); border: 1px solid var(--line); border-radius: 4px;
  transition: transform .4s ease, border-color .4s ease;
}
.app-card:hover, .app-feature:hover { border-color: var(--ink-faint); }
.app-card:hover { transform: translateY(-3px); }
.app-card .app-icon { width: 72px; height: 72px; margin-bottom: 28px; }
.app-card h3 { font-size: 26px; margin: 6px 0 12px; }
.app-card .app-desc { font-size: 15px; flex: 1; }

.store-links { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.store { display: inline-block; line-height: 0; border-radius: 8px; transition: opacity .25s, transform .25s; }
.store:hover { opacity: .78; transform: translateY(-1px); }
.store:focus-visible { outline: 2px solid var(--shu); outline-offset: 3px; }
.badge { height: 40px; width: auto; }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: 80px 1fr; column-gap: 24px; }
.about-lead {
  grid-column: 2;
  font-family: var(--serif); font-size: clamp(22px, 2.6vw, 30px); line-height: 1.6;
  max-width: 30em; margin-bottom: 72px;
}
.principles {
  grid-column: 2; list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 48px;
}
.principles li { border-top: 1px solid var(--ink); padding-top: 24px; }
.p-num { font-family: "Cormorant Garamond", serif; font-style: italic; color: var(--ink-faint); font-size: 18px; }
.principles h3 { font-size: 24px; margin: 8px 0 12px; }
.principles p { color: var(--ink-soft); font-size: 15px; }

/* ---------- Contact ---------- */
.contact { text-align: center; }
.contact h2 { font-size: clamp(40px, 6vw, 72px); margin: 12px 0 20px; }
.contact p { color: var(--ink-soft); }
.contact-mail {
  display: inline-block; margin-top: 36px;
  font-family: "Cormorant Garamond", serif; font-size: clamp(22px, 3vw, 32px);
  text-decoration: none; border-bottom: 1px solid var(--line); padding-bottom: 4px;
  transition: border-color .3s, color .3s;
  word-break: break-all;
}
.contact-mail:hover { border-color: var(--shu); color: var(--shu); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 40px 0; }
.footer-inner { display: flex; align-items: center; gap: 32px; flex-wrap: wrap; }
.brand--small .brand-mark { width: 26px; height: 18px; }
.brand--small .brand-name { font-size: 17px; }
.footer-links { display: flex; gap: 24px; margin-left: auto; }
.footer-links a, .copyright { font-size: 13px; color: var(--ink-faint); text-decoration: none; }
.footer-links a:hover { color: var(--ink); }
.legal {
  flex-basis: 100%; margin-top: 8px; padding-top: 20px; border-top: 1px solid var(--line);
  font-size: 11px; line-height: 1.7; color: var(--ink-faint);
}

/* ---------- Reveal ---------- */
.js .reveal { opacity: 0; transform: translateY(16px); transition: opacity .9s ease, transform .9s cubic-bezier(.2,.7,.2,1); }
.js .reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .hero-bird { animation: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .app-grid, .principles { grid-template-columns: 1fr; }
  .app-grid { gap: 20px; }
  .principles { gap: 40px; }
  .app-feature { grid-template-columns: 1fr; gap: 28px; padding: 36px 28px; }
  .app-feature .app-icon { justify-self: start; width: 112px; height: 112px; }
}
@media (max-width: 720px) {
  .nav { display: none; }
  .lang { margin-left: auto; }
  .header-inner { height: 64px; gap: 12px; }
  .brand-name { font-size: 18px; }
  .brand-name em { display: none; }
  .section-head, .about-grid { grid-template-columns: 1fr; }
  .section-head p, .about-lead, .principles { grid-column: 1; }
  .section-head { margin-bottom: 40px; }
  .section-num { display: block; margin-bottom: 8px; }
  .hero-seal { width: 48px; height: 48px; font-size: 26px; top: -40px; }
  .hero-stats { grid-template-columns: 1fr; gap: 18px; margin-top: 48px; }
  .hero-stats div { display: flex; align-items: baseline; gap: 14px; }
  .hero-stats strong { font-size: 26px; min-width: 5.5em; }
  .hero-stats span { margin: 0; }
  .hero-bird { top: auto; bottom: -30px; opacity: .05; }
  .footer-inner { flex-direction: column; align-items: flex-start; gap: 16px; }
  .footer-links { margin-left: 0; }
}

/* Korean: break between words, not syllables */
html[lang="ko"] body { word-break: keep-all; overflow-wrap: anywhere; }
