/* ============================================================
   Article Polish
   World-class refinements layered on top of per-essay styles.
   Loaded last in <head> so it wins specificity ties.
   ============================================================ */

/* ---------- Foundations ---------- */

::selection {
  background-color: rgba(0, 255, 255, 0.28);
  color: #ffffff;
}

html {
  scrollbar-gutter: stable;
}

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
}

time,
.article-content time {
  font-variant-numeric: tabular-nums;
}

/* ---------- Article typography ---------- */

.article-content {
  hanging-punctuation: first last;
}

.article-content p {
  text-wrap: pretty;
}

.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4 {
  text-wrap: balance;
  letter-spacing: -0.015em;
}

/* Editorial scaffold above each major section heading */
.article-content > h2 {
  position: relative;
  margin-top: clamp(2.25rem, 1.5rem + 2.4vw, 3.75rem);
  margin-bottom: 0.875rem;
  padding-top: 1.5rem;
  font-size: clamp(1.625rem, 1.2rem + 1.4vw, 2.125rem);
  line-height: 1.2;
}

.article-content > h2::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 2.5rem;
  height: 2px;
  background: linear-gradient(90deg, #00ffff, rgba(0, 255, 255, 0));
  border-radius: 2px;
}

.article-content > h3 {
  margin-top: 2rem;
  font-size: clamp(1.25rem, 1rem + 0.8vw, 1.5rem);
  line-height: 1.3;
}

/* ---------- Refined blockquote — editorial pull ---------- */

.article-content blockquote {
  position: relative;
  margin: 2rem 0;
  padding: 1rem 1.5rem 1rem 2.75rem;
  border-left: 0;
  font-style: normal;
  font-size: 1.0625rem;
  line-height: 1.65;
  color: #e5e7eb;
  background: linear-gradient(90deg, rgba(0, 255, 255, 0.06), transparent 80%);
  border-radius: 0.375rem;
}

.article-content blockquote::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, #00ffff, rgba(0, 255, 255, 0.18));
  border-radius: 3px;
}

.article-content blockquote::after {
  content: "\201C";
  position: absolute;
  left: 0.65rem;
  top: 0.4rem;
  font-size: 1.85rem;
  line-height: 1;
  font-family: Georgia, "Times New Roman", serif;
  color: #00ffff;
  opacity: 0.55;
  pointer-events: none;
}

/* ---------- Inline links — animated underline ---------- */

.article-content a:not(.lightbox-trigger):not([class*="bg-"]):not([class*="rounded-full"]) {
  text-decoration: none;
  background-image: linear-gradient(to right, rgba(0, 255, 255, 0.55), rgba(0, 255, 255, 0.55));
  background-size: 100% 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size 200ms ease, color 200ms ease;
}

.article-content a:not(.lightbox-trigger):not([class*="bg-"]):not([class*="rounded-full"]):hover {
  color: #ffffff;
  background-size: 100% 2px;
}

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

main h1 {
  text-wrap: balance;
  letter-spacing: -0.025em;
}

.article-dek {
  text-wrap: pretty;
}

/* ---------- Scroll progress bar ---------- */

.progress-bar {
  height: 3px !important;
  background: linear-gradient(90deg, #00ffff 0%, #4ad8ff 60%, #ffffff 100%) !important;
  box-shadow: 0 0 8px rgba(0, 255, 255, 0.45) !important;
}

/* ---------- Back-to-top — refined, safe-area aware ---------- */

.back-to-top {
  bottom: max(1.25rem, env(safe-area-inset-bottom)) !important;
  right: max(1.25rem, env(safe-area-inset-right)) !important;
  width: 3rem !important;
  height: 3rem !important;
  -webkit-backdrop-filter: blur(10px) saturate(150%);
  backdrop-filter: blur(10px) saturate(150%);
  background-color: rgba(0, 0, 0, 0.55) !important;
  transition: transform 220ms cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 220ms ease,
              opacity 240ms ease,
              background-color 200ms ease !important;
}

@media (min-width: 768px) {
  .back-to-top {
    bottom: max(2rem, env(safe-area-inset-bottom)) !important;
    right: max(2rem, env(safe-area-inset-right)) !important;
    width: 3.25rem !important;
    height: 3.25rem !important;
  }
}

.back-to-top:hover,
.back-to-top:focus-visible {
  transform: translateY(-3px) !important;
  box-shadow: 0 10px 28px rgba(0, 255, 255, 0.32) !important;
  background-color: rgba(0, 0, 0, 0.85) !important;
}

/* ---------- Share buttons — Stripe-style hover ---------- */

[aria-label^="Share"],
[aria-label="Copy link"] {
  transition: transform 220ms cubic-bezier(0.16, 1, 0.3, 1),
              background-color 200ms ease,
              box-shadow 200ms ease !important;
}

[aria-label^="Share"]:hover,
[aria-label="Copy link"]:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(0, 255, 255, 0.22);
}

