@font-face {
  font-family: "Sora";
  src: url("./fonts/sora-latin.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("./fonts/ibm-plex-mono-400.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("./fonts/ibm-plex-mono-500.woff2") format("woff2");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}

:root {
  --bg: #061c18;
  --bg-deep: #03110f;
  --surface: #0a2822;
  --surface-raised: #0d332b;
  --paper: #eef5ef;
  --ink: #f2f6f1;
  --ink-dark: #10241f;
  --muted: #a8bdb3;
  --muted-dark: #587067;
  --gold: #deb968;
  --gold-bright: #f0d68d;
  --opal: #6fd1b5;
  --line: rgba(222, 185, 104, 0.25);
  --line-soft: rgba(255, 255, 255, 0.1);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.27);
  --radius: 18px;
  --page: min(1180px, calc(100% - 40px));
  --reading: 760px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 85% 4%, rgba(111, 209, 181, 0.11), transparent 28rem),
    radial-gradient(circle at 12% 48%, rgba(222, 185, 104, 0.07), transparent 34rem),
    linear-gradient(155deg, var(--bg) 0%, var(--bg-deep) 100%);
  color: var(--ink);
  font-family: "Sora", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before,
body::after {
  position: fixed;
  z-index: -1;
  content: "";
  pointer-events: none;
}

body::before {
  inset: -20%;
  opacity: 0.34;
  background:
    linear-gradient(115deg, transparent 43%, rgba(111, 209, 181, 0.08) 44%, transparent 45%),
    linear-gradient(25deg, transparent 58%, rgba(222, 185, 104, 0.06) 59%, transparent 60%);
  background-size: 34rem 34rem, 42rem 42rem;
  animation: drift 32s linear infinite;
}

body::after {
  top: 18%;
  right: -12rem;
  width: 38rem;
  height: 38rem;
  border: 1px solid rgba(111, 209, 181, 0.08);
  border-radius: 50%;
  box-shadow:
    0 0 0 6rem rgba(111, 209, 181, 0.02),
    0 0 0 12rem rgba(222, 185, 104, 0.015);
}

@keyframes drift {
  to { transform: translate3d(8rem, 5rem, 0); }
}

::selection {
  background: var(--gold);
  color: var(--ink-dark);
}

a {
  color: inherit;
}

img {
  max-width: 100%;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 10px;
  left: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--gold);
  color: var(--ink-dark);
  font-weight: 700;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: sticky;
  z-index: 100;
  top: 0;
  display: flex;
  width: var(--page);
  min-height: 74px;
  margin: 0 auto;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(6, 28, 24, 0.83);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand img {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(240, 214, 141, 0.6);
  border-radius: 50%;
  object-fit: cover;
  object-position: 50% 31%;
}

.brand-copy {
  display: grid;
  gap: 2px;
}

.brand strong {
  color: var(--gold-bright);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.9rem;
  letter-spacing: 0.12em;
}

.brand small {
  color: var(--muted);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 26px;
}

.site-nav a {
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.76rem;
  letter-spacing: 0.05em;
  text-decoration: none;
  text-transform: uppercase;
  transition: color 160ms ease;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  color: var(--gold-bright);
}

.home-hero {
  display: grid;
  width: var(--page);
  min-height: 390px;
  margin: 0 auto;
  padding: 80px 0 62px;
  align-items: end;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.4fr);
  gap: 64px;
  border-bottom: 1px solid var(--line-soft);
}

.eyebrow,
.section-kicker,
.article-meta {
  margin: 0 0 18px;
  color: var(--gold);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  line-height: 1.6;
  text-transform: uppercase;
}

.home-hero h1 {
  max-width: 850px;
  margin: 0;
  font-size: clamp(3.1rem, 8vw, 7.2rem);
  font-weight: 650;
  letter-spacing: -0.075em;
  line-height: 0.92;
}

.home-hero h1 span {
  color: transparent;
  -webkit-text-stroke: 1px rgba(240, 214, 141, 0.68);
}

