/* Pikkola Tools — a curated directory for async teams */

:root {
  --bg: #08090b;
  --bg-soft: #0b0d10;
  --surface: #0f1116;
  --surface-2: #12151b;
  --surface-3: #171b22;
  --border: rgba(255, 255, 255, .075);
  --border-mid: rgba(255, 255, 255, .11);
  --border-strong: rgba(255, 255, 255, .2);
  --text: #e9ecf1;
  --text-dim: #b6bcc6;
  --muted: #8d949f;
  --faint: #666e7a;
  --accent: #8f9bff;
  --accent-ink: #0a0b10;
  --accent-soft: rgba(143, 155, 255, .13);
  --accent-line: rgba(143, 155, 255, .34);
  --gold: #e6c07b;
  --gold-bg: rgba(230, 192, 123, .12);
  --good: #3ddc97;
  --good-bg: rgba(61, 220, 151, .13);
  --good-text: #a9f2d2;
  --warn: #efb45f;
  --warn-bg: rgba(239, 180, 95, .12);
  --warn-text: #f4d6a8;
  --bad: #f2777a;
  --bad-bg: rgba(242, 119, 122, .12);

  --shadow-card: 0 1px 0 rgba(255, 255, 255, .035) inset, 0 26px 50px -38px rgba(0, 0, 0, .9);
  --shadow-lift: 0 1px 0 rgba(255, 255, 255, .05) inset, 0 34px 60px -34px rgba(0, 0, 0, .95);
  --radius: 16px;
  --radius-sm: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial,
    "Apple SD Gothic Neo", "Noto Sans KR", "Hiragino Sans", "Yu Gothic", "Noto Sans JP", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

[data-theme="light"] {
  --bg: #fbfbfc;
  --bg-soft: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #fcfcfd;
  --surface-3: #f2f3f6;
  --border: rgba(12, 16, 26, .085);
  --border-mid: rgba(12, 16, 26, .13);
  --border-strong: rgba(12, 16, 26, .24);
  --text: #14171d;
  --text-dim: #3d434e;
  --muted: #646b77;
  --faint: #8b919c;
  --accent: #4f5bd5;
  --accent-soft: rgba(79, 91, 213, .09);
  --accent-line: rgba(79, 91, 213, .3);
  --gold: #8a5a09;
  --gold-bg: rgba(197, 138, 33, .14);
  --good: #109c68;
  --good-bg: rgba(16, 156, 104, .12);
  --good-text: #0a6b48;
  --warn: #b57612;
  --warn-bg: rgba(197, 138, 33, .14);
  --warn-text: #8a5a09;
  --bad: #c0393c;
  --bad-bg: rgba(192, 57, 60, .1);

  --shadow-card: 0 1px 0 rgba(255, 255, 255, .7) inset, 0 22px 44px -36px rgba(12, 16, 26, .42);
  --shadow-lift: 0 1px 0 rgba(255, 255, 255, .8) inset, 0 28px 50px -30px rgba(12, 16, 26, .3);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  word-break: keep-all;
  overflow-wrap: anywhere;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(1000px 460px at 50% -10%, rgba(143, 155, 255, .12), transparent 70%),
    radial-gradient(760px 380px at 92% 2%, rgba(61, 220, 151, .045), transparent 70%);
}
[data-theme="light"] body::before {
  background:
    radial-gradient(1000px 460px at 50% -10%, rgba(79, 91, 213, .075), transparent 70%),
    radial-gradient(760px 380px at 92% 2%, rgba(16, 156, 104, .035), transparent 70%);
}

.wrap { width: min(1180px, 100% - 40px); margin-inline: auto; position: relative; z-index: 1; }
.narrow { width: min(780px, 100% - 40px); }

a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.028em; line-height: 1.15; }
p { margin: 0; }
button { font: inherit; color: inherit; }
svg { display: block; }
[hidden] { display: none !important; }

.visually-hidden {
  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: 60;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 8px;
  font-size: 13px; font-weight: 600; transition: top .15s ease;
}
.skip-link:focus { top: 12px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

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

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; gap: 20px; height: 60px; }

