/* The design system (loaded first) supplies the colour tokens, Inter,
   and .btn / .input / .tag / .text-muted. This file adds only what a blog needs
   on top: the header and footer chrome the canvas draws with inline styles, the
   signup strip, and prose. Do not redefine a token here — change it in the
   canvas and both follow. */

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--color-accent-200); }
a:hover { color: #fff; }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 60;
  padding: 10px 16px; background: var(--color-surface);
  border: 1px solid var(--color-accent); border-radius: var(--radius-sm);
  color: var(--color-accent-200); font-size: 14px; text-decoration: none;
}
.skip:focus { left: 12px; top: 12px; }

/* --- page + the gradient opener ---
   .page is the stacking context; the gradient sits under everything and fades
   out downward, the same treatment the canvas pages give their opener. */
.page { min-height: 100vh; display: flex; flex-direction: column; position: relative; isolation: isolate; }
.page > main { flex: 1; position: relative; z-index: 1; }
.hero-bg {
  position: absolute; left: 0; right: 0; top: 0; height: 760px; z-index: 0; pointer-events: none;
  -webkit-mask-image: linear-gradient(180deg, #000 55%, transparent);
  mask-image: linear-gradient(180deg, #000 55%, transparent);
}
.hero-bg shader-gradient-bg { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0.85; }
.hero-bg-fade {
  position: absolute; inset: 0;
  background: linear-gradient(90deg, #161826 0%, color-mix(in srgb, #161826 62%, transparent) 45%, color-mix(in srgb, #161826 10%, transparent) 88%);
}
liquid-glass { display: block; }

/* --- signup, in the closing inbox block --- */
.signup { width: 100%; max-width: 420px; }
.signup-row { display: flex; gap: 8px; flex-wrap: wrap; }
.signup-row .input { flex: 1; min-width: 190px; min-height: 42px; font-size: 14px; }
.signup-row .btn { min-height: 42px; padding-inline: 18px; white-space: nowrap; }
.signup-msg { margin: 8px 0 0; font-size: 13px; color: var(--color-accent-200); }

/* --- header --- */
.site-head {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, #161826 66%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-divider);
}
.site-head-in {
  max-width: 1120px; margin: 0 auto; padding: 12px 24px;
  display: flex; align-items: center; gap: 20px;
}
.brand {
  display: flex; align-items: center; gap: 9px;
  color: var(--color-text); text-decoration: none; margin-right: auto; flex: none;
}
.brand-mark { color: var(--color-accent); display: flex; align-items: center; justify-content: center; width: 15px; height: 28px; }
.brand-name { font-family: var(--font-heading); font-weight: 500; font-size: 16px; letter-spacing: -0.01em; }
.site-nav { display: flex; align-items: center; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.site-nav::-webkit-scrollbar { display: none; }
.site-nav a {
  padding: 8px 11px; font-size: 13.5px; color: var(--color-neutral-300);
  white-space: nowrap; text-decoration: none; border-radius: 6px;
}
.site-nav a:hover { color: var(--color-text); background: color-mix(in srgb, var(--color-surface) 70%, transparent); }
.site-nav a[aria-current="page"] { color: var(--color-accent-200); }
.nav-cta { flex: none; min-height: 38px; padding-inline: 16px; }
/* the burger is added by /transitions.js and only shows on narrow screens */
.nav-burger { display: none; width: 44px; height: 44px; padding: 0; flex: none; align-items: center; justify-content: center; color: var(--color-text); }
@keyframes es-menu { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes es-scrim { from { opacity: 0; } to { opacity: 1; } }
@media (min-width: 761px) { .nav-scrim { display: none; } }

.crumb { margin: 0 0 4px; font-size: 13.5px; }
.crumb a { color: var(--color-neutral-400); text-decoration: none; }
.crumb a:hover { color: var(--color-text); }

/* metadata, in the mono treatment the design uses throughout */
.meta-mono {
  font-family: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  font-size: 11.5px; color: var(--color-neutral-400); letter-spacing: 0.06em;
}
.post-head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 22px 0 16px; }

h1 {
  font-family: var(--font-heading); font-weight: 500;
  font-size: clamp(40px, 6vw, 78px); line-height: 0.98;
  letter-spacing: -0.04em; margin: 0 0 20px; max-width: 15ch; text-wrap: balance;
}

/* the standfirst — larger and lighter than body copy */
.dek {
  font-size: 19px; line-height: 1.55;
  color: var(--color-neutral-200); margin: 0 0 6px; max-width: 56ch;
}
.lede { font-size: 18px; line-height: 1.55; color: var(--color-neutral-300); max-width: 56ch; margin: 0; }

/* --- index --- */
.blog-hero {
  max-width: 1120px; margin: 0 auto; padding: 40px 24px;
  display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.7fr); gap: 32px; align-items: center;
}
.blog-hero-text { padding-top: 56px; }
.blog-hero h1 { font-size: clamp(40px, 6vw, 80px); margin: 18px 0 20px; max-width: 14ch; }
.hero-3d { height: 440px; min-width: 0; }
.hero-3d trident-scene { display: block; width: 100%; height: 440px; }

.featured-wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px 64px; }
.featured { display: block; color: inherit; text-decoration: none; }
.featured-in {
  display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.7fr); gap: 32px; align-items: end;
  padding: 32px 32px 30px; border-radius: var(--radius-md);
  border: 1px solid color-mix(in srgb, var(--color-accent) 26%, var(--color-divider));
}
.featured .post-head { margin: 0 0 16px; }
.featured h2 {
  font-family: var(--font-heading); font-weight: 500; color: var(--color-text);
  font-size: clamp(26px, 3.4vw, 42px); line-height: 1.06; letter-spacing: -0.03em;
  margin: 0; max-width: 22ch; text-wrap: pretty;
}
.featured p { margin: 0 0 14px; font-size: 15px; color: var(--color-neutral-200); }
.featured:hover h2 { color: var(--color-accent-100); }
.read-it { font-size: 14px; color: var(--color-accent-200); }

.post-list { max-width: 1120px; margin: 0 auto; padding: 0 24px 64px; }
.topic-bar {
  display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
  padding-bottom: 18px; border-bottom: 1px solid var(--color-divider);
}
.topic-bar[hidden] { display: none; }
.topic-bar button { cursor: pointer; min-height: 28px; font: inherit; font-size: 12px; }
.topic-label {
  font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 11px;
  letter-spacing: 0.1em; color: var(--color-neutral-500); margin-right: 8px;
}
.topic-count { margin-left: auto; font-size: 12.5px; color: var(--color-neutral-500); }
.post-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 0 40px; }
.post-grid article { border-bottom: 1px solid var(--color-divider); }
.post-grid article[hidden] { display: none; }
.post-grid article > a {
  display: flex; flex-direction: column; gap: 8px; padding: 24px 0;
  color: inherit; text-decoration: none; transition: transform .2s ease;
}
.post-grid article > a:hover { transform: translateX(4px); }
.card-meta {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 11px;
  letter-spacing: 0.06em; color: var(--color-neutral-500);
}
.card-topic { color: var(--color-accent); }
.post-grid h2 {
  font-family: var(--font-heading); font-weight: 500; font-size: 20px; line-height: 1.25;
  letter-spacing: -0.015em; color: var(--color-text); margin: 0; text-wrap: pretty;
}
.post-grid article > a:hover h2 { color: var(--color-accent-200); }
.post-grid p { margin: 0; font-size: 14px; color: var(--color-neutral-400); text-wrap: pretty; }

