/* The blog (tools/blog_page.py). Both pages open with the homepage hero (the silk card,
   css/hero.css). The archive: a topic filter that scrolls sideways, then every article in an even
   grid of stacked cards. A post: its photo opening the article, the contents list and share row
   beside a readable column, the author box, more articles. The blue call to action comes from
   css/case.css. Cards are solid dark, not frosted. */

.blog { padding-bottom: clamp(60px, 7vw, 100px); }

/* ---------- the homepage hero on the blog: the silk card, centred ---------- */
.blog-silk .hero__inner { padding: 180px var(--gutter) 40px; }
.blog-silk__title { max-width: 1000px; font-size: clamp(40px, 5.2vw, 74px); line-height: 1.02; }
.blog-silk--archive .blog-silk__title { font-size: clamp(44px, 6vw, 88px); line-height: 0.98; }
.blog-pill { display: inline-flex; align-items: center; margin-bottom: 26px; padding: 9px 16px; border-radius: 12px; background: rgba(255, 255, 255, 0.07); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), inset 0 0 0 1px rgba(255, 255, 255, 0.1); color: var(--text-2); font-size: 14.5px; font-weight: 500; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.blog-back { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 22px; color: var(--text-3); font-size: 14.5px; font-weight: 500; transition: color 0.2s; }
.blog-back svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.35s var(--ease-out); }
.blog-back:hover { color: var(--text-1); }
.blog-back:hover svg { transform: translateX(-3px); }
.post-by { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 28px; color: var(--text-1); font-size: 15px; text-align: left; }
.post-by img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.7); }
.post-by b { display: block; font-weight: 600; }
.post-by__meta, .bcard__meta { display: flex; flex-wrap: wrap; gap: 0 8px; color: var(--text-3); font-size: 14px; }

/* ---------- the archive ---------- */
.blog-list { margin-top: 40px; }
.blog-list__head { display: grid; gap: 16px; }

/* the topic filter: one line that scrolls sideways when it runs out of room. Each chip shows how
   many articles it holds; the chosen one is the brand blue. */