.brand { display: inline-flex; align-items: center; gap: 9px; letter-spacing: -0.02em; flex: none; }
.brand-mark { width: 24px; height: 24px; color: var(--accent); flex: none; }
.brand-name { font-size: 16px; font-weight: 620; letter-spacing: -0.02em; }
.brand-tool {
  font-size: 11.5px; font-weight: 560; color: var(--muted); letter-spacing: .05em;
  padding: 2px 7px; border: 1px solid var(--border-mid); border-radius: 6px;
  text-transform: uppercase; line-height: 1.5;
}

.site-nav { display: flex; gap: 2px; margin-left: 6px; }
.site-nav a {
  font-size: 13.5px; color: var(--muted); padding: 7px 10px; border-radius: 8px;
  transition: color .15s ease, background .15s ease;
}
.site-nav a:hover { color: var(--text); background: var(--surface-3); }

.header-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.lang-switch {
  display: flex; align-items: center; gap: 2px; padding: 3px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
}
.lang-btn {
  border: 0; background: transparent; color: var(--muted);
  font-size: 11.5px; font-weight: 550; letter-spacing: .01em;
  padding: 4px 7px; border-radius: 7px; cursor: pointer; transition: .15s ease;
}
.lang-btn:hover { color: var(--text); }
.lang-btn[aria-pressed="true"] { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 0 var(--border) inset; }

.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-dim);
  border-radius: 10px; cursor: pointer; transition: .15s ease; flex: none;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }
.icon-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ico-sun { display: none; }
[data-theme="light"] .ico-sun { display: block; }
[data-theme="light"] .ico-moon { display: none; }

/* ---------- hero ---------- */

.hero { padding: 54px 0 8px; }
.hero .eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11px; letter-spacing: .11em; text-transform: uppercase;
  color: var(--muted); font-weight: 570;
}
.eyebrow .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px var(--good-bg); }
.hero h1 {
  margin-top: 14px; text-wrap: balance;
  font-size: clamp(2rem, 1.25rem + 3vw, 3.35rem);
  max-width: 24ch; letter-spacing: -0.036em;
}
.hero h1 em { font-style: normal; color: var(--accent); }
.hero .lede { margin-top: 16px; max-width: 66ch; color: var(--muted); font-size: 15.5px; line-height: 1.65; }
.hero .lede b { color: var(--text-dim); font-weight: 550; }

.search-row { margin-top: 26px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.search-box {
  position: relative; flex: 1 1 420px; max-width: 560px;
  display: flex; align-items: center;
  background: var(--surface); border: 1px solid var(--border-mid); border-radius: 12px;
  box-shadow: var(--shadow-card); transition: border-color .15s ease, box-shadow .15s ease;
}
.search-box:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 4px var(--accent-soft); }
.search-box .s-ico {
  width: 17px; height: 17px; margin-left: 14px; flex: none; color: var(--faint);
  fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round;
}
.search-box input {
  flex: 1 1 auto; min-width: 0; border: 0; background: transparent; color: var(--text);
  padding: 13px 10px; font-family: inherit; font-size: 14.5px; outline: none;
}
.search-box input::placeholder { color: var(--faint); }
.search-box .kbd {
  margin-right: 12px; flex: none; font-family: var(--mono); font-size: 11px; color: var(--faint);
  border: 1px solid var(--border-mid); border-radius: 5px; padding: 1px 6px; line-height: 1.5;
}
.search-clear {
  margin-right: 8px; flex: none; width: 24px; height: 24px; border: 0; border-radius: 50%;
  background: var(--surface-3); color: var(--muted); cursor: pointer; display: none; place-items: center;
}
.search-clear svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.search-box.has-value .search-clear { display: grid; }
.search-box.has-value .kbd { display: none; }

.quick-chips { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.quick-chip {
  border: 1px solid var(--border); background: transparent; color: var(--muted);
  font-size: 12px; font-weight: 520; padding: 6px 10px; border-radius: 999px;
  cursor: pointer; transition: .15s ease; white-space: nowrap;
}
.quick-chip:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface-3); }
.quick-chip[aria-pressed="true"] {
  color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft);
}

