/* =========================================================
   Design tokens — kept in sync with khemrajshrestha.com.np
   ========================================================= */
:root {
  --font-display: "Space Grotesk", "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", monospace;

  --radius-sm: 10px;
  --radius: 18px;
  --radius-lg: 28px;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  --container: 1200px;
  --gutter: clamp(16px, 4vw, 40px);
  --nav-h: 76px;
}

/* Dark (default) */
:root,
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #07080d;
  --bg-elev: #0d0f17;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-strong: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #eceef6;
  --text-muted: #9aa1b5;
  --text-faint: #646b80;
  --accent: #8b7bff;
  --accent-2: #22d3ee;
  --accent-3: #f472b6;
  --accent-ink: #0a0b12;
  --glow: rgba(139, 123, 255, 0.35);
  --grid-line: rgba(255, 255, 255, 0.045);
  --shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.8);
  --blob-opacity: 0.55;
  --success: #34d399;
  --danger: #f87171;
  --media-dim: 0.9;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f6fa;
  --bg-elev: #ffffff;
  --surface: rgba(255, 255, 255, 0.7);
  --surface-strong: #ffffff;
  --border: rgba(15, 18, 35, 0.08);
  --border-strong: rgba(15, 18, 35, 0.16);
  --text: #0e1124;
  --text-muted: #4f5670;
  --text-faint: #8a90a6;
  --accent: #5b3df5;
  --accent-2: #0891b2;
  --accent-3: #db2777;
  --accent-ink: #ffffff;
  --glow: rgba(91, 61, 245, 0.22);
  --grid-line: rgba(15, 18, 35, 0.05);
  --shadow: 0 30px 70px -35px rgba(30, 30, 80, 0.35);
  --blob-opacity: 0.35;
  --success: #059669;
  --danger: #dc2626;
  --media-dim: 1;
}

/* =========================================================
   Reset & base
   ========================================================= */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  transition: background-color 0.5s var(--ease-out), color 0.5s var(--ease-out);
}

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

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 999px;
  border: 3px solid var(--bg);
}

img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Icons */
.i {
  width: 1em;
  height: 1em;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Brand icons (Simple Icons), tinted with currentColor via mask */
.si {
  display: inline-block;
  width: 1em;
  height: 1em;
  flex-shrink: 0;
  background: currentColor;
  -webkit-mask: var(--si) center / contain no-repeat;
  mask: var(--si) center / contain no-repeat;
}
.si--github { --si: url("https://cdn.jsdelivr.net/npm/simple-icons@9.21.0/icons/github.svg"); }
.si--linkedin { --si: url("https://cdn.jsdelivr.net/npm/simple-icons@9.21.0/icons/linkedin.svg"); }
.si--leetcode { --si: url("https://cdn.jsdelivr.net/npm/simple-icons@9.21.0/icons/leetcode.svg"); }
.si--x { --si: url("https://cdn.jsdelivr.net/npm/simple-icons@9.21.0/icons/x.svg"); }
.si--instagram { --si: url("https://cdn.jsdelivr.net/npm/simple-icons@9.21.0/icons/instagram.svg"); }
.si--facebook { --si: url("https://cdn.jsdelivr.net/npm/simple-icons@9.21.0/icons/facebook.svg"); }
.si--discord { --si: url("https://cdn.jsdelivr.net/npm/simple-icons@9.21.0/icons/discord.svg"); }
.si--medium { --si: url("https://cdn.jsdelivr.net/npm/simple-icons@9.21.0/icons/medium.svg"); }

/* =========================================================
   Layout primitives
   ========================================================= */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  padding-block: clamp(72px, 10vw, 140px);
  position: relative;
}

.page {
  min-height: 100vh;
  padding-top: var(--nav-h);
}

/* =========================================================
   Typography helpers
   ========================================================= */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.eyebrow::before {
  content: "";
  width: 28px;
  height: 1px;
  background: currentColor;
}

.display {
  font-size: clamp(2.6rem, 7.5vw, 6.2rem);
  line-height: 0.98;
  letter-spacing: -0.045em;
}

