/* LocalStash — stylesheet.
   Editorial paper palette, hairline rules, no web fonts (system + Georgia),
   no external assets. Everything below is hand-written and layout-safe down to 320px. */

/* ---------- tokens ---------- */
:root {
  --paper: #f5f1e6;
  --paper-deep: #ece5d3;
  --card: #fffcf4;
  --ink: #191710;
  --ink-soft: #46422f;
  --muted: #78715f;
  --line: #ddd6c2;
  --line-strong: #c8bfa6;
  --accent: #bf4517;
  --accent-ink: #fff8f2;
  --accent-soft: #f4e2d5;
  --teal: #1b6b62;
  --teal-soft: #dcece7;
  --danger: #a3281b;
  --shadow-sm: 0 1px 2px rgba(25, 23, 16, .06), 0 6px 18px -12px rgba(25, 23, 16, .25);
  --shadow-md: 0 2px 4px rgba(25, 23, 16, .05), 0 20px 40px -24px rgba(25, 23, 16, .35);
  --radius: 14px;
  --radius-sm: 9px;
  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --max: 1340px;
}

html[data-theme="dark"] {
  --paper: #12110d;
  --paper-deep: #191812;
  --card: #1b1a14;
  --ink: #f4efe1;
  --ink-soft: #d6d0bd;
  --muted: #9c9481;
  --line: #302e23;
  --line-strong: #45412f;
  --accent: #ff8a5c;
  --accent-ink: #1c0f08;
  --accent-soft: #38231a;
  --teal: #6ec6b8;
  --teal-soft: #17322e;
  --danger: #ff7a66;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 22px -14px rgba(0, 0, 0, .8);
  --shadow-md: 0 2px 6px rgba(0, 0, 0, .45), 0 24px 48px -28px rgba(0, 0, 0, .9);
}

/* ---------- reset ---------- */
[hidden] { display: none !important; }
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    radial-gradient(circle at 12% 8%, rgba(191, 69, 23, .07), transparent 42%),
    radial-gradient(circle at 88% 0%, rgba(27, 107, 98, .07), transparent 38%);
}
html[data-theme="dark"] body::before {
  background-image:
    radial-gradient(circle at 12% 8%, rgba(255, 138, 92, .09), transparent 42%),
    radial-gradient(circle at 88% 0%, rgba(110, 198, 184, .07), transparent 38%);
}
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.15; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 8px;
  text-decoration: none; transition: top .15s;
}
.skip-link:focus { top: 12px; }

