/* Wilt - base.css
 * One of the per-page stylesheets split from the former single style.css.
 * Load order matters: base.css first, then this file. See docs/development.md. */

:root {
  color-scheme: dark;

  --bg: #0a000a;
  --card: rgba(60, 60, 67, 0.92);
  --bg-soft: #4a4a52;
  --bg-raised: #55555e;
  --line: #575760;
  --text: #f2f2f5;
  --muted: #d8d8e0;
  --accent: #d3d6dc;
  --accent-color: #7b93bf;
  --accent-hover: #c2d3f0;
  --accent-subtle: #8798b8;

  --line-soft: rgba(87, 87, 96, 0.55);
  --line-faint: rgba(87, 87, 96, 0.28);
  --panel: rgba(60, 60, 67, 0.42);
  --dim: #8e8e99;

  --topbar-bg: rgba(10, 0, 10, 0.82);
  --danger: #d9706f;
  --danger-text: #f0bcbb;
  --success: #6fa87c;
  --success-text: #c3e2c9;
  --warning-text: #e5cf9b;
  --checkmark-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23d3d6dc' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.5 8.5 6.5 11.5 12.5 4.5'/%3E%3C/svg%3E");

  --radius-sm: 6px;
  --radius: 9px;

  --maxw: 1060px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

html[data-theme='light'] {
  color-scheme: light;

  --bg: #f7f7f9;
  --card: #ffffff;
  --bg-soft: #ececf0;
  --bg-raised: #e2e2e8;
  --line: #d2d2db;
  --text: #17171c;
  --muted: #4c4c58;
  --accent: #1c1c22;
  --accent-color: #3f5b8c;
  --accent-hover: #000000;
  --accent-subtle: #6f83a3;

  --line-soft: rgba(23, 23, 28, 0.14);
  --line-faint: rgba(23, 23, 28, 0.08);
  --panel: #ffffff;
  --dim: #6f6f7c;

  --topbar-bg: rgba(247, 247, 249, 0.85);
  --danger: #c0565a;
  --danger-text: #8f2f34;
  --success: #3f7d4f;
  --success-text: #2b5c38;
  --warning-text: #7a5a12;
  --checkmark-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%2317171c' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.5 8.5 6.5 11.5 12.5 4.5'/%3E%3C/svg%3E");
}

html[data-theme='midnight'] {
  color-scheme: dark;

  --bg: #06080f;
  --card: rgba(26, 33, 51, 0.92);
  --bg-soft: #1a2133;
  --bg-raised: #232c42;
  --line: #2e3950;
  --text: #eef2fb;
  --muted: #c2cbdd;
  --accent: #d7e5ff;
  --accent-color: #5b8def;
  --accent-hover: #ffffff;
  --accent-subtle: #6f92d8;

  --line-soft: rgba(94, 116, 160, 0.4);
  --line-faint: rgba(94, 116, 160, 0.2);
  --panel: rgba(26, 33, 51, 0.5);
  --dim: #7b879e;

  --topbar-bg: rgba(6, 8, 15, 0.82);
  --checkmark-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23d7e5ff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.5 8.5 6.5 11.5 12.5 4.5'/%3E%3C/svg%3E");
}

html[data-theme='ember'] {
  color-scheme: dark;

  --bg: #120806;
  --card: rgba(74, 42, 34, 0.92);
  --bg-soft: #3a211b;
  --bg-raised: #4a2a22;
  --line: #5c382e;
  --text: #fbeee9;
  --muted: #e2c6bc;
  --accent: #ffd9c9;
  --accent-color: #e08256;
  --accent-hover: #fff3ee;
  --accent-subtle: #c07a5c;

  --line-soft: rgba(146, 92, 74, 0.42);
  --line-faint: rgba(146, 92, 74, 0.22);
  --panel: rgba(74, 42, 34, 0.42);
  --dim: #a08279;

  --topbar-bg: rgba(18, 8, 6, 0.82);
  --checkmark-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23ffd9c9' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.5 8.5 6.5 11.5 12.5 4.5'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; }

  html { scroll-behavior: auto; }
}

a { color: inherit; text-decoration: none; }

img, svg { max-width: 100%; }

button { font: inherit; color: inherit; }

code { font-family: var(--mono); font-size: 0.94em; }

.shell {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 12px 16px;
  background: var(--bg-raised);
  border-radius: var(--radius);
  z-index: 60;
}

.skip:focus { left: 16px; top: 16px; }

.key-hint, .key-foot {
  margin: 4px 0 0;
  color: var(--dim);
  font-size: 12px;
  line-height: 1.55;
}

.key-result {
  display: grid;
  justify-items: start;
  gap: 10px;
  margin-top: 24px;
  padding: 18px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: var(--panel);
}

.key-result p {
  margin: 0;
}

.key-result code {
  overflow-wrap: anywhere;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 9px 20px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg);
}

.btn-primary:hover { background: #ffffff; }

.btn-ghost {
  border-color: var(--line);
  color: var(--text);
}

.btn-ghost:hover { background: var(--bg-soft); }

/* pointer-events stops the hover styles above from firing on a busy button,
   e.g. while an auth request is in flight. */
.btn:disabled {
  opacity: 0.6;
  cursor: default;
  pointer-events: none;
}

.handle {
  font-family: var(--mono);
  font-size: 0.94em;
  color: var(--accent);
  white-space: nowrap;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line-faint);
  background: var(--topbar-bg);
  backdrop-filter: blur(10px);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 16.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  color: var(--muted);
}

.nav-links a {
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background-color 0.15s;
}

