:root {
  --bg-page: #f1f5f9;
  --bg-main: #f8fafc;
  --bg-white: #ffffff;
  --text: #0f172a;
  --text-muted: #475569;
  --text-soft: #64748b;
  --text-faint: #94a3b8;
  --border: #e2e8f0;
  --sky: #2f5fc8;
  --sky-soft: #eef3fd;
  --sky-text: #2f5fc8;
  --sky-deep: #1f4499;
  --emerald: #047857;
  --yellow-border: #facc15;
  --yellow-bg: #fefce8;
  --yellow-text: #a16207;
  --blue-border: #60a5fa;
  --blue-bg: #eff6ff;
  --blue-text: #1d4ed8;
  --green-border: #4ade80;
  --green-bg: #f0fdf4;
  --green-text: #15803d;
}

* {
  box-sizing: border-box;
}

html {
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  background: var(--bg-page);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

.site {
  min-height: 100vh;
  background: var(--bg-page);
}

.site-shell {
  position: relative;
  display: grid;
  min-height: 100vh;
  max-width: 80rem;
  margin: 0 auto;
}

.sidebar {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--bg-white);
  padding: 3rem 2rem;
}

.sidebar-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.avatar {
  width: 10rem;
  height: 10rem;
  overflow: hidden;
  border-radius: 9999px;
  border: 4px solid var(--border);
  background: #f1f5f9;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Sidebar swap (desktop): scrolling slides the photo up and out, the name and
   school block rises with it and parks at the top, and the OC panel rises in
   underneath. On narrow screens the sidebar scrolls away, so only the photo shows. */

.avatar-slot {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 10rem;
  height: 10rem;
  flex-shrink: 0;
}

.avatar-slot .avatar {
  flex-shrink: 0;
}

.oc-slot {
  display: none;
}

.oc {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--oc-h);
}

.oc img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* The bare body is a window: a mask cut to its shape shows a level that
   rises with page progress (--sp) and a glow under the pointer. */
.oc-fill {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  mix-blend-mode: multiply;
  -webkit-mask: url("../img/oc-mask.png") center / 100% 100% no-repeat;
  mask: url("../img/oc-mask.png") center / 100% 100% no-repeat;
}

.oc-level {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--sp, 0) * 100%);
  border-top: 1px dashed rgb(58 111 216 / 0.55);
  background: radial-gradient(circle, rgb(58 111 216 / 0.42) 0.55px, transparent 0.9px) 0 0 / 5px 5px;
}

/* Clouds, wind streaks and a gull crossing behind the silhouette. */
.oc-drift {
  position: absolute;
  top: var(--y);
  left: 0;
  animation: oc-drift var(--dur, 18s) linear infinite;
}

.oc-drift .c-body,
.oc-drift .c-line,
.oc-drift .d-body {
  stroke: rgb(58 111 216 / 0.75);
  stroke-width: 1;
}

.oc-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle 4rem at var(--mx, 50%) var(--my, 50%), rgb(67 221 248 / 0.28), transparent 70%);
  opacity: 0;
  transition: opacity 0.35s ease;
}

.oc.is-near .oc-glow {
  opacity: 1;
}

@keyframes oc-drift {
  from {
    transform: translateX(13rem);
  }
  to {
    transform: translateX(1.5rem);
  }
}

/* Construction marks above and below the figure: around the name block and
   beside the links. Desktop only; they fade in with the photo swap (--s) and
   move with page progress (--sp). */
.side-info,
.social-nav {
  position: relative;
}

/* Pale blue block behind the name / email / school, the same blue as the
   disc behind the figure. Full sidebar width on desktop, a rounded card on
   narrow screens. */
.side-info {
  isolation: isolate;
}

.side-info::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -0.9rem -1.25rem;
  border-radius: 0.75rem;
  background: #e1e9fb;
}

@media (min-width: 768px) {
  /* keep the photo above the block */
  .avatar-slot {
    position: relative;
    z-index: 1;
  }

  .side-info::before {
    /* runs from the top edge of the sidebar, behind the photo while it is
       there (3rem padding + the photo slot and its gap, which shrink with --s) */
    inset: calc(-3rem - (1 - var(--s, 0)) * 11.5rem) auto -1.25rem 50%;
    width: 17.5rem;
    border-radius: 0;
    translate: -50% 0;
  }
}

.side-marks {
  display: none;
}

@media (min-width: 768px) {
  .side-marks {
    --ln: rgb(58 111 216 / 0.55);
    --tick: rgb(148 163 184 / 0.75);
    display: block;
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: var(--s, 0);
  }

  .side-marks > span {
    position: absolute;
  }

  /* name block: corner brackets that open up, a ruler with a progress handle,
     a turning crosshair, a coordinate tag */
  .sm-corner {
    width: 10px;
    height: 10px;
    border: 1px solid var(--ln);
  }

  .sm-tl {
    left: calc(var(--sp, 0) * -12px - 4px);
    top: calc(var(--sp, 0) * -8px - 2px);
    border-right: 0;
    border-bottom: 0;
  }

  .sm-br {
    right: calc(var(--sp, 0) * -12px - 4px);
    bottom: calc(var(--sp, 0) * -8px - 2px);
    border-left: 0;
    border-top: 0;
  }

  .sm-rule {
    left: 0;
    right: 0;
    bottom: -1rem;
    height: 5px;
    border-bottom: 1px solid var(--tick);
    background: repeating-linear-gradient(90deg, var(--tick) 0 1px, transparent 1px 8px);
    background-position-x: calc(var(--sp, 0) * -160px);
    /* sinks from under the name down across the figure */
    translate: 0 calc(var(--sp, 0) * 34vh);
  }

  .sm-rule::after,
  .sm-vline::after,
  .sm-ring::after {
    content: "";
    position: absolute;
    width: 6px;
    height: 6px;
    background: var(--sky);
  }

  .sm-rule::after {
    top: 1px;
    left: calc(var(--sp, 0) * 100% - 3px);
  }

  .sm-cross {
    right: -0.5rem;
    top: -0.6rem;
    width: 13px;
    height: 13px;
    background:
      linear-gradient(var(--ln), var(--ln)) center / 100% 1px no-repeat,
      linear-gradient(var(--ln), var(--ln)) center / 1px 100% no-repeat;
    transform: rotate(calc(var(--sp, 0) * 360deg));
    /* drifts from the top-right corner down and left through the figure */
    translate: calc(var(--sp, 0) * -9.5rem) calc(var(--sp, 0) * 47vh);
  }

  .sm-coord {
    left: 0;
    top: -1.15rem;
    font: 700 8px/1 Georgia, "Times New Roman", serif;
    letter-spacing: 0.08em;
    color: var(--sky);
    white-space: nowrap;
  }

  /* links: a vertical ruler with a handle, a sliding grid, a turning ring,
     a swinging line */
  .sm-vline {
    right: 0;
    top: 0.2rem;
    bottom: 0.2rem;
    width: 6px;
    border-right: 1px solid var(--tick);
    background: repeating-linear-gradient(0deg, var(--tick) 0 1px, transparent 1px 8px);
    background-position-y: calc(var(--sp, 0) * 120px);
  }

  .sm-vline::after {
    right: -4px;
    top: calc(var(--sp, 0) * 100% - 3px);
  }

  .sm-grid {
    right: 1.6rem;
    top: 0.3rem;
    width: 41px;
    height: 31px;
    border: 1px solid var(--ln);
    background:
      linear-gradient(rgb(58 111 216 / 0.28) 1px, transparent 1px) 0 0 / 10px 10px,
      linear-gradient(90deg, rgb(58 111 216 / 0.28) 1px, transparent 1px) 0 0 / 10px 10px;
    background-position: 0 calc(var(--sp, 0) * 60px), calc(var(--sp, 0) * -40px) 0;
    /* the bottom marks rise out of the links area into the figure */
    translate: calc(var(--sp, 0) * 1.2rem) calc(var(--sp, 0) * -33vh);
  }

  .sm-grid::after {
    content: "";
    position: absolute;
    top: 10px;
    left: calc(var(--sp, 0) * 30px);
    width: 10px;
    height: 10px;
    background: rgb(47 95 200 / 0.28);
  }

  .sm-ring {
    right: 1.8rem;
    bottom: 0.2rem;
    width: 56px;
    height: 56px;
    border: 1px dashed var(--ln);
    border-radius: 50%;
    transform: rotate(calc(var(--sp, 0) * -720deg)) scale(calc(0.65 + var(--sp, 0) * 0.45));
    /* rolls all the way up to the top corner of the sidebar */
    translate: calc(var(--sp, 0) * 0.6rem) calc(var(--sp, 0) * (7.6rem - 100vh));
  }

  .sm-ring::after {
    top: -3px;
    left: calc(50% - 3px);
  }

  .sm-seg {
    right: 0.6rem;
    top: 52%;
    width: 84px;
    height: 1px;
    background: var(--ln);
    opacity: 0.6;
    transform: rotate(calc(-28deg + var(--sp, 0) * 56deg));
    translate: calc(var(--sp, 0) * -3rem) calc(var(--sp, 0) * -43vh);
  }
}