.hero-stats {
  margin-top: 20px; display: flex; align-items: center; gap: 8px 18px; flex-wrap: wrap;
  font-size: 12.5px; color: var(--faint);
}
.hero-stats b { color: var(--text-dim); font-weight: 600; }
.hero-stats .sep { width: 3px; height: 3px; border-radius: 50%; background: var(--border-strong); }

/* ---------- shelf banner ---------- */

.shelf { margin-top: 38px; }
.shelf-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.shelf-head h2 { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.shelf-head span { font-size: 12px; color: var(--faint); }
.shelf-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.book {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px 12px 12px;
  border: 1px solid var(--border); border-radius: 13px; background: var(--surface);
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}
.book:hover { border-color: var(--border-strong); background: var(--surface-2); transform: translateY(-1px); }
.book img { width: 42px; height: 42px; border-radius: 7px; object-fit: cover; flex: none; border: 1px solid var(--border); }
.book .b-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.book .b-title { font-size: 13px; font-weight: 570; letter-spacing: -0.012em; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.book .b-sub { font-size: 11.5px; color: var(--faint); margin-top: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.book .b-price {
  margin-left: auto; flex: none; font-size: 11px; font-weight: 620; color: var(--gold);
  background: var(--gold-bg); border: 1px solid color-mix(in srgb, var(--gold) 32%, transparent);
  padding: 2px 7px; border-radius: 6px; font-variant-numeric: tabular-nums;
}

/* ---------- filter bar ---------- */

.filterbar {
  position: sticky; top: 60px; z-index: 40; margin-top: 0;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(16px);
  -webkit-backdrop-filter: saturate(1.4) blur(16px);
  border-block: 1px solid var(--border);
}
.library-shell { position: relative; }
.library-shell > .filterbar:first-child { margin-top: 34px; }
.filterbar-inner { display: flex; align-items: center; gap: 10px; min-height: 58px; padding: 8px 0; }

.tabs {
  display: flex; align-items: center; gap: 2px; overflow-x: auto; scrollbar-width: none;
  flex: 1 1 auto; min-width: 0; margin: 0 -4px; padding: 0 4px;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs { -webkit-mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 22px), transparent 100%);
  mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 22px), transparent 100%); }
.tab {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  font-size: 13px; font-weight: 540; padding: 7px 11px; border-radius: 8px;
  transition: color .15s ease, background .15s ease; white-space: nowrap;
}
.tab:hover { color: var(--text); background: var(--surface-3); }
.tab[aria-current="page"], .tab[aria-pressed="true"] { color: var(--text); background: var(--surface-3); }
.tab .tab-count {
  font-size: 10.5px; color: var(--faint); font-variant-numeric: tabular-nums;
  border: 1px solid var(--border); border-radius: 5px; padding: 0 4px; line-height: 1.5;
}
.tab[aria-current="page"] .tab-count, .tab[aria-pressed="true"] .tab-count { color: var(--text-dim); border-color: var(--border-mid); }

.filter-tools { display: flex; align-items: center; gap: 6px; margin-left: auto; flex: none; }
.seg {
  display: inline-flex; padding: 2px; gap: 2px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 9px;
}
.seg button {
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  font-size: 11.5px; font-weight: 550; padding: 4px 8px; border-radius: 7px; transition: .15s ease; white-space: nowrap;
}
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 0 var(--border) inset; }

.saved-toggle {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  font-size: 12px; font-weight: 540; padding: 5px 9px; border-radius: 9px; transition: .15s ease;
}
.saved-toggle:hover { color: var(--text); border-color: var(--border-strong); }
.saved-toggle[aria-pressed="true"] { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }
.saved-toggle svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.saved-toggle[aria-pressed="true"] svg { fill: currentColor; }
.saved-toggle .n { font-variant-numeric: tabular-nums; }

/* ---------- library ---------- */

.library { padding-top: 22px; }
.result-line {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  min-height: 22px; margin-bottom: 12px;
  font-size: 12.5px; color: var(--faint);
}
.result-line b { color: var(--text-dim); font-weight: 600; font-variant-numeric: tabular-nums; }
.result-line .clear-filters {
  margin-left: auto; border: 0; background: transparent; color: var(--muted);
  font-size: 12px; cursor: pointer; padding: 2px 4px; border-radius: 5px;
}
.result-line .clear-filters:hover { color: var(--text); background: var(--surface-3); }