/* --- article --- */
.post-hero { max-width: 1120px; margin: 0 auto; padding: 104px 24px 48px; }
.post-body {
  max-width: 1120px; margin: 0 auto; padding: 0 24px 72px;
  display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 64px; align-items: start;
}
.post-body.no-toc { grid-template-columns: minmax(0, 1fr); }
.post-main { max-width: 680px; min-width: 0; }
.toc { position: sticky; top: 88px; }
.toc-in {
  display: flex; flex-direction: column; gap: 9px; padding: 16px 18px;
  border: 1px solid color-mix(in srgb, var(--color-accent) 24%, var(--color-divider));
  border-radius: var(--radius-md);
}
.toc-label {
  font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 11px;
  letter-spacing: 0.1em; color: var(--color-neutral-500); text-transform: uppercase;
}
.toc-in a { font-size: 13.5px; line-height: 1.4; color: var(--color-neutral-200); text-decoration: none; }
.toc-in a:hover { color: var(--color-accent-100); }
.prose [id] { scroll-margin-top: 84px; }

/* --- prose --- */
.prose { font-size: 16.5px; line-height: 1.7; color: var(--color-neutral-200); }
.prose > * + * { margin-top: 0; }
.prose p { margin: 0 0 16px; text-wrap: pretty; }
.prose h1, .prose h2 {
  font-family: var(--font-heading); font-weight: 500; color: var(--color-text);
  font-size: clamp(24px, 2.6vw, 30px); line-height: 1.15; letter-spacing: -0.025em; margin: 48px 0 14px;
  max-width: none;
}
.prose > :first-child { margin-top: 0; }
.prose h3 {
  font-family: var(--font-heading); font-weight: 500; color: var(--color-text);
  font-size: 19px; line-height: 1.3; letter-spacing: -0.01em; margin: 30px 0 10px;
}
.prose strong { color: var(--color-text); font-weight: 600; }

