/* House UI kit: the shared look of the house's own web pages (the start page, the error page,
   the bots' websites, netportal, ...). Served by Caddy on every house site at /_house/ui.css
   (same origin: works under a CSP with style-src 'self'). System fonts only, light and dark,
   no external resources. How to use it: docs/DOMAINS.md, "House UI kit".

   Tokens (--h-*): change them here, every page follows. Components (.h-*): opt-in classes;
   nothing here styles a page's own elements beyond a sane base for body, links and focus. */

:root {
  color-scheme: light dark;
  --h-bg: #f7f3ec;
  --h-bg-2: #efe8dc;                /* a second, quieter background (code, icons, the glow) */
  --h-surface: #fffdf9;
  --h-text: #2b2520;
  --h-muted: #6b5f55;
  --h-line: #e6ddd0;
  --h-accent: #b5471f;
  --h-accent-ink: #ffffff;          /* text on --h-accent */
  --h-accent-soft: #f6dcd0;
  --h-ok: #3f6b4f;
  --h-ok-soft: #dcebe0;
  --h-warn: #8a5a00;
  --h-warn-soft: #f7e7c4;
  --h-bad: #b3261e;
  --h-bad-soft: #f9dedc;
  --h-ring: #b5471f;                /* at least 3:1 on the background (a focus ring) */
  --h-radius: 14px;
  --h-font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --h-mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  --h-shadow: 0 1px 2px rgba(60, 40, 20, .05), 0 10px 30px rgba(60, 40, 20, .07);
}
@media (prefers-color-scheme: dark) {
  :root {
    --h-bg: #1b1917;
    --h-bg-2: #221f1c;
    --h-surface: #27231f;
    --h-text: #f1ebe3;
    --h-muted: #b3a89c;
    --h-line: #3a342e;
    --h-accent: #e8864f;
    --h-accent-ink: #1b1917;
    --h-accent-soft: #3d2a20;
    --h-ok: #9ccfa9;
    --h-ok-soft: #24332a;
    --h-warn: #f0c56a;
    --h-warn-soft: #3a2f17;
    --h-bad: #f2a29b;
    --h-bad-soft: #3d2220;
    --h-ring: #f0a070;
    --h-shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 10px 30px rgba(0, 0, 0, .3);
  }
}

/* Base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--h-bg);
  color: var(--h-text);
  font: 16px/1.55 var(--h-font);
}
a { color: var(--h-accent); }
:focus-visible { outline: 3px solid var(--h-ring); outline-offset: 3px; border-radius: 8px; }
[hidden] { display: none !important; }

/* House bar: back to the start page and the app's name.
   <header class="h-bar"><a class="h-home" href="https://<base domain>/">⌂ <span>Scharni</span></a>
   <span class="h-bar-app">Deals</span></header> */
.h-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  min-height: 52px; padding: 4px 16px;
  background: var(--h-surface); border-bottom: 1px solid var(--h-line);
}
.h-home {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 4px;
  color: var(--h-text); font-weight: 700; text-decoration: none;
}
.h-home:hover { color: var(--h-accent); }
.h-bar-app { color: var(--h-muted); font-weight: 600; }
.h-bar-app::before { content: "·"; margin-right: 10px; color: var(--h-muted); }
.h-bar > .h-lang, .h-bar > .h-bar-end { margin-left: auto; }

/* Buttons: <a> or <button>. .quiet = outlined, .danger = destructive. */
.h-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 8px 18px; border: 0; border-radius: 999px;
  background: var(--h-accent); color: var(--h-accent-ink);
  font: inherit; font-weight: 650; text-decoration: none; cursor: pointer;
  transition: filter .15s ease, transform .15s ease;
}
.h-btn:hover { filter: brightness(1.05); }
.h-btn:active { transform: translateY(1px); }
.h-btn.quiet { background: transparent; color: var(--h-accent); box-shadow: inset 0 0 0 1.5px var(--h-accent); }
.h-btn.danger { background: var(--h-bad); color: var(--h-surface); }
.h-btn.danger.quiet { background: transparent; color: var(--h-bad); box-shadow: inset 0 0 0 1.5px var(--h-bad); }
.h-btn:disabled, .h-btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; filter: none; transform: none; }

