/* Layout: app shell. A deep-teal tool-drawer panel on the left (icon rail when collapsed, slide-in drawer on phones),
   one reading column on the right, and the same footer with the Privacy link on every page. */
:root {
  --bg: #eef3f1;
  --surface: #f9fbfa;
  --ink: #14262c;
  --muted: #55696f;
  --line: #d0dcd8;
  --accent: #e2a100;
  --accent-ink: #1a1400;
  --link: #0a6670;
  --side-bg: #12303a;
  --side-ink: #e9f1ef;
  --side-muted: #a3babc;
  --side-hover: #1d4553;
  --side-line: #12303a;
  --danger: #a3341f;

  --font-display: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-body: "Instrument Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --t-xs: 0.75rem;
  --t-sm: 0.875rem;
  --t-base: 1rem;
  --t-lg: 1.25rem;
  --t-xl: 1.625rem;
  --t-2xl: clamp(2rem, 1.2rem + 3.4vw, 3.25rem);

  --side-w: 248px;
  --rail-w: 64px;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1c21; --surface: #15282e; --ink: #e6efed; --muted: #9bb0b3; --line: #27424a;
    --accent: #f2b824; --accent-ink: #1a1400; --link: #74d2d8;
    --side-bg: #0a1519; --side-ink: #e6efed; --side-muted: #8fa6a9; --side-hover: #17303a; --side-line: #1d343b;
    --danger: #ff9b85;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1c21; --surface: #15282e; --ink: #e6efed; --muted: #9bb0b3; --line: #27424a;
  --accent: #f2b824; --accent-ink: #1a1400; --link: #74d2d8;
  --side-bg: #0a1519; --side-ink: #e6efed; --side-muted: #8fa6a9; --side-hover: #17303a; --side-line: #1d343b;
  --danger: #ff9b85;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; color-scheme: light; }
[hidden] { display: none !important; }
img { max-width: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: var(--t-base)/1.6 var(--font-body); }
a { color: var(--link); text-underline-offset: 0.18em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.1; text-wrap: balance; margin: 0; }
p { margin: 0; }
svg.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); min-height: 100vh; transition: grid-template-columns 0.22s ease; }
.topbar, .scrim { display: none; }

.side {
  position: sticky; top: 0; align-self: start; height: 100vh;
  display: flex; flex-direction: column; gap: 20px; padding: 16px 12px;
  background: var(--side-bg); color: var(--side-ink); border-right: 1px solid var(--side-line);
  overflow-y: auto; overflow-x: hidden;
}
.side-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 40px; padding-left: 4px; min-width: calc(var(--side-w) - 24px); }
.pin[aria-pressed="true"] { color: var(--accent); }
.pin[aria-pressed="true"] svg.ic { fill: currentColor; }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font: 700 var(--t-lg)/1 var(--font-display); letter-spacing: -0.01em; min-width: 0; }
.brand-mark { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font: 800 1.125rem/1 var(--font-display); }
.icon-btn { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border: 0; border-radius: 8px; background: transparent; color: inherit; cursor: pointer; }
.side .icon-btn:hover { background: var(--side-hover); }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-link { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 8px; color: var(--side-muted); text-decoration: none; font-weight: 500; white-space: nowrap; }
.nav-link:hover { background: var(--side-hover); color: var(--side-ink); }
.nav-link[aria-current="page"] { background: var(--accent); color: var(--accent-ink); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 4px; padding-top: 12px; border-top: 1px solid var(--side-hover); }

@media (min-width: 761px) {
  /* Rail by default. Hover or keyboard focus opens the panel over the page; pinning gives it its own column. */
  .side { width: var(--rail-w); z-index: 15; transition: width 0.22s ease, box-shadow 0.22s ease; }
  .shell[data-side="expanded"] .side { width: var(--side-w); }
  .side .label { transition: opacity 0.15s ease; }
  .shell[data-side="collapsed"] .side .label { opacity: 0; }
  .shell[data-side="expanded"][data-pinned="false"] .side { box-shadow: 10px 0 30px color-mix(in srgb, var(--side-bg) 32%, transparent); }
  .shell[data-pinned="true"] { grid-template-columns: var(--side-w) minmax(0, 1fr); }
}