/* Solid pieces: filled shapes to weigh against all the line work. */
.oc-disc {
  position: absolute;
  left: 50%;
  top: 3%;
  width: 50%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #e1e9fb;
  translate: -50% 0;
  scale: calc(0.78 + var(--sp, 0) * 0.4);
}

.oc-hud .hud-solid {
  fill: var(--sky);
}

.oc-hud .hud-solid-mid {
  fill: #8fabeb;
}

.oc-hud .hud-solid-light {
  fill: #cddbf8;
}

/* Construction marks driven by the scroll position. */
.oc-hud .hud-grid-line {
  fill: none;
  stroke: var(--bp);
  stroke-width: 0.25;
  stroke-opacity: 0.45;
}

.oc-hud .hud-grid-box {
  stroke: var(--bp);
  stroke-width: 0.3;
  stroke-opacity: 0.5;
}

.oc-hud .hud-cell {
  fill: var(--sky);
  fill-opacity: 0.28;
}

.oc-hud .hud-tilt {
  fill: none;
  stroke: var(--bp);
  stroke-width: 0.3;
  stroke-opacity: 0.35;
}

.oc-hud .hud-ruler {
  fill: none;
  stroke: var(--text-faint);
  stroke-width: 2.6;
  stroke-dasharray: 0.35 3.65;
}

.oc-hud .hud-ruler-line {
  fill: none;
  stroke: var(--text-faint);
  stroke-width: 0.3;
}

.oc-hud .hud-scan path {
  fill: none;
  stroke: var(--bp);
  stroke-width: 0.35;
  stroke-opacity: 0.6;
  stroke-dasharray: 1.6 1.4;
}

.oc-hud .hud-item {
  transition: opacity 0.2s linear;
}

/* Wings and sparkles are separate layers that drift on their own. */
/* Each feather turns about its own root. Folded down along the arm at the
   top of the page, fully spread at the bottom (--sp); a small flutter rides
   on top through `transform`, which leaves `rotate` / `scale` to the scroll. */
.oc-wing {
  transform-origin: var(--ox) var(--oy);
  rotate: calc((1 - var(--sp, 0)) * var(--fold));
  scale: calc(0.72 + var(--sp, 0) * 0.28);
  animation: oc-wing 5.5s ease-in-out infinite alternate;
}

.oc-wing-1 {
  --ox: 33.1%;
  --oy: 26%;
  --fold: -50deg;
}

.oc-wing-2 {
  --ox: 34.5%;
  --oy: 27.2%;
  --fold: -38deg;
  animation-delay: -1.2s;
}

.oc-wing-3 {
  --ox: 36.2%;
  --oy: 28.7%;
  --fold: -26deg;
  animation-delay: -2.4s;
}

.oc-wing-4 {
  --ox: 40.3%;
  --oy: 31.7%;
  --fold: -14deg;
  animation-delay: -3.6s;
}

/* Colour layer of the wing sits a little lower than the line art. */
.oc-fan {
  translate: 0 4%;
}

.oc-star {
  animation: oc-star 4.2s ease-in-out infinite alternate;
}

.oc-star-1 {
  transform-origin: 65% 18.4%;
}

.oc-star-2 {
  transform-origin: 56.5% 24.2%;
  animation-duration: 3.4s;
  animation-delay: -1.3s;
}

.oc-star-3 {
  transform-origin: 49.6% 29.3%;
  animation-duration: 4.8s;
  animation-delay: -2.6s;
}

@keyframes oc-wing {
  from {
    transform: rotate(-1.6deg);
  }
  to {
    transform: rotate(1.8deg);
  }
}

@keyframes oc-star {
  from {
    transform: translateY(1.2%) scale(0.82) rotate(-6deg);
    opacity: 0.55;
  }
  to {
    transform: translateY(-1.6%) scale(1.08) rotate(6deg);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .oc-wing,
  .oc-star,
  .oc-drift {
    animation: none;
  }
}

/* Blueprint overlay: selection boxes, leader line, tick labels. */
.oc-hud {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  font-family: Georgia, "Times New Roman", serif;
}

.oc-hud .hud-select,
.oc-hud .hud-box {
  fill: none;
  stroke: var(--bp);
  stroke-width: 0.5;
}

.oc-hud .hud-box {
  stroke-opacity: 0.7;
}

.oc-hud .hud-handle,
.oc-hud .hud-tag {
  fill: var(--sky);
}

.oc-hud .hud-leader {
  fill: none;
  stroke: var(--text);
  stroke-width: 0.35;
}

.oc-hud .hud-dot,
.oc-hud .hud-text circle {
  fill: var(--text);
}

.oc-hud .hud-dots {
  fill: none;
  stroke: var(--text-faint);
  stroke-width: 0.6;
  stroke-dasharray: 0.2 3;
  stroke-linecap: round;
}

.oc-hud text {
  font-size: 5px;
  font-weight: 700;
  fill: var(--text);
}

.oc-hud .hud-tag-text {
  font-size: 4.2px;
  fill: #fff;
}

.oc-hud .hud-label {
  font-size: 4px;
  letter-spacing: 0.08em;
  fill: var(--sky);
}

@media (min-width: 768px) {
  .sidebar {
    --s: var(--swap, 0);
  }

  .sidebar-top {
    flex: 1;
    /* may be shorter than its content: the figure then spills down over the
       links instead of pushing them off the screen */
    min-height: 0;
  }

  .avatar-slot {
    height: calc((1 - var(--s)) * 10rem);
    margin-bottom: calc(var(--s) * -1.5rem);
    overflow: hidden;
    opacity: calc(1 - var(--s) * 0.5);
  }

  .oc-slot {
    --oc-h: min(24rem, 46vh);
    --oc-clearance: 3rem;
    display: block;
    position: relative;
    width: calc(var(--oc-h) * 0.729);
    /* Anchor to the school block, never to the viewport bottom. Reserve
       clearance for the eye callout, including its maximum scroll zoom. */
    height: calc(var(--s) * (var(--oc-h) + var(--oc-clearance)));
    margin-top: 0;
    margin-bottom: -3.6rem;
    pointer-events: none;
    flex-shrink: 0;
  }

  .side-info {
    flex-shrink: 0;
  }
}

.sidebar-name {
  margin: 0;
  text-align: center;
  font-size: 1.25rem;
  font-weight: 600;
}

.sidebar-name span {
  font-weight: 400;
}

.sidebar-meta {
  margin: 0.5rem 0 0;
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-soft);
}