/* ---------- shared controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 10px;
  padding: 9px 15px; font-size: 14px; font-weight: 600; letter-spacing: -.01em;
  text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, transform .12s;
}
.btn:active { transform: translateY(1px); }
.btn-solid { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn-solid:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-line { background: transparent; border-color: var(--line-strong); color: var(--ink); }
.btn-line:hover { background: var(--paper-deep); border-color: var(--ink); }
.btn-ghost { background: transparent; color: var(--ink-soft); border-color: transparent; }
.btn-ghost:hover { background: var(--paper-deep); color: var(--ink); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger.btn-line { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn-danger.btn-line:hover { background: color-mix(in srgb, var(--danger) 12%, transparent); border-color: var(--danger); }
.btn-small { padding: 6px 12px; font-size: 13px; }
.btn-pro {
  background: var(--accent); color: var(--accent-ink); border-color: var(--accent);
  padding: 7px 13px; font-size: 13px; letter-spacing: .02em; text-transform: uppercase;
}
.btn-pro:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 10px;
  background: transparent; border: 1px solid transparent; color: var(--ink-soft);
  font-size: 20px; line-height: 1;
}
.icon-btn:hover { background: var(--paper-deep); color: var(--ink); border-color: var(--line); }
.mini-btn {
  background: transparent; border: 1px solid var(--line-strong); color: var(--ink-soft);
  border-radius: 7px; padding: 3px 9px; font-size: 12px; font-weight: 600; letter-spacing: .01em;
}
.mini-btn:hover { border-color: var(--ink); color: var(--ink); }
.mini-btn-solid { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.linkish {
  background: none; border: 0; padding: 0; color: var(--accent);
  font-size: 13px; font-weight: 600; text-decoration: underline;
  text-decoration-thickness: 1px; text-underline-offset: 3px;
}
.linkish:hover { color: var(--ink); }
.check { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); cursor: pointer; }
.check input { accent-color: var(--accent); width: 14px; height: 14px; }

input[type="text"], input[type="url"], input[type="search"], select, textarea {
  width: 100%; background: var(--card); color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; font-size: 14.5px;
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .85; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}
select {
  appearance: none; padding-right: 32px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 17px) 55%, calc(100% - 12px) 55%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
textarea { resize: vertical; min-height: 76px; line-height: 1.5; }
.select-compact { width: auto; padding: 7px 30px 7px 10px; font-size: 13px; border-radius: 8px; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: var(--max); margin: 0 auto;
  padding: 10px clamp(14px, 3vw, 32px);
  display: flex; align-items: center; gap: clamp(14px, 2.4vw, 32px);
}
.brand {
  display: inline-flex; align-items: center; gap: 9px;
  text-decoration: none; color: var(--ink); flex-shrink: 0;
}
.brand-mark { color: var(--accent); flex-shrink: 0; }
.brand-text { font-family: var(--serif); font-size: 20px; letter-spacing: -.02em; }
.brand-text b { font-weight: 700; }
.topnav { display: flex; align-items: center; gap: 20px; margin-right: auto; min-width: 0; }
.topnav a {
  color: var(--ink-soft); text-decoration: none; font-size: 13.5px; letter-spacing: -.005em;
  white-space: nowrap; padding: 4px 0; border-bottom: 1px solid transparent;
}
.topnav a:hover { color: var(--ink); border-bottom-color: var(--line-strong); }
.topnav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }
.topbar-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; flex-shrink: 0; }
.filters-btn { display: none; }

/* ---------- shell ---------- */
.shell {
  position: relative; z-index: 1;
  max-width: var(--max); margin: 0 auto;
  padding: clamp(18px, 3vw, 34px) clamp(14px, 3vw, 32px) 60px;
  display: grid; grid-template-columns: 258px minmax(0, 1fr);
  gap: clamp(20px, 3.2vw, 44px);
  align-items: start;
}
.workspace { min-width: 0; }

/* ---------- sidebar ---------- */
.sidebar {
  position: sticky; top: 72px;
  max-height: calc(100vh - 92px); overflow-y: auto;
  padding: 2px 2px 8px;
  scroll-margin-top: 68px;
  display: flex; flex-direction: column; gap: 22px;
  scrollbar-width: thin;
}
.side-block { border-top: 1px solid var(--line); padding-top: 14px; min-width: 0; }
.side-block:first-child { border-top: 0; padding-top: 0; }
.side-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 9px; }
.side-head h2 {
  font-size: 11px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase;
  color: var(--muted);
}
.side-count { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.side-note { font-size: 12px; color: var(--muted); line-height: 1.45; margin-top: 8px; }
.new-col { display: flex; gap: 6px; margin-bottom: 10px; }
.new-col input { padding: 6px 9px; font-size: 13px; border-radius: 8px; }
.col-list { display: flex; flex-direction: column; gap: 1px; }
.col-item { display: flex; align-items: center; gap: 4px; min-width: 0; }
.col-btn {
  flex: 1; min-width: 0; text-align: left; background: none; border: 0;
  padding: 6px 8px; border-radius: 7px; font-size: 13.5px; color: var(--ink-soft);
  display: flex; align-items: center; gap: 8px; overflow: hidden;
}
.col-btn .col-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-btn .col-num { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--muted); flex-shrink: 0; }
.col-btn:hover { background: var(--paper-deep); color: var(--ink); }
.col-btn[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.col-btn[aria-pressed="true"] .col-num { color: color-mix(in srgb, var(--paper) 70%, transparent); }
.col-del {
  flex-shrink: 0; width: 22px; height: 22px; border-radius: 6px; border: 0; background: none;
  color: var(--muted); font-size: 15px; line-height: 1; opacity: 0; transition: opacity .12s;
}
.col-item:hover .col-del, .col-del:focus-visible { opacity: 1; }
.col-del:hover { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }

.cat-list { display: flex; flex-direction: column; gap: 1px; }
.cat-btn {
  width: 100%; text-align: left; background: none; border: 0; border-radius: 7px;
  padding: 6px 8px; font-size: 13.5px; color: var(--ink-soft);
  display: flex; align-items: center; gap: 8px;
}
.cat-btn:hover { background: var(--paper-deep); color: var(--ink); }
.cat-btn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
html[data-theme="dark"] .cat-btn[aria-pressed="true"] { color: var(--accent); }
.cat-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.cat-num { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--muted); }