.hero-aside {
  align-self: end;
  padding: 18px 0 4px 22px;
  border-left: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.96rem;
  line-height: 1.75;
}

.hero-aside strong {
  display: block;
  margin-top: 12px;
  color: var(--ink);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.archive {
  width: var(--page);
  margin: 0 auto;
  padding: 72px 0 96px;
}

.archive-head {
  display: grid;
  align-items: end;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.7fr);
  gap: 42px;
  margin-bottom: 34px;
}

.archive h2 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.6rem);
  font-weight: 620;
  letter-spacing: -0.05em;
}

.search-wrap {
  position: relative;
}

.search-wrap label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.search-wrap input {
  width: 100%;
  padding: 14px 42px 14px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: 0.88rem "IBM Plex Mono", monospace;
}

.search-wrap input::placeholder {
  color: #80998e;
}

.search-wrap::after {
  position: absolute;
  right: 4px;
  bottom: 14px;
  color: var(--gold);
  content: "⌕";
  font-size: 1.2rem;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 24px;
}

.filter {
  padding: 8px 13px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
  cursor: pointer;
  font: 500 0.68rem "IBM Plex Mono", monospace;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  transition: 160ms ease;
}

.filter:hover,
.filter:focus-visible,
.filter[aria-pressed="true"] {
  border-color: rgba(222, 185, 104, 0.65);
  background: rgba(222, 185, 104, 0.1);
  color: var(--gold-bright);
}

.result-count {
  margin: 0 0 14px;
  color: var(--muted);
  font: 0.7rem "IBM Plex Mono", monospace;
  text-transform: uppercase;
}

.post-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}

.post-card {
  position: relative;
  display: flex;
  min-height: 295px;
  padding: 28px;
  flex-direction: column;
  grid-column: span 4;
  border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  text-decoration: none;
  transition: background 180ms ease, transform 180ms ease;
}

.post-card:nth-child(n + 3):nth-child(3n + 2) {
  border-right: 0;
}

.post-card.featured {
  min-height: 350px;
  grid-column: span 6;
}

.post-card.featured:nth-child(2) {
  border-right: 0;
}

.post-card:hover,
.post-card:focus-visible {
  z-index: 1;
  outline: 0;
  background: rgba(111, 209, 181, 0.065);
  transform: translateY(-3px);
}

.post-card.is-hidden {
  display: none;
}

.post-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  color: var(--muted);
  font: 0.68rem "IBM Plex Mono", monospace;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.post-card-top .topic {
  color: var(--gold);
}

.post-card h3 {
  max-width: 22ch;
  margin: auto 0 18px;
  font-size: clamp(1.35rem, 2.3vw, 2.1rem);
  font-weight: 570;
  letter-spacing: -0.035em;
  line-height: 1.12;
}

.post-card:not(.featured) h3 {
  font-size: clamp(1.12rem, 1.8vw, 1.55rem);
}

.post-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.62;
}

.post-card-bottom {
  display: flex;
  margin-top: 24px;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font: 0.68rem "IBM Plex Mono", monospace;
  text-transform: uppercase;
}

.post-card-bottom b {
  color: var(--gold-bright);
  font-size: 1rem;
  transition: transform 160ms ease;
}

.post-card:hover .post-card-bottom b {
  transform: translate(3px, -3px);
}

.external-card::after {
  position: absolute;
  top: 0;
  right: 24px;
  width: 42px;
  height: 2px;
  background: #e84444;
  content: "";
}

.empty-state {
  display: none;
  padding: 52px 0;
  color: var(--muted);
}

.empty-state.is-visible {
  display: block;
}

.article-page {
  background:
    radial-gradient(circle at 85% 4%, rgba(111, 209, 181, 0.08), transparent 28rem),
    linear-gradient(155deg, var(--bg) 0%, var(--bg-deep) 100%);
}

.reading-progress {
  position: fixed;
  z-index: 110;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: transparent;
}

