/* rkj dev Blog: the home page's candlelit palette, tuned for long reading. */
:root {
  --night: #16101a;
  --dusk: #1f1824;
  --dusk-2: #251d2b;
  --wick: #372c3d;
  --underline: #5b4b61;
  --ash: #a69daa;
  --bone: #efe7dc;
  --flame: #f4b860;
  --ember: #c8703f;
  --violet: #6e4a9e;
  --display: "Unbounded", ui-sans-serif, system-ui, sans-serif;
  --text: "Hanken Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --gutter: clamp(16px, 5vw, 48px);
  --ease-out: cubic-bezier(.2, .7, .1, 1);
  --radius: 18px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 96px; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0; background: var(--night); color: var(--bone);
  font: 400 17px/1.65 var(--text); -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--flame); outline-offset: 3px; border-radius: 4px; }
.wrap { position: relative; max-width: 1160px; margin: 0 auto; padding: 0 var(--gutter); }

.skip {
  position: absolute; left: var(--gutter); top: -48px; z-index: 40;
  background: var(--flame); color: var(--night); padding: 8px 14px; border-radius: 8px; font-weight: 600; text-decoration: none;
}
.skip:focus { top: 12px; }

.backdrop {
  position: fixed; inset: 0; z-index: -2; pointer-events: none; overflow: hidden;
  background: linear-gradient(170deg, #1a1320 0%, #16101a 38%, #130e17 72%, #110c14 100%);
}
.backdrop::before {
  content: ""; position: absolute; inset: -20%;
  background:
    radial-gradient(40% 30% at 12% 0%, rgba(244, 184, 96, .10), transparent 70%),
    radial-gradient(38% 32% at 86% 14%, rgba(110, 74, 158, .16), transparent 70%),
    radial-gradient(40% 34% at 70% 92%, rgba(84, 58, 132, .12), transparent 70%);
}
.backdrop::after {
  content: ""; position: absolute; inset: 0; opacity: .05; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Header */
.top { position: sticky; top: 0; z-index: 20; border-bottom: 1px solid transparent; transition: background-color .15s ease, border-color .15s ease; }
.top.scrolled {
  background: rgba(22, 16, 26, .76);
  -webkit-backdrop-filter: blur(14px) saturate(1.2); backdrop-filter: blur(14px) saturate(1.2);
  border-bottom-color: rgba(55, 44, 61, .7);
}
.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 24px; height: 72px; }
.mark { display: inline-flex; align-items: center; gap: 10px; font: 500 16px/1 var(--display); letter-spacing: .01em; text-decoration: none; }
.mark::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--flame); box-shadow: 0 0 14px 3px rgba(244, 184, 96, .45); }
.top nav { display: flex; gap: clamp(14px, 3vw, 32px); }
.top nav a { color: var(--ash); text-decoration: none; font-size: 15px; font-weight: 500; padding: 6px 0; transition: color .25s ease; }
.top nav a:hover, .top nav a[aria-current] { color: var(--bone); }
.top nav a[aria-current] { box-shadow: inset 0 -1px 0 var(--flame); }

/* Reading progress */
.progress { position: fixed; inset: 0 0 auto 0; height: 2px; z-index: 30; pointer-events: none; }
.progress span {
  display: block; height: 100%; transform-origin: 0 50%; transform: scaleX(var(--p, 0));
  background: linear-gradient(90deg, var(--ember), var(--flame)); box-shadow: 0 0 12px rgba(244, 184, 96, .6);
}