/* ---------- Header refinements ---------- */

header.fixed {
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  backdrop-filter: blur(14px) saturate(160%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

/* ---------- Focus-visible — on-brand keyboard rings ---------- */

a:focus-visible,
button:focus-visible {
  outline: 2px solid #00ffff;
  outline-offset: 3px;
  border-radius: 4px;
}

.article-content a:focus-visible {
  background-size: 100% 2px;
  color: #ffffff;
}

/* ---------- Author / related card hover ---------- */

a.group:hover img {
  filter: saturate(1.05) brightness(1.02);
}

/* ---------- Mobile reading optimizations ---------- */

@media (max-width: 640px) {
  /* Tighten hero so it doesn't dominate small screens */
  main h1 {
    font-size: clamp(1.875rem, 7.4vw, 2.5rem) !important;
    line-height: 1.1;
    padding: 0 0.25rem;
  }

  /* Slightly more compressed dek on mobile */
  .article-dek {
    font-size: 1.125rem !important;
    line-height: 1.55 !important;
  }

  /* Larger body text for legibility on small screens */
  .article-content p {
    font-size: 1.0625rem;
    line-height: 1.7;
  }

  /* Tighter blockquote padding on mobile */
  .article-content blockquote {
    padding: 0.875rem 1rem 0.875rem 2.25rem;
    font-size: 1rem;
  }

  /* Trim H2 lead on mobile */
  .article-content > h2 {
    padding-top: 1.125rem;
    margin-top: 2rem;
  }
}

/* ---------- Reduced motion — kill non-essential animation ---------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto !important;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  .progress-bar {
    transition: none !important;
    box-shadow: none !important;
  }

  a.group:hover img,
  .back-to-top:hover,
  [aria-label^="Share"]:hover,
  [aria-label="Copy link"]:hover {
    transform: none !important;
  }
}

/* ============================================================
   Pass 2 — Editorial shells, hero, byline, author, related
   ============================================================ */

/* ---------- Hero — refined vignette + typography ---------- */

main > div.relative > .absolute.inset-0.bg-gradient-to-b {
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.55) 0%,
    rgba(0, 0, 0, 0.18) 35%,
    rgba(0, 0, 0, 0.18) 60%,
    rgba(0, 0, 0, 0.95) 100%
  ) !important;
}

main > div.relative h1 {
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.55), 0 1px 3px rgba(0, 0, 0, 0.65);
}