.nav-links a:hover { color: var(--text); background: var(--bg-soft); }

.nav-actions { display: flex; align-items: center; gap: 8px; }

.nav-actions .btn { min-height: 38px; padding: 6px 16px; font-size: 13.5px; }

.nav-login {
  padding: 8px 6px;
  font-size: 13.5px;
  color: var(--muted);
}

.nav-login:hover { color: var(--text); }

/* The signed in name, filled in by js/session-nav.js. js/supabase.js already
   shortens a long email, so this width is only a backstop for a long username;
   it is set wide enough that the shortening is not then cut again. */
.nav-account {
  max-width: 26ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13.5px;
  color: var(--muted);
}

.nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
}

@media (max-width: 860px) {
  .nav-toggle { display: grid; place-items: center; }

  .nav-links, .nav-actions { display: none; }

  .topbar.is-open .nav {
    flex-wrap: wrap;
    row-gap: 4px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg-soft);
  }

  .topbar.is-open .nav > .brand { order: 1; padding: 0 4px; }

  .topbar.is-open .nav-toggle { order: 2; }

  .topbar.is-open .nav-links {
    order: 3;
    display: flex;
    flex-basis: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding-top: 12px;
  }

  .topbar.is-open .nav-links a { padding: 10px 12px; }

  .topbar.is-open .nav-actions {
    order: 4;
    display: flex;
    flex-basis: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    margin-top: 10px;
    padding-top: 14px;
    border-top: 1px solid var(--line-faint);
  }

  .topbar.is-open .nav-actions .btn { width: 100%; }

  .topbar.is-open .nav-login { text-align: center; }

  .topbar.is-open .nav-account { text-align: center; }
}

.site-footer {
  border-top: 1px solid var(--line-soft);
  padding: 46px 0 34px;
}

.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) repeat(2, minmax(0, 0.75fr));
  gap: 36px;
}

.footer-brand { display: flex; align-items: center; gap: 10px; }

.footer-blurb {
  margin: 14px 0 0;
  max-width: 36ch;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--muted);
}

.footer-col h4 {
  margin: 0 0 12px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--dim);
}

.footer-col ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 9px;
  font-size: 13.5px;
  color: var(--muted);
}

.footer-col a:hover { color: var(--text); }

.footer-base {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 38px;
  padding-top: 20px;
  border-top: 1px solid var(--line-faint);
  font-size: 12.5px;
  color: var(--dim);
}

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

.footer-base a:hover { color: var(--text); }

@media (max-width: 780px) {
  .footer-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }

  .footer-grid > :first-child { grid-column: span 2; }
}

.page-narrow { display: flex; flex-direction: column; min-height: 100vh; }

.auth-main {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 56px 24px;
}

/* A plain column on the page rather than a card, so the provider buttons and the
   form sit on the same surface. */
.auth-panel {
  width: 100%;
  max-width: 400px;
}

.auth-panel h1 {
  margin: 0 0 8px;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.auth-lede {
  margin: 0 0 26px;
  font-size: 14px;
  line-height: 1.65;
  color: var(--muted);
}

.field { display: grid; gap: 6px; margin-bottom: 15px; }

.field label { font-size: 12.5px; color: var(--dim); }

.field input, .field select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

.field input:focus, .field select:focus { outline: none; border-color: var(--accent); }

/* A select keeps the native arrow, so it needs room on the right for it. */
.field select {
  padding-right: 34px;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 19px) 50%, calc(100% - 14px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}

.field select option { background: var(--bg-soft); color: var(--text); }

.auth-panel form .btn { width: 100%; margin-top: 9px; }

.btn-sm { min-height: 32px; padding: 5px 12px; font-size: 13px; }

.status { font-size: 12.5px; color: var(--dim); }

.status.is-error { color: var(--danger-text); }

.status.is-success { color: var(--success-text); }

.status[hidden] { display: none; }

.empty { margin: 0; font-size: 13px; line-height: 1.6; color: var(--dim); }

.empty[hidden] { display: none; }

.dash-top .brand { margin-right: auto; }

/* Every icon inside a button is sized here rather than with a style attribute,
   which the CSP in _headers blocks. */
.btn svg { width: 15px; height: 15px; flex: none; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--dim);
}

.back-link:hover { color: var(--text); }

.back-link svg { width: 14px; height: 14px; flex: none; }

.checkpoints {
  padding-top: 16px;
  border-top: 1px solid var(--line-faint);
}

.settings { display: flex; flex-direction: column; gap: 44px; }

.bar {
  display: flex;
  flex: 1 1 0;
  align-items: flex-end;
  height: 100%;
  min-width: 2px;
}

/* .field and .key-result set their own display, which beats the browser default
   for the hidden attribute. Without this a field marked hidden still shows. */
.filter-bar .field[hidden], .key-result[hidden], .filter-bar[hidden] { display: none; }

/* Advertising consent bar, drawn by src/frontend/ts/ads.ts for visitors in the
   regions that require a choice. Both answers are the same button size so
   neither is favoured. */
.ad-consent {
  position: fixed;
  z-index: 60;
  right: 12px;
  bottom: 12px;
  left: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  align-items: center;
  justify-content: space-between;
  max-width: 680px;
  margin: 0 auto;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  backdrop-filter: blur(8px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.ad-consent-copy {
  flex: 1 1 260px;
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

.ad-consent-copy a {
  color: var(--accent-color);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ad-consent-actions { display: flex; gap: 8px; }

@media (max-width: 560px) {
  .ad-consent-actions { flex: 1 1 100%; }
  .ad-consent-actions .btn { flex: 1; }
}