/* Listing masthead */
.masthead { padding: clamp(40px, 8vh, 96px) 0 clamp(28px, 4vw, 44px); }
.eyebrow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0; color: var(--ash); font-size: 14px; font-weight: 500; }
.eyebrow a { color: var(--bone); }
.eyebrow .updated { color: var(--ash); font-weight: 400; }
.eyebrow .updated::before { content: "·"; margin-right: 12px; color: var(--underline); }
.live { width: 8px; height: 8px; border-radius: 50%; background: var(--flame); box-shadow: 0 0 0 0 rgba(244, 184, 96, .6); }
@media (prefers-reduced-motion: no-preference) { .live { animation: pulse 2.4s ease-out infinite; } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(244, 184, 96, .55); } 70% { box-shadow: 0 0 0 10px rgba(244, 184, 96, 0); } 100% { box-shadow: 0 0 0 0 rgba(244, 184, 96, 0); } }
.masthead h1 {
  margin: 22px 0 0; max-width: 15em;
  font: 300 clamp(38px, 6.6vw, 86px)/1 var(--display); letter-spacing: -.045em;
}
.intro { max-width: 40em; margin: 24px 0 0; color: var(--ash); font-size: clamp(17px, 1.6vw, 19px); }
.chips { display: flex; gap: 8px; margin-top: 32px; overflow-x: auto; scrollbar-width: none; padding-bottom: 4px; -webkit-mask-image: linear-gradient(90deg, #000 92%, transparent); mask-image: linear-gradient(90deg, #000 92%, transparent); }
.chips::-webkit-scrollbar { display: none; }
.chips a {
  flex: none; padding: 8px 15px; border-radius: 999px; border: 1px solid var(--wick);
  color: var(--ash); text-decoration: none; font-size: 14px; font-weight: 500; white-space: nowrap;
  transition: color .2s ease, border-color .2s ease, background-color .2s ease;
}
.chips a:hover { color: var(--bone); border-color: var(--underline); }
.chips a[aria-current] { color: var(--night); background: var(--flame); border-color: var(--flame); }
.empty { color: var(--ash); padding: 48px 0 96px; }

/* Cards */
.card { position: relative; min-width: 0; }
.card-link { display: flex; flex-direction: column; height: 100%; text-decoration: none; }
.thumb {
  position: relative; overflow: hidden; border-radius: var(--radius); aspect-ratio: 16 / 9;
  background: var(--dusk); border: 1px solid rgba(239, 231, 220, .06);
  box-shadow: 0 24px 48px -32px rgba(0, 0, 0, .8);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.2s var(--ease-out), filter .6s ease; filter: saturate(.95); }
.thumb::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(22, 16, 26, .35)); pointer-events: none; }
.card-link:hover .thumb img { transform: scale(1.04); filter: saturate(1.05); }
.card-body { padding-top: 16px; }
.meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; margin: 0; font-size: 13px; color: var(--ash); font-weight: 500; }
.cat { color: var(--flame); letter-spacing: .02em; }
.card h3 {
  margin: 10px 0 0; font: 400 20px/1.25 var(--display); letter-spacing: -.02em;
  transition: color .25s ease; text-wrap: balance;
}
.card-link:hover h3 { color: var(--flame); }
.card .dek { margin: 10px 0 0; color: var(--ash); font-size: 15.5px; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.foot-meta { margin: 12px 0 0; font-size: 13px; color: var(--underline); color: #8a7f8e; }

.top-stories { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: clamp(24px, 3vw, 40px); padding: 8px 0 clamp(48px, 7vw, 80px); border-bottom: 1px solid var(--wick); }
.card.lead h3 { font-size: clamp(26px, 3.2vw, 40px); line-height: 1.1; letter-spacing: -.03em; margin-top: 14px; }
.card.lead .dek { font-size: 17.5px; -webkit-line-clamp: 4; max-width: 38em; }
.card.lead .thumb { border-radius: 22px; box-shadow: 0 40px 80px -36px rgba(0, 0, 0, .85), 0 20px 70px -40px rgba(110, 74, 158, .55); }
.top-stories .side { display: grid; gap: clamp(24px, 3vw, 36px); align-content: start; }
.card.side h3 { font-size: 19px; }

.latest { padding: clamp(40px, 6vw, 72px) 0 24px; }
.latest h2, .related h2 { margin: 0 0 32px; font: 400 clamp(22px, 2.6vw, 28px)/1.2 var(--display); letter-spacing: -.02em; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: clamp(28px, 3.4vw, 44px) clamp(20px, 2.6vw, 32px); }

.pager { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 40px 0 72px; color: var(--ash); font-size: 15px; }
.pager a { color: var(--bone); text-decoration: none; padding: 10px 18px; border: 1px solid var(--wick); border-radius: 999px; transition: border-color .2s ease, color .2s ease; }
.pager a:hover { border-color: var(--flame); color: var(--flame); }

/* Article */
.post-head { padding-top: clamp(28px, 6vh, 72px); }
.crumbs { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 500; color: var(--ash); }
.crumbs a { text-decoration: none; color: var(--ash); transition: color .2s ease; }
.crumbs a:last-child { color: var(--flame); }
.crumbs a:hover { color: var(--bone); }
.crumbs span { color: var(--underline); }
.post-head h1 {
  margin: 20px 0 0; max-width: 19em;
  font: 400 clamp(32px, 5.2vw, 62px)/1.06 var(--display); letter-spacing: -.035em; text-wrap: balance;
}
.standfirst { max-width: 36em; margin: 22px 0 0; font-size: clamp(19px, 2vw, 23px); line-height: 1.5; color: #ddd3c7; }
.byline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 0; margin-top: 26px; font-size: 14px; color: var(--ash); }
.byline > * + *::before { content: ""; display: inline-block; width: 3px; height: 3px; border-radius: 50%; background: var(--underline); margin: 0 12px; vertical-align: middle; }
.byline .by { color: var(--bone); font-weight: 600; }
.byline a { color: var(--ash); text-decoration: underline; text-decoration-color: var(--underline); text-underline-offset: 4px; }
.byline a:hover { color: var(--flame); }

.hero-wrap { margin-top: clamp(28px, 4vw, 44px); }
.hero-fig { margin: 0; }
.hero-fig .img {
  overflow: hidden; border-radius: 24px; aspect-ratio: 16 / 9; background: var(--dusk);
  border: 1px solid rgba(239, 231, 220, .07);
  box-shadow: 0 50px 100px -40px rgba(0, 0, 0, .85), 0 30px 90px -50px rgba(110, 74, 158, .6);
}
.hero-fig img { width: 100%; height: 100%; object-fit: cover; }
figcaption { display: flex; flex-wrap: wrap; gap: 4px 14px; justify-content: space-between; margin-top: 12px; font-size: 13.5px; line-height: 1.5; color: var(--ash); }
figcaption .credit { color: #8a7f8e; white-space: nowrap; }
figcaption .credit a { color: #8a7f8e; }
figcaption .credit.ai::before { content: "✦ "; color: var(--flame); }

.layout { display: grid; grid-template-columns: 220px minmax(0, 700px); justify-content: space-between; gap: 56px; margin-top: clamp(40px, 5vw, 64px); }
.rail { position: sticky; top: 104px; align-self: start; font-size: 14px; }
.rail p { margin: 0 0 12px; color: var(--bone); font-weight: 600; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; }
.toc ol { list-style: none; margin: 0 0 36px; padding: 0; border-left: 1px solid var(--wick); }
.toc a { display: block; padding: 7px 0 7px 16px; margin-left: -1px; border-left: 1px solid transparent; color: var(--ash); text-decoration: none; line-height: 1.4; transition: color .2s ease, border-color .2s ease; }
.toc a:hover { color: var(--bone); }
.toc a.active { color: var(--flame); border-left-color: var(--flame); }
.share { display: flex; flex-wrap: wrap; gap: 8px; }
.share p { flex-basis: 100%; }
.share a, .share button {
  font: 500 13px/1 var(--text); color: var(--ash); background: none; cursor: pointer;
  padding: 9px 13px; border-radius: 999px; border: 1px solid var(--wick); text-decoration: none;
  transition: color .2s ease, border-color .2s ease;
}
.share a:hover, .share button:hover { color: var(--flame); border-color: var(--flame); }

.prose { font-size: 19px; line-height: 1.75; min-width: 0; }
.prose > p:first-of-type::first-line { color: #fff6ea; }
.prose p { margin: 0 0 1.25em; }
.prose h2 { margin: 2.1em 0 .7em; font: 400 clamp(24px, 2.6vw, 29px)/1.2 var(--display); letter-spacing: -.025em; text-wrap: balance; }
.prose h3 { margin: 1.8em 0 .5em; font: 600 21px/1.35 var(--text); }
.prose h4 { margin: 1.6em 0 .4em; font: 600 18px/1.4 var(--text); color: var(--ash); }
.prose a { text-decoration: underline; text-decoration-color: var(--underline); text-decoration-thickness: 1px; text-underline-offset: 4px; transition: color .2s ease, text-decoration-color .2s ease; }
.prose a:hover { color: var(--flame); text-decoration-color: currentColor; }
.prose strong { font-weight: 600; color: #fff6ea; }
.prose ul, .prose ol { margin: 0 0 1.35em; padding-left: 1.3em; }
.prose li { margin: .4em 0; padding-left: .2em; }
.prose ul li::marker { color: var(--flame); }
.prose ol li::marker { color: var(--flame); font-weight: 600; font-size: .9em; }
.prose blockquote { margin: 1.6em 0; padding: .2em 0 .2em 1.2em; border-left: 2px solid var(--flame); color: #ddd3c7; font-style: italic; }
.prose code { font: .86em/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--dusk); border: 1px solid var(--wick); border-radius: 6px; padding: 1px 6px; }
.prose pre { overflow-x: auto; background: var(--dusk); border: 1px solid var(--wick); border-radius: 12px; padding: 16px 18px; font-size: 15px; }
.prose pre code { background: none; border: 0; padding: 0; }
.prose table { width: 100%; border-collapse: collapse; margin: 1.6em 0; font-size: 16px; display: block; overflow-x: auto; }
.prose th, .prose td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--wick); vertical-align: top; }
.prose th { color: var(--ash); font-weight: 600; font-size: 14px; }
.prose hr { border: 0; height: 1px; background: var(--wick); margin: 2.4em 0; }
.prose .fig { margin: 2.2em 0; }
.prose .fig .img { overflow: hidden; border-radius: 16px; background: var(--dusk); border: 1px solid rgba(239, 231, 220, .06); }
.prose .fig img { width: 100%; }

.takeaways {
  position: relative; margin: 0 0 2.2em; padding: 24px 26px 18px; border-radius: 18px;
  background: linear-gradient(160deg, rgba(244, 184, 96, .07), rgba(110, 74, 158, .07) 60%, rgba(31, 24, 36, .6));
  border: 1px solid rgba(244, 184, 96, .16);
}
.prose .takeaways h2 { margin: 0 0 10px; font: 600 13px/1.4 var(--text); letter-spacing: .08em; text-transform: uppercase; color: var(--flame); }
.takeaways ul { list-style: none; padding: 0; margin: 0; }
.takeaways li { position: relative; padding-left: 22px; margin: 0 0 .7em; font-size: 17.5px; line-height: 1.6; }
.takeaways li::before { content: ""; position: absolute; left: 2px; top: .7em; width: 7px; height: 7px; border-radius: 50%; background: var(--flame); box-shadow: 0 0 10px rgba(244, 184, 96, .5); }

.faq { margin-top: 2.6em; }
.faq details { border-top: 1px solid var(--wick); }
.faq details:last-child { border-bottom: 1px solid var(--wick); }
.faq summary {
  list-style: none; cursor: pointer; position: relative; padding: 18px 40px 18px 0;
  font: 400 18px/1.4 var(--display); letter-spacing: -.01em; transition: color .2s ease;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 4px; top: 14px; font: 300 26px/1 var(--display); color: var(--flame); transition: transform .3s var(--ease-out); }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq summary:hover { color: var(--flame); }
.faq details p { margin: 0 0 20px; color: #ddd3c7; font-size: 17.5px; }

.sources { margin-top: 2.6em; padding-top: .4em; }
.sources ol { margin: 0; padding-left: 1.4em; font-size: 16px; line-height: 1.5; }
.sources li { margin: 0 0 12px; }
.sources li span { display: block; color: var(--ash); font-size: 14px; margin-top: 2px; }
.official { display: inline-block; font: 600 11px/1 var(--text); letter-spacing: .06em; text-transform: uppercase; color: var(--night); background: var(--flame); padding: 3px 7px; border-radius: 999px; vertical-align: 1px; }
.method { margin-top: 24px !important; padding: 16px 18px; border-radius: 14px; background: var(--dusk); border: 1px solid var(--wick); color: var(--ash); font-size: 15px; line-height: 1.6; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 28px 0 0 !important; }
.tags span { font-size: 13.5px; color: var(--ash); padding: 5px 11px; border-radius: 999px; background: var(--dusk); border: 1px solid var(--wick); }
.stamp { color: #8a7f8e; font-size: 14px; }

.related { padding-top: clamp(56px, 8vw, 96px); margin-top: clamp(40px, 6vw, 72px); border-top: 1px solid var(--wick); }
.prevnext { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; padding-top: clamp(48px, 6vw, 72px); padding-bottom: 24px; }
.prevnext a { display: block; padding: 20px 22px; border-radius: 16px; border: 1px solid var(--wick); text-decoration: none; font: 400 17px/1.35 var(--display); letter-spacing: -.01em; transition: border-color .25s ease, color .25s ease; }
.prevnext a:hover { border-color: var(--flame); color: var(--flame); }
.prevnext a span { display: block; margin-bottom: 8px; font: 500 13px/1 var(--text); letter-spacing: .06em; text-transform: uppercase; color: var(--ash); }
.prevnext .next { text-align: right; }

/* Footer */
.foot { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px 48px; margin-top: clamp(56px, 8vw, 96px); padding-top: 32px; padding-bottom: 48px; border-top: 1px solid var(--wick); color: var(--ash); font-size: 14px; }
.foot p { margin: 0; max-width: 34em; }
.foot-mark { font: 500 16px/1 var(--display); color: var(--bone); margin-bottom: 12px !important; }
.foot-mark span { color: var(--flame); }
.foot nav { display: flex; flex-wrap: wrap; gap: 6px 18px; max-width: 420px; justify-content: flex-end; align-content: start; }
.foot nav a { color: var(--ash); padding: 4px 0; transition: color .2s ease; }
.foot nav a:hover { color: var(--bone); }
.foot .fine { grid-column: 1 / -1; font-size: 13px; color: #8a7f8e; max-width: 60em; }

/* Entrance */
@media (prefers-reduced-motion: no-preference) {
  .masthead h1, .post-head h1 { animation: settle 1s var(--ease-out) both; }
  .intro, .standfirst, .chips, .byline { animation: settle 1s var(--ease-out) .12s both; }
  .top-stories, .hero-wrap { animation: settle 1.2s var(--ease-out) .22s both; }
}
@keyframes settle { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

@media (max-width: 1080px) {
  .layout { grid-template-columns: minmax(0, 1fr); max-width: 760px; }
  .rail { position: static; order: 2; }
  .toc { display: none; }
  .hero-wrap, .post-head { max-width: 1160px; }
}
@media (max-width: 900px) {
  .top-stories { grid-template-columns: 1fr; }
  .top-stories .side { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .top nav a:nth-child(2) { display: none; }
  .top-stories .side { grid-template-columns: 1fr; }
  .prose { font-size: 18px; }
  .hero-wrap { padding: 0; }
  .hero-fig .img { border-radius: 0; border-left: 0; border-right: 0; }
  .hero-fig figcaption { padding: 0 var(--gutter); }
  .takeaways { padding: 20px 18px 12px; }
  .prevnext { grid-template-columns: 1fr; }
  .prevnext .next { text-align: left; }
  .foot { grid-template-columns: 1fr; }
  .foot nav { justify-content: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
@media (max-width: 520px) { .top nav a[href="/#work"] { display: none; } }
