:root {
  --bg: #000;
  --text: #fff;
  --muted: #cfd2d8;
  --gold: #FFD700;
  --gold-2: #ffec8b;
  --border: #1a1a1a;
  --wrap: 1200px;

  --gutter: clamp(.9rem, 1.6vw, 1.4rem);
  --radius: 1rem;
  --radius-sm: .6rem;
  --ring: 0 0 0 3px color-mix(in oklab, var(--gold) 40%, transparent);

  /* Elevation */
  --shadow-1: 0 16px 40px -18px color-mix(in oklab, var(--gold) 45%, transparent);
  --shadow-2: 0 26px 70px -28px rgba(0, 0, 0, .75);

  /* Fluid Type */
  --fs-0: clamp(.92rem, .25vw + .86rem, 1rem);
  --fs-1: clamp(1.02rem, .45vw + .96rem, 1.12rem);
  --fs-2: clamp(1.22rem, .8vw + 1rem, 1.38rem);
  --fs-3: clamp(1.48rem, 1.2vw + 1.1rem, 1.85rem);
  --fs-4: clamp(1.85rem, 1.8vw + 1.2rem, 2.45rem);
}

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding-inline: clamp(.9rem, 2vw, 1.2rem);
}

/* Selection */
::selection {
  background: color-mix(in oklab, var(--gold) 35%, #333);
  color: #111;
}

/* ---------- Eyebrow ---------- */
.eyebrow {
  display: inline-block;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-size: var(--fs-0);
  padding: .35rem .6rem;
  border-radius: var(--radius-sm);
  color: #111;
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  box-shadow: 0 10px 28px -16px color-mix(in oklab, var(--gold) 60%, transparent);
  transform: translateZ(0);
}

/* =========================
   Article Shell
   ========================= */
.b-post {
  background: var(--bg);
  color: var(--text);
}

/* ---------- Hero ---------- */
.p-hero {
  position: relative;
  border-bottom: 1px solid var(--border);
  padding-block: clamp(2rem, 5vw, 3rem) 1.2rem;
  padding-top: max(82px, env(safe-area-inset-top));
  isolation: isolate;
}

.p-hero .bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.p-hero .bg::before {
  content: "";
  position: absolute;
  inset: -30%;
  background:
    radial-gradient(40% 35% at 20% 30%, color-mix(in oklab, var(--gold) 18%, transparent) 0, transparent 60%),
    radial-gradient(45% 40% at 80% 70%, color-mix(in oklab, var(--gold-2) 16%, transparent) 0, transparent 70%);
  filter: blur(60px);
  opacity: .22;
  transform: translateZ(0);
}

.p-hero .wrap {
  position: relative;
  z-index: 1;
}

.p-hero h1 {
  margin: .6rem 0 .35rem;
  font-size: var(--fs-4);
  letter-spacing: -.01em;
  background: linear-gradient(135deg, #fff 40%, color-mix(in oklab, var(--gold) 22%, #fff));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: goldFlow 10s ease-in-out infinite alternate;
}

.p-hero .intro {
  color: var(--muted);
  max-width: 72ch;
  margin: 0;
  font-size: var(--fs-1);
  line-height: 1.65
}

/* ---------- Cover ---------- */
.cover {
  border-bottom: 1px solid var(--border);
  background: #0a0a0a;
  position: relative;
  overflow: hidden;
}

.cover img {
  width: 100%;
  max-height: min(56vh, 640px);
  object-fit: cover;
  display: block;
  transform: scale(1.02);
  opacity: 0;
  transition: transform .7s ease, filter .45s ease, opacity .45s ease;
  will-change: transform, filter, opacity;
}

.cover img:is(:hover, :focus-visible) {
  transform: scale(1.05);
  filter: saturate(1.05) contrast(1.03);
}

.cover img[src] {
  opacity: 1;
}

/* reveal when src present */

/* =========================
   Layout
   ========================= */
.body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(280px, 28vw, 360px);
  gap: var(--gutter);
  padding: 1.2rem 0 2rem;
  align-items: start;
}

@media (max-width: 980px) {
  .body {
    grid-template-columns: 1fr;
  }
}

/* ---------- Content ---------- */
.content {
  color: #e8ebf2;
  font-size: var(--fs-1);
  line-height: 1.78;
  display: grid;
  gap: 1.05rem;
  word-break: break-word;
  hyphens: auto;
}

.content p {
  margin: 0;
}

.content p+p {
  margin-top: .25rem;
}

.content b,
strong {
  color: #fff;
}

.content a {
  color: #fff;
  text-decoration: underline dotted rgba(255, 255, 255, .45);
  text-underline-offset: 4px;
  transition: color .2s ease, text-decoration-color .2s ease, outline-color .2s ease;
  outline: 0;
  border-radius: .2rem;
}

.content a:hover {
  color: var(--gold);
  text-decoration-color: var(--gold);
}

.content a:focus-visible {
  outline: 2px solid color-mix(in oklab, var(--gold) 48%, transparent);
  outline-offset: 2px;
}

.content h2,
.content h3 {
  margin: 1rem 0 .3rem;
  line-height: 1.25;
  letter-spacing: .2px;
}

.content h2 {
  font-size: var(--fs-3);
}

.content h3 {
  font-size: var(--fs-2);
}

/* First paragraph dropcap (tasteful) */
.content p:first-of-type::first-letter {
  font-weight: 800;
  font-size: clamp(2.6rem, 1vw, 2.2rem);
  line-height: .9;
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  position: relative;
  display: inline-block;
  margin-right: 0.5px;
}

/* Lists */
.content ul,
.content ol {
  margin: .25rem 0 .25rem 1.1rem;
  display: grid;
  gap: .35rem;
}

.content ul {
  list-style: none;
  padding: 0;
  margin-left: .2rem;
}

.content ul li {
  position: relative;
  padding-left: 1.15rem;
}

.content ul li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .7em;
  width: .45rem;
  height: .45rem;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .06) inset;
}

