/* =========================================================
   SpiderWebX — blog ("Field Notes") + articles (+ shared post cards)
   ========================================================= */

/* ---------- shared post card (home teaser uses this too) ---------- */
.post-card { position: relative; display: grid; gap: 16px; align-content: start; }
.post-card .cover { position: relative; aspect-ratio: 3 / 2; border-radius: 18px; overflow: hidden; background: #000; isolation: isolate; }
.cover svg { width: 100%; height: 100%; }
.cover .cw { transform-origin: var(--ox) var(--oy); transition: transform 1.6s var(--ease-out); }
.cover .cr { transition: opacity 0.6s; }
.post-card:hover .cover .cw, .post-card:focus-within .cover .cw { transform: rotate(8deg) scale(1.08); }
.post-card .cover::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); pointer-events: none; }
.post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; color: var(--muted); font-size: var(--fs-xs); }
.post-meta .tag { height: 28px; padding: 0 12px; color: var(--fg); }
.post-card h3, .post-card h2 { font-size: clamp(1.25rem, 1.1rem + 0.55vw, 1.6rem); font-weight: 600; line-height: 1.15; font-variation-settings: "wdth" 100; transition: color 0.3s; text-wrap: balance; }
.post-card :is(h2, h3) a::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.post-card:hover :is(h2, h3) { color: var(--accent); }
.post-card p { color: var(--muted); font-size: var(--fs-sm); max-width: 52ch; }
.post-card :is(h2, h3) a:focus-visible { outline: none; }
.post-card:has(:is(h2, h3) a:focus-visible) { outline: 2px solid var(--accent); outline-offset: 6px; border-radius: 18px; }
.read-more { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-sm); font-weight: 600; }

/* =========================================================
   Blog index — paper masthead, sticky topic bar, magazine list
   ========================================================= */
:is(.mag, .rel-grid, .mast-feat) .post-card .tag { height: auto; padding: 0; border: 0; background: none; color: var(--accent); font-weight: 600; }

/* masthead */
.b-mast { padding: calc(var(--nav-h) + clamp(18px, 4vw, 56px)) 0 clamp(36px, 5vw, 72px); }
.mast-head { display: grid; gap: 14px 48px; align-items: end; padding-bottom: clamp(16px, 2.4vw, 28px); margin-bottom: clamp(20px, 3.4vw, 44px); border-bottom: 2px solid var(--fg); }
@media (min-width: 900px) { .mast-head { grid-template-columns: 1fr minmax(0, 34ch); } }
.mast-title { font-size: clamp(3.2rem, 1.2rem + 9vw, 9.5rem); font-weight: 800; line-height: 0.86; letter-spacing: -0.045em; }
.mast-by { margin-top: clamp(10px, 1.4vw, 18px); color: var(--muted); font-size: clamp(1rem, 0.9rem + 0.5vw, 1.375rem); }
.mast-by strong { color: var(--fg); font-family: var(--font-display); font-weight: 700; }
.mast-desc { color: var(--muted); font-size: var(--fs-body); line-height: 1.5; max-width: 40ch; }

/* featured article */
.is-feat { gap: 14px; }
.is-feat .cover { aspect-ratio: 16 / 10; border-radius: 16px; }
.is-feat h2 { font-size: clamp(1.55rem, 1.1rem + 2.2vw, 3.4rem); font-weight: 700; line-height: 1.06; letter-spacing: -0.015em; max-width: 22ch; }
.is-feat p { font-size: var(--fs-body); line-height: 1.5; max-width: 46ch; }
.is-feat .read-more { color: var(--fg); text-decoration: underline; text-decoration-color: var(--venom); text-decoration-thickness: 2px; text-underline-offset: 6px; }
@media (max-width: 699px) {
  .is-feat p { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .is-feat .read-more { display: none; }
}
@media (min-width: 900px) {
  .is-feat { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); grid-template-rows: 1fr auto auto auto auto; column-gap: clamp(36px, 4vw, 64px); row-gap: 18px; }
  .is-feat .cover { grid-column: 1; grid-row: 1 / -1; border-radius: 20px; }
  .is-feat > :not(.cover) { grid-column: 2; }
  .is-feat .post-meta { grid-row: 2; }
  .is-feat h2 { grid-row: 3; }
  .is-feat p { grid-row: 4; }
  .is-feat .read-more { grid-row: 5; margin-top: 6px; }
}

