/* KETHRAX Bordbuch.
   World: an expedition manifest. Flat paper, ink rules, one signal colour that only
   ever means "this needs you" or "this is the thing to press". Structure comes from
   rules and columns, not from boxes. Light and dark follow the system setting. */

@font-face {
  font-family: "Big Shoulders Display";
  src: url("/team/fonts/big-shoulders-display-800.woff2") format("woff2");
  font-weight: 800;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/team/fonts/ibm-plex-sans-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/team/fonts/ibm-plex-sans-600.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}

:root {
  color-scheme: light dark;

  --paper: #ecebe6;
  --paper-2: #dfddd5;
  --ink: #16181b;
  --ink-2: #4b4f55;
  --rule-soft: #b7b4aa;
  --signal: #f04e23;
  --signal-text: #b3300c;
  --on-signal: #16181b;

  --display: "Big Shoulders Display", "Arial Narrow", sans-serif;
  --body: "IBM Plex Sans", "Segoe UI", sans-serif;
  --mono: "Cascadia Mono", Consolas, monospace;

  --size-small: 0.875rem;
  --size-body: 1.0625rem;
  --size-h2: clamp(1.5rem, 1.2rem + 0.9vw, 2rem);
  --size-h1: clamp(2.75rem, 1.4rem + 5.4vw, 5.75rem);

  --gutter: clamp(1.25rem, 0.6rem + 2.4vw, 3rem);
  --rule: 3px;
  --quick: 120ms;
  --out: cubic-bezier(0.16, 1, 0.3, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #15171a;
    --paper-2: #212428;
    --ink: #e9e7e0;
    --ink-2: #a8a9a4;
    --rule-soft: #3d4147;
    --signal-text: #ff7d55;
  }
}

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

html { scrollbar-color: var(--ink-2) var(--paper); }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: var(--size-body);
  line-height: 1.5;
  caret-color: var(--signal-text);
}

::selection { background: var(--signal); color: var(--on-signal); }

h1, h2, h3, p, ol, ul, dl, dd { margin: 0; }
ol, ul { padding: 0; list-style: none; }

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }

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

time { font-variant-numeric: tabular-nums; }

.skip-link { position: absolute; left: -999px; top: 0.5rem; background: var(--ink); color: var(--paper); padding: 0.5rem 0.75rem; z-index: 10; }
.skip-link:focus { left: 0.5rem; }

/* ── display type ─────────────────────────────────────────────────────────── */
.wordmark, h1, h2, .crew-name {
  font-family: var(--display);
  font-weight: 800;
  text-transform: uppercase;
  line-height: 0.95;
}
.wordmark { font-size: 2rem; letter-spacing: 0.02em; }
h1 { font-size: var(--size-h1); letter-spacing: -0.01em; text-wrap: balance; max-width: 14ch; }
h2 { font-size: var(--size-h2); letter-spacing: 0.01em; margin-bottom: 1rem; }

.muted { color: var(--ink-2); }
.empty { color: var(--ink-2); padding: 0.75rem 0; }

/* ── masthead ─────────────────────────────────────────────────────────────── */
.masthead {
  display: flex;
  align-items: baseline;
  gap: 0.5rem 1.5rem;
  flex-wrap: wrap;
  padding: 1rem var(--gutter) 0.85rem;
  border-bottom: var(--rule) solid var(--ink);
}
.masthead-title { color: var(--ink-2); }
.masthead-end { margin-left: auto; display: flex; align-items: baseline; gap: 1.5rem; font-size: var(--size-small); }
.connection { display: inline-flex; align-items: center; gap: 0.5rem; }
.connection::before { content: ""; width: 0.6rem; height: 0.6rem; background: var(--rule-soft); }
.connection[data-state="live"]::before { background: var(--ink); }
.connection[data-state="offline"] { color: var(--signal-text); font-weight: 600; }
.connection[data-state="offline"]::before { background: var(--signal); }

/* ── sheet layout ─────────────────────────────────────────────────────────── */
.sheet {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 0 var(--gutter);
  padding: 0 var(--gutter) 5rem;
  max-width: 96rem;
  margin: 0 auto;
}
.sheet > section { padding: 2rem 0 2.75rem; }
.sheet > section + section { border-top: var(--rule) solid var(--ink); }
.now, .crew { border-top: 0 !important; }
.log, .decide { align-self: start; }
.plan, .docs { grid-column: 1 / -1; }

