/* thinkrlabs — "bench logbook", dark. Tokens: docs/PLAN.md §7.1 */
:root {
  --bg: #0E1012;
  --surface: #16191C;
  --border: #262A2F;
  --border-strong: #2E3338;
  --divider: #23272C;
  --text: #ECEAE5;
  --text-2: #C4C7CB;
  --muted: #8E949B;
  --accent: #FFB000;
  --on-accent: #0E1012;
  --hatch: repeating-linear-gradient(135deg, #191C20 0 10px, #1F2327 10px 20px);
  --sans: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Space Grotesk", var(--sans);
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
ul { margin: 0; padding: 0; list-style: none; }
p { margin: 0; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.hatch { background: var(--hatch); }
.mono { font-family: var(--mono); }

.skip {
  position: absolute; left: 16px; top: -100px; z-index: 10;
  background: var(--accent); color: var(--on-accent);
  padding: 12px 16px; border-radius: 10px; font-weight: 600;
}
.skip:focus { top: 12px; }

.wrap { max-width: 520px; margin: 0 auto; padding: 0 16px 40px; }

/* --- Header ------------------------------------------------------------- */
.masthead { padding-top: 28px; display: flex; flex-direction: column; gap: 14px; }
.brand-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wordmark {
  margin: 0; display: flex; align-items: center; gap: 3px;
  font: 600 24px/1 var(--mono); letter-spacing: -0.02em;
}
.cursor { display: inline-block; width: 11px; height: 24px; background: var(--accent); }
@media (prefers-reduced-motion: no-preference) {
  .cursor { animation: blink 1.1s steps(1) infinite; }
  @keyframes blink { 50% { opacity: 0; } }
}
.domain { font: 500 11px var(--mono); color: var(--muted); letter-spacing: 0.06em; }
.tagline { color: var(--text-2); }

/* Visually small chips extend their hit area to 44px (PLAN §7.5) */
.pill, .chip { position: relative; }
.pill::before, .chip::before { content: ""; position: absolute; left: 0; right: 0; }

.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  display: inline-flex; align-items: center; height: 36px; padding: 0 14px;
  font: 500 12px var(--mono);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 999px;
}
.pill::before { inset: -4px 0; }
.pill.soon { background: none; border-style: dashed; color: var(--muted); }
.pill:hover { border-color: var(--muted); }

.tabs { display: flex; gap: 24px; margin-top: 6px; border-bottom: 1px solid var(--divider); }
.tab {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0;
  font-size: 14px; font-weight: 500; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab[aria-current="page"] { color: var(--text); font-weight: 600; border-bottom-color: var(--accent); }
/* Without JS no tab is "current"; all views are stacked below */

/* --- Views -------------------------------------------------------------- */
.view-title {
  margin: 40px 0 0; font: 600 11px var(--mono); letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted);
}
.view:first-child .view-title { margin-top: 28px; }
.js .view-title {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.js .view:not(.active) { display: none; }
/* With JS, #feed/#featured/#topics select a tab; keep the page at the top */
.js .view { scroll-margin-top: 100vh; }
#featured .products, #topics .rows { margin-top: 28px; }
.empty { padding: 28px 0; color: var(--muted); }

.filter {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 16px; padding-left: 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  font-size: 14px; color: var(--text-2);
}
.filter[hidden] { display: none; }
.filter-tag { font-family: var(--mono); color: var(--text); }
.filter-clear {
  min-height: 44px; padding: 0 14px; background: none; border: 0; cursor: pointer;
  font-weight: 600; color: var(--accent);
}

/* --- Entry -------------------------------------------------------------- */
.entry {
  padding: 28px 0 28px; display: flex; flex-direction: column; gap: 16px;
  border-bottom: 1px solid var(--divider);
}
.entry[hidden] { display: none; }
.meta {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font: 500 11px var(--mono); letter-spacing: 0.08em; color: var(--muted);
}
.log { color: var(--accent); }

.media {
  position: relative; display: block; overflow: hidden;
  border: 1px solid var(--divider); border-radius: 14px;
}
.media img { width: 100%; height: 100%; object-fit: cover; }
.media-tall { aspect-ratio: 4 / 5; }
.media-yt { aspect-ratio: 16 / 9; }
.media iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.play, .play-yt {
  position: absolute; left: 50%; top: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(236, 234, 229, 0.92); color: var(--bg);
}
.play { width: 64px; height: 64px; margin: -32px 0 0 -32px; border-radius: 50%; }
.play-yt { width: 64px; height: 44px; margin: -22px 0 0 -32px; border-radius: 12px; }
.media:hover .play, .media:hover .play-yt { background: var(--text); }
.watch {
  position: absolute; left: 12px; bottom: 12px;
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px;
  background: var(--bg); border: 1px solid var(--border-strong); border-radius: 999px;
  font-size: 13px; font-weight: 600;
}

.body { display: flex; flex-direction: column; gap: 8px; }
.title {
  margin: 0; font: 600 24px/1.15 var(--display); letter-spacing: -0.015em;
}
.text { color: var(--text-2); }
.text p + p { margin-top: 8px; }
.text a { color: var(--text); text-decoration: underline; text-underline-offset: 2px; }
.text code { font: 500 13px var(--mono); }

.chips { display: flex; flex-wrap: wrap; gap: 14px 6px; margin-top: 2px; }
.chip {
  display: inline-flex; align-items: center; height: 30px; padding: 0 10px;
  font: 500 12px var(--mono); color: var(--muted);
  border: 1px solid var(--border); border-radius: 6px;
}
.chip::before { inset: -7px 0; }
.chip:hover { color: var(--text); border-color: var(--border-strong); }

.block { display: flex; flex-direction: column; gap: 8px; }
.label { font: 500 11px var(--mono); letter-spacing: 0.1em; color: var(--muted); }

.rows { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.rows li + li { border-top: 1px solid var(--divider); }
.row {
  display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 14px 16px;
}
.row:hover .row-label { text-decoration: underline; text-underline-offset: 3px; }
.row-text { flex: 1; min-width: 0; }
.row-label { display: block; font-weight: 600; overflow-wrap: anywhere; }
.row-note { display: block; margin-top: 2px; font-size: 13px; color: var(--muted); }
.row-label.topic { flex: 1; font: 500 14px var(--mono); }
.count { font: 500 12px var(--mono); color: var(--muted); }
.icon { flex: none; }
.icon.muted { color: var(--muted); }

.products { display: flex; flex-direction: column; gap: 8px; }
.product {
  display: flex; align-items: center; gap: 12px; padding: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
}
.product-img { flex: none; width: 64px; height: 64px; border-radius: 8px; object-fit: cover; }
.product-text { flex: 1; min-width: 0; }
.product-name { font-weight: 600; line-height: 1.3; }
.product-note { margin-top: 2px; font-size: 13px; line-height: 1.35; color: var(--muted); }
.product:has(.seen-in) { flex-wrap: wrap; row-gap: 12px; }
.seen-in {
  flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 14px 6px;
  padding-top: 12px; border-top: 1px solid var(--divider);
}
.seen-label { font: 500 11px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.buy { flex: none; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.amazon {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px;
  background: var(--accent); color: var(--on-accent); border-radius: 10px;
  font-size: 13px; font-weight: 600;
}
.amazon:hover { background: #FFC233; }
.amazon:focus-visible { outline-color: var(--text); }
.paid { font: 500 10px var(--mono); letter-spacing: 0.06em; color: var(--muted); }

/* --- Pagination & footer ------------------------------------------------ */
.more { padding: 24px 0; text-align: center; }
.more:has(.older[hidden]) { display: none; }
.older {
  min-height: 44px; padding: 0 20px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 999px;
  font-size: 14px; font-weight: 500;
}
.older:hover { border-color: var(--muted); }
.older[hidden] { display: none; }

.footer {
  margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--divider);
  display: flex; flex-direction: column; gap: 8px;
  font-size: 12px; line-height: 1.5; color: var(--muted);
}
.footer .mono { font-size: 11px; }
