/* Garage — shared styles. Phone first; light and dark. */

:root {
  --bg: #f4f1ec;
  --surface: #ffffff;
  --surface-2: #ece8e1;
  --text: #1d1b18;
  --muted: #6b655c;
  --border: #d9d3c8;
  --accent: #b4521f;
  --accent-text: #ffffff;
  --go: #1f7a3d;
  --go-bg: #dff3e5;
  --caution: #8a5a00;
  --caution-bg: #fdefc9;
  --nogo: #b3261e;
  --nogo-bg: #fadad7;
  --unknown: #55606e;
  --unknown-bg: #e4e8ee;
  --radius: 12px;
  --gutter: 16px;
  --wall: #e6dfd2;
  --floor: #b9b1a3;
  --door-frame: #8c8579;
  --door: #d3cdc2;
  --door-line: #a39c8f;
  --closet: #7b6a55;
  --closet-door: #94826a;
  --metal: #3b3732;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15130f;
    --surface: #1f1c17;
    --surface-2: #2a261f;
    --text: #f1ece3;
    --muted: #a39b8d;
    --border: #3a352c;
    --accent: #e0793d;
    --accent-text: #15130f;
    --go: #6fd18c;
    --go-bg: #173323;
    --caution: #f0c25a;
    --caution-bg: #3a2f10;
    --nogo: #ff8f86;
    --nogo-bg: #3d1a17;
    --unknown: #a9b4c2;
    --unknown-bg: #262c34;
    --wall: #2b2822;
    --floor: #1c1a16;
    --door-frame: #54504a;
    --door: #3d3a34;
    --door-line: #2a2823;
    --closet: #4a3f31;
    --closet-door: #5a4c3a;
    --metal: #d8d2c6;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent); }

main { max-width: 760px; margin: 0 auto; padding: var(--gutter); }

.bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px var(--gutter);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 5;
}
.bar h1 { margin: 0; font-size: 1.1rem; flex: 1; }
.bar a { text-decoration: none; font-weight: 600; min-height: 44px; display: inline-flex; align-items: center; }

h2 { font-size: 1.05rem; margin: 24px 0 8px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin: 12px 0;
}

.muted { color: var(--muted); font-size: 0.9rem; }

button, .button {
  font: inherit;
  min-height: 44px;
  padding: 8px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
button.danger { color: var(--nogo); }
button:disabled { opacity: 0.55; cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

label { display: block; font-size: 0.9rem; font-weight: 600; margin: 10px 0 4px; }
input, select, textarea {
  font: inherit;
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}
input[type="checkbox"] { width: auto; min-height: 0; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1 1 120px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }

/* ---- verdict ---- */
.banner {
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.banner .icon { font-size: 2rem; font-weight: 800; width: 2.4rem; text-align: center; }
.banner .label { font-size: 1.6rem; font-weight: 800; line-height: 1.1; }
.banner .headline { font-size: 0.95rem; }

.lv-go { background: var(--go-bg); color: var(--go); }
.lv-caution { background: var(--caution-bg); color: var(--caution); }
.lv-nogo { background: var(--nogo-bg); color: var(--nogo); }
.lv-unknown { background: var(--unknown-bg); color: var(--unknown); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.85rem;
  font-weight: 600;
}

.leg h3 { margin: 0 0 4px; font-size: 1rem; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.hazards { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 6px; }
.hazards li { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.chip { background: var(--surface-2); border-radius: 999px; padding: 2px 10px; font-size: 0.85rem; }

.departures { display: grid; grid-template-columns: repeat(auto-fit, minmax(64px, 1fr)); gap: 6px; margin-top: 10px; }
.dep { border-radius: 8px; padding: 6px 4px; text-align: center; font-size: 0.8rem; font-weight: 600; }
.dep .t { display: block; }
.dep .best { display: block; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; }

.notice { border-left: 4px solid var(--caution); background: var(--caution-bg); color: var(--caution); padding: 10px 12px; border-radius: 8px; margin: 12px 0; }
.notice.bad { border-color: var(--nogo); background: var(--nogo-bg); color: var(--nogo); }

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); vertical-align: middle; }
td input { min-height: 38px; padding: 4px 8px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- disclosure (collapsible forms) ---- */
.disclosure { margin: 10px 0; }
.disclosure > summary {
  list-style: none;
  cursor: pointer;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-weight: 600;
}
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure[open] > summary { border-color: var(--accent); color: var(--accent); }
.disclosure-body { padding-top: 10px; }

/* ---- list rows ---- */
.item { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: flex-start; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); }
.item:last-child { border-bottom: 0; }
/* The text takes a readable width and the controls wrap beneath it on a phone,
   instead of squeezing the text into a sliver beside them. */
.item .main { flex: 1 1 220px; min-width: 0; }
.item .title { font-weight: 600; overflow-wrap: anywhere; }
.item .side { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.item button { min-height: 40px; padding: 4px 12px; }
.big { font-size: 2rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }

/* ---- closet grid ---- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; text-align: left; padding: 0; min-height: 0; width: 100%;
  /* A button centres its content vertically; pin it to the top so tiles line up. */
  display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; }
.tile .thumb { aspect-ratio: 4 / 3; background: var(--surface-2); display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 2rem; }
.tile .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .meta { padding: 8px 10px; }
.tile .meta strong { display: block; overflow-wrap: anywhere; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.filters button { min-height: 36px; padding: 2px 12px; border-radius: 999px; }
.filters button[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }

/* ---- the garage scene ---- */
.scene { width: 100%; height: auto; display: block; border-radius: var(--radius); border: 1px solid var(--border); background: var(--wall); }
.scene .hot { cursor: pointer; outline: none; }
.scene .hl { fill: none; stroke: var(--accent); stroke-width: 3; opacity: 0; rx: 6; pointer-events: none; }
.scene .hot:hover .hl, .scene .hot:focus-visible .hl { opacity: 1; }
.scene .sign-text { font: 800 15px system-ui, sans-serif; text-anchor: middle; fill: currentColor; }
.scene .badge-text { font: 700 12px system-ui, sans-serif; text-anchor: middle; fill: currentColor; }
.scene .sign-bg, .scene .badge-bg { fill: var(--sign-bg, var(--surface)); stroke: currentColor; stroke-width: 2; }
/* The level classes colour text; in the scene they also pick the sign's fill, via a
   custom property the child shapes inherit. */
.scene .lv-go { --sign-bg: var(--go-bg); background: none; }
.scene .lv-caution { --sign-bg: var(--caution-bg); background: none; }
.scene .lv-nogo { --sign-bg: var(--nogo-bg); background: none; }
.scene .lv-unknown { --sign-bg: var(--unknown-bg); background: none; }
.scene .metal { stroke: var(--metal); fill: none; stroke-linecap: round; stroke-linejoin: round; }
.scene .solid { fill: var(--metal); stroke: none; }

.entries { display: grid; gap: 10px; margin-top: 14px; }
.entry { display: flex; gap: 12px; align-items: center; text-decoration: none; color: inherit; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; min-height: 64px; }
.entry:hover { border-color: var(--accent); }
.entry .glyph { font-size: 1.6rem; width: 2rem; text-align: center; }
.entry .body { flex: 1; min-width: 0; }
.entry .name { font-weight: 700; }
.entry .arrow { color: var(--muted); }