/* Card: a surface for one thing. */
.h-card {
  padding: 16px; border-radius: var(--h-radius);
  background: var(--h-surface); border: 1px solid var(--h-line); box-shadow: var(--h-shadow);
}
.h-card > :first-child { margin-top: 0; }
.h-card > :last-child { margin-bottom: 0; }

/* Note: a message box. .ok .warn .bad; without one, neutral. Give it role="status" or
   role="alert" when it appears after an action. */
.h-note {
  margin: 12px 0; padding: 12px 14px; border-radius: var(--h-radius);
  background: var(--h-bg-2); border-left: 4px solid var(--h-muted); color: var(--h-text);
}
.h-note.ok { background: var(--h-ok-soft); border-left-color: var(--h-ok); }
.h-note.warn { background: var(--h-warn-soft); border-left-color: var(--h-warn); }
.h-note.bad { background: var(--h-bad-soft); border-left-color: var(--h-bad); }
.h-note > :first-child { margin-top: 0; }
.h-note > :last-child { margin-bottom: 0; }

/* Field: the label above its input. <div class="h-field"><label for="x">Name</label>
   <input id="x"><small>help</small></div> */
.h-field { display: grid; gap: 6px; margin: 0 0 14px; }
.h-field > label { font-weight: 650; }
.h-field > small { color: var(--h-muted); font-size: 14px; }
.h-field input, .h-field select, .h-field textarea {
  width: 100%; min-height: 44px; padding: 8px 12px;
  border: 1px solid var(--h-line); border-radius: 10px;
  background: var(--h-surface); color: var(--h-text); font: inherit;
}
.h-field textarea { min-height: 96px; }
.h-field input:focus-visible, .h-field select:focus-visible, .h-field textarea:focus-visible { border-color: var(--h-ring); }
.h-field [aria-invalid="true"] { border-color: var(--h-bad); }

/* Badge: a short label. .ok .warn .bad like .h-note. */
.h-badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 650; line-height: 1.6;
  background: var(--h-accent-soft); color: var(--h-text);
}
.h-badge.ok { background: var(--h-ok-soft); color: var(--h-ok); }
.h-badge.warn { background: var(--h-warn-soft); color: var(--h-warn); }
.h-badge.bad { background: var(--h-bad-soft); color: var(--h-bad); }

/* Language switch: <nav class="h-lang"><button aria-pressed="true">Deutsch</button>...</nav>.
   The house's choice is the cookie house_lang (de, en, uk) for the whole domain. */
.h-lang { display: flex; justify-content: flex-end; }
.h-lang button, .h-lang a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 6px 12px; margin-left: -1px;
  border: 1px solid var(--h-line); background: var(--h-surface); color: var(--h-muted);
  font: inherit; font-size: 13px; text-decoration: none; cursor: pointer;
}
.h-lang > :first-child { border-radius: 999px 0 0 999px; margin-left: 0; }
.h-lang > :last-child { border-radius: 0 999px 999px 0; }
.h-lang [aria-pressed="true"], .h-lang [aria-current="true"] {
  position: relative; background: var(--h-text); border-color: var(--h-text); color: var(--h-bg);
}

/* Table: wide tables scroll inside the wrapper, not the page.
   <div class="h-table-wrap" tabindex="0" role="region" aria-label="..."><table>...</table></div> */
.h-table-wrap {
  overflow-x: auto; border: 1px solid var(--h-line); border-radius: var(--h-radius);
  background: var(--h-surface);
}
.h-table-wrap table { width: 100%; border-collapse: collapse; font-size: 15px; }
.h-table-wrap th, .h-table-wrap td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--h-line); vertical-align: top; }
.h-table-wrap th { color: var(--h-muted); font-weight: 650; font-size: 13px; }
.h-table-wrap tr:last-child td { border-bottom: 0; }

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