/* ---------- main column ---------- */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 100vh; padding-inline: clamp(16px, 5vw, 64px); }
#view { flex: 1; width: 100%; max-width: 860px; padding-block: clamp(28px, 6vw, 72px) 48px; display: flex; flex-direction: column; gap: 32px; outline: none; }
.foot { width: 100%; max-width: 860px; display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; padding-block: 20px 28px; border-top: 1px solid var(--line); color: var(--muted); font-size: var(--t-sm); }
.foot nav { display: flex; gap: 20px; }

.page-head { display: flex; flex-direction: column; gap: 14px; }
.page-head h1 { font-size: var(--t-2xl); font-weight: 700; letter-spacing: -0.02em; }
.lede { font-size: var(--t-lg); line-height: 1.5; color: var(--muted); max-width: 60ch; }
.tape { display: inline-block; padding: 3px 8px; background: var(--accent); color: var(--accent-ink); font: 500 var(--t-xs)/1.4 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; }
.tape.quiet { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
.meta { font: 400 var(--t-xs)/1.4 var(--font-mono); letter-spacing: 0.04em; color: var(--muted); white-space: nowrap; }
.prose { display: flex; flex-direction: column; gap: 16px; max-width: 65ch; }
.prose h2 { font-size: var(--t-xl); font-weight: 700; margin-top: 16px; }
mark.todo { background: color-mix(in srgb, var(--accent) 38%, transparent); color: inherit; padding: 0 3px; }
.note { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); font-size: var(--t-sm); max-width: 65ch; }
.note strong { font: 500 var(--t-xs)/1.4 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink); }

/* home splash */
#view.splash { justify-content: center; position: relative; isolation: isolate; }
#view.splash::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image: radial-gradient(var(--line) 1.3px, transparent 1.5px); background-size: 24px 24px;
  -webkit-mask-image: radial-gradient(ellipse 60% 70% at 78% 50%, #000 10%, transparent 75%);
  mask-image: radial-gradient(ellipse 60% 70% at 78% 50%, #000 10%, transparent 75%); }
.splash-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 40px clamp(32px, 6vw, 80px); }
.splash-text { display: flex; flex-direction: column; gap: 22px; }
.splash-text h1 { font-size: clamp(2.5rem, 1.3rem + 4.4vw, 4.25rem); font-weight: 700; letter-spacing: -0.03em; line-height: 1.03; }
.pegs { display: flex; flex-direction: column; gap: 22px; padding-right: 48px; }
.peg { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 112px; color: inherit; text-decoration: none; }
.peg:nth-child(2) { transform: translateX(48px); }
.peg .app-icon { width: 92px; height: 92px; border-radius: 22px; transition: transform 0.18s ease; }
.peg .app-icon svg.ic { width: 42px; height: 42px; }
.peg:hover .app-icon { transform: translateY(-3px); }
.peg .meta { white-space: normal; text-align: center; }

/* directory rows (fun things) */
.dir { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.dir-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 6px 18px; padding: 18px 4px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
a.dir-row:hover h2 { color: var(--link); }
.dir-row h2 { font-size: var(--t-xl); font-weight: 700; letter-spacing: -0.01em; }
.dir-row p { color: var(--muted); }
.dir-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 10px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.dir-end { display: flex; align-items: center; gap: 12px; }

/* apps */
.apps { display: flex; flex-direction: column; gap: 16px; }
.app { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 20px; padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.app-icon { display: grid; place-items: center; width: 60px; height: 60px; border-radius: 14px; background: var(--side-bg); color: var(--accent); box-shadow: inset 0 0 0 1px var(--side-line); }
.app-icon svg.ic { width: 30px; height: 30px; stroke-width: 1.5; }
.app-body { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.app-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.app-title h2 { font-size: var(--t-xl); font-weight: 700; letter-spacing: -0.01em; }
.tags, .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border: 1px solid var(--ink); border-radius: 8px; background: var(--ink); color: var(--bg); font: 600 var(--t-sm)/1.2 var(--font-body); text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--link); border-color: var(--link); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--ink); background: transparent; }
.btn.off { background: transparent; color: var(--muted); border: 1px dashed var(--line); cursor: default; font-weight: 500; }
.btn svg.ic { width: 16px; height: 16px; }

/* pictures */
.pics { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.pic { display: flex; flex-direction: column; gap: 8px; margin: 0; }
.pic-frame { display: grid; place-items: center; aspect-ratio: 4 / 3; max-width: 100%; border-radius: var(--radius); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
.pic-frame svg.ic { width: 32px; height: 32px; stroke-width: 1.3; }
.tone-a { background: color-mix(in srgb, var(--accent) 26%, var(--surface)); }
.tone-b { background: color-mix(in srgb, var(--link) 20%, var(--surface)); }
.tone-c { background: color-mix(in srgb, var(--ink) 10%, var(--surface)); }
.pic img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius); }
.pic figcaption { font-size: var(--t-sm); color: var(--muted); }
.empty { padding: 28px 20px; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); max-width: 65ch; }

