/* The frame (design §5). In dark the canvas lifts toward the top left. */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; position: relative; isolation: isolate; background-color: var(--canvas); }
:root[data-theme="dark"] .shell { background: radial-gradient(120% 80% at 0% 0%, #16233F 0%, #0D1527 45%, #0B1220 100%); }
.page { position: relative; min-width: 0; display: flex; flex-direction: column; }
/* The skip link (round 23; shadcn-admin's skip-to-main): the first thing the keyboard reaches on every page, off screen
   until it has the focus, then a key at the top left; Enter moves the focus past the sidebar to the page (#page carries
   tabindex -1 for it, and draws no ring of its own: the next Tab shows the ring on a real control). */
.skip { position: fixed; top: 12px; left: 12px; z-index: 60; padding: 9px 14px; border-radius: var(--radius-btn); background: var(--btn-bg); color: var(--btn-ink); font: 600 13.5px/1 var(--font); text-decoration: none; white-space: nowrap; transform: translateY(calc(-100% - 16px)); transition: transform .15s ease; }
.skip:focus-visible { transform: none; }
.page:focus, .page:focus-visible { outline: none; }
:root { --main-gap: 36px; } /* the space between sections; the insights page's two-column formula reads it (panels.css), so the two cannot drift apart */
.main { padding: 8px 28px 40px; display: flex; flex-direction: column; gap: var(--main-gap); }

/* Glass (§4.2) on four surfaces only: the sidebar, the header band, the filter bar while it sticks, and the month's
   finding. In every theme since round 14 (Rob, 19 Oct: "the light can also be glass so it's all uniform just different
   colors for the eyes"): navy glass in dark, white glass in light, the finding's the densest (tokens.css). Glass and glow
   off, or reduced transparency, makes them solid. */
.glass { background: var(--glass-bg); -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(140%); backdrop-filter: blur(var(--glass-blur)) saturate(140%); box-shadow: var(--glass-rim); }
.sidebar.glass { background: var(--side-glass); }
/* The month's finding, one treatment in every theme (round 25; Rob: light's ink card "is not the same" as navy's and
   black's): its glass, the rim, and a whisper of gold along its foot; the gold label and the edge light under it do the rest. */
.finding.glass { background: var(--finding-glass); box-shadow: var(--finding-rim), inset 0 -10px 22px -18px color-mix(in srgb, var(--seam) 35%, transparent); }
/* The sticking filter bar's glass is near solid (tokens.css, --bar-glass): content scrolls under it, the neon too. */
.filterbar.stuck.glass { background: var(--bar-glass); -webkit-backdrop-filter: blur(var(--glass-blur)); backdrop-filter: blur(var(--glass-blur)); }
/* (A media rule for the system's reduced transparency stood here, dark only. The Glass and glow setting already follows
   that preference until the reader chooses, so it went in round 18: it overrode a reader's own "on", in dark alone.) */

/* The edge light (§4.7): a 2 px seam on the bottom edge, brightest in the middle and gone at both ends, and a halo
   under it, alike in every theme since round 18 (Rob, 19 Oct: "the dark has glass and glow while white not"). Strong,
   and only with Glass and glow on (Rob: "when settings: glass and glow is turned on then it will have a strong edge
   light"); off, it goes with the glass. */
.edge { position: relative; isolation: isolate; }
.edge::after { content: ""; position: absolute; left: 14%; right: 14%; bottom: -1px; height: 2px; border-radius: 1px; pointer-events: none;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--seam) 90%, transparent) 50%, transparent); }
.edge::before { content: ""; position: absolute; left: 22%; right: 22%; bottom: -12px; height: 20px; z-index: -1; pointer-events: none; opacity: var(--halo);
  background: radial-gradient(50% 50% at 50% 30%, var(--seam), transparent 72%); filter: blur(7px); }
/* Focus: a 2 px ring, and with Glass and glow the same light underneath (§4.7) as a soft glow below the control, in
   every theme. */
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
:root:not([data-glass="off"]) :focus-visible { box-shadow: 0 8px 10px -8px color-mix(in srgb, var(--seam) 80%, transparent); }
/* Forced colours (Windows high contrast; review, 19 Oct): the seam, the focus light, the texture and the waves go; the
   HTML-drawn marks keep their colours, as the SVG charts do, and gain an edge in the system's text colour, so they show
   even where a colour is taken away. */
