/* app.css — the chrome around the article: bar, panel, contents rail.
   Deliberately quiet. The article is the only thing meant to shout. */

*, *::before, *::after { box-sizing: border-box; }

:root {
  --ui-font: 'IBM Plex Mono', ui-monospace, monospace;
  --ui-display: 'Newsreader', Georgia, serif;
  --bar-h: 54px;
  --panel-w: 392px;
  --ease: cubic-bezier(.2, .8, .2, 1);

  /* fixed chrome (used when "chrome follows theme" is off) */
  --ui-bg: #14151a;
  --ui-surface: #1b1d23;
  --ui-fg: #eceff4;
  --ui-muted: #9aa1ae;
  --ui-hair: #2b2f38;
  --ui-accent: #e0a458;
}
body.chrome-theme {
  --ui-bg: var(--ui-bg-themed, #14151a);
  --ui-surface: var(--ui-surface-themed, #1b1d23);
  --ui-fg: var(--ui-fg-themed, #eceff4);
  --ui-muted: var(--ui-muted-themed, #9aa1ae);
  --ui-hair: var(--ui-hair-themed, #2b2f38);
  --ui-accent: var(--rd-accent);
}

html, body { min-height: 100%; }
body {
  margin: 0; background: var(--rd-bg, #fbfaf7); color: var(--ui-fg);
  font-family: var(--ui-font);
  transition: background .3s var(--ease), color .3s var(--ease);
  overscroll-behavior-y: none;
}
button, input, select { font: inherit; color: inherit; }
.skip { position: fixed; left: -999px; top: 0; z-index: 99; background: var(--ui-accent); color: #000; padding: .6em 1em; }
.skip:focus { left: 8px; top: 8px; }

/* ---------- top bar ---------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--bar-h); z-index: 40;
  display: grid; grid-template-columns: 1fr minmax(180px, 520px) 1fr; align-items: center; gap: 14px;
  padding: 0 14px;
  background: var(--ui-bg);
  background: var(--ui-scrim, var(--ui-bg));
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--ui-hair);
}
.topbar__left, .topbar__right { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar__right { justify-content: flex-end; }
.rule { width: 1px; height: 18px; background: var(--ui-hair); }
.kicker {
  font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--ui-muted); white-space: nowrap;
}
.wordmark {
  font-family: var(--ui-display); font-size: 21px; letter-spacing: -.01em; text-decoration: none; color: var(--ui-fg);
  display: inline-flex; align-items: baseline;
}
.wordmark__v { color: var(--ui-accent); font-style: italic; }
.wordmark__rest { opacity: .9; }

.iconbtn {
  display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; flex: 0 0 auto;
  background: none; border: 0; padding: 0; cursor: pointer; color: var(--ui-muted);
  transition: color .15s var(--ease);
}
.iconbtn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.iconbtn:hover { color: var(--ui-fg); }

.typebtn {
  display: inline-flex; align-items: baseline; gap: 7px; height: 30px; padding: 0 2px 0 10px;
  background: none; border: 0; border-bottom: 1px solid transparent; cursor: pointer;
  color: var(--ui-muted); transition: .15s var(--ease);
}
.typebtn:hover, .typebtn[aria-expanded="true"] { color: var(--ui-fg); border-bottom-color: var(--ui-accent); }
.typebtn__aa { font-family: var(--ui-display); font-size: 17px; line-height: 1; }
.typebtn__label { font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--ui-muted); }

.topbar__search { position: relative; }
#searchform, .home__search { display: flex; align-items: center; gap: 8px; }
#searchform {
  height: 32px; padding: 0 10px; border: 1px solid var(--ui-muted); border-radius: 2px;
  background: var(--rd-tint, transparent); transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
#searchform:focus-within {
  border-color: var(--ui-accent);
  box-shadow: 0 0 0 3px var(--ui-accent-glow, rgba(224,164,88,.14));
}
.searchicon { width: 15px; height: 15px; fill: none; stroke: var(--ui-muted); stroke-width: 1.7; stroke-linecap: round; flex: 0 0 auto; }
#q { flex: 1; min-width: 0; background: none; border: 0; outline: none; font-size: 13px; }
#q2 {
  flex: 1; min-width: 0; background: none; border: 0; outline: none;
  font-family: var(--ui-display); font-size: 21px; color: var(--ui-fg);
}
#q::placeholder, #q2::placeholder { color: var(--ui-muted); }
input[type="search"]::-webkit-search-decoration, input[type="search"]::-webkit-search-cancel-button { display: none; }

.suggest {
  position: absolute; top: calc(100% + 5px); left: 0; right: 0; z-index: 50; margin: 0; padding: 0;
  list-style: none; background: var(--ui-bg); border: 1px solid var(--ui-hair); border-radius: 0;
  box-shadow: 0 18px 40px -30px rgba(0,0,0,.55); max-height: 62vh; overflow: auto;
}
.suggest li {
  padding: 9px 12px; border-radius: 0; cursor: pointer; font-size: 13px;
  border-bottom: 1px solid var(--ui-hair);
}
.suggest li small { display: block; color: var(--ui-muted); font-size: 11px; margin-top: 2px; }
.suggest li[aria-selected="true"], .suggest li:hover { background: var(--ui-surface); }

/* ---------- scroller & progress ---------- */
.scroller { padding-top: var(--bar-h); min-height: 100vh; }
.progress { position: fixed; top: var(--bar-h); left: 0; right: 0; height: 2px; z-index: 39; background: transparent; }
.progress i { display: block; height: 100%; width: 0; background: var(--ui-accent); transition: width .1s linear; }
body:not(.has-progress) .progress { display: none; }

/* ---------- home ---------- */
.home { max-width: 760px; margin: 0 auto; padding: 12vh 24px 20vh; color: var(--rd-fg, var(--ui-fg)); }
.home__title {
  font-family: var(--ui-display); font-weight: 400; font-size: 46px; font-size: clamp(38px, 7vw, 74px); line-height: 1.02;
  letter-spacing: -.025em; margin: .5rem 0 1.2rem;
}
.home__title em { color: var(--ui-accent); }
.home__lede {
  font-family: var(--rd-body-font, 'Source Serif 4', Georgia, serif);
  font-size: 21px; line-height: 1.55; max-width: 34ch;
  color: var(--ui-fg); margin: 0 0 2rem;
}
.home__search { margin: 2.4rem 0 1.4rem; max-width: 520px; }
.home__search input {
  flex: 1; height: 52px; padding: 0 14px; background: var(--rd-tint, transparent);
  border: 1px solid var(--ui-muted); border-radius: 2px; outline: none;
  font-family: var(--ui-display); font-size: 19px; color: var(--ui-fg);
}
.home__search input::placeholder { color: var(--ui-muted); }
.home__search input:focus {
  border-color: var(--ui-accent);
  box-shadow: 0 0 0 3px var(--ui-accent-glow, rgba(224,164,88,.14));
}
.home__search button {
  height: 52px; padding: 0 20px; border: 1px solid var(--ui-accent); border-radius: 2px;
  cursor: pointer; background: none; color: var(--ui-accent);
  font-size: 10px; letter-spacing: .2em; text-transform: uppercase;
}
.home__picks { display: flex; flex-wrap: wrap; gap: 0 14px; margin-bottom: 1rem; }
.pick {
  padding: 3px 0; border: 0; border-radius: 0; background: none; cursor: pointer;
  font-family: var(--ui-display); font-size: 16px; color: var(--ui-fg);
  transition: color .15s var(--ease);
}
.pick:hover { color: var(--ui-accent); }
.pick--history { border-style: dashed; }
.home__hint { font-size: 11px; color: var(--ui-muted); letter-spacing: .04em; }
kbd {
  display: inline-block; padding: 1px 5px; margin: 0 1px; border: 1px solid var(--ui-hair);
  border-bottom-width: 2px; border-radius: 4px; font-size: 10px; background: var(--ui-surface);
}

/* ---------- contents rail ---------- */
.article-wrap { position: relative; }
.toc {
  position: fixed; top: calc(var(--bar-h) + 40px); left: 18px; width: 190px; max-height: 70vh; overflow: auto;
  font-size: 11px; line-height: 1.45; z-index: 20; padding-right: 8px;
}
body:not(.has-toc) .toc, .toc:empty { display: none; }
@media (max-width: 1180px) { .toc { display: none !important; } }
.toc a {
  display: block; padding: 4px 0 4px 10px; color: var(--ui-muted); text-decoration: none;
  border-left: 1px solid var(--ui-hair); transition: .15s var(--ease);
}
.toc a:hover { color: var(--ui-fg); border-color: var(--ui-accent); }
.toc a.is-active { color: var(--ui-fg); border-left-color: var(--ui-accent); }
.toc a[data-level="2"] { padding-left: 20px; opacity: .8; }
.toc__head { font-size: 9px; letter-spacing: .2em; text-transform: uppercase; color: var(--ui-muted); margin-bottom: 8px; }

/* ---------- status / errors ---------- */
.status { max-width: 640px; margin: 22vh auto; text-align: center; color: var(--rd-muted, var(--ui-muted)); font-size: 13px; }
.status h3 { font-family: var(--ui-display); font-size: 26px; color: var(--rd-fg, var(--ui-fg)); margin: 0 0 .4em; font-weight: 400; }
.status .results { text-align: left; margin-top: 2rem; }
.status .results button {
  display: block; width: 100%; text-align: left; padding: 12px 14px; margin-bottom: 6px; cursor: pointer;
  background: transparent; border: 1px solid var(--ui-hair); border-radius: 9px; color: var(--rd-fg, var(--ui-fg)); font-size: 13px;
}
.status .results button:hover { border-color: var(--ui-accent); }
.status .results small { display: block; color: var(--ui-muted); font-size: 11px; margin-top: 4px; }
.spinner {
  width: 16px; height: 16px; margin: 0 auto 14px; border: 1.5px solid var(--ui-hair);
  border-top-color: var(--ui-accent); border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- the type panel ---------- */
.panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: var(--panel-w); max-width: 92vw; z-index: 60;
  display: flex; flex-direction: column; background: var(--ui-bg);
  border-left: 1px solid var(--ui-hair); box-shadow: -24px 0 60px -50px rgba(0,0,0,.7);
  transform: translateX(101%); transition: transform .34s var(--ease);
}
body[data-panel="open"] .panel { transform: none; }
.panel__head {
  display: flex; align-items: center; justify-content: space-between; height: var(--bar-h);
  padding: 0 10px 0 18px; border-bottom: 1px solid var(--ui-hair); flex: 0 0 auto;
}
.panel__head h2 { font-family: var(--ui-display); font-weight: 400; font-size: 18px; margin: 0; letter-spacing: -.01em; }
.panel__tabs {
  display: flex; gap: 0 18px; padding: 10px 18px 0; border-bottom: 1px solid var(--ui-hair);
  flex: 0 0 auto; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.panel__tabs::-webkit-scrollbar { display: none; }
.panel__tabs button { white-space: nowrap; }
.panel__tabs button {
  padding: 0 0 9px; border: 0; border-bottom: 2px solid transparent; border-radius: 0;
  background: none; cursor: pointer; font-size: 10px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--ui-muted); margin-bottom: -1px;
}
.panel__tabs button:hover { color: var(--ui-fg); }
.panel__tabs button.is-active {
  color: var(--ui-fg); border-bottom-color: var(--ui-accent); background: none;
}
.panel__body { flex: 1; overflow-y: auto; padding: 6px 18px 24px; scrollbar-width: thin; }
.panel__foot { flex: 0 0 auto; border-top: 1px solid var(--ui-hair); padding: 10px 14px; display: grid; gap: 8px; }

.group { padding: 14px 0 4px; }
.group + .group { border-top: 1px solid var(--ui-hair); }
.group__title { font-size: 9px; letter-spacing: .22em; text-transform: uppercase; color: var(--ui-accent); margin: 0 0 12px; }

.ctl { margin-bottom: 15px; }
.ctl[hidden] { display: none; }
.ctl__top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 5px; }
.ctl__label { font-size: 11.5px; letter-spacing: .01em; color: var(--ui-fg); }
.ctl__val { font-size: 10px; color: var(--ui-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ctl__hint { font-size: 10px; line-height: 1.45; color: var(--ui-muted); margin: 5px 0 0; opacity: .85; }

input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: none; cursor: pointer;
  touch-action: pan-y;
}
input[type="range"]::-webkit-slider-runnable-track { height: 2px; background: var(--ui-hair); border-radius: 2px; }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px; margin-top: -7px; border-radius: 50%;
  background: var(--ui-bg); border: 1.5px solid var(--ui-accent); transition: .12s var(--ease);
}
input[type="range"]::-moz-range-track { height: 2px; background: var(--ui-hair); }
input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%; background: var(--ui-bg); border: 1.5px solid var(--ui-accent);
}
input[type="range"]:hover::-webkit-slider-thumb { transform: scale(1.18); }
input[type="range"]:active::-webkit-slider-thumb { background: var(--ui-accent); }

/* Touch: a 13px dot is a thumbnail's worth of target. On any coarse pointer
   the grips grow to roughly Apple's 44pt guidance, and the rows get the room
   to match. */
@media (pointer: coarse) {
  input[type="range"] { height: 44px; }
  input[type="range"]::-webkit-slider-runnable-track { height: 3px; }
  input[type="range"]::-webkit-slider-thumb {
    width: 30px; height: 30px; margin-top: -13.5px; border-width: 2px;
    box-shadow: 0 2px 8px -2px rgba(0,0,0,.5);
  }
  input[type="range"]::-moz-range-thumb { width: 30px; height: 30px; border-width: 2px; }
  input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.12); }

  .ctl { margin-bottom: 20px; }
  .ctl__label { font-size: 13px; }
  .ctl__val { font-size: 12px; }
  .chip { width: 34px; height: 34px; }
  .swatchrow { gap: 8px; }
  .seg button { padding: 11px 4px; font-size: 12px; }
  .switch { width: 52px; height: 30px; }
  .switch::after { width: 22px; height: 22px; }
  .switch[aria-checked="true"]::after { left: 26px; }
  select, .ctl input[type="text"] { height: 42px; font-size: 15px; }
  .swatch input[type="color"] { width: 46px; height: 34px; }
  .panel__tabs button { padding: 9px 11px; font-size: 11px; }
  .ghost { padding: 11px 8px; }
  .presets select { height: 42px; }
}

select, .ctl input[type="text"] {
  width: 100%; height: 30px; padding: 0 18px 0 0; border: 0;
  border-bottom: 1px solid var(--ui-hair); border-radius: 0; background: none;
  outline: none; font-family: var(--ui-display); font-size: 15px; cursor: pointer;
  -webkit-appearance: none; appearance: none;
}
select:focus { border-bottom-color: var(--ui-accent); }

.seg { display: flex; flex-wrap: wrap; gap: 0; padding: 0; border: 0; background: none; }
.seg button {
  flex: 0 0 auto; padding: 2px 0; border: 0; border-radius: 0; background: none; cursor: pointer;
  font-size: 12px; color: var(--ui-muted); letter-spacing: .01em;
}
.seg button.is-active { background: none; color: var(--ui-accent); }

.swatch { display: flex; align-items: center; gap: 9px; }
.swatch input[type="color"] {
  -webkit-appearance: none; appearance: none; width: 30px; height: 22px; padding: 0; cursor: pointer;
  border: 1px solid var(--ui-hair); border-radius: 0; background: none;
}
.swatch input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; }
.swatch input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 4px; }
.swatch code { font-size: 10.5px; color: var(--ui-muted); text-transform: uppercase; }

.swatchrow { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.chip {
  width: 20px; height: 20px; padding: 0; border-radius: 0; cursor: pointer;
  border: 1px solid var(--ui-hair); transition: transform .12s var(--ease);
}
.chip:hover { transform: scale(1.16); }
.chip.is-active { box-shadow: 0 0 0 1px var(--ui-bg), 0 0 0 2px var(--ui-accent); }


.fontpreview { font-size: 15px; margin-top: 6px; color: var(--ui-muted); line-height: 1.3; }

.presets { display: grid; grid-template-columns: 1fr auto auto; gap: 0 14px; align-items: end; }
.footrow { display: flex; gap: 6px; }
.ghost {
  flex: 1; padding: 8px 0; border: 0; border-top: 1px solid var(--ui-hair); border-radius: 0;
  background: none; cursor: pointer; font-size: 10px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--ui-muted);
}
.ghost:hover { color: var(--ui-fg); }
.ghost.danger:hover { border-color: #c0553f; color: #e08a76; }

.scrim { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 55; background: rgba(0,0,0,.28); backdrop-filter: blur(1px); }

@media (max-width: 900px) {
  .topbar { grid-template-columns: auto 1fr auto; }
  .topbar .kicker, .rule, .typebtn__label { display: none; }
  .home { padding-top: 8vh; }
}

/* ---------- phones ---------- */
@media (max-width: 700px) {
  :root { --bar-h: 50px; --panel-w: 100vw; }
  /* `1fr` will not shrink below its content, which lets the search field
     push the buttons off the bar; minmax(0, 1fr) lets it give way. */
  .topbar { grid-template-columns: auto minmax(0, 1fr) auto; padding: 0 8px; gap: 6px; }
  .topbar__search { min-width: 0; }
  .wordmark__rest { display: none; }          /* the V alone carries it */
  .wordmark { font-size: 24px; }
  .topbar__left, .topbar__right { gap: 2px; }
  .iconbtn { width: 32px; height: 32px; }
  #searchform { height: 32px; padding: 0 10px; }
  #q { font-size: 16px; }                     /* 16px stops iOS zooming on focus */
  .typebtn { padding: 0 9px; }
  .suggest { max-height: 50vh; }

  .home { padding: 6vh 18px 14vh; }
  .stylecard { flex: 1 1 calc(50% - 5px); min-width: 0; padding: 10px; }
  .stylecard__swatch { height: 40px; }
  .home__title { font-size: 34px; font-size: clamp(30px, 9vw, 44px); }
  .home__lede { font-size: 18px; max-width: none; }
  .home__search { flex-wrap: wrap; }
  .home__search input { min-width: 60%; font-size: 16px; }

  .panel { border-left: 0; }
  .panel__body { padding: 6px 16px 24px; }
}

/* Home-screen (standalone) launches have no browser chrome, so the bar clears
   the status bar itself. Applied unconditionally: env() is 0 in a normal tab,
   and the display-mode query is unreliable on older iOS. */
.topbar { height: calc(var(--bar-h) + env(safe-area-inset-top)); padding-top: env(safe-area-inset-top); }
.scroller { padding-top: calc(var(--bar-h) + env(safe-area-inset-top)); }
.progress { top: calc(var(--bar-h) + env(safe-area-inset-top)); }
.panel__head { height: calc(var(--bar-h) + env(safe-area-inset-top)); padding-top: env(safe-area-inset-top); }

/* Safari gained flexbox `gap` and `inset` in the same release (14.1), so the
   absence of `inset` is a reliable stand-in for "no flex gap here". Older
   iPhones get margins instead, or every control in a row would touch. */
@supports not (inset: 0) {
  .topbar__left > * + *, .topbar__right > * + * { margin-left: 8px; }
  #searchform > * + *, .home__search > * + *, .typebtn > * + * { margin-left: 8px; }
  .home__picks > * { margin: 0 8px 8px 0; }
  .swatchrow > * { margin: 0 6px 6px 0; }
  .seg > * + * { margin-left: 3px; }
  .footrow > * + * { margin-left: 6px; }
  .panel__tabs > * { margin: 0 2px 2px 0; }
}
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- reading styles ---------- */
.home__h {
  font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: var(--ui-accent);
  margin: 0 0 12px; font-weight: 600; font-family: var(--ui-font);
}
.home__styles, .home__start { margin: 2.6rem 0; }
.linkish {
  background: none; border: 0; padding: 0; cursor: pointer; font-size: 12px;
  color: var(--ui-accent); font-family: var(--ui-font);
}
.linkish:hover { text-decoration: underline; }
.pick--random { border-style: dashed; margin-top: 4px; }

/* styles inside the panel */
.group__lead { font-size: 11px; line-height: 1.5; color: var(--ui-muted); margin: 0 0 12px; }

/* ---------- chrome that gets out of the way ---------- */
.topbar { transition: transform .25s var(--ease), background .3s var(--ease); }
body.bar-hidden .topbar { transform: translateY(-100%); }
body.bar-hidden .progress { opacity: 0; }
body.on-home .topbar__search { display: none; }
body.on-home .topbar { grid-template-columns: 1fr auto; }

/* ============================================================
   Art direction: the interface is set, not assembled.
   Rules and typography carry the hierarchy; almost nothing is
   put inside a box, because a page doesn't outline its ideas.
   ============================================================ */

/* ---- toggles read as words ---- */
.flag {
  background: none; border: 0; padding: 2px 0; cursor: pointer;
  font-family: var(--ui-font); font-size: 11px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--ui-muted); transition: color .15s var(--ease);
}
.flag[aria-checked="true"] { color: var(--ui-accent); }
.ctl--switch .ctl__top { margin-bottom: 0; align-items: baseline; }
.ctl--switch { border-bottom: 1px solid var(--ui-hair); padding-bottom: 9px; }

/* ---- control rows ---- */
.ctl { margin-bottom: 17px; }
.ctl__label { font-size: 13px; font-family: var(--ui-display); letter-spacing: 0; color: var(--ui-fg); }
.ctl__val {
  font-size: 10.5px; color: var(--ui-muted); font-variant-numeric: tabular-nums;
  letter-spacing: .04em;
}
.ctl__hint { font-size: 10.5px; line-height: 1.5; color: var(--ui-muted); margin: 6px 0 0; }
.group { padding: 18px 0 6px; }
.group__title {
  font-size: 9px; letter-spacing: .24em; text-transform: uppercase;
  color: var(--ui-muted); margin: 0 0 16px; padding-bottom: 8px;
  border-bottom: 1px solid var(--ui-hair);
}
.group__lead { font-size: 12px; line-height: 1.55; color: var(--ui-muted); margin: 0 0 16px; font-family: var(--ui-display); }
.fontpreview { font-size: 17px; margin-top: 8px; color: var(--ui-muted); line-height: 1.25; }

/* ---- reading styles: a contents list ---- */
.styles { display: block; margin-bottom: 22px; }
.styles__head {
  font-size: 9px; letter-spacing: .24em; text-transform: uppercase; color: var(--ui-accent);
  margin: 16px 0 8px;
}
.styles__head:first-child { margin-top: 0; }
.style {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  width: 100%; text-align: left; padding: 7px 0; cursor: pointer;
  background: none; border: 0; border-bottom: 1px solid var(--ui-hair); color: var(--ui-fg);
}
.style__name { font-family: var(--ui-display); font-size: 15px; }
.style__blurb { font-size: 10.5px; color: var(--ui-muted); text-align: right; }
.style:hover .style__name { color: var(--ui-accent); }
.style.is-active { background: none; }
.style.is-active .style__name { color: var(--ui-accent); }
.style.is-active .style__name::before { content: '— '; }

/* ---- home: three miniature pages ---- */
.stylecards { display: flex; flex-wrap: wrap; gap: 22px; margin-bottom: 18px; }
.stylecard {
  flex: 0 0 auto; text-align: left; cursor: pointer; padding: 0;
  background: none; border: 0; display: flex; flex-direction: column; gap: 9px;
}
.minipage {
  display: block; width: 178px; height: 236px; padding: 16px 14px; overflow: hidden;
  border: 1px solid var(--ui-hair);
  box-shadow: 0 12px 28px -22px rgba(0,0,0,.5);
  transition: transform .18s var(--ease), box-shadow .18s var(--ease);
}
.stylecard:hover .minipage { transform: translateY(-2px); box-shadow: 0 16px 30px -20px rgba(0,0,0,.6); }
.minipage__h { display: block; font-size: 17px; line-height: 1.1; margin-bottom: 8px; }
.minipage__body {
  display: block; font-size: 6.4px; letter-spacing: .01em;
  -webkit-hyphens: auto; hyphens: auto;
}
.stylecard__name {
  font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: var(--ui-muted);
}
.stylecard:hover .stylecard__name { color: var(--ui-fg); }

/* ---- home rhythm ---- */
.home__h {
  font-size: 9px; letter-spacing: .24em; text-transform: uppercase; color: var(--ui-muted);
  margin: 0 0 16px; font-weight: 400; padding-bottom: 7px; border-bottom: 1px solid var(--ui-hair);
}
.home__styles, .home__start { margin: 3rem 0; }
.linkish {
  background: none; border: 0; padding: 0; cursor: pointer; font-size: 11px;
  letter-spacing: .14em; text-transform: uppercase; color: var(--ui-accent); font-family: var(--ui-font);
}
.pick--random {
  font-family: var(--ui-font); font-size: 11px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--ui-muted); margin-top: 10px;
}
.pick--history::after { content: ' ·'; color: var(--ui-hair); }