.tag-cloud { display: flex; flex-wrap: wrap; gap: 5px; }
.tag-chip {
  background: transparent; border: 1px solid var(--line); color: var(--ink-soft);
  border-radius: 999px; padding: 3px 9px; font-family: var(--mono); font-size: 11.5px;
  line-height: 1.5; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tag-chip:hover { border-color: var(--ink); color: var(--ink); }
.tag-chip[aria-pressed="true"] { background: var(--teal-soft); border-color: var(--teal); color: var(--teal); font-weight: 600; }
.tag-chip .tag-n { opacity: .55; margin-left: 5px; font-size: 10px; vertical-align: 1px; }

.stat-list { display: flex; flex-direction: column; gap: 5px; }
.stat-list > div { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.stat-list dt { font-size: 12.5px; color: var(--muted); }
.stat-list dd { margin: 0; font-family: var(--mono); font-size: 12.5px; color: var(--ink); }
.meter { height: 3px; background: var(--line); border-radius: 999px; overflow: hidden; margin: 10px 0 4px; }
.meter span { display: block; height: 100%; width: 2%; background: var(--teal); border-radius: 999px; transition: width .3s; }
.stack { display: flex; flex-direction: column; gap: 6px; }
.stack .btn { justify-content: flex-start; }

/* ---------- page head ---------- */
.page-head { margin-bottom: 20px; }
.eyebrow {
  font-family: var(--mono); font-size: 11px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 8px;
}
.page-head h1 {
  font-family: var(--serif); font-size: clamp(30px, 4.6vw, 46px);
  letter-spacing: -.035em; font-weight: 700; margin-bottom: 10px;
}
.lede { color: var(--ink-soft); font-size: 15px; line-height: 1.6; max-width: 62ch; }

/* ---------- save card ---------- */
.save-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px; box-shadow: var(--shadow-sm); margin-bottom: 14px;
}
.save-row { display: flex; gap: 8px; align-items: stretch; }
.url-input { flex: 1; min-width: 0; padding: 12px 14px; font-size: 15px; border-radius: 11px; }
.save-btn { padding: 0 22px; border-radius: 11px; font-size: 14.5px; }
.save-extra { display: flex; flex-wrap: wrap; gap: 16px; padding: 10px 4px 2px; }
.details-panel { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 14px; }
.field-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 14px;
}
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field-wide { grid-column: 1 / -1; }
.field label { font-size: 12px; font-weight: 600; letter-spacing: .01em; color: var(--ink-soft); }
.label-hint { font-weight: 400; color: var(--muted); }
.field select, .field input, .field textarea { font-size: 14px; }
.tag-editor {
  display: flex; flex-wrap: wrap; align-items: center; gap: 5px;
  border: 1px solid var(--line); border-radius: 10px; padding: 5px 7px;
  background: var(--card); min-width: 0;
}
.tag-editor:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent); }
.tag-editor input { border: 0; box-shadow: none; padding: 4px 2px; flex: 1; min-width: 120px; background: transparent; }
.tag-editor input:focus { box-shadow: none; }
.tag-chips { display: contents; }
.tag-pill {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--paper-deep); border: 1px solid var(--line); border-radius: 999px;
  padding: 2px 4px 2px 9px; font-family: var(--mono); font-size: 11.5px; color: var(--ink-soft);
  max-width: 100%;
}
.tag-pill button { border: 0; background: none; color: var(--muted); font-size: 13px; line-height: 1; padding: 2px 4px; border-radius: 50%; }
.tag-pill button:hover { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }
.suggest-row { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; font-size: 11.5px; color: var(--muted); min-height: 18px; }
.suggest-row .suggest-label { font-family: var(--mono); letter-spacing: .04em; text-transform: uppercase; }
.suggest-chip {
  background: var(--teal-soft); border: 1px dashed var(--teal); color: var(--teal);
  border-radius: 999px; padding: 1px 8px; font-family: var(--mono); font-size: 11px;
}
.suggest-chip:hover { border-style: solid; }