.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }

.tcard {
  position: relative; display: flex; flex-direction: column; gap: 11px;
  padding: 16px 16px 14px; border: 1px solid var(--border); border-radius: 14px;
  background: var(--surface); box-shadow: var(--shadow-card);
  transition: border-color .16s ease, transform .16s ease, box-shadow .16s ease, background .16s ease;
}
.tcard:hover { border-color: var(--border-strong); transform: translateY(-2px); box-shadow: var(--shadow-lift); background: var(--surface-2); }
.tcard.is-certified { border-color: color-mix(in srgb, var(--accent) 22%, var(--border)); }
.tcard-head { display: flex; align-items: flex-start; gap: 11px; }
.tlogo {
  width: 38px; height: 38px; flex: none; border-radius: 10px;
  display: grid; place-items: center; font-weight: 650; font-size: 15px; letter-spacing: -0.02em;
  color: hsl(var(--h) 70% 82%); background: hsl(var(--h) 46% 18% / .75);
  border: 1px solid hsl(var(--h) 52% 46% / .3);
}
[data-theme="light"] .tlogo {
  color: hsl(var(--h) 58% 32%); background: hsl(var(--h) 68% 94%);
  border-color: hsl(var(--h) 46% 62% / .34);
}
.tname-wrap { min-width: 0; flex: 1 1 auto; padding-top: 1px; }
.tname { font-size: 14.5px; font-weight: 590; letter-spacing: -0.018em; line-height: 1.3; }
.tname a { display: inline-flex; align-items: center; gap: 5px; }
.tname a:hover { color: var(--accent); }
.thost { display: block; margin-top: 2px; font-family: var(--mono); font-size: 10.5px; color: var(--faint); letter-spacing: -0.01em; }

.save-btn {
  width: 28px; height: 28px; flex: none; display: grid; place-items: center;
  border: 1px solid transparent; background: transparent; color: var(--muted);
  border-radius: 7px; cursor: pointer; transition: .15s ease;
}
.save-btn:hover { color: var(--text); background: var(--surface-3); border-color: var(--border); }
.save-btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.save-btn[aria-pressed="true"] { color: var(--accent); }
.save-btn[aria-pressed="true"] svg { fill: currentColor; stroke: var(--accent); }

.ttag { font-size: 12.8px; line-height: 1.55; color: var(--muted); flex: 1 1 auto; }
.ttag mark { background: var(--accent-soft); color: var(--text); border-radius: 3px; padding: 0 1px; }

.tmeta { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; font-weight: 540; letter-spacing: .005em; line-height: 1.6;
  padding: 1px 6px; border-radius: 5px; border: 1px solid var(--border);
  background: var(--surface-3); color: var(--muted); white-space: nowrap;
}
.pill.price-free { color: var(--good-text); background: var(--good-bg); border-color: color-mix(in srgb, var(--good) 28%, transparent); }
.pill.price-freemium { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-line); }
.pill.price-paid { color: var(--warn-text); background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 28%, transparent); }
.pill.cert {
  color: var(--gold); background: var(--gold-bg);
  border-color: color-mix(in srgb, var(--gold) 34%, transparent); font-weight: 600;
}
.pill.cert svg { width: 9px; height: 9px; fill: currentColor; }
.pill.cat { border-style: dashed; }
.tplats { font-size: 10.5px; color: var(--faint); margin-left: auto; white-space: nowrap; }

.empty {
  grid-column: 1 / -1; display: grid; place-items: center; gap: 10px; text-align: center;
  padding: 54px 20px; border: 1px dashed var(--border-strong); border-radius: 14px; color: var(--muted);
}
.empty svg { width: 26px; height: 26px; fill: none; stroke: var(--faint); stroke-width: 1.6; stroke-linecap: round; }
.empty h3 { font-size: 15px; color: var(--text-dim); }
.empty p { font-size: 13px; max-width: 46ch; }
.empty button {
  margin-top: 4px; border: 1px solid var(--border-mid); background: var(--surface-3);
  color: var(--text); font-size: 12.5px; font-weight: 540; padding: 6px 12px; border-radius: 8px; cursor: pointer;
}
.empty button:hover { border-color: var(--border-strong); }