/* Category pill — thin border + glass blur, on-brand */
main > div.relative span.bg-outlier-cyan {
  background-color: rgba(0, 255, 255, 0.10) !important;
  border: 1px solid rgba(0, 255, 255, 0.38);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 0.6875rem;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

/* Hero meta — tabular dates and read time */
main > div.relative time,
main > div.relative .text-gray-400,
main > div.relative .text-gray-300 {
  font-variant-numeric: tabular-nums;
}

/* ---------- Article dek + byline divider ---------- */

.article-dek {
  color: #e5e7eb !important;
  letter-spacing: -0.005em;
}

main .max-w-3xl > .mb-12 > .flex.items-center.mt-8 {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 1.25rem;
  margin-top: 1.75rem !important;
}

/* ---------- Author box — gradient border ---------- */

.max-w-3xl > div.bg-dark-gray.rounded-lg.border,
.max-w-3xl > .author-box {
  background:
    linear-gradient(#0a0a0a, #0a0a0a) padding-box,
    linear-gradient(135deg, rgba(0, 255, 255, 0.45), rgba(0, 255, 255, 0.04) 55%, rgba(255, 255, 255, 0.04)) border-box !important;
  border: 1px solid transparent !important;
  border-radius: 0.875rem !important;
}

/* Author headshot — subtle cyan ring */
.max-w-3xl > div.bg-dark-gray.rounded-lg.border > img.rounded-full,
.max-w-3xl > .author-box > img.rounded-full {
  box-shadow: 0 0 0 2px rgba(0, 255, 255, 0.25), 0 12px 28px rgba(0, 0, 0, 0.5);
}

/* ---------- Related cards — refined float on hover ---------- */

a.group > div.bg-dark-gray.rounded-lg {
  transition: transform 280ms cubic-bezier(0.16, 1, 0.3, 1),
              border-color 220ms ease,
              box-shadow 280ms ease !important;
}

a.group:hover > div.bg-dark-gray.rounded-lg {
  transform: translateY(-4px);
  box-shadow: 0 18px 40px -10px rgba(0, 255, 255, 0.20), 0 8px 16px rgba(0, 0, 0, 0.45);
}

a.group img.transition-transform {
  transition: transform 500ms cubic-bezier(0.16, 1, 0.3, 1), filter 400ms ease !important;
}

a.group:hover img.transition-transform {
  transform: scale(1.08);
  filter: saturate(1.08) brightness(1.04);
}

/* ---------- Share section — refined header + buttons ---------- */

main .max-w-3xl > .mt-12.mb-8 {
  padding-top: 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

main .max-w-3xl > .mt-12.mb-8 > .text-lg.font-bold {
  font-size: 0.75rem !important;
  font-weight: 600 !important;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55) !important;
  margin-bottom: 1rem !important;
}

[aria-label^="Share"],
[aria-label="Copy link"] {
  border: 1px solid rgba(255, 255, 255, 0.06);
}

[aria-label^="Share"]:hover,
[aria-label="Copy link"]:hover {
  border-color: rgba(0, 255, 255, 0.4);
}

/* ---------- Pro-tip / callout boxes — subtle gradient ---------- */

.article-content div.bg-dark-gray.border-l-4.border-outlier-cyan {
  background: linear-gradient(135deg, rgba(0, 255, 255, 0.06), rgba(0, 0, 0, 0) 70%) !important;
  border-left-width: 3px !important;
  border-radius: 0 0.5rem 0.5rem 0 !important;
}

/* ---------- Aside notes ---------- */

.article-content > aside {
  background: rgba(255, 255, 255, 0.02) !important;
  border-color: rgba(255, 255, 255, 0.06) !important;
}

/* ---------- "More field notes" link — directional hover ---------- */

main .max-w-3xl > .text-center.mt-12.mb-8 > a {
  display: inline-block;
  transition: transform 220ms ease, color 220ms ease;
}

main .max-w-3xl > .text-center.mt-12.mb-8 > a:hover {
  transform: translateX(3px);
}

/* ---------- Footer — subtle top accent ---------- */

footer.bg-black {
  position: relative;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  padding-top: 2.5rem !important;
}

footer.bg-black::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 4rem;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 255, 255, 0.7), transparent);
}

/* ---------- Mobile refinements for pass 2 ---------- */

@media (max-width: 640px) {
  main > div.relative h1 {
    text-shadow: 0 1px 10px rgba(0, 0, 0, 0.75);
  }

  main > div.relative span.bg-outlier-cyan {
    font-size: 0.625rem;
  }

  .max-w-3xl > div.bg-dark-gray.rounded-lg.border,
  .max-w-3xl > .author-box {
    padding: 1.5rem !important;
  }

  [aria-label^="Share"],
  [aria-label="Copy link"] {
    padding: 0.625rem !important;
  }

  /* Disable hover-lift on touch devices to avoid sticky states */
  a.group:hover > div.bg-dark-gray.rounded-lg {
    transform: none;
  }
  a.group:hover img.transition-transform {
    transform: none;
  }
}

/* ---------- Print — keep pass 2 sane ---------- */

@media print {
  .max-w-3xl > div.bg-dark-gray.rounded-lg.border,
  .max-w-3xl > .author-box {
    background: #ffffff !important;
    border: 1px solid #000 !important;
  }
  footer.bg-black::before { display: none !important; }
  main > div.relative h1 { text-shadow: none !important; }
}

/* ============================================================
   Pass 3 — Reading flow: anchors, lists, dividers, emphasis
   ============================================================ */

/* ---------- Anchor scroll offset under fixed header ---------- */

html {
  scroll-padding-top: 5rem;
}

