/* Home Health Training
   ------------------------------------------------------------------
   Mobile first: most readers open this on a phone between visits.
   Fraunces carries the headings, Inter does the reading and the UI.
   Each section owns an accent colour so people navigate by memory. */

:root {
  /* Warm paper rather than clinical white — this gets read for long stretches. */
  --ground: #f7f4ef;
  --paper: #ffffff;
  --paper-sunk: #f2eee7;

  --ink: #1b2420;
  --ink-soft: #55605a;
  --ink-faint: #838d87;

  --line: #e3ddd3;
  --line-soft: #efeae2;

  --brand: #0f5f57;
  --brand-deep: #0a453f;
  --brand-wash: #e4f0ed;

  --amber: #9a6410;
  --amber-wash: #fbf1de;
  --rose: #a33a33;
  --rose-wash: #fbeae8;
  --moss: #3f6b34;
  --moss-wash: #eaf2e5;

  /* Overridden per section on [data-section]; this is the neutral default. */
  --section: var(--brand);
  --section-wash: var(--brand-wash);

  --radius: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(27, 36, 32, 0.05);
  --shadow: 0 1px 2px rgba(27, 36, 32, 0.04), 0 6px 20px -8px rgba(27, 36, 32, 0.14);
  --shadow-lg: 0 2px 4px rgba(27, 36, 32, 0.04), 0 18px 40px -16px rgba(27, 36, 32, 0.22);

  --measure: 70ch;
  --header-h: 60px;

  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --display: "Fraunces", Georgia, "Times New Roman", serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground: #14181a;
    --paper: #1b2124;
    --paper-sunk: #222a2d;

    --ink: #e8ece9;
    --ink-soft: #aab4af;
    --ink-faint: #838e89;

    --line: #2e3739;
    --line-soft: #242c2f;

    --brand: #5ec6b4;
    --brand-deep: #8fdccd;
    --brand-wash: #14302c;

    --amber: #e0ab5f;
    --amber-wash: #2f2716;
    --rose: #ef8f86;
    --rose-wash: #331d1b;
    --moss: #8dc57c;
    --moss-wash: #1c2a18;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 18px 40px -16px rgba(0, 0, 0, 0.7);
  }
}

/* --------------------------------------------------- section accent colours */

