/* ---------------------------------------------------------------------------
   All The Tools — stylesheet
   Colour tokens live on :root and are redefined for dark mode. A manual
   override is applied through data-theme on <html>.
   ------------------------------------------------------------------------ */

:root {
  --bg:          #f6f7fb;
  --bg-elev:     #ffffff;
  --bg-sunken:   #eef0f7;
  --fg:          #14161f;
  --fg-muted:    #5d6478;
  --border:      #dcdfea;
  --border-soft: #e007;
  --accent:      #4f46e5;
  --accent-weak: #eceafd;
  --accent-fg:   #ffffff;
  --ok:          #157f4a;
  --warn:        #9a6200;
  --err:         #b3261e;
  --err-weak:    #fdeceb;

  --radius:   10px;
  --radius-s: 6px;
  --shadow:   0 1px 2px rgb(20 22 31 / 6%), 0 8px 24px rgb(20 22 31 / 6%);
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:          #0e1016;
    --bg-elev:     #171a23;
    --bg-sunken:   #0a0c11;
    --fg:          #e8eaf2;
    --fg-muted:    #9aa2b8;
    --border:      #2a2f3d;
    --accent:      #8b84ff;
    --accent-weak: #22203a;
    --accent-fg:   #14121f;
    --ok:          #4ad295;
    --warn:        #e0a94a;
    --err:         #ff8a80;
    --err-weak:    #35191a;
    --shadow:      0 1px 2px rgb(0 0 0 / 40%), 0 8px 24px rgb(0 0 0 / 30%);
  }
}

:root[data-theme="dark"] {
  --bg:          #0e1016;
  --bg-elev:     #171a23;
  --bg-sunken:   #0a0c11;
  --fg:          #e8eaf2;
  --fg-muted:    #9aa2b8;
  --border:      #2a2f3d;
  --accent:      #8b84ff;
  --accent-weak: #22203a;
  --accent-fg:   #14121f;
  --ok:          #4ad295;
  --warn:        #e0a94a;
  --err:         #ff8a80;
  --err-weak:    #35191a;
  --shadow:      0 1px 2px rgb(0 0 0 / 40%), 0 8px 24px rgb(0 0 0 / 30%);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--accent); }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--accent); color: var(--accent-fg);
  padding: 10px 16px; border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { left: 0; }

/* --- top bar ------------------------------------------------------------ */

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 16px;
  padding: 10px 16px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex; align-items: center; gap: 10px;
  color: var(--accent);
  font-weight: 650; font-size: 16px;
  text-decoration: none; white-space: nowrap;
}
.brand span { color: var(--fg); }

.search-trigger {
  flex: 1; min-width: 0; max-width: 560px; margin: 0 auto;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px 8px 14px;
  font: inherit; text-align: left;
  color: var(--fg-muted);
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
}
.search-trigger:hover { border-color: var(--accent); color: var(--fg); }
.search-trigger:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.search-trigger svg { width: 17px; height: 17px; flex: none; }
.search-trigger span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

kbd {
  padding: 2px 6px;
  font: 600 11px/1.4 var(--sans);
  color: var(--fg-muted);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 5px;
  white-space: nowrap;
}

.topbar-actions { display: flex; gap: 6px; }

.icon-btn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  font-size: 17px; line-height: 1;
  color: var(--fg);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  cursor: pointer;
}
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn:hover { background: var(--bg-sunken); }
.menu-only { display: none; }

/* --- category colour ----------------------------------------------------
   Each category hands these elements a hue (--cat-h) and a lightness for
   each theme (--cat-l / --cat-ld) as inline custom properties. The derived
   colours have to be declared on the same elements, because a custom
   property substitutes var() where it is *declared*, not where it is used.
   ------------------------------------------------------------------------ */

.tool-card-wrap, .feature-card, .cat-head, .tool-head, .palette-row, .sidebar a, .section-icon, .head-icon, .change-tools .pill, .pick, .sec-cat, .daily, .recipe-step {
  --cat-h: 250;
  --cat-l: 50%;
  --cat-ld: 74%;
  --cat:      hsl(var(--cat-h) 62% var(--cat-l));
  --cat-soft: hsl(var(--cat-h) 76% 96%);
  --cat-line: hsl(var(--cat-h) 48% 85%);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) :is(.tool-card-wrap, .feature-card, .cat-head, .tool-head, .palette-row, .sidebar a, .section-icon, .head-icon, .change-tools .pill, .pick, .sec-cat, .daily, .recipe-step) {
    --cat:      hsl(var(--cat-h) 70% var(--cat-ld));
    --cat-soft: hsl(var(--cat-h) 38% 16%);
    --cat-line: hsl(var(--cat-h) 26% 30%);
  }
}

:root[data-theme="dark"] :is(.tool-card-wrap, .feature-card, .cat-head, .tool-head, .palette-row, .sidebar a, .section-icon, .head-icon, .change-tools .pill, .pick, .sec-cat, .daily, .recipe-step) {
  --cat:      hsl(var(--cat-h) 70% var(--cat-ld));
  --cat-soft: hsl(var(--cat-h) 38% 16%);
  --cat-line: hsl(var(--cat-h) 26% 30%);
}