.drop-zone {
  border: 1px dashed var(--line-strong); border-radius: 10px; background: var(--paper);
  padding: 14px; min-height: 68px; display: flex; align-items: center; justify-content: center;
  transition: border-color .15s, background .15s; cursor: pointer;
}
.drop-zone:hover, .drop-zone:focus-visible { border-color: var(--accent); }
.drop-zone.is-drag { border-color: var(--accent); background: var(--accent-soft); }
.drop-empty { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; text-align: left; }
.drop-empty svg { flex-shrink: 0; }
.drop-preview { display: flex; align-items: center; gap: 12px; width: 100%; min-width: 0; }
.drop-preview img {
  width: 86px; height: 58px; object-fit: cover; border-radius: 7px;
  border: 1px solid var(--line); flex-shrink: 0;
}
.preview-meta { display: flex; flex-direction: column; gap: 6px; min-width: 0; font-size: 12px; color: var(--muted); }
.preview-meta .mini-btn { align-self: flex-start; }
.details-actions { display: flex; justify-content: flex-end; margin-top: 10px; }
.mode-note { font-size: 11.5px; color: var(--muted); }

/* ---------- ad slot ---------- */
.ad-slot {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--paper-deep); padding: 10px 14px; margin: 0 0 16px;
  min-height: 74px; display: flex; align-items: center; gap: 12px;
}
.ad-label {
  font-family: var(--mono); font-size: 9px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--muted); writing-mode: vertical-rl; transform: rotate(180deg); flex-shrink: 0;
}
.house-ad { display: flex; align-items: center; justify-content: space-between; gap: 14px; width: 100%; min-width: 0; flex-wrap: wrap; }
.house-ad strong { font-family: var(--serif); font-size: 16px; }
.house-ad p { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.ad-slot ins { width: 100%; }

/* ---------- toolbar ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.search-wrap { position: relative; flex: 1 1 260px; min-width: 0; }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-wrap input { padding: 10px 34px 10px 36px; border-radius: 10px; font-size: 14px; background: var(--card); }
.search-clear {
  position: absolute; right: 7px; top: 50%; transform: translateY(-50%);
  border: 0; background: none; color: var(--muted); font-size: 19px; line-height: 1; padding: 2px 7px; border-radius: 6px;
}
.search-clear:hover { background: var(--paper-deep); color: var(--ink); }
.toolbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: transparent; color: var(--ink-soft);
  border-radius: 999px; padding: 6px 12px; font-size: 13px;
}
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip-toggle[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.view-toggle { display: flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--card); }
.view-btn { border: 0; background: transparent; color: var(--muted); padding: 7px 9px; display: inline-flex; }
.view-btn:hover { background: var(--paper-deep); color: var(--ink); }
.view-btn.is-active { background: var(--ink); color: var(--paper); }

.result-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; min-height: 22px; }
.result-count { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.active-filters { display: flex; flex-wrap: wrap; gap: 5px; }
.filter-pill {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--paper-deep); border: 1px solid var(--line); border-radius: 999px;
  padding: 2px 4px 2px 10px; font-size: 11.5px; color: var(--ink-soft); max-width: 100%;
}
.filter-pill span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filter-pill button { border: 0; background: none; color: var(--muted); border-radius: 50%; padding: 1px 5px; font-size: 13px; line-height: 1; }
.filter-pill button:hover { color: var(--danger); }

/* ---------- cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 14px; align-items: stretch; }
.card {
  position: relative; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; min-width: 0;
  display: flex; flex-direction: column; height: 100%;
  transition: transform .16s, box-shadow .16s, border-color .16s;
  cursor: pointer;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--line-strong); }
.thumb {
  position: relative; aspect-ratio: 16 / 10; background: var(--paper-deep);
  border-bottom: 1px solid var(--line); overflow: hidden; flex-shrink: 0;
}
.thumb img { position: relative; z-index: 1; width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.thumb-fallback {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-size: 40px; font-weight: 700; letter-spacing: -.04em;
  color: color-mix(in srgb, var(--ink) 22%, transparent);
  background-image: linear-gradient(135deg, color-mix(in srgb, var(--paper-deep) 70%, var(--card)) 0%, var(--paper-deep) 100%);
}
.card[data-cat="UI"] .thumb-fallback { background-image: linear-gradient(135deg, #e9dfc9, #d8c8a8); }
.card[data-cat="Dev"] .thumb-fallback { background-image: linear-gradient(135deg, #dbe5df, #c2d5cb); }
.card[data-cat="Article"] .thumb-fallback { background-image: linear-gradient(135deg, #e6e2d3, #d3cdb6); }
.card[data-cat="Tool"] .thumb-fallback { background-image: linear-gradient(135deg, #dfe2ea, #c8cedb); }
.card[data-cat="Inspiration"] .thumb-fallback { background-image: linear-gradient(135deg, #f0ddd2, #e3c3b1); }
html[data-theme="dark"] .card[data-cat="UI"] .thumb-fallback { background-image: linear-gradient(135deg, #2a2519, #3a3220); }
html[data-theme="dark"] .card[data-cat="Dev"] .thumb-fallback { background-image: linear-gradient(135deg, #19251f, #243a30); }
html[data-theme="dark"] .card[data-cat="Article"] .thumb-fallback { background-image: linear-gradient(135deg, #26241a, #34311f); }
html[data-theme="dark"] .card[data-cat="Tool"] .thumb-fallback { background-image: linear-gradient(135deg, #1c2029, #262e3c); }
html[data-theme="dark"] .card[data-cat="Inspiration"] .thumb-fallback { background-image: linear-gradient(135deg, #2c211a, #3d2a20); }
.thumb-badge {
  position: absolute; left: 8px; top: 8px; z-index: 2;
  background: color-mix(in srgb, var(--ink) 82%, transparent); color: var(--paper);
  border-radius: 999px; padding: 2px 8px; font-family: var(--mono); font-size: 10px; letter-spacing: .06em;
  text-transform: uppercase; backdrop-filter: blur(4px);
}
.card-body { padding: 11px 12px 12px; display: flex; flex-direction: column; gap: 7px; min-width: 0; flex: 1; }
.card-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.cat-tag {
  font-family: var(--mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; flex-shrink: 0;
}
.star-btn {
  margin-left: auto; flex-shrink: 0; border: 0; background: none; color: var(--muted);
  width: 26px; height: 26px; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center;
}
.star-btn:hover { background: var(--paper-deep); color: var(--ink); }
.star-btn[aria-pressed="true"] { color: var(--accent); }
.star-btn[aria-pressed="true"] svg path { fill: currentColor; }
.card-title {
  font-size: 14.5px; font-weight: 600; letter-spacing: -.015em; line-height: 1.32;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  overflow-wrap: anywhere;
}
.card-title a { text-decoration: none; }
mark { background: color-mix(in srgb, var(--accent) 22%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.card-title a:hover { text-decoration: underline; text-underline-offset: 2px; }
.card-note {
  font-size: 12.5px; color: var(--muted); line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  overflow-wrap: anywhere;
}
.card-tags { display: flex; flex-wrap: wrap; gap: 4px; max-height: 21px; overflow: hidden; }
.card-tags .tag-chip { padding: 1px 7px; font-size: 10.5px; border-color: transparent; background: var(--paper-deep); color: var(--muted); }
.card-tags .tag-chip:hover { color: var(--ink); border-color: var(--line-strong); }
.card-foot {
  margin-top: auto; display: flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 10.5px; color: var(--muted); min-width: 0;
}
.card-domain { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.card-date { margin-left: auto; flex-shrink: 0; }

/* list view */
.grid.is-list { grid-template-columns: minmax(0, 1fr); gap: 8px; }
.grid.is-list .card { flex-direction: row; align-items: stretch; }
.grid.is-list .thumb { width: 168px; aspect-ratio: auto; border-bottom: 0; border-right: 1px solid var(--line); flex-shrink: 0; }
.grid.is-list .card-body { padding: 10px 14px; }
.grid.is-list .card-title { -webkit-line-clamp: 1; }
.grid.is-list .card-note { -webkit-line-clamp: 1; }

/* ---------- empty ---------- */
.empty {
  border: 1px dashed var(--line-strong); border-radius: var(--radius);
  padding: clamp(28px, 5vw, 56px) 20px; text-align: center; background: color-mix(in srgb, var(--card) 60%, transparent);
}
.empty-mark { color: var(--accent); display: flex; justify-content: center; margin-bottom: 14px; }
.empty h2 { font-family: var(--serif); font-size: clamp(20px, 2.6vw, 26px); margin-bottom: 8px; }
.empty p { color: var(--muted); font-size: 14px; max-width: 46ch; margin: 0 auto; }
.empty-actions { display: flex; justify-content: center; gap: 8px; margin-top: 18px; flex-wrap: wrap; }

/* ---------- footer ---------- */
.site-foot {
  margin-top: 52px; padding-top: 22px; border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: 20px 32px; align-items: flex-start;
}
.foot-brand { max-width: 300px; min-width: 0; }
.foot-brand p { font-size: 12.5px; color: var(--muted); margin-top: 6px; line-height: 1.5; }
.foot-nav { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; min-width: 0; }
.foot-nav a { color: var(--ink-soft); text-decoration: none; }
.foot-nav a:hover { color: var(--accent); text-decoration: underline; }
.foot-fine { flex-basis: 100%; font-size: 11.5px; color: var(--muted); }

/* ---------- dialogs ---------- */
.dialog {
  border: 1px solid var(--line); border-radius: 16px; padding: 0;
  background: var(--card); color: var(--ink);
  width: min(660px, calc(100vw - 28px)); max-height: min(88vh, 900px);
  box-shadow: var(--shadow-md);
}
.dialog::backdrop { background: rgba(15, 13, 8, .5); backdrop-filter: blur(3px); }
.dialog-small { width: min(420px, calc(100vw - 28px)); }
.dialog-inner { display: flex; flex-direction: column; max-height: inherit; }
.dialog-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 16px 18px 12px; border-bottom: 1px solid var(--line); flex-shrink: 0;
}
.dialog-head h2 { font-family: var(--serif); font-size: 20px; letter-spacing: -.02em; }
.dialog-body { padding: 16px 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.dialog-foot {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 12px 18px; border-top: 1px solid var(--line); flex-shrink: 0;
  background: color-mix(in srgb, var(--paper) 60%, var(--card));
}
.foot-spacer { flex: 1; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.detail-thumb { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; max-height: 240px; background: var(--paper-deep); }
.detail-thumb img { width: 100%; height: 100%; max-height: 220px; object-fit: cover; object-position: top center; }
.detail-meta { font-family: var(--mono); font-size: 11px; color: var(--muted); overflow-wrap: anywhere; line-height: 1.6; }
.pro-lede { font-size: 14px; color: var(--ink-soft); }
.pro-list { display: flex; flex-direction: column; gap: 10px; }
.pro-list li {
  border-left: 2px solid var(--accent); padding-left: 12px;
  display: flex; flex-direction: column; gap: 2px;
}
.pro-list strong { font-size: 14px; }
.pro-list span { font-size: 12.5px; color: var(--muted); }
.pro-list code { font-family: var(--mono); font-size: 11.5px; background: var(--paper-deep); padding: 1px 4px; border-radius: 4px; }
.pro-note { font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 10px; }
.pro-note a { color: var(--accent); }
#proCheckout[aria-disabled="true"] { opacity: .5; pointer-events: none; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
  background: var(--ink); color: var(--paper); border-radius: 10px;
  padding: 10px 16px; font-size: 13.5px; box-shadow: var(--shadow-md);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  z-index: 80; max-width: calc(100vw - 32px); text-align: center;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- responsive ---------- */
@media (max-width: 1120px) {
  .topnav { gap: 14px; }
  .topnav a:nth-child(3) { display: none; }
}
@media (max-width: 980px) {
  .shell { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .sidebar {
    position: static; max-height: none; overflow: visible;
    display: none; background: var(--card); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-sm);
  }
  body.filters-open .sidebar { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 18px 22px; }
  .side-block:first-child { border-top: 1px solid var(--line); padding-top: 14px; }
  .filters-btn { display: inline-flex; }
  .topnav { display: none; }
  .sidebar .side-storage .side-note { margin-top: 6px; }
}
@media (max-width: 640px) {
  .topbar-inner { gap: 8px; padding: 8px 14px; }
  .brand-text { font-size: 18px; }
  .brand-mark { width: 26px; height: 26px; }
  .btn-install { display: none !important; }
  .page-head h1 { font-size: 30px; }
  .lede { font-size: 14px; }
  .save-row { flex-wrap: wrap; }
  .url-input { flex-basis: 100%; }
  .save-btn { width: 100%; padding: 11px 18px; }
  .field-grid, .field-row { grid-template-columns: minmax(0, 1fr); }
  .toolbar { gap: 8px; }
  .search-wrap { flex-basis: 100%; }
  .toolbar-right { width: 100%; }
  .toolbar-right .select-compact { flex: 1; min-width: 0; }
  .view-toggle { margin-left: auto; }
  .grid { grid-template-columns: minmax(0, 1fr); }
  .grid.is-list .thumb { width: 104px; }
  .grid.is-list .card-note { display: none; }
  .grid.is-list .card-body { padding: 9px 11px; }
  .thumb { aspect-ratio: 16 / 9; }
  .site-foot { gap: 16px; }
  .dialog { width: calc(100vw - 16px); }
  .dialog-foot { padding: 12px; }
  .dialog-foot .btn { flex: 1 1 auto; }
  .dialog-foot .foot-spacer { display: none; }
  .house-ad { flex-direction: column; align-items: flex-start; gap: 8px; }
  .ad-slot { padding: 12px; }
  .ad-label { display: none; }
}
@media (max-width: 380px) {
  .cat-tag { display: none; }
  .brand-text { font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}

/* ============================================================
   Article pages (guides, use cases, about, legal)
   ============================================================ */
.doc-page .topnav { gap: 18px; }
.doc-shell {
  position: relative; z-index: 1;
  max-width: 1120px; margin: 0 auto;
  padding: clamp(26px, 4vw, 52px) clamp(16px, 3vw, 32px) 24px;
}
.doc-hero { border-bottom: 1px solid var(--line); padding-bottom: 24px; margin-bottom: 32px; }
.doc-hero h1 {
  font-family: var(--serif); font-weight: 700;
  font-size: clamp(30px, 4.6vw, 50px); line-height: 1.06; letter-spacing: -.035em;
  max-width: 22ch; margin-bottom: 14px;
}
.standfirst { font-size: clamp(15px, 1.5vw, 17.5px); line-height: 1.6; color: var(--ink-soft); max-width: 64ch; }
.doc-meta {
  display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 18px;
  font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
}
.doc-meta span { display: inline-flex; align-items: center; gap: 6px; }
.doc-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: clamp(24px, 4vw, 56px); align-items: start; }
.toc { position: sticky; top: 82px; font-size: 13px; min-width: 0; }
.toc h2 {
  font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted);
  font-weight: 700; margin-bottom: 10px;
}
.toc ol { display: flex; flex-direction: column; gap: 2px; list-style: none; padding: 0; }
.toc a {
  display: block; color: var(--muted); text-decoration: none; font-size: 13px; line-height: 1.4;
  padding: 4px 0 4px 11px; border-left: 1px solid var(--line);
}
.toc a:hover { color: var(--ink); border-left-color: var(--line-strong); }
.toc a.is-active { color: var(--accent); border-left-color: var(--accent); font-weight: 600; }
.toc .toc-app {
  display: inline-flex; margin-top: 14px; font-family: var(--mono); font-size: 11px;
  letter-spacing: .04em; color: var(--accent); text-decoration: none;
}
.prose { max-width: 68ch; font-size: 16.5px; line-height: 1.72; color: var(--ink-soft); min-width: 0; }
.prose > * + * { margin-top: 1.05em; }
.prose h2 {
  font-family: var(--serif); font-size: clamp(23px, 2.8vw, 30px); color: var(--ink);
  letter-spacing: -.025em; margin-top: 2.1em; scroll-margin-top: 84px;
}
.prose h3 { font-size: 17.5px; color: var(--ink); margin-top: 1.8em; letter-spacing: -.01em; }
.prose h2 + h3 { margin-top: 1em; }
.prose a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.prose a:hover { color: var(--ink); }
.prose ul, .prose ol { padding-left: 1.25em; display: flex; flex-direction: column; gap: .5em; }
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose li { padding-left: .15em; }
.prose li::marker { color: var(--accent); }
.prose blockquote {
  border-left: 3px solid var(--accent); padding: 2px 0 2px 18px; margin-left: 0;
  font-family: var(--serif); font-size: 19px; line-height: 1.5; color: var(--ink); font-style: italic;
}
.prose code {
  font-family: var(--mono); font-size: .86em; background: var(--paper-deep);
  border-radius: 4px; padding: 2px 5px; color: var(--ink);
}
.prose pre {
  background: var(--ink); color: var(--paper); border-radius: 10px;
  padding: 14px 16px; overflow-x: auto; font-size: 13px; line-height: 1.55;
}
.prose pre code { background: none; color: inherit; padding: 0; font-size: inherit; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.2em 0; }
.prose table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 1.2em 0; }
.prose th {
  text-align: left; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); font-weight: 700; padding: 0 10px 8px 0; border-bottom: 1px solid var(--ink);
}
.prose td { padding: 10px 10px 10px 0; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--ink-soft); line-height: 1.5; }
.prose td strong { color: var(--ink); }
.prose .table-wrap { overflow-x: auto; }
.callout {
  border: 1px solid var(--line); border-left: 3px solid var(--teal);
  background: color-mix(in srgb, var(--teal) 6%, var(--card));
  border-radius: 0 10px 10px 0; padding: 14px 16px; font-size: 14.5px; line-height: 1.6;
}
.callout strong { display: block; color: var(--ink); margin-bottom: 4px; font-size: 13px; letter-spacing: .02em; }
.callout--warn { border-left-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--card)); }
.checklist { list-style: none !important; padding-left: 0 !important; }
.checklist li { position: relative; padding-left: 26px; }
.checklist li::before {
  content: "✓"; position: absolute; left: 0; top: 0; color: var(--teal); font-weight: 700;
}
.doc-cta {
  margin-top: 48px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card);
  padding: 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
}
.doc-cta h2 { font-family: var(--serif); font-size: 21px; letter-spacing: -.02em; margin-bottom: 4px; }
.doc-cta p { font-size: 13px; color: var(--muted); max-width: 46ch; }
.doc-cta-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.related-title { margin-top: 36px; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.related { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-top: 10px; }
.related a {
  display: block; border: 1px solid var(--line); border-radius: 12px; padding: 14px;
  background: var(--card); text-decoration: none; transition: border-color .15s, transform .15s;
}
.related a:hover { border-color: var(--accent); transform: translateY(-1px); }
.related .k { font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.related .t { display: block; font-family: var(--serif); font-size: 17px; line-height: 1.3; color: var(--ink); margin-top: 4px; }
.doc-foot { border-top: 1px solid var(--line); margin-top: 44px; padding-top: 18px; font-size: 12.5px; color: var(--muted); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.doc-foot a { color: var(--ink-soft); text-decoration: none; }
.doc-foot a:hover { color: var(--accent); text-decoration: underline; }
.faq { display: flex; flex-direction: column; gap: 0; }
.faq details { border-bottom: 1px solid var(--line); padding: 12px 0; }
.faq summary { cursor: pointer; font-weight: 600; color: var(--ink); font-size: 15px; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--accent); font-family: var(--mono); }
.faq details[open] summary::after { content: "–"; }
.faq details p { margin-top: 8px; font-size: 14.5px; color: var(--ink-soft); }
.legal { font-size: 15px; }
.legal h2 { font-size: 21px; }
.legal ul { display: flex; flex-direction: column; gap: .5em; padding-left: 1.2em; list-style: disc; }
@media (max-width: 900px) {
  .doc-layout { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .toc {
    position: static; border: 1px solid var(--line); border-radius: 12px;
    background: var(--card); padding: 14px 16px; order: -1;
  }
  .toc ol { flex-direction: row; flex-wrap: wrap; gap: 4px 16px; }
  .toc a { border-left: 0; padding: 0; }
  .toc a.is-active { text-decoration: underline; }
  .toc .toc-app { margin-top: 10px; }
  .doc-page .topbar-inner { flex-wrap: wrap; row-gap: 6px; }
  .doc-page .topnav { order: 3; flex-basis: 100%; display: flex; gap: 16px; overflow-x: auto; padding: 2px 0 4px; scrollbar-width: none; }
  .doc-page .topnav::-webkit-scrollbar { display: none; }
  .doc-page .topnav a { font-size: 12.5px; }
}
@media (max-width: 640px) {
  .prose { font-size: 16px; }
  .doc-cta { flex-direction: column; align-items: flex-start; }
  .doc-cta-actions { width: 100%; }
  .doc-cta-actions .btn { flex: 1 1 auto; }
}