.section-more { display: flex; justify-content: center; margin-top: 18px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 14px; border-radius: 9px; border: 1px solid var(--border-mid);
  background: var(--surface); color: var(--text-dim);
  font-size: 13px; font-weight: 540; cursor: pointer; transition: .15s ease; white-space: nowrap;
}
.btn:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface-3); }
.btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.btn-primary { background: var(--text); color: var(--bg); border-color: transparent; font-weight: 600; }
.btn-primary:hover { color: var(--bg); opacity: .92; background: var(--text); }

/* ---------- ebook section ---------- */

.books-section { padding: 62px 0 0; }
.books-section .shelf-head { margin-bottom: 14px; }
.books-section .shelf-head h2 { font-size: 12px; }
.books-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.bookcard {
  display: flex; flex-direction: column; padding: 18px; border-radius: 14px;
  border: 1px solid var(--border); background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  box-shadow: var(--shadow-card); transition: border-color .15s ease, transform .15s ease;
}
.bookcard:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.bookcard .cover { display: flex; align-items: center; gap: 12px; }
.bookcard .cover > span:last-child { min-width: 0; display: block; }
.bookcard img { width: 54px; height: 54px; border-radius: 8px; object-fit: cover; border: 1px solid var(--border-mid); }
.bookcard .b-kind { display: block; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); font-weight: 600; }
.bookcard .b-title { display: block; font-size: 15px; font-weight: 580; letter-spacing: -0.02em; margin-top: 3px; line-height: 1.3; }
.bookcard p { margin-top: 12px; font-size: 12.8px; line-height: 1.6; color: var(--muted); flex: 1 1 auto; }
.bookcard .b-foot { margin-top: 14px; display: flex; align-items: center; gap: 8px; }
.bookcard .b-price {
  font-size: 11.5px; font-weight: 620; color: var(--gold);
  background: var(--gold-bg); border: 1px solid color-mix(in srgb, var(--gold) 32%, transparent);
  padding: 2px 8px; border-radius: 6px;
}
.bookcard .b-link { margin-left: auto; font-size: 12.5px; font-weight: 550; color: var(--text-dim); display: inline-flex; align-items: center; gap: 4px; }
.bookcard:hover .b-link { color: var(--accent); }
.bookcard .b-link svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; flex: none; }
.bookcard .b-link { display: inline-flex; align-items: center; gap: 4px; }

/* ---------- categories ---------- */

.cat-section { padding: 66px 0 0; }
.cat-head { display: flex; align-items: flex-end; gap: 20px; flex-wrap: wrap; }
.cat-head h2 { font-size: clamp(1.35rem, 1.05rem + 1vw, 1.8rem); }
.cat-head p { color: var(--muted); font-size: 13.5px; max-width: 60ch; margin-left: auto; }
.cat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; margin-top: 22px;
  background: var(--border); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.cat-link { background: var(--surface); padding: 18px 18px 20px; transition: background .15s ease; display: block; }
.cat-link:hover { background: var(--surface-3); }
.cat-link .c-top { display: flex; align-items: center; gap: 8px; }
.cat-link h3 { font-size: 14.5px; letter-spacing: -0.015em; }
.cat-link .c-count {
  margin-left: auto; font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums;
  border: 1px solid var(--border); border-radius: 5px; padding: 0 5px;
}
.cat-link p { margin-top: 8px; font-size: 12.5px; line-height: 1.6; color: var(--muted); }
.cat-link .c-go { margin-top: 10px; font-size: 12px; color: var(--faint); display: flex; align-items: center; gap: 4px; }
.cat-link:hover .c-go { color: var(--accent); }
.cat-link .c-go svg { width: 11px; height: 11px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

/* category nav on a shelf page */
.cat-nav-grid a {
  display: flex; align-items: center; gap: 10px; background: var(--surface);
  padding: 15px 17px; transition: background .15s ease, color .15s ease;
}
.cat-nav-grid a:hover { background: var(--surface-3); }
.cat-nav-grid a > span:first-child { font-size: 13.5px; font-weight: 570; letter-spacing: -0.012em; }
.cat-nav-grid a[aria-current="page"] { background: var(--surface-3); color: var(--accent); }
.cat-nav-grid a[aria-current="page"] > span:first-child::before {
  content: ""; display: inline-block; width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent); margin-right: 7px; vertical-align: 2px;
}
.c-count {
  margin-left: auto; font-size: 10.5px; color: var(--faint); font-variant-numeric: tabular-nums;
  border: 1px solid var(--border); border-radius: 5px; padding: 0 5px; white-space: nowrap;
}
.faint { color: var(--faint); font-weight: 400; }
.site-nav a.is-current { color: var(--text); background: var(--surface-3); }