/* --- layout ------------------------------------------------------------- */

.layout {
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  /* The sidebar spans both rows; the flexible second row soaks up its extra
     height so the related-tools strip sits right under the tool. */
  grid-template-rows: auto 1fr;
  gap: 0 24px;
  max-width: 1320px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.sidebar { position: sticky; top: 74px; align-self: start; grid-row: span 2; max-height: calc(100vh - 96px); overflow-y: auto; }

.sidebar h2 {
  margin: 18px 0 8px;
  font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--fg-muted);
}

.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group[hidden] { display: none; }

/* The six sections: rows like the links, opening one at a time. */
.nav-heading { margin: 18px 0 6px 6px; }
.nav-block + .nav-block { margin-top: 2px; }
.nav-section {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 6px 8px 6px 6px;
  font: inherit; font-weight: 600; color: var(--fg); text-align: left;
  background: none; border: 0; border-radius: var(--radius-s); cursor: pointer;
}
.nav-section:hover { background: var(--bg-sunken); }
.nav-section .nav-icon { color: var(--fg-muted); background: var(--bg-sunken); }
.nav-section[aria-expanded="true"] .nav-icon { color: var(--accent); background: var(--accent-weak); }
.nav-section > svg { width: 14px; height: 14px; flex: none; color: var(--fg-muted); transition: transform .15s; }
.nav-section[aria-expanded="false"] > svg { transform: rotate(-90deg); }
.nav-sub { margin: 2px 0 8px 14px; padding-left: 8px; border-left: 1px solid var(--border); }
.nav-sub a { padding-top: 5px; padding-bottom: 5px; font-size: 14px; }
.nav-sub .nav-icon { width: 22px; height: 22px; border-radius: 6px; }
.nav-sub .nav-icon svg { width: 14px; height: 14px; }

.sidebar a {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px 6px 6px;
  border-radius: var(--radius-s);
  color: var(--fg);
  text-decoration: none;
}
.sidebar a:hover { background: var(--bg-sunken); }
.sidebar a.current { background: var(--cat-soft); color: var(--cat); font-weight: 600; }

.nav-icon {
  flex: none;
  width: 26px; height: 26px;
  display: grid; place-items: center;
  color: var(--cat);
  background: var(--cat-soft);
  border-radius: 7px;
}
.nav-icon svg { width: 16px; height: 16px; }
.sidebar a.current .nav-icon { color: var(--accent-fg); background: var(--cat); }

.nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar .count { flex: none; font-size: 12px; color: var(--fg-muted); font-variant-numeric: tabular-nums; }
.sidebar a.current .count { color: inherit; }

.view:focus { outline: none; }

/* --- headings ----------------------------------------------------------- */

.page-head { margin-bottom: 20px; }
.page-head h1 { display: flex; align-items: center; gap: 12px; margin: 0 0 4px; font-size: 26px; letter-spacing: -.01em; }
.page-head p { margin: 0; color: var(--fg-muted); max-width: 70ch; }

.head-icon {
  flex: none;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  color: var(--cat);
  background: var(--cat-soft);
  border: 1px solid var(--cat-line);
  border-radius: 11px;
}
.head-icon svg { width: 22px; height: 22px; }
.head-icon.big { width: 48px; height: 48px; border-radius: 13px; }
.head-icon.big svg { width: 26px; height: 26px; }

.cat-head {
  padding: 18px 20px;
  background: var(--cat-soft);
  border: 1px solid var(--cat-line);
  border-radius: var(--radius);
}
.cat-head h1 { color: var(--cat); }
.cat-head .head-icon { background: var(--bg-elev); }
.cat-head-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 14px; }