.h2 {
  font-size: clamp(2rem, 4.6vw, 3.6rem);
  letter-spacing: -0.035em;
}

.h3 { font-size: clamp(1.2rem, 2vw, 1.45rem); }

.lead {
  font-size: clamp(1.02rem, 1.4vw, 1.2rem);
  color: var(--text-muted);
  max-width: 62ch;
}

.muted { color: var(--text-muted); }
.mono { font-family: var(--font-mono); }

.gradient-text,
.gradient-text .split-word {
  background: linear-gradient(100deg, var(--accent) 0%, var(--accent-2) 50%, var(--accent-3) 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: gradient-pan 8s linear infinite;
}

/* Split words carry transforms, so each word clips its own gradient */
.gradient-text .split-line { background: none; }

@keyframes gradient-pan {
  to { background-position: 200% center; }
}

/* =========================================================
   Buttons
   ========================================================= */
.btn {
  --btn-bg: var(--surface-strong);
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 24px;
  border-radius: 999px;
  font-weight: 500;
  font-size: 0.95rem;
  border: 1px solid var(--border-strong);
  background: var(--btn-bg);
  color: var(--text);
  overflow: hidden;
  isolation: isolate;
  transition: color 0.4s var(--ease-out), border-color 0.4s var(--ease-out),
    transform 0.4s var(--ease-out);
  white-space: nowrap;
}

/* Liquid fill on hover */
.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--text);
  border-radius: inherit;
  transform: translateY(101%);
  transition: transform 0.5s var(--ease-out);
}

.btn:hover::before { transform: translateY(0); }
.btn:hover { color: var(--bg); border-color: var(--text); }

.btn .i { transition: transform 0.4s var(--ease-out); }

.btn--primary {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 10px 40px -10px var(--glow);
}

.btn--sm { padding: 10px 18px; font-size: 0.85rem; }

/* =========================================================
   Surfaces
   ========================================================= */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: border-color 0.4s var(--ease-out), transform 0.5s var(--ease-out),
    background-color 0.4s var(--ease-out);
}

.card:hover { border-color: var(--border-strong); }

/* Cursor-following spotlight — position set via --mx / --my */
.spotlight::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s var(--ease-out);
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), var(--glow), transparent 45%);
}

.spotlight:hover::after { opacity: 1; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  background: var(--surface-strong);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.chip--link { transition: color 0.3s, border-color 0.3s; }
.chip--link:hover { color: var(--text); border-color: var(--accent); }

.pulse-dot {
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
}

.pulse-dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--success);
  animation: pulse 2s var(--ease-out) infinite;
}

@keyframes pulse {
  to { transform: scale(3); opacity: 0; }
}

.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-strong), transparent);
  border: 0;
}

/* =========================================================
   Skip link
   ========================================================= */
.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 200;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  transform: translateY(-200%);
  transition: transform 0.3s var(--ease-out);
}
.skip-link:focus { transform: translateY(0); }

/* =========================================================
   Ambient background
   ========================================================= */
.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.bg__blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(110px);
  opacity: var(--blob-opacity);
  will-change: transform;
}

.bg__blob--1 {
  width: 46vw; height: 46vw;
  top: -18vw; left: -10vw;
  background: var(--accent);
  animation: drift-1 22s ease-in-out infinite alternate;
}

.bg__blob--2 {
  width: 38vw; height: 38vw;
  top: 20vh; right: -14vw;
  background: var(--accent-2);
  opacity: calc(var(--blob-opacity) * 0.6);
  animation: drift-2 26s ease-in-out infinite alternate;
}

.bg__blob--3 {
  width: 30vw; height: 30vw;
  bottom: -14vw; left: 30vw;
  background: var(--accent-3);
  opacity: calc(var(--blob-opacity) * 0.35);
  animation: drift-3 30s ease-in-out infinite alternate;
}

@keyframes drift-1 { to { transform: translate(18vw, 14vh) scale(1.15); } }
@keyframes drift-2 { to { transform: translate(-16vw, 22vh) scale(0.9); } }
@keyframes drift-3 { to { transform: translate(-20vw, -26vh) scale(1.2); } }