@media (forced-colors: active) {
  .edge::before, .edge::after { display: none; } :focus-visible { box-shadow: none; }
  .material, .shell::before, .filterbar::before { display: none !important; content: none !important; } /* over the texture's own rule, which comes later */
  .split-bar span, .split li i, .rank-bar i, .dots i, .legend i, .frame h3 i { forced-color-adjust: none; outline: 1px solid CanvasText; outline-offset: -1px; }
}

/* The sidebar: the first glass surface, white glass in light (moodboard 234), navy glass in dark. */
/* Fixed to the window in every text size (Rob, 19 Oct: the name and Settings "fixed at the bottom so I don't need to
   scroll down"): the page's zoom (larger text) would scale 100vh past the window, so the height is divided by it; the
   links scroll inside if they ever outgrow it, and the person menu keeps the foot. */
.sidebar { position: sticky; top: 0; height: calc(100vh / var(--zoom, 1)); z-index: 5; display: flex; flex-direction: column; gap: 4px; padding: 18px 12px; background: var(--side); color: var(--side-ink-2); border-right: 1px solid var(--side-line); }
.logo { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; color: var(--side-ink); font: 600 18px/1 var(--font); letter-spacing: -.01em; text-decoration: none; }
.logo svg { width: 24px; height: auto; flex: none; }
/* The logo and the fold button share the top (moodboard 234: the panel button beside the name). */
.side-top { display: flex; align-items: center; gap: 6px; margin-bottom: 14px; }
.side-top .logo { flex: 1; min-width: 0; padding: 4px 10px; }
.fold { flex: none; width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 8px; background: none; color: var(--side-ink-2); cursor: pointer; }
.fold:hover { background: var(--nav-hover); color: var(--side-ink); }
.nav { display: flex; flex-direction: column; gap: 2px; min-height: 0; overflow-y: auto; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: var(--side-ink-2); text-decoration: none; font-weight: 500; }
.nav a:hover { color: var(--side-ink); background: var(--nav-hover); }
.nav a[aria-current="page"] { color: var(--nav-on); background: color-mix(in srgb, var(--gold) 12%, transparent); font-weight: 600; }
/* A line between the pages that read the answers and the builder, which changes the questionnaire (round 31). */
.nav-sep { flex: none; height: 1px; margin: 8px 12px; background: var(--side-line); }
.me { margin-top: auto; position: relative; }
#me-button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px; border: 0; border-top: 1px solid var(--side-line); background: none; color: var(--side-ink); font: inherit; cursor: pointer; border-radius: 10px; text-align: left; }
/* The person row reads as the menu it opens (round 22; the Workly sidebar, image 233): a line under the name, a chevron. */
#me-button .me-words { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
#me-button .me-name { font-weight: 500; }
#me-button .me-line { font-size: 11.5px; color: var(--side-ink-2); }
#me-button .me-chevron { flex: none; display: grid; color: var(--side-ink-2); }
#me-button:hover { background: var(--nav-hover); }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font: 700 12px/1 var(--font); color: var(--avatar-ink); border: 1px solid color-mix(in srgb, var(--gold) 45%, transparent); }
#me-menu { position: absolute; left: 0; bottom: 54px; width: 212px; background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; padding: 6px; box-shadow: 0 12px 30px rgba(0,0,0,.25); }
#me-menu[hidden] { display: none; }
#me-menu button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 0; background: none; color: inherit; font: inherit; border-radius: 8px; cursor: pointer; text-align: left; }
#me-menu button:hover { background: var(--panel-2); }

/* The header band: the second glass surface in dark. */
.header { position: relative; display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 26px 28px 12px; }
.header-text { min-width: 0; }
.header h1 { margin: 0; font: 600 26px/1.15 var(--font-title); letter-spacing: -.01em; }
.header p { margin: 6px 0 0; color: var(--ink-2); max-width: 70ch; }
.header-text a { color: var(--ink); text-underline-offset: 3px; } /* the header's words' links only: never the main button */
.eyebrow { margin: 0 0 6px !important; font: 500 13px/1.2 var(--font); color: var(--ink-2); } /* sentence case (round 21): one tracked label on a page at most, the month's finding's */
:root[data-theme="dark"] .eyebrow { color: var(--gold-word); }
.header .rule { width: 32px; height: 2px; border-radius: 1px; background: var(--gold-rule); margin-top: 10px; }
/* The help link is help, not the page's action (round 21): a quiet key with no fill and no edge light, so the eye goes to
   the figures first. The gold belongs to the data: the hero wears the edge light the button had. */