.tool-head {
  display: flex; align-items: flex-start; gap: 14px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.tool-head-text { flex: 1; min-width: 0; }
.tool-head h1 { display: block; }

.filter-box {
  flex: 1; min-width: 180px; max-width: 320px;
  padding: 7px 12px;
  font: inherit; color: var(--fg);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.filter-box:focus { outline: 2px solid var(--cat, var(--accent)); outline-offset: 1px; }

.pill {
  padding: 4px 10px;
  font-size: 12px; font-weight: 600;
  color: var(--cat, var(--fg-muted));
  background: var(--bg-elev);
  border: 1px solid var(--cat-line, var(--border));
  border-radius: 999px;
}

.crumbs { margin: 0 0 10px; font-size: 13px; color: var(--fg-muted); }
.crumbs a { text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }

.section-title {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 30px 0 12px;
}
.section-title h2 { display: flex; align-items: center; gap: 9px; margin: 0; font-size: 17px; }
.section-title a, .link-btn { font-size: 13px; text-decoration: none; }

.section-icon {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  color: var(--cat); background: var(--cat-soft);
  border-radius: 7px;
}
.section-icon svg { width: 16px; height: 16px; }

.link-btn {
  padding: 0; font-family: inherit;
  color: var(--accent); background: none; border: 0; cursor: pointer;
}
.link-btn:hover { text-decoration: underline; }

/* --- home --------------------------------------------------------------- */

.hero { margin-bottom: 4px; }
.hero h1 { margin: 0 0 6px; font-size: 30px; letter-spacing: -.02em; }
.hero p { margin: 0; max-width: 68ch; color: var(--fg-muted); }

.hero-search {
  display: flex; align-items: center; gap: 10px;
  margin-top: 16px; padding: 11px 14px;
  width: min(100%, 420px);
  font: inherit; color: var(--fg);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow);
  cursor: pointer;
}
.hero-search:hover { border-color: var(--accent); }
.hero-search svg { width: 18px; height: 18px; color: var(--accent); }
.hero-search span { flex: 1; text-align: left; }

/* The intake box: search, paste or drop. */
.intake { margin-top: 18px; max-width: 780px; }
.intake-box {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 8px 8px 8px 16px;
  background: var(--bg-elev);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  cursor: text;
  transition: border-color .12s, box-shadow .12s, background .12s;
}
.intake-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-weak), var(--shadow); }
.intake.over .intake-box { border-style: dashed; border-color: var(--accent); background: var(--accent-weak); }
.intake-box > svg { flex: none; width: 20px; height: 20px; margin-top: 10px; color: var(--accent); }
.intake-input,
.intake-input:focus {
  flex: 1; width: auto; min-width: 0; min-height: 0; height: 40px; max-height: 140px;
  padding: 8px 0; resize: none; box-shadow: none;
  font: inherit; font-size: 16px; line-height: 1.5; color: var(--fg);
  background: transparent; border: 0; outline: 0;
}
.intake-choose { flex: none; display: inline-flex; align-items: center; gap: 7px; }
.intake-choose svg { width: 16px; height: 16px; }
.intake-results {
  margin-top: 10px; padding: 14px 16px 16px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 14px;
}
.intake-label { margin: 14px 0 8px; font-size: 13px; color: var(--fg-muted); }
.intake-label:first-child { margin-top: 0; }
.intake-label strong { color: var(--fg); }
.intake-more { display: inline-block; margin-top: 12px; font-size: 13px; text-decoration: none; }
.intake-file { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-size: 15px; }
.intake-file-icon {
  flex: none; width: 32px; height: 32px; display: grid; place-items: center;
  color: var(--accent); background: var(--accent-weak); border-radius: 9px;
}
.intake-file-icon svg { width: 18px; height: 18px; }
.intake-file-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }

/* Small tool links, used for intake suggestions and recipe steps. */
.picks { display: flex; flex-wrap: wrap; gap: 8px; }
.pick {
  display: inline-flex; align-items: center; gap: 8px; max-width: 100%;
  padding: 6px 12px 6px 6px; font-size: 13.5px;
  color: var(--fg); text-decoration: none;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 999px;
}
.pick:hover { border-color: var(--cat); background: var(--cat-soft); }
.pick-icon {
  flex: none; width: 24px; height: 24px; display: grid; place-items: center;
  color: var(--cat); background: var(--cat-soft); border-radius: 999px;
}
.pick-icon svg { width: 14px; height: 14px; }
.picks.quiet .pick { font-size: 12.5px; color: var(--fg-muted); }
/* An all-in-one editor offered for a dropped file: its name over a line
   saying what it can do with the file. */
.pick-suite { padding: 7px 16px 7px 7px; border-radius: 22px; }
.pick-suite .pick-icon { width: 32px; height: 32px; }
.pick-suite .pick-icon svg { width: 18px; height: 18px; }
.pick-suite .pick-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.pick-suite strong { font-weight: 600; }
.pick-suite small { font-size: 12px; color: var(--fg-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-more { padding-left: 12px; font: inherit; font-size: 13px; color: var(--accent); cursor: pointer; }
.pick-more:hover { border-color: var(--accent); background: var(--accent-weak); }

/* "Show me tools for..." */
.modes { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; }
.modes-label { margin-right: 2px; font-size: 13px; font-weight: 600; color: var(--fg-muted); }
.mode-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px 7px 10px;
  font: inherit; font-size: 13.5px; color: var(--fg);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
}
.mode-chip svg { width: 16px; height: 16px; color: var(--fg-muted); }
.mode-chip:hover { border-color: var(--accent); }
.mode-chip.on { color: var(--accent); background: var(--accent-weak); border-color: var(--accent); font-weight: 600; }
.mode-chip.on svg { color: var(--accent); }
.modes-reset { margin-left: 4px; }

/* Tool of the day beside the recipes. */
.home-band {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2.1fr);
  gap: 18px; margin-top: 30px; align-items: stretch;
}
.home-band .section-title { margin-top: 0; }
.home-recipes > .note { margin: -6px 0 12px; }
.daily {
  display: flex; flex-direction: column; gap: 6px;
  padding: 18px;
  color: inherit; text-decoration: none;
  background: linear-gradient(160deg, var(--cat-soft), var(--bg-elev) 75%);
  border: 1px solid var(--cat-line);
  border-radius: 14px;
  transition: border-color .12s, transform .12s, box-shadow .12s;
}
.daily:hover { border-color: var(--cat); transform: translateY(-2px); box-shadow: var(--shadow); }
.daily-eyebrow {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--cat);
}
.daily-eyebrow svg { width: 15px; height: 15px; }
.daily-icon {
  width: 52px; height: 52px; margin: 8px 0 4px;
  display: grid; place-items: center;
  color: var(--cat); background: var(--bg-elev);
  border: 1px solid var(--cat-line);
  border-radius: 14px;
}
.daily-icon svg { width: 28px; height: 28px; }
.daily-name { font-size: 19px; line-height: 1.3; }
.daily-desc { font-size: 13.5px; color: var(--fg-muted); }
.daily-go { margin-top: auto; padding-top: 10px; font-size: 14px; font-weight: 600; color: var(--cat); }