.article-content > h2[id],
.article-content > h3[id] {
  scroll-margin-top: 5rem;
}

/* Anchor hint glyph on hover (only for headings that are anchored) */
.article-content > h2[id]:hover::after {
  content: " #";
  margin-left: 0.4rem;
  color: rgba(0, 255, 255, 0.55);
  font-weight: 400;
  font-size: 0.7em;
  letter-spacing: 0;
}

/* ---------- Custom ordered list markers ---------- */

.article-content ol {
  list-style: none !important;
  counter-reset: list-counter;
  padding-left: 0 !important;
  margin-left: 0 !important;
}

.article-content ol > li {
  position: relative;
  counter-increment: list-counter;
  padding-left: 2.75rem;
  margin-bottom: 0.75rem;
}

.article-content ol > li::before {
  content: counter(list-counter);
  position: absolute;
  left: 0;
  top: 0.15em;
  width: 1.75rem;
  height: 1.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  font-weight: 700;
  color: #00ffff;
  background: rgba(0, 255, 255, 0.06);
  border: 1px solid rgba(0, 255, 255, 0.32);
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}

/* ---------- Custom unordered list markers ---------- */

.article-content ul {
  list-style: none !important;
  padding-left: 0 !important;
  margin-left: 0 !important;
}

.article-content ul > li {
  position: relative;
  padding-left: 1.75rem;
  margin-bottom: 0.625rem;
}

.article-content ul > li::before {
  content: "";
  position: absolute;
  left: 0.25rem;
  top: 0.7em;
  width: 0.5rem;
  height: 1px;
  background: linear-gradient(90deg, #00ffff, rgba(0, 255, 255, 0.3));
  border-radius: 1px;
}

/* ---------- HR — three-dot chapter divider ---------- */

.article-content hr {
  border: 0 !important;
  text-align: center;
  height: auto !important;
  margin: 2.75rem 0 !important;
  overflow: visible !important;
}

.article-content hr::before {
  content: "·  ·  ·";
  display: inline-block;
  letter-spacing: 0.55em;
  color: rgba(0, 255, 255, 0.55);
  font-size: 1rem;
  line-height: 1;
}

/* ---------- Refined inline code ---------- */

.article-content code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace !important;
  background: rgba(0, 255, 255, 0.07) !important;
  border: 1px solid rgba(0, 255, 255, 0.18);
  font-size: 0.875em !important;
  padding: 0.12rem 0.42rem !important;
  border-radius: 0.3rem !important;
  letter-spacing: -0.005em;
}

.article-content pre code {
  background: transparent !important;
  border: 0 !important;
  padding: 0 !important;
}

/* ---------- Refined figcaption ---------- */

.article-content figcaption {
  font-style: italic;
  letter-spacing: 0.01em;
  font-size: 0.8125rem !important;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.55) !important;
  margin-top: 0.875rem;
}

/* ---------- Strong + em refinements (paragraph-only) ---------- */

.article-content p strong {
  color: #ffffff;
  font-weight: 600;
}

.article-content p em {
  font-style: italic;
  color: #f3f4f6;
}

/* ---------- Header logo — subtle hover ---------- */

header.fixed a:has(> img[alt="Paul Takisaki"]) {
  display: inline-flex;
  transition: filter 220ms ease, transform 220ms ease;
}

header.fixed a:has(> img[alt="Paul Takisaki"]):hover {
  filter: brightness(1.15);
  transform: scale(1.03);
}

/* ---------- Hero scroll cue — animated cyan thread ---------- */

main > div.relative > div.absolute.inset-0.flex.flex-col.justify-center {
  position: absolute;
}

main > div.relative > div.absolute.inset-0.flex.flex-col.justify-center::after {
  content: "";
  position: absolute;
  bottom: 1rem;
  left: 50%;
  width: 1px;
  height: 2rem;
  background: linear-gradient(180deg, rgba(0, 255, 255, 0) 0%, rgba(0, 255, 255, 0.7) 100%);
  transform: translateX(-50%);
  animation: scrollCue 2.6s ease-in-out infinite;
  pointer-events: none;
}

@keyframes scrollCue {
  0%, 100% { opacity: 0.25; transform: translate(-50%, -3px); }
  50%      { opacity: 1;    transform: translate(-50%, 4px); }
}

/* ---------- Mobile refinements for pass 3 ---------- */

