/* site.css: backupemail.ca design layer on top of WebTUI (css/webtui.css).
 *
 * WebTUI styles live in cascade layers (base, utils, components), so every
 * rule here is unlayered and wins without !important.
 *
 * Tokens: WebTUI's own --background0..3 / --foreground0..2, plus:
 *   --accent      highlight colour (your seat, focus, leaderboard bars)
 *   --accent-ink  text colour on top of --accent
 *   --ok          "fits tonight" badges
 */

/* ---------------------------------------------------------------- palettes */

:root,
[data-palette="amber"] {
  --background0: #17110a;
  --background1: #251c11;
  --background2: #3b2d1b;
  --background3: #5c462a;
  --foreground0: #ffd27a;
  --foreground1: #ecbd66;
  --foreground2: #b08a50;
  --accent: #ff9a3c;
  --accent-ink: #17110a;
  --ok: #c9e36b;
  color-scheme: dark;
}

[data-palette="phosphor"] {
  --background0: #0a120d;
  --background1: #122019;
  --background2: #1d3328;
  --background3: #2d4b3b;
  --foreground0: #b9ffd2;
  --foreground1: #93e3ae;
  --foreground2: #62a07a;
  --accent: #3dff8c;
  --accent-ink: #0a120d;
  --ok: #e6f27a;
  color-scheme: dark;
}

[data-palette="paper"] {
  --background0: #f4eee1;
  --background1: #e7dfca;
  --background2: #d5c8a6;
  --background3: #b6a67d;
  --foreground0: #1c1913;
  --foreground1: #3a3428;
  --foreground2: #675d4b;
  --accent: #b4321c;
  --accent-ink: #f4eee1;
  --ok: #2f6b2a;
  color-scheme: light;
}

[data-palette="night"] {
  --background0: #1c1c2b;
  --background1: #27273a;
  --background2: #38384f;
  --background3: #535375;
  --foreground0: #ebebf5;
  --foreground1: #c9c9dc;
  --foreground2: #9c9cb8;
  --accent: #f4c36a;
  --accent-ink: #1c1c2b;
  --ok: #8fd6a4;
  color-scheme: dark;
}

/* ------------------------------------------------------------- base type */

:root {
  /* System monospace only: no web fonts, nothing loaded from elsewhere. */
  --font-family: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas,
    "Roboto Mono", "Droid Sans Mono", "DejaVu Sans Mono", monospace;
  --font-size: 16px;
  --line-height: 1.5;
  --box-border-color: var(--foreground2);
}

@media (min-width: 30em) {
  :root { --font-size: 17px; }
}

[hidden] { display: none !important; }

html, body {
  /* WebTUI breaks words anywhere; that hurts readability in prose. */
  word-break: normal;
  overflow-wrap: anywhere;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.page {
  width: 100%;
  max-width: 40rem;
  margin: 0 auto;
  padding: 1.25rem 16px 2.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

h1 {
  font-size: 1.3em;
  color: var(--foreground0);
}
h1::before { content: "# "; color: var(--accent); }
h2 { color: var(--foreground0); }
h2::before { content: "## "; color: var(--foreground2); }

a { color: var(--accent); }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.dim { color: var(--foreground2); }
.small { font-size: 0.875em; }
.stack > * + * { margin-top: 0.75rem; }

/* Site header line, like a shell prompt. */
.prompt {
  color: var(--foreground2);
  font-size: 0.875em;
}
.prompt b { color: var(--accent); font-weight: var(--font-weight-normal); }

/* ------------------------------------------------------------- controls */

/* WebTUI's default button is 3 lines tall with a gradient trick; for thumbs
 * we want a solid block with a 44px tap target. */
button, [is-~="button"] {
  height: auto;
  min-height: 2.75rem;
  padding: 0.4rem 2ch;
  background-image: none;
  background-color: var(--mapped-primary);
  color: var(--mapped-secondary);
  cursor: pointer;
  touch-action: manipulation;
}
button[data-kind="accent"] {
  --button-primary: var(--accent);
  --button-secondary: var(--accent-ink);
}
button[data-kind="quiet"] {
  background: transparent;
  color: var(--foreground2);
  text-decoration: underline;
  padding-inline: 0;
}
button:disabled { opacity: 0.55; }
.button-row { display: flex; flex-wrap: wrap; gap: 0.75rem 1.25rem; align-items: center; }

input[type="text"], input[type="search"] {
  width: 100%;
  min-width: 0;
  height: auto;
  min-height: 2.75rem;
  padding: 0.4rem 1ch;
  font-size: max(16px, var(--font-size)); /* 16px+ stops iOS zooming in */
  border-bottom: 2px solid var(--foreground2);
}
input[type="text"]:focus, input[type="search"]:focus { border-bottom-color: var(--accent); }

.field { display: flex; flex-direction: column; gap: 0.35rem; }
.field label { color: var(--foreground1); }
.error { color: var(--accent); }
.error:empty { display: none; }

/* Footer with the palette switcher. */
.foot {
  max-width: 40rem;
  width: 100%;
  margin: 0 auto;
  padding: 1rem 16px 1.5rem;
  color: var(--foreground2);
  font-size: 0.875em;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1ch;
}
.foot button {
  min-height: 2rem;
  padding: 0 1ch;
  background: transparent;
  color: var(--foreground2);
}
.foot button[aria-pressed="true"] { color: var(--accent); text-decoration: underline; }