.bg__grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 75%);
}

.bg__noise {
  position: absolute;
  inset: -50%;
  opacity: 0.05;
  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='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1.2s steps(6) infinite;
}

@keyframes grain {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(-3%, 2%); }
  50% { transform: translate(2%, -3%); }
  75% { transform: translate(-1%, 3%); }
}

/* =========================================================
   Scroll progress
   ========================================================= */
.scroll-progress {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 2px;
  z-index: 120;
  transform-origin: 0 50%;
  transform: scaleX(var(--progress, 0));
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent-3));
}

/* =========================================================
   Navbar
   ========================================================= */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  padding-top: 14px;
  transition: transform 0.6s var(--ease-out);
  animation: nav-in 0.6s var(--ease-out) both;
}

.nav.is-hidden { transform: translateY(-110px); }

@keyframes nav-in {
  from { transform: translateY(-100px); opacity: 0; }
}

.nav__inner {
  height: calc(var(--nav-h) - 14px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.nav__logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.1rem;
}

.nav__logo-mark {
  flex-shrink: 0;
  filter: drop-shadow(0 8px 18px var(--glow));
  transition: transform 0.6s var(--ease-out);
}

.nav__logo:hover .nav__logo-mark { transform: rotate(-8deg) scale(1.06); }

/* Logo micro-animations */
.logo--animated .logo__cursor { animation: logo-blink 1.1s steps(1) infinite; }
.logo--animated .logo__arm {
  stroke-dasharray: 46;
  stroke-dashoffset: 46;
  animation: logo-draw 1.2s var(--ease-out) 0.6s forwards;
}
.logo--animated .logo__node { transform-box: fill-box; transform-origin: center; animation: logo-pop 0.6s var(--ease-out) 1.4s both; }
.logo--animated .logo__node--2 { animation-delay: 1.55s; }
.nav__logo:hover .logo__node { animation: logo-pulse 0.8s var(--ease-out); }

@keyframes logo-blink { 50% { opacity: 0; } }
@keyframes logo-draw { to { stroke-dashoffset: 0; } }
@keyframes logo-pop { from { transform: scale(0); } to { transform: scale(1); } }
@keyframes logo-pulse { 50% { transform: scale(1.35); } }
.nav__logo-text em { color: var(--accent); font-style: normal; }

.nav__actions { display: flex; align-items: center; gap: 10px; }

.theme-toggle {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  font-size: 1.05rem;
  overflow: hidden;
  transition: border-color 0.3s var(--ease-out), transform 0.3s var(--ease-out);
}
.theme-toggle:hover { border-color: var(--border-strong); transform: rotate(15deg); }
.theme-toggle__icon.is-swapping { animation: icon-swap 0.35s var(--ease-out); }

@keyframes icon-swap {
  from { transform: translateY(18px) rotate(-90deg); opacity: 0; }
}

.nav__logo-text, .nav__cta { white-space: nowrap; }
.nav__cta-short { display: none; }

/* Narrow phones: logo mark only, short CTA label, so the header never overflows */
@media (max-width: 520px) {
  .nav__logo-text { display: none; }
  .nav__cta-full { display: none; }
  .nav__cta-short { display: inline; }
}

/* =========================================================
   Language toggle (EN | DE) — same as the main site
   ========================================================= */
.lang-toggle {
  position: relative;
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.lang-toggle__btn {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 36px;
  height: 34px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  transition: color 0.3s var(--ease-out);
}

.lang-toggle__btn:hover { color: var(--text); }
.lang-toggle__btn.is-active { color: #fff; }

/* Sliding indicator; only animates after the first paint */
.lang-toggle__pill {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 36px;
  height: 34px;
  border-radius: 999px;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 18px -8px var(--glow);
}

.lang-toggle[data-active="de"] .lang-toggle__pill { transform: translateX(36px); }
.lang-ready .lang-toggle__pill { transition: transform 0.45s cubic-bezier(0.34, 1.3, 0.64, 1); }

/* Non-English first load: stay hidden until the text is swapped in.
   Failsafe: show anyway after 1.5s if a script failed to load. */
.i18n-pending body {
  visibility: hidden;
  animation: i18n-failsafe 0s linear 1.5s forwards;
}

@keyframes i18n-failsafe { to { visibility: visible; } }

/* Page-wide crossfade while switching language (View Transitions API) */
html.lang-switching::view-transition-old(root) {
  animation: lang-out 0.28s cubic-bezier(0.4, 0, 1, 1) both;
}
html.lang-switching::view-transition-new(root) {
  animation: lang-in 0.42s cubic-bezier(0.22, 1, 0.36, 1) 0.08s both;
}

@keyframes lang-out { to { opacity: 0; filter: blur(6px); transform: translateY(-6px); } }
@keyframes lang-in { from { opacity: 0; filter: blur(6px); transform: translateY(8px); } }

.footer__socials a {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  transition: color 0.3s, border-color 0.3s, background-color 0.3s, transform 0.4s var(--ease-out);
}

.footer__socials a:hover {
  color: var(--text);
  border-color: var(--accent);
  background: var(--surface-strong);
}

.footer__socials a:hover { transform: translateY(-4px); }

/* =========================================================
   Page hero
   ========================================================= */
.page-hero {
  padding-top: clamp(64px, 10vw, 140px);
  padding-bottom: clamp(48px, 7vw, 96px);
}

.page-hero .container { display: grid; gap: 24px; justify-items: start; }
.page-hero__title { max-width: 16ch; }

.page-hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.page-hero__meta .i { font-size: 0.9rem; }

/* =========================================================
   Toolbar — filters & search
   ========================================================= */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 40px;
}

.filters {
  display: flex;
  gap: 6px;
  padding: 6px;
  max-width: 100%;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  overflow-x: auto;
  scrollbar-width: none;
}
.filters::-webkit-scrollbar { display: none; }

.filters__btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 999px;
  font-size: 0.9rem;
  color: var(--text-muted);
  white-space: nowrap;
  isolation: isolate;
  transition: color 0.3s;
}

.filters__btn::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.35s var(--ease-out), transform 0.45s var(--ease-out);
}

