/* YorkNav UI prototype
   Concept: the building's own wayfinding, on screen. Room codes are York-green
   plaques like the ones beside every door; type is Helvetica-style signage type;
   the floor plan is the canvas. One accent colour. */

/* ---------- fonts (bundled, so the page works offline) ---------- */
@font-face {
  font-family: "YN Heros";
  src: url("../fonts/texgyreheros-regular.woff") format("woff");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "YN Heros";
  src: url("../fonts/texgyreheros-bold.woff") format("woff");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "YN Heros Cn";
  src: url("../fonts/texgyreheroscn-bold.woff") format("woff");
  font-weight: 700;
  font-display: swap;
}

/* ---------- tokens ---------- */
:root {
  color-scheme: light;

  /* York green, sampled from the school's own room plaques and signs */
  --york-green: #1c4532;
  --york-green-hover: #255a42;
  --york-green-ink: #143022;
  --york-green-tint: #e4eee8;
  --york-green-wash: #f1f6f3;
  --route: #1f7a4d;
  --route-casing: #ffffff;

  /* neutrals (cool, faintly green; never cream) */
  --page: #f4f6f5;
  --surface: #ffffff;
  --canvas: #e6eae8;
  --ink: #17201c;
  --ink-muted: #55625c;
  --ink-faint: #8a958f;
  --line: #dde3e0;
  --line-strong: #c3ccc7;

  /* states */
  --danger: #b3261e;
  --danger-tint: #fdf0ee;
  --danger-line: #f1c7c2;
  --warn-ink: #5e4500;
  --warn-tint: #fdf7e4;
  --warn-line: #ecdcaa;
  --focus: #17201c;

  /* type */
  --font-sans: "YN Heros", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-sign: "YN Heros Cn", "Helvetica Neue", "Arial Narrow", Arial, sans-serif;
  --text-xs: 0.8125rem;   /* 13 */
  --text-sm: 0.875rem;    /* 14 */
  --text-md: 1rem;        /* 16 */
  --text-lg: 1.125rem;    /* 18 */
  --text-xl: 1.375rem;    /* 22 */
  --leading-tight: 1.25;
  --leading: 1.5;

  /* space: 4-point scale */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;

  /* shape: plaques are nearly square-cornered, controls a little softer */
  --r-plaque: 3px;
  --r-md: 8px;
  --r-lg: 12px;

  /* elevation: only floating things get a shadow */
  --shadow-1: 0 1px 2px rgba(20, 48, 34, 0.12), 0 0 0 1px rgba(20, 48, 34, 0.06);
  --shadow-2: 0 10px 28px rgba(20, 48, 34, 0.16), 0 2px 6px rgba(20, 48, 34, 0.08);

  /* sizes */
  --header-h: 64px;
  --control-h: 52px;
  --button-h: 48px;
  --icon-btn: 40px;
  --sidebar-w: 400px;
  --gutter: var(--sp-6);
}

@media (pointer: coarse) {
  :root { --icon-btn: 44px; }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--text-md);
  line-height: var(--leading);
  -webkit-font-smoothing: antialiased;
  font-kerning: normal;
}
h1, h2, h3, h4, p, ol, ul { margin: 0; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
b { font-weight: 700; }

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

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: var(--sp-4); top: -100px; z-index: 100;
  padding: var(--sp-2) var(--sp-4);
  background: var(--surface); color: var(--ink); border-radius: var(--r-md);
  box-shadow: var(--shadow-2); font-weight: 700; text-decoration: none;
}
.skip-link:focus { top: var(--sp-3); }

.icon {
  width: 20px; height: 20px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.75;
  stroke-linecap: round; stroke-linejoin: round;
}

/* ---------- plaques: the room-sign motif ---------- */
.plaque {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 3.4em; padding: 3px 7px 2px;
  background: var(--york-green); color: #fff;
  font-family: var(--font-sign); font-weight: 700; font-size: 0.9375rem;
  line-height: 1.2; letter-spacing: 0.02em; white-space: nowrap;
  border-radius: var(--r-plaque);
  font-variant-numeric: tabular-nums lining-nums;
}
.plaque-sm { font-size: var(--text-sm); min-width: 0; padding: 2px 6px 1px; }
.plaque-xs { font-size: var(--text-xs); min-width: 0; padding: 1px 5px 0; }

