/* ==========================================================================
   Blog — archive + article
   Loaded only on blog pages. style.css owns the world (tokens, header, footer,
   bands); this file adds the Read-mode surfaces on top of it.
   ========================================================================== */

:root {
  /* Long-form body sits brighter than --fg-muted: 7.6:1 on the mid band rather
     than 4.9:1, which is the difference between scannable and readable. */
  --fg-read: #c2c6ce;
  --measure: 68ch;
}

/* ==========================================================================
   1. Page head (shared by archive and post)
   ========================================================================== */

.page-head {
  padding-top: clamp(9rem, 15vw, 12rem);
  padding-bottom: clamp(3rem, 6vw, 5rem);
}

.page-title {
  font-size: clamp(2.5rem, 6vw, 4.25rem);
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -0.03em;
}

.page-head__intro {
  max-width: 52ch;
}

/* ==========================================================================
   2. Archive
   ========================================================================== */

.archive {
  padding-top: clamp(2.5rem, 5vw, 4rem);
}

.entry + .entry {
  border-top: 1px solid var(--hairline);
}

.entry > a {
  display: grid;
  grid-template-columns: minmax(120px, 168px) 1fr auto;
  align-items: start;
  gap: clamp(1.25rem, 3vw, 2.5rem);
  padding: clamp(1.75rem, 3vw, 2.5rem) 0;
}

.entry__meta {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  padding-top: 0.3rem;
  color: var(--fg-faint);
  font-size: var(--step-small);
  line-height: 1.4;
}