.btn-quiet { display: inline-flex; align-items: center; gap: 8px; padding: 8px 13px; border: 1px solid color-mix(in srgb, var(--ink) 18%, transparent); border-radius: var(--radius-btn); background: transparent; color: var(--ink); font: 500 13.5px/1 var(--font); cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn-quiet:hover { background: var(--nav-hover); }

/* Material (§4.8), in every theme since round 13 (Rob: "more uniform throughout"; light's gold is deeper, look.js),
   never behind words or figures: the gold particle waves, alike at the top and the foot (Rob,
   19 Oct: "bottom and top style with the dots should be the same"), as bright in both, each cropped to fit so the dots
   stay round. At the top they fill the header's right part, whose words keep to the left 58%, fading at both ends; at
   the foot, a band of their own. Under 1280 px the header has no room to keep words and waves apart, so its waves go. */
.material { position: absolute; pointer-events: none; z-index: -1; opacity: .38; background-repeat: no-repeat; background-size: cover; transition: opacity .24s ease, visibility 0s linear 0s; }
.material.band { left: 0; right: 0; bottom: 0; height: 180px; background-position: center bottom, center bottom; background-size: cover, 100% 100%; } /* the waves, and under them the gold pool (look.js sets both) */
.material.crown { top: 0; right: 0; width: 40%; height: 100%; background-position: center;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 30%, #000 72%, transparent); mask-image: linear-gradient(to right, transparent, #000 30%, #000 72%, transparent); }
/* The band's room is always kept (round 21): with Material off the foot is quiet space, so switching moves nothing. Off
   fades the layers out rather than removing them; Tactile shows them a little stronger. */
.page { padding-bottom: 180px; }
@media (min-width: 1280px) { :root:not([data-material="off"]) .header-text { max-width: 58%; } }
@media (max-width: 1279px) { .material.crown { display: none; } }
:root[data-material="tactile"] .material { opacity: .55; }
:root[data-material="off"] .material { opacity: 0; visibility: hidden; transition: opacity .24s ease, visibility 0s linear .24s; }

/* The footer: what is behind the figures. */
.behind { margin: 0 28px 32px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--ink-2); font-size: 13px; }
.behind h2 { margin: 0 0 4px; font: 600 13px/1.2 var(--font); color: var(--ink); } .behind p { margin: 4px 0 0; max-width: 80ch; }

/* The filter bar (§5): sticky, and while it sticks the third glass surface in dark (look.js adds .glass then). */
.filterbar { position: sticky; top: 0; z-index: 3; padding: 10px 28px 12px; display: flex; flex-direction: column; gap: 6px; border-bottom: 1px solid transparent; }
.filterbar.stuck { border-bottom-color: var(--line); background: var(--canvas); }
.switches { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: flex-end; }
.switch { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.switch-head { display: flex; align-items: center; gap: 4px; }
.switch-name { font-size: 12px; font-weight: 500; color: var(--ink-2); }
.why { border: 0; background: none; color: var(--ink-2); padding: 0; display: inline-grid; cursor: pointer; border-radius: 50%; }
.why[aria-expanded="true"] { color: var(--ink); }
.why-text { margin: 0; font-size: 12px; color: var(--ink-2); max-width: 70ch; } .why-text[hidden] { display: none; }
.track { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--chip-track); max-width: 100%; }
.track button { border: 0; background: none; color: var(--ink-2); font: 500 13px/1 var(--font); padding: 7px 11px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.track button[aria-pressed="true"] { background: var(--chip-on); color: var(--chip-on-ink); box-shadow: var(--chip-on-shadow); font-weight: 600; }
.shown { margin: 0; font-size: 12px; color: var(--ink-2); }
@media (forced-colors: active) { .track button[aria-pressed="true"] { outline: 2px solid CanvasText; } }

/* The icon rail (Rob, 19 Oct: "we can collapse it to just icons"; moodboard 233, 234): at 1024–1279 by itself, with no
   fold button, and at 1280 or more when the reader folds it; on a phone the sidebar is a top bar. The page takes the
   room, the change eased unless motion is off. */
.shell { transition: grid-template-columns .2s ease; }
@media (min-width: 768px) and (max-width: 1279px) { .shell { grid-template-columns: 76px 1fr; } .fold { display: none; } }
@media (min-width: 1280px) { :root[data-sidebar="icons"] .shell { grid-template-columns: 76px 1fr; } }
/* Whatever narrows it, the rail is drawn from the sidebar's own width (a container query), so one set of rules serves
   both. A word that leaves the rail leaves the eye only: a screen reader still reads every link's name (until round 17
   they were display: none, nameless), and a tip shows it beside the rail on hover and on focus. */
.sidebar { container: side / inline-size; }
@container side (max-width: 120px) {
  .side-top { flex-direction: column; gap: 8px; }
  .side-top .logo, .nav a, #me-button { justify-content: center; padding-left: 0; padding-right: 0; }
  .logo span, #me-button .me-words, #me-button .me-chevron { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .nav { overflow: visible; }
  .nav a { position: relative; }
  .nav a span { position: absolute; left: calc(100% + 12px); top: 50%; transform: translateY(-50%); white-space: nowrap; padding: 7px 10px; border-radius: 8px;
    background: var(--ink); color: var(--canvas); box-shadow: 0 8px 22px rgba(0,0,0,.24); font: 500 13px/1 var(--font); /* inverted, so it stands off any page */
    opacity: 0; pointer-events: none; transition: opacity .12s ease; z-index: 30; }
  .nav a:hover span, .nav a:focus-visible span { opacity: 1; }
}
/* ---- Round 27 (Rob, 19 Oct: "On a very small screen … I like the bottom one, the navigation at the bottom"; six pictures
   of bottom bars in the inspiration folder): below 768 px the sidebar is a floating bar at the foot of the screen. Five
   tabs, the four pages and the person, each an icon over its name (the size guide in his pictures: 24 px icons and 12 px
   names, here 22 and 11, to fit a 320 px phone); the page you are on in the sidebar's own gold pill, the edge light under
   it. How it works moves into the person's menu, which opens upward. The bar is near-solid glass (--tabbar-glass), since
   the whole page scrolls under it, and it keeps clear of an iPhone's home indicator. Nothing slides: motion is Read
   More's. The two parts only a phone shows, the header's mark and the menu's How it works: ---- */
.header-mark { display: none; align-items: center; gap: 8px; margin: 0 0 12px; color: var(--ink); font: 600 15px/1 var(--font); letter-spacing: -.01em; text-decoration: none; border-radius: 6px; }
.header-mark svg { width: 20px; height: auto; flex: none; }
.me-how, .me-page { display: none; width: 100%; align-items: center; gap: 10px; padding: 8px 10px; color: inherit; text-decoration: none; border-radius: 8px; }
.me-how:hover, .me-page:hover { background: var(--panel-2); }
.me-page[aria-current="page"] { color: var(--nav-on); font-weight: 600; } /* the builder, in the menu on a phone (round 31) */
/* The bar's own light (round 28; Rob: "The glow is activated. Could you add a slight glow underneath the whole panel at
   the bottom"): the edge light's gold spread under the bar's whole length, as a shadow, so it lies beneath the glass and
   never tints it. With Glass and glow only and not under More contrast, like every glow; Material off keeps it, since it
   is a light and not depth. */
.sidebar { --tabbar-glow: 0 0 0 0 transparent; --tabbar-shade: rgba(16, 24, 40, .14); }
:root[data-theme="dark"] .sidebar { --tabbar-shade: rgba(0, 0, 0, .45); } /* light: a soft shade, so the gold reads as light, not as a beige shadow */
/* Round 30 set the bar on the screen's foot, where nothing lies under it, so the glow rises from its top edge instead
   (Rob, 20 Oct: "at the top it's rounded and has light"). */
:root[data-glass="on"]:not([data-contrast="more"]) .sidebar { --tabbar-glow: 0 -4px 20px -2px color-mix(in srgb, var(--seam) 60%, transparent); }
@media (max-width: 767px) {
  .shell { grid-template-columns: 1fr; }
  .fold, .side-top { display: none; }
  /* Round 30 (Rob, 20 Oct: "fix it at the very, very bottom? So it's covering everything at the bottom, and then at the
     top it's rounded and has light"): the bar meets the screen's foot and both its sides, only its top corners round,
     concentric with the pill (17 px and 5 px of padding). The safe areas pad the tabs, so they keep clear of an
     iPhone's home indicator while the glass runs to the very edge. Its shade rises, since nothing lies under it. */
  .sidebar { position: fixed; top: auto; left: 0; right: 0; bottom: 0; height: auto; z-index: 30;
    flex-direction: row; align-items: stretch; gap: 0;
    padding: 5px max(5px, env(safe-area-inset-right, 0px)) calc(5px + env(safe-area-inset-bottom, 0px)) max(5px, env(safe-area-inset-left, 0px));
    border: 0; border-top: 1px solid var(--side-line); border-radius: 22px 22px 0 0;
    box-shadow: var(--rim), var(--tabbar-glow), 0 -12px 30px -18px var(--tabbar-shade); }
  .sidebar.glass { background: var(--tabbar-glass); }
  :root[data-material="tactile"] .sidebar { box-shadow: var(--rim), var(--tabbar-glow), 0 -16px 40px -16px var(--tabbar-shade); }
  :root[data-material="off"] .sidebar { box-shadow: var(--tabbar-glow); }
  /* The light along its top (round 30): the edge light's seam on the top edge, brightest in the middle and gone at both
     ends, and its halo above it, rising onto the page; with Glass and glow alone, like round 28's glow. */
  :root[data-glass="on"]:not([data-contrast="more"]) .sidebar::after { content: ""; position: absolute; top: -1px; left: 12%; right: 12%; height: 2px; border-radius: 1px; pointer-events: none;
    background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--seam) 90%, transparent) 50%, transparent); }
  :root[data-glass="on"]:not([data-contrast="more"]) .sidebar::before { content: ""; position: absolute; top: -14px; left: 20%; right: 20%; height: 18px; z-index: -1; pointer-events: none;
    opacity: var(--halo); background: radial-gradient(50% 50% at 50% 75%, var(--seam), transparent 72%); filter: blur(7px); }
  .nav { flex: 4 1 0; min-width: 0; flex-direction: row; gap: 0; overflow: visible; }
  .nav a, #me-button { flex: 1 1 0; min-width: 0; flex-direction: column; justify-content: center; gap: 3px; min-height: 54px; padding: 6px 0 5px; border: 0; border-radius: 17px;
    font: 500 11px/1.2 var(--font); letter-spacing: -.005em; }
  .nav a svg { width: 22px; height: 22px; }
  .nav a > span, #me-button .me-name { position: static; width: auto; height: auto; max-width: 100%; overflow: hidden; clip: auto; white-space: nowrap; text-overflow: ellipsis; }
  .nav a[href="#how"], .nav a[href="builder.html"], .nav-sep { display: none; } /* both in the person's menu (round 31: the builder too) */
  .nav a[aria-current="page"] { font-weight: 600; }
  .nav a.edge::after { left: 28%; right: 28%; bottom: 2px; }
  .nav a.edge::before { left: 30%; right: 30%; bottom: -8px; height: 14px; }
  .me { flex: 1 1 0; min-width: 0; margin: 0; display: flex; }
  #me-button { color: var(--side-ink-2); }
  #me-button .avatar { width: 22px; height: 22px; font-size: 10px; }
  #me-button .me-words { position: static; width: auto; height: auto; max-width: 100%; overflow: hidden; clip: auto; flex: none; align-items: center; }
  #me-button .me-name { font-weight: 500; }
  #me-button .me-line, #me-button .me-chevron { display: none; }
  #me-menu { left: auto; right: 6px; top: auto; bottom: calc(100% + 10px); } /* clear of the screen's edge, which the bar meets since round 30 */
  .me-how, .me-page { display: flex; }
  .header-mark { display: inline-flex; }
  .header { padding: 16px 16px 8px; flex-direction: column; } .main { padding: 8px 16px 32px; } .behind { margin: 0 16px 24px; }
  .filterbar { position: static; padding: 8px 16px; } .switches { flex-direction: column; align-items: stretch; }
  .switches, .switch { min-width: 0; max-width: 100%; } .track { overflow-x: auto; }
}
@media (max-width: 767px) and (forced-colors: active) {
  .sidebar { border: 0; border-top: 1px solid CanvasText; }
  .sidebar::before, .sidebar::after { display: none; }
  .nav a[aria-current="page"] { outline: 2px solid CanvasText; outline-offset: -3px; }
}
/* ---- Round 29 (Rob, 19 Oct, with a picture of the questionnaire switch scrolling on a phone: "if it's on a smaller
   device, we can just make it into shorter sentences … "both" without the word questionnaires, one-time without the word
   "buyers," and A++ without the word "customers""): on a phone the filter switches take short names. A tail Rob cut
   stays for a screen reader, clipped from the eye, since the short name is its start; "Everyone" becomes "All", which is
   not its start, so the phone reads aloud what it shows. Below 361 px the choices sit a little closer, and a switch that
   still cannot fit (a 320 px phone with larger text) wraps to a second row instead of scrolling sideways. ---- */
