/* MTM Studios
 *
 * The palette is defined ONCE per theme. Written twice it drifts, and it is then
 * wrong only for people on the system default — now the majority path, and the
 * one nobody tests.
 *
 * Every ratio below is measured, not guessed (scripts/check_contrast.py). A wall
 * display in a dim studio makes contrast a functional requirement, not a taste
 * question, so there is no --text-faint here at all: the palette does not offer a
 * colour that fails AA, rather than offering one and asking people not to use it.
 */

:root {
  color-scheme: light;

  --bg: #f6f4f1;
  --surface: #ffffff;
  --surface-sunken: #ece8e3;
  --border: #d6d0c8;
  --border-strong: #8d8478;

  --text: #1c1a17;
  --text-muted: #55504a;

  --accent: #8a4b1f;
  --accent-hover: #6f3c18;
  --accent-contrast: #ffffff;

  --ok: #1f6b3a;
  --ok-soft: #e3f0e7;
  --warn: #8a5a00;
  --warn-soft: #f8eeda;
  --danger: #9a2a20;
  --danger-soft: #f8e5e3;

  --radius: 6px;
  --gap: 1rem;
  --font: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;

    --bg: #161513;
    --surface: #201e1b;
    --surface-sunken: #2a2724;
    --border: #3b3733;
    --border-strong: #7a726a;

    --text: #f2efea;
    --text-muted: #b8b0a6;

    --accent: #e8934f;
    --accent-hover: #f2a868;
    --accent-contrast: #1c1a17;

    --ok: #7bc08f;
    --ok-soft: #1d2b21;
    --warn: #e0b45f;
    --warn-soft: #2c2617;
    --danger: #e98b80;
    --danger-soft: #2e1d1b;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #161513;
  --surface: #201e1b;
  --surface-sunken: #2a2724;
  --border: #3b3733;
  --border-strong: #7a726a;

  --text: #f2efea;
  --text-muted: #b8b0a6;

  --accent: #e8934f;
  --accent-hover: #f2a868;
  --accent-contrast: #1c1a17;

  --ok: #7bc08f;
  --ok-soft: #1d2b21;
  --warn: #e0b45f;
  --warn-soft: #2c2617;
  --danger: #e98b80;
  --danger-soft: #2e1d1b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
}

.wrap {
  max-width: 60rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 4rem;
}

header.app {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  border-bottom: 2px solid var(--border-strong);
  padding-bottom: 0.75rem;
  margin-bottom: 1.5rem;
}

header.app h1 {
  font-size: 1.35rem;
  margin: 0;
  letter-spacing: 0.01em;
}

.term {
  color: var(--text-muted);
  font-size: 0.9rem;
}

section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem;
  margin-bottom: 1.25rem;
}

section > h2 {
  margin: 0 0 0.85rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

input, select, textarea {
  width: 100%;
  padding: 0.5rem 0.6rem;
  font: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--surface-sunken);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
}

input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

button {
  font: inherit;
  font-weight: 600;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-contrast);
  cursor: pointer;
}

button:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

button.secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}

button.secondary:hover { background: var(--surface-sunken); }

ul.plain { list-style: none; margin: 0; padding: 0; }

.booking {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}

.booking:last-child { border-bottom: none; }

.booking .when { font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 0.9rem; }
.booking .room { font-weight: 600; }
.booking .who { color: var(--text-muted); font-size: 0.9rem; }

.badge {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  border: 1px solid currentColor;
}

.badge.provisional { color: var(--warn); background: var(--warn-soft); }
.badge.approved { color: var(--ok); background: var(--ok-soft); }

.notice {
  border-left: none;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 0.7rem 0.85rem;
  margin-bottom: 1rem;
  font-size: 0.92rem;
}

.notice.warn { background: var(--warn-soft); color: var(--text); border-color: var(--warn); }
.notice.error { background: var(--danger-soft); color: var(--text); border-color: var(--danger); }
.notice.ok { background: var(--ok-soft); color: var(--text); border-color: var(--ok); }

.empty { color: var(--text-muted); font-size: 0.92rem; }

footer.app {
  margin-top: 2rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.8rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

code.v { font-family: var(--mono); }