/* lists use the design's accent dash, not bullets */
.prose ul { list-style: none; padding: 0; margin: 0 0 18px; display: flex; flex-direction: column; gap: 9px; }
/* The design draws the dash as its own column, but that markup is two spans
   per item. A markdown <li> is inline content, so a grid would put every word
   in its own cell — the marker is absolutely positioned instead. */
.prose ul li {
  position: relative; padding-left: 28px;
  font-size: 15.5px; line-height: 1.6;
}
.prose ul li::before {
  content: "—"; color: var(--color-accent);
  position: absolute; left: 0; top: 0;
}
.prose ol { padding-left: 1.3em; margin: 0 0 18px; display: flex; flex-direction: column; gap: 9px; }
.prose ol li { font-size: 15.5px; line-height: 1.6; }

/* a blockquote renders as the design's note callout; a leading <strong>
   becomes its label, so "> **Why it matters** text" reads correctly */
.prose blockquote {
  margin: 4px 0 22px; padding: 16px 18px;
  border: 1px solid var(--color-accent-700); border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--color-accent) 7%, transparent);
}
.prose blockquote p { margin: 0; font-size: 15px; line-height: 1.62; }
.prose blockquote p + p { margin-top: 8px; }
.prose blockquote strong:first-child {
  display: block; color: var(--color-accent);
  font-family: var(--font-heading); font-weight: 500; font-size: 13px; margin-bottom: 6px;
}

.prose code {
  font-family: 'JetBrains Mono', ui-monospace, Menlo, monospace; font-size: 0.86em;
  background: var(--color-surface); border: 1px solid var(--color-divider);
  border-radius: 4px; padding: 1px 5px;
}
.prose pre {
  margin: 0 0 20px; padding: 15px 17px; background: #101120;
  border: 1px solid var(--color-divider); border-radius: var(--radius-sm);
  overflow-x: auto; font-family: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  font-size: 12.5px; line-height: 1.72;
}
.prose pre code { background: none; border: 0; padding: 0; font-size: inherit; }
.prose img { max-width: 100%; height: auto; border-radius: var(--radius-md); border: 1px solid var(--color-divider); }
.prose table { width: 100%; border-collapse: collapse; font-size: 14px; display: block; overflow-x: auto; margin: 0 0 18px; }
.prose th, .prose td { border: 1px solid var(--color-divider); padding: 8px 12px; text-align: left; }
.prose th { color: var(--color-text); font-weight: 600; }
.prose hr { border: 0; border-top: 1px solid var(--color-divider); margin: 30px 0; }