/* Recipe cards. */
.recipe-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.recipe-grid.wide { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.recipe-card {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 13px 14px;
  color: inherit; text-decoration: none;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color .12s, transform .12s, box-shadow .12s;
}
.recipe-card:hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow); }
.recipe-card-icon {
  flex: none; width: 34px; height: 34px; display: grid; place-items: center;
  color: var(--accent); background: var(--accent-weak); border-radius: 9px;
}
.recipe-card-icon svg { width: 19px; height: 19px; }
.recipe-card-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.recipe-card-text strong { font-size: 14.5px; line-height: 1.35; }
.recipe-card-text span { font-size: 13px; color: var(--fg-muted); }
.recipe-card-steps { flex: none; font-size: 11.5px; font-weight: 600; color: var(--fg-muted); white-space: nowrap; }

/* A recipe's own page. */
.recipe-steps { display: grid; gap: 12px; max-width: 780px; margin: 8px 0 20px; padding: 0; list-style: none; }
.recipe-step {
  display: flex; gap: 14px; padding: 16px;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 12px;
}
.recipe-num {
  flex: none; width: 30px; height: 30px; display: grid; place-items: center;
  font-weight: 700; color: var(--cat); background: var(--cat-soft); border-radius: 999px;
}
.recipe-body { min-width: 0; }
.recipe-body strong { font-size: 15.5px; }
.recipe-body p { margin: 4px 0 10px; font-size: 14px; color: var(--fg-muted); }
a.btn { display: inline-block; text-decoration: none; }

/* The bar above a tool while a recipe is being followed. */
.recipe-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px;
  margin: 0 0 16px; padding: 12px 14px;
  background: var(--accent-weak);
  border: 1px solid var(--accent);
  border-radius: 12px;
}
.recipe-bar-text { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.recipe-bar-name {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; text-decoration: none;
}
.recipe-bar-name svg { width: 14px; height: 14px; }
.recipe-bar-hint { font-size: 13px; color: var(--fg-muted); }
.recipe-bar-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.recipe-bar .icon-btn { font-size: 20px; line-height: 1; }
.handoff-note { margin-bottom: 4px; }

/* Six section cards, each listing its categories. */
.sec-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.sec-card { padding: 14px 12px 10px; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 14px; }
.sec-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 0 6px 8px; }
.sec-card-head strong { font-size: 15px; }
.sec-card-head span { font-size: 12px; color: var(--fg-muted); }
.sec-card-cats { display: grid; }
.sec-card.wide .sec-card-cats { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); column-gap: 12px; }
.sec-cat {
  display: flex; align-items: center; gap: 10px;
  padding: 6px; border-radius: 8px;
  font-size: 14px; color: inherit; text-decoration: none;
}
.sec-cat:hover { background: var(--cat-soft); }
.sec-cat-name { flex: 1; min-width: 0; }
.sec-cat-count { font-size: 12px; color: var(--fg-muted); font-variant-numeric: tabular-nums; }
.more-cats { margin-top: 14px; }
.more-cats summary { padding: 10px 0; font-weight: 600; cursor: pointer; }
.more-cats summary span { margin-left: 8px; font-size: 12.5px; font-weight: 500; color: var(--fg-muted); }
.more-cats[open] summary { margin-bottom: 8px; }

/* Groups ("shelves") on a category page, with jump links above them. */
.shelf-jump { display: flex; flex-wrap: wrap; gap: 6px; margin: -6px 0 6px; }
.shelf-jump[hidden] { display: none; }
.shelf-jump .chip { font-size: 12.5px; padding: 4px 10px; cursor: pointer; border: 1px solid var(--border); }
.shelf-jump .chip span { margin-left: 6px; color: var(--fg-muted); font-variant-numeric: tabular-nums; }
.shelf-title {
  display: flex; align-items: baseline; gap: 8px;
  margin: 26px 0 10px; font-size: 16px; scroll-margin-top: 80px;
}
.shelf-title span { font-size: 12px; font-weight: 500; color: var(--fg-muted); }
.cat-tools > .shelf-title:first-child { margin-top: 12px; }