/* ── now ──────────────────────────────────────────────────────────────────── */
.now { display: grid; gap: 1.75rem; align-content: start; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.35rem 1.5rem; max-width: 40rem; }
.facts dt { color: var(--ink-2); }
.facts code { font-family: var(--mono); font-size: 0.95em; }
.play { display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; }
.play-note { color: var(--ink-2); max-width: 34ch; font-size: var(--size-small); }

.button {
  display: inline-block;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  padding: 0.85rem 1.6rem;
  border: 2px solid var(--ink);
  border-radius: 2px;
  background: var(--signal);
  color: var(--on-signal);
  cursor: pointer;
  transition: background-color var(--quick), color var(--quick), transform var(--quick) var(--out);
}
.button:hover { background: var(--ink); color: var(--paper); }
.button:active { transform: translateY(2px); }
.button[hidden] { display: none; }
.button:disabled { background: transparent; color: var(--ink-2); border: 2px dashed var(--rule-soft); cursor: not-allowed; transform: none; }

.text-button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
.text-button:hover { text-decoration-thickness: 2px; }

/* ── crew ─────────────────────────────────────────────────────────────────── */
.crew-row { padding: 1rem 0 1.15rem; border-top: 1px solid var(--rule-soft); }
.crew-row:first-child { border-top: 0; padding-top: 0; }
.crew-name { font-size: 1.75rem; margin-bottom: 0.3rem; }
.crew-task { max-width: 46ch; }
.crew-task.is-idle { color: var(--ink-2); }
.crew-meta { display: flex; flex-wrap: wrap; gap: 0.1rem 1.25rem; margin-top: 0.4rem; color: var(--ink-2); font-size: var(--size-small); }
.crew-area { color: var(--ink); font-weight: 600; }

/* ── log ──────────────────────────────────────────────────────────────────── */
.log-day { font-weight: 600; padding: 1.1rem 0 0.4rem; border-bottom: 1px solid var(--ink); }
.log-day:first-child { padding-top: 0; }
.log-entry {
  display: grid;
  grid-template-columns: 3.75rem 6.5rem minmax(0, 1fr) max-content;
  gap: 0 1rem;
  align-items: baseline;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--rule-soft);
}
.log-time, .log-kind { color: var(--ink-2); font-size: var(--size-small); }
.log-who { font-weight: 600; overflow-wrap: anywhere; }
.log-entry.is-new { animation: arrive 2.4s var(--out); }
@keyframes arrive { from { background: var(--signal); color: var(--on-signal); } }

/* ── decisions: the one coloured field on the page ────────────────────────── */
.decide.has-items { background: var(--signal); color: var(--on-signal); padding-inline: 1.25rem; margin-inline: -1.25rem; }
.decide.has-items :focus-visible { outline-color: var(--on-signal); }
.decision { padding: 0.8rem 0; border-top: 1px solid currentColor; }
.decision-who { display: block; font-weight: 600; font-size: var(--size-small); margin-top: 0.15rem; }

/* ── plan ─────────────────────────────────────────────────────────────────── */
#phases { columns: 2 24rem; column-gap: var(--gutter); }
.phase {
  break-inside: avoid;
  display: grid;
  grid-template-columns: 1rem minmax(0, 1fr) max-content;
  gap: 0 0.9rem;
  align-items: baseline;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--rule-soft);
}
.phase-mark { width: 0.85rem; height: 0.85rem; border: 2px solid var(--ink-2); align-self: center; }
.phase[data-status="begonnen"] .phase-mark,
.phase[data-status="prototyp"] .phase-mark { border-color: var(--ink); background: linear-gradient(to top right, var(--signal) 50%, transparent 50%); }
.phase[data-status="fertig"] .phase-mark,
.phase[data-status="getestet"] .phase-mark { border-color: var(--ink); background: var(--ink); }
.phase[data-status="geplant"] { color: var(--ink-2); }
.phase-note { display: block; color: var(--ink-2); font-size: var(--size-small); }
.phase-status { font-size: var(--size-small); }
.phase:not([data-status="geplant"]) .phase-title,
.phase:not([data-status="geplant"]) .phase-status { font-weight: 600; }

/* ── documents ────────────────────────────────────────────────────────────── */
.doc-list { columns: 2 24rem; column-gap: var(--gutter); }
.doc { break-inside: avoid; padding: 0.7rem 0; border-bottom: 1px solid var(--rule-soft); }
.doc .text-button { font-weight: 600; text-align: left; }
.doc-status { display: block; color: var(--ink-2); font-size: var(--size-small); margin-top: 0.1rem; }

