/* Empty Classroom — MekaVerse style reference.
   Monochrome gallery: pure black void, white ink, charcoal controls, hairline frost.
   All colour lives in the campus render, which is the only object in the room. */

:root {
  /* Colors */
  --color-void: #000000;
  --color-bone: #ffffff;
  --color-charcoal: #444345;
  --color-frost: #e2e2e2;
  --color-ash: #b8bab9;

  /* Typography */
  --font-roobert: 'Roobert', 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono: 'GT America Mono', 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --text-caption: 10px;      --leading-caption: 1;     --tracking-caption: -0.2px;
  --text-heading-sm: 26px;   --leading-heading-sm: 1.15;
  --text-heading: 30px;      --leading-heading: 1;
  --text-display: 80px;      --leading-display: 0.78;
  --font-weight-regular: 400;

  /* Spacing */
  --spacing-4: 4px; --spacing-16: 16px; --spacing-20: 20px;
  --spacing-40: 40px; --spacing-116: 116px;
  --card-padding: 20px; --element-gap: 20px;

  /* Radius — the 2 / 10 / 20 triad is the entire system */
  --radius-buttons: 2px; --radius-nav: 2px;
  --radius-cards: 10px;  --radius-containers: 20px;
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 76px;   /* the nav is fixed; keep anchored heads clear of it */
}

body {
  margin: 0;
  background: var(--color-void);
  color: var(--color-bone);
  font: var(--font-weight-regular) 14px/1.15 var(--font-roobert);
  font-feature-settings: "liga" 0, "tnum" 1;
  -webkit-font-smoothing: antialiased;
}

/* Weight 400 everywhere — the whisper-authority rule. */
h1, h2, h3, b, strong { font-weight: var(--font-weight-regular); margin: 0; }

.caption {
  font: var(--font-weight-regular) var(--text-caption)/var(--leading-caption) var(--font-mono);
  letter-spacing: -0.02em;
  text-transform: uppercase;
  color: var(--color-frost);
}
.heading    { font: var(--font-weight-regular) var(--text-heading)/var(--leading-heading) var(--font-roobert); }
.heading-sm { font: var(--font-weight-regular) var(--text-heading-sm)/var(--leading-heading-sm) var(--font-roobert); }

.skip { position: absolute; left: -9999px; top: 0; z-index: 60; background: var(--color-charcoal); color: var(--color-bone); padding: 10px 20px; border-radius: var(--radius-buttons); }
.skip:focus { left: 0; }

:where(a, button, input, select, [tabindex]):focus-visible {
  outline: 1px solid var(--color-frost);
  outline-offset: 2px;
}

/* ------------------------------------------------------------------ buttons */
/* Charcoal fill, 2px radius, 1px frost border. Pressed in, never raised. */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--color-charcoal);
  color: var(--color-bone);
  border: 1px solid rgba(226, 226, 226, 0.45);
  border-radius: var(--radius-buttons);
  padding: 10px 20px;
  font: var(--font-weight-regular) 12px/1 var(--font-mono);
  letter-spacing: -0.02em; text-transform: uppercase;
  text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: var(--color-frost); }
.btn .caption { color: var(--color-ash); }

/* --------------------------------------------------------------------- nav */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--spacing-16);
  padding: 12px 25px;
  background: transparent;
  border-bottom: 1px solid rgba(226, 226, 226, 0.3);
  backdrop-filter: blur(6px);
}
.logo { display: inline-flex; align-items: center; gap: 8px; color: var(--color-bone); text-decoration: none; }
.glyph { width: 14px; height: 14px; flex: none; }
.logo-text { font: var(--font-weight-regular) 12px/1 var(--font-mono); letter-spacing: -0.02em; }
.nav-links { display: flex; align-items: center; gap: 7px; }
.nav-link {
  font: var(--font-weight-regular) 12px/1 var(--font-mono);
  letter-spacing: -0.02em; color: var(--color-bone); text-decoration: none;
  padding: 6px 25px; border-bottom: 1px solid transparent;
}
.nav-link:hover { border-bottom-color: var(--color-frost); }
.nav-right { display: flex; align-items: center; gap: 12px; }
.nav-right .caption { color: var(--color-ash); white-space: nowrap; }
.nav-btn { padding: 8px 14px; }

/* -------------------------------------------------------------- art frame */
/* No padding, no border, no shadow — the render fills the viewport. */
.frame { position: relative; height: 100svh; min-height: 560px; overflow: hidden; }
.art { position: absolute; inset: 0; background: var(--color-void); }
#map { position: absolute; inset: 0; }
/* Void image-overlay keeps white type legible over the render. */
.art-veil { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.42); pointer-events: none; }

