/*
 * The stylesheet for pages this process renders as strings: the blog, and the
 * notices a form or an email link lands on.
 *
 * The frame, palette, fonts, masthead, footer and buttons come from tokens.css,
 * which is linked ahead of this one by src/web/layout.ts — a <link> rather than
 * an @import here, because a server-rendered page controls its own head and can
 * simply state the order instead of paying for a second round trip.
 *
 * The design is a fixed 1240px desktop layout of inline styles
 * (design/Solheim landing page design/Solheim Blog - Editorial.dc.html). This
 * is the same language rebuilt with the landing page's two breakpoints; its
 * 4-column archive rows are unreadable below ~1000px otherwise.
 *
 * Where a rule already exists on the landing page in the same form — the
 * headings, the lede, the section head, the numbered rows — it is repeated here
 * rather than shared, because landing.css is that page's stylesheet and pulling
 * a third file in between the two would cost every page a request to save
 * sixty lines.
 */

/* --- typography ------------------------------------------------------------ */

h1 {
  font-size: clamp(34px, 7.4vw, 92px);
  font-weight: 700;
  line-height: 0.92;
  letter-spacing: -0.045em;
  text-transform: uppercase;
  text-wrap: balance;
  margin: 22px 0 0;
}

h2 {
  font-size: clamp(26px, 4.4vw, 50px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.04em;
  text-transform: uppercase;
  text-wrap: balance;
  margin: 0;
}

.lede {
  font-size: 20px;
  line-height: 1.5;
  color: var(--fg);
  max-width: 34em;
  margin: 26px 0 0;
  text-wrap: pretty;
}

/* The mono line that carries dates, read times and bylines. */
.meta {
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.8;
  color: var(--fg-dim);
  margin: 0;
}

.band__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--rule-heavy);
  flex-wrap: wrap;
}
.band__head h2 {
  font-size: clamp(24px, 3vw, 30px);
  font-weight: 600;
  letter-spacing: -0.03em;
}

/* --- index: masthead -------------------------------------------------------- */

.blog-hero {
  padding: 48px 0 40px;
  border-bottom: 2px solid var(--rule-heavy);
}

/* --- index: the latest note ------------------------------------------------- */

.featured {
  display: grid;
  grid-template-columns: 0.32fr 0.68fr;
  gap: 48px;
  padding: 44px 0 0;
}
.featured__meta .meta {
  margin: 14px 0 0;
}
.featured__body h2 {
  font-size: clamp(30px, 4.4vw, 52px);
  line-height: 0.98;
}
.featured__body h2 a {
  color: var(--fg);
}
.featured__body h2 a:hover {
  color: var(--accent-text);
}
.featured__dek {
  font-size: 20px;
  line-height: 1.5;
  color: var(--fg-body);
  margin: 20px 0 0;
  max-width: 40em;
  text-wrap: pretty;
}
.featured__read {
  display: flex;
  align-items: center;
  gap: 20px;
  margin: 26px 0 0;
  flex-wrap: wrap;
}

/* --- index: the archive ----------------------------------------------------- */

.archive {
  padding: 64px 0 0;
}

.chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.chip {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 9px 15px;
  border: 1px solid var(--rule-heavy);
  color: var(--fg);
  transition: background-color 120ms ease, color 120ms ease;
}
.chip:hover {
  background: var(--surface);
  color: var(--fg);
}
.chip--on {
  background: var(--rule-heavy);
  color: var(--bg);
}
.chip--on:hover {
  background: var(--rule-heavy);
  color: var(--bg);
}

.rows {
  list-style: none;
  margin: 0;
  padding: 0;
}

.row {
  display: grid;
  grid-template-columns: 46px 1.5fr 1.3fr 150px;
  gap: 28px;
  padding: 26px 0;
  border-bottom: 1px solid var(--rule);
  align-items: baseline;
  transition: background-color 120ms ease;
}
.row:hover {
  background: var(--surface);
}

.row__n {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-text);
}
.row__title {
  display: block;
  font-size: 27px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--fg);
}
.row__title:hover {
  color: var(--accent-text);
}
.row__category {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-dim);
  margin: 8px 0 0;
}
.row__body {
  font-size: 16px;
  line-height: 1.5;
  color: var(--fg-body);
  margin: 0;
}
.row__meta {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.8;
  color: var(--fg-dim);
  margin: 0;
  text-align: right;
}

.archive__empty {
  font-size: 18px;
  color: var(--fg-body);
  margin: 26px 0 0;
}

/* --- index: subscribe ------------------------------------------------------- */

.subscribe {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  flex-wrap: wrap;
  margin: 72px 0 0;
  padding: 44px 0;
  border-top: 2px solid var(--rule-heavy);
  border-bottom: 2px solid var(--rule-heavy);
}
.subscribe h2 {
  font-size: clamp(28px, 3.6vw, 44px);
  line-height: 0.95;
}
.subscribe .meta {
  font-size: 13px;
  margin: 14px 0 0;
  max-width: 34em;
}

.subscribe__row {
  display: grid;
  grid-template-columns: minmax(0, 260px) auto;
  margin: 10px 0 0;
}
.subscribe__input {
  font-family: var(--font-mono);
  font-size: 13.5px;
  padding: 15px 18px;
  border: 1px solid var(--rule-heavy);
  border-right: 0;
  background: var(--surface);
  color: var(--fg);
  min-width: 0;
}
.subscribe__input::placeholder {
  color: var(--fg-faint);
}
.subscribe__form .btn {
  padding: 15px 24px;
}
.subscribe__note {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  color: var(--fg-faint);
  margin: 10px 0 0;
}

/* --- article ---------------------------------------------------------------- */