@media (max-width: 640px) {
  .article-content ol > li {
    padding-left: 2.5rem;
  }
  .article-content ol > li::before {
    width: 1.625rem;
    height: 1.625rem;
    font-size: 0.75rem;
  }

  /* Hide hero scroll cue on small screens — limited room */
  main > div.relative > div.absolute.inset-0.flex.flex-col.justify-center::after {
    display: none;
  }
}

/* ---------- Reduced motion — kill scroll cue animation ---------- */

@media (prefers-reduced-motion: reduce) {
  main > div.relative > div.absolute.inset-0.flex.flex-col.justify-center::after {
    animation: none !important;
    opacity: 0.45;
  }
}

/* ---------- Print — neutralize pass 3 ornaments ---------- */

@media print {
  .article-content ol > li::before {
    background: none !important;
    border: 1px solid #000 !important;
    color: #000 !important;
  }
  .article-content ul > li::before {
    background: #000 !important;
  }
  .article-content hr::before {
    color: #000 !important;
  }
  .article-content code {
    background: #f3f4f6 !important;
    border: 1px solid #ccc !important;
    color: #000 !important;
  }
  main > div.relative > div.absolute.inset-0.flex.flex-col.justify-center::after {
    display: none !important;
  }
}

/* ============================================================
   Pass 4 — Element primitives, opt-in lede, mobile menu UX
   ============================================================ */

/* ---------- External link auto-arrow ---------- */

.article-content a[href^="http"]:not([href*="paultakisaki.com"]):not([href*="localhost"]):not(.lightbox-trigger):not([class*="bg-"])::after {
  content: " \2197";  /* ↗ — north-east arrow */
  display: inline-block;
  font-size: 0.78em;
  margin-left: 0.15em;
  color: rgba(0, 255, 255, 0.7);
  transition: transform 200ms ease, color 200ms ease;
}

.article-content a[href^="http"]:not([href*="paultakisaki.com"]):not([href*="localhost"]):not(.lightbox-trigger):not([class*="bg-"]):hover::after {
  transform: translate(1px, -1px);
  color: #ffffff;
}

/* ---------- Opt-in lede paragraph ---------- */

.article-content > p.lede {
  font-size: 1.1875rem;
  line-height: 1.7;
  color: #f3f4f6;
  font-weight: 400;
  letter-spacing: -0.005em;
  margin-bottom: 1.75rem;
}

@media (min-width: 768px) {
  .article-content > p.lede::first-letter {
    float: left;
    font-size: 4rem;
    line-height: 0.9;
    padding: 0.4rem 0.65rem 0 0;
    color: #ffffff;
    font-weight: 700;
    letter-spacing: -0.03em;
  }
}

/* ---------- Mobile menu — scroll-lock body when open ---------- */

body:has(#mobile-menu.translate-y-0) {
  overflow: hidden;
}

/* ---------- <kbd> — keyboard input ---------- */

.article-content kbd {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.8125em;
  padding: 0.15rem 0.45rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-bottom-width: 2px;
  border-radius: 0.3rem;
  background: rgba(255, 255, 255, 0.05);
  color: #f3f4f6;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.45);
  letter-spacing: -0.005em;
  white-space: nowrap;
}

/* ---------- <mark> — highlight ---------- */

.article-content mark {
  background: linear-gradient(transparent 55%, rgba(0, 255, 255, 0.20) 55%);
  color: inherit;
  padding: 0 0.1em;
}

/* ---------- <sup> / <sub> ---------- */

.article-content sup,
.article-content sub {
  font-size: 0.7em;
  line-height: 0;
}

.article-content sup {
  vertical-align: super;
  color: rgba(0, 255, 255, 0.85);
  margin-left: 0.1em;
}

/* ---------- <table> — editorial style ---------- */

.article-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  font-size: 0.9375rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0.5rem;
  overflow: hidden;
}

.article-content thead {
  background: rgba(0, 255, 255, 0.05);
}

.article-content th,
.article-content td {
  padding: 0.625rem 0.875rem;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  vertical-align: top;
}

.article-content th {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(0, 255, 255, 0.9);
  font-weight: 600;
}

.article-content tbody tr {
  transition: background-color 180ms ease;
}

.article-content tbody tr:hover {
  background: rgba(255, 255, 255, 0.025);
}

.article-content tbody tr:last-child td {
  border-bottom: 0;
}

