/* =============================================================================
   Posts — /blog/. Loaded only by the post pages, after styles.css, and built
   on its tokens so a post follows the site into dark mode. Nothing here is
   inline: the CSP is style-src 'self', so a style attribute would simply be
   dropped. The charts are drawn by /assets/blog.js from data in that file.
   ========================================================================== */

/* The two chart series: before and now. Validated as a categorical pair
   (dataviz validate_palette.js, both modes: CVD ΔE ≥ 24, contrast ≥ 3:1). */
:root {
  --series-before: #2a78d6;
  --series-now:    #eb6834;
}
@media (prefers-color-scheme: dark) {
  :root {
    --series-before: #3987e5;
    --series-now:    #d95926;
  }
}

.post { max-width: 42rem; margin-inline: auto; }
.post__meta { color: var(--ink-55); font-size: .9rem; margin-top: .75rem; }
.post h1 {
  font-size: clamp(1.9rem, 6vw, 2.6rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 680;
}
.post__lede { font-size: 1.15rem; color: var(--ink); }
.post ul { padding-left: 1.2rem; }
.post li + li { margin-top: .35rem; }

/* At a glance */
.post-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.post-stat { background: var(--paper); border-radius: 14px; padding: 1rem; }
.post-stat b {
  display: block; font-size: 1.7rem; line-height: 1.1; color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.post-stat span { display: block; margin-top: .35rem; font-size: .85rem; line-height: 1.4; color: var(--ink-55); }
.post-stat span strong { color: var(--ink); }
@media (max-width: 520px) { .post-stats { grid-template-columns: 1fr; } }

/* Figures */
.post-figure {
  /* No browser default 40px side margins: on a phone they shrink the drawing
     and the words inside it below a readable size. */
  margin: 1.5rem 0;
  position: relative; background: var(--paper); border-radius: 14px;
  padding: 1.1rem 1.1rem .9rem;
}
.post-figure__title { font-weight: 600; font-size: .95rem; color: var(--ink); margin: 0 0 .7rem; }
.post-figure figcaption { font-size: .85rem; line-height: 1.45; color: var(--ink-55); margin-top: .6rem; }
.post-figure svg { display: block; width: 100%; height: auto; overflow: visible; }
.post-figure svg text { font-family: var(--sans); }
.post-legend { display: flex; gap: 1.1rem; flex-wrap: wrap; font-size: .85rem; color: var(--ink-70); margin-bottom: .6rem; }
.post-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.post-legend .is-before { background: var(--series-before); }
.post-legend .is-now { background: var(--series-now); }
.post-bar { cursor: default; }
.post-bar:focus { outline: none; }
.post-bar:hover rect, .post-bar:focus rect { filter: brightness(1.08); }
.post-tip {
  position: absolute; pointer-events: none; opacity: 0; transition: opacity .1s;
  background: var(--bg); color: var(--ink); border: 1px solid var(--rule);
  border-radius: 8px; padding: .4rem .6rem; font-size: .8rem; white-space: nowrap;
  box-shadow: var(--lift);
}
.post-tip.is-on { opacity: 1; }

/* The diagram: a wide drawing on wide screens, a stacked one on phones, each
   drawn at a size its words can be read at. */
.post-diagram .narrow { display: none; max-width: 330px; margin-inline: auto; }
@media (max-width: 560px) {
  .post-diagram .wide { display: none; }
  .post-diagram .narrow { display: block; }
}
.dg-box { fill: var(--bg); stroke: var(--rule); }
.dg-box--model { stroke: var(--series-now); stroke-width: 2; }
.dg-line { fill: none; stroke: var(--ink-55); stroke-width: 2; }
.dg-head { fill: var(--ink-55); }
.dg-title { fill: var(--ink); font-weight: 600; font-size: 14px; }
.dg-sub { fill: var(--ink-55); font-size: 12px; }
.dg-text { fill: var(--ink-70); font-size: 12px; }
.dg-speaker { fill: var(--ink); font-weight: 600; }
.dg-lane { fill: var(--paper-deep); }
.dg-on { fill: var(--series-now); }

/* Chart text the script draws */
.ch-grid { stroke: var(--rule); stroke-width: 1; }
.ch-tick { fill: var(--ink-55); font-size: 12px; }
.ch-label { fill: var(--ink); font-size: 14px; font-weight: 600; }
.ch-sub { fill: var(--ink-55); font-size: 12px; }
.ch-value { fill: var(--ink); font-size: 12px; }
.ch-value--now { font-weight: 700; }
.ch-before { fill: var(--series-before); }
.ch-now { fill: var(--series-now); }

/* Comparison table */
.post-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.post-table th, .post-table td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
.post-table th { color: var(--ink-55); font-weight: 600; font-size: .78rem; letter-spacing: .04em; text-transform: uppercase; }
.post-table td { color: var(--ink-70); }
.post-table td:first-child { color: var(--ink); font-weight: 500; }
.post-table td.is-now { color: var(--ink); font-weight: 600; }

.post__small { font-size: .85rem; color: var(--ink-55); }

/* The byline: date, topic, and the apps it is about. Each is a link to /blog/
   filtered by it. */
.post__meta a { color: var(--ink-70); }
.post__meta .chip { margin-left: .4rem; vertical-align: 1px; }

.post__back { margin-top: 2.5rem; font-size: .95rem; }

/* =============================================================================
   /blog/ — the list, its filters, and the tags on each post. The list and the
   options are written by deploy/build.py; blog.js shows the form and filters.
   ========================================================================== */
.blog .wrap { max-width: 58rem; }
.blog__head h1 {
  margin: 0;
  font-size: clamp(2.1rem, 6vw, 3rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-weight: 680;
}
.blog__lede { margin: .9rem 0 0; max-width: 36rem; font-size: 1.15rem; color: var(--ink-70); }

.blog-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .75rem 1rem;
  margin-top: 2.25rem;
  padding: 1rem 1.1rem 1.1rem;
  background: var(--paper);
  border-radius: var(--radius);
}
.blog-filters[hidden] { display: none; }
.blog-filter label {
  display: block;
  margin-bottom: .35rem;
  font-size: .74rem;
  font-weight: 650;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-55);
}
.blog-filter .control {
  padding-block: .55rem;
  font-size: .95rem;
  background-position: calc(100% - 1.15rem) 50%, calc(100% - .8rem) 50%;
}
.blog-filters__clear {
  grid-column: 1 / -1;
  justify-self: start;
  padding: 0;
  font: inherit;
  font-size: .9rem;
  font-weight: 560;
  color: var(--ink);
  background: none;
  border: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: var(--amber);
  cursor: pointer;
}
.blog-filters__clear[hidden] { display: none; }
@media (max-width: 46rem) {
  .blog-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* Two to a row on a phone, with room for "Newest first" beside its arrow. */
@media (max-width: 30rem) {
  .blog-filters { gap: .7rem .6rem; padding: .85rem .8rem .9rem; }
  .blog-filter .control {
    padding-inline: .6rem 1.75rem;
    font-size: .9rem;
    background-position: calc(100% - .95rem) 50%, calc(100% - .6rem) 50%;
  }
}

.blog-count { margin: 1.4rem 0 0; font-size: .9rem; color: var(--ink-55); }
.blog-count:empty { display: none; }

.post-cards { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: 1rem; }
.post-card {
  position: relative;
  padding: 1.4rem 1.5rem 1.3rem;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  transition: box-shadow .15s ease, border-color .15s ease;
}
.post-card:hover { box-shadow: var(--lift); border-color: var(--rule-warm); }
.post-card[hidden] { display: none; }
.post-card--none { color: var(--ink-55); }
.post-card__meta { margin: 0; font-size: .85rem; color: var(--ink-55); }
.post-card__topic { color: var(--ink-70); font-weight: 600; text-decoration: none; }
.post-card__topic:hover { text-decoration: underline; }
.post-card__title {
  margin: .45rem 0 0;
  font-size: clamp(1.2rem, 2.6vw, 1.45rem);
  line-height: 1.25;
  letter-spacing: -0.01em;
  font-weight: 650;
}
.post-card__title a { text-decoration: none; }
/* The whole card opens the post; the tags inside it stay their own links. */
.post-card__title a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.post-card__title a:hover { text-decoration: underline; text-decoration-color: var(--amber); }
.post-card__topic, .post-card .chip { position: relative; z-index: 1; }
.post-card__summary { margin: .55rem 0 0; color: var(--ink-70); max-width: 44rem; }
.post-card__apps { margin: .9rem 0 0; display: flex; flex-wrap: wrap; gap: .4rem; }

.chip {
  display: inline-block;
  padding: .18rem .65rem .2rem;
  border-radius: 999px;
  background: var(--paper-deep);
  color: var(--ink-70);
  font-size: .8rem;
  font-weight: 600;
  text-decoration: none;
}
.chip:hover { color: var(--ink); background: var(--amber-wash); }

.blog-empty {
  margin-top: 1rem;
  padding: 2rem 1.25rem;
  text-align: center;
  color: var(--ink-55);
  background: var(--paper);
  border-radius: var(--radius);
}
.blog-empty[hidden] { display: none; }
.blog-empty__clear {
  padding: 0;
  font: inherit;
  color: var(--ink);
  background: none;
  border: 0;
  text-decoration: underline;
  text-decoration-color: var(--amber);
  text-underline-offset: 2px;
  cursor: pointer;
}
