:root {
  color-scheme: light dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --background: #fbf8f3;
  --surface: #fff;
  --surface-muted: #f6f1e8;
  --text: #1b1f27;
  --text-secondary: #5f5a52;
  --border: #e8e0d2;
  --brand: #f0b35b;
  --brand-deep: #8f5c0e;
  --brand-soft: #fcefd9;
  --danger: #b3372b;
  --danger-soft: #fcedeb;
  --on-danger: #fff;
  --shadow: 0 12px 32px rgb(27 31 39 / 7%);
}

/* Dark tokens live in two places: an explicit choice and the OS preference. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --background: #0e1117;
  --surface: #171b24;
  --surface-muted: #1f2430;
  --text: #ede8e0;
  --text-secondary: #a3a6af;
  --border: #2a303c;
  --brand-deep: #f6c985;
  --brand-soft: #2e2618;
  --danger: #f29a89;
  --danger-soft: #3a1f1f;
  --on-danger: #1b1305;
  --shadow: 0 12px 32px rgb(0 0 0 / 24%);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --background: #0e1117;
    --surface: #171b24;
    --surface-muted: #1f2430;
    --text: #ede8e0;
    --text-secondary: #a3a6af;
    --border: #2a303c;
    --brand-deep: #f6c985;
    --brand-soft: #2e2618;
    --danger: #f29a89;
    --danger-soft: #3a1f1f;
    --on-danger: #1b1305;
    --shadow: 0 12px 32px rgb(0 0 0 / 24%);
  }
}

:root[data-theme="light"] { color-scheme: light; }

* { box-sizing: border-box; }

/* display on buttons would otherwise override the HTML hidden attribute. */
[hidden] { display: none !important; }

html { min-width: 320px; background: var(--background); }

body {
  min-height: 100vh;
  margin: 0;
  background: var(--background);
  color: var(--text);
  line-height: 1.65;
}

a { color: var(--brand-deep); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 3px solid var(--brand-deep);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  z-index: 2;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.5rem 0.75rem;
  transform: translateY(-160%);
  border-radius: 0.5rem;
  background: var(--surface);
}
.skip-link:focus { transform: translateY(0); }

.site-header, .site-footer {
  width: min(100% - 2rem, 64rem);
  margin-inline: auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.wordmark {
  flex: 0 0 auto;
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 750;
  letter-spacing: -0.03em;
  text-decoration: none;
}
.wordmark span { color: var(--brand-deep); }

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem 1rem;
  font-size: 0.92rem;
}
.site-nav a[aria-current="page"] { color: var(--text); font-weight: 700; }
.language-nav { display: inline-flex; gap: 0.55rem; padding-left: 0.5rem; border-left: 1px solid var(--border); }
.language-nav a[aria-current="page"] { text-decoration: none; }

.page-shell { width: min(100% - 2rem, 52rem); margin: 0 auto; padding-block: 3rem 4.5rem; }
.hero { padding-block: 1.5rem 2.5rem; }
.eyebrow { color: var(--brand-deep); font-size: 0.78rem; font-weight: 750; letter-spacing: 0.12em; text-transform: uppercase; }
h1 { max-width: 18ch; margin: 0.45rem 0 0.8rem; font-size: clamp(2rem, 8vw, 3.3rem); line-height: 1.08; letter-spacing: -0.045em; }
h2 { margin: 0; font-size: 1.25rem; line-height: 1.3; letter-spacing: -0.02em; }
h3 { margin: 0; font-size: 1.06rem; line-height: 1.4; }
p { margin: 0.6rem 0 0; color: var(--text-secondary); }
.lead { max-width: 44rem; font-size: clamp(1.05rem, 3vw, 1.2rem); }
.updated { margin-top: -0.2rem; color: var(--brand-deep); font-size: 0.9rem; font-weight: 650; }

.card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.card, .policy-section, .auth-card, .info-section, .success-card {
  border: 1px solid var(--border);
  border-radius: 1.15rem;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.card { display: flex; flex-direction: column; align-items: flex-start; gap: 0.8rem; padding: 1.25rem; }
.card > p { flex: 1 1 auto; }
.card-link { font-weight: 700; }
.store-note { margin-top: 1.5rem; font-size: 0.88rem; }

.policy-intro { margin-bottom: 1.25rem; }
.policy-sections, .delete-content { display: grid; gap: 0.85rem; }
.policy-section, .info-section { padding: 1.15rem 1.25rem; }
.policy-section p, .info-section p { white-space: pre-line; overflow-wrap: anywhere; }
.section-title { margin-bottom: 0.15rem; }

.delete-layout { display: grid; gap: 1rem; }
.auth-card { padding: clamp(1rem, 4vw, 1.5rem); }
.auth-card > p { margin-bottom: 1rem; }
.account-email { margin-top: 0.85rem; overflow-wrap: anywhere; font-weight: 700; color: var(--text); }
.confirm-form { display: grid; gap: 0.65rem; margin-top: 1.15rem; }
#restart-sign-in-button { margin-top: 1.15rem; }
label { font-weight: 650; }
input {
  width: 100%;
  min-height: 2.9rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.7rem;
  background: var(--background);
  color: var(--text);
  font: inherit;
}
button, .button-link {
  display: inline-flex;
  min-height: 2.9rem;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  border: 1px solid transparent;
  border-radius: 0.75rem;
  background: var(--brand);
  color: #1b1305;
  font: inherit;
  font-weight: 750;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
button:hover:not(:disabled), .button-link:hover { filter: brightness(0.96); }
button:disabled { cursor: not-allowed; opacity: 0.58; }
.danger-button { background: var(--danger); color: var(--on-danger); }
.status-message { min-height: 1.6rem; margin: 0 0 0.75rem; color: var(--text); }
.status-message[data-kind="error"] { color: var(--danger); }
.status-message[data-kind="success"] { color: var(--text); }
.success-card { margin-top: 1rem; padding: 1.25rem; }
.theme-toggle {
  min-height: 2.2rem;
  padding: 0.3rem 0.75rem;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 650;
}
.contact-line { overflow-wrap: anywhere; }
.contact-link { font-weight: 650; }
.policy-link { display: inline-block; margin-top: 0.75rem; font-weight: 650; }

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding-block: 1.25rem 2rem;
  border-top: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.85rem;
}

@media (max-width: 42rem) {
  .site-header { align-items: flex-start; flex-direction: column; }
  .site-nav { justify-content: flex-start; gap: 0.55rem 0.8rem; }
  .language-nav { padding-left: 0.7rem; }
  .page-shell { padding-block: 2.25rem 3rem; }
  .card-grid { grid-template-columns: 1fr; }
  .site-footer { flex-direction: column; }
}