.reading-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--opal), var(--gold-bright));
}

.article-masthead {
  width: min(980px, calc(100% - 40px));
  margin: 0 auto;
  padding: 76px 0 54px;
  border-bottom: 1px solid var(--line);
}

.article-masthead h1 {
  max-width: 950px;
  margin: 0;
  font-size: clamp(2.45rem, 6.7vw, 5.8rem);
  font-weight: 630;
  letter-spacing: -0.065em;
  line-height: 0.98;
}

.article-standfirst {
  max-width: 720px;
  margin: 26px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.18rem);
  line-height: 1.7;
}

.article-shell {
  width: min(var(--reading), calc(100% - 40px));
  margin: 0 auto;
  padding: 58px 0 74px;
}

.blog-post {
  color: #dae7df;
  font-size: 1.02rem;
  line-height: 1.82;
}

.blog-post > *:first-child {
  margin-top: 0;
}

.blog-post h2,
.blog-post h3,
.blog-post h4 {
  color: var(--ink);
  font-weight: 610;
  letter-spacing: -0.035em;
  line-height: 1.2;
}

.blog-post h2 {
  margin: 0 0 28px;
  font-size: clamp(1.9rem, 4.2vw, 3rem);
}

.blog-post h3 {
  margin: 54px 0 16px;
  font-size: clamp(1.35rem, 2.8vw, 1.8rem);
}

.blog-post h4 {
  margin: 36px 0 12px;
  font-size: 1.16rem;
}

.blog-post p,
.blog-post ul,
.blog-post ol,
.blog-post table,
.blog-post pre,
.blog-post blockquote {
  margin-top: 0;
  margin-bottom: 24px;
}

.blog-post ul,
.blog-post ol {
  padding-left: 1.4rem;
}

.blog-post li {
  margin-bottom: 10px;
  padding-left: 0.25rem;
}

.blog-post strong,
.blog-post b {
  color: var(--ink);
  font-weight: 650;
}

.blog-post a {
  color: var(--gold-bright);
  text-decoration-color: rgba(240, 214, 141, 0.35);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

.blog-post a:hover {
  text-decoration-color: currentColor;
}

.blog-post hr {
  height: 1px;
  margin: 50px 0;
  border: 0;
  background: var(--line);
}

.blog-post blockquote,
.callout {
  margin: 30px 0;
  padding: 20px 24px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: 0 12px 12px 0;
  background: rgba(222, 185, 104, 0.055);
  color: #d9e7df;
}

.blog-post pre {
  position: relative;
  overflow-x: auto;
  padding: 24px;
  border: 1px solid rgba(111, 209, 181, 0.18);
  border-radius: 12px;
  background: #020c0a;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.025);
  color: #cdebe0;
  font: 0.82rem/1.62 "IBM Plex Mono", monospace;
  tab-size: 2;
}

.blog-post code {
  border-radius: 5px;
  background: rgba(111, 209, 181, 0.085);
  color: #b7ebdc;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.9em;
}

.blog-post pre code {
  padding: 0;
  background: transparent;
  color: inherit;
}

.copy-btn {
  position: sticky;
  left: 100%;
  display: block;
  width: max-content;
  margin: -10px -10px 8px auto;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--gold-bright);
  cursor: pointer;
  font: 0.65rem "IBM Plex Mono", monospace;
  text-transform: uppercase;
}

.blog-post img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  margin: 34px auto;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.blog-post table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.blog-post th,
.blog-post td {
  min-width: 150px;
  padding: 13px 15px;
  border: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: top;
}

.blog-post th {
  background: rgba(222, 185, 104, 0.08);
  color: var(--gold-bright);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75rem;
}

.sources-list {
  padding-left: 0;
  list-style: none;
}

.sources-list li {
  padding: 16px 0;
  border-bottom: 1px solid var(--line-soft);
}