/* ---------- editorial / notice ---------- */

.editorial { padding: 66px 0 0; }
.editorial-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 34px; align-items: start; margin-top: 22px; }
.editorial h2 { font-size: clamp(1.35rem, 1.05rem + 1vw, 1.8rem); max-width: 24ch; }
.editorial p { margin-top: 14px; font-size: 14px; line-height: 1.75; color: var(--muted); }
.editorial p b { color: var(--text-dim); font-weight: 560; }
.principles { display: flex; flex-direction: column; gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.principle { background: var(--surface); padding: 15px 17px; display: flex; gap: 11px; align-items: flex-start; }
.principle .ic { width: 26px; height: 26px; flex: none; border-radius: 7px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.principle .ic svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.principle h3 { font-size: 13px; letter-spacing: -0.01em; }
.principle p { margin-top: 3px; font-size: 12.5px; line-height: 1.6; color: var(--faint); }

/* ---------- faq ---------- */

.faq { padding: 62px 0 0; }
.faq-list { margin-top: 20px; border-top: 1px solid var(--border); }
.faq-list details { border-bottom: 1px solid var(--border); }
.faq-list summary {
  cursor: pointer; padding: 15px 30px 15px 2px; font-size: 14px; font-weight: 550;
  list-style: none; position: relative;
}
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after {
  content: "+"; position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  color: var(--faint); font-size: 17px; font-weight: 400; transition: .2s ease;
}
.faq-list details[open] summary::after { content: "–"; }
.faq-list p { padding: 0 40px 17px 2px; color: var(--muted); font-size: 13.3px; line-height: 1.72; max-width: 92ch; }

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

.site-footer { margin-top: 76px; border-top: 1px solid var(--border); background: var(--bg-soft); }
.footer-inner { display: flex; flex-wrap: wrap; gap: 18px 28px; align-items: flex-start; padding: 36px 0 40px; }
.footer-brand { display: flex; flex-direction: column; gap: 7px; max-width: 34ch; }
.footer-brand .brand-name { font-size: 14px; }
.footer-brand p { font-size: 12.5px; color: var(--faint); line-height: 1.6; }
.footer-brand a { color: var(--muted); }
.footer-brand a:hover { color: var(--text); }
.footer-nav { margin-left: auto; display: flex; gap: 30px; flex-wrap: wrap; }
.footer-col { display: flex; flex-direction: column; gap: 7px; }
.footer-col h4 {
  font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint);
  font-weight: 600; margin: 0 0 2px;
}
.footer-col a { font-size: 12.5px; color: var(--muted); }
.footer-col a:hover { color: var(--text); }
.footer-fine { font-size: 12px; color: var(--faint); width: 100%; margin-top: 8px; display: flex; gap: 14px; flex-wrap: wrap; }
.footer-fine span { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- doc pages ---------- */

.doc { padding: 50px 0 0; max-width: 760px; }
.doc .crumb { font-size: 12px; color: var(--faint); margin-bottom: 14px; }
.doc .crumb a:hover { color: var(--text); }
.doc h1 { font-size: clamp(1.7rem, 1.3rem + 1.4vw, 2.35rem); }
.doc .updated { margin-top: 10px; font-size: 12.5px; color: var(--faint); }
.doc h2 { font-size: 15.5px; margin: 30px 0 8px; letter-spacing: -0.015em; }
.doc p, .doc li { font-size: 14px; color: var(--text-dim); line-height: 1.75; }
.doc p + p { margin-top: 10px; }
.doc ul { margin: 10px 0 0; padding-left: 20px; }
.doc li + li { margin-top: 4px; }
.doc a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.doc .lede-doc { margin-top: 18px; font-size: 14.5px; color: var(--muted); }
.doc .doc-note {
  margin-top: 14px; padding: 6px 11px; font-size: 12px; color: var(--faint);
  border-left: 2px solid var(--border-strong); background: var(--bg-soft); border-radius: 0 6px 6px 0;
}
.doc code { font-family: var(--mono); font-size: 12.5px; background: var(--surface-3); padding: 1px 5px; border-radius: 4px; }

/* category page hero */
.cat-hero { padding: 42px 0 4px; }
.cat-hero .eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11px; letter-spacing: .11em; text-transform: uppercase; color: var(--muted); font-weight: 570;
}
.cat-hero h1 { margin-top: 12px; font-size: clamp(1.85rem, 1.3rem + 2vw, 2.6rem); max-width: 26ch; }
.cat-hero .lede { margin-top: 13px; max-width: 74ch; color: var(--muted); font-size: 14.5px; line-height: 1.7; }
.cat-hero .cat-back { margin-top: 16px; font-size: 12.5px; color: var(--faint); }
.cat-hero .cat-back a:hover { color: var(--text); }
.cat-note {
  margin-top: 30px; padding: 16px 18px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--bg-soft); font-size: 13px; line-height: 1.7; color: var(--muted);
}
.cat-note b { color: var(--text-dim); font-weight: 560; }