.filters__btn:hover { color: var(--text); }
.filters__btn.is-active { color: #fff; }
.filters__btn.is-active::before { opacity: 1; transform: none; }

.filters__count { font-size: 0.72rem; opacity: 0.7; }

.search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 220px;
  max-width: 320px;
  min-width: 0;
  height: 52px;
  padding: 0 10px 0 18px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--text-muted);
  cursor: text;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}

.search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 0.95rem;
}

.search input::placeholder { color: var(--text-faint); }
.search input::-webkit-search-cancel-button { cursor: pointer; }

.search__kbd {
  display: grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  font-size: 0.75rem;
  color: var(--text-faint);
  transition: opacity 0.2s;
}

.search:focus-within .search__kbd { opacity: 0; }

@media (max-width: 700px) {
  .toolbar { flex-direction: column-reverse; align-items: stretch; }
  .search { flex-basis: auto; max-width: none; }
  .search__kbd { display: none; }
  .filters { width: 100%; gap: 2px; }
  .filters__btn { flex: 1 1 auto; justify-content: center; gap: 6px; padding: 9px 12px; font-size: 0.86rem; }
}

/* =========================================================
   Posts grid & card
   ========================================================= */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.post-card {
  overflow: hidden;
  padding: 0;
}

.post-card[hidden] { display: none; }

.post-card__hit {
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
  z-index: 1;
  border-radius: inherit;
}

.post-card__media {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  margin: 10px 10px 0;
  border-radius: calc(var(--radius) - 6px);
  background: #fff;
}

.post-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(var(--media-dim));
  transition: transform 0.9s var(--ease-out), filter 0.6s var(--ease-out);
}

/* Transparent illustrations that must not be cropped sit on a themed glow */
.post-card__media--contain {
  background:
    radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--accent) 30%, transparent), transparent 65%),
    radial-gradient(circle at 80% 90%, color-mix(in srgb, var(--accent-2) 22%, transparent), transparent 55%),
    var(--surface-strong);
}