.hero { position: absolute; left: 60px; bottom: 116px; z-index: 3; max-width: min(90vw, 900px); }

/* Hero stacked title — 80px / 400 / 0.78, each line marked by a frost hairline. */
.stack { display: flex; flex-direction: column; gap: 0; }
.line { display: block; }
.line-text {
  display: block;
  font: var(--font-weight-regular) clamp(46px, 13vw, var(--text-display))/var(--leading-display) var(--font-roobert);
  color: var(--color-bone);
  letter-spacing: 0;
}
.mark { display: block; width: 40%; height: 1px; background: var(--color-frost); margin-top: 4px; }

.sub {
  margin: var(--spacing-20) 0 0;
  font: var(--font-weight-regular) var(--text-caption)/1.3 var(--font-mono);
  letter-spacing: -0.02em; text-transform: uppercase; color: var(--color-ash);
  max-width: 44ch;
}
.hero-btn { margin-top: var(--spacing-20); }

.frame-foot {
  position: absolute; left: 60px; right: 25px; bottom: var(--spacing-40); z-index: 3;
  display: flex; align-items: center; gap: var(--spacing-20); flex-wrap: wrap;
}
.legend { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; display: inline-block; border: 1px solid rgba(226,226,226,.4); }
.sw-free { background: #1f8a5a; }   /* the render's colour, quoted in the key */
.sw-busy { background: var(--color-charcoal); }
#mapStatus:empty { display: none; }

/* ---------------------------------------------------------------- controls */
.controls {
  display: flex; align-items: flex-end; gap: var(--element-gap); flex-wrap: wrap;
  padding: var(--spacing-40) 60px var(--spacing-20);
  border-bottom: 1px solid rgba(226, 226, 226, 0.15);
}
.ctl { display: flex; flex-direction: column; gap: 6px; border: 0; margin: 0; padding: 0; min-width: 0; }
.ctl > .caption, .ctl > legend { color: var(--color-ash); padding: 0; }

input[type="date"], input[type="time"], select {
  background: var(--color-void);
  color: var(--color-bone);
  border: 1px solid rgba(226, 226, 226, 0.45);
  border-radius: var(--radius-buttons);
  padding: 9px 12px; min-height: 38px;
  font: var(--font-weight-regular) 12px/1 var(--font-mono);
  letter-spacing: -0.02em; appearance: none;
}
input[type="date"]:hover, input[type="time"]:hover, select:hover { border-color: var(--color-frost); }
select { padding-right: 30px; background-image: linear-gradient(45deg, transparent 50%, var(--color-ash) 50%), linear-gradient(135deg, var(--color-ash) 50%, transparent 50%); background-position: right 14px center, right 9px center; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
::-webkit-calendar-picker-indicator { filter: invert(1); opacity: .55; }

.seg-row { display: flex; }
.seg-row label { position: relative; }
.seg-row input { position: absolute; opacity: 0; pointer-events: none; }
.seg-row span {
  display: block; cursor: pointer; min-height: 38px; padding: 12px 16px;
  font: var(--font-weight-regular) 12px/1 var(--font-mono); letter-spacing: -0.02em;
  color: var(--color-ash);
  border: 1px solid rgba(226, 226, 226, 0.45); border-left-width: 0;
}
.seg-row label:first-child span { border-left-width: 1px; border-radius: var(--radius-buttons) 0 0 var(--radius-buttons); }
.seg-row label:last-child span { border-radius: 0 var(--radius-buttons) var(--radius-buttons) 0; }
.seg-row input:checked + span { background: var(--color-charcoal); color: var(--color-bone); border-color: var(--color-frost); }
.seg-row input:focus-visible + span { outline: 1px solid var(--color-frost); outline-offset: -3px; }

.toggle {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  min-height: 38px; padding: 9px 14px;
  border: 1px solid rgba(226, 226, 226, 0.45); border-radius: var(--radius-buttons);
  font: var(--font-weight-regular) 12px/1 var(--font-mono); letter-spacing: -0.02em;
  color: var(--color-ash);
}
.toggle input { appearance: none; width: 10px; height: 10px; margin: 0; border: 1px solid var(--color-ash); border-radius: 0; }
.toggle:has(input:checked) { background: var(--color-charcoal); color: var(--color-bone); border-color: var(--color-frost); }
.toggle:has(input:checked) input { background: var(--color-bone); border-color: var(--color-bone); }

.notice {
  margin: var(--spacing-20) 60px 0;
  padding: 12px var(--card-padding);
  border: 1px solid rgba(226, 226, 226, 0.35);
  border-radius: var(--radius-cards);
  color: var(--color-ash); line-height: 1.3; text-transform: none;
}

/* buildings strip */
.buildings {
  display: flex; gap: var(--spacing-4); overflow-x: auto;
  padding: var(--spacing-20) 60px 0; scrollbar-width: none;
}
.buildings::-webkit-scrollbar { display: none; }
.bchip {
  flex: none; cursor: pointer; background: transparent; color: var(--color-ash);
  border: 1px solid rgba(226, 226, 226, 0.35); border-radius: var(--radius-buttons);
  padding: 8px 12px; display: flex; align-items: center; gap: 8px;
  font: var(--font-weight-regular) 10px/1 var(--font-mono); letter-spacing: -0.02em;
  text-transform: uppercase; white-space: nowrap;
}
.bchip:hover { border-color: var(--color-frost); color: var(--color-bone); }
.bchip b { color: var(--color-bone); }
.bchip[aria-pressed="true"] { background: var(--color-charcoal); border-color: var(--color-frost); color: var(--color-bone); }

/* ------------------------------------------------------------------- index */
.index { padding: var(--spacing-40) 60px 0; scroll-margin-top: 76px; }
.group { margin-bottom: var(--spacing-40); scroll-margin-top: 76px; }
.group-head {
  display: flex; align-items: center; gap: var(--spacing-16);
  margin-bottom: var(--spacing-20);
}
.group-head .caption { color: var(--color-bone); }
.group-head hr { flex: 1; height: 0; border: 0; border-top: 1px solid rgba(226, 226, 226, 0.25); margin: 0; }

.cards { display: grid; gap: var(--spacing-4); grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.card {
  display: block; width: 100%; text-align: left; cursor: pointer;
  background: transparent; color: inherit;
  border: 1px solid rgba(226, 226, 226, 0.25);
  border-radius: var(--radius-cards);
  padding: var(--card-padding);
  font: inherit;
}
.card:hover { border-color: var(--color-frost); }
.card-top { display: flex; align-items: baseline; justify-content: space-between; gap: var(--spacing-16); }
.card-name { font: var(--font-weight-regular) 20px/1 var(--font-roobert); overflow-wrap: anywhere; }
.card-num { font-family: var(--font-mono); letter-spacing: -0.02em; }
.card-mark { width: 40%; height: 1px; background: rgba(226, 226, 226, 0.35); margin: 12px 0; }
.card-meta { display: flex; align-items: baseline; justify-content: space-between; gap: var(--spacing-16); }
.card-free { font: var(--font-weight-regular) var(--text-caption)/1.3 var(--font-mono); letter-spacing: -0.02em; text-transform: uppercase; color: var(--color-bone); }
.card-next { font: var(--font-weight-regular) var(--text-caption)/1.3 var(--font-mono); letter-spacing: -0.02em; text-transform: uppercase; color: var(--color-ash); }

/* room day strip — ash marks the occupied hours, void the free ones */
.strip { position: relative; height: 10px; margin-top: 12px; border: 1px solid rgba(226, 226, 226, 0.25); }
.strip .blk { position: absolute; top: 0; bottom: 0; background: var(--color-ash); }
.strip .win { position: absolute; top: -1px; bottom: -1px; border-left: 1px solid var(--color-bone); border-right: 1px solid var(--color-bone); }
.strip .now { position: absolute; top: -3px; bottom: -3px; width: 1px; background: var(--color-bone); }
.strip-scale { display: flex; justify-content: space-between; margin-top: 5px; }

.empty {
  border: 1px solid rgba(226, 226, 226, 0.35); border-radius: var(--radius-containers);
  padding: var(--spacing-40); text-align: center;
}
.empty .heading-sm { margin-bottom: var(--spacing-16); }

/* --------------------------------------------------------------------- day */
.day { padding: var(--spacing-40) 60px 0; scroll-margin-top: 76px; }
.day h2 { display: flex; align-items: baseline; gap: var(--spacing-16); margin-bottom: var(--spacing-20); }
.day h2 .caption { color: var(--color-ash); }
.day-scroll { overflow-x: auto; border: 1px solid rgba(226, 226, 226, 0.25); border-radius: var(--radius-containers); padding: var(--card-padding); }
.day-grid { min-width: 640px; }
.day-axis, .day-row { display: grid; grid-template-columns: 120px 1fr; gap: var(--spacing-16); align-items: center; }
.day-axis { margin-bottom: 8px; }
.day-ticks { display: flex; justify-content: space-between; }
.day-row { height: 13px; }
.day-row + .day-row { margin-top: 2px; }
.day-lab { font: var(--font-weight-regular) var(--text-caption)/1 var(--font-mono); letter-spacing: -0.02em; color: var(--color-ash); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.day-bar { position: relative; height: 9px; border: 1px solid rgba(226, 226, 226, 0.18); }
.day-bar .blk { position: absolute; top: 0; bottom: 0; background: var(--color-ash); }
.day-bar .now { position: absolute; top: -2px; bottom: -2px; width: 1px; background: var(--color-bone); }

/* ------------------------------------------------------------------- sheet */
.sheet { position: fixed; inset: 0; z-index: 70; background: rgba(0, 0, 0, 0.72); display: grid; place-items: end center; }
.sheet[hidden] { display: none; }
.sheet-panel {
  width: 100%; max-width: 620px; max-height: 88vh; overflow-y: auto;
  background: var(--color-void);
  border: 1px solid rgba(226, 226, 226, 0.35);
  border-radius: var(--radius-containers) var(--radius-containers) 0 0;
  padding: var(--card-padding) var(--card-padding) var(--spacing-40);
}
@media (min-width: 700px) {
  .sheet { place-items: center; }
  .sheet-panel { border-radius: var(--radius-containers); }
}
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--spacing-20); margin-bottom: var(--spacing-20); }
.sheet-head .caption { margin: 6px 0 0; color: var(--color-ash); }
.slot { display: grid; grid-template-columns: 108px 1fr; gap: var(--spacing-16); padding: 12px 0; border-top: 1px solid rgba(226, 226, 226, 0.2); }
.slot-time { font: var(--font-weight-regular) var(--text-caption)/1.3 var(--font-mono); letter-spacing: -0.02em; color: var(--color-ash); }
.slot-unit { font: var(--font-weight-regular) 16px/1.15 var(--font-roobert); }
.slot-desc { font: var(--font-weight-regular) var(--text-caption)/1.3 var(--font-mono); letter-spacing: -0.02em; color: var(--color-ash); margin-top: 5px; text-transform: uppercase; }
.slot.gap .slot-time, .slot.gap .slot-unit { color: var(--color-bone); }
.slot.gap .slot-unit::after { content: ""; display: block; width: 40%; height: 1px; background: var(--color-frost); margin-top: 6px; }

/* ------------------------------------------------------------------ caveat */
.caveat {
  margin: var(--spacing-40) 60px; padding-top: var(--spacing-20);
  border-top: 1px solid rgba(226, 226, 226, 0.15);
  color: var(--color-ash); line-height: 1.3; text-transform: none; max-width: 78ch;
}

/* ----------------------------------------------------------- mobile tabs */
/* Hidden on desktop, where the header nav does this job. */
.tabs { display: none; }

@media (max-width: 720px) {
  .nav { padding: 10px 16px; }
  .nav-links { display: none; }
  .nav-btn { display: none; }          /* NOW lives in the thumb bar instead */
  .logo-text { font-size: 11px; }

  .frame { height: 100svh; min-height: 480px; }
  /* Keep the type clear of the level bar on the right rail. */
  .hero { left: 20px; right: 76px; bottom: 132px; }
  .line-text { font-size: clamp(38px, 12.5vw, 64px); }
  .sub { max-width: none; }
  .frame-foot { left: 20px; right: 20px; bottom: 74px; gap: 10px 14px; }

  .controls, .buildings, .index, .day { padding-left: 20px; padding-right: 20px; }
  .notice, .caveat { margin-left: 20px; margin-right: 20px; }
  .cards { grid-template-columns: 1fr; }

  /* Controls in a two-up grid — thumbs need the width. */
  .controls { display: grid; grid-template-columns: 1fr 1fr; gap: var(--spacing-16); }
  .controls .seg, .controls .ctl:last-child { grid-column: 1 / -1; }
  .seg-row { width: 100%; }
  .seg-row label { flex: 1; }
  .seg-row span { text-align: center; }

  /* 44px minimum touch targets throughout. */
  input[type="date"], input[type="time"], select,
  .seg-row span, .toggle, .btn, .bchip { min-height: 44px; }
  .seg-row span { display: flex; align-items: center; justify-content: center; padding: 0 8px; }
  .toggle, .bchip { align-items: center; }
  .hero-btn { width: 100%; justify-content: center; }

  .day-axis, .day-row { grid-template-columns: 92px 1fr; }
  .slot { grid-template-columns: 88px 1fr; }

  /* Clear the fixed tab bar. */
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  html { scroll-padding-top: 60px; }
  .index, .day, .group { scroll-margin-top: 60px; }
  .caveat { margin-bottom: var(--spacing-20); }

  .tabs {
    display: grid; grid-template-columns: repeat(4, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 55;
    background: var(--color-void);
    border-top: 1px solid rgba(226, 226, 226, 0.35);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tab {
    display: flex; align-items: center; justify-content: center;
    min-height: 56px; padding: 0 4px;
    background: transparent; border: 0;
    border-left: 1px solid rgba(226, 226, 226, 0.15);
    color: var(--color-ash); text-decoration: none; cursor: pointer;
    font: var(--font-weight-regular) var(--text-caption)/1 var(--font-mono);
    letter-spacing: -0.02em; text-transform: uppercase;
  }
  .tab:first-child { border-left: 0; }
  .tab[aria-current="true"] { background: var(--color-charcoal); color: var(--color-bone); }
  .tab-now { color: var(--color-bone); }

  #map .mapboxgl-ctrl-bottom-left { bottom: 74px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* --------------------------------------------- MazeMap chrome, re-skinned */
/* The SDK ships a white/blue control set. Pull it into the gallery palette so
   the render stays the only thing on screen carrying colour. */
#map .mazemap-control-zlevel-bar,
#map .mapboxgl-ctrl-group {
  background: var(--color-void);
  border: 1px solid rgba(226, 226, 226, 0.35);
  border-radius: var(--radius-buttons);
  box-shadow: none;
  overflow: hidden;
}
#map .mazemap-control-zlevel-bar button,
#map .mapboxgl-ctrl-group button {
  background: transparent;
  color: var(--color-ash);
  border: 0;
  border-top: 1px solid rgba(226, 226, 226, 0.15);
  font: var(--font-weight-regular) var(--text-caption)/1 var(--font-mono);
  letter-spacing: -0.02em;
}
#map .mazemap-control-zlevel-bar button:first-child,
#map .mapboxgl-ctrl-group button:first-child { border-top: 0; }
#map .mazemap-control-zlevel-bar button:hover { background: var(--color-charcoal); color: var(--color-bone); }
#map .mazemap-control-zlevel-bar button.active,
#map .mazemap-control-zlevel-bar button[class*="active"],
#map .mazemap-control-zlevel-bar .active {
  background: var(--color-charcoal) !important;
  color: var(--color-bone) !important;
}
#map .mapboxgl-ctrl-group button .mapboxgl-ctrl-icon { filter: invert(1) grayscale(1) opacity(.6); }
/* Attribution must stay for licensing; desaturate it rather than hide it. */
#map .mapboxgl-ctrl-attrib, #map .mapboxgl-ctrl-logo, #map .mm-attribution-control-override {
  filter: grayscale(1) opacity(0.45);
  background: transparent;
}
#map .mapboxgl-ctrl-attrib a { color: var(--color-ash); }
#map .mapboxgl-ctrl-bottom-left, #map .mapboxgl-ctrl-bottom-right { z-index: 2; }
/* The SDK parks the level bar bottom-left, straight through the hero title.
   The whole bottom-left cluster moves to the right rail; the left belongs to the type. */
#map .mapboxgl-ctrl-bottom-left {
  left: auto; right: 25px; bottom: 64px;
  display: flex; flex-direction: column; align-items: flex-end; gap: 6px;
}
#map .mazemap-control-zlevel-bar { max-height: min(46vh, 380px); }
/* MazeMap's own wordmark: attribution stays, colour does not. */
#map .mazemap-ctrl-logo, #map .mazemap-ctrl-logo-wrapper { filter: grayscale(1) opacity(0.45); }
@media (max-width: 720px) {
  #map .mapboxgl-ctrl-bottom-left { right: 16px; bottom: 58px; }
  /* The SDK's level buttons are 25px; thumbs need more. */
  #map .mazemap-control-zlevel-bar { max-height: 40vh; }
  #map .mazemap-control-zlevel-bar button,
  #map .mazemap-control-zlevel-bar .z-label {
    min-width: 40px; min-height: 40px;
    display: flex; align-items: center; justify-content: center;
  }
}
