@layer reset, base, layout, components, responsive;

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  body, h1, h2, h3, p, figure { margin: 0; }
  img, svg { display: block; max-width: 100%; }
  a { color: inherit; }
}
@layer base {
  :root {
    color-scheme: light;
    --paper: #ffffff;
    --surface: #f4f3ef;
    --image: #e8e7e3;
    --ink: #191919;
    --muted: #5f5f5a;
    --line: #d4d4ce;
    --accent: #28734e;
    --serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
    --sans: 'Barlow Semi Condensed', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  }
  html { scroll-padding-top: 2rem; }
  body { background: var(--paper); color: var(--ink); font: 16px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
  ::selection { background: #dce6c9; color: var(--ink); }
  a { text-underline-offset: .22em; text-decoration-thickness: 1px; }
  a:hover { color: var(--accent); }
  a:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 6px; border-radius: 1px; }
  h1, h2, h3 { font-family: var(--sans); font-weight: 800; }
  p { text-wrap: pretty; }
  h1, h2, h3 { text-wrap: balance; }
}
@layer layout {
  .wrap { width: min(1184px, calc(100% - 112px)); margin-inline: auto; }
  .site-header { display: flex; align-items: center; justify-content: space-between; padding-block: 28px 16px; border-bottom: 2px solid var(--accent); gap: 24px; }
  .site-header nav { display: flex; gap: 32px; align-items: center; font-size: 14px; }
  .site-header nav a { text-decoration: none; }
  .site-header nav [aria-current] { text-decoration: underline; }
  .publication-intro { display: flex; align-items: center; gap: 22px; padding-block: 28px; font-size: 16px; }
  .publication-intro p { max-width: 76ch; }
  .publication-intro .text-link { margin-top: 8px; }
  .more-stories { margin-top: 56px; padding-top: 25px; border-top: 1px solid var(--line); }
  .section-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 20px; margin-bottom: 24px; }
  .section-heading h2 { font-size: 14px; font-weight: 600; }
  .featured { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); background: var(--paper); min-height: 365px; gap: 48px; }
  .featured-copy { padding: 26px 0; align-self: center; }
  .featured h1 { font: 800 clamp(46px, 5.7vw, 68px)/1.01 var(--sans); letter-spacing: -.025em; text-transform: uppercase; margin: 16px 0; }
  .featured-copy > p { color: var(--muted); font-size: 20px; line-height: 1.4; max-width: 44ch; }
  .featured-copy > .text-link { margin-top: 25px; }
  .story-grid { display: grid; gap: 28px; }
  .secondary-story { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 28px; align-items: start; }
  .secondary-story + .secondary-story { padding-top: 28px; border-top: 1px solid var(--line); }
  .secondary-copy { min-width: 0; }
  .secondary-story h3 { font: 800 31px/1.07 var(--sans); text-transform: uppercase; letter-spacing: -.025em; margin: 11px 0; max-width: 27ch; }
  .secondary-copy > p { color: var(--muted); font-size: 17px; line-height: 1.4; max-width: 65ch; }
  .site-footer { display: flex; justify-content: space-between; gap: 30px; padding-block: 30px 40px; margin-top: 55px; border-top: 1px solid var(--line); }
  .footer-links { font-size: 12px; color: var(--muted); }
  .footer-links { display: flex; align-items: flex-end; flex-wrap: wrap; column-gap: 25px; row-gap: 10px; }
  .footer-links a { text-decoration: none; }
  .article-shell { max-width: 1050px; }
  .article-back { display: inline-block; margin-top: 40px; }
  .article-opening { max-width: 860px; margin: 30px auto 36px; }
  .article-opening.has-explainer { max-width: none; display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(260px, 1fr); gap: 48px; align-items: start; }
  .article-header h1, .page-header h1 { font: 800 clamp(42px, 5.5vw, 67px)/1.01 var(--sans); letter-spacing: -.025em; text-transform: uppercase; margin: 20px 0; }
  .article-header .eyebrow { margin-top: 0; }
  .has-explainer .article-header h1 { font-size: clamp(42px, 5vw, 64px); }
  .article-image { margin-bottom: 48px; }
  .article-hero { aspect-ratio: 16 / 7; }
  .article-image figcaption { padding-top: 9px; font-size: 12px; color: var(--muted); }
  .article-deck { font-size: 21px; line-height: 1.4; color: var(--muted); max-width: 65ch; }
  .article-body { max-width: 650px; margin-inline: auto; }
  .article-end { max-width: 650px; margin: 50px auto 25px; border-top: 1px solid var(--line); padding-top: 25px; }
  .articles-shell { padding-block: 48px; }
  .article-list { list-style: none; padding: 0; margin: 0; }
  .article-list-item { display: grid; grid-template-columns: 165px minmax(0, 1fr); gap: 25px; padding-block: 25px; border-top: 1px solid var(--line); }
  .article-list-item .story-art { aspect-ratio: 4 / 3; }
  .article-list-item h2 { font: 800 32px/1.07 var(--sans); text-transform: uppercase; margin: 9px 0; }
  .article-list-item p { color: var(--muted); max-width: 65ch; }
  .page-shell { max-width: 780px; padding-block: 68px 60px; }
  .page-header { margin-bottom: 45px; }
}
@layer components {
  .masthead-identity { --logo-size: 64px; --logo-gap: 13px; position: relative; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 5px; min-height: var(--logo-size); padding-left: calc(var(--logo-size) + var(--logo-gap)); }
  .masthead-author { font-size: 14px; line-height: 1; color: var(--muted); text-decoration: none; white-space: nowrap; }
  .masthead-author:hover { text-decoration: underline; }
  .author-portrait { width: 72px; height: 72px; flex: 0 0 auto; border-radius: 50%; object-fit: cover; }
  .about-header { display: flex; flex-direction: row-reverse; align-items: center; gap: 32px; }
  .about-header > div { flex: 1; min-width: 0; }
  .about-header .author-portrait { width: 140px; height: 140px; }
  .author-card { display: flex; align-items: flex-start; gap: 20px; font-size: 14px; }
  .author-card > div { min-width: 0; }
  .author-card-name { font-weight: 600; margin-bottom: 8px; }
  .author-card-name span { color: var(--muted); font-weight: 400; }
  .author-links { display: flex; flex-wrap: wrap; gap: 10px 22px; margin-top: 12px; }
  .corrections-invite { font-size: 14px; margin-block: 24px; }
  .footer-credit { margin-top: 6px; font-size: 13px; color: var(--muted); }
  .article-explainer { background: var(--surface); padding: 26px 27px 24px; }
  .article-explainer h2 { font-size: 21px; font-weight: 600; line-height: 1.2; margin-bottom: 24px; }
  .explainer-equation { font: clamp(28px, 3.3vw, 34px)/1.2 var(--serif); margin-bottom: 21px; }
  .explainer-condition { display: block; font-size: .7em; margin-top: 8px; }
  .article-explainer p { font-size: 17px; line-height: 1.45; }
  .article-explainer p + p { margin-top: 15px; }
  .article-byline { margin-top: 20px; font-size: 14px; }
  .skip-link { position: absolute; z-index: 10; left: 16px; top: -100px; background: var(--ink); color: white; padding: 10px 20px; }
  .skip-link:focus { top: 12px; }
  .preview-notice { font-size: 12px; text-align: center; padding: 7px 20px; background: var(--surface); color: var(--muted); }
  .preview-notice span { margin-inline: 8px; }
  .wordmark { display: flex; align-items: center; text-decoration: none; color: var(--ink); }
  .wordmark > span { font: 600 36px/1 var(--sans); letter-spacing: -.02em; white-space: nowrap; }
  .wordmark picture { position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: var(--logo-size); height: var(--logo-size); background: var(--accent); mask: url(logo/refined.svg) center / contain no-repeat; }
  .wordmark picture img { visibility: hidden; }
  .wordmark-dot { color: var(--accent); }
  .footer-name { font: 600 27px/1.4 var(--sans); letter-spacing: -.02em; text-decoration: none; }
  .eyebrow { color: var(--accent); font-size: 13px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; }
  .eyebrow > span { margin-inline: 8px; font-weight: 400; }
  .text-link { color: var(--accent); display: inline-flex; gap: 18px; align-items: center; font-size: 13px; font-weight: 500; text-decoration: none; white-space: nowrap; }
  .text-link span { font-size: 19px; font-weight: 400; }
  .story-card :is(h1, h2, h3) a { text-decoration: none; }
  .story-card :is(h1, h2, h3) a:hover { color: var(--accent); }
  .story-meta { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 19px; color: var(--muted); font-size: 11px; }
  .story-art { --art-paper: var(--image); --art-accent: #9a6044; background: var(--art-paper); color: #647967; overflow: hidden; }
  .story-art svg { width: 100%; height: 100%; object-fit: contain; }
  .proof, .robot, .groups { display: grid; place-items: center; }
  .story-art img { width: 100%; height: 100%; min-height: 0; object-fit: contain; }
  .featured-art { display: grid; align-items: center; padding: 20px; }
  .secondary-story .story-art { aspect-ratio: 4 / 3; }
  .proof { background: #fff; }
  .robot { background: transparent; }
  .robot img { object-fit: cover; }
  .robot.article-hero img { object-position: 50% 60%; }
  .robot.article-hero { background: #ede7da; }
  .groups { --art-paper: #faf3e2; --art-accent: #a25b44; color: #657e7b; }
  .groups.article-hero { aspect-ratio: 3 / 2; }
  .article-image-groups { max-width: 690px; margin-inline: auto; }
  .art-orbit { stroke: currentColor; stroke-width: 1px; opacity: .25; }
  .art-grid { stroke: currentColor; stroke-width: .5px; opacity: .15; }
  .art-shadow { fill: currentColor; opacity: .08; }
  .back-link { font-size: 12px; text-decoration: none; color: var(--muted); }
  .back-link span { margin-right: 8px; }
  .prose { font: 20px/1.5 var(--serif); overflow-wrap: anywhere; }
  .prose > * + * { margin-top: 1.25em; }
  .prose h2 { font: 700 31px/1.12 var(--sans); letter-spacing: -.025em; margin-top: 2em; }
  .prose h3 { font: 700 25px/1.2 var(--sans); margin-top: 1.8em; }
  .prose a { color: var(--accent); }
  .prose a:hover { color: var(--accent); }
  .prose blockquote { border-left: 2px solid var(--accent); padding-left: 24px; margin-inline: 0; }
  .prose code { font-size: .8em; background: var(--surface); padding: .12em .3em; border-radius: 3px; }
  .prose pre { overflow-x: auto; padding: 20px; background: var(--surface); }
  .prose pre code { padding: 0; }
  .prose hr { border: 0; border-top: 1px solid var(--line); margin-block: 2.5em 1.5em; }
  .prose hr ~ p:last-child { font: 13px/1.75 var(--sans); color: var(--muted); }
  .prose table { width: 100%; border-collapse: collapse; font-size: .9em; }
  .prose th, .prose td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); }
  .prose math[display='block'], .prose .katex { max-width: 100%; overflow-x: auto; }
  .coming-soon { padding: 60px 40px; background: var(--surface); }
  .coming-soon h1 { font: 800 40px/1.1 var(--sans); margin: 15px 0; }
  .coming-soon p { max-width: 56ch; color: var(--muted); margin-bottom: 22px; }
}
@layer responsive {
  @media (max-width: 900px) {
    .wrap { width: calc(100% - 64px); }
    .featured-copy { padding: 24px 0; }
    .featured { grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 28px; }
    .featured-art { padding: 0; }
    .site-footer { flex-direction: column; gap: 18px; }
    .article-opening.has-explainer { gap: 28px; grid-template-columns: minmax(0, 1.3fr) minmax(240px, 1fr); }
  }
  @media (max-width: 700px) {
    .article-opening.has-explainer { grid-template-columns: minmax(0, 1fr); }
  }
  @media (max-width: 600px) {
    .wrap { width: calc(100% - 40px); }
    .site-header { padding-block: 20px 12px; gap: 12px; flex-wrap: wrap; }
    .masthead-identity { --logo-size: 48px; --logo-gap: 9px; }
    .masthead-author { font-size: 12px; }
    .publication-intro { align-items: flex-start; gap: 16px; }
    .publication-intro .author-portrait { width: 64px; height: 64px; }
    .about-header { flex-direction: column; align-items: flex-start; gap: 24px; }
    .about-header .author-portrait { width: 112px; height: 112px; }
    .author-card { flex-direction: column; gap: 16px; }
    .wordmark img { width: 48px; height: 48px; }
    .wordmark picture { mask-image: url(logo/compact.svg); }
    .wordmark > span { font-size: 29px; }
    .site-header nav { gap: 20px; font-size: 12px; }
    .feed-link { display: none; }
    .publication-intro { font-size: 14px; padding-block: 20px; }
    .section-heading { margin-bottom: 19px; }
    .featured { grid-template-columns: 1fr; }
    .featured-copy { padding: 0; }
    .featured h1 { font-size: 48px; }
    .featured-art { max-height: 245px; border-top: 1px solid var(--line); }
    .featured-art :is(svg, img) { max-height: 245px; }
    .more-stories { margin-top: 40px; }
    .story-grid { gap: 24px; }
    .secondary-story { grid-template-columns: 100px minmax(0, 1fr); gap: 12px 18px; }
    .secondary-story > a { grid-row: 1 / 3; }
    .secondary-copy { display: contents; }
    .secondary-copy > :is(.eyebrow, h3) { grid-column: 2; }
    .secondary-copy > :is(p, .story-meta) { grid-column: 1 / -1; }
    .secondary-copy .story-meta { margin-top: 0; }
    .secondary-story + .secondary-story { padding-top: 24px; }
    .secondary-copy > p { font-size: 16px; }
    .article-list-item { grid-template-columns: minmax(0, 1fr); gap: 20px; }
    .article-list-item .story-art { aspect-ratio: 16 / 9; }
    .secondary-story h3 { font-size: 25px; margin: 0; }
    .site-footer { padding-block: 28px; }
    .article-back { margin-top: 28px; }
    .article-opening { margin-top: 28px; margin-bottom: 30px; }
    .article-hero { aspect-ratio: 4 / 3; }
    .groups.article-hero { aspect-ratio: 3 / 2; }
    .article-image { margin-bottom: 32px; }
    .article-header h1, .page-header h1 { font-size: 43px; }
    .article-deck { font-size: 18px; }
    .prose { font-size: 19px; line-height: 1.5; }
    .prose h2 { font-size: 28px; }
    .page-shell { padding-block: 42px; }
    .coming-soon { padding: 35px 25px; }
    .coming-soon h1 { font-size: 33px; }
  }
  @media (max-width: 350px) {
    .featured h1, .article-header h1, .page-header h1 { font-size: 41px; }
  }
  @media print {
    .site-header nav, .site-footer, .preview-notice, .article-end, .back-link { display: none; }
    body { background: white; }
    .wrap { width: 100%; }
    .prose { font-size: 12pt; }
  }
}