.post-card__media--contain img {
  filter: none;
  object-fit: contain;
  padding: 6%;
}

.post-card:hover .post-card__media img {
  transform: scale(1.06);
  filter: brightness(1);
}

.post-card__badge {
  position: absolute;
  left: 12px;
  top: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.72rem;
  color: #fff;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 24px -8px var(--glow);
}

.post-card__body {
  display: grid;
  gap: 10px;
  padding: 20px 22px 24px;
  flex: 1;
  align-content: start;
}

.post-card__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
}

.post-card__arrow {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  transition: transform 0.5s var(--ease-out), background-color 0.4s, color 0.4s, border-color 0.4s;
}

.post-card:hover .post-card__arrow,
.post-card__hit:focus-visible .post-card__arrow {
  transform: rotate(45deg);
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.post-card__topic {
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.post-card__title {
  line-height: 1.2;
  transition: color 0.3s;
}

.post-card__excerpt {
  font-size: 0.95rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card__foot {
  display: grid;
  gap: 16px;
  margin-top: 6px;
}

.post-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.post-card__read {
  justify-self: start;
  position: relative;
  font-size: 0.9rem;
  font-weight: 500;
}

.post-card__read::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.5s var(--ease-out);
}

.post-card:hover .post-card__read::after { transform: scaleX(1); transform-origin: left; }

/* Featured (newest) article spans two columns with a side-by-side layout */
@media (min-width: 701px) {
  .post-card.is-featured { grid-column: span 2; }

  .post-card.is-featured .post-card__hit {
    display: grid;
    grid-template-columns: 1fr 1.15fr;
  }

  .post-card.is-featured .post-card__media {
    aspect-ratio: auto;
    min-height: 100%;
    margin: 10px 0 10px 10px;
  }

  .post-card.is-featured .post-card__body {
    padding: clamp(22px, 3vw, 36px);
    align-content: center;
    gap: 12px;
  }

  .post-card.is-featured .post-card__title { font-size: clamp(1.35rem, 2vw, 1.75rem); }
  .post-card.is-featured .post-card__excerpt { -webkit-line-clamp: 5; line-clamp: 5; }
}

@media (max-width: 1000px) {
  .posts-grid { grid-template-columns: repeat(2, 1fr); }
}

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

/* Empty state */
.empty {
  display: grid;
  justify-items: center;
  gap: 10px;
  text-align: center;
  padding: 64px 24px;
  border-radius: var(--radius);
  border: 1px dashed var(--border-strong);
}

.empty[hidden] { display: none; }
.empty .btn { margin-top: 10px; }

/* Medium CTA */
.more-work {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 56px;
  padding: 28px 32px;
  border-radius: var(--radius);
  border: 1px dashed var(--border-strong);
}

.more-work__title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

@media (max-width: 560px) {
  .more-work { padding: 24px 20px; }
  .more-work .btn { width: 100%; justify-content: center; white-space: normal; text-align: center; }
}

/* =========================================================
   Footer
   ========================================================= */
.footer {
  position: relative;
  overflow: hidden;
  margin-top: clamp(40px, 6vw, 80px);
  padding-top: clamp(72px, 10vw, 130px);
  border-top: 1px solid var(--border);
  background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--bg-elev) 80%, transparent));
}

.footer__cta {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 32px;
  padding-bottom: clamp(56px, 8vw, 96px);
}

.footer__cta .eyebrow { grid-column: 1 / -1; }

.footer__title {
  font-size: clamp(2.2rem, 6vw, 5rem);
  letter-spacing: -0.045em;
  line-height: 1.02;
}

.footer__orb {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 4px;
  width: clamp(130px, 14vw, 170px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-weight: 500;
  text-align: center;
  box-shadow: 0 20px 60px -15px var(--glow);
  transition: transform 0.5s var(--ease-out);
}

.footer__orb .i { font-size: 1.4rem; transition: transform 0.5s var(--ease-out); }
.footer__orb:hover .i { transform: rotate(45deg); }

.footer__grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1.2fr;
  gap: 40px;
  padding-block: 56px;
}