.sidebar-affil {
  margin: 0.25rem 0 0;
  max-width: 16rem;
  text-align: center;
  font-size: 0.875rem;
  line-height: 1.625;
  color: var(--text-soft);
}

.social-nav {
  margin-top: 3rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.social-nav a {
  color: var(--text-soft);
  transition: color 0.15s ease;
}

.social-nav a:hover {
  color: var(--text);
}

.social-nav {
  isolation: isolate;
}

.social-nav::before {
  content: none;
  position: absolute;
  z-index: -1;
  inset: -0.9rem -1.25rem;
  border-radius: 0.75rem;
  background: #e1e9fb;
}

.sidebar-birds {
  position: absolute;
  right: -0.75rem;
  bottom: -0.8rem;
  width: 5rem;
  height: 2.4rem;
  color: #7094df;
  opacity: 0.7;
  pointer-events: none;
}

.avatar-birds {
  display: none;
}

.sidebar-birds svg {
  position: absolute;
  width: 3.5rem;
  height: 1.8rem;
  fill: #f7f9ff;
  stroke: currentColor;
  stroke-width: 1.1;
}

.sidebar-birds svg + svg {
  width: 1.6rem;
  height: 0.8rem;
  right: 0;
  top: -0.25rem;
}

.side-info .sidebar-birds {
  right: -1rem;
  top: -1.5rem;
  bottom: auto;
  width: 3.5rem;
  transform: rotate(-8deg);
}

.content-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.top-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--border);
  background: rgb(255 255 255 / 0.8);
  backdrop-filter: blur(12px);
}