/* ---------- header ---------- */
.app-header {
  position: relative; z-index: 20;
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4);
  padding: 0 var(--gutter);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: inset 0 3px 0 var(--york-green);
}
.brand { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }
.brand-mark {
  display: flex; align-items: center;
  height: 40px; padding-right: var(--sp-3);
  border-right: 1px solid var(--line);
}
.brand-mark[hidden] { display: none; }
.brand-logo { height: 40px; width: auto; max-width: 180px; object-fit: contain; display: block; }
.brand-text { display: flex; flex-direction: column; line-height: var(--leading-tight); min-width: 0; }
.brand-name {
  font-weight: 700; font-size: var(--text-xl); letter-spacing: -0.01em;
  color: var(--york-green); white-space: nowrap;
}
.brand-school { font-size: var(--text-xs); color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.header-actions { display: flex; align-items: center; gap: var(--sp-2); }
.preview-tag {
  display: inline-flex; align-items: center; height: 28px; padding: 0 var(--sp-3);
  border: 1px solid var(--line-strong); border-radius: 999px;
  font-size: var(--text-xs); font-weight: 700; color: var(--ink-muted);
}
.btn-quiet {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  height: var(--icon-btn); padding: 0 var(--sp-3);
  background: none; border: 0; border-radius: var(--r-md);
  font-size: var(--text-sm); font-weight: 700; color: var(--ink);
}
.btn-quiet:hover { background: var(--page); }

/* ---------- app layout ---------- */
.app {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "planner" "summary" "map" "directions";
}
.planner { grid-area: planner; }
.summary-bar { grid-area: summary; }
.map-region { grid-area: map; }
.directions { grid-area: directions; }

/* ---------- planner ---------- */
.planner {
  padding: var(--sp-5) var(--gutter) var(--sp-6);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.route-form { display: flex; flex-direction: column; gap: var(--sp-3); }

.fields {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--icon-btn);
  grid-template-areas: "from swap" "to swap";
  column-gap: var(--sp-2);
}
.field[data-role="from"] { grid-area: from; }
.field[data-role="to"] { grid-area: to; margin-top: -1px; }
.swap { grid-area: swap; align-self: center; }

.field {
  position: relative;
  display: grid;
  grid-template-columns: 40px 44px minmax(0, 1fr) auto;
  align-items: center;
  height: var(--control-h);
  background: var(--surface);
  border: 1px solid var(--line-strong);
}
.field[data-role="from"] { border-radius: var(--r-md) var(--r-md) 0 0; }
.field[data-role="to"] { border-radius: 0 0 var(--r-md) var(--r-md); }
.field:focus-within, .field.is-open {
  z-index: 2; border-color: var(--york-green);
  box-shadow: inset 0 0 0 1px var(--york-green);
}
.field.is-invalid { z-index: 1; border-color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger); }
.field.is-open { z-index: 30; }

.field .glyph { grid-column: 1; justify-self: center; }
.field-label {
  grid-column: 2; grid-row: 1;
  font-size: var(--text-sm); color: var(--ink-muted);
  cursor: text;
}
.field-input {
  grid-column: 3; grid-row: 1;
  width: 100%; height: 100%; min-width: 0;
  padding: 0 var(--sp-2) 0 0;
  border: 0; background: none; outline: none;
  font-size: var(--text-md); font-weight: 700; color: var(--ink);
}
.field-input::placeholder { color: var(--ink-muted); font-weight: 400; opacity: 1; }
.field-input:disabled { background: none; }
.field-clear {
  grid-column: 4; grid-row: 1;
  display: grid; place-items: center;
  width: 36px; height: 36px; margin-right: var(--sp-2);
  border: 0; border-radius: var(--r-md); background: none; color: var(--ink-muted);
}
.field-clear:hover { background: var(--page); color: var(--ink); }
.field-clear[hidden] { display: none; }

/* glyphs: the same two shapes on the fields, the map and the directions */
.glyph { display: inline-block; flex: none; }
.glyph-start {
  width: 14px; height: 14px; border-radius: 50%;
  border: 3.5px solid var(--york-green); background: var(--surface);
}
.glyph-end {
  width: 13px; height: 13px; border-radius: 2px;
  background: var(--york-green);
}
.connector {
  position: absolute; z-index: 3; left: 20px; top: calc(var(--control-h) / 2 + 10px);
  height: calc(var(--control-h) - 20px); width: 0;
  border-left: 2px dotted var(--ink-faint);
  transform: translateX(-1px);
  pointer-events: none;
}

.swap {
  display: grid; place-items: center;
  width: var(--icon-btn); height: var(--icon-btn);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-md);
  color: var(--ink);
}
.swap:hover:not(:disabled) { border-color: var(--york-green); color: var(--york-green); }
.swap .icon { transition: transform 240ms ease; }
.swap.is-flipped .icon { transform: rotate(180deg); }