.content ol {
  list-style: decimal;
}

/* Quotes */
.content blockquote {
  margin: .6rem 0;
  padding: .9rem 1rem;
  border-left: 3px solid color-mix(in oklab, var(--gold) 55%, transparent);
  background: linear-gradient(180deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, .02));
  border-radius: var(--radius);
}

/* Code */
.content pre,
.content code,
.content kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, "JetBrains Mono", Consolas, "Liberation Mono", monospace;
}

.content pre {
  margin: .4rem 0;
  padding: 1rem;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #0b0b0b;
  box-shadow: var(--shadow-2);
}

.content code {
  background: #0b0b0b;
  padding: .15rem .35rem;
  border-radius: .4rem;
  border: 1px solid #1a1a1a;
}

/* Media inside content */
.content img {
  width: 100%;
  height: auto;
  border-radius: calc(var(--radius) - .2rem);
  border: 1px solid var(--border);
  display: block;
  transition: transform .4s ease, filter .3s ease;
}

.content img:hover {
  transform: translateY(-2px);
  filter: saturate(1.05);
}

/* Tables */
.content table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.content th,
.content td {
  padding: .7rem .8rem;
  border-bottom: 1px solid #111;
}

.content thead th {
  background: linear-gradient(135deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, .03));
  text-align: left;
}

/* ---------- Sidebar ---------- */
.side .card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, .02));
  padding: 1rem;
  box-shadow: var(--shadow-2);
  transition: border-color .25s ease, transform .25s ease, box-shadow .25s ease;
}

.side .card:focus-within {
  outline: 2px solid color-mix(in oklab, var(--gold) 45%, transparent);
  outline-offset: 2px;
}

.side .card+.card {
  margin-top: .9rem;
}

.sticky {
  position: sticky;
  top: 90px;
  max-height: calc(100vh - 110px);
  overflow: auto;
}

/* External links list */
.ext {
  list-style: none;
  margin: .5rem 0 0;
  padding: 0;
  display: grid;
  gap: .4rem;
}

.ext a {
  color: #fff;
  text-decoration: none;
  border-bottom: 1px dashed transparent;
  padding: .2rem 0;
  transition: color .2s ease, border-color .2s ease, transform .2s ease;
  will-change: transform;
}

.ext a:hover {
  color: var(--gold);
  border-bottom-color: var(--gold);
  transform: translateY(-1px);
}

.ext a:focus-visible {
  outline: 2px solid color-mix(in oklab, var(--gold) 45%, transparent);
  outline-offset: 2px;
}

/* ---------- Buttons ---------- */
.btn {
  --btn-bg: #0e0e0e;
  --btn-fg: #fff;
  --btn-bd: #232323;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  padding: .9rem 1.15rem;
  border-radius: .9rem;
  border: 1px solid var(--btn-bd);
  color: var(--btn-fg);
  text-decoration: none;
  font-weight: 800;
  letter-spacing: .2px;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease, background .2s ease, color .2s ease;
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  color: #111;
  border-color: transparent;
  box-shadow: 0 12px 36px -12px color-mix(in oklab, var(--gold) 60%, transparent);
  position: relative;
  overflow: hidden;
}