.top-nav nav {
  display: flex;
  max-width: 56rem;
  margin: 0 auto;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  padding: 1.5rem 2rem;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.025em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.top-nav a {
  border-radius: 0.375rem;
  padding: 0.5rem 0.75rem;
  transition: all 0.15s ease;
}

.top-nav a:hover {
  background: var(--sky-soft);
  color: var(--sky);
}

.top-nav a.active {
  background: var(--sky);
  color: #fff;
}

.main {
  flex: 1;
  overflow-x: clip;
  background: var(--bg-main);
  padding-bottom: 4rem;
}

.page-intro {
  display: flex;
  max-width: 64rem;
  margin: 0 auto;
  flex-direction: column;
  gap: 1rem;
  padding: 3rem 1.5rem 0;
}

.page-intro.welcome {
  gap: 1.5rem;
}

.eyebrow {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.page-intro h2 {
  margin: 0;
  font-size: 1.875rem;
  font-weight: 600;
}

.welcome-title {
  font-size: 2.25rem !important;
}

.page-intro p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.welcome-bio {
  font-size: 1rem !important;
}

.welcome-bio a {
  color: var(--sky);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.welcome-bio a:hover {
  color: var(--sky-deep);
}

.home-sections {
  display: flex;
  max-width: 64rem;
  margin: 0 auto;
  flex-direction: column;
  gap: 3rem;
  padding: 1.5rem 1.5rem 4rem;
}

.home-section h3 {
  margin: 0 0 1.25rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
  font-size: 1.875rem;
  font-weight: 700;
}

.home-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.home-item {
  position: relative;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

/* last-of-type: the list also holds the decoration overlay as its last child */
.home-item:last-of-type {
  border-bottom: none;
}

.home-item-head {
  position: relative;
  padding-right: 7rem;
}

.home-item h4 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.home-item h4 a:hover {
  color: var(--sky);
}

.list-status {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-soft);
}

.home-date {
  position: absolute;
  right: 0;
  top: 0;
  border-radius: 0.375rem;
  background: var(--sky-soft);
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--sky);
}

.home-author,
.home-status {
  margin: 0.5rem 0 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.home-venue {
  margin: 0.5rem 0 0;
  font-size: 0.875rem;
  font-weight: 400;
  color: #6b8fe0;
}

.home-subtitle {
  margin: 0.25rem 0 0;
  font-size: 0.875rem;
  color: var(--sky);
}

.home-status strong {
  font-weight: 500;
  color: var(--emerald);
}

.home-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-top: 0.25rem;
  font-size: 0.875rem;
}

.home-links a {
  color: var(--sky);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.home-links a:hover {
  color: var(--sky-deep);
}

.filter-bar {
  max-width: 64rem;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 0;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.filter-chip {
  border: 0;
  border-radius: 9999px;
  padding: 0.25rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  background: #f1f5f9;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.filter-chip:hover {
  background: #e2e8f0;
}

.filter-chip.active {
  background: var(--sky);
  color: #fff;
}

.filter-chip.clean {
  background: #e2e8f0;
}

.filter-chip.clean:hover {
  background: #cbd5e1;
}

.filter-count {
  margin: 0.75rem 0 0;
  font-size: 0.875rem;
  color: var(--text-soft);
}

.post-wrap {
  max-width: 64rem;
  min-height: calc(100vh - 300px);
  margin: 0 auto;
  padding: 3rem 1.5rem 0;
}

.post-list {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.post-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  border-radius: 0.375rem;
  border: 2px solid rgb(58 111 216 / 0.55);
  background: rgb(255 255 255 / 0.62);
  padding: 1.75rem;
  opacity: 0;
  animation: fade-in-up 0.4s ease-out forwards;
  transition: border-color 0.25s ease, background-color 0.25s ease;
}

.post-card::before {
  content: none;
}

.post-card:hover,
.post-card:focus-within {
  border-color: var(--bp);
}

.post-title-highlight {
  background: linear-gradient(#e1e9fb, #e1e9fb) 0 85% / 0% 65% no-repeat;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  transition: background-size 400ms ease;
}

.post-card:hover .post-title-highlight,
.post-card:focus-within .post-title-highlight {
  background-size: 100% 65%;
}

@media (prefers-reduced-motion: reduce) {
  .post-title-highlight {
    transition: none;
  }
}

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

.post-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.post-type {
  font-family: var(--display);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--sky);
}

.post-date {
  font-family: var(--display);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.post-card h2,
.post-card h3 {
  margin: 0.5rem 0 0;
  font-size: 1.4rem;
  font-weight: 600;
  line-height: 1.35;
}

.post-subtitle {
  margin: 0.25rem 0 0;
  font-size: 1rem;
  color: var(--text-soft);
}

.keyword-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-top: 0.25rem;
}

.keyword-pill {
  border-radius: 9999px;
  border: 1px solid rgb(47 95 200 / 0.16);
  background: rgb(255 255 255 / 0.5);
  padding: 0.1rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--sky-deep);
}

.post-author {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-soft);
}

.post-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.post-content p,
.post-content li {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.75;
  color: var(--text-muted);
}

.post-content ul,
.post-content ol {
  margin: 0;
  padding-left: 1.25rem;
}

.post-content ul {
  list-style: disc;
}

.post-content ol {
  list-style: decimal;
}

.post-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-top: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.post-actions a,
.status-badge {
  border-radius: 9999px;
  border: 1px solid rgb(15 23 42 / 0.12);
  background: rgb(255 255 255 / 0.55);
  padding: 0.25rem 0.75rem;
  color: var(--text-muted);
  text-transform: capitalize;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.post-actions a:hover {
  border-color: var(--sky);
  color: var(--sky);
}

.status-under-review {
  border-color: var(--yellow-border);
  background: var(--yellow-bg);
  color: var(--yellow-text);
}

.status-preparing {
  border-color: var(--blue-border);
  background: var(--blue-bg);
  color: var(--blue-text);
}

.status-accepted {
  border-color: var(--green-border);
  background: var(--green-bg);
  color: var(--green-text);
}

.post-thumb {
  width: 100%;
}

.post-thumb-frame {
  height: 12rem;
  overflow: hidden;
  border-radius: 0.5rem;
  border: 1px solid rgb(255 255 255 / 0.9);
  background: rgb(255 255 255 / 0.6);
  border-color: rgb(15 23 42 / 0.07);
}

.post-thumb img,
.content-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.post-thumb img:hover,
.content-image:hover {
  opacity: 0.9;
}

.content-image {
  height: auto;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  margin: 1rem 0;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgb(0 0 0 / 0.8);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-inner {
  position: relative;
  max-height: 90vh;
  max-width: 90vw;
  padding: 1rem;
  transform: scale(0.9);
  opacity: 0;
  transition: all 0.3s ease;
}

.modal.open .modal-inner {
  transform: scale(1);
  opacity: 1;
}

.modal-inner img {
  max-height: 90vh;
  max-width: 90vw;
  border-radius: 0.5rem;
  object-fit: contain;
  box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.35);
}

.modal-close {
  position: absolute;
  right: 0.5rem;
  top: 0.5rem;
  border: 0;
  border-radius: 9999px;
  background: rgb(0 0 0 / 0.5);
  padding: 0.5rem;
  color: #fff;
  cursor: pointer;
}

.modal-close:hover {
  background: rgb(0 0 0 / 0.7);
  transform: scale(1.1);
}

/* ------------------------------------------------------------------
   Motion layer: layered hero, floating parallax elements, masked reveals
   ------------------------------------------------------------------ */

@property --r {
  syntax: "<number>";
  inherits: true;
  initial-value: 0;
}

:root {
  --nav-h: 77px;
  --amber: #f59e0b;
  --bp: #3a6fd8;
  --display: "Barlow Condensed", "Arial Narrow", Arial, sans-serif;
}

/* Hero ------------------------------------------------------------- */

.hero {
  position: relative;
  overflow: hidden;
  min-height: min(34rem, calc(100vh - var(--nav-h)));
  display: flex;
  flex-direction: column;
  justify-content: center;
  background:
    linear-gradient(rgb(15 23 42 / 0.035) 1px, transparent 1px) 0 0 / 100% 4rem,
    var(--bg-main);
}

.hero-copy {
  width: 100%;
  padding-bottom: 2.5rem !important;
}

.hero .welcome-bio {
  max-width: 34rem;
}

.hero-hud {
  position: absolute;
  top: 1.25rem;
  left: 1.5rem;
  right: 1.5rem;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  border-top: 1px solid rgb(15 23 42 / 0.12);
  padding-top: 0.5rem;
  font-family: var(--display);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.hero-hud::before {
  content: "";
  position: absolute;
  top: -2px;
  left: 0;
  width: 2.5rem;
  height: 3px;
  background: var(--sky);
}

.hero-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 0.5rem;
}

.hero-card {
  position: relative;
  display: flex;
  min-width: 13rem;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.4rem 1.65rem 0.4rem 0.9rem;
  border-left: 3px solid var(--sky);
  background: #203e78;
  color: #fff;
  border-top: 1px solid #203e78;
  border-bottom: 1px solid #203e78;
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 50%, calc(100% - 16px) 100%, 0 100%);
}

.hero-card b {
  display: none;
}

@keyframes interest-slide-in {
  from { opacity: 0; transform: translateX(5rem); }
  to { opacity: 1; transform: translateX(0); }
}

@media (prefers-reduced-motion: no-preference) {
  .hero-card {
    animation: interest-slide-in 650ms cubic-bezier(0.22, 1, 0.36, 1) both;
  }

  .hero-card:nth-child(2) {
    animation-delay: 120ms;
  }
}

.hero-card span {
  font-size: 1.05rem;
  font-weight: 600;
}

.hero-card::after {
  content: none;
  position: absolute;
  right: 0.6rem;
  bottom: 0.6rem;
  width: 0.45rem;
  height: 0.45rem;
  background: var(--amber);
}

/* Floating decoration field ------------------------------------------ */

.fx-field {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.page-intro,
.home-section,
.post-wrap {
  position: relative;
}

.page-intro > :not(.fx-field),
.home-section > :not(.fx-field),
.post-wrap > :not(.fx-field) {
  position: relative;
  z-index: 1;
}

.page-intro > .fx-field,
.home-section > .fx-field,
.post-wrap > .fx-field {
  overflow: visible;
}

.fx {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--w, auto);
  height: var(--h, auto);
  will-change: translate;
}

.fx-slab {
  background: linear-gradient(135deg, rgb(56 189 248 / 0.1), rgb(148 163 184 / 0.08));
  clip-path: polygon(14% 0, 100% 0, 100% 82%, 86% 100%, 0 100%, 0 18%);
}

.fx-slab-alt {
  background:
    repeating-linear-gradient(135deg, rgb(15 23 42 / 0.06) 0 1px, transparent 1px 8px),
    rgb(255 255 255 / 0.5);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 22% 100%, 0 70%);
}

.fx-mark {
  font-family: var(--display);
  font-size: clamp(3.5rem, 8.5vw, 8rem);
  font-weight: 700;
  line-height: 0.8;
  letter-spacing: 0.02em;
  white-space: nowrap;
  color: transparent;
  -webkit-text-stroke: 1px rgb(15 23 42 / 0.1);
}

.fx-ring {
  aspect-ratio: 1;
  height: auto;
  border: 1px solid rgb(58 111 216 / 0.25);
  border-radius: 50%;
}

.fx-ring::after {
  content: "";
  position: absolute;
  inset: 14%;
  border: 1px dashed rgb(58 111 216 / 0.2);
  border-radius: 50%;
}

.fx-frame {
  border: 1px solid rgb(58 111 216 / 0.4);
}

.fx-frame::before,
.fx-frame::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  border-color: var(--bp);
  border-style: solid;
}