/* --- post foot --- */
.post-foot {
  margin-top: 44px; padding-top: 24px;
  border-top: 1px solid var(--color-divider);
  display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 22px;
}
.post-foot h6 {
  color: var(--color-accent); margin: 0 0 6px;
  font-family: var(--font-heading); font-weight: 500; font-size: 13px;
}
.next-post {
  font-size: 17px; line-height: 1.3; font-family: var(--font-heading); font-weight: 500;
  color: var(--color-text); text-decoration: none;
}
.next-post:hover { color: var(--color-accent-200); }
.post-foot .btn { min-height: 40px; margin-top: 2px; justify-self: start; }

/* --- likes + comments --- */
.engage { margin-top: 48px; padding-top: 28px; border-top: 1px solid var(--color-divider); }
.engage[hidden] { display: none; }
.like-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 40px; }
.like-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding-inline: 16px; color: var(--color-neutral-200); }
.like-btn svg { color: var(--color-neutral-400); transition: transform .2s ease, color .2s ease; }
.like-btn.is-liked { color: var(--color-accent-100); border-color: color-mix(in srgb, var(--color-accent) 50%, var(--color-divider)); background: color-mix(in srgb, var(--color-accent) 12%, transparent); }
.like-btn.is-liked svg { color: var(--color-accent); transform: scale(1.12); }
.like-count { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 13px; color: var(--color-neutral-400); }
.like-count:empty { display: none; }
.like-hint { font-size: 13.5px; color: var(--color-neutral-500); }
.engage-title {
  font-family: var(--font-heading); font-weight: 500; font-size: clamp(22px, 2.4vw, 28px);
  letter-spacing: -0.025em; margin: 0 0 18px; max-width: none;
}
.engage-count { color: var(--color-neutral-500); font-size: 0.7em; }
.comment-list { list-style: none; margin: 0 0 24px; padding: 0; }
.comment { padding: 16px 0; border-top: 1px solid var(--color-divider); }
.comment:last-child { border-bottom: 1px solid var(--color-divider); }
.comment-head { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; margin-bottom: 6px; }
.comment-name { font-family: var(--font-heading); font-weight: 500; color: var(--color-text); }
.comment-body { margin: 0; font-size: 15.5px; line-height: 1.65; color: var(--color-neutral-200); white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-empty { color: var(--color-neutral-400); font-size: 15px; margin: 0 0 24px; }
.comment-form { display: flex; flex-direction: column; gap: 14px; padding: 20px; border: 1px solid var(--color-divider); border-radius: var(--radius-md); background: color-mix(in srgb, var(--color-surface) 45%, transparent); }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--color-neutral-400); }
.field .input { font-size: 15px; min-height: 42px; }
.field textarea.input { min-height: 110px; resize: vertical; line-height: 1.55; padding-top: 10px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.comment-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.comment-actions .btn { min-height: 42px; }
.comment-note { font-size: 12.5px; color: var(--color-neutral-500); }

/* --- inbox --- */
.inbox {
  position: relative; z-index: 1; overflow: hidden;
  border-top: 1px solid var(--color-divider);
  background: radial-gradient(80% 130% at 88% 50%, #262550, #161826 68%);
}
.inbox-in {
  max-width: 1120px; margin: 0 auto; padding: 80px 24px;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 48px; align-items: center;
}
.inbox h2 {
  font-family: var(--font-heading); font-weight: 500;
  font-size: clamp(28px, 3.6vw, 44px); line-height: 1.04; letter-spacing: -0.035em;
  margin: 0 0 12px; max-width: 18ch;
}
.inbox p { color: var(--color-neutral-300); margin: 0 0 20px; max-width: 48ch; }
.inbox .signup-msg { margin: 8px 0 0; }
.inbox-mark { color: var(--color-accent); display: flex; align-items: center; justify-content: center; width: 100px; height: 192px; }

/* --- footer --- */
.site-foot {
  border-top: 1px solid var(--color-divider);
  background: color-mix(in srgb, var(--color-surface) 45%, transparent);
  position: relative; z-index: 1;
}
.site-foot-in {
  max-width: 1120px; margin: 0 auto; padding: 44px 24px 30px;
  display: grid; grid-template-columns: minmax(0,1.4fr) repeat(3, minmax(0,1fr)); gap: 32px;
}
.foot-brand { margin-bottom: 10px; }
.site-foot-in p { font-size: 13.5px; margin: 0 0 8px; max-width: 42ch; }
.foot-col { display: flex; flex-direction: column; gap: 7px; }
.foot-col h6 {
  margin: 0 0 3px; color: var(--color-neutral-500);
  font-family: var(--font-heading); font-weight: 500; font-size: 13px;
}
.foot-col a { font-size: 13.5px; color: var(--color-neutral-300); text-decoration: none; }
.foot-col a:hover { color: var(--color-text); }
.site-foot-fine {
  max-width: 1120px; margin: 0 auto;
  padding: 16px 24px 30px; border-top: 1px solid var(--color-divider);
  display: flex; gap: 18px; flex-wrap: wrap; align-items: center;
  font-size: 12.5px; color: var(--color-neutral-500);
}
.site-foot-fine a { color: var(--color-neutral-400); text-decoration: none; }
.site-foot-fine a:hover { color: var(--color-text); }
.site-foot-fine .foot-rss { margin-left: auto; }

@media (max-width: 900px) {
  .blog-hero, .featured-in, .post-body, .inbox-in { grid-template-columns: minmax(0, 1fr); }
  .toc { position: static; }
  .post-body { gap: 32px; }
  .site-foot-in { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .hero-3d, .hero-3d trident-scene { height: 320px; }
  .blog-hero-text { padding-top: 24px; }
  .post-hero { padding-top: 56px; }
  .blog-hero, .featured-wrap, .post-list, .post-hero, .post-body, .inbox-in { padding-left: 18px; padding-right: 18px; }
  .featured-in { padding: 24px 20px; }
  .post-grid { grid-template-columns: minmax(0, 1fr); }
  .inbox-mark { display: none; }
  /* mobile menu, matching the canvas pages */
  .site-head-in { gap: 10px; padding: 10px 16px; }
  .brand-name { font-size: 15px; }
  .nav-cta { min-height: 40px; padding-inline: 12px; }
  .nav-burger { display: inline-flex; }
  .site-nav { display: none; }
  .site-head[data-open="1"] .site-nav { display: flex; position: absolute; left: 0; right: 0; top: 100%; flex-direction: column; align-items: stretch; gap: 0; padding: 4px 16px 20px; background: color-mix(in srgb, var(--color-bg) 96%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-bottom: 1px solid var(--color-divider); box-shadow: var(--shadow-lg); max-height: calc(100dvh - 62px); overflow-y: auto; animation: es-menu .26s cubic-bezier(.2,.7,.2,1) both; }
  .site-head[data-open="1"] .site-nav a { display: flex; align-items: center; min-height: 52px; padding: 0 4px; font-size: 18px; font-family: var(--font-heading); color: var(--color-text); border-bottom: 1px solid var(--color-divider); border-radius: 0; white-space: normal; }
  .site-head[data-open="1"] .site-nav a[aria-current="page"] { color: var(--color-accent-200); }
  .nav-scrim { position: fixed; inset: 0; z-index: 19; background: color-mix(in srgb, var(--color-bg) 60%, transparent); animation: es-scrim .2s ease-out both; }
  .site-foot a { display: inline-flex; align-items: center; min-height: 36px; }
}
@media (max-width: 600px) {
  .site-foot-in { grid-template-columns: 1fr; gap: 24px; padding-inline: 18px; }
  .site-foot-fine { padding-inline: 18px; }
}