/* search results */
.options {
  position: absolute; z-index: 40; left: -1px; right: -1px; top: calc(100% + 6px);
  max-height: min(380px, 52vh); overflow-y: auto; overscroll-behavior: contain;
  margin: 0; padding: var(--sp-1) 0; list-style: none;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-md);
  box-shadow: var(--shadow-2);
}
.options[hidden] { display: none; }
.option {
  display: flex; align-items: center; gap: var(--sp-3);
  min-height: 48px; padding: var(--sp-2) var(--sp-4);
  cursor: pointer;
}
.option[aria-selected="true"] { background: var(--york-green-wash); box-shadow: inset 3px 0 0 var(--york-green); }
.option:hover { background: var(--york-green-wash); }
.option .plaque { min-width: 4.4em; }
.option-text { display: flex; flex-direction: column; min-width: 0; line-height: var(--leading-tight); }
.option-label { font-size: var(--text-md); }
.option-note { font-size: var(--text-xs); color: var(--warn-ink); margin-top: 2px; }
.option-group {
  padding: var(--sp-3) var(--sp-4) var(--sp-1);
  font-size: var(--text-xs); font-weight: 700; color: var(--ink-muted);
}
.option-group:not(:first-child) { border-top: 1px solid var(--line); margin-top: var(--sp-1); }
.option-empty { padding: var(--sp-4); color: var(--ink-muted); font-size: var(--text-sm); }

.form-error {
  display: flex; gap: var(--sp-2);
  font-size: var(--text-sm); color: var(--danger); font-weight: 700;
}
.form-error[hidden] { display: none; }

.btn-primary {
  height: var(--button-h); width: 100%;
  border: 0; border-radius: var(--r-md);
  background: var(--york-green); color: #fff;
  font-weight: 700; font-size: var(--text-md); letter-spacing: 0.01em;
}
.btn-primary:hover:not(:disabled) { background: var(--york-green-hover); }
.btn-primary:active:not(:disabled) { transform: translateY(1px); }
.btn-primary:disabled { opacity: 0.55; }

.btn-secondary {
  display: inline-flex; align-items: center; justify-content: center;
  height: var(--icon-btn); padding: 0 var(--sp-4);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-md);
  font-weight: 700; font-size: var(--text-sm); color: var(--ink);
}
.btn-secondary:hover { border-color: var(--york-green); color: var(--york-green); }

.btn-link {
  padding: 0; border: 0; background: none;
  color: var(--york-green); font-weight: 700; text-decoration: underline;
  text-decoration-thickness: 1px; text-underline-offset: 3px; text-align: left;
}
.btn-link:hover { text-decoration-thickness: 2px; }

