/* base.css — reset, retro tokens, shared layout, a11y.
 * Retro is the only theme (no switcher), so these are the sole :root tokens —
 * no [data-theme="retro"] attribute scoping needed. Ported/trimmed from
 * menno-codes-v1's base.css + themes/retro.css. */

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; }
img, picture, svg, video { display: block; max-width: 100%; }
a { color: inherit; }

/* ---------- tokens: retro (Omarchy Retro-82, dark only) ---------- */
:root {
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, "Liberation Mono", monospace;
  --font: var(--mono);

  --bg: #05182e;
  --surface: #0d2742;
  --ink: #f6dcac;
  --ink-soft: #6fa39d;
  --ink-faint: #4c7a75;
  --rule: #134e5a;
  --divider: #0e2e3a;
  --link: #8cbfb8;
  --accent: #faa968;
  --nav-active: #faa968;
  --code-bg: #0d2742;

  color-scheme: dark;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
}

/* ---------- prose ----------
 * Minimal spacing for hand-written page content — not a full .markdown-body
 * treatment (no code blocks/tables/etc. yet), just enough that headings and
 * paragraphs in app/views/pages/*.html.erb don't run together after the
 * global `* { margin: 0 }` reset above. */
main :is(h2, h3, h4) { margin: 1.5em 0 0.5em; }
main :is(h2, h3, h4):first-child { margin-top: 0; }
main p { margin: 0 0 1em; }
main p:last-child { margin-bottom: 0; }
main ul { margin: 0 0 1em; padding-left: 1.4em; }
main li + li { margin-top: 0.3em; }

/* ---------- shared layout ---------- */
.page {
  max-width: 42rem;
  margin: 0 auto;
  padding: 44px 24px 40px;
}

.rule-soft {
  border: 0;
  border-top: 1px solid var(--divider);
  margin: 22px 0;
}

.menu {
  display: flex;
  gap: 16px;
  align-items: center;
  font-size: 0.9rem;
}
.menu__link { color: var(--link); }
.menu__link[aria-current="page"] {
  color: var(--ink);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--nav-active);
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
}
.menu__sep { color: var(--ink-faint); }
.menu__ext { color: var(--ink-faint); }

.site-footer {
  max-width: 42rem;
  margin: 0 auto;
  padding: 18px 24px 40px;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  align-items: center;
  font-size: 0.8125rem;
  color: var(--ink-soft);
}
.switcher { display: flex; gap: 9px; align-items: center; }
.switcher__opt { color: var(--link); text-decoration: none; }
.switcher__opt:hover { text-decoration: underline; }
.switcher__opt.is-active { color: var(--ink); font-weight: 600; }

.site-footer__source { margin-left: auto; color: var(--ink-soft); text-decoration: none; }
.site-footer__source:hover { text-decoration: underline; }
.site-footer__auth { display: flex; gap: 6px; align-items: baseline; color: var(--ink-faint); }
.site-footer__auth a { color: var(--link); text-decoration: none; }
.site-footer__auth a:hover { text-decoration: underline; }
.site-footer__signout {
  padding: 0;
  font: inherit;
  color: var(--link);
  background: none;
  border: 0;
  cursor: pointer;
}
.site-footer__signout:hover { text-decoration: underline; }

/* ---------- forms ---------- */
.field { display: block; margin: 0 0 1em; }
.field__label {
  display: block;
  margin-bottom: 0.35em;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

input[type="text"],
input[type="password"],
input[type="email"],
select {
  width: 100%;
  max-width: 24rem;
  padding: 0.5em 0.6em;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 6px;
}
input::placeholder { color: var(--ink-faint); }

/* Only `form.submit` (renders <input type="submit">) — not `button_to`'s
 * <button type="submit">, which powers the footer's Sign out and the users
 * index's Delete, both meant to look like plain secondary actions, not a
 * primary CTA. */
input[type="submit"] {
  padding: 0.55em 1.1em;
  font: inherit;
  font-weight: 600;
  color: var(--bg);
  background: var(--accent);
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}
input[type="submit"]:hover {
  opacity: 0.9;
}

.form-errors {
  margin: 0 0 1em;
  padding: 0.75em 1em;
  color: #ffb4ab;
  background: #3a1512;
  border-radius: 6px;
}
.form-errors p { margin: 0; }
.form-errors ul { margin: 0.4em 0 0; padding-left: 1.2em; }

.flash {
  margin: 0 0 1em;
  padding: 0.6em 0.9em;
  border-radius: 6px;
  font-size: 0.9rem;
}
.flash--alert { color: #ffb4ab; background: #3a1512; }
.flash--notice { color: #7fdca0; background: #10301d; }

/* Figlet wordmark. The ASCII is ~94 cols wide, so it's sized off the column
 * width (container query) and never allowed past 11px — it scales down to fit
 * instead of scrolling. Below 34rem the one-liner is swapped for the stacked
 * MENNO / .CODES (each ~48 cols, so it can run a little larger). */
.wordmark { container-type: inline-size; overflow-x: auto; overflow-y: hidden; color: var(--accent); }
.wordmark__full, .wordmark__top, .wordmark__bottom {
  margin: 0;
  line-height: 1.05;
}
.wordmark__full { font-size: min(10px, 1.5cqw); }
.wordmark__top, .wordmark__bottom { display: none; font-size: min(12px, 2.9cqw); }
@media (max-width: 34rem) {
  .wordmark__full { display: none; }
  .wordmark__top, .wordmark__bottom { display: block; }
}

/* ---------- a11y ---------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 8px;
  top: -3rem;
  z-index: 10;
  padding: 8px 14px;
  font: inherit;
  color: var(--link);
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 6px;
  text-decoration: none;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 8px; }

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

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