/* ---------- <details> / <summary> — refined accordion ---------- */

.article-content details {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0.5rem;
  padding: 0.875rem 1.125rem;
  margin: 1.25rem 0;
  background: rgba(255, 255, 255, 0.018);
  transition: border-color 220ms ease, background-color 220ms ease;
}

.article-content details[open] {
  border-color: rgba(0, 255, 255, 0.28);
  background: rgba(0, 255, 255, 0.03);
}

.article-content summary {
  cursor: pointer;
  font-weight: 600;
  color: #ffffff;
  list-style: none;
  position: relative;
  padding-left: 1.5rem;
  letter-spacing: -0.005em;
  outline: none;
}

.article-content summary::-webkit-details-marker { display: none; }

.article-content summary::before {
  content: "+";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  color: #00ffff;
  font-weight: 700;
  font-size: 1.15em;
  line-height: 1;
  transition: transform 220ms ease;
}

.article-content details[open] > summary::before {
  content: "\2212";  /* − */
}

.article-content summary:focus-visible {
  outline: 2px solid #00ffff;
  outline-offset: 4px;
  border-radius: 4px;
}

.article-content details > *:not(summary) {
  margin-top: 0.875rem;
}

/* ---------- Mobile refinements for pass 4 ---------- */

@media (max-width: 640px) {
  .article-content table {
    font-size: 0.875rem;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Hide drop cap on mobile — too cramped */
  .article-content > p.lede::first-letter {
    float: none;
    font-size: inherit;
    padding: 0;
  }
}

/* ---------- Print — neutralize pass 4 ---------- */

@media print {
  .article-content a[href^="http"]:not([href*="paultakisaki.com"])::after {
    content: " (" attr(href) ")";
    color: #444 !important;
    font-size: 0.75em;
  }
  .article-content kbd {
    background: #f3f4f6 !important;
    color: #000 !important;
    border: 1px solid #999 !important;
    box-shadow: none !important;
  }
  .article-content mark {
    background: #ffe680 !important;
    color: #000 !important;
  }
  .article-content table {
    background: #fff !important;
  }
  .article-content thead {
    background: #f3f4f6 !important;
  }
  .article-content th {
    color: #000 !important;
  }
  .article-content details {
    border: 1px solid #ccc !important;
    background: #fff !important;
  }
  .article-content details[open] > summary::before,
  .article-content summary::before {
    display: none !important;
  }
  .article-content summary {
    padding-left: 0 !important;
  }
}

/* ============================================================
   Pass 5 — TOC scroll-spy active state (paired with article-enhance.js)
   ============================================================ */

.toc-list a {
  position: relative;
  display: inline-block;
  transition: color 220ms ease, padding-left 220ms ease;
}

.toc-list a.toc-active {
  color: #00ffff !important;
  padding-left: 0.75rem;
  font-weight: 500;
}

.toc-list a.toc-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 1.05em;
  background: linear-gradient(180deg, #00ffff, rgba(0, 255, 255, 0.4));
  border-radius: 2px;
  box-shadow: 0 0 8px rgba(0, 255, 255, 0.4);
}

@media (prefers-reduced-motion: reduce) {
  .toc-list a {
    transition: none !important;
  }
}

/* ============================================================
   Pass 6 — Atmosphere & accessibility
   ============================================================ */

/* ---------- Dynamic header — glass at top, opaque on scroll ---------- */

header.fixed {
  background-color: rgba(0, 0, 0, 0.55) !important;
  border-bottom-color: transparent !important;
  transition: background-color 320ms ease,
              border-color 320ms ease,
              box-shadow 320ms ease,
              backdrop-filter 320ms ease !important;
}

header.fixed.is-scrolled {
  background-color: rgba(0, 0, 0, 0.92) !important;
  border-bottom-color: rgba(255, 255, 255, 0.08) !important;
  box-shadow: 0 1px 14px rgba(0, 0, 0, 0.45);
  -webkit-backdrop-filter: blur(18px) saturate(170%);
  backdrop-filter: blur(18px) saturate(170%);
}

/* ---------- Skip-to-content keyboard link ---------- */

.skip-to-content {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 1000;
  padding: 0.625rem 1.125rem;
  background: #00ffff;
  color: #000000;
  font-weight: 700;
  font-size: 0.8125rem;
  letter-spacing: 0.02em;
  border-radius: 0.4rem;
  text-decoration: none;
  transform: translateY(calc(-100% - 1rem));
  transition: transform 200ms cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 200ms ease;
  box-shadow: 0 8px 22px rgba(0, 255, 255, 0.35);
}

.skip-to-content:focus,
.skip-to-content:focus-visible {
  transform: translateY(0);
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

main:focus {
  outline: none;
}

/* ---------- External link auto-attribute compatibility ---------- */
/* (No CSS needed — JS sets target/rel; Pass 4's "↗" still applies.) */

/* ---------- Reduced motion — kill header transition ---------- */

@media (prefers-reduced-motion: reduce) {
  header.fixed {
    transition: none !important;
  }
  .skip-to-content {
    transition: none !important;
  }
}

/* ---------- Print — hide skip link ---------- */

@media print {
  .skip-to-content {
    display: none !important;
  }
  header.fixed {
    background: #ffffff !important;
    border-bottom: 1px solid #000 !important;
  }
}

/* ============================================================
   Pass 7 — Reading-time pill, copy-link toast, active nav
   ============================================================ */

/* ---------- Reading-time-remaining pill (desktop only) ---------- */

.read-time-pill {
  position: fixed;
  top: 4.5rem;
  right: 1.25rem;
  z-index: 45;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(0, 255, 255, 0.85);
  background: rgba(0, 0, 0, 0.55);
  padding: 0.35rem 0.75rem;
  border: 1px solid rgba(0, 255, 255, 0.18);
  border-radius: 999px;
  -webkit-backdrop-filter: blur(10px) saturate(140%);
  backdrop-filter: blur(10px) saturate(140%);
  font-variant-numeric: tabular-nums;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity 280ms ease, transform 280ms ease;
}

.read-time-pill.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 768px) {
  .read-time-pill { display: none !important; }
}

/* ---------- Toast (copy-link + future) ---------- */

.toast {
  position: fixed;
  bottom: max(2rem, env(safe-area-inset-bottom));
  left: 50%;
  z-index: 60;
  padding: 0.625rem 1.25rem;
  background: rgba(0, 0, 0, 0.92);
  color: #00ffff;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  border: 1px solid rgba(0, 255, 255, 0.28);
  border-radius: 999px;
  -webkit-backdrop-filter: blur(10px) saturate(150%);
  backdrop-filter: blur(10px) saturate(150%);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 1rem);
  transition: opacity 240ms ease,
              transform 320ms cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.55),
              0 0 0 1px rgba(0, 255, 255, 0.06);
  white-space: nowrap;
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- Active nav indicator (Field Notes) ---------- */