/* ---------- summary bar (phones, once a route is shown) ---------- */
.summary-bar {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  padding: var(--sp-3) var(--gutter);
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.summary-bar[hidden] { display: none; }
.summary-route {
  display: flex; align-items: center; gap: var(--sp-2); min-width: 0;
  font-weight: 700; font-size: var(--text-lg);
}
.summary-arrow { color: var(--ink-faint); margin: 0 var(--sp-1); }

/* ---------- map ---------- */
.map-region {
  position: relative;
  height: clamp(340px, 62svh, 680px);
  background: var(--canvas);
}
.map-frame {
  position: absolute; inset: 0; overflow: hidden;
  cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none;
}
.map-frame.is-dragging { cursor: grabbing; }
.map-frame:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.map-svg { display: block; width: 100%; height: 100%; }
.floorplan { image-rendering: auto; }
.plan-sheet { fill: #fff; stroke: rgba(20, 48, 34, 0.18); stroke-width: 1; }
.coverage-mask { fill: var(--canvas); fill-opacity: 0.62; pointer-events: none; }

.route-casing {
  fill: none; stroke: var(--route-casing); stroke-width: 11px;
  stroke-linecap: round; stroke-linejoin: round;
}
.route-line {
  fill: none; stroke: var(--route); stroke-width: 5.5px;
  stroke-linecap: round; stroke-linejoin: round;
}

.map-overlay { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.pin { position: absolute; left: 0; top: 0; will-change: transform; }
.pin-dot { position: absolute; left: 0; top: 0; border-radius: 50%; transform: translate(-50%, -50%); }
.pin-start .pin-dot {
  width: 18px; height: 18px; background: #fff;
  border: 4.5px solid var(--york-green); box-shadow: 0 1px 3px rgba(20, 48, 34, 0.35);
}
.pin-end .pin-dot {
  width: 12px; height: 12px; background: var(--york-green);
  border: 2.5px solid #fff; box-shadow: 0 1px 3px rgba(20, 48, 34, 0.35);
}
.pin-label {
  position: absolute; left: 0; top: 0;
  display: inline-flex; align-items: baseline; gap: 5px;
  padding: 3px 8px 2px; white-space: nowrap;
  background: #fff; border-radius: 5px; box-shadow: var(--shadow-1);
  font-weight: 700; font-size: var(--text-sm); color: var(--ink);
}
.pin-label-right { transform: translate(16px, -50%); }
.pin-label-left { transform: translate(calc(-100% - 16px), -50%); }
.pin-label-above { transform: translate(-50%, calc(-100% - 16px)); }
.pin-label-below { transform: translate(-50%, 16px); }
.pin-kicker { font-weight: 400; color: var(--ink-muted); font-size: var(--text-xs); }
.pin-plaque {
  position: absolute; left: 0; top: 0;
  padding: 5px 10px 4px; white-space: nowrap;
  background: var(--york-green); color: #fff; border-radius: var(--r-plaque);
  font-family: var(--font-sign); font-weight: 700; font-size: 1.0625rem; line-height: 1.15;
  letter-spacing: 0.02em; box-shadow: 0 2px 6px rgba(20, 48, 34, 0.3);
}
.pin-plaque-above { transform: translate(-50%, calc(-100% - 13px)); }
.pin-plaque-below { transform: translate(-50%, 13px); }
.pin-plaque::after {
  content: ""; position: absolute; left: 50%;
  border: 6px solid transparent; transform: translateX(-50%);
}
.pin-plaque-above::after { top: 100%; border-top-color: var(--york-green); }
.pin-plaque-below::after { bottom: 100%; border-bottom-color: var(--york-green); }
.focus-ring {
  position: absolute; left: 0; top: 0; pointer-events: none;
}
.focus-ring::before {
  content: ""; position: absolute; left: 0; top: 0;
  width: 44px; height: 44px; border-radius: 50%;
  transform: translate(-50%, -50%);
  border: 3px solid var(--york-green); background: rgba(28, 69, 50, 0.12);
  animation: ring 1.2s ease-out 2;
}
@keyframes ring {
  0% { box-shadow: 0 0 0 0 rgba(28, 69, 50, 0.35); }
  100% { box-shadow: 0 0 0 16px rgba(28, 69, 50, 0); }
}

.map-floor {
  position: absolute; z-index: 5; left: var(--sp-4); top: var(--sp-4);
  display: inline-flex; align-items: baseline; gap: 6px;
  height: var(--icon-btn); padding: 0 var(--sp-3); align-items: center;
  background: var(--surface); border-radius: var(--r-md); box-shadow: var(--shadow-1);
}
.map-floor-label { font-size: var(--text-xs); color: var(--ink-muted); }
.map-floor-value { font-family: var(--font-sign); font-weight: 700; font-size: var(--text-lg); line-height: 1; }

.map-controls {
  position: absolute; z-index: 5; right: var(--sp-4); top: var(--sp-4);
  display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--r-md); box-shadow: var(--shadow-1);
}
.map-btn {
  display: grid; place-items: center;
  width: var(--icon-btn); height: var(--icon-btn);
  border: 0; background: none; color: var(--ink);
}
.map-btn + .map-btn { border-top: 1px solid var(--line); }
.map-btn:first-child { border-radius: var(--r-md) var(--r-md) 0 0; }
.map-btn:last-child { border-radius: 0 0 var(--r-md) var(--r-md); }
.map-btn:hover:not(:disabled) { background: var(--york-green-wash); color: var(--york-green); }
.map-btn:disabled { color: var(--line-strong); }

.map-status {
  position: absolute; z-index: 6; left: 50%; top: 50%; transform: translate(-50%, -50%);
  display: flex; align-items: center; gap: var(--sp-3);
  max-width: min(440px, calc(100% - 2 * var(--sp-6)));
  padding: var(--sp-4) var(--sp-5);
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-2);
  font-size: var(--text-sm); color: var(--ink-muted);
}
.map-status[hidden] { display: none; }
.map-status.is-error {
  flex-direction: column; align-items: flex-start; gap: var(--sp-2);
  padding: var(--sp-5) var(--sp-6); color: var(--ink);
}
.map-status-title { font-weight: 700; font-size: var(--text-lg); }
.map-status-detail {
  display: block; width: 100%; max-height: 160px; overflow: auto;
  padding: var(--sp-2) var(--sp-3); background: var(--page); border-radius: var(--r-md);
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: var(--text-xs);
  white-space: pre-wrap; color: var(--ink-muted);
}
.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid var(--york-green-tint); border-top-color: var(--york-green);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- directions ---------- */
.directions {
  display: flex; flex-direction: column;
  background: var(--surface);
}
.directions-body { padding: var(--sp-6) var(--gutter) var(--sp-8); display: flex; flex-direction: column; gap: var(--sp-5); }
.directions-title { font-size: var(--text-xl); line-height: var(--leading-tight); letter-spacing: -0.01em; }
.lead { color: var(--ink-muted); max-width: 44ch; }
.lead b { color: var(--ink); }
.sample { font-size: var(--text-md); }
.coverage { font-size: var(--text-sm); color: var(--ink-muted); max-width: 48ch; }

.browse { display: flex; flex-direction: column; gap: var(--sp-4); padding-top: var(--sp-5); border-top: 1px solid var(--line); }
.browse-title { font-size: var(--text-md); line-height: var(--leading-tight); }
.browse-hint { margin-top: calc(-1 * var(--sp-2)); font-size: var(--text-sm); color: var(--ink-muted); max-width: 48ch; }
.browse-group { display: flex; flex-direction: column; gap: var(--sp-2); }
.browse-group-title { font-size: var(--text-xs); font-weight: 700; color: var(--ink-muted); }
.browse-list { display: flex; flex-wrap: wrap; gap: 6px; padding: 0; list-style: none; }
.plaque-btn {
  min-width: 4.2em; min-height: 32px; padding: 4px 8px 3px; border: 0;
  transition: background-color 120ms ease;
}
.plaque-btn:hover { background: var(--york-green-hover); }
@media (pointer: coarse) { .plaque-btn { min-height: 40px; min-width: 4.6em; } }

.route-head { display: flex; flex-direction: column; gap: var(--sp-2); }
.route-end { display: flex; align-items: center; gap: var(--sp-3); }
.route-end .glyph { margin-left: 3px; }
.route-end-text { display: flex; align-items: baseline; gap: var(--sp-3); min-width: 0; }
.route-end-role { width: 34px; flex: none; font-size: var(--text-sm); color: var(--ink-muted); }
.route-end-name { font-weight: 700; font-size: var(--text-lg); line-height: var(--leading-tight); }
.route-end-name .plaque { vertical-align: 2px; margin-right: 2px; }
.route-facts {
  display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-4);
  margin-top: var(--sp-2); padding-top: var(--sp-3); border-top: 1px solid var(--line);
  font-size: var(--text-sm); color: var(--ink-muted);
}
.route-facts span + span { padding-left: var(--sp-4); border-left: 1px solid var(--line); }