/* sticky topic bar */
.b-list { padding: 0 0 clamp(80px, 11vw, 150px); min-height: 100vh; min-height: 100svh; }
.b-bar {
  position: sticky; top: var(--nav-h); z-index: 60;
  background: var(--bg);
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  transition: transform 0.6s var(--ease-out), background-color 0.6s;
}
/* blog list: solid header so nothing ghosts through while scrolling */
body[data-page="blog"] .nav.is-scrolled { background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; }
.b-bar.stuck { border-top-color: transparent; }
body[data-page="blog"] .nav.is-hidden { transform: translateY(-100%); } /* same distance as the bar, so they slide as one */
body:has(.nav.is-hidden) .b-bar.stuck { transform: translateY(calc(-1 * var(--nav-h))); }
.bar-in { display: flex; flex-wrap: wrap; align-items: center; column-gap: 8px; }
.tabs {
  position: relative; flex: 1; min-width: 0; display: flex;
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain;
  margin-left: -10px;
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
}
.tabs.scrolled { -webkit-mask-image: linear-gradient(90deg, transparent, #000 28px, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(90deg, transparent, #000 28px, #000 calc(100% - 28px), transparent); }
.tabs::-webkit-scrollbar { display: none; }
.filter { flex: none; height: 54px; padding: 0 10px; color: var(--muted); font-size: var(--fs-sm); font-weight: 500; white-space: nowrap; transition: color 0.3s; }
.filter:hover, .filter[aria-pressed="true"] { color: var(--fg); }
.filter sup { font-size: 0.7em; margin-left: 3px; opacity: 0.6; }
.filter:last-of-type { margin-right: 24px; }
.tab-ink { position: absolute; left: 0; bottom: 0; width: 1px; height: 2px; background: var(--venom); transform-origin: 0 0; transform: translateX(var(--x, 10px)) scaleX(var(--w, 0)); pointer-events: none; }
.tab-ink.go { transition: transform 0.55s var(--ease-out); }
.bar-find { flex: none; width: 44px; height: 44px; margin-right: -8px; display: grid; place-items: center; border-radius: 50%; color: var(--fg); transition: background-color 0.3s; }
.bar-find svg { width: 20px; height: 20px; }
.bar-find[aria-expanded="true"] { background: var(--surface); }
.search { position: relative; display: none; flex-basis: 100%; padding-bottom: 12px; }
.b-bar.searching .search { display: block; }
.search input { width: 100%; height: 46px; padding: 0 18px 0 44px; border-radius: 999px; border: 1px solid var(--line-strong); background: #fff; outline: none; font-size: 16px; transition: border-color 0.3s, box-shadow 0.3s; }
.search input:focus { border-color: var(--fg); box-shadow: 0 0 0 4px var(--surface); }
.search svg { position: absolute; left: 16px; top: 23px; width: 18px; height: 18px; transform: translateY(-50%); color: var(--muted); }
@media (min-width: 900px) {
  .bar-in { flex-wrap: nowrap; }
  .bar-find { display: none; }
  .search { display: block; flex: none; flex-basis: auto; padding: 0; }
  .search input { width: 260px; height: 40px; }
  .search svg { top: 50%; }
}

/* magazine list */
.mag { display: grid; column-gap: 32px; padding-top: clamp(28px, 4vw, 56px); }
.mag-h { grid-column: 1 / -1; font-size: var(--fs-sm); font-family: var(--font-text); font-weight: 600; color: var(--muted); padding-bottom: 12px; border-bottom: 1px solid var(--line); letter-spacing: 0.01em; }
.mag-h + * { margin-top: 0; }
.mag .post-card[hidden], .mag .is-dup { display: none; }
.mag.filtering .is-dup:not([hidden]) { display: grid; }
.mag.filtering .mag-h { display: none; }

/* compact rows (phones): small cover on the left, title on the right */
@media (max-width: 699px) {
  .mag .post-card, .rel-grid .post-card {
    grid-template-columns: 116px minmax(0, 1fr); grid-template-rows: auto 1fr; column-gap: 16px; row-gap: 6px; align-items: start;
    padding: 18px 0; border-bottom: 1px solid var(--line);
  }
  .mag .post-card .cover, .rel-grid .post-card .cover { grid-row: 1 / span 2; aspect-ratio: 4 / 3; border-radius: 10px; }
  .mag .post-card :is(h2, h3), .rel-grid .post-card :is(h2, h3) { font-size: 1.0625rem; line-height: 1.3; font-weight: 600; letter-spacing: 0; }
  .mag .post-card p, .rel-grid .post-card p, .mag .pm-date, .rel-grid .pm-date { display: none; }
  .mag .post-card .post-meta, .rel-grid .post-card .post-meta { gap: 10px; font-size: 0.78rem; }
  .mag .post-card:last-of-type, .rel-grid .post-card:last-child { border-bottom: 0; }
  .mag-h { margin-top: 28px; padding-bottom: 6px; }
  .mag-h:first-child { margin-top: 0; }
  .mag.filtering { padding-top: 12px; }
}
@media (min-width: 700px) {
  .mag { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 0; }
  .mag-h { margin: 56px 0 32px; }
  .mag-h:first-child { margin-top: 0; }
  .mag .is-pick { gap: 16px; }
  .mag .is-pick h3 { font-size: clamp(1.35rem, 1.1rem + 0.8vw, 1.9rem); line-height: 1.12; }
  /* wide rows */
  .mag .is-row, .mag.filtering .post-card {
    grid-column: 1 / -1; grid-template-columns: clamp(200px, 26vw, 300px) minmax(0, 1fr); grid-template-rows: auto auto 1fr; column-gap: clamp(24px, 3.5vw, 48px); row-gap: 10px;
    padding: 28px 0; border-bottom: 1px solid var(--line);
  }
  .mag .is-row .cover, .mag.filtering .post-card .cover { grid-row: 1 / -1; border-radius: 14px; }
  .mag .is-row :is(h2, h3), .mag.filtering .post-card :is(h2, h3) { font-size: clamp(1.25rem, 1.05rem + 0.7vw, 1.75rem); line-height: 1.15; max-width: 30ch; }
  .mag .is-row:last-of-type, .mag.filtering .post-card:last-of-type { border-bottom: 0; }
  .mag.filtering .post-card:first-of-type { padding-top: 0; }
  .mag .is-row:nth-child(1 of .is-row) { padding-top: 0; }
}

.empty { display: none; padding: 48px 0; }
.empty.on { display: block; }
.empty h3 { font-size: var(--fs-h3); margin-bottom: 10px; }
.empty p { color: var(--muted); margin-bottom: 20px; }
.b-cta { padding: clamp(64px, 9vw, 120px) 0; }
.b-cta h2 { font-size: clamp(2.2rem, 1rem + 5vw, 5.5rem); line-height: 0.96; max-width: 14ch; font-variation-settings: "wdth" 100; margin-bottom: 28px; }

/* =========================================================
   Article
   ========================================================= */
.progress { position: fixed; left: 0; right: 0; top: 0; z-index: 130; height: 3px; pointer-events: none; }
.progress i { position: absolute; inset: 0; background: var(--venom); transform-origin: left; transform: scaleX(0); }
.a-hero { padding: calc(var(--nav-h) + clamp(28px, 6vw, 88px)) 0 clamp(28px, 4vw, 56px); }
.crumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: var(--fs-sm); color: var(--muted); margin-bottom: clamp(18px, 3vw, 36px); }
.crumbs li + li::before { content: "/"; margin-right: 10px; color: var(--line-strong); }
.crumbs a { display: inline-block; padding: 8px 0; transition: color 0.3s; }
.crumbs a:hover { color: var(--fg); }
.crumbs li:last-child a { color: var(--accent); font-weight: 600; }
.back { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: var(--fs-sm); margin-bottom: clamp(28px, 4vw, 48px); transition: color 0.3s; }
.back svg { width: 16px; height: 16px; transition: transform 0.5s var(--ease-out); }
.back:hover { color: var(--fg); }
.a-hero h1 { font-size: clamp(2rem, 1rem + 4vw, 4.6rem); line-height: 1.02; letter-spacing: -0.02em; max-width: 20ch; font-variation-settings: "wdth" 100; text-wrap: balance; }
.a-hero .post-meta { margin-top: 20px; font-size: var(--fs-sm); }
.a-cover { margin-top: clamp(28px, 4.5vw, 56px); aspect-ratio: 16 / 8; border-radius: 22px; overflow: hidden; }
.a-cover svg { width: 100%; height: 100%; }
@media (max-width: 699px) { .a-cover { aspect-ratio: 3 / 2; border-radius: 16px; } }
.a-body { padding: clamp(24px, 6vw, 88px) 0; }
.a-grid { display: grid; gap: 40px; }
.toc { display: none; }
@media (min-width: 900px) {
  .a-grid { grid-template-columns: 200px minmax(0, 1fr); gap: 48px; }
  .toc { display: block; position: sticky; top: calc(var(--nav-h) + 30px); align-self: start; font-size: var(--fs-sm); }
  .toc p { color: var(--muted); font-size: var(--fs-xs); margin-bottom: 14px; }
  .toc li { border-left: 1px solid var(--line); }
  .toc a { display: block; padding: 7px 0 7px 16px; color: var(--muted); line-height: 1.35; position: relative; transition: color 0.3s; }
  .toc a::before { content: ""; position: absolute; left: -1px; top: 0; bottom: 0; width: 2px; background: var(--venom); transform: scaleY(0); transition: transform 0.5s var(--ease-out); }
  .toc a:hover, .toc a.on { color: var(--fg); }
  .toc a.on::before { transform: scaleY(1); }
}
@media (min-width: 1100px) { .a-grid { grid-template-columns: 240px minmax(0, 1fr); gap: 80px; } }

/* "In 30 seconds" */
.tldr { max-width: 68ch; margin-bottom: clamp(32px, 5vw, 56px); padding: clamp(20px, 3vw, 30px); border-radius: 18px; background: #fff; border: 1px solid var(--line); }
.tldr h2 { display: flex; align-items: center; gap: 10px; font-size: 1.0625rem; font-weight: 700; margin-bottom: 14px; }
.tldr h2::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--venom); }
.tldr ul { display: grid; gap: 10px; }
.tldr li { position: relative; padding-left: 22px; font-size: 1rem; line-height: 1.55; }
.tldr li::before { content: ""; position: absolute; left: 1px; top: 0.78em; width: 11px; height: 2px; background: var(--fg); opacity: 0.45; }

.prose { max-width: 68ch; font-size: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem); line-height: 1.72; }
.prose > * + * { margin-top: 1.1em; }
.prose h2 { font-size: clamp(1.45rem, 1.2rem + 1.2vw, 2.25rem); line-height: 1.15; margin-top: 2.2em; font-variation-settings: "wdth" 100; scroll-margin-top: 8px; }
.prose h2 + * { margin-top: 0.8em; }
.prose strong { font-weight: 650; }
.prose h3 { font-size: clamp(1.1rem, 1rem + 0.4vw, 1.3rem); line-height: 1.3; font-weight: 650; margin-top: 1.7em; font-variation-settings: "wdth" 100; }
.prose h3 + p { margin-top: 0.45em; }
.post-meta .by { color: var(--fg); font-weight: 600; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.post-meta .by:hover { text-decoration-color: var(--venom); }
.author-role { color: var(--muted); font-size: var(--fs-xs); margin: -2px 0 10px; }
.prose ul, .prose ol { padding-left: 0; display: grid; gap: 0.5em; }
.prose ul li { position: relative; padding-left: 1.4em; }
.prose ul li::before { content: ""; position: absolute; left: 0.2em; top: 0.68em; width: 7px; height: 7px; border-radius: 50%; background: var(--venom); }
.prose ol { counter-reset: n; }
.prose ol li { position: relative; padding-left: 2em; counter-increment: n; }
.prose ol li::before { content: counter(n); position: absolute; left: 0; top: 0.1em; width: 1.45em; height: 1.45em; border-radius: 50%; border: 1px solid var(--line-strong); font-family: var(--font-display); font-size: 0.75em; display: grid; place-items: center; line-height: 1; }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.prose > p:first-child { font-size: 1.18em; line-height: 1.55; }

/* mid-article free audit */
.prose .mid-cta { margin: 2.4em 0 0; padding: clamp(22px, 3.5vw, 32px); border-radius: 18px; background: var(--silk); color: #fff; display: grid; gap: 10px; justify-items: start; }
.prose .mid-cta + h2 { margin-top: 1.8em; }
.mid-cta .mc-h { font-family: var(--font-display); font-size: clamp(1.2rem, 1.05rem + 0.6vw, 1.5rem); font-weight: 700; line-height: 1.2; }
.mid-cta p:not(.mc-h) { color: #b8b8bc; font-size: 1rem; line-height: 1.55; max-width: 46ch; }
.prose .mid-cta .btn { margin-top: 8px; color: #fff; text-decoration: none; --h: 48px; }

.a-end { margin-top: clamp(48px, 7vw, 80px); display: grid; gap: 28px; max-width: 68ch; }
.author { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 18px; padding: clamp(20px, 3vw, 30px); border-radius: 18px; background: #fff; border: 1px solid var(--line); }
.author-av { width: 56px; height: 56px; border-radius: 50%; background: #000; display: grid; place-items: center; }
.author-av svg { width: 24px; height: 34px; color: #fff; }
.author-name { font-family: var(--font-display); font-weight: 700; font-size: 1.0625rem; margin-bottom: 6px; }
.author-txt p:not(.author-name, .author-role) { color: var(--muted); font-size: var(--fs-sm); line-height: 1.55; margin-bottom: 16px; }
.author .btn { --h: 46px; }
@media (max-width: 699px) {
  .author { grid-template-columns: 44px minmax(0, 1fr); column-gap: 14px; row-gap: 0; align-items: center; }
  .author-av { width: 44px; height: 44px; grid-row: 1 / span 2; }
  .author-av svg { width: 19px; height: 27px; }
  .author-txt { display: contents; }
  .author-name { grid-column: 2; margin: 0; align-self: end; }
  .author-role { grid-column: 2; margin: 2px 0 0; align-self: start; }
  .author-txt p:not(.author-name, .author-role), .author .btn { grid-column: 1 / -1; }
  .author-txt p:not(.author-name, .author-role) { margin-top: 14px; }
  .author .btn { justify-self: start; }
}
.share { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; color: var(--muted); font-size: var(--fs-sm); }
.share > span { flex-basis: 100%; }
.share .btn { --h: 44px; padding: 0 15px; }
.share { gap: 8px; }
.a-cta { position: relative; overflow: hidden; border-radius: 22px; padding: clamp(28px, 5vw, 56px); background: var(--silk); color: #fff; isolation: isolate; }

/* keep reading */
.related { padding: clamp(56px, 8vw, 110px) 0; border-top: 1px solid var(--line); }
.related h2 { font-size: var(--fs-h3); margin-bottom: clamp(12px, 3vw, 32px); }
@media (min-width: 700px) and (max-width: 899px) {
  .rel-grid .post-card { grid-template-columns: 220px minmax(0, 1fr); grid-template-rows: auto auto 1fr; column-gap: 28px; row-gap: 10px; padding: 24px 0; border-bottom: 1px solid var(--line); }
  .rel-grid .post-card:first-child { padding-top: 0; }
  .rel-grid .post-card:last-child { border-bottom: 0; }
  .rel-grid .post-card .cover { grid-row: 1 / -1; border-radius: 14px; }
}
@media (min-width: 900px) { .rel-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; } .rel-grid .post-card p { display: none; } }

/* mobile "Contents" sheet */
.dock .btn-toc { flex: none; padding: 0 16px; gap: 8px; background: #1f1f22; color: #fff; }
.dock .btn-toc svg { width: 18px; height: 18px; }
.dock .btn-red { padding: 0 16px; }
@media (min-width: 900px) { .btn-toc { display: none; } }
.sheet { position: fixed; inset: 0; z-index: 140; }
.sheet[hidden] { display: none; }
.sheet-bg { position: absolute; inset: 0; background: rgba(0,0,0,.42); opacity: 0; transition: opacity 0.35s; }
.sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: min(72vh, 560px); display: flex; flex-direction: column;
  background: var(--paper); color: #000; border-radius: 22px 22px 0 0; padding-bottom: env(safe-area-inset-bottom);
  transform: translateY(100%); transition: transform 0.45s var(--ease-out);
  --fg: #000; --muted: #55555b; --line: rgba(0,0,0,.13); --accent: #c2000a;
}
.sheet.open .sheet-bg { opacity: 1; }
.sheet.open .sheet-panel { transform: none; }
@media (min-width: 600px) {
  .sheet-panel { left: 50%; right: auto; width: 560px; transform: translate(-50%, 100%); }
  .sheet.open .sheet-panel { transform: translateX(-50%); }
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px 6px 22px; }
.sheet-head p { font-family: var(--font-display); font-weight: 700; font-size: 1.0625rem; }
.sheet-x { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; font-size: 26px; line-height: 1; }
.sheet ul { overflow-y: auto; overscroll-behavior: contain; padding: 0 12px 16px; }
.sheet li a { display: block; padding: 13px 12px 13px 16px; border-radius: 12px; font-size: 1rem; line-height: 1.35; color: var(--muted); position: relative; }
.sheet li a.on { color: #000; background: rgba(0,0,0,.05); font-weight: 600; }
.sheet li a.on::before { content: ""; position: absolute; left: 4px; top: 12px; bottom: 12px; width: 3px; border-radius: 2px; background: var(--venom); }

.toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); z-index: 200; transform: translate(-50%, 20px); opacity: 0; padding: 12px 20px; border-radius: 999px; background: var(--fg); color: var(--bg); font-size: var(--fs-sm); font-weight: 500; transition: opacity 0.4s, transform 0.5s var(--ease-silk); pointer-events: none; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  .tab-ink.go, .b-bar, .sheet-panel, .sheet-bg { transition: none; }
}

/* ===== Update 28 — blog covers, style B (a colour per topic) ===== */
.cover-b { background: transparent; }
.post-card .cover.cover-paper::after, .a-cover.cover-paper { box-shadow: inset 0 0 0 1px rgba(14,14,16,.12); }
.post-card .cover.cover-b:not(.cover-paper)::after { box-shadow: none; }
.cover-b .cv-art { transition: transform 0.9s var(--ease-out); }
.fine .post-card:hover .cover-b .cv-art { transform: translate(-6px, -4px); }