.entry__cat {
  font-size: var(--step-eyebrow);
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.entry__body {
  display: block;
  max-width: 62ch;
}

.entry__title {
  display: block;
  font-size: clamp(1.1rem, 1.7vw, 1.375rem);
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.015em;
  transition: color 0.2s linear;
}

.entry__excerpt {
  display: block;
  margin-top: 0.625rem;
  color: var(--fg-muted);
  font-size: var(--step-small);
  line-height: 1.8;
}

.entry .i-arrow {
  align-self: center;
  color: var(--accent);
  transition: transform 0.4s var(--ease-out);
}

.entry > a:hover .entry__title,
.entry > a:focus-visible .entry__title {
  color: var(--accent);
}

.entry > a:hover .i-arrow {
  transform: translateX(6px);
}

.archive__empty {
  max-width: 46ch;
  color: var(--fg-muted);
}

.archive__empty a {
  color: var(--accent);
  border-bottom: 1px solid currentColor;
}

/* ==========================================================================
   3. Post head
   ========================================================================== */

.article__head {
  padding-top: clamp(8rem, 14vw, 11rem);
  padding-bottom: clamp(2.5rem, 5vw, 4rem);
}

.article__back {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: clamp(2rem, 4vw, 3rem);
  color: var(--fg-muted);
  font-size: var(--step-small);
  font-weight: 500;
  transition: color 0.2s linear, gap 0.35s var(--ease-out);
}

.article__back:hover,
.article__back:focus-visible {
  color: var(--accent);
  gap: 1rem;
}

.article__back .i-arrow {
  width: 16px;
  height: 16px;
}

/* The shared .eyebrow is a flex row, which wraps badly once it carries
   date + category + reading time. Here it behaves as normal text with the
   dash set inline. */
.article__head .eyebrow {
  display: block;
  line-height: 1.7;
}

.article__head .eyebrow::before {
  display: inline-block;
  width: 12px;
  margin-right: 0.625rem;
  vertical-align: middle;
}

.article__head .eyebrow time {
  white-space: nowrap;
}

.article__title {
  max-width: 20ch;
  font-size: clamp(2.1rem, 5vw, 3.5rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.article__standfirst {
  max-width: 54ch;
  margin-top: 1.75rem;
  color: var(--fg-muted);
  font-size: var(--step-lead);
  font-weight: 400;
  line-height: 1.55;
  letter-spacing: -0.01em;
}

/* Featured image straddles the band change, the same device the service cards
   use on the homepage. */
.article__figure {
  background: linear-gradient(
    to bottom,
    var(--ink-900) 50%,
    var(--ink-800) 50%
  );
}

.article__figure img {
  width: 100%;
  max-height: 460px;
  object-fit: cover;
  border-radius: 3px;
  box-shadow: 0 34px 60px -34px rgba(0, 0, 0, 0.85);
}

/* ==========================================================================
   4. Article body — Read mode: comprehension first
   ========================================================================== */

.article__body-band {
  padding-top: clamp(3rem, 6vw, 5rem);
}

.article__body {
  max-width: var(--measure);
  color: var(--fg-read);
  font-size: 1.0625rem;
  line-height: 1.85;
}

.article__body > * + * {
  margin-top: 1.5rem;
}

/* More space above a heading than below it. */
.article__body h2,
.article__body h3,
.article__body h4 {
  color: var(--fg);
  letter-spacing: -0.02em;
}

.article__body h2 {
  margin-top: 3.5rem;
  font-size: clamp(1.5rem, 2.6vw, 1.9rem);
  font-weight: 600;
  line-height: 1.25;
}

.article__body h3 {
  margin-top: 2.75rem;
  font-size: clamp(1.2rem, 2vw, 1.4rem);
  font-weight: 600;
  line-height: 1.3;
}

.article__body h4 {
  margin-top: 2.25rem;
  font-size: 1.0625rem;
  font-weight: 600;
}

.article__body h2 + *,
.article__body h3 + *,
.article__body h4 + * {
  margin-top: 0.875rem;
}

.article__body a {
  color: var(--accent);
  border-bottom: 1px solid rgba(249, 178, 51, 0.4);
  transition: border-color 0.2s linear;
}

.article__body a:hover,
.article__body a:focus-visible {
  border-bottom-color: currentColor;
}

.article__body strong {
  color: var(--fg);
  font-weight: 600;
}

.article__body em {
  font-style: italic;
}

/* Lists — amber markers, drawn rather than glyphs */
.article__body ul,
.article__body ol {
  padding-left: 1.5rem;
  list-style: none;
}

.article__body li + li {
  margin-top: 0.625rem;
}

.article__body ul > li {
  position: relative;
}

.article__body ul > li::before {
  content: "";
  position: absolute;
  left: -1.25rem;
  top: 0.78em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.article__body ol {
  counter-reset: li;
}

.article__body ol > li {
  position: relative;
  counter-increment: li;
}

.article__body ol > li::before {
  content: counter(li);
  position: absolute;
  left: -1.75rem;
  top: 0;
  width: 1.25rem;
  color: var(--accent);
  font-size: var(--step-small);
  font-weight: 600;
  text-align: right;
}

.article__body blockquote {
  margin-left: 0;
  margin-right: 0;
  padding-left: clamp(1.25rem, 3vw, 2rem);
  border-left: 1px solid var(--accent);
  color: var(--fg);
  font-size: var(--step-lead);
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: -0.015em;
}

.article__body blockquote p + p {
  margin-top: 1rem;
}

/* Code — monospace here is measurement, not costume */
.article__body code {
  padding: 0.15em 0.4em;
  background: var(--ink-700);
  border-radius: 3px;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.875em;
  color: var(--fg);
}

.article__body pre {
  overflow-x: auto;
  padding: clamp(1.1rem, 2.4vw, 1.6rem);
  background: var(--ink-900);
  border-radius: 4px;
  font-size: 0.875rem;
  line-height: 1.7;
  -webkit-overflow-scrolling: touch;
}

.article__body pre code {
  padding: 0;
  background: none;
  border-radius: 0;
  font-size: inherit;
  color: var(--fg-read);
}

.article__body img {
  width: 100%;
  border-radius: 3px;
}

.article__body figure {
  margin: 0;
}

.article__body figcaption {
  margin-top: 0.75rem;
  color: var(--fg-faint);
  font-size: var(--step-small);
}

.article__body hr {
  height: 1px;
  margin: clamp(2.5rem, 5vw, 3.5rem) 0;
  border: 0;
  background: var(--hairline);
}

/* Tables scroll inside their own container rather than widening the page */
.article__body .table-scroll,
.article__body table {
  display: block;
  overflow-x: auto;
  max-width: 100%;
}

.article__body table {
  border-collapse: collapse;
  font-size: var(--step-small);
}

.article__body th,
.article__body td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--hairline);
  text-align: left;
  white-space: nowrap;
}

.article__body th {
  color: var(--fg);
  font-weight: 600;
}

.article__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
  max-width: var(--measure);
  margin-top: clamp(2.5rem, 5vw, 3.5rem);
  padding-top: clamp(1.5rem, 3vw, 2rem);
  border-top: 1px solid var(--hairline);
}

.article__tags li {
  padding: 0.3rem 0.75rem;
  background: var(--ink-750);
  border-radius: 3px;
  color: var(--fg-muted);
  font-size: var(--step-eyebrow);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* ==========================================================================
   5. Prev / next
   ========================================================================== */

.article__nav {
  padding-top: clamp(2.5rem, 5vw, 4rem);
  padding-bottom: clamp(2.5rem, 5vw, 4rem);
}

.article__nav-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(1.5rem, 4vw, 3rem);
}

.article__nav-link {
  display: block;
  padding: clamp(1.25rem, 2.4vw, 1.75rem);
  background: var(--ink-750);
  transition: transform 0.4s var(--ease-out);
}

.article__nav-link--next {
  text-align: right;
}

.article__nav-link:hover {
  transform: translateY(-4px);
}

.article__nav-label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--accent);
  font-size: var(--step-eyebrow);
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.article__nav-title {
  display: block;
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.01em;
}

/* ==========================================================================
   6. Responsive
   ========================================================================== */

@media (max-width: 880px) {
  .entry > a {
    grid-template-columns: 1fr auto;
    gap: 0.5rem 1rem;
  }

  .entry__meta {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
    padding-top: 0;
  }

  .entry .i-arrow {
    align-self: start;
    margin-top: 0.25rem;
  }
}

@media (max-width: 620px) {
  .page-head {
    padding-top: 8rem;
  }

  .article__head {
    padding-top: 7.5rem;
  }

  .article__body {
    font-size: 1rem;
  }

  .article__figure img {
    max-height: 260px;
  }

  .article__nav-grid {
    grid-template-columns: 1fr;
  }

  .article__nav-link--next {
    text-align: left;
  }
}