.steps { list-style: none; padding: 0; display: flex; flex-direction: column; }
.step { position: relative; }
.step:not(:last-child)::before {
  content: ""; position: absolute; left: calc(var(--sp-2) + 17px); top: 48px; bottom: -6px;
  border-left: 2px solid var(--york-green-tint);
}
.step-btn {
  display: flex; align-items: flex-start; gap: var(--sp-4);
  width: 100%; padding: var(--sp-2) var(--sp-2) var(--sp-3);
  border: 0; border-radius: var(--r-md); background: none; text-align: left;
}
.step-btn:hover { background: var(--page); }
.step.is-active .step-btn { background: var(--york-green-wash); }
.step-icon {
  position: relative; z-index: 1;
  display: grid; place-items: center; flex: none;
  width: 36px; height: 36px; border-radius: var(--r-md);
  background: var(--york-green-wash); color: var(--york-green);
  box-shadow: inset 0 0 0 1px var(--york-green-tint);
}
.step-depart .step-icon { background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--york-green); }
.step-arrive .step-icon { background: var(--york-green); color: #fff; box-shadow: none; }
.step-icon .icon { width: 20px; height: 20px; stroke-width: 2; }
.step-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding-top: 6px; }
.step-title { font-weight: 700; font-size: var(--text-md); line-height: var(--leading-tight); }
.step-detail { color: var(--ink-muted); font-size: var(--text-sm); }
.step-passes {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1) 5px;
  margin-top: var(--sp-1); font-size: var(--text-xs); color: var(--ink-muted);
}
.step-passes-label { margin-right: 2px; }