/* ── reader ───────────────────────────────────────────────────────────────── */
.reader { width: min(60rem, 100vw); height: 100vh; max-width: none; max-height: none; margin: 0 0 0 auto; padding: 0; border: 0; border-left: var(--rule) solid var(--ink); background: var(--paper); color: var(--ink); }
.reader[open] { display: flex; flex-direction: column; }
.reader::backdrop { background: rgb(22 24 27 / 0.6); }
.reader-bar { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding: 0.9rem var(--gutter); border-bottom: 1px solid var(--ink); font-size: var(--size-small); }
.reader-path { color: var(--ink-2); overflow-wrap: anywhere; }
.reader-body { overflow: auto; padding: 2rem var(--gutter) 5rem; line-height: 1.6; }
.reader-body > * { max-width: 72ch; }
.reader-body > .table-wrap { max-width: none; }
.reader-body h1, .reader-body h2, .reader-body h3 { text-transform: none; font-family: var(--body); font-weight: 600; line-height: 1.25; letter-spacing: 0; max-width: 40ch; }
.reader-body h1 { font-family: var(--display); font-weight: 800; text-transform: uppercase; font-size: clamp(2rem, 1.4rem + 2vw, 3rem); line-height: 1; margin-bottom: 1.5rem; }
.reader-body h2 { font-size: 1.4rem; margin: 2.5rem 0 0.75rem; padding-top: 0.75rem; border-top: 1px solid var(--ink); }
.reader-body h3 { font-size: 1.1rem; margin: 1.75rem 0 0.5rem; }
.reader-body p, .reader-body ul, .reader-body ol, .reader-body pre, .reader-body .table-wrap, .reader-body blockquote { margin: 0 0 1rem; }
.reader-body ul, .reader-body ol { padding-left: 1.4rem; }
.reader-body ul { list-style: square; }
.reader-body ol { list-style: decimal; }
.reader-body li { margin: 0.2rem 0; }
.reader-body code { font-family: var(--mono); font-size: 0.9em; background: var(--paper-2); padding: 0.05em 0.3em; }
.reader-body pre { background: var(--paper-2); padding: 1rem; overflow: auto; }
.reader-body pre code { background: none; padding: 0; }
.reader-body .table-wrap { overflow-x: auto; }
.reader-body table { border-collapse: collapse; width: 100%; font-size: 0.95rem; font-variant-numeric: tabular-nums; }
.reader-body th, .reader-body td { border-bottom: 1px solid var(--rule-soft); padding: 0.45rem 1rem 0.45rem 0; text-align: left; vertical-align: top; }
.reader-body th { border-bottom: 1px solid var(--ink); font-weight: 600; }
.reader-body blockquote { margin-left: 0; padding-left: 1.25rem; color: var(--ink-2); }
.reader-body hr { border: 0; border-top: 1px solid var(--ink); margin: 2rem 0; }
/* Second-level headings already carry a rule; a divider right before one would double it. */
.reader-body hr:has(+ h2) { display: none; }

/* ── sign-in ──────────────────────────────────────────────────────────────── */
.signin { max-width: 34rem; padding: clamp(2rem, 12vh, 8rem) var(--gutter) 3rem; display: grid; gap: 1.25rem; }
.signin .wordmark { font-size: clamp(4rem, 2rem + 12vw, 7rem); line-height: 0.85; }
.signin-error { border: 2px solid var(--ink); background: var(--signal); color: var(--on-signal); padding: 0.6rem 0.8rem; font-weight: 600; }
.signin form { display: grid; gap: 0.5rem; margin-top: 0.75rem; justify-items: start; }
.signin label { font-weight: 600; }
.signin input { width: 100%; font: inherit; font-family: var(--mono); color: inherit; background: transparent; border: 0; border-bottom: 2px solid var(--ink); border-radius: 0; padding: 0.6rem 0; }
.signin input:focus-visible { outline: 0; border-bottom-color: var(--signal); border-bottom-width: 4px; padding-bottom: calc(0.6rem - 2px); }
.signin .button { margin-top: 1rem; }

/* ── narrow screens & reduced motion ──────────────────────────────────────── */
@media (max-width: 62rem) {
  .sheet { grid-template-columns: minmax(0, 1fr); }
  .crew { border-top: var(--rule) solid var(--ink) !important; }
}
@media (max-width: 36rem) {
  .log-entry { grid-template-columns: 3.75rem minmax(0, 1fr); }
  .log-text { grid-column: 1 / -1; }
  .log-kind { display: none; }
  .facts { grid-template-columns: 1fr; gap: 0; }
  .facts dd { margin-bottom: 0.5rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