header nav a[href*="insight" i],
#mobile-menu a[href*="insight" i] {
  color: #00ffff !important;
}

header nav a[href*="insight" i] {
  position: relative;
}

header nav a[href*="insight" i]::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -7px;
  width: 5px;
  height: 5px;
  background: #00ffff;
  border-radius: 50%;
  transform: translateX(-50%);
  box-shadow: 0 0 8px rgba(0, 255, 255, 0.6);
  animation: navDotPulse 2.4s ease-in-out infinite;
}

@keyframes navDotPulse {
  0%, 100% { opacity: 0.65; }
  50%      { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .read-time-pill,
  .toast {
    transition: none !important;
  }
  header nav a[href*="insight" i]::after {
    animation: none !important;
    opacity: 0.85;
  }
}

@media print {
  .read-time-pill,
  .toast {
    display: none !important;
  }
  header nav a[href*="insight" i]::after {
    display: none !important;
  }
}

/* ---------- Print ---------- */

@media print {
  header,
  footer,
  .progress-bar,
  .back-to-top,
  #mobile-menu,
  [aria-label^="Share"],
  [aria-label="Copy link"],
  .lightbox-hint {
    display: none !important;
  }

  body {
    background: #ffffff !important;
    color: #000000 !important;
  }

  .article-content,
  .article-content * {
    color: #000000 !important;
  }

  .article-content a {
    color: #000000 !important;
    text-decoration: underline !important;
    background-image: none !important;
  }

  .article-content blockquote {
    background: none !important;
    border-left: 3px solid #000 !important;
    padding-left: 1rem !important;
  }

  .article-content blockquote::before,
  .article-content blockquote::after {
    display: none !important;
  }
}