/* Related tools under a tool (a sibling of #view in the layout grid). */
.related { grid-column: 2; align-self: start; margin-top: 34px; padding-top: 18px; border-top: 1px solid var(--border); }
.related[hidden] { display: none; }
.related h2 { margin: 0 0 10px; font-size: 14px; font-weight: 700; color: var(--fg-muted); letter-spacing: .02em; }
.related-list { display: flex; flex-wrap: wrap; gap: 8px; }
.related-list a {
  --cat-h: 250; --cat-l: 50%; --cat-ld: 74%;
  --cat: hsl(var(--cat-h) 62% var(--cat-l)); --cat-soft: hsl(var(--cat-h) 76% 96%);
  display: inline-flex; align-items: center; gap: 8px; max-width: 100%;
  padding: 6px 12px 6px 6px; font-size: 13.5px;
  color: var(--fg); text-decoration: none;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 999px;
}
.related-list a:hover { border-color: var(--cat); }
.related-icon {
  flex: none; width: 24px; height: 24px; display: grid; place-items: center;
  color: var(--cat); background: var(--cat-soft); border-radius: 999px;
}
.related-icon svg { width: 14px; height: 14px; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .related-list a { --cat: hsl(var(--cat-h) 70% var(--cat-ld)); --cat-soft: hsl(var(--cat-h) 38% 16%); }
}
:root[data-theme="dark"] .related-list a { --cat: hsl(var(--cat-h) 70% var(--cat-ld)); --cat-soft: hsl(var(--cat-h) 38% 16%); }