.notes { display: flex; flex-direction: column; gap: var(--sp-2); }
.notice {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--page); border: 1px solid var(--line); border-radius: var(--r-md);
  font-size: var(--text-sm); color: var(--ink-muted);
}
.notice .icon { margin-top: 1px; color: var(--ink-faint); }
.notice-warn { background: var(--warn-tint); border-color: var(--warn-line); color: var(--warn-ink); }
.notice-warn .icon { color: var(--warn-ink); }
.notice-error { background: var(--danger-tint); border-color: var(--danger-line); color: var(--danger); }

.route-actions { display: flex; gap: var(--sp-2); }

.app-foot {
  margin-top: auto;
  padding: var(--sp-4) var(--gutter) var(--sp-5);
  border-top: 1px solid var(--line);
  font-size: var(--text-xs); color: var(--ink-muted);
}

/* ---------- developer view (?debug) ---------- */
.debug-edge { stroke: #7a3cff; stroke-width: 1.5px; opacity: 0.75; }
.debug-edge.kind-doorway { stroke-dasharray: 3 2; }
.debug-edge.conf-medium { stroke: #d98a00; }
.debug-node circle { fill: #fff; stroke: #7a3cff; stroke-width: 1.2px; }
.debug-node.type-room circle, .debug-node.type-entrance circle { fill: #7a3cff; }
.debug-node text { font: 700 4.5px/1 ui-monospace, monospace; fill: #3b0f99; paint-order: stroke; stroke: #fff; stroke-width: 1.2px; }
.debug-panel {
  grid-column: 1 / -1;
  padding: var(--sp-4) var(--gutter); background: #f7f3ff; border-top: 1px solid #ddd0ff;
  font-size: var(--text-xs); color: #3b0f99;
}
.debug-panel h2 { font-size: var(--text-sm); margin-bottom: var(--sp-1); }

/* ---------- dialog ---------- */
.dialog {
  width: min(480px, calc(100% - 2 * var(--sp-4)));
  padding: 0; border: 0; border-radius: var(--r-lg);
  box-shadow: var(--shadow-2); color: var(--ink);
}
.dialog::backdrop { background: rgba(23, 32, 28, 0.45); }
.dialog-inner { display: flex; flex-direction: column; gap: var(--sp-3); padding: var(--sp-6); }
.dialog-title { font-size: var(--text-xl); line-height: var(--leading-tight); margin-bottom: var(--sp-1); }
.dialog p { color: var(--ink-muted); }
.dialog p b { color: var(--ink); }
.dialog-actions { display: flex; justify-content: flex-end; margin-top: var(--sp-2); }

/* ---------- phones ---------- */
@media (max-width: 719px) {
  :root { --header-h: 56px; --gutter: var(--sp-4); }
  body { background: var(--surface); }
  .brand-name { font-size: var(--text-lg); }
  .brand-mark { height: 34px; padding-right: var(--sp-2); }
  .brand-logo { height: 34px; max-width: 112px; }
  /* If the official mark spells out the school's name (brand.json "logoIncludesSchoolName"),
     it carries the name on small screens; otherwise the name stays under YorkNav. */
  .logo-has-name .brand-school { display: none; }
  .btn-quiet-label { display: none; }
  .btn-quiet { padding: 0; width: var(--icon-btn); justify-content: center; }
  .planner { padding: var(--sp-4) var(--gutter) var(--sp-4); }
  body[data-route="shown"]:not([data-editing]) .planner { display: none; }
  body:not([data-route="shown"]) .summary-bar,
  body[data-editing] .summary-bar { display: none; }
  .map-floor, .map-controls { top: var(--sp-3); }
  .map-floor { left: var(--sp-3); }
  .map-controls { right: var(--sp-3); }
  .directions-body { padding: var(--sp-5) var(--gutter) var(--sp-6); gap: var(--sp-4); }
  .options { max-height: min(340px, 46svh); }
}

/* ---------- tablets: one planner row above the map ---------- */
@media (min-width: 720px) and (max-width: 1023px) {
  .summary-bar { display: none; }
  .route-form { flex-direction: row; align-items: stretch; gap: var(--sp-3); }
  .fields {
    flex: 1; min-width: 0;
    grid-template-columns: minmax(0, 1fr) var(--icon-btn) minmax(0, 1fr);
    grid-template-areas: "from swap to";
  }
  .field[data-role="from"], .field[data-role="to"] { border-radius: var(--r-md); margin-top: 0; }
  .field { grid-template-columns: 36px 40px minmax(0, 1fr) auto; }
  .connector { display: none; }
  .btn-primary { width: auto; padding: 0 var(--sp-6); height: var(--control-h); white-space: nowrap; }
  .form-error { order: 3; }
  .route-form { flex-wrap: wrap; }
  .form-error { flex-basis: 100%; }
  .map-region { height: clamp(380px, 58svh, 760px); }
  .directions-body { max-width: 760px; }
}

/* ---------- laptops and desktops: planner and directions beside a full-height map ---------- */
@media (min-width: 1024px) {
  body { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
  .app {
    flex: 1; min-height: 0;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas: "planner map" "directions map";
  }
  .summary-bar { display: none; }
  .planner, .directions { border-right: 1px solid var(--line); }
  .planner { position: relative; z-index: 10; padding: var(--sp-6) var(--gutter) var(--sp-5); border-bottom: 1px solid var(--line); }
  .directions { overflow-y: auto; overscroll-behavior: contain; }
  .map-region { height: auto; min-height: 0; }
  .map-floor, .map-controls { top: var(--sp-5); }
  .map-floor { left: var(--sp-5); }
  .map-controls { right: var(--sp-5); }
  .debug-panel { grid-column: 1; }
}
@media (min-width: 1440px) {
  :root { --sidebar-w: 432px; }
}

/* ---------- motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- styled floor map (assets/map/floor1-map.svg) ----------
   Three restrained treatments were compared (docs/map/); "warm" is the default:
   warm off-white circulation, cool green-grey rooms, medium-dark grey walls. */
.map-region {
  --m-ground: #eaece8;
  --m-hall: #fcf9f2;
  --m-room: #e6ede8;
  --m-other: #eff1ee;
  --m-wall: #56615c;
  --m-mark: #b6bfba;
  --m-text: #a7b1ac;
  --m-text-opacity: 1;
  --m-wall-u: #c2c8c4;
  --m-mark-u: #d9dedb;
  --m-text-u: #cdd3cf;
  --m-hl-start: rgba(31, 122, 77, 0.07);
  --m-hl-end: rgba(31, 122, 77, 0.16);
  --route-w: 6px;
  --m-label-room: #2c3833;
  --m-label-name: #5f6b65;
  --m-label-hall: #66716b;
  --m-label-door: #4f5b55;
  background: var(--m-ground);
}
.map-region[data-map-theme="sage"] {
  --m-ground: #e8ece9; --m-hall: #ffffff; --m-room: #eef2ef; --m-other: #f0f2f0;
  --m-wall: #5b6661; --m-mark: #b7bfba; --m-text: #a3ada8;
}
.map-region[data-map-theme="soft"] {
  --m-ground: #f2f4f2; --m-hall: #ffffff; --m-room: #e3eae5; --m-other: #ebeeeb;
  --m-wall: #6b7671; --m-mark: #bcc4bf; --m-text: #a9b2ad;
}
.styled-map .m-hall { fill: var(--m-hall); }
.styled-map .m-room { fill: var(--m-room); }
.styled-map .m-other { fill: var(--m-other); }
.styled-map .m-wall { fill: var(--m-wall); }
.styled-map .m-mark { fill: var(--m-mark); }
.styled-map .m-text { fill: var(--m-text); opacity: var(--m-text-opacity); }
.styled-map .m-room-text.is-replaced { visibility: hidden; }
.styled-map .m-wall-u { fill: var(--m-wall-u); }
.styled-map .m-mark-u { fill: var(--m-mark-u); }
.styled-map .m-text-u { fill: var(--m-text-u); }
.styled-map .m-hl-start { fill: var(--m-hl-start); stroke: rgba(31, 122, 77, 0.45); stroke-width: 1.5px; stroke-dasharray: 4 3; }
.styled-map .m-hl-end { fill: var(--m-hl-end); stroke: var(--route); stroke-width: 2.5px; }

/* the original plan: shown when the styled map is missing, or on request in the developer view */
.has-styled-map .floorplan, .has-styled-map .plan-sheet, .plan-overlay { display: none; }
body[data-plan-mode="plan"] .has-styled-map .floorplan { display: inline; }
body[data-plan-mode="plan"] .styled-map { display: none; }
body[data-plan-mode="plan"] .map-labels { display: none; }
body[data-plan-mode="overlay"] .plan-overlay { display: inline; opacity: 0.5; mix-blend-mode: multiply; }

.has-styled-map .route-casing { stroke-width: calc(var(--route-w) + 5px); }
.has-styled-map .route-line { stroke-width: var(--route-w); }

/* map labels: screen-space, constant size, sharp at any zoom */
.map-labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.map-label {
  position: absolute; left: 0; top: 0; white-space: nowrap;
  display: flex; flex-direction: column; align-items: center;
  line-height: 1.15; will-change: transform;
  text-shadow: 0 0 2px var(--m-room), 0 0 3px var(--m-room), 0 0 1px var(--m-room);
}
.map-label[hidden] { display: none; }
.map-label-room .map-label-code {
  font-family: var(--font-sign); font-weight: 700; font-size: 0.8125rem; letter-spacing: 0.03em;
  color: var(--m-label-room);
}
.map-label-room .map-label-name { font-size: 0.6875rem; color: var(--m-label-name); }
.map-label-room:not(.has-name) .map-label-name { display: none; }
.map-label-room.is-selected .map-label-code { color: var(--york-green); font-size: 0.9375rem; }
.map-label-room.is-selected .map-label-name { color: var(--york-green); font-weight: 700; }
.map-label-hall {
  font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.12em; color: var(--m-label-hall);
  text-shadow: 0 0 2px var(--m-hall), 0 0 3px var(--m-hall);
}
.map-label-door {
  flex-direction: row; gap: 4px; align-items: center;
  font-size: 0.6875rem; font-weight: 700; color: var(--m-label-door);
  text-shadow: 0 0 2px var(--m-ground), 0 0 3px var(--m-ground);
}
.map-label-exit {
  width: 9px; height: 9px; border-radius: 1.5px; background: #6d7a73;
  box-shadow: inset 0 0 0 2px var(--m-ground); outline: 1.5px solid #6d7a73; outline-offset: -1.5px;
}
.map-label-door.is-selected { color: var(--york-green); }
.route-end-extra { display: block; font-size: var(--text-sm); font-weight: 400; color: var(--ink-muted); }
.debug-modes { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-3); margin-bottom: var(--sp-2); }
.debug-modes .btn-link[aria-pressed="true"] { text-decoration-thickness: 3px; }

/* ---------- narrow phones (360-419 px): the logo, YorkNav and the whole school name fit on one row ---------- */
@media (max-width: 419px) {
  .app-header { gap: var(--sp-2); }
  .brand { gap: 6px; }
  .brand-mark { padding-right: 6px; }
  .brand-mark, .brand-logo { height: 32px; }
  .brand-school { font-size: 0.75rem; }
  .header-actions { gap: var(--sp-1); }
  .preview-tag { height: 26px; padding: 0 var(--sp-2); font-size: 0.75rem; }
}

/* ---------- hallway lockers (assets/js/lockers-layer.js, locker-core.js) ----------
   A bank is a thin strip on its wall; single doors appear when the map is zoomed in. The strips are a map symbol:
   positions come from one survey fitted to the plan (assets/data/floor1-lockers.json). */
.map-region { --m-locker: #b3c1b9; --m-locker-line: #71807a; --m-locker-blank: #dfe5e1; }
.lk-body { fill: var(--m-locker); stroke: var(--m-locker-line); stroke-width: 0.75px; }
.lk-blank { fill: var(--m-locker-blank); stroke: var(--m-locker-line); stroke-width: 0.5px; }
.lk-ticks { fill: none; stroke: var(--m-locker-line); stroke-width: 0.6px; display: none; }
.locker-layer.is-detailed .lk-ticks { display: inline; }
.locker-layer.is-far .lk-bank { opacity: 0.6; }
.lk-observed .lk-body { fill: none; stroke-dasharray: 2 2; }
.lk-bank.is-route { opacity: 1; }
.lk-bank.is-route .lk-body { fill: #cfe3d8; stroke: var(--route); }
.lk-hl { fill: var(--route); stroke: var(--route); stroke-width: 2px; stroke-linejoin: round; }
.lk-hl-bank { fill: rgba(31, 122, 77, 0.35); }
body[data-plan-mode="plan"] .locker-layer { display: none; }

.plaque-locker {
  background: #eef2ef; color: var(--york-green);
  box-shadow: inset 0 0 0 1.5px var(--york-green);
  font-size: var(--text-sm);
}
.option-locker-note { border-top: 1px solid var(--line); }
.option-locker-note:first-child { border-top: 0; }
.locker-hint { font-size: var(--text-sm); color: var(--ink-muted); max-width: 48ch; }
.locker-hint b { color: var(--ink); font-family: var(--font-sign); letter-spacing: 0.02em; white-space: nowrap; }