#filterbar .track .short { display: none; }
@media (max-width: 767px) {
  #filterbar .track .tail { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  #filterbar .track .long { display: none; }
  #filterbar .track .short { display: inline; }
  #filterbar .track { flex-wrap: wrap; }
}
@media (max-width: 360px) { #filterbar .track button { padding-left: 8px; padding-right: 8px; } }


/* ---- Round 2 (19 Oct): the reader's settings and the open looks (design §12, §12.1) ---- */
/* Controls answer at once, softly; under "motion reduced" nothing moves. */
.track button, #me-menu button, .switch-btn { transition: background-color .15s ease, color .15s ease, box-shadow .15s ease; }
:root[data-motion="reduced"] *, :root[data-motion="reduced"] *::before, :root[data-motion="reduced"] *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
/* More contrast: a firmer focus ring too. */
:root[data-contrast="more"] :focus-visible { outline-width: 3px; }
/* Larger text: the page scales as a whole, so chart labels grow with the words. */
:root[data-text="large"] { --zoom: 1.143; }
:root[data-text="large"] .shell, :root[data-text="large"] #settings { zoom: var(--zoom); } /* Settings lives outside the shell (review, 19 Oct) */
/* Figures as tables: every card shows its table under its chart. */
.figures-table { display: none; }
:root[data-tables="on"] .figures-table { display: block; }
/* Glass and glow off: solid surfaces, no blur, no halo, no light under anything. */
:root[data-glass="off"] .glass { -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: none; }
:root[data-glass="off"] .sidebar.glass { background: var(--side); }
:root[data-glass="off"] .header.glass { background: transparent; }
:root[data-glass="off"] .finding.glass { background: var(--panel); box-shadow: none; } /* in every theme, the whisper too (round 25: dark still drew it with glass off) */
:root[data-glass="off"] .filterbar.stuck.glass { background: var(--canvas); }
:root[data-glass="off"] .edge::before, :root[data-glass="off"] .edge::after { display: none; }
:root[data-glass="off"] :focus-visible { box-shadow: none; }
/* Dark base black: the canvas's lift in charcoal instead of navy. */
:root[data-theme="dark"][data-base="black"] .shell { background: radial-gradient(120% 80% at 0% 0%, #1C1E24 0%, #111215 45%, #0B0C0E 100%); }
/* Tactile controls, Settings → Material → Tactile: an inset track, the chosen key raised, a small light under it
   (191–194 of the moodboard). Off and Flat keep the flat keys. */
:root[data-material="tactile"] .track { background: var(--panel-2); box-shadow: inset 0 1px 2px rgba(0,0,0,.18), inset 0 -1px 0 rgba(255,255,255,.05); }
:root[data-material="tactile"] .track button[aria-pressed="true"] { position: relative; background: linear-gradient(180deg, var(--chip-on-hi), var(--chip-on)); box-shadow: 0 1px 2px rgba(0,0,0,.28), inset 0 1px 0 rgba(255,255,255,.14); }
:root[data-material="tactile"] .track button[aria-pressed="true"]::after { content: ""; position: absolute; left: 28%; right: 28%; bottom: 2px; height: 2px; border-radius: 1px; background: var(--seam); box-shadow: 0 0 6px var(--seam); }
:root[data-glass="off"][data-material="tactile"] .track button[aria-pressed="true"]::after { box-shadow: none; }
/* Tactile's raised tiles (round 21): the cards' icon tiles, the findings' kind tiles and Settings' tiles catch the light. */
.tile, .kind, .setting-icon { transition: background-color .24s ease, box-shadow .24s ease; }
:root[data-material="tactile"] :is(.tile, .kind, .setting-icon) { background: var(--tile-face); box-shadow: var(--tile-depth); }
/* The on/off switches, tactile too (Rob, 19 Oct: "there should also be a flat and a tactile for the radio buttons?"):
   the groove pressed in like the track's, the knob raised and lit from above, on the gold when on, with a small light
   round the groove while Glass and glow is on. */
:root[data-material="tactile"] .switch-btn .knob { background: var(--knob-groove); border-color: transparent; box-shadow: inset 0 1px 3px rgba(0,0,0,.32), inset 0 -1px 0 rgba(255,255,255,.06); }
:root[data-material="tactile"] .switch-btn .knob::after { background: linear-gradient(180deg, var(--knob-hi), var(--knob-lo)); box-shadow: 0 0 0 1px var(--knob-ring), 0 1px 2px rgba(0,0,0,.35), 0 2px 5px rgba(0,0,0,.18); }
:root[data-material="tactile"] .switch-btn[aria-checked="true"] .knob { background: linear-gradient(180deg, color-mix(in srgb, var(--btn-bg) 78%, #000), var(--btn-bg)); }
:root[data-material="tactile"] .switch-btn[aria-checked="true"] .knob::after { background: linear-gradient(180deg, #FFFFFF, #ECEEF1); }
:root[data-material="tactile"][data-glass="on"] .switch-btn[aria-checked="true"] .knob { box-shadow: inset 0 1px 3px rgba(0,0,0,.32), 0 0 8px color-mix(in srgb, var(--seam) 45%, transparent); }

/* The Settings dialog: the reader's own, under the person menu. */
#settings { width: min(600px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); padding: 0; background: var(--panel); color: var(--ink); box-shadow: 0 24px 60px rgba(0,0,0,.35); }
#settings::backdrop { background: rgba(8,12,20,.55); }
:root[data-glass="on"] #settings::backdrop { -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.settings-head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px 6px; }
.settings-head h2 { margin: 0; font: 600 18px/1.2 var(--font); } .settings-head p { margin: 4px 0 0; color: var(--ink-2); font-size: 13px; }
/* Close, a button that looks like one (Rob, 19 Oct: "could we make the 'close' a button instead please"): a key like the
   chosen filter's, with its icon, 36 px high; raised like the tactile keys under Material → Tactile. */
.settings-close { margin-left: auto; flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 8px 14px 8px 11px;
  border: 1px solid var(--line); border-radius: var(--radius-btn); background: var(--chip-on); box-shadow: var(--chip-on-shadow); color: var(--ink); font: 600 13px/1 var(--font); cursor: pointer; }
.settings-close:hover { background: var(--panel-2); }
:root[data-material="tactile"] .settings-close { background: linear-gradient(180deg, var(--chip-on-hi), var(--chip-on)); box-shadow: 0 1px 2px rgba(0,0,0,.28), inset 0 1px 0 rgba(255,255,255,.14); }
.setting { display: flex; align-items: center; gap: 16px; padding: 12px 20px; border-top: 1px solid var(--line); }
.setting b { font-weight: 600; } .setting p { margin: 2px 0 0; color: var(--ink-2); font-size: 12.5px; }
.setting .follows { display: inline-block; margin-top: 4px; font-size: 11.5px; color: var(--ink-2); }
.setting .follows[hidden] { display: none; }
.switch-btn { margin-left: auto; flex: none; display: inline-flex; align-items: center; gap: 8px; border: 0; background: none; color: var(--ink); font: 600 12px/1 var(--font); cursor: pointer; padding: 4px; border-radius: 999px; }
.switch-btn .knob { width: 38px; height: 22px; border-radius: 999px; background: var(--chip-track); border: 1px solid var(--line); position: relative; }
.switch-btn .knob::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--ink-2); transition: left .15s ease; }
.switch-btn[aria-checked="true"] .knob { background: var(--btn-bg); border-color: var(--btn-bg); }
.switch-btn[aria-checked="true"] .knob::after { left: 18px; background: var(--btn-ink); }
.switch-btn .state { min-width: 2.2em; text-align: right; }
.setting .track { margin-left: auto; flex: none; } /* Theme's and Material's three: the filter bar's own track */
/* Two groups, Look and Reading (moodboard 242): a small label like the filter bar's, then rows that each start with an
   icon tile, the cards' own tile a little smaller. */
.settings-group + .settings-group { margin-top: 8px; border-top: 1px solid var(--line); }
.settings-group-head { padding: 14px 20px 8px; }
.settings-group-head h3 { margin: 0; font: 600 13px/1.2 var(--font); color: var(--ink); }
:root[data-theme="dark"] .settings-group-head h3 { color: var(--gold-word); }
.settings-group-head p { margin: 3px 0 0; color: var(--ink-2); font-size: 12.5px; }
.setting-icon { flex: none; width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--panel-2); color: var(--ink-2); }
.setting-words { flex: 1; min-width: 0; }
/* On a phone the icon tiles go, and a choice's track goes under its words, so the words keep a readable width. */
@media (max-width: 480px) {
  .setting-icon { display: none; }
  .setting.choice { flex-wrap: wrap; row-gap: 10px; }
  .setting.choice .setting-words { flex-basis: 100%; }
  .setting.choice .track { margin-left: 0; }
}
/* Wide enough, the two groups stand side by side, so the whole of Settings shows at once on a laptop; a choice's track
   then sits under its words, which keep their width. */
@media (min-width: 1000px) {
  #settings { width: min(980px, calc(100vw - 48px)); }
  .settings-groups { display: grid; grid-template-columns: 1fr 1fr; }
  .settings-group + .settings-group { margin-top: 0; border-top: 0; border-left: 1px solid var(--line); }
  /* Balanced (Rob, 19 Oct: "more spaces in between"): the shorter group's rows share out the taller one's height, each
     row's content centred in its share, so the two columns end level. */
  .settings-group { display: flex; flex-direction: column; }
  .settings-group .setting { flex: 1 1 auto; align-content: center; }
  .setting.choice { flex-wrap: wrap; row-gap: 10px; }
  .setting.choice .setting-words { flex-basis: calc(100% - 48px); }
  .setting.choice .track { margin-left: 48px; }
}

/* ---- The texture (Rob, 19 Oct; round 4 replaced round 3's drawn grain and rosette: "something more realistic. maybe a
   texture overlay?"). A scanned, seamless material from ambientCG (CC0; checks/make-textures-v5.cjs makes the tiles),
   in one fixed layer that stays put while the page scrolls, at about its real size. The tile is grey, so it brings no
   hue: in light, multiply darkens the canvas only where the stone's grain is; in dark the tile is inverted and
   screened, so the grain catches the light on the navy. Stone, under the cards, in both themes (Rob, 19 Oct: "I prefer
   the stone one but make it even more subtle"; "layer for the stone background is under the cards"): the cards lie
   over it, clean. Off with the Material setting, under more contrast and in print. The check measures its strongest
   speck against the secondary words. ---- */
.shell::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .17; mix-blend-mode: multiply; transition: opacity .24s ease;
  background: url("../img/texture-stone.jpg") 0 0 / 1024px 1024px repeat; } /* over the canvas, under all the shell holds */
:root[data-theme="dark"] .shell::before { opacity: .18; mix-blend-mode: screen; filter: invert(1); }
/* Where the filter bar sticks as a solid band (glass off, in either theme), it would hide the texture: it carries the
   same, fixed to the window like the page's, so the two meet without a seam. Glass shows the page's own through it.
   (A phone's bar never sticks.) */
@media (min-width: 768px) {
  :root[data-glass="off"] .filterbar.stuck::before {
    content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
    opacity: .17; mix-blend-mode: multiply; background: url("../img/texture-stone.jpg") 0 0 / 1024px 1024px repeat fixed; }
  :root[data-theme="dark"][data-glass="off"] .filterbar.stuck::before { opacity: .18; mix-blend-mode: screen; filter: invert(1); }
}
/* Material off fades the texture out rather than removing it, so the switch is a fade (round 21); More contrast and print
   remove it. */
:root[data-material="off"] .shell::before { opacity: 0; }
:root[data-material="off"] .filterbar::before,
:root[data-contrast="more"] .shell::before, :root[data-contrast="more"] .filterbar::before { content: none !important; }
@media print { .shell::before, .filterbar::before { content: none !important; } }

