/* Hofbuch — the one stylesheet.
   Mobile-first: base rules target a phone held in one hand in a dim basement.
   Wider screens get a few adjustments at the bottom.
   Light theme only, by design (owner's eyesight). Change colors via the
   custom properties below, not inline. */

:root {
  /* Colors — all text/background pairs meet WCAG AA (most meet AAA). */
  --paper:       #faf8f3;   /* page background: warm off-white */
  --surface:     #ffffff;   /* cards */
  --ink:         #1f1c17;   /* body text, ~16:1 on paper */
  --ink-muted:   #575047;   /* secondary text, ~7.5:1 on paper */
  --line:        #d9d2c5;   /* borders */
  --stone:       #6b6358;   /* accents */
  --accent:      #1f5135;   /* barn-door green: primary buttons, links (~9:1) */
  --accent-ink:  #ffffff;
  --accent-soft: #e4efe7;
  --danger:      #9b1c1c;   /* errors, Safety priority (~7:1) */
  --danger-soft: #fbeaea;
  --warn:        #7a4b00;   /* Soon priority, due-soon (~7:1) */
  --warn-soft:   #fdf3e1;
  --focus:       #1a56db;

  /* Type */
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-head: Georgia, "Iowan Old Style", "Times New Roman", serif;
  --text-base: 1.0625rem;   /* 17px: readable at arm's length */
  --leading: 1.5;

  /* Space and shape */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --radius: 0.5rem;
  --touch: 2.75rem;         /* 44px minimum touch target */
  --page-max: 60rem;
  --gutter: 1rem;           /* 16px side gutter on phones */
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: var(--text-base)/var(--leading) var(--font-body);
}

h1, h2, h3 {
  font-family: var(--font-head);
  line-height: 1.2;
  margin: 0 0 var(--space-3);
}
h1 { font-size: 1.75rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; }

p { margin: 0 0 var(--space-3); }

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

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

.skip-link {
  position: absolute;
  left: -999px;
}
.skip-link:focus {
  left: var(--space-2);
  top: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--surface);
  z-index: 10;
}

/* ---- Header ---- */
.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-4);
  padding: var(--space-2) var(--gutter);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand {
  font-family: var(--font-head);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  min-height: var(--touch);
  display: inline-flex;
  align-items: center;
}
.nav-list {
  display: flex;
  gap: var(--space-1);
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-list a {
  display: inline-flex;
  align-items: center;
  min-height: var(--touch);
  padding: 0 var(--space-3);
  border-radius: var(--radius);
  text-decoration: none;
}
.nav-list a[aria-current="page"] {
  background: var(--accent-soft);
  font-weight: 600;
}
.logout { margin-left: auto; }

/* ---- Layout ---- */
.page {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: var(--space-5) var(--gutter) var(--space-6);
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
}
.narrow { max-width: 26rem; margin-inline: auto; }
.stack > * + * { margin-top: var(--space-4); }

/* ---- Forms ---- */
.field label {
  display: block;
  font-weight: 600;
  margin-bottom: var(--space-1);
}
input, select, textarea {
  width: 100%;
  min-height: var(--touch);
  padding: var(--space-2) var(--space-3);
  font: inherit;            /* 17px also stops iOS zooming on focus */
  color: var(--ink);
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius);
}
input:focus, select:focus, textarea:focus { border-color: var(--focus); }
.hint {
  color: var(--ink-muted);
  font-size: 0.9375rem;
  margin: var(--space-1) 0 0;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--touch);
  padding: 0 var(--space-4);
  font: inherit;
  font-weight: 600;
  border: 2px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
}
.btn-primary {
  width: 100%;
  background: var(--accent);
  color: var(--accent-ink);
}
.btn-quiet {
  background: transparent;
  color: var(--ink-muted);
  border-color: var(--line);
}

/* ---- Messages ---- */
.alert {
  padding: var(--space-3);
  border-left: 4px solid var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
  border-radius: var(--radius);
}

/* ---- Definition lists for facts (make, model, filter size...) ---- */
.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: var(--space-1) var(--space-4);
  margin: 0;
}
.facts dt { color: var(--ink-muted); }
.facts dd { margin: 0; font-weight: 600; }

/* htmx loading indicator (replaces the inline style htmx would inject) */
.htmx-indicator { opacity: 0; transition: opacity 200ms; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }

/* ---- Wider screens ---- */
@media (min-width: 40rem) {
  :root { --gutter: 1.5rem; }
  .btn-primary { width: auto; }
}