[data-section="start-here"]              { --section: #0f5f57; --section-wash: #e4f0ed; }
[data-section="home-health-101"]         { --section: #1f5f86; --section-wash: #e3eef6; }
[data-section="eligibility-coverage"]    { --section: #7a4b9c; --section-wash: #f0e9f6; }
[data-section="oasis"]                   { --section: #9a6410; --section-wash: #fbf1de; }
[data-section="visit-types"]             { --section: #1b6b5f; --section-wash: #e3f1ee; }
[data-section="plan-of-care"]            { --section: #2c5aa0; --section-wash: #e6ecf8; }
[data-section="documentation"]           { --section: #a33a33; --section-wash: #fbeae8; }
[data-section="nursing-skills"]          { --section: #146b74; --section-wash: #e2f1f3; }
[data-section="therapy-practice"]        { --section: #3f6b34; --section-wash: #eaf2e5; }
[data-section="common-diagnoses"]        { --section: #8a4a63; --section-wash: #f8e9ef; }
[data-section="safety"]                  { --section: #b0572a; --section-wash: #fdeee4; }
[data-section="coordination-supervision"]{ --section: #4a5a8c; --section-wash: #eaedf7; }
[data-section="logistics"]               { --section: #5d6b2f; --section-wash: #f0f3e2; }
[data-section="quick-reference"]         { --section: #445; --section-wash: #ececf2; }

@media (prefers-color-scheme: dark) {
  [data-section="start-here"]              { --section: #5ec6b4; --section-wash: #14302c; }
  [data-section="home-health-101"]         { --section: #79bbe4; --section-wash: #162c3a; }
  [data-section="eligibility-coverage"]    { --section: #c19ce0; --section-wash: #2a1f35; }
  [data-section="oasis"]                   { --section: #e0ab5f; --section-wash: #2f2716; }
  [data-section="visit-types"]             { --section: #62c5b3; --section-wash: #142e2a; }
  [data-section="plan-of-care"]            { --section: #8fb2ea; --section-wash: #1a2436; }
  [data-section="documentation"]           { --section: #ef8f86; --section-wash: #331d1b; }
  [data-section="nursing-skills"]          { --section: #63c0c9; --section-wash: #132c2f; }
  [data-section="therapy-practice"]        { --section: #8dc57c; --section-wash: #1c2a18; }
  [data-section="common-diagnoses"]        { --section: #dc98b2; --section-wash: #301d25; }
  [data-section="safety"]                  { --section: #eca272; --section-wash: #33231a; }
  [data-section="coordination-supervision"]{ --section: #9aa8d8; --section-wash: #1e2333; }
  [data-section="logistics"]               { --section: #b3c163; --section-wash: #262b16; }
  [data-section="quick-reference"]         { --section: #a9b0c4; --section-wash: #23262e; }
}

/* ------------------------------------------------------------------- base */

* { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Clears the sticky header when jumping to an anchor. The mobile header is
     two rows tall, so it needs more room than the desktop one. */
  scroll-padding-top: 122px;
}
@media (min-width: 960px) { html { scroll-padding-top: 80px; } }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16.5px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "kern", "liga";
}

a { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--brand-deep); }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--brand); color: #fff; padding: 12px 18px;
  border-radius: 0 0 var(--radius) 0; font-weight: 600;
}
.skip-link:focus { left: 0; }

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

::selection { background: var(--section-wash); color: var(--ink); }

/* ----------------------------------------------------------------- header */

.site-header {
  /* Two rows on a phone: menu/brand/sign-in on top, search full width below.
     In one row the search collapsed to a sliver, because everything else is a
     fixed width and the input was the only thing allowed to shrink — which made
     the site's primary action all but invisible on the device most people read
     it on. */
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 9px 14px;
  /* Solid rather than translucent: a blurred backdrop on a sticky element
     repaints the whole header on every scroll frame, which is a real cost on
     the phones this gets read on. */
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
}

.brand {
  display: flex; align-items: center; gap: 9px; min-width: 0;
  color: var(--ink); text-decoration: none;
}
.brand-mark {
  display: grid; place-items: center; flex: none;
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--brand); color: #fff;
}
.brand-mark svg { width: 18px; height: 18px; }
.brand-name {
  min-width: 0;
  font-family: var(--display);
  font-weight: 600; font-size: 1.05rem; letter-spacing: -0.015em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.brand { flex: 1 1 0; }

.search {
  order: 3; flex: 1 0 100%;
  position: relative; min-width: 0;
}
.search-icon {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--ink-faint); pointer-events: none;
}
.site-header .search input {
  width: 100%; padding: 10px 12px 10px 38px;
  font: inherit; color: var(--ink);
  /* 16px exactly: anything smaller makes iOS Safari zoom the page when the
     field is focused, and the reader then has to pinch back out. */
  font-size: 16px;
  background: var(--paper-sunk);
  border: 1px solid transparent; border-radius: 999px;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.site-header .search input::placeholder { color: var(--ink-faint); }
.site-header .search input:focus {
  outline: none; background: var(--paper);
  border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-wash);
}
.search-page { max-width: 100%; margin: 20px 0 28px; display: flex; gap: 10px; }
.search-page input { border-radius: var(--radius); padding-left: 14px; font-size: 1rem; }
.search-page .search-icon { display: none; }

.header-actions { display: flex; gap: 8px; flex: none; }

.nav-toggle {
  display: flex; flex-direction: column; justify-content: center; gap: 4px;
  width: 36px; height: 36px; padding: 9px; flex: none;
  background: none; border: 1px solid var(--line); border-radius: 9px; cursor: pointer;
}
.nav-toggle span { display: block; height: 1.8px; background: var(--ink); border-radius: 2px; }

/* ------------------------------------------------------------------ shell */

.shell { display: block; max-width: 1480px; margin: 0 auto; }

.sidebar {
  display: none; padding: 14px 14px 28px;
  background: var(--paper); border-bottom: 1px solid var(--line);
}
.sidebar.open { display: block; }

.content { padding: 28px 18px 72px; max-width: var(--measure); margin: 0 auto; }
.shell-wide .content { max-width: 1120px; }

@media (min-width: 960px) {
  .nav-toggle { display: none; }

  .site-header { flex-wrap: nowrap; height: var(--header-h); padding: 0 14px; }
  .brand { flex: 0 1 auto; }
  .search {
    order: 0; flex: 1 1 auto; max-width: 420px; margin-left: auto;
  }
  .site-header .search input { font-size: 0.92rem; padding: 8px 12px 8px 34px; }

  .shell { display: grid; grid-template-columns: 296px minmax(0, 1fr); }
  .sidebar {
    display: block; border-bottom: 0; border-right: 1px solid var(--line);
    background: transparent;
    position: sticky; top: var(--header-h); align-self: start;
    height: calc(100vh - var(--header-h)); overflow-y: auto;
    padding: 20px 14px 60px 20px;
    scrollbar-width: thin;
  }
  .content { padding: 40px 56px 100px; margin: 0; }
}

/* -------------------------------------------------------------------- nav */

.nav-section { border-radius: 9px; margin-bottom: 1px; }
.nav-section > summary {
  display: flex; gap: 9px; align-items: center;
  padding: 9px 10px; cursor: pointer; list-style: none;
  font-size: 0.895rem; font-weight: 600; color: var(--ink-soft);
  border-radius: 9px; transition: background 0.12s, color 0.12s;
}
.nav-section > summary::-webkit-details-marker { display: none; }
.nav-section > summary:hover { background: var(--paper-sunk); color: var(--ink); }

.nav-number {
  display: grid; place-items: center; flex: none;
  width: 22px; height: 22px; border-radius: 6px;
  background: var(--section-wash); color: var(--section);
  font-size: 0.72rem; font-weight: 700; font-variant-numeric: tabular-nums;
}
.nav-title { flex: 1; min-width: 0; line-height: 1.3; }
.nav-count {
  flex: none; color: var(--ink-faint); font-size: 0.72rem;
  font-weight: 500; font-variant-numeric: tabular-nums;
}
.nav-section[open] > summary { color: var(--ink); }
.nav-section[open] .nav-number { background: var(--section); color: #fff; }

.nav-section ul {
  list-style: none; margin: 2px 0 10px; padding: 0 0 0 21px;
  border-left: 1.5px solid var(--line); margin-left: 20px;
}
.nav-section li a {
  display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap;
  padding: 6px 9px; margin-left: -1px; border-radius: 7px;
  color: var(--ink-soft); text-decoration: none;
  font-size: 0.855rem; line-height: 1.4;
  transition: background 0.12s, color 0.12s;
}
.nav-section li a:hover { background: var(--paper-sunk); color: var(--ink); }
.nav-section li a.active {
  background: var(--section-wash); color: var(--section); font-weight: 600;
  box-shadow: inset 2px 0 0 var(--section);
}
.nav-empty {
  padding: 6px 9px; color: var(--ink-faint);
  font-size: 0.8rem; font-style: italic;
}

/* ------------------------------------------------------------- typography */

h1, h2, h3 { font-family: var(--display); font-weight: 600; letter-spacing: -0.012em; }

h1 {
  font-size: clamp(1.85rem, 1.3rem + 2.2vw, 2.6rem);
  line-height: 1.12; margin: 0 0 14px;
  font-variation-settings: "opsz" 96;
}
h2 {
  font-size: clamp(1.3rem, 1.1rem + 0.8vw, 1.6rem);
  line-height: 1.22; margin: 2.2em 0 0.6em;
  font-variation-settings: "opsz" 36;
}
h3 {
  font-size: 1.14rem; line-height: 1.3; margin: 1.9em 0 0.5em;
  font-variation-settings: "opsz" 20;
}
h4 {
  font-family: var(--sans);
  font-size: 0.82rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--ink-faint); margin: 1.8em 0 0.5em;
}

.lede {
  font-size: 1.12rem; line-height: 1.55; color: var(--ink-soft);
  margin: 0 0 22px; max-width: 60ch;
}
.muted { color: var(--ink-faint); font-size: 0.875rem; }
.tiny { font-size: 0.76rem; color: var(--ink-faint); }

.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  margin-bottom: 12px; padding: 4px 11px 4px 5px;
  background: var(--section-wash); color: var(--section);
  border-radius: 999px;
  font-size: 0.75rem; font-weight: 650; letter-spacing: 0.02em;
  text-decoration: none;
}
.eyebrow-num {
  display: grid; place-items: center;
  width: 19px; height: 19px; border-radius: 50%;
  background: var(--section); color: #fff;
  font-size: 0.66rem; font-variant-numeric: tabular-nums;
}

.ref {
  color: var(--section); font-variant-numeric: tabular-nums;
  font-weight: 600; margin-right: 0.45em;
}

.section-heading {
  font-family: var(--sans);
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--ink-faint); font-weight: 700;
  margin: 44px 0 16px; padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.crumbs {
  display: flex; flex-wrap: wrap; gap: 7px; align-items: center;
  font-size: 0.82rem; color: var(--ink-faint); margin: 0 0 22px;
}
.crumbs a { color: var(--ink-faint); text-decoration: none; }
.crumbs a:hover { color: var(--section); text-decoration: underline; }
.crumb-sep { opacity: 0.45; }

/* ------------------------------------------------------------------ prose */

.prose { max-width: var(--measure); font-size: 1.02rem; }
.prose > *:first-child { margin-top: 0; }
.prose p { margin: 0 0 1.15em; }
.prose ul, .prose ol { margin: 0 0 1.15em; padding-left: 1.35em; }
.prose li { margin: 0.4em 0; padding-left: 0.2em; }
.prose li::marker { color: var(--section); }
.prose li > ul, .prose li > ol { margin: 0.4em 0; }
.prose strong { font-weight: 650; color: var(--ink); }
.prose hr {
  border: 0; height: 1px; margin: 2.6em 0;
  background: linear-gradient(to right, var(--line), transparent);
}

/* Callout — the single most-used block on a clinical reference page. */
.prose blockquote {
  position: relative;
  margin: 1.7em 0; padding: 16px 20px 16px 22px;
  background: var(--section-wash);
  border-radius: var(--radius);
  color: var(--ink);
  font-size: 0.99rem;
}
.prose blockquote::before {
  content: ""; position: absolute; left: 0; top: 10px; bottom: 10px;
  width: 3px; border-radius: 3px; background: var(--section);
}
.prose blockquote p:last-child { margin-bottom: 0; }
.prose blockquote strong { color: var(--section); }

.prose code {
  background: var(--paper-sunk); padding: 2px 6px; border-radius: 5px;
  font-family: var(--mono); font-size: 0.87em;
  border: 1px solid var(--line-soft);
}
.prose pre {
  background: var(--paper-sunk); padding: 16px 18px; border-radius: var(--radius);
  overflow-x: auto; margin: 0 0 1.2em; border: 1px solid var(--line);
}
.prose pre code { background: none; padding: 0; border: 0; }

/* Tables carry a lot of this site's content, so they get real attention. */
.prose .table-wrap { overflow-x: auto; margin: 0 0 1.5em; }
.prose table {
  width: 100%; border-collapse: collapse; font-size: 0.93rem;
  background: var(--paper);
  border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden;
}
.prose table th, .prose table td {
  padding: 10px 14px; text-align: left; vertical-align: top;
  border-bottom: 1px solid var(--line-soft);
}
.prose table th {
  background: var(--section-wash); color: var(--section);
  font-weight: 650; font-size: 0.78rem;
  text-transform: uppercase; letter-spacing: 0.045em;
  border-bottom: 1px solid var(--line);
}
.prose table tr:last-child td { border-bottom: 0; }
.prose table tbody tr:nth-child(even) { background: color-mix(in srgb, var(--paper-sunk) 45%, transparent); }

.prose img { max-width: 100%; height: auto; border-radius: var(--radius); }

/* Checklists read as things to do, not as bullets. */
.prose ul:has(> li > input[type="checkbox"]) { padding-left: 0; list-style: none; }
.prose li:has(> input[type="checkbox"]) {
  list-style: none; display: flex; gap: 11px; align-items: flex-start;
  padding: 9px 13px; margin: 5px 0;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 9px; font-size: 0.96rem;
}
.prose input[type="checkbox"] {
  margin: 4px 0 0; flex: none; width: 15px; height: 15px;
  accent-color: var(--section);
}

/* ------------------------------------------------------------------ parts */

.hero {
  position: relative;
  margin: -4px 0 8px; padding: 30px 28px 32px;
  background: var(--paper);
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.hero::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 4px;
  background: linear-gradient(90deg, #0f5f57, #1f5f86, #7a4b9c, #9a6410, #a33a33, #3f6b34);
}
.hero h1 { margin-top: 6px; }
.hero .lede { margin-bottom: 0; }

.card-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}
.card {
  position: relative; display: flex; flex-direction: column; gap: 6px;
  padding: 18px 18px 16px;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  text-decoration: none; color: inherit;
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
}
.card::before {
  content: ""; position: absolute; left: 0; top: 14px; bottom: 14px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--section);
  opacity: 0; transition: opacity 0.14s;
}
.card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--section) 40%, var(--line));
  box-shadow: var(--shadow);
}
.card:hover::before { opacity: 1; }
.card-number {
  display: grid; place-items: center;
  width: 26px; height: 26px; border-radius: 7px;
  background: var(--section-wash); color: var(--section);
  font-size: 0.78rem; font-weight: 700; font-variant-numeric: tabular-nums;
}
.card h3 { margin: 6px 0 2px; font-size: 1.06rem; line-height: 1.25; }
.card p { margin: 0; color: var(--ink-soft); font-size: 0.89rem; line-height: 1.5; }
.card-meta {
  margin-top: auto; padding-top: 10px;
  color: var(--ink-faint); font-size: 0.78rem; font-weight: 500;
}

.page-list, .recent-list, .results { list-style: none; margin: 0; padding: 0; }

.page-list li {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); margin-bottom: 10px;
  transition: border-color 0.14s, box-shadow 0.14s, transform 0.14s;
}
.page-list li:hover {
  border-color: color-mix(in srgb, var(--section) 40%, var(--line));
  box-shadow: var(--shadow-sm); transform: translateX(2px);
}
.page-list li a {
  display: block; padding: 14px 18px 6px;
  font-weight: 600; font-size: 1.02rem; text-decoration: none; color: var(--ink);
}
.page-list li p { margin: 0; padding: 0 18px 14px; color: var(--ink-soft); font-size: 0.89rem; }

.results li { padding: 16px 0; border-bottom: 1px solid var(--line); }
.results li a { font-weight: 600; font-size: 1.04rem; text-decoration: none; }
.results li a:hover { text-decoration: underline; }
.results li > .muted { display: block; margin-top: 2px; }
.snippet { color: var(--ink-soft); font-size: 0.92rem; margin: 6px 0 0; }
.snippet mark {
  background: var(--amber-wash); color: var(--ink);
  padding: 1px 3px; border-radius: 3px; font-weight: 600;
}

.recent-list li {
  display: flex; flex-wrap: wrap; gap: 3px 12px; align-items: baseline;
  padding: 11px 0; border-bottom: 1px solid var(--line-soft);
}
.recent-list li a { font-weight: 550; text-decoration: none; }
.recent-list li a:hover { text-decoration: underline; }

/* ------------------------------------------------------------- page header */

.page-head {
  margin-bottom: 28px; padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}
.page-meta {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 14px 0 0;
}

.toc {
  background: var(--paper); border: 1px solid var(--line);
  border-left: 3px solid var(--section);
  border-radius: var(--radius); padding: 16px 20px; margin: 0 0 32px;
}
.toc-title {
  margin: 0 0 10px; font-size: 0.7rem; text-transform: uppercase;
  letter-spacing: 0.09em; color: var(--ink-faint); font-weight: 700;
}
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc li { margin: 5px 0; font-size: 0.89rem; line-height: 1.4; }
.toc .toc-d3 { padding-left: 15px; }
.toc .toc-d4 { padding-left: 30px; }
.toc a { text-decoration: none; color: var(--ink-soft); }
.toc a:hover { color: var(--section); text-decoration: underline; }

.tag, .pill {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 0.7rem; font-weight: 650; letter-spacing: 0.015em;
  vertical-align: middle; white-space: nowrap;
}
.tag-nursing { background: #e2f1f3; color: #146b74; }
.tag-therapy { background: var(--moss-wash); color: var(--moss); }
.pill { background: var(--amber-wash); color: var(--amber); }
.pill-ok { background: var(--moss-wash); color: var(--moss); }
.pill-internal { background: var(--paper-sunk); color: var(--ink-soft); }
@media (prefers-color-scheme: dark) {
  .tag-nursing { background: #132c2f; color: #63c0c9; }
}

.banner {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--amber-wash); color: var(--amber);
  border-radius: var(--radius); padding: 12px 16px; margin: 0 0 24px;
  font-size: 0.9rem; border: 1px solid color-mix(in srgb, var(--amber) 25%, transparent);
}
.empty-state {
  background: var(--paper); border: 1px dashed var(--line);
  border-radius: var(--radius); padding: 22px; color: var(--ink-soft);
}

.stat-row {
  display: grid; gap: 12px; margin: 22px 0;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}
.stat {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px;
  font-size: 0.78rem; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--ink-faint);
}
.stat span {
  display: block; font-family: var(--display);
  font-size: 1.85rem; font-weight: 600; letter-spacing: -0.02em;
  color: var(--ink); line-height: 1.1; margin-bottom: 2px;
  text-transform: none;
}

/* --------------------------------------------------------------- controls */

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 15px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--paper); color: var(--ink);
  font-family: inherit; font-size: 0.89rem; font-weight: 550; line-height: 1.25;
  text-decoration: none; cursor: pointer;
  transition: border-color 0.14s, background 0.14s, color 0.14s, transform 0.1s;
}
.btn:hover { border-color: var(--section); color: var(--section); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--brand); border-color: var(--brand); color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: var(--brand-deep); border-color: var(--brand-deep); color: #fff; }
.btn-ghost { border-color: transparent; background: none; color: var(--ink-soft); }
.btn-ghost:hover { background: var(--paper-sunk); color: var(--ink); border-color: transparent; }
.btn-small { padding: 4px 11px; font-size: 0.8rem; }
.btn-danger { color: var(--rose); border-color: color-mix(in srgb, var(--rose) 40%, var(--line)); background: none; }
.btn-danger:hover { background: var(--rose-wash); border-color: var(--rose); color: var(--rose); }
.btn-row { display: flex; flex-wrap: wrap; gap: 9px; margin: 20px 0; }

.table {
  width: 100%; border-collapse: collapse; font-size: 0.89rem;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
}
.table th, .table td {
  text-align: left; padding: 10px 13px;
  border-bottom: 1px solid var(--line-soft); vertical-align: top;
}
.table th {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-faint); font-weight: 700;
  background: var(--paper-sunk); border-bottom: 1px solid var(--line);
}
.table tr:last-child td { border-bottom: 0; }
.table .row-off { opacity: 0.45; }
.table form { display: inline; }
.table-scroll { overflow-x: auto; }

.form { display: grid; gap: 15px; max-width: 540px; margin: 18px 0 34px; }
label { display: grid; gap: 6px; font-size: 0.82rem; font-weight: 650; color: var(--ink-soft); }
input[type="text"], input[type="email"], input[type="number"], input[type="search"],
input[type="file"], select, textarea {
  font: inherit; font-size: 0.95rem; font-weight: 400;
  color: var(--ink); background: var(--paper);
  border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; width: 100%;
  transition: border-color 0.14s, box-shadow 0.14s;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus {
  border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-wash);
}

.centered { max-width: 540px; margin: 14vh auto; padding: 0 22px; text-align: center; }
.centered h1 { font-size: 1.9rem; }

.site-footer {
  border-top: 1px solid var(--line); padding: 26px 20px 48px;
  color: var(--ink-faint); font-size: 0.82rem; text-align: center;
}
.site-footer p { max-width: 620px; margin: 0 auto; }
.site-footer strong { color: var(--ink-soft); font-weight: 600; }

/* ----------------------------------------------------------------- editor */

.editor { margin: 0; }
.editor-head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.title-input {
  flex: 1 1 320px;
  font-family: var(--display); font-size: 1.45rem; font-weight: 600;
  letter-spacing: -0.015em; padding: 11px 13px;
}
.editor-actions { display: flex; gap: 8px; }

.editor-grid { display: grid; gap: 22px; }
@media (min-width: 1040px) {
  .editor-grid { grid-template-columns: minmax(0, 1fr) 286px; align-items: start; }
  .editor-side { position: sticky; top: calc(var(--header-h) + 16px); }
}

.toolbar {
  display: flex; flex-wrap: wrap; gap: 3px; padding: 7px;
  background: var(--paper-sunk); border: 1px solid var(--line);
  border-radius: var(--radius) var(--radius) 0 0; border-bottom: 0;
}
.toolbar button {
  padding: 6px 10px; font: inherit; font-size: 0.81rem; font-weight: 550; line-height: 1.2;
  background: none; border: 1px solid transparent; border-radius: 7px;
  color: var(--ink-soft); cursor: pointer; transition: background 0.12s, color 0.12s;
}
.toolbar button:hover { background: var(--paper); color: var(--ink); }
.toolbar button.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.toolbar-spacer { flex: 1; }

.body-input {
  width: 100%; min-height: 62vh; padding: 20px;
  border: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius);
  font-family: var(--mono); font-size: 0.89rem; line-height: 1.75; tab-size: 2;
}
.preview {
  min-height: 62vh; padding: 24px; background: var(--paper);
  border: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius);
}

.editor-side { display: grid; gap: 13px; align-content: start; }
.editor-side label { font-size: 0.78rem; }
.editor-side .url-line input { font-size: 0.83rem; font-family: var(--mono); }

.danger summary { cursor: pointer; color: var(--rose); font-size: 0.83rem; }
.delete-form { margin: 26px 0 0; }
.copyable { cursor: pointer; }

/* -------------------------------------------------------- media in pages */

.prose figure.media { margin: 1.8em 0; }
.prose figure.media video,
.prose figure.media audio {
  width: 100%; display: block; border-radius: var(--radius);
  background: #000; box-shadow: var(--shadow);
}
.prose figure.media audio { background: none; box-shadow: none; }
.prose figure.media figcaption {
  margin-top: 10px; color: var(--ink-faint);
  font-size: 0.86rem; text-align: center;
}

/* --------------------------------------------------------------- uploader */

.uploader {
  display: grid; gap: 14px; max-width: 560px; margin: 18px 0 34px;
  padding: 20px; background: var(--paper);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.uploader .btn { justify-self: start; }
.progress { display: grid; gap: 7px; }
.progress-bar { height: 7px; background: var(--paper-sunk); border-radius: 999px; overflow: hidden; }
.progress-bar span {
  display: block; height: 100%; width: 0%; border-radius: 999px;
  background: linear-gradient(90deg, var(--brand), color-mix(in srgb, var(--brand) 60%, #6cc));
  transition: width 0.2s;
}
.upload-error {
  margin: 0; padding: 11px 14px; border-radius: var(--radius);
  background: var(--rose-wash); color: var(--rose); font-size: 0.87rem;
}

/* ----------------------------------------------------------- media picker */

.picker-overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(27, 36, 32, 0.5);
  display: flex; align-items: center; justify-content: center; padding: 22px;
}
.picker {
  background: var(--paper); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  width: min(560px, 100%); max-height: 80vh; display: flex; flex-direction: column;
  border: 1px solid var(--line);
}
.picker-head, .picker-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 15px 20px;
}
.picker-head { border-bottom: 1px solid var(--line); }
.picker-head strong { font-family: var(--display); font-size: 1.05rem; }
.picker-foot { border-top: 1px solid var(--line); font-size: 0.86rem; }
.picker-body { padding: 9px 11px; overflow-y: auto; }
.picker-list { list-style: none; margin: 0; padding: 0; }
.picker-item {
  display: grid; gap: 2px; width: 100%; text-align: left;
  padding: 11px 13px; border: 0; border-radius: 8px;
  background: none; font: inherit; color: inherit; cursor: pointer;
}
.picker-item:hover { background: var(--brand-wash); }
.picker-name { font-weight: 600; font-size: 0.91rem; }
.picker-meta { font-size: 0.78rem; }

[hidden] { display: none !important; }

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

/* ------------------------------------------------- page warning banner */

.notice {
  display: flex; gap: 13px; align-items: flex-start;
  margin: 0 0 28px; padding: 15px 18px;
  background: var(--amber-wash);
  border: 1px solid color-mix(in srgb, var(--amber) 30%, transparent);
  border-left: 3px solid var(--amber);
  border-radius: var(--radius);
}
.notice-icon { flex: none; width: 19px; height: 19px; margin-top: 2px; color: var(--amber); }
.notice-label {
  margin: 0 0 3px; color: var(--amber);
  font-size: 0.78rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.notice-text { margin: 0; font-size: 0.92rem; line-height: 1.55; color: var(--ink); }

/* Sign-out reads as an exit, not another navigation option. */
.sign-out { color: var(--rose); }
.sign-out:hover { color: var(--rose); background: var(--rose-wash); border-color: transparent; }
.lede .sign-out { margin-left: 10px; vertical-align: middle; }