/* tables (privacy) */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; min-width: 440px; font-size: var(--t-sm); }
th, td { text-align: left; vertical-align: top; padding: 10px 14px; border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: 0; }
th { font: 500 var(--t-xs)/1.4 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }

/* admin */
.editor { display: flex; flex-direction: column; gap: 14px; }
.editor > h2 { font-size: var(--t-xl); font-weight: 700; }
.card { display: flex; flex-direction: column; gap: 12px; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-head h3 { font-size: var(--t-lg); font-weight: 700; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field label { font: 500 var(--t-xs)/1.4 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.field input, .field textarea { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); font: var(--t-base)/1.4 var(--font-body); }
.field textarea { resize: vertical; min-height: 4.5em; }
.field [aria-invalid="true"] { border-color: var(--danger); }
.savebar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.status { font-size: var(--t-sm); color: var(--muted); }
.status.bad { color: var(--danger); }
.signed { font: 400 var(--t-xs)/1.4 var(--font-mono); letter-spacing: 0.04em; color: var(--muted); }

/* ---------- phone ---------- */
@media (max-width: 760px) {
  .shell { display: block; }
  .topbar { display: flex; align-items: center; gap: 8px; position: sticky; top: 0; z-index: 5; padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 8px; background: var(--side-bg); color: var(--side-ink); }
  .topbar .icon-btn:hover { background: var(--side-hover); }
  .side { position: fixed; z-index: 20; top: 0; left: 0; bottom: 0; height: auto; align-self: auto; width: min(290px, 84vw); padding-top: calc(16px + env(safe-area-inset-top, 0px)); transform: translateX(-102%); transition: transform 0.22s ease; }
  .shell[data-drawer="open"] .side { transform: none; }
  .shell[data-drawer="open"] .scrim { display: block; position: fixed; inset: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 70%, transparent); }
  .main { min-height: calc(100vh - 56px); }
  .app { grid-template-columns: minmax(0, 1fr); }
  .pin { display: none; }
  .splash-grid { grid-template-columns: minmax(0, 1fr); }
  .pegs { flex-direction: row; flex-wrap: wrap; gap: 14px; padding-right: 0; }
  .peg { width: 96px; }
  .peg:nth-child(2) { transform: none; }
  .peg .app-icon { width: 76px; height: 76px; border-radius: 18px; }
  #view.splash::before { -webkit-mask-image: linear-gradient(to bottom, transparent 35%, #000); mask-image: linear-gradient(to bottom, transparent 35%, #000); }
  .dir-row { grid-template-columns: auto minmax(0, 1fr); }
  .dir-end { grid-column: 2; }
  .dir-row h2 { font-size: var(--t-lg); }
}
@media (prefers-reduced-motion: reduce) { .shell, .side, .side .label, .peg .app-icon { transition: none; } }

/* BCPS Menu shown inside the site: the frame fills the page area and scrolls on its own. */
.shell[data-embed="true"] .main { padding-inline: 0; height: 100vh; }
.shell[data-embed="true"] #view { max-width: none; padding-block: 0; gap: 0; min-height: 0; }
.shell[data-embed="true"] .foot { max-width: none; padding-inline: clamp(16px, 5vw, 64px); padding-block: 12px 14px; }
iframe.embed { flex: 1 1 auto; width: 100%; min-height: 0; border: 0; background: var(--surface); }
@media (max-width: 760px) { .shell[data-embed="true"] .main { height: calc(100vh - 56px); height: calc(100dvh - 56px); } }