.fx-frame::before {
  left: -1px;
  top: -1px;
  border-width: 2px 0 0 2px;
}

.fx-frame::after {
  right: -1px;
  bottom: -1px;
  border-width: 0 2px 2px 0;
}

.fx-dots {
  background: radial-gradient(rgb(58 111 216 / 0.4) 1px, transparent 1.5px) 0 0 / 12px 12px;
}

.fx-bars {
  width: 5.5rem;
  height: 1.4rem;
  background: repeating-linear-gradient(
    90deg,
    rgb(15 23 42 / 0.45) 0 2px,
    transparent 2px 4px,
    rgb(15 23 42 / 0.45) 4px 5px,
    transparent 5px 8px
  );
}

.fx-cross {
  width: 18px;
  height: 18px;
  background:
    linear-gradient(var(--bp), var(--bp)) center / 100% 1px no-repeat,
    linear-gradient(var(--bp), var(--bp)) center / 1px 100% no-repeat;
}

.fx-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
  font-family: var(--display);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.28em;
  color: var(--text-faint);
}

.fx-label::before {
  content: "";
  width: 1.25rem;
  height: 2px;
  background: var(--bp);
}

.fx-vertical {
  writing-mode: vertical-rl;
}

.fx-vertical::before {
  width: 2px;
  height: 1.25rem;
}

.fx-accent {
  width: 10px;
  height: 10px;
  background: var(--amber);
}

.fx-bird,
.fx-feather {
  width: var(--s);
  color: rgb(15 23 42 / 0.75);
}

.fx-feather {
  color: rgb(58 111 216 / 0.35);
}

.fx-bird > span,
.fx-feather > span {
  display: block;
  transform: rotate(var(--tilt, 0deg));
  animation: fx-hover var(--hover, 6s) ease-in-out infinite alternate;
}

.fx-bird svg,
.fx-feather svg {
  display: block;
  width: 100%;
  height: auto;
  fill: currentColor;
}

.fx-feather svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.2;
}

/* Gull and clouds ----------------------------------------------------- */

.fx-gull,
.fx-cloud,
.fx-cloudline {
  width: var(--s);
}

.fx-gull > span,
.fx-cloud > span,
.fx-cloudline > span {
  display: block;
  transform: rotate(var(--tilt, 0deg)) scaleX(var(--flip, 1));
  animation: fx-hover var(--hover, 6s) ease-in-out infinite alternate;
}

.fx-cloud > span,
.fx-cloudline > span {
  animation: fx-drift calc(var(--hover, 6s) * 2.5) ease-in-out infinite alternate;
}