.bchips { position: relative; min-width: 0; }
.bchips__row { display: flex; gap: 8px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; scroll-padding-inline: var(--gutter); padding: 4px 2px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.bchips__row::-webkit-scrollbar { display: none; }
.bchip { flex: none; display: inline-flex; align-items: center; gap: 10px; padding: 10px 10px 10px 16px; border-radius: 12px; background: #0c1d3a; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08); color: var(--text-2); font-size: 14.5px; font-weight: 500; white-space: nowrap; scroll-snap-align: start; transition: color 0.2s, background-color 0.2s, box-shadow 0.2s; }
.bchip:hover { color: var(--text-1); box-shadow: inset 0 0 0 1px rgba(80, 170, 255, 0.35); }
.bchip__n { display: grid; place-items: center; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 8px; background: rgba(255, 255, 255, 0.07); color: var(--text-3); font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.bchip.is-on { background: linear-gradient(180deg, #1668ff, #0a4dff); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 10px 24px -12px rgba(10, 77, 255, 0.9); color: #fff; }
.bchip.is-on .bchip__n { background: rgba(255, 255, 255, 0.2); color: #fff; }
.bchip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* the articles: an even grid of stacked cards */
.blog-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; margin-top: 28px; }
.bcard[hidden] { display: none; }
.bcard__link { display: flex; flex-direction: column; height: 100%; overflow: hidden; border-radius: 24px; background: linear-gradient(180deg, #0c1d3a 0%, #081630 60%, #061127 100%); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), inset 0 0 0 1px rgba(255, 255, 255, 0.05); transition: transform 0.45s var(--ease-out), box-shadow 0.45s var(--ease); }
.bcard__link:hover { transform: translateY(-4px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.09), inset 0 0 0 1px rgba(80, 170, 255, 0.25), 0 40px 70px -40px rgba(10, 77, 255, 0.7); }
.bcard__link:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.bcard__shot { display: block; overflow: hidden; aspect-ratio: 16 / 10; background: #061127; }
.bcard__shot img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.9s var(--ease-out); }
.bcard__link:hover .bcard__shot img { transform: scale(1.04); }
.bcard__body { display: flex; flex: 1; flex-direction: column; gap: 12px; padding: 24px 26px 28px; }
.bcard__cat { color: #7fd3ff; font-size: 13px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.bcard__title { color: var(--text-1); font-size: 21px; font-weight: 600; line-height: 1.25; letter-spacing: -0.02em; text-wrap: balance; }
.bcard__desc { color: var(--text-3); font-size: 15.5px; line-height: 1.6; text-wrap: pretty; }
/* the date sits on the card's bottom edge, so a row of cards lines up */
.bcard__meta { margin-top: auto; padding-top: 6px; color: var(--text-4); }
.blog-empty { margin-top: 28px; color: var(--text-3); }

/* ---------- the post ---------- */
.post { display: grid; grid-template-columns: 250px minmax(0, 740px); gap: clamp(40px, 6vw, 96px); margin-top: 56px; }
.post__side { position: sticky; top: 110px; align-self: start; }
.toc ol { display: grid; gap: 2px; margin-top: 16px; }
.toc a { display: block; padding: 8px 0 8px 16px; color: var(--text-3); font-size: 14.5px; line-height: 1.4; box-shadow: inset 2px 0 0 rgba(255, 255, 255, 0.08); transition: color 0.2s, box-shadow 0.2s; }
.toc a:hover { color: var(--text-1); }
.toc a.is-on { color: var(--text-1); box-shadow: inset 2px 0 0 var(--accent); }
.share { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 36px; }
.share__k { width: 100%; margin-bottom: 4px; color: var(--text-4); font-size: 13px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.share__btn { position: relative; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: #0c1d3a; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08); color: var(--text-2); transition: color 0.2s, background-color 0.2s, transform 0.3s var(--ease-out); }
.share__btn:hover { color: #fff; background: #10284f; transform: translateY(-2px); }
.share__btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.share__done { position: absolute; bottom: calc(100% + 8px); left: 50%; padding: 5px 9px; border-radius: 8px; background: #fff; color: #06235c; font-size: 12.5px; font-weight: 600; white-space: nowrap; opacity: 0; transform: translate(-50%, 4px); pointer-events: none; transition: opacity 0.2s, transform 0.2s; }
.share__btn.is-copied .share__done { opacity: 1; transform: translate(-50%, 0); }
.post__end .share { margin-top: 0; }
.post__end .share__k { width: auto; margin: 0 8px 0 0; }

/* the article opens with its photo */
.post__figure { margin: 0 0 40px; }
.post__figure img { display: block; width: 100%; height: auto; border-radius: 24px; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.07), 0 50px 100px -60px rgba(10, 77, 255, 0.8); }
.post__figure figcaption { margin-top: 12px; color: var(--text-4); font-size: 13px; }
.post__figure figcaption a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }

/* the article itself, set to read */
.post__body > p, .post__body > ul, .post__body > ol { margin-top: 22px; color: var(--text-2); font-size: clamp(17px, 1.3vw, 18.5px); line-height: 1.78; }
.post__figure + p { margin-top: 0; color: var(--text-1); font-size: clamp(19px, 1.5vw, 21px); line-height: 1.65; }
.post__body h2 { margin-top: 60px; color: var(--text-1); font-size: clamp(26px, 2.4vw, 32px); font-weight: 600; line-height: 1.2; letter-spacing: -0.03em; text-wrap: balance; scroll-margin-top: 110px; }
.post__body h2 + p { margin-top: 16px; }
.post__body h3 { margin-top: 36px; color: var(--text-1); font-size: 21px; font-weight: 600; }
.post__body ul, .post__body ol { padding-left: 22px; }
.post__body ul { list-style: disc; }
.post__body ol { list-style: decimal; }
.post__body li { padding-left: 4px; }
.post__body li + li { margin-top: 10px; }
.post__body li::marker { color: var(--accent); }
.post__body strong { color: var(--text-1); font-weight: 600; }
.post__body a { color: var(--accent); text-decoration: underline; text-decoration-color: rgba(24, 205, 253, 0.4); text-underline-offset: 4px; }
.post__body a:hover { text-decoration-color: currentColor; }
.post__table { overflow-x: auto; margin-top: 28px; border-radius: 18px; background: #0a1a34; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07); }
.post__table table { width: 100%; min-width: 460px; border-collapse: collapse; font-size: 16px; }
.post__table th { padding: 16px 20px; color: var(--text-4); font-size: 12.5px; font-weight: 600; letter-spacing: 0.08em; text-align: left; text-transform: uppercase; }
.post__table td { padding: 15px 20px; color: var(--text-2); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07); font-variant-numeric: tabular-nums; }
.post__table td:first-child { color: var(--text-1); font-weight: 500; }
.post__end { margin-top: 48px; padding-top: 28px; box-shadow: inset 0 1px 0 var(--line-card); }
.author { display: flex; align-items: flex-start; gap: 20px; margin-top: 36px; padding: 28px; border-radius: 22px; background: linear-gradient(180deg, #0c1d3a, #081630); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06); }
.author img { flex: none; width: 72px; height: 72px; border-radius: 50%; object-fit: cover; }
.author__name { color: var(--text-1); font-size: 18px; font-weight: 600; }
.author__bio { margin-top: 8px; color: var(--text-3); font-size: 15.5px; line-height: 1.6; }
.author .link-arrow { margin-top: 12px; }

.blog-more { margin-top: 110px; }
.blog-grid--more { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 32px; }

@media (pointer: coarse), (max-width: 767px) {
  .blog-back { padding-block: 10px; margin-block: -10px; margin-bottom: 12px; }
}

/* ---------- the 404 and the privacy page (tools/pages_extra.py) ---------- */
.nf-links ul { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 24px; }
.nf-link { position: relative; display: grid; gap: 8px; height: 100%; padding: 26px 56px 28px 26px; border-radius: 22px; background: linear-gradient(180deg, #0c1d3a, #081630); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06); transition: transform 0.4s var(--ease-out), box-shadow 0.4s var(--ease); }
.nf-link:hover { transform: translateY(-3px); box-shadow: inset 0 0 0 1px rgba(80, 170, 255, 0.3); }
.nf-link b { color: var(--text-1); font-size: 19px; font-weight: 600; }
.nf-link span { color: var(--text-3); font-size: 15px; line-height: 1.55; }
.nf-link svg { position: absolute; top: 28px; right: 24px; width: 20px; height: 20px; fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.4s var(--ease-out); }
.nf-link:hover svg { transform: translateX(4px); }
.legal__wrap { max-width: 800px; margin-top: 40px; }
.legal__body > p:first-child { margin-top: 0; color: var(--text-1); font-size: clamp(18px, 1.4vw, 20px); }
.legal-hero .blog-silk__title { font-size: clamp(40px, 5vw, 68px); }
[data-theme="light"] .nf-link { background: #fff; box-shadow: inset 0 0 0 1px var(--line-card); }

/* ---------- light theme ---------- */
[data-theme="light"] .blog-pill { background: rgba(255, 255, 255, 0.7); box-shadow: inset 0 0 0 1px var(--line-card); }
[data-theme="light"] .bchip { background: #fff; box-shadow: inset 0 0 0 1px var(--line-card); }
[data-theme="light"] .bchip__n { background: rgba(6, 30, 66, 0.06); }
[data-theme="light"] .bchip.is-on { background: linear-gradient(180deg, #1668ff, #0a4dff); box-shadow: 0 10px 24px -12px rgba(10, 77, 255, 0.7); color: #fff; }
[data-theme="light"] .bcard__link, [data-theme="light"] .author { background: #fff; box-shadow: inset 0 0 0 1px var(--line-card); }
[data-theme="light"] .bcard__link:hover { box-shadow: inset 0 0 0 1px rgba(10, 110, 230, 0.3), 0 40px 70px -44px rgba(10, 60, 160, 0.5); }
[data-theme="light"] .bcard__shot { background: #e6edf7; }
[data-theme="light"] .bcard__cat { color: #0a6fe0; }
[data-theme="light"] .toc a { box-shadow: inset 2px 0 0 rgba(6, 30, 66, 0.1); }
[data-theme="light"] .toc a.is-on { box-shadow: inset 2px 0 0 var(--accent); }
[data-theme="light"] .share__btn { background: #fff; box-shadow: inset 0 0 0 1px var(--line-card); }
[data-theme="light"] .share__btn:hover { background: #eef3fa; color: #06235c; }
[data-theme="light"] .post__table { background: #fff; box-shadow: inset 0 0 0 1px var(--line-card); }
[data-theme="light"] .post__table td { box-shadow: inset 0 1px 0 var(--line-card); }

/* ---------- responsive ---------- */
@media (max-width: 1024px) {
  .blog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1000px) {
  .post { grid-template-columns: minmax(0, 1fr); gap: 0; margin-top: 48px; }
  .post__side { display: none; }
}
@media (max-width: 767px) {
  .nf-links ul { grid-template-columns: minmax(0, 1fr); }
  /* the filter runs to the screen edges and fades there, so it reads as something to swipe */
  .bchips { margin-inline: calc(var(--gutter) * -1); -webkit-mask-image: linear-gradient(90deg, transparent, #000 var(--gutter), #000 calc(100% - 36px), transparent); mask-image: linear-gradient(90deg, transparent, #000 var(--gutter), #000 calc(100% - 36px), transparent); }
  .bchips__row { padding-inline: var(--gutter); }
  .bchip { padding: 9px 9px 9px 14px; font-size: 14px; }
  .blog-grid, .blog-grid--more { grid-template-columns: minmax(0, 1fr); }
  .bcard__body { padding: 22px 22px 26px; }
  .post__body h2 { margin-top: 48px; }
  .author { flex-direction: column; gap: 14px; padding: 22px; }
  .blog-silk .hero__inner { padding-top: 130px; }
  .blog-silk__title { font-size: clamp(32px, 8.6vw, 44px); }
  .blog-silk--archive .blog-silk__title { font-size: clamp(38px, 10.4vw, 52px); }
  .post__figure img { border-radius: 16px; }
  .blog-more { margin-top: 80px; }
}
