/*
 * style.css — the DOM overlay: HUD, tile inspector, boot card.
 *
 * Owns: everything outside the canvas. The look target (PRD §4) is a game box
 * insert — cream card stock, rounded corners, slab-serif headers.
 * Does NOT own: anything drawn in 3D. Tile, piece and table colors live in
 * src/data/ and are applied by src/render/.
 *
 * Family swatch colors are set inline from `families.js` — the DOM never
 * hardcodes a family color.
 */

:root {
  --card: #f4ead6;
  --card-edge: #d8c6a3;
  --ink: #2f2418;
  --ink-soft: #6b5a45;
  --accent: #bf3b2c;
  --shadow: 0 10px 28px rgba(20, 12, 6, 0.45);
  --radius: 14px;
  --slab: "Rockwell", "Roboto Slab", Georgia, "Times New Roman", serif;
  --sans: "Avenir Next", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #231a14;
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

#table {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none; /* the orbit controls handle gestures themselves */
}

/* ---------------------------------------------------------------- HUD ---- */

.hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  gap: 14px;
  align-items: stretch;
  padding: 14px;
  pointer-events: none; /* the table stays draggable between the cards */
}

/* `display: flex` above outbids the UA stylesheet's [hidden] rule — say it here
   or the empty HUD shows through before the first deal. */
.hud[hidden] { display: none; }

.hud > * {
  pointer-events: auto;
  background: var(--card);
  border: 1px solid var(--card-edge);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 10px 14px;
}

.hud__brand h1 {
  font-family: var(--slab);
  font-size: 20px;
  letter-spacing: 0.01em;
  margin: 0;
}

.hud__round {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--ink-soft);
}

.hud__families {
  display: flex;
  gap: 16px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
}

.family {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: "swatch name" "swatch stats" "swatch heat";
  column-gap: 9px;
  align-items: center;
  min-width: 168px;
}

.family__swatch {
  grid-area: swatch;
  width: 16px;
  height: 100%;
  min-height: 40px;
  border-radius: 5px;
  border: 1px solid rgba(0, 0, 0, 0.25);
}

.family__name {
  grid-area: name;
  font-family: var(--slab);
  font-size: 14px;
  white-space: nowrap;
}

.family__name .tag {
  font-family: var(--sans);
  font-size: 10px;
  color: var(--ink-soft);
  margin-left: 5px;
}

.family__stats {
  grid-area: stats;
  font-size: 12px;
  color: var(--ink-soft);
  white-space: nowrap;
}

.family__stats b {
  color: var(--ink);
  font-weight: 700;
}

/* Heat meter — the siren. Marks at the Patrol and Raid thresholds, PRD §3.7. */
.heat {
  grid-area: heat;
  display: flex;
  gap: 2px;
  margin-top: 3px;
}

.heat__pip {
  width: 9px;
  height: 6px;
  border-radius: 2px;
  background: rgba(47, 36, 24, 0.16);
}

.heat__pip--on { background: var(--accent); }
.heat__pip--threshold { box-shadow: inset 0 0 0 1px rgba(47, 36, 24, 0.55); }

.hud__city { min-width: 250px; }

.hud__label {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ink-soft);
}

.hud__seedrow {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.hud__seed {
  flex: 1;
  min-width: 0;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 13px;
  padding: 5px 8px;
  border: 1px solid var(--card-edge);
  border-radius: 8px;
  background: #fffaf0;
  color: var(--ink);
}

.hud__hint {
  margin: 6px 0 0;
  font-size: 11px;
  color: var(--ink-soft);
}

.btn {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 8px;
  border: 1px solid var(--card-edge);
  background: #fffaf0;
  color: var(--ink);
  cursor: pointer;
}

.btn:hover { background: #fff; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn--primary {
  background: var(--accent);
  border-color: #8f2b20;
  color: #fff6ee;
}

.btn--primary:hover { background: #d0442f; }

/* ---------------------------------------------------- Tile inspector ---- */

.panel {
  position: fixed;
  right: 14px;
  bottom: 14px;
  width: 300px;
  max-height: 62vh;
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--card-edge);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px 16px;
}

.panel[hidden] { display: none; }

.panel__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.panel__title {
  font-family: var(--slab);
  font-size: 18px;
  margin: 0;
}

.panel__close {
  border: none;
  background: none;
  font-size: 18px;
  line-height: 1;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 0 2px;
}

.panel__blurb {
  margin: 6px 0 12px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink-soft);
  font-style: italic;
}

.panel__rows {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 12px;
  font-size: 13px;
  margin: 0;
}

.panel__rows dt {
  color: var(--ink-soft);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  align-self: center;
}

.panel__rows dd {
  margin: 0;
  font-weight: 600;
}

.owner-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 6px;
  border: 1px solid rgba(0, 0, 0, 0.3);
  vertical-align: baseline;
}

.note {
  margin: 12px 0 0;
  padding: 8px 10px;
  border-radius: 9px;
  background: rgba(191, 59, 44, 0.1);
  border: 1px solid rgba(191, 59, 44, 0.28);
  font-size: 12px;
  line-height: 1.4;
}

.note--calm {
  background: rgba(47, 36, 24, 0.06);
  border-color: rgba(47, 36, 24, 0.18);
  color: var(--ink-soft);
}

/* ------------------------------------------------------------- boot ---- */

.boot {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 6px;
  text-align: center;
  background: #231a14;
  color: var(--card);
}

.boot[hidden] { display: none; }

.boot__title {
  font-family: var(--slab);
  font-size: 22px;
  margin: 0;
}

.boot__note {
  margin: 0;
  font-size: 13px;
  color: #a3937b;
  max-width: 34ch;
}

.boot--error .boot__title { color: #f0836f; }

@media (max-width: 900px) {
  .hud { flex-wrap: wrap; }
  .hud__families { order: 3; width: 100%; }
  .panel { width: min(300px, calc(100vw - 28px)); }
}