/* ---------- toast ---------- */

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 8px);
  background: var(--text); color: var(--bg); padding: 9px 14px; border-radius: 9px;
  font-size: 12.5px; font-weight: 550; z-index: 90; opacity: 0; pointer-events: none;
  transition: opacity .18s ease, transform .18s ease; box-shadow: 0 16px 40px -16px rgba(0, 0, 0, .6);
  max-width: min(90vw, 460px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.noscript {
  margin: 18px auto; max-width: 760px; padding: 12px 16px; font-size: 13px;
  border: 1px solid var(--warn-bg); background: var(--warn-bg); color: var(--warn-text);
  border-radius: 10px; text-align: center;
}

/* ---------- responsive ---------- */

@media (max-width: 1020px) {
  .cards, .shelf-grid, .books-grid, .cat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .editorial-grid { grid-template-columns: 1fr; gap: 26px; }
  .cat-head p { margin-left: 0; }
}

@media (max-width: 860px) {
  .site-nav { display: none; }
  .filterbar-inner { flex-wrap: wrap; }
  .tabs { order: 1; width: 100%; }
  .filter-tools { order: 2; margin-left: 0; width: 100%; justify-content: space-between; }
  .filterbar { top: 56px; }
}

@media (max-width: 760px) {
  .wrap { width: calc(100% - 24px); }
  .header-inner { height: 56px; gap: 8px; }
  .brand-tool { display: none; }
  .lang-switch { padding: 2px; }
  .lang-btn { padding: 4px 6px; font-size: 11px; }
  .hero { padding: 34px 0 4px; }
  .hero h1 { font-size: clamp(1.75rem, 1.4rem + 3.4vw, 2.4rem); }
  .hero .lede { font-size: 14px; }
  .search-row { margin-top: 20px; }
  .search-box { flex-basis: 100%; max-width: none; }
  .shelf { margin-top: 28px; }
  .shelf-grid, .cards, .books-grid, .cat-grid { grid-template-columns: 1fr; }
  .book { padding: 11px 12px; }
  .book img { width: 38px; height: 38px; }
  .filterbar { margin-top: 24px; }
  .tcard { padding: 14px; }
  .cat-head p { font-size: 13px; }
  .editorial, .faq, .cat-section, .books-section { padding-top: 50px; }
  .footer-nav { margin-left: 0; gap: 24px; }
  .doc { padding-top: 34px; }
}

@media print {
  .site-header, .filterbar, .shelf, .books-section, .site-footer, .faq { display: none !important; }
}

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