/* start.nihongo.one — guest module design tokens (ivory / red / gold), spec §7/§8.
   Single committed brand look; WCAG 2.2 AA contrast; two-column desktop, form-first
   (single-column) mobile; no horizontal scroll at any width. */
:root {
  --ivory: #fbf7ef;
  --ivory-2: #f4ecdd;
  --ink: #241f1b;
  --ink-soft: #4b433b;
  --red: #b3122f;
  --red-dark: #8a0e24;
  --gold: #b8863b;
  --gold-soft: #c6a15b;
  --line: #e4d9c3;
  --white: #ffffff;
  --focus: #1b4de4;
  --radius: 14px;
  --maxw: 1080px;
  --font: "Hiragino Kaku Gothic ProN", "Noto Sans", "Noto Sans TC", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--ivory);
  line-height: 1.6;
  overflow-x: hidden;
}
a { color: var(--red-dark); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.skip-link {
  position: absolute; left: -999px; top: 0; background: var(--ink); color: var(--white);
  padding: 10px 16px; z-index: 100; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

header.site {
  border-bottom: 1px solid var(--line);
  background: var(--ivory);
}
header.site .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 68px; }
.brand { display: flex; align-items: baseline; gap: 10px; text-decoration: none; color: var(--ink); }
.brand b { font-size: 1.2rem; letter-spacing: .2px; }
.brand .jp { color: var(--red); font-weight: 700; }
.brand small { color: var(--ink-soft); font-weight: 500; }

.lang-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.lang-toggle button {
  font: inherit; border: 0; background: transparent; padding: 7px 14px; cursor: pointer; color: var(--ink-soft);
}
.lang-toggle button[aria-pressed="true"] { background: var(--red); color: var(--white); }

main { padding: 40px 0 64px; }
h1 { font-size: clamp(1.7rem, 3.6vw, 2.6rem); line-height: 1.2; margin: 0 0 12px; }
h2 { font-size: clamp(1.25rem, 2.4vw, 1.6rem); margin: 2em 0 .5em; }
.lede { font-size: 1.12rem; color: var(--ink-soft); max-width: 60ch; }

.hero { display: grid; grid-template-columns: 1.05fr .95fr; gap: 40px; align-items: start; }
.hero .aside {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; box-shadow: 0 1px 0 rgba(0,0,0,.02);
}
@media (max-width: 780px) {
  .hero { grid-template-columns: 1fr; gap: 24px; }
  .hero .aside { order: -1; } /* form-first on mobile */
}

.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 22px; }
@media (max-width: 780px) { .cards { grid-template-columns: 1fr; } }
.card {
  display: block; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; text-decoration: none; color: var(--ink); transition: border-color .15s, transform .15s;
}
.card:hover, .card:focus-visible { border-color: var(--gold-soft); transform: translateY(-2px); }
.card .k { display: inline-block; font-size: .8rem; color: var(--red-dark); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.card h3 { margin: 8px 0 6px; font-size: 1.15rem; }
.card p { margin: 0; color: var(--ink-soft); }

.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; background: var(--ivory-2); color: var(--ink-soft); font-size: .82rem; border: 1px solid var(--line); }
.note { background: var(--ivory-2); border: 1px solid var(--line); border-left: 4px solid var(--gold); border-radius: 10px; padding: 14px 16px; color: var(--ink-soft); }

.btn { display: inline-block; font: inherit; font-weight: 700; border-radius: 10px; padding: 12px 20px; text-decoration: none; cursor: pointer; border: 1px solid transparent; }
.btn-primary { background: var(--red); color: var(--white); }
.btn-primary:hover { background: var(--red-dark); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }

.prose { max-width: 74ch; }
.prose h2 { border-bottom: 1px solid var(--line); padding-bottom: .2em; }
.prose ul { padding-left: 1.2em; }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; }
dl.facts dt { color: var(--ink-soft); }
dl.facts dd { margin: 0; font-weight: 600; }

footer.site { border-top: 1px solid var(--line); color: var(--ink-soft); font-size: .92rem; }
footer.site .wrap { padding-top: 22px; padding-bottom: 34px; display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; }
footer.site a { color: var(--ink-soft); }

/* i18n: every localised node carries data-lang="en" | "zh-Hant". Show only the
   node matching <html lang>. <html> always has a lang (default en), so the other
   language is hidden with no reliance on the `hidden` attribute. */
html[lang="en"] [data-lang]:not([data-lang="en"]) { display: none; }
html[lang="zh-Hant"] [data-lang]:not([data-lang="zh-Hant"]) { display: none; }
