:root {
  color-scheme: light dark;
  --bg: #f7f5f0;
  --surface: #ffffff;
  --text: #1f1d1a;
  --muted: #5d5850;
  --line: #e2ddd3;
  --accent: #2f5d50;
  --accent-text: #ffffff;
  --accent-soft: #e4ece8;
  --focus: #1f6feb;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Songti SC", "Hiragino Mincho ProN", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans", "Noto Sans CJK SC", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 14px;
  --measure: 40rem;
}

/* Dark palette: follows the device unless the visitor picked a theme with the header
   switch (assets/theme.js sets data-theme on <html>). Keep the two blocks identical. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151614;
    --surface: #1e201d;
    --text: #ecebe6;
    --muted: #a9a69d;
    --line: #33352f;
    --accent: #8cc4b0;
    --accent-text: #10201a;
    --accent-soft: #23302b;
    --focus: #79b8ff;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #151614;
  --surface: #1e201d;
  --text: #ecebe6;
  --muted: #a9a69d;
  --line: #33352f;
  --accent: #8cc4b0;
  --accent-text: #10201a;
  --accent-soft: #23302b;
  --focus: #79b8ff;
}

:root[data-theme="light"] {
  color-scheme: light;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 1.0625rem/1.6 var(--sans);
}

a {
  color: var(--accent);
  text-underline-offset: 0.15em;
}

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

h1,
h2,
h3 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

h1 {
  font-size: clamp(2.1rem, 7vw, 3.2rem);
  margin: 0 0 1rem;
}

h2 {
  font-size: clamp(1.5rem, 4.5vw, 2rem);
  margin: 0 0 0.75rem;
}

h3 {
  font-size: 1.2rem;
  margin: 0 0 0.35rem;
}

p {
  margin: 0 0 1rem;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  padding: 0.5rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  z-index: 10;
}

.skip-link:focus {
  top: 1rem;
}

.wrap {
  max-width: 64rem;
  margin: 0 auto;
  padding: 0 1rem;
}

@media (min-width: 40rem) {
  .wrap {
    padding: 0 1.5rem;
  }
}

/* Header and footer */

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1.1rem;
  padding-bottom: 1.1rem;
}

.wordmark {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1.1rem;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  flex: none;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.theme-toggle:hover {
  color: var(--text);
  border-color: var(--muted);
}

.wordmark,
.site-nav a {
  white-space: nowrap;
}

/* Small phones: keep the wordmark, links and switch on one line. */
@media (max-width: 26rem) {
  .header-actions,
  .site-nav {
    gap: 0.7rem;
  }

  .site-nav {
    font-size: 0.88rem;
  }

  .theme-toggle {
    width: 2rem;
    height: 2rem;
  }
}

/* The narrowest phones: links and switch drop to a second row instead of overflowing. */
@media (max-width: 23rem) {
  .site-header .wrap:has(.site-nav) {
    flex-wrap: wrap;
    row-gap: 0.5rem;
  }

  .site-header .wrap:has(.site-nav) .header-actions {
    width: 100%;
    justify-content: space-between;
  }
}

.site-nav {
  display: flex;
  gap: 1.1rem;
  font-size: 0.95rem;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--text);
}

.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 4rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  padding-top: 1.5rem;
  padding-bottom: 2rem;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.1rem;
}

.site-footer a {
  color: var(--muted);
}

/* Buttons */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 48px;
  padding: 0.7rem 1.3rem;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-text);
  font: 600 1rem/1.2 var(--sans);
  text-decoration: none;
  cursor: pointer;
}

.button:hover {
  filter: brightness(1.08);
}

.button.secondary {
  background: transparent;
  color: var(--accent);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin: 1.5rem 0 0.75rem;
}

.fine {
  color: var(--muted);
  font-size: 0.92rem;
}

/* Landing */

.hero {
  padding: 2.5rem 0 3rem;
  display: grid;
  gap: 2.5rem;
  align-items: center;
}

@media (min-width: 52rem) {
  .hero {
    grid-template-columns: 1.15fr 0.85fr;
    padding: 4.5rem 0 4rem;
  }
}

.lede {
  font-size: 1.2rem;
  color: var(--muted);
  max-width: 34rem;
}

.sample {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  margin: 0;
}