@media (pointer: coarse) {
  .chip { width: 30px; height: 30px; }
  .swatchrow { gap: 6px; }
  .seg { gap: 0 14px; }
  .seg button { padding: 8px 0; font-size: 13px; }
  .flag { font-size: 13px; padding: 8px 0; }
  .style { padding: 11px 0; }
  select, .ctl input[type="text"] { height: 40px; font-size: 16px; }
}

/* ---- the library ---- */
.resume {
  display: flex; align-items: baseline; justify-content: space-between; gap: 14px;
  width: 100%; text-align: left; padding: 10px 0; cursor: pointer;
  background: none; border: 0; border-bottom: 1px solid var(--ui-hair); color: var(--ui-fg);
}
.resume__title { font-family: var(--ui-display); font-size: 19px; }
.resume__note { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--ui-muted); }
.resume:hover .resume__title { color: var(--ui-accent); }

.collection { margin-bottom: 22px; }
.collection__head {
  display: flex; align-items: baseline; gap: 10px;
  padding-bottom: 6px; border-bottom: 1px solid var(--ui-hair); margin-bottom: 4px;
}
.collection__name { font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: var(--ui-accent); }
.collection__count { font-size: 10px; color: var(--ui-muted); font-variant-numeric: tabular-nums; }
.collection__del {
  margin-left: auto; background: none; border: 0; cursor: pointer; opacity: 0;
  font-size: 9px; letter-spacing: .16em; text-transform: uppercase; color: var(--ui-muted);
  transition: opacity .15s var(--ease);
}
.collection:hover .collection__del { opacity: 1; }
.collection__del:hover { color: #c0553f; }
.collection__row { display: flex; align-items: baseline; gap: 8px; }
.collection__item {
  flex: 1; text-align: left; padding: 5px 0; background: none; border: 0; cursor: pointer;
  font-family: var(--ui-display); font-size: 16px; color: var(--ui-fg);
}
.collection__item:hover { color: var(--ui-accent); }
.collection__drop {
  background: none; border: 0; cursor: pointer; color: var(--ui-hair); font-size: 15px; padding: 0 2px;
}
.collection__drop:hover { color: #c0553f; }
.collection__empty { font-size: 12px; color: var(--ui-muted); font-style: italic; margin: 6px 0 0; }

#btn-save.is-saved { color: var(--ui-accent); }
#btn-save.is-saved svg { fill: currentColor; }

.popover {
  position: fixed; z-index: 70; min-width: 190px; padding: 4px 0;
  background: var(--ui-bg); border: 1px solid var(--ui-hair);
  box-shadow: 0 18px 40px -28px rgba(0,0,0,.6);
}
.popover button {
  display: block; width: 100%; text-align: left; padding: 9px 14px; background: none; border: 0;
  cursor: pointer; font-family: var(--ui-display); font-size: 14px; color: var(--ui-fg);
}
.popover button:hover { color: var(--ui-accent); }
.popover__new {
  border-top: 1px solid var(--ui-hair) !important; font-size: 11px !important;
  letter-spacing: .14em; text-transform: uppercase; color: var(--ui-muted) !important;
  font-family: var(--ui-font) !important;
}

/* the home field's magnifier sits inside the box with the input */
.home__search { position: relative; }
.searchicon--home {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 17px; height: 17px; z-index: 1; pointer-events: none;
}
.home__search input { padding-left: 40px; }
@media (max-width: 700px) {
  .home__search input { height: 48px; font-size: 16px; }
  .home__search button { height: 48px; padding: 0 14px; }
}

.home__legal {
  font-size: 11px; line-height: 1.6; color: var(--ui-muted); margin: 2.5rem 0 1rem;
  max-width: 60ch;
}
.home__legal a { color: var(--ui-accent); text-decoration: none; }
.home__legal a:hover { text-decoration: underline; }

/* ---- landing: use the width ------------------------------------------
   A 760px column in a 1280px window left half the screen empty. On a wide
   viewport the hero and the page previews sit side by side, which fills the
   space and puts the three specimens next to the sentence describing them. */
@media (min-width: 1040px) {
  .home { max-width: 1120px; padding-top: 9vh; }
  .home__top {
    display: grid; grid-template-columns: minmax(0, 1fr) auto;
    gap: 64px; align-items: start;
  }
  .home__styles { margin: 0; }
  .home__styles .home__h { margin-top: 0; }
  .stylecards { gap: 18px; }
  .home__search { max-width: 560px; }
  .home__start, .home__library, .home__resume { max-width: 720px; }
}

/* Small caps labels were at 9px, which is decorative rather than legible. */
.home__h, .group__title, .styles__head, .collection__name {
  font-size: 10.5px; letter-spacing: .2em;
}
.stylecard__name { font-size: 10.5px; }
.home__legal { font-size: 12px; color: var(--ui-muted); }
.home__hint { font-size: 12px; }
.kicker { font-size: 10.5px; }

/* On a phone the bigger specimens must still sit two to a row, or the landing
   becomes a column of three tall cards. */
@media (max-width: 700px) {
  .stylecards { gap: 12px; }
  .stylecard { flex: 0 0 calc(50% - 6px); }
  .minipage { width: 100%; height: 176px; padding: 13px 11px; }
  .minipage__h { font-size: 15px; }
  .minipage__body { font-size: 5.8px; }

  /* The button was eating the field, clipping the placeholder mid-word. */
  .home__search { flex-wrap: wrap; gap: 10px; }
  .home__search input { flex: 1 1 100%; }
  .home__search button { flex: 0 0 auto; padding: 0 26px; }
}

/* ---- density and legibility -------------------------------------------
   Small caps at 9-10px are decorative, not readable, and the landing had
   more air than content. Sizes up, gaps down. */
.home__h, .group__title, .styles__head, .collection__name, .kicker,
.stylecard__name, .typebtn__label { font-size: 11px; letter-spacing: .18em; }
.home__hint, .home__legal { font-size: 12.5px; line-height: 1.65; }
.pick { font-size: 17px; }
.home__picks { gap: 2px 18px; }
.resume__title { font-size: 20px; }
.collection__item { font-size: 17px; }
.ctl__label { font-size: 14px; }
.ctl__val { font-size: 11.5px; }
.ctl__hint { font-size: 11.5px; }
.style__name { font-size: 16px; }
.style__blurb { font-size: 11.5px; }
.suggest li { font-size: 14px; }

/* Tighter vertical rhythm — the sections were floating apart. */
.home { padding-top: 7vh; padding-bottom: 12vh; }
.home__styles, .home__start, .home__library, .home__resume { margin: 2.2rem 0; }
.home__title { margin: .4rem 0 1rem; }
.home__search { margin: 1.8rem 0 0; }

/* ---- colophon: a person behind it -------------------------------------- */
.colophon {
  margin-top: 2.4rem; padding-top: 1.1rem; border-top: 1px solid var(--ui-hair);
  font-size: 12.5px; line-height: 1.7; color: var(--ui-muted); max-width: 62ch;
}
.colophon strong { color: var(--ui-fg); font-weight: 400; font-family: var(--ui-display); font-size: 15px; }
.colophon a { color: var(--ui-accent); }