/* --- tool cards --------------------------------------------------------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(252px, 1fr));
  gap: 12px;
}

.tool-card-wrap { position: relative; }

.tool-card {
  display: flex; align-items: flex-start; gap: 12px;
  height: 100%;
  padding: 13px 40px 13px 14px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: inherit; text-decoration: none;
  transition: border-color .12s, transform .12s, box-shadow .12s;
}
.tool-card:hover { border-color: var(--cat); transform: translateY(-1px); box-shadow: var(--shadow); }

.tool-icon {
  flex: none;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  color: var(--cat); background: var(--cat-soft);
  border-radius: 9px;
}
.tool-icon svg { width: 19px; height: 19px; }

.tool-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tool-name { font-size: 14.5px; font-weight: 600; }
.tool-desc { font-size: 12.5px; line-height: 1.4; color: var(--fg-muted); }
.tool-cat {
  margin-top: 4px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--cat);
}
.cat-tools .tool-cat { display: none; }

.pin-btn {
  position: absolute; top: 8px; right: 8px;
  width: 28px; height: 28px;
  display: grid; place-items: center;
  color: var(--fg-muted);
  background: none; border: 0; border-radius: 7px;
  opacity: 0; cursor: pointer;
  transition: opacity .12s, color .12s;
}
.pin-btn svg { width: 17px; height: 17px; }
.pin-btn:hover { background: var(--bg-sunken); color: var(--cat); }
.pin-btn.on { opacity: 1; color: var(--cat); }
.pin-btn.on svg { fill: currentColor; }
.tool-card-wrap:hover .pin-btn, .pin-btn:focus-visible { opacity: 1; }

/* Feature cards: the many-in-one tools, first on their category page and in
   the home page's "All-in-one tools" row. The name link covers the card;
   the part links and the pin sit above it. */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 12px;
}
.cat-tools > .feature-grid + .card-grid { margin-top: 12px; }
.feature-card {
  position: relative;
  display: flex; align-items: flex-start; gap: 14px;
  padding: 16px 44px 16px 16px;
  background: linear-gradient(135deg, var(--cat-soft), var(--bg-elev) 75%);
  border: 1px solid var(--cat-line);
  border-radius: var(--radius);
  transition: border-color .12s, transform .12s, box-shadow .12s;
}
.feature-card:hover { border-color: var(--cat); transform: translateY(-1px); box-shadow: var(--shadow); }
.feature-card .tool-icon {
  width: 46px; height: 46px; border-radius: 12px;
  background: var(--bg-elev); border: 1px solid var(--cat-line);
}
.feature-card .tool-icon svg { width: 24px; height: 24px; }
.feature-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.feature-kicker {
  font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--cat);
}
.feature-name { font-size: 16.5px; font-weight: 700; color: var(--fg); text-decoration: none; }
.feature-name::after { content: ''; position: absolute; inset: 0; border-radius: inherit; }
.feature-name:focus-visible { outline: none; }
.feature-card:has(.feature-name:focus-visible) { outline: 2px solid var(--cat); outline-offset: 2px; }
.feature-parts { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.feature-parts a {
  position: relative; z-index: 1;
  padding: 2px 9px; font-size: 12px;
  color: var(--fg); text-decoration: none;
  background: var(--bg-elev); border: 1px solid var(--cat-line); border-radius: 999px;
}
.feature-parts a:hover { color: var(--cat); border-color: var(--cat); }
.feature-parts a.more { color: var(--fg-muted); }
.feature-card .pin-btn { z-index: 2; }
.feature-card:hover .pin-btn { opacity: 1; }
:root[data-density="compact"] .feature-card { padding: 12px 40px 12px 12px; }
:root[data-density="compact"] .feature-card .tool-desc { display: none; }

.tool-head .pin-btn { position: static; opacity: 1; width: 34px; height: 34px; border: 1px solid var(--border); }
.tool-head .mem-reset { align-self: flex-start; height: 34px; padding: 0 12px; font-size: 13px; }
.tool-head .pin-btn svg { width: 19px; height: 19px; }

/* --- command palette ---------------------------------------------------- */

body.palette-open { overflow: hidden; }

.palette { position: fixed; inset: 0; z-index: 60; display: flex; justify-content: center; }
.palette[hidden] { display: none; }
.palette-backdrop { position: absolute; inset: 0; background: rgb(10 12 17 / 45%); }

.palette-box {
  position: relative;
  display: flex; flex-direction: column;
  width: min(680px, calc(100% - 24px));
  max-height: min(620px, calc(100vh - 100px));
  margin-top: clamp(24px, 9vh, 96px);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgb(10 12 17 / 30%);
  overflow: hidden;
}

.palette-search { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.palette-icon { width: 19px; height: 19px; flex: none; color: var(--fg-muted); }
#palette-input {
  flex: 1; min-width: 0;
  padding: 4px 0;
  font: inherit; font-size: 16px; color: var(--fg);
  background: none; border: 0; outline: none;
}
#palette-input::-webkit-search-cancel-button { display: none; }

.palette-results { flex: 1; overflow-y: auto; padding: 6px; }

.palette-row {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 10px;
  border-radius: 9px;
  color: inherit; text-decoration: none;
  border-left: 3px solid transparent;
}
.palette-row.active { background: var(--cat-soft); border-left-color: var(--cat); }

.palette-row-icon {
  flex: none; width: 30px; height: 30px;
  display: grid; place-items: center;
  color: var(--cat); background: var(--cat-soft);
  border-radius: 8px;
}
.palette-row.active .palette-row-icon { background: var(--bg-elev); }
.palette-row-icon svg { width: 17px; height: 17px; }

.palette-row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.palette-row-text strong { font-size: 14px; font-weight: 600; }
.palette-row-text span {
  font-size: 12px; color: var(--fg-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.palette-row-pin { flex: none; color: var(--cat); }
.palette-row-pin svg { width: 14px; height: 14px; fill: currentColor; }
.palette-row-cat {
  flex: none;
  font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--cat);
}

.palette-empty { margin: 0; padding: 22px 16px; text-align: center; color: var(--fg-muted); font-size: 14px; }
.palette-hint {
  display: flex; gap: 16px; justify-content: center;
  padding: 9px; font-size: 12px; color: var(--fg-muted);
  background: var(--bg-sunken); border-top: 1px solid var(--border);
}
.palette-hint span { display: inline-flex; align-items: center; gap: 4px; }
.palette-hint kbd { border-bottom-width: 1px; }

/* --- compact density ---------------------------------------------------- */

:root[data-density="compact"] .card-grid { grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 8px; }
:root[data-density="compact"] .tool-card { padding: 8px 34px 8px 10px; gap: 9px; align-items: center; }
:root[data-density="compact"] .tool-icon { width: 26px; height: 26px; border-radius: 7px; }
:root[data-density="compact"] .tool-icon svg { width: 16px; height: 16px; }
:root[data-density="compact"] .tool-desc,
:root[data-density="compact"] .tool-cat { display: none; }
:root[data-density="compact"] .tool-name { font-size: 13.5px; }
:root[data-density="compact"] .pin-btn { top: 4px; right: 4px; width: 24px; height: 24px; }
:root[data-density="compact"] .recipe-card-text span { display: none; }

/* --- tool surface ------------------------------------------------------- */

.panel {
  padding: 16px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.panel + .panel { margin-top: 16px; }
.panel > h3 { margin: 0 0 12px; font-size: 14px; letter-spacing: .02em; color: var(--fg-muted); text-transform: uppercase; }

.split { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.row > * { flex: 0 0 auto; }
.row .grow { flex: 1 1 180px; min-width: 0; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label { font-size: 13px; font-weight: 600; color: var(--fg-muted); }
.field .hint { font-size: 12px; color: var(--fg-muted); }

input[type="text"], input[type="number"], input[type="search"], input[type="password"],
input[type="date"], input[type="datetime-local"], input[type="time"], select, textarea {
  font: inherit;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  padding: 8px 10px;
  width: 100%;
  min-width: 0;
}
textarea { font-family: var(--mono); font-size: 13px; line-height: 1.55; resize: vertical; min-height: 150px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
input[type="color"] { width: 54px; height: 38px; padding: 2px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-s); }
input[type="range"] { width: 100%; accent-color: var(--accent); }

.check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.check input { width: auto; accent-color: var(--accent); }

.btn {
  font: inherit; font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--radius-s);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: var(--bg-sunken); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--fg-muted); }
.btn.ghost:hover { background: var(--bg-sunken); color: var(--fg); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btnrow { display: flex; flex-wrap: wrap; gap: 8px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font: inherit; font-size: 13px;
  padding: 5px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--fg);
  cursor: pointer;
}
.chip:hover { border-color: var(--accent); }
.chip.on { background: var(--accent-weak); border-color: var(--accent); color: var(--accent); font-weight: 600; }

.out {
  margin: 0;
  padding: 12px;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  font-family: var(--mono); font-size: 13px; line-height: 1.55;
  white-space: pre-wrap; word-break: break-word;
  max-height: 460px; overflow: auto;
}
.out:empty::before { content: "—"; color: var(--fg-muted); }

.note { font-size: 13px; color: var(--fg-muted); }
.note.err { color: var(--err); }
.note.ok  { color: var(--ok); }

.banner {
  padding: 10px 12px; border-radius: var(--radius-s);
  background: var(--err-weak); color: var(--err);
  border: 1px solid currentColor; font-size: 13px;
}
.banner.info { background: var(--bg-sunken); color: var(--fg-muted); border-color: var(--border); }
.progress { display: grid; gap: 6px; }

.stats { display: flex; flex-wrap: wrap; gap: 10px; }
.stat {
  flex: 1 1 110px;
  padding: 10px 12px;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
}
.stat b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--fg-muted); }

table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th, table.data td { padding: 7px 10px; border-bottom: 1px solid var(--border); text-align: left; }
table.data th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--fg-muted); }
table.data td.mono { font-family: var(--mono); font-size: 13px; }