.footer__col { display: grid; gap: 14px; align-content: start; }
.footer__col ul { display: grid; gap: 8px; }
.footer__brand { display: flex; align-items: center; gap: 12px; font-family: var(--font-display); font-size: 1.3rem; font-weight: 600; }

.footer__heading {
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.footer__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  position: relative;
  transition: color 0.3s;
}

.footer__link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.5s var(--ease-out);
}

.footer__link:hover { color: var(--text); }
.footer__link:hover::after { transform: scaleX(1); transform-origin: left; }

.footer__time {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-faint);
}

.footer__socials { display: flex; flex-wrap: wrap; gap: 8px; }

.footer__bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding-block: 24px;
  border-top: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 0.85rem;
}

.footer__top {
  font-size: 0.8rem;
  color: var(--text-muted);
  transition: color 0.3s;
}
.footer__top:hover { color: var(--accent); }

.footer__giant {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(4rem, 16.5vw, 17rem);
  line-height: 0.8;
  letter-spacing: -0.06em;
  text-align: center;
  white-space: nowrap;
  margin-bottom: -0.12em;
  background: linear-gradient(180deg, var(--border-strong), transparent 85%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  user-select: none;
}

@media (max-width: 900px) {
  .footer__grid { grid-template-columns: 1fr 1fr; }
  .footer__grid .footer__col:first-child { grid-column: 1 / -1; }
}

@media (max-width: 600px) {
  .footer__cta { grid-template-columns: 1fr; }
  .footer__bottom { flex-direction: column; align-items: flex-start; }
}

/* =========================================================
   Game-style cursor (fine pointers only — same as the main site)
   ========================================================= */
@media (hover: hover) and (pointer: fine) {
  body.has-cursor, body.has-cursor a, body.has-cursor button, body.has-cursor [role="tab"], body.has-cursor label { cursor: none; }
  body.has-cursor input, body.has-cursor textarea { cursor: text; }
}

.gc { position: fixed; inset: 0; pointer-events: none; z-index: 9999; }

.gc-arrow {
  position: fixed;
  top: -2px;
  left: -2px;
  transform-origin: 2px 2px; /* the arrow tip is the hotspot */
  will-change: transform;
  opacity: 0;
  transition: opacity 0.2s;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.35)) drop-shadow(0 0 10px var(--glow));
}

.gc-arrow svg { display: block; overflow: visible; }