.article__back {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: 44px 0 28px;
}

.article__head {
  padding: 0 0 40px;
  border-bottom: 2px solid var(--rule-heavy);
}
.article__head h1 {
  font-size: clamp(32px, 6.2vw, 76px);
  line-height: 0.94;
  max-width: 16em;
}
.article__dek {
  font-size: 22px;
  line-height: 1.45;
  color: var(--fg-body);
  margin: 24px 0 0;
  max-width: 34em;
  text-wrap: pretty;
}

.article__body {
  display: grid;
  grid-template-columns: 0.3fr 0.7fr;
  gap: 56px;
  padding: 40px 0 0;
}
/*
 * A grid item refuses to shrink below its content's min-content width unless
 * told otherwise, and a code block's longest line is unbreakable — so without
 * this the whole page scrolls sideways at 390px instead of the block scrolling
 * inside its own box. Verified by bun run check:responsive.
 */
.article__aside,
.prose,
.featured__meta,
.featured__body {
  min-width: 0;
}

.article__aside {
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.9;
  color: var(--fg-dim);
  /* Long articles are read scrolling; the byline and contents follow along. */
  position: sticky;
  top: 24px;
  align-self: start;
}
.article__byline {
  margin: 0;
  padding: 0 0 14px;
  border-bottom: 1px solid var(--rule);
}
.article__contents {
  margin: 16px 0 0;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-text);
}
.article__toc {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
}
.article__toc a {
  color: var(--fg-dim);
}
.article__toc a:hover {
  color: var(--accent-text);
}

.article__cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  margin: 40px 0 0;
  padding: 26px 0 0;
  border-top: 2px solid var(--rule-heavy);
}

/* --- the rendered markdown -------------------------------------------------- */

/*
 * Everything under .prose comes from a markdown file, so these are element
 * selectors rather than classes: a writer cannot be asked to remember class
 * names, and Bun.markdown does not emit any.
 */
.prose {
  max-width: 34em;
}
.prose > :first-child {
  margin-top: 0;
}

.prose p {
  font-size: 19px;
  line-height: 1.65;
  color: var(--fg);
  margin: 26px 0 0;
  text-wrap: pretty;
}

.prose h2 {
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin: 48px 0 0;
}
.prose h3 {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-text);
  margin: 36px 0 0;
}

.prose ul,
.prose ol {
  font-size: 19px;
  line-height: 1.65;
  color: var(--fg);
  margin: 22px 0 0;
  padding-left: 22px;
}
.prose li + li {
  margin-top: 8px;
}

.prose a {
  border-bottom: 1px solid var(--accent-edge);
}

/* The design's pull quote. In markdown that is a blockquote. */
.prose blockquote {
  margin: 34px 0 0;
  padding: 22px 0;
  border-top: 2px solid var(--rule-heavy);
  border-bottom: 2px solid var(--rule-heavy);
}
.prose blockquote p {
  font-size: 28px;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.025em;
  margin: 0;
}

.prose pre {
  margin: 30px 0 0;
  padding: 20px;
  border: 1px solid var(--rule-heavy);
  background: var(--surface);
  /* A snippet is copied, not reflowed: scroll the block, never the page. */
  overflow-x: auto;
}
.prose pre code {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.8;
  color: var(--fg-body);
}
.prose :not(pre) > code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  padding: 2px 5px;
  background: var(--surface);
  border: 1px solid var(--rule);
}

.prose img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 30px 0 0;
}

.prose hr {
  margin: 40px 0 0;
  border: 0;
  border-top: 1px solid var(--rule);
}

.prose table {
  width: 100%;
  margin: 30px 0 0;
  border-collapse: collapse;
  font-size: 16px;
}
.prose th,
.prose td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--rule);
}
.prose th {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
  border-bottom-color: var(--rule-heavy);
}

/* --- notices ---------------------------------------------------------------- */

/* The one-message page: a form reply, a confirmation, a dead link. */
.notice {
  padding: 72px 0 96px;
  max-width: 34em;
}
/* A sentence of news, not a masthead: the page's h1 size would shout it. */
.notice h1 {
  font-size: clamp(30px, 4.4vw, 52px);
  line-height: 0.98;
}
.notice__back {
  margin: 32px 0 0;
}

/* --- breakpoints ------------------------------------------------------------ */

@media (max-width: 1040px) {
  .featured,
  .article__body {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .article__aside {
    position: static;
  }
  .prose {
    max-width: none;
  }

  /*
   * The 4-column archive stops being a row: the number keeps its rail and
   * everything after the title stacks under it, which is the only reading
   * order that still works.
   */
  .row {
    grid-template-columns: 46px 1fr;
    gap: 10px 24px;
  }
  .row > :nth-child(n + 3) {
    grid-column: 2;
  }
  .row__meta {
    text-align: left;
  }
}

@media (max-width: 720px) {
  :root {
    --gutter: 22px;
  }

  .row {
    grid-template-columns: 34px 1fr;
    gap: 10px 20px;
  }
  .row__title {
    font-size: 23px;
  }
  .lede,
  .article__dek {
    font-size: 19px;
  }
  .prose p,
  .prose ul,
  .prose ol {
    font-size: 17px;
  }
  .prose blockquote p {
    font-size: 23px;
  }
  .prose h2 {
    font-size: 26px;
  }

  .site-nav {
    gap: 16px;
  }
  .subscribe__row {
    grid-template-columns: 1fr;
  }
  .subscribe__input {
    border-right: 1px solid var(--rule-heavy);
  }

  /* Forced line breaks are a desktop measure; at this width the text wraps. */
  h1 br {
    display: none;
  }
}