.sample-label {
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.75rem;
}

.sample-text {
  font-family: var(--serif);
  font-size: 1.35rem;
  line-height: 2.1;
  margin: 0 0 1rem;
}

.sample-text ruby rt {
  font-family: var(--sans);
  font-size: 0.55em;
  color: var(--muted);
}

.sample-gloss {
  border-top: 1px solid var(--line);
  padding-top: 0.85rem;
  font-size: 0.95rem;
  color: var(--muted);
  margin: 0;
}

.sample-gloss strong {
  color: var(--text);
  font-weight: 600;
}

mark.tapped {
  background: var(--accent-soft);
  color: inherit;
  border-radius: 4px;
  padding: 0 0.1em;
}

.section {
  padding: 2.75rem 0;
  border-top: 1px solid var(--line);
}

.section > .wrap > p,
.section-intro {
  max-width: var(--measure);
}

.steps {
  list-style: none;
  padding: 0;
  margin: 1.75rem 0 0;
  display: grid;
  gap: 1rem;
  counter-reset: step;
}

@media (min-width: 46rem) {
  .steps {
    grid-template-columns: repeat(3, 1fr);
  }
}

.steps li {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.2rem 1.25rem;
  counter-increment: step;
}

.steps li::before {
  content: counter(step);
  display: inline-grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 0.65rem;
}

.steps p {
  margin: 0;
  color: var(--muted);
}

.two-col {
  display: grid;
  gap: 1.5rem 3rem;
}

@media (min-width: 46rem) {
  .two-col {
    grid-template-columns: 1fr 1fr;
  }
}

.plain-list {
  padding-left: 1.2rem;
  margin: 0 0 1rem;
}

.plain-list li {
  margin-bottom: 0.4rem;
}

.languages {
  display: grid;
  gap: 1rem;
  margin-top: 1.5rem;
}

@media (min-width: 40rem) {
  .languages {
    grid-template-columns: 1fr 1fr;
  }
}

.language {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  background: var(--surface);
}

.language .native {
  font-family: var(--serif);
  font-size: 1.6rem;
  margin: 0 0 0.25rem;
}

.language p {
  margin: 0;
  color: var(--muted);
}

.beta {
  background: var(--accent-soft);
  border-radius: var(--radius);
  padding: 2rem 1.35rem;
  margin-top: 1rem;
}

@media (min-width: 40rem) {
  .beta {
    padding: 2.5rem 2.25rem;
  }
}

/* Long-form pages (privacy, terms, support) */

.doc {
  max-width: var(--measure);
  padding: 2rem 0 1rem;
}

.doc h2 {
  font-size: 1.45rem;
  margin-top: 2.25rem;
}

.doc h3 {
  margin-top: 1.5rem;
}

.doc ul {
  padding-left: 1.2rem;
}

.doc li {
  margin-bottom: 0.45rem;
}

.meta {
  color: var(--muted);
  font-size: 0.95rem;
}

.callout {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  padding: 1rem 1.1rem;
  margin: 1.5rem 0;
}

.callout p:last-child {
  margin-bottom: 0;
}

.table-scroll {
  overflow-x: auto;
  margin: 1rem 0 1.5rem;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.95rem;
}

th,
td {
  text-align: left;
  vertical-align: top;
  padding: 0.6rem 0.75rem 0.6rem 0;
  border-bottom: 1px solid var(--line);
}

th {
  font-weight: 600;
}

details {
  border-bottom: 1px solid var(--line);
  padding: 0.9rem 0;
}

summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 1.05rem;
  list-style-position: outside;
}

details[open] summary {
  margin-bottom: 0.6rem;
}

details > :not(summary) {
  margin-left: 0;
}

/* Invite */

.invite {
  max-width: 34rem;
  padding: 2.5rem 0 1rem;
}

.code-box {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  margin: 1rem 0;
}

.code {
  flex: 1 1 16rem;
  font-family: var(--mono);
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  overflow-wrap: anywhere;
  user-select: all;
  -webkit-user-select: all;
}

.status {
  min-height: 1.5em;
  color: var(--muted);
  font-size: 0.95rem;
}

ol.how {
  padding-left: 1.3rem;
}

ol.how li {
  margin-bottom: 0.5rem;
}

[hidden] {
  display: none !important;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}