.fx-gull svg,
.fx-cloud svg,
.fx-cloudline svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.d-body {
  fill: #fff;
  stroke: rgb(58 111 216 / 0.6);
  stroke-width: 1.2;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

/* Blueprint dot fill laid over the white silhouette (pattern injected by JS) */
.d-dots {
  fill: url(#fx-dotpat);
  stroke: none;
}

/* Blueprint pieces: target box, numeric annotation, dashed guide ---------- */

.fx-target {
  border: 1px solid var(--bp);
}

.fx-target::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 14px;
  height: 14px;
  transform: translate(-50%, -50%);
  background:
    linear-gradient(var(--bp), var(--bp)) center / 100% 1px no-repeat,
    linear-gradient(var(--bp), var(--bp)) center / 1px 100% no-repeat;
}

.fx-target::after {
  content: "";
  position: absolute;
  right: -4px;
  top: -4px;
  width: 7px;
  height: 7px;
  background: var(--bp);
}

.fx-annot {
  font-family: var(--display);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1;
  white-space: nowrap;
  color: var(--bp);
}

.fx-annot::before {
  content: "";
  position: absolute;
  right: calc(100% + 3px);
  top: 70%;
  width: 1.75rem;
  height: 1px;
  background: var(--bp);
  transform: rotate(-30deg);
  transform-origin: right center;
}

.fx-dash {
  height: 0;
  border-top: 1px dashed rgb(58 111 216 / 0.55);
}

.fx-dash::after {
  content: "";
  position: absolute;
  right: 0;
  top: -4px;
  width: 1px;
  height: 7px;
  background: var(--bp);
}

.c-body {
  fill: #fff;
  stroke: rgb(58 111 216 / 0.18);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.c-shade {
  fill: #e3eff8;
}

.c-line {
  fill: none;
  stroke: rgb(58 111 216 / 0.24);
  stroke-width: 2;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.fx-over .fx-gull {
  opacity: 1;
}

/* Clouds over text stay see-through so they never hide a title */
.fx-over .fx-cloud {
  opacity: 0.55;
}

@keyframes fx-drift {
  from {
    transform: translateX(-10px);
  }
  to {
    transform: translateX(10px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .fx-gull > span,
  .fx-cloud > span,
  .fx-cloudline > span {
    animation: none !important;
  }
}

/* Small pieces scattered over item lists */

.home-list,
.post-list {
  position: relative;
}

.fx-field.fx-over {
  z-index: 4;
  overflow: visible;
}

.fx-over .fx {
  opacity: 0.8;
}

.fx-sm.fx-bars {
  width: 3rem;
  height: 0.8rem;
}

.fx-sm.fx-label {
  font-size: 0.62rem;
  letter-spacing: 0.22em;
}

.fx-sm.fx-label::before {
  width: 0.8rem;
}

.fx-sm.fx-accent {
  width: 6px;
  height: 6px;
}

.fx-sm.fx-frame::before,
.fx-sm.fx-frame::after {
  width: 6px;
  height: 6px;
}

.fx-cross {
  width: 14px;
  height: 14px;
}

@keyframes fx-hover {
  from {
    transform: translateY(-5px) rotate(var(--tilt, 0deg)) scaleX(var(--flip, 1));
  }
  to {
    transform: translateY(5px) rotate(calc(var(--tilt, 0deg) + 3deg)) scaleX(var(--flip, 1));
  }
}

/* Scroll progress bird in the top nav */

.nav-flight {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 0;
  pointer-events: none;
}

.nav-flight-line {
  position: absolute;
  left: 0;
  bottom: 0;
  width: calc(var(--sp, 0) * 100%);
  height: 2px;
  background: linear-gradient(90deg, rgb(47 95 200 / 0), var(--sky));
}

.nav-bird {
  position: absolute;
  bottom: 1px;
  left: calc(var(--sp, 0) * (100% - 22px));
  width: 22px;
  color: var(--sky);
}

.nav-bird svg {
  display: block;
  width: 100%;
  height: auto;
  fill: currentColor;
}

@media (max-width: 767px) {
  .fx-hide-sm {
    display: none;
  }

  .hero-card {
    min-width: 0;
    flex: 1 1 10rem;
  }
}

@media (min-width: 768px) {
  .hero-hud {
    left: 3rem;
    right: 3rem;
  }
}

/* Section headings with index numbers */

.home-sections {
  counter-reset: home-sec;
}

.home-section h3 {
  background: linear-gradient(var(--sky), var(--sky)) 0 100% / 3rem 3px no-repeat;
}

.home-section h3::before {
  counter-increment: home-sec;
  content: "0" counter(home-sec);
  display: block;
  margin-bottom: 0.15rem;
  font-family: var(--display);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.35em;
  color: var(--sky);
}

/* Reveal: content unrolls from the top down */

.motion .reveal {
  --r: 0;
  clip-path: inset(-2rem -2rem calc((1 - var(--r)) * 100%) -2rem);
  opacity: calc(0.2 + var(--r) * 0.8);
  transition: --r 0.9s cubic-bezier(0.22, 0.8, 0.3, 1) var(--rd, 0ms);
}

.motion .reveal.in {
  --r: 1;
}

.motion .reveal.done {
  clip-path: none;
}

.motion .post-card.reveal {
  opacity: 1;
  animation: none;
}

@media (prefers-reduced-motion: reduce) {
  .fx-bird > span,
  .fx-feather > span {
    animation: none !important;
  }
}

@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (min-width: 768px) {
  .site-shell {
    grid-template-columns: 280px 1fr;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
  }

  .sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    max-height: 100vh;
    border-right: 1px solid var(--border);
  }

  .page-intro,
  .home-sections,
  .filter-bar,
  .post-wrap {
    padding-left: 3rem;
    padding-right: 3rem;
  }

  .home-section h3 {
    font-size: 2.25rem;
  }

  .post-card {
    flex-direction: row;
  }

  .post-thumb {
    width: 16rem;
    flex-shrink: 0;
  }
}

@media (max-width: 767px) {
  .sidebar {
    position: relative;
    background: #e1e9fb;
  }

  .avatar-birds {
    display: block;
    left: 1.25rem;
    top: 1.25rem;
    right: auto;
    bottom: auto;
    width: 5.5rem;
    transform: rotate(-8deg);
  }

  .social-nav {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    align-items: center;
    justify-content: center;
    gap: 0.6rem 0.4rem;
    width: 100%;
    max-width: 22rem;
    margin: 1.5rem auto 0;
    font-size: clamp(0.7rem, 3vw, 0.875rem);
  }

  .social-nav a {
    grid-column: span 2;
    justify-self: center;
    white-space: nowrap;
    padding: 0.3rem 0;
  }

  .social-nav a:nth-of-type(4) {
    grid-column: 2 / span 2;
  }

  .social-nav a:nth-of-type(5) {
    grid-column: 4 / span 2;
  }

  .social-nav > .sidebar-birds {
    right: -0.5rem;
    bottom: -1.8rem;
    transform: scale(0.7);
    transform-origin: right bottom;
    opacity: 0.45;
  }

  .site-shell {
    border-bottom: 1px solid var(--border);
  }

  .top-nav nav {
    flex-wrap: nowrap;
    justify-content: space-evenly;
    gap: clamp(0.35rem, 2vw, 1rem);
    padding: 0.75rem 0.4rem;
    font-size: clamp(0.6rem, 2.7vw, 0.875rem);
    letter-spacing: 0;
  }

  .top-nav a {
    padding: 0.65rem clamp(0.2rem, 1vw, 0.5rem);
    white-space: nowrap;
  }

  .home-item-head {
    padding-right: 0;
  }

  .home-date {
    position: static;
    display: inline-block;
    margin-top: 0.35rem;
  }
}

/* The figure is revealed from the feet up behind a mask whose leading edge is
   a line of gulls. The mask sits on a wrapper big enough to hold the pieces
   that stick out above and beside the figure. */
.oc-reveal {
  display: contents;
}

@media (min-width: 768px) {
  .oc-reveal {
    --h: calc(var(--oc-h) + 5rem);
    --edge: calc((1 - var(--s)) * (var(--h) + 2.6rem) - 2.6rem);
    display: block;
    position: absolute;
    left: -3rem;
    right: -3rem;
    /* The wrapper extends 5rem above the art. Keep the art's top at a
       constant offset even while the slot height animates during reveal. */
    top: calc(var(--oc-clearance) - 5rem);
    bottom: auto;
    height: var(--h);
    --gulls: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 40' preserveAspectRatio='none'%3E%3Cpath d='M0 40V26Q14 8 30 24Q46 6 64 26Q80 30 96 22Q116 2 134 22Q152 4 172 24Q190 32 206 26Q220 10 234 24Q250 8 266 26Q284 30 300 22V40Z'/%3E%3Cpath d='M40 7q7-7 12 1q6-8 12-1q-8-1-12 7q-4-8-12-7ZM214 5q6-6 10 1q5-7 10-1q-7-1-10 6q-3-7-10-6Z'/%3E%3C/svg%3E");
    -webkit-mask-image: var(--gulls), linear-gradient(#000, #000);
    mask-image: var(--gulls), linear-gradient(#000, #000);
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-size: 100% 2.6rem, 100% calc(100% + 3rem);
    mask-size: 100% 2.6rem, 100% calc(100% + 3rem);
    -webkit-mask-position: 0 var(--edge), 0 calc(var(--edge) + 2.55rem);
    mask-position: 0 var(--edge), 0 calc(var(--edge) + 2.55rem);
  }

  .oc-reveal .oc {
    left: 3rem;
    right: 3rem;
  }
}

/* Day/night controls and celestial night palette. */
.top-nav { padding-right: 2.75rem; }
.theme-toggle {
  position: absolute; right: 0.6rem; top: 0.7rem;
  width: 2rem; height: 2rem; display: grid; place-items: center;
  border: 1px solid var(--border); border-radius: 50%;
  background: var(--bg-white); color: var(--sky); font: 1.3rem/1 Arial;
  cursor: pointer; transition: background-color 200ms, color 200ms;
}
.theme-toggle:hover { background: var(--sky-soft); }
.theme-toggle:focus-visible { outline: 2px solid var(--sky); outline-offset: 3px; }
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg-page: #080f20; --bg-main: #0d172b; --bg-white: #101c33;
  --text: #e7edfa; --text-muted: #bac8e1; --text-soft: #a4b5d3;
  --text-faint: #8298bb; --border: #2b3d5c;
  --sky: #9db9ff; --sky-text: #abc4ff; --sky-soft: #243757;
  --sky-deep: #c3d3ff; --bp: #91adf3;
  --yellow-bg: #42361c; --yellow-text: #ffe2a0;
  --blue-bg: #203559; --blue-text: #c3d8ff;
  --green-bg: #193c35; --green-text: #ace8cd;
}
[data-theme="dark"] .top-nav { background: rgb(13 23 43 / 0.93); }
[data-theme="dark"] .sidebar { background: #101c33; }
[data-theme="dark"] .side-info::before,
[data-theme="dark"] .social-nav::before { background: #1c2c4a; }
[data-theme="dark"] .post-card { background: #111e35; border-color: #607db7; }
[data-theme="dark"] .post-card:hover,
[data-theme="dark"] .post-card:focus-within { border-color: #b1c6ff; }
[data-theme="dark"] .post-title-highlight { background-image: linear-gradient(#314d7c, #314d7c); }
[data-theme="dark"] .keyword-pill,
[data-theme="dark"] .post-actions a,
[data-theme="dark"] .filter-chip,
[data-theme="dark"] .post-thumb-frame { background-color: #1b2b46; border-color: #405777; }
[data-theme="dark"] .filter-chip.active { background: #9db9ff; color: #101c33; }
[data-theme="dark"] .top-nav a.active { color: #0d172b; }
[data-theme="dark"] .hero-card { background: #263f6b; border-color: #6081c8; }
[data-theme="dark"] .hero {
  background:
    radial-gradient(circle at 75% 24%, #778bc955 0 1px, transparent 2px) 0 0 / 101px 93px,
    radial-gradient(circle at 20% 65%, #c0d1ff55 0 1px, transparent 2px) 0 0 / 163px 139px,
    radial-gradient(ellipse at 85% 10%, #243d66, transparent 65%), #0d172b;
}
[data-theme="dark"] .fx-mark { -webkit-text-stroke-color: #829ed42b; }
[data-theme="dark"] .fx-slab-alt { background: #253b5c55; }
[data-theme="dark"] .sidebar-birds { color: #abc4ff; }
[data-theme="dark"] svg.celestial-icon,
[data-theme="dark"] svg.celestial-icon path {
  fill: none; stroke: #b6c9ff; stroke-width: 1.2;
  stroke-linecap: round; stroke-linejoin: round;
}
[data-theme="dark"] .fx-ring { border-color: #91adf366; }
[data-theme="dark"] .fx-ring::after { border-color: #c1d0ff55; }
[data-theme="dark"] .oc-disc { background: #203756; }
@keyframes celestial-orbit { to { rotate: 360deg; } }
@keyframes celestial-pulse { 0%,100% { opacity: 0.45; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: no-preference) {
  [data-theme="dark"] .fx-ring { animation: celestial-orbit 80s linear infinite; }
  [data-theme="dark"] .fx-bird svg,
  [data-theme="dark"] .sidebar-birds svg { animation: celestial-pulse 5s ease-in-out infinite; }
  [data-theme="dark"] .fx-cloudline svg { animation: celestial-pulse 7s ease-in-out infinite; }
}
@media (max-width: 767px) {
  .top-nav { padding-right: 2.2rem; }
  .theme-toggle { right: 0.3rem; top: 0.85rem; width: 1.75rem; height: 1.75rem; }
  .top-nav nav { gap: 0.1rem; padding-inline: 0.2rem; font-size: clamp(0.55rem, 2.5vw, 0.85rem); }
  .top-nav a { padding-inline: 0.25rem; }
}
[data-theme="dark"] .oc-reveal {
  --gulls: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 40' preserveAspectRatio='none'%3E%3Cpath d='M0 40V29Q75 12 150 26T300 23V40Z M32 3L35 11L43 14L35 17L32 25L29 17L21 14L29 11Z M206 1L209 9L217 12L209 15L206 23L203 15L195 12L203 9Z'/%3E%3C/svg%3E");
}

/* Black-sky edition: shaded rotating planets, travelling meteors, phased stars. */
:root[data-theme="dark"] {
  --bg-page: #000; --bg-main: #050505; --bg-white: #080808;
  --border: #303036; --text: #eeeeef; --text-muted: #c7c7cc;
  --text-soft: #aaaab3; --text-faint: #85858f; --sky-soft: #242429;
}
[data-theme="dark"] .sidebar { background: #080808; }
[data-theme="dark"] .top-nav { background: rgb(5 5 5 / 94%); }
[data-theme="dark"] .side-info::before,
[data-theme="dark"] .social-nav::before { background: #171719; }
[data-theme="dark"] .main,
[data-theme="dark"] .hero { background: #050505; }
[data-theme="dark"] .post-card { background: #101012; border-color: #585866; }
[data-theme="dark"] .hero-card { background: #24242b; border-color: #686879; }
[data-theme="dark"] .keyword-pill,
[data-theme="dark"] .post-actions a,
[data-theme="dark"] .filter-chip,
[data-theme="dark"] .post-thumb-frame { background-color: #1b1b20; border-color: #3e3e48; }
[data-theme="dark"] .filter-chip.clean { background: #25252c; }
[data-theme="dark"] .filter-chip:hover { background: #34343f; }
[data-theme="dark"] .post-title-highlight { background-image: linear-gradient(#363641, #363641); }
[data-theme="dark"] .fx-slab,
[data-theme="dark"] .fx-slab-alt { background: linear-gradient(135deg, #ffffff05, #ffffff01); }
[data-theme="dark"] .oc-disc { background: #24242a; }
.night-dust { display: none; position: absolute; inset: 0; pointer-events: none; }
[data-theme="dark"] .night-dust { display: block; }
.night-dust i { position: absolute; width: 2px; height: 2px; border-radius: 50%; background: #fff; opacity: .5; box-shadow: 0 0 5px #ddd8ff80; }
.night-dust i:nth-child(4n) { width: 3px; height: 3px; }
[data-theme="dark"] svg.planet-art,
[data-theme="dark"] svg.meteor-art { overflow: visible; animation: none; }
[data-theme="dark"] svg.planet-art .planet-sphere { stroke: #e0d9ce88; stroke-width: .6; }
[data-theme="dark"] svg.planet-art .planet-surface { transform-origin: 80px 60px; }
[data-theme="dark"] svg.planet-art .planet-surface path,
[data-theme="dark"] svg.planet-art .planet-surface ellipse { fill: none; stroke: #e3d8c3; stroke-width: .8; opacity: .4; }
[data-theme="dark"] svg.planet-art .planet-orbit { fill: none; stroke: #c9c5d1; stroke-width: .65; opacity: .42; }
[data-theme="dark"] svg.planet-art .planet-ring-front { fill: none; stroke: #e0d7c6; stroke-width: 1.4; opacity: .85; }
[data-theme="dark"] svg.planet-art .planet-satellite circle { fill: #e1dcce; stroke: none; }
.planet-satellite { transform-origin: 80px 60px; }
[data-theme="dark"] svg.meteor-art .meteor-guide { stroke: #bfc0d9; stroke-width: .4; opacity: .2; fill: none; }
[data-theme="dark"] svg.meteor-art .meteor-tail { stroke-width: 1.5; fill: none; }
[data-theme="dark"] svg.meteor-art .meteor-head { fill: #fff; stroke: none; filter: drop-shadow(0 0 3px #d6d5ff); }
.meteor-flight { offset-path: path('M5 67Q84 59 189 10'); offset-rotate: 0deg; offset-distance: 64%; }
@keyframes planet-turn { from { transform: rotate(-12deg); } to { transform: rotate(348deg); } }
@keyframes satellite-turn { to { transform: rotate(360deg); } }
@keyframes meteor-travel {
  0%, 55% { offset-distance: 0%; opacity: 0; }
  59% { opacity: 1; }
  76% { offset-distance: 100%; opacity: 0; }
  100% { offset-distance: 100%; opacity: 0; }
}
@keyframes star-breathe { 0%,100% { opacity: .12; transform: scale(.65); } 48% { opacity: .95; transform: scale(1.25); } }
@media (prefers-reduced-motion: no-preference) {
  [data-theme="dark"] .planet-surface { animation: planet-turn 34s linear infinite; }
  [data-theme="dark"] .planet-satellite { animation: satellite-turn 24s linear infinite; }
  [data-theme="dark"] .meteor-flight { animation: meteor-travel 8s linear infinite; }
  [data-theme="dark"] .fx-cloudline .meteor-flight { animation-delay: -4s; animation-duration: 11s; }
  [data-theme="dark"] .fx-field:nth-child(2n) .meteor-flight { animation-delay: -2s; }
  [data-theme="dark"] .night-dust i { animation: star-breathe var(--twinkle) ease-in-out var(--phase) infinite; }
}
/* Flat celestial illustrations: solid disks and graphic linework. */
[data-theme="dark"] svg.planet-art .planet-sphere { fill: #19191e; stroke: #b6c9ff; stroke-width: 1.2; }
[data-theme="dark"] svg.planet-art .planet-surface path { stroke: #b6c9ff; stroke-width: 1; opacity: .45; }
[data-theme="dark"] svg.planet-art .planet-ring-front { stroke: #b6c9ff; stroke-width: 1.2; }
[data-theme="dark"] svg.planet-art .planet-orbit { stroke: #b6c9ff; opacity: .45; }
[data-theme="dark"] svg.planet-art .planet-satellite circle { fill: #b6c9ff; }

/* Polaris: concentric arcs sharing one fixed pole and one angular velocity. */
.polar-trails { display: none; position: absolute; width: clamp(22rem, 58vw, 44rem); height: auto; left: 76%; top: 30%; transform: translate(-50%, -50%); pointer-events: none; }
[data-theme="dark"] .polar-trails { display: block; opacity: .55; }
.polar-orbits { transform-origin: 300px 300px; }
.polar-orbits circle { fill: none; stroke: #aebde1; stroke-width: .8; }
.polar-orbits .polar-star { fill: #e3e8ff; stroke: none; }
.polar-origin { fill: #eef1ff; stroke: none; }
@keyframes polar-rotation { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: no-preference) {
  [data-theme="dark"] .polar-orbits { animation: polar-rotation 180s linear infinite; }
  [data-theme="dark"] .polar-star { animation: star-breathe 6s ease-in-out var(--phase) infinite; transform-box: fill-box; transform-origin: center; }
}
@media (max-width: 767px) {
  .polar-trails { left: 84%; top: 24%; width: 28rem; }
  [data-theme="dark"] .polar-trails { opacity: .35; }
}

/* Falling meteors and dense, independently twinkling star clusters. */
[data-theme="dark"] svg.meteor-art .meteor-guide { display: none; }
.meteor-flight { offset-path: path('M185 5L25 76'); }
[data-theme="dark"] .fx-cloud > span,
[data-theme="dark"] .fx-cloudline > span { animation: none; transform: none; }
[data-theme="dark"] svg.star-cluster-art { overflow: visible; }
[data-theme="dark"] svg.star-cluster-art circle,
[data-theme="dark"] svg.star-cluster-art path { fill: #e2e8ff; stroke: none; }
.night-dust i { width: 1px; height: 1px; box-shadow: none; }
.night-dust i:nth-child(4n) { width: 2px; height: 2px; }
.night-dust i:nth-child(11n) { width: 3px; height: 3px; }
[data-theme="dark"] .fx-ring:not(.polar-trails) { display: none; }
@media (prefers-reduced-motion: no-preference) {
  [data-theme="dark"] svg.star-cluster-art circle,
  [data-theme="dark"] svg.star-cluster-art path { animation: star-breathe 5s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
  [data-theme="dark"] svg.star-cluster-art :nth-child(2) { animation-delay: -2s; animation-duration: 7s; }
  [data-theme="dark"] svg.star-cluster-art :nth-child(3) { animation-delay: -4s; animation-duration: 9s; }
  [data-theme="dark"] svg.star-cluster-art :nth-child(4) { animation-delay: -1s; animation-duration: 6s; }
}
[data-theme="dark"] .hero-card {
  background: #93aefa;
  border-color: #93aefa;
  color: #101526;
}

/* Reveal the new theme from the top, like a falling night curtain. */
html.theme-curtain::view-transition-old(root),
html.theme-curtain::view-transition-new(root) {
  mix-blend-mode: normal;
  animation: none;
}
html.theme-curtain::view-transition-old(root) { z-index: 1; }
html.theme-curtain::view-transition-new(root) {
  z-index: 2;
  animation: theme-nightfall 900ms cubic-bezier(.4, 0, .2, 1) both;
}
@keyframes theme-nightfall {
  from { clip-path: inset(0 0 100% 0); }
  to { clip-path: inset(0 0 0 0); }
}
@media (prefers-reduced-motion: reduce) {
  html.theme-curtain::view-transition-new(root) { animation: none; }
}

/* Flat artificial satellites: solar panels, instruments and a dish antenna. */
.fx-satellite { display: none; width: clamp(9rem, 19vw, 16rem); height: auto; transform: translate(-50%, -50%); opacity: .75; }
[data-theme="dark"] .fx-satellite { display: block; }
.satellite-drift { display: block; transform: rotate(var(--sat-tilt)); }
.fx-satellite svg { display: block; width: 100%; height: auto; overflow: visible; }
[data-theme="dark"] .fx-satellite svg path { stroke: #aabfe9; stroke-width: 1.2; stroke-linejoin: round; fill: none; }
[data-theme="dark"] .fx-satellite svg .sat-panel { fill: #182437; }
[data-theme="dark"] .fx-satellite svg .sat-grid { stroke: #7c98c4; stroke-width: .75; }
[data-theme="dark"] .fx-satellite svg .sat-body { fill: #343338; stroke: #d3cfbf; }
[data-theme="dark"] .fx-satellite svg .sat-dish { fill: #23232b; stroke: #d3cfbf; }
[data-theme="dark"] .fx-satellite svg .sat-detail { stroke: #d3cfbf; stroke-width: .85; }
[data-theme="dark"] .fx-satellite svg .sat-signal { opacity: .45; }
@keyframes satellite-float {
  from { transform: translateY(-7px) rotate(calc(var(--sat-tilt) - 3deg)); }
  to { transform: translateY(7px) rotate(calc(var(--sat-tilt) + 3deg)); }
}
@media (prefers-reduced-motion: no-preference) {
  [data-theme="dark"] .satellite-drift { animation: satellite-float 12s ease-in-out infinite alternate; }
  [data-theme="dark"] .sat-signal { animation: celestial-pulse 4s ease-in-out infinite; }
}
@media (max-width: 767px) {
  .fx-satellite { width: 9rem; opacity: .4; }
  .hero .fx-satellite { --x: 85% !important; --y: 76% !important; }
}

[data-theme="dark"] .satellite-extra { width: clamp(7rem, 14vw, 11rem); opacity: .35; }
[data-theme="dark"] .polar-extra { width: clamp(18rem, 36vw, 28rem); opacity: .2; }
@media (prefers-reduced-motion: no-preference) {
  .satellite-extra .satellite-drift { animation-delay: -6s; animation-duration: 17s; }
  .polar-extra .polar-orbits { animation-delay: -65s; }
}
@media (max-width: 767px) {
  [data-theme="dark"] .satellite-extra { width: 7rem; opacity: .22; }
  [data-theme="dark"] .polar-extra { width: 20rem; opacity: .13; }
}

[data-theme="dark"] .satellite-extra { width: var(--sat-size, 8rem); }
@media (prefers-reduced-motion: no-preference) {
  .satellite-extra .satellite-drift { animation-delay: var(--sat-delay, -6s); animation-duration: var(--sat-duration, 17s); }
}
@media (max-width: 767px) {
  [data-theme="dark"] .satellite-extra { width: calc(var(--sat-size, 8rem) * .7); }
}