/* --- merged tools ------------------------------------------------------
   The tabs (or the menu) over a merged tool, and the pane the chosen part
   renders into. */
.tool-tabs { display: grid; gap: 8px; }
.tool-tabs .field { max-width: 320px; margin: 0; }
.tool-tab-about { margin: 0; }
/* Underlined tabs, so they don't look like the pill toggles inside a tool. */
.tool-tabs .chips { gap: 2px; border-bottom: 1px solid var(--border); }
.tool-tabs .chip {
  margin-bottom: -1px; padding: 8px 14px;
  font-size: 14px; font-weight: 600; color: var(--fg-muted);
  background: none; border: 0; border-bottom: 2px solid transparent; border-radius: 8px 8px 0 0;
}
.tool-tabs .chip:hover { color: var(--fg); background: var(--bg-sunken); border-color: transparent; }
.tool-tabs .chip.on { color: var(--accent); background: none; border-bottom-color: var(--accent); }

/* --- workspaces --------------------------------------------------------
   The PDF and Image Editors: the file being edited across the top, the
   tools down the side, the chosen tool beside them. */
.ws-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 12px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color .3s, box-shadow .3s;
}
.ws-bar.empty { border-style: dashed; background: var(--bg-sunken); }
.ws-bar.changed { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.ws-hint { font-size: 13.5px; color: var(--fg-muted); }
.ws-thumb {
  flex: none; width: 44px; height: 44px; object-fit: cover;
  border-radius: 8px; border: 1px solid var(--border); background: var(--bg-sunken);
}
.ws-thumb.icon { display: grid; place-items: center; color: var(--accent); background: var(--accent-weak); border: 0; }
.ws-thumb.icon svg { width: 22px; height: 22px; }
.ws-doc { flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; }
.ws-doc-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-doc-line { font-size: 12.5px; color: var(--fg-muted); }
.ws-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.ws-body { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 18px; align-items: start; }
.ws-nav { position: sticky; top: 80px; display: grid; gap: 14px; }
.ws-group { display: grid; gap: 1px; }
.ws-group-name {
  margin: 0 0 4px 8px;
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--fg-muted);
}
.ws-item {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 8px; border-radius: var(--radius-s);
  font-size: 14px; color: var(--fg); text-decoration: none;
}
.ws-item:hover { background: var(--bg-sunken); }
.ws-item.on { color: var(--accent); background: var(--accent-weak); font-weight: 600; }
.ws-item-icon { flex: none; width: 22px; height: 22px; display: grid; place-items: center; color: var(--fg-muted); }
.ws-item.on .ws-item-icon { color: var(--accent); }
.ws-item-icon svg { width: 16px; height: 16px; }
.ws-main { display: grid; gap: 10px; min-width: 0; }
.ws-main > .tool-tab-about { margin: 0; }

@media (max-width: 960px) {
  .ws-body { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  /* The tool list becomes one scrolling row. */
  .ws-nav {
    position: static; display: flex; gap: 4px; overflow-x: auto;
    padding-bottom: 6px; border-bottom: 1px solid var(--border);
    -webkit-overflow-scrolling: touch;
    /* Fade the right edge so it's clear the row scrolls. */
    -webkit-mask-image: linear-gradient(to right, #000 85%, transparent);
    mask-image: linear-gradient(to right, #000 85%, transparent);
  }
  .ws-group { display: flex; gap: 4px; }
  .ws-group-name { display: none; }
  .ws-item { white-space: nowrap; }
}

/* --- drop zone ---------------------------------------------------------- */

.dropzone {
  display: grid; place-items: center; gap: 6px;
  padding: 26px 16px; text-align: center;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg-sunken);
  color: var(--fg-muted);
  cursor: pointer;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); color: var(--accent); }
.dropzone strong { color: var(--fg); font-size: 15px; }
.dropzone.over { background: var(--accent-weak); }

.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.thumb { border: 1px solid var(--border); border-radius: var(--radius-s); padding: 6px; background: var(--bg-sunken); font-size: 11px; color: var(--fg-muted); text-align: center; }
.thumb img, .thumb canvas { display: block; width: 100%; height: 88px; object-fit: contain; margin-bottom: 4px; }

.preview-wrap { display: grid; place-items: center; padding: 12px; background: var(--bg-sunken); border: 1px solid var(--border); border-radius: var(--radius-s); }
.preview-wrap img, .preview-wrap canvas { max-width: 100%; height: auto; }

.swatch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.swatch { border: 1px solid var(--border); border-radius: var(--radius-s); overflow: hidden; cursor: pointer; background: var(--bg-sunken); }
.swatch i { display: block; height: 58px; }
.swatch code { display: block; padding: 5px 4px; font-size: 11px; text-align: center; font-family: var(--mono); }

/* --- diff --------------------------------------------------------------- */

.diffline { display: block; padding: 0 6px; border-radius: 3px; }
.diffline.add { background: color-mix(in srgb, var(--ok) 18%, transparent); }
.diffline.del { background: color-mix(in srgb, var(--err) 18%, transparent); }

/* --- toaster ------------------------------------------------------------ */

/* Toasts are messages only: clicks pass through to whatever is underneath. */
.toaster { position: fixed; right: 16px; bottom: calc(16px + var(--tray-h, 0px)); z-index: 60; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  padding: 10px 14px;
  background: var(--fg); color: var(--bg);
  border-radius: var(--radius-s);
  box-shadow: var(--shadow);
  font-size: 14px;
  animation: toast-in .16s ease-out;
}
.toast.err { background: var(--err); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } }

/* Work carrying on in the background (UI.park): a tray at the bottom
   right with a line per parked tool, its live progress, Open and Stop. */
.tray {
  position: fixed; right: 16px; bottom: 16px; z-index: 55;
  width: 320px; max-width: calc(100vw - 32px);
  padding: 10px 14px 4px;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); font-size: 13px;
  animation: toast-in .16s ease-out;
}
.tray[hidden] { display: none; }
.tray-title { margin: 0 0 4px; font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--fg-muted); }
.tray-item { display: grid; gap: 5px; padding: 8px 0 10px; border-top: 1px solid var(--border-soft); }
.tray-head { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.tray-head strong { font-weight: 600; }
.tray-sub { font-size: 12px; color: var(--fg-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tray-item progress { width: 100%; height: 6px; }
.tray-item:not(.busy) progress { display: none; }
.tray-text { font-size: 12px; color: var(--fg-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tray-item.done .tray-text { color: var(--ok); }
.tray-item.failed .tray-text { color: var(--err); white-space: normal; }
.tray-actions { display: flex; gap: 6px; margin-top: 2px; }
.tray .btn { padding: 4px 12px; font-size: 12.5px; }
@media (max-width: 560px) { .tray { left: 16px; right: 16px; width: auto; } }

/* --- changelog ---------------------------------------------------------- */

.change-list { margin: 0; padding: 0; list-style: none; }
.change { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 12px; padding: 10px 0; }
.change + .change { border-top: 1px solid var(--border); }
.change-type {
  align-self: start; justify-self: start;
  padding: 2px 8px; font-size: 12px; font-weight: 600;
  border: 1px solid currentColor; border-radius: 999px;
}
.change-added .change-type    { color: var(--ok); }
.change-improved .change-type { color: var(--accent); }
.change-fixed .change-type    { color: var(--warn); }
.change-body p { margin: 0; max-width: 75ch; }
.change-tools { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.change-tools .pill { text-decoration: none; }
.change-tools .pill:hover { background: var(--cat-soft); }
.change-more { margin-top: 8px; }
.change-more summary { cursor: pointer; font-size: 13px; color: var(--fg-muted); }

@media (max-width: 560px) {
  .change { grid-template-columns: minmax(0, 1fr); gap: 6px; }
}

/* --- footer ------------------------------------------------------------- */

.sitefoot {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between;
  max-width: 1320px; margin: 0 auto; padding: 18px 16px 32px;
  font-size: 13px; color: var(--fg-muted);
  border-top: 1px solid var(--border);
}

/* --- narrow screens ----------------------------------------------------- */

@media (max-width: 960px) {
  .layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; gap: 16px; padding: 16px; }
  .related { grid-column: auto; }
  .sidebar {
    position: static; display: none; grid-row: auto; max-height: none; overflow: visible;
    padding: 12px; background: var(--bg-elev);
    border: 1px solid var(--border); border-radius: var(--radius);
  }
  .sidebar.open { display: block; }
  .menu-only { display: grid; }
  .brand span { display: none; }
  .topbar { gap: 10px; padding: 10px 12px; }
  .search-trigger kbd { display: none; }
  .hero h1 { font-size: 24px; }
  .home-band { grid-template-columns: minmax(0, 1fr); }
  .page-head h1 { font-size: 22px; }
}

@media (max-width: 560px) {
  .search-trigger span { display: none; }
  .search-trigger { flex: none; width: 38px; height: 38px; padding: 0; justify-content: center; border-radius: var(--radius-s); }
  .topbar { justify-content: space-between; }
  .card-grid, .feature-grid, .sec-grid, .recipe-grid, .recipe-grid.wide { grid-template-columns: minmax(0, 1fr); }
  .top-grid .tool-card-wrap:nth-child(n+7) { display: none; }
  .intake-choose span { display: none; }
  .intake-box { padding-left: 12px; }
  .recipe-bar-nav { width: 100%; }
  .palette-box { margin-top: 12px; max-height: calc(100vh - 24px); }
  .cat-head-tools .filter-box { max-width: none; }
  .pin-btn { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* Wide content (tables, previews) scrolls sideways inside its panel rather
   than widening the page on phones. */
.scroll { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* The hidden attribute always wins over a class that sets display. */
[hidden] { display: none !important; }

/* Panels side by side in a .split sit level with each other. */
.split > .panel { margin-top: 0; }