.gc-arrow__body {
  fill: url(#gc-fill);
  stroke: #0b0c14;
  stroke-width: 1.6;
  stroke-linejoin: round;
  transition: filter 0.25s;
}

.gc-arrow__shine { fill: rgba(255, 255, 255, 0.55); }
.gc-arrow[data-hover="1"] .gc-arrow__body { filter: brightness(1.2) saturate(1.2); }

/* Target-lock brackets */
.gc-reticle {
  position: fixed;
  top: 0;
  left: 0;
  opacity: 0;
  will-change: transform, width, height;
}

.gc-c {
  position: absolute;
  width: 10px;
  height: 10px;
  border: 2px solid var(--accent-2);
  filter: drop-shadow(0 0 4px var(--accent-2));
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.gc-c--tl { top: 0; left: 0; border-right: 0; border-bottom: 0; border-top-left-radius: 3px; }
.gc-c--tr { top: 0; right: 0; border-left: 0; border-bottom: 0; border-top-right-radius: 3px; }
.gc-c--bl { bottom: 0; left: 0; border-right: 0; border-top: 0; border-bottom-left-radius: 3px; }
.gc-c--br { bottom: 0; right: 0; border-left: 0; border-top: 0; border-bottom-right-radius: 3px; }

/* Locked on: brackets "breathe" outward; pressing clamps them in */
.gc-reticle[data-mode="lock"] .gc-c { animation: gc-breathe 1.1s ease-in-out infinite; }
.gc-reticle[data-mode="lock"] .gc-c--tl { --dx: -3px; --dy: -3px; }
.gc-reticle[data-mode="lock"] .gc-c--tr { --dx: 3px; --dy: -3px; }
.gc-reticle[data-mode="lock"] .gc-c--bl { --dx: -3px; --dy: 3px; }
.gc-reticle[data-mode="lock"] .gc-c--br { --dx: 3px; --dy: 3px; }
.gc-reticle[data-press="1"] .gc-c { animation: none; transform: scale(0.7); }

@keyframes gc-breathe {
  50% { transform: translate(var(--dx, 0), var(--dy, 0)); }
}

/* Over big areas: a small spinning sight */
.gc-corners { position: absolute; inset: 0; }
.gc-reticle[data-mode="sight"] .gc-corners { animation: gc-spin 3s linear infinite; }
.gc-reticle[data-mode="sight"] .gc-c { width: 8px; height: 8px; }

@keyframes gc-spin { to { rotate: 360deg; } }

/* HUD label for data-cursor targets */
.gc-tag {
  position: absolute;
  left: 0;
  bottom: calc(100% + 6px);
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
  color: #fff;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 16px -6px var(--glow);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.2s, transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.gc-tag::before { content: "▸ "; }
.gc-tag[data-on="1"] { opacity: 1; transform: none; }

/* Trail */
.gc-trail {
  position: fixed;
  top: -2px;
  left: -2px;
  width: 4px;
  height: 4px;
  border-radius: 1px;
  background: var(--accent-2);
  box-shadow: 0 0 6px var(--accent-2);
  opacity: 0;
  will-change: transform;
}

/* Click burst */
.gc-wave {
  position: fixed;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--accent-2);
  box-shadow: 0 0 12px var(--accent-2);
}

.gc-spark {
  position: fixed;
  width: 9px;
  height: 2px;
  border-radius: 2px;
  transform-origin: 0 50%;
  background: linear-gradient(90deg, #fff, var(--accent-2));
}

/* =========================================================
   WebGL stage — fixed behind the page (three/stage.js)
   ========================================================= */
.stage {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  animation: stage-in 1.2s var(--ease-out) both;
}

.stage canvas { display: block; }

@keyframes stage-in { from { opacity: 0; } }

/* Page content sits above the canvas */
.page, .footer { position: relative; z-index: 1; }

/* With 3D on, the CSS blobs step back so the scene leads */
html.has-3d .bg__blob { opacity: calc(var(--blob-opacity) * 0.55); }

/* Hero: copy beside the space the 3D book is drawn into */
.page-hero__copy { display: grid; gap: 24px; justify-items: start; }
.page-hero__slot { display: none; }

html.has-3d .page-hero .container {
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr);
  align-items: center;
  gap: clamp(24px, 4vw, 56px);
}

html.has-3d .page-hero__slot {
  display: block;
  width: 100%;
  max-width: 440px;
  aspect-ratio: 1;
  justify-self: center;
}

@media (max-width: 900px) {
  html.has-3d .page-hero .container { grid-template-columns: 1fr; gap: 8px; }
  html.has-3d .page-hero__slot { order: -1; width: min(62vw, 300px); }
}

/* =========================================================
   Lenis smooth scrolling (from lenis/dist/lenis.css)
   ========================================================= */
html.lenis, html.lenis body { height: auto; }
.lenis:not(.lenis-autoToggle).lenis-stopped { overflow: clip; }
.lenis.lenis-smooth iframe { pointer-events: none; }

/* =========================================================
   Motion — scroll reveal & split text (enabled only with JS)
   ========================================================= */
.js .reveal {
  opacity: 0;
  transform: translateY(32px);
  filter: blur(8px);
  transition: opacity 0.9s var(--ease-out), transform 0.9s var(--ease-out), filter 0.9s var(--ease-out);
  transition-delay: var(--d, 0s);
}

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

.split-line {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
  padding-bottom: 0.08em;
  margin-bottom: -0.08em;
}

.split-word {
  display: inline-block;
  transform: translateY(110%) rotate(4deg);
  transition: transform 1s var(--ease-out);
}

.split.is-in .split-word { transform: none; }

.magnetic { will-change: transform; }

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