.article-pagination {
  display: grid;
  width: min(980px, calc(100% - 40px));
  margin: 0 auto 86px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.article-pagination a {
  display: grid;
  min-height: 118px;
  padding: 24px;
  align-content: center;
  gap: 8px;
  text-decoration: none;
}

.article-pagination a + a {
  border-left: 1px solid var(--line-soft);
  text-align: right;
}

.article-pagination small {
  color: var(--gold);
  font: 0.68rem "IBM Plex Mono", monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.article-pagination span {
  color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.4;
}

.site-footer {
  width: var(--page);
  margin: 0 auto;
  padding: 34px 0 42px;
  border-top: 1px solid var(--line);
}

.footer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}

.footer-mark {
  color: var(--gold-bright);
  font: 500 0.78rem "IBM Plex Mono", monospace;
  letter-spacing: 0.1em;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
}

.footer-links a {
  color: var(--muted);
  font: 0.72rem "IBM Plex Mono", monospace;
  text-decoration: none;
  text-transform: uppercase;
}

.footer-links a:hover {
  color: var(--gold-bright);
}

.footer-note {
  max-width: 870px;
  margin: 24px 0 0;
  color: #789087;
  font-size: 0.7rem;
  line-height: 1.65;
}

.reveal {
  animation: reveal-in 520ms ease both;
}

@keyframes reveal-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 900px) {
  .home-hero,
  .archive-head {
    grid-template-columns: 1fr;
  }

  .home-hero {
    min-height: 0;
    gap: 40px;
    padding-top: 68px;
  }

  .hero-aside {
    max-width: 620px;
  }

  .post-card,
  .post-card.featured {
    grid-column: span 6;
  }

  .post-card:nth-child(n + 3):nth-child(3n + 2) {
    border-right: 1px solid var(--line-soft);
  }

  .post-card:nth-child(2n) {
    border-right: 0;
  }
}

@media (max-width: 640px) {
  :root {
    --page: min(100% - 28px, 1180px);
  }

  .site-header {
    min-height: 66px;
  }

  .brand img {
    width: 32px;
    height: 32px;
  }

  .brand small,
  .site-nav a:first-child {
    display: none;
  }

  .site-nav {
    gap: 14px;
  }

  .home-hero {
    padding: 54px 0 46px;
  }

  .home-hero h1 {
    font-size: clamp(3rem, 17vw, 5rem);
  }

  .archive {
    padding: 54px 0 72px;
  }

  .post-card,
  .post-card.featured {
    min-height: 260px;
    padding: 22px 4px;
    grid-column: 1 / -1;
    border-right: 0;
  }

  .post-card:nth-child(n + 3):nth-child(3n + 2) {
    border-right: 0;
  }

  .article-masthead {
    width: calc(100% - 28px);
    padding: 52px 0 42px;
  }

  .article-masthead h1 {
    font-size: clamp(2.35rem, 12vw, 4rem);
  }

  .article-shell {
    width: calc(100% - 28px);
    padding: 42px 0 56px;
  }

  .blog-post {
    font-size: 0.96rem;
    line-height: 1.76;
  }

  .blog-post pre {
    margin-right: -4px;
    margin-left: -4px;
    padding: 18px;
    font-size: 0.75rem;
  }

  .article-pagination {
    width: calc(100% - 28px);
    grid-template-columns: 1fr;
  }

  .article-pagination a + a {
    border-top: 1px solid var(--line-soft);
    border-left: 0;
    text-align: left;
  }

  .footer-top {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

}

@media print {
  body {
    background: white;
    color: #111;
  }

  body::before,
  body::after,
  .site-header,
  .reading-progress,
  .article-pagination,
  .site-footer,
  .copy-btn {
    display: none !important;
  }

  .article-masthead,
  .article-shell {
    width: 100%;
  }

  .article-masthead h1,
  .blog-post,
  .blog-post h2,
  .blog-post h3,
  .blog-post h4,
  .blog-post strong,
  .blog-post b {
    color: #111;
  }
}