.btn-primary::after {
  content: "";
  position: absolute;
  inset: -20% -60%;
  background: linear-gradient(100deg, transparent 45%, rgba(255, 255, 255, .65) 50%, transparent 55%);
  mix-blend-mode: screen;
  transform: translateX(-120%);
  pointer-events: none;
  animation: shineSweep 3.6s ease-in-out infinite .2s;
}

@media (hover:hover) {
  .btn-primary:hover {
    transform: translateY(-1px) scale(1.01);
  }
}

.btn-ghost {
  background: #0e0e0e;
  color: #fff;
  border-color: #232323;
}

.btn-ghost:hover {
  border-color: color-mix(in oklab, var(--gold) 40%, #232323);
  box-shadow: var(--ring);
}

/* =========================
   "More" section (related)
   ========================= */
.more {
  border-top: 1px solid var(--border);
  background: #050505;
  color: #fff;
  padding: 1.45rem 0 1.75rem;
}

.more h2 {
  margin: 0 0 .85rem;
  font-size: clamp(1.3rem, 1.1vw + 1rem, 1.75rem);
  letter-spacing: .2px;
}

.more-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: clamp(.9rem, 1.6vw, 1.2rem);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  align-items: stretch;
}

.more-grid li {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, .02));
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease, outline-color .22s ease;
  box-shadow: var(--shadow-2);
}

@media (hover:hover) {
  .more-grid li:hover {
    transform: translateY(-3px);
    border-color: color-mix(in oklab, var(--gold) 40%, var(--border));
    box-shadow: var(--shadow-1);
  }
}

.more-grid li:focus-within {
  outline: 2px solid color-mix(in oklab, var(--gold) 45%, transparent);
  outline-offset: 2px;
}

.more-grid img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
  transform: scale(1.01);
  transition: transform .5s ease, filter .35s ease;
}

.more-grid li:hover img {
  transform: scale(1.05);
  filter: saturate(1.05) contrast(1.02);
}

.more-grid a {
  display: block;
  padding: .8rem 1rem;
  color: #fff;
  text-decoration: none;
  border-top: 1px solid var(--border);
  transition: color .2s ease;
}

.more-grid a:hover {
  color: var(--gold);
}

/* =========================
   Micro-interactions / Utilities
   ========================= */

/* Reveal utility (optional: add .reveal in HTML where desired) */
.reveal {
  opacity: 0;
  transform: translateY(8px) scale(.995);
  filter: blur(1.2px);
  transition: opacity .5s ease, transform .5s ease, filter .5s ease;
  will-change: transform, opacity, filter;
}

.reveal.is-in {
  opacity: 1;
  transform: none;
  filter: none;
}

/* Scrollbars */
* {
  scrollbar-width: thin;
  scrollbar-color: #333 #0b0b0b;
}

*::-webkit-scrollbar {
  height: 10px;
  width: 10px;
}

*::-webkit-scrollbar-thumb {
  background: #333;
  border-radius: 10px;
}

*::-webkit-scrollbar-track {
  background: #0b0b0b;
}

/* Motion/contrast/forced-colors */
@media (prefers-reduced-motion: reduce) {

  .cover img,
  .btn,
  .btn-primary::after,
  .more-grid img,
  .more-grid li,
  .eyebrow,
  .p-hero h1 {
    animation: none !important;
    transition: none !important;
  }
}

@media (prefers-contrast: more) {

  .btn,
  .btn-ghost,
  .btn-primary,
  .side .card,
  .content pre,
  .content table {
    border-color: #3a3a3a;
  }
}

@media (forced-colors: active) {

  .btn,
  .btn-ghost,
  .btn-primary,
  .side .card,
  .content pre,
  .content table {
    border: 1px solid CanvasText;
  }

  .content a {
    text-decoration: underline;
    background: none;
  }
}

/* Touch affordances */
@media (pointer:coarse) {
  .btn {
    min-height: 48px;
    padding: .85rem 1rem;
  }

  .ext a {
    padding: .35rem 0;
  }
}

/* =========================
   Keyframes
   ========================= */
@keyframes shineSweep {
  0% {
    transform: translateX(-120%);
  }

  45% {
    transform: translateX(120%);
  }

  100% {
    transform: translateX(120%);
  }
}

@keyframes goldFlow {
  0% {
    background-position: 0% 50%;
  }

  100% {
    background-position: 100% 50%;
  }
}