/*
  Daniel Sheedy Portfolio — Version 1.0
  Mathematical rendering, ambient worked examples, Blog cards, and article layout.
*/

body { isolation: isolate; }
body > [data-site-header],
body > main,
body > [data-site-footer] { position: relative; z-index: 2; }
.math-toggle-glyph { font-family: var(--serif); font-size: 1.23rem; font-weight: 700; line-height: 1; }
.icon-button.motion-off .math-toggle-glyph { opacity: 0.38; text-decoration: line-through; }
.icon-button:disabled { cursor: not-allowed; opacity: 0.45; transform: none !important; }



/* Version 1.0 ambience controls and layered mathematical field */
.math-ambience-control { position: relative; }
.math-ambience-panel {
  position: absolute;
  z-index: 240;
  top: calc(100% + 11px);
  right: 0;
  width: min(390px, calc(100vw - 24px));
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-top: 4px solid var(--gold);
  border-radius: 7px;
  background: color-mix(in srgb, var(--surface-solid) 97%, transparent);
  box-shadow: 0 24px 70px color-mix(in srgb, #000 22%, transparent);
  backdrop-filter: blur(22px);
}
.math-ambience-panel[hidden] { display: none !important; }
.math-ambience-panel > header,
.math-ambience-panel > footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 15px;
}
.math-ambience-panel > header { border-bottom: 1px solid var(--line); }
.math-ambience-panel > header > div { display: grid; gap: 3px; min-width: 0; }
.math-ambience-panel > header span,
.math-ambience-panel > footer span {
  color: var(--faint);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.math-ambience-panel > header strong { overflow: hidden; font-size: 0.82rem; text-overflow: ellipsis; white-space: nowrap; }
.math-ambience-panel > header .icon-button { width: 31px; height: 31px; flex: 0 0 auto; font-size: 1.15rem; }
.math-ambience-body { display: grid; gap: 11px; padding: 15px; }
.math-ambience-body > label { display: grid; grid-template-columns: minmax(92px, 0.72fr) minmax(0, 1.28fr); gap: 12px; align-items: center; }
.math-ambience-body > label > span { color: var(--muted); font-size: 0.73rem; font-weight: 760; }
.math-ambience-body select {
  min-width: 0;
  min-height: 38px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--text);
  padding: 0 28px 0 9px;
  font: 0.74rem var(--font);
}
.math-play-control {
  width: 100%;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 11px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: color-mix(in srgb, var(--gold) 5%, var(--surface));
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.math-play-control:hover { border-color: var(--gold); }
.math-play-control:disabled { cursor: not-allowed; opacity: 0.67; }
.math-play-control > span:last-child { display: grid; gap: 2px; }
.math-play-control strong { font-size: 0.77rem; }
.math-play-control small { color: var(--muted); font-size: 0.67rem; line-height: 1.4; }
.math-play-icon { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; background: var(--surface); color: var(--red); font-size: 0.74rem; font-weight: 900; }
.math-play-control.is-paused .math-play-icon { padding-left: 2px; }
.math-checkbox { grid-template-columns: 18px minmax(0, 1fr) !important; }
.math-checkbox input { width: 16px; height: 16px; accent-color: var(--red); }
.math-ambience-panel > footer { border-top: 1px solid var(--line); background: var(--surface-2); }
.math-ambience-panel > footer a { flex: 0 0 auto; color: var(--red); font-size: 0.72rem; font-weight: 800; }
.math-ambience-panel > footer a:hover { color: var(--red-strong); }
.icon-button.reduced-motion-active { border-style: dashed; }

.math-background-orbits,
.math-background-axis { position: absolute; inset: 0; }
.math-background-orbits {
  background:
    radial-gradient(ellipse 34% 18% at 14% 18%, transparent 68%, color-mix(in srgb, var(--gold) 10%, transparent) 69%, transparent 70%),
    radial-gradient(ellipse 28% 16% at 84% 72%, transparent 68%, color-mix(in srgb, var(--red) 8%, transparent) 69%, transparent 70%),
    radial-gradient(circle at 83% 17%, color-mix(in srgb, var(--gold) 7%, transparent) 0 2px, transparent 3px),
    radial-gradient(circle at 17% 77%, color-mix(in srgb, var(--red) 7%, transparent) 0 2px, transparent 3px);
  opacity: 0.72;
}
.math-background-axis {
  background:
    linear-gradient(90deg, transparent calc(50% - .5px), color-mix(in srgb, var(--grey) 6%, transparent) 50%, transparent calc(50% + .5px)),
    linear-gradient(transparent calc(50% - .5px), color-mix(in srgb, var(--grey) 6%, transparent) 50%, transparent calc(50% + .5px));
  opacity: 0.5;
}
.math-proof-watermark {
  position: absolute;
  z-index: 0;
  top: 5px;
  right: 9px;
  color: color-mix(in srgb, var(--gold) 14%, transparent);
  font: 900 clamp(2rem, 4vw, 3.6rem)/1 var(--serif);
  letter-spacing: -0.08em;
  pointer-events: none;
}
.math-proof-card[data-labels="false"] header,
.math-proof-card[data-labels="false"] footer { visibility: hidden; }
.math-proof-card.proof-preview {
  border-color: color-mix(in srgb, var(--red) 58%, var(--line));
  background: color-mix(in srgb, var(--surface-solid) 52%, transparent);
  box-shadow: 0 18px 64px color-mix(in srgb, var(--red) 11%, transparent);
}
.math-background[data-contrast="subtle"] .math-proof-card { opacity: 0.66; }
.math-background[data-contrast="clear"] .math-proof-card {
  background: color-mix(in srgb, var(--surface-solid) 53%, transparent);
  color: color-mix(in srgb, var(--text) 72%, transparent);
  border-color: color-mix(in srgb, var(--grey) 35%, transparent);
  backdrop-filter: blur(2px);
}
.math-background[data-contrast="clear"] .math-proof-card header span,
.math-background[data-contrast="clear"] .math-proof-card footer { color: color-mix(in srgb, var(--muted) 78%, transparent); }

@media (max-width: 860px) {
  .math-ambience-panel { position: fixed; top: 78px; right: 12px; }
}
@media (max-width: 480px) {
  .math-ambience-panel { top: 74px; right: 8px; width: calc(100vw - 16px); max-height: calc(100vh - 88px); overflow-y: auto; }
  .math-ambience-body > label { grid-template-columns: 1fr; gap: 5px; }
  .math-ambience-panel > footer { align-items: flex-start; flex-direction: column; }
}

/* Ambient mathematical working */
.math-background {
  position: fixed;
  z-index: 0;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  contain: strict;
  opacity: 1;
  transition: opacity 0.35s ease;
}
.math-background-paused { opacity: 0; }
.math-background-grid,
.math-background-vignette { position: absolute; inset: 0; }
.math-background-grid {
  background-image:
    linear-gradient(color-mix(in srgb, var(--gold) 5%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--gold) 5%, transparent) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(circle at 52% 38%, black, transparent 80%);
  opacity: 0.45;
}
.math-background-vignette {
  background: radial-gradient(circle at 50% 44%, transparent 31%, var(--bg) 93%);
  opacity: 0.48;
}
.math-proof-card {
  position: absolute;
  left: 0;
  padding: 17px 19px 13px;
  border: 1px solid color-mix(in srgb, var(--grey) 22%, transparent);
  border-top: 3px solid color-mix(in srgb, var(--gold) 56%, transparent);
  border-radius: 5px;
  background: color-mix(in srgb, var(--surface-solid) 29%, transparent);
  color: color-mix(in srgb, var(--text) 54%, transparent);
  box-shadow: 0 10px 38px color-mix(in srgb, var(--bg) 28%, transparent);
  backdrop-filter: blur(0.8px);
  will-change: transform, opacity;
  transform-origin: center;
}
.math-proof-card.proof-kind-proof,
.math-proof-card.proof-kind-derivation { border-top-color: color-mix(in srgb, var(--red) 50%, transparent); }
.math-proof-card::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 38px;
  width: 1px;
  background: color-mix(in srgb, var(--red) 14%, transparent);
}
.math-proof-card header,
.math-proof-card footer,
.math-proof-working { position: relative; z-index: 1; }
.math-proof-card header {
  display: grid;
  gap: 2px;
  padding: 0 0 8px 31px;
  border-bottom: 1px solid color-mix(in srgb, var(--grey) 18%, transparent);
}
.math-proof-card header span,
.math-proof-card footer {
  color: color-mix(in srgb, var(--muted) 62%, transparent);
  font-size: 0.57rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}
.math-proof-card header span { color: color-mix(in srgb, var(--red) 65%, transparent); font-weight: 850; }
.math-proof-card header strong { font-size: 0.77rem; letter-spacing: 0.01em; }
.math-proof-working { min-height: 132px; display: grid; gap: 5px; padding: 11px 0 8px 31px; }
.math-proof-line {
  position: relative;
  min-height: 27px;
  opacity: 0;
  clip-path: inset(0 100% 0 0);
  white-space: nowrap;
  font-size: clamp(0.83rem, 1vw, 1.06rem);
}
.math-proof-line mjx-container { margin: 0 !important; text-align: left !important; font-size: 1.18em !important; }
.math-proof-line.is-drawing {
  animation: math-write var(--draw-duration, 2200ms) cubic-bezier(0.2, 0.7, 0.2, 1) var(--line-delay, 0ms) forwards;
}
.math-proof-line.is-drawing::after {
  content: "";
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 0;
  width: 1px;
  background: currentColor;
  box-shadow: 0 0 6px currentColor;
  animation: math-pen var(--draw-duration, 2200ms) cubic-bezier(0.2, 0.7, 0.2, 1) var(--line-delay, 0ms) forwards;
}
.math-proof-source-fallback { overflow: hidden; text-overflow: ellipsis; font: 0.74rem/1.45 ui-monospace, monospace; }
.math-proof-card footer { display: flex; justify-content: space-between; gap: 9px; padding: 7px 0 0 31px; border-top: 1px solid color-mix(in srgb, var(--grey) 16%, transparent); }
.math-proof-card.proof-complete { border-color: color-mix(in srgb, var(--grey) 30%, transparent); }

@keyframes math-write {
  0% { opacity: 0; clip-path: inset(0 100% 0 0); filter: blur(1px); }
  8% { opacity: 0.55; }
  92% { opacity: 0.9; }
  100% { opacity: 1; clip-path: inset(0 0 0 0); filter: none; }
}
@keyframes math-pen {
  0% { left: 0; opacity: 0; }
  8% { opacity: 0.82; }
  92% { opacity: 0.62; }
  100% { left: 100%; opacity: 0; }
}

/* MathJax sizing and containment */
:root {
  --math-inline-scale: 1.11;
  --math-display-scale: 1.36;
  --math-hero-scale: 1.54;
}
mjx-container { max-width: 100%; color: inherit; }
mjx-container[jax="SVG"] { max-width: 100%; font-size: 1.11em !important; line-height: 1.28; }
mjx-container[jax="SVG"] > svg {
  width: auto !important;
  height: auto !important;
  max-width: none !important;
  overflow: visible;
  fill: currentColor;
  stroke: currentColor;
  stroke-width: 0;
  stroke-linecap: butt;
  stroke-linejoin: miter;
}
mjx-container[jax="SVG"][display="true"] {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.32em 0.12em 0.44em;
  font-size: 1.36em !important;
  scrollbar-width: thin;
  overscroll-behavior-inline: contain;
}
.latex-demo { overflow: auto; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); font-size: 1.12rem; }
.latex-render-error { outline: 2px solid color-mix(in srgb, var(--danger) 70%, transparent); outline-offset: 3px; }

/* Blog archive */
.blog-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.blog-card { min-width: 0; }
.blog-card-link {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.blog-card-link:hover { transform: translateY(-2px); border-color: var(--line-strong); box-shadow: var(--shadow-soft); }
.blog-card-equation {
  position: relative;
  min-height: 142px;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 23px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--red) 7%, transparent), transparent 44%),
    color-mix(in srgb, var(--gold) 7%, var(--surface-2));
  font-size: clamp(1.25rem, 2.1vw, 1.75rem);
}
.blog-card-equation::before,
.featured-blog-equation::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: 0.24;
}
.blog-card-equation > span,
.blog-card-equation > mjx-container,
.featured-blog-equation > mjx-container { position: relative; z-index: 1; }
.blog-card-equation mjx-container[jax="SVG"] > svg,
.featured-blog-equation mjx-container[jax="SVG"] > svg,
.post-equation-panel mjx-container[jax="SVG"] > svg { max-width: 100% !important; height: auto !important; }
.blog-card-body { flex: 1; display: flex; flex-direction: column; padding: 20px; }
.blog-card-meta,
.blog-card-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; color: var(--faint); font-size: 0.67rem; letter-spacing: 0.06em; text-transform: uppercase; }
.blog-card h3 { margin: 15px 0 8px; font-size: 1.17rem; line-height: 1.2; letter-spacing: -0.024em; }
.blog-card p { margin: 0; color: var(--muted); font-size: 0.86rem; }
.blog-card-footer { margin-top: auto; padding-top: 20px; letter-spacing: 0; text-transform: none; }
.featured-blog { margin-top: 34px; }
.featured-blog-link {
  min-height: 350px;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.72fr);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.featured-blog-link:hover { transform: translateY(-2px); box-shadow: var(--shadow-soft); }
.featured-blog-copy { display: flex; flex-direction: column; align-items: flex-start; padding: clamp(30px, 5vw, 52px); }
.featured-blog-copy h2 { margin: 15px 0; font-size: clamp(1.9rem, 3.8vw, 3rem); line-height: 1.05; letter-spacing: -0.045em; }
.featured-blog-copy > p:not(.eyebrow) { max-width: 630px; color: var(--muted); }
.featured-blog-copy .button { margin-top: auto; }
.featured-blog-equation {
  position: relative;
  min-height: 260px;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 34px;
  border-left: 1px solid var(--line);
  background: color-mix(in srgb, var(--gold) 9%, var(--surface-2));
  font-size: clamp(1.55rem, 2.7vw, 2.3rem);
}

/* Article page */
.reading-progress-track { position: fixed; z-index: 300; top: 0; right: 0; left: 0; height: 3px; background: transparent; }
.reading-progress { display: block; width: 100%; height: 100%; transform: scaleX(0); transform-origin: left; background: linear-gradient(90deg, var(--red), var(--gold)); will-change: transform; }
.post-hero { padding: 48px 0 43px; border-bottom: 1px solid var(--line); }
.post-breadcrumb { margin-bottom: 32px; }
.post-header { max-width: 900px; }
.post-meta-row { display: flex; flex-wrap: wrap; gap: 9px 17px; color: var(--faint); font-size: 0.72rem; letter-spacing: 0.09em; text-transform: uppercase; }
.post-meta-row span:first-child { color: var(--red); font-weight: 850; }
.post-header h1 { max-width: 980px; margin: 20px 0; font-size: clamp(2.55rem, 5.8vw, 4.8rem); line-height: 1; letter-spacing: -0.055em; }
.post-subtitle { max-width: 790px; margin: 0; color: var(--muted); font-size: clamp(1rem, 1.8vw, 1.19rem); }
.post-equation-panel {
  --math-display-scale: 1.22;
  position: relative;
  min-height: 230px;
  display: grid;
  place-items: center;
  overflow: auto;
  margin-top: 40px;
  padding: 43px 58px;
  border: 1px solid var(--line-strong);
  border-top: 4px solid var(--gold);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--gold) 7%, var(--surface));
  font-size: clamp(1.5rem, 3vw, 2.7rem);
}
.post-equation-panel .post-hero-math-render { max-width: 100%; overflow-x: auto; padding: 0.32rem 0.18rem; }
.post-equation-panel .copy-latex-button { top: 12px; right: 12px; }
.post-byline { display: flex; align-items: center; justify-content: space-between; gap: 22px; margin-top: 20px; padding: 16px 0 0; color: var(--muted); font-size: 0.8rem; }
.post-byline strong { color: var(--text); }
.post-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.post-actions .button { min-height: 37px; padding: 0 12px; font-size: 0.73rem; }
.post-layout { display: grid; grid-template-columns: minmax(0, 750px) 220px; gap: 64px; align-items: start; justify-content: center; }
.post-article { min-width: 0; }
.article-body { color: color-mix(in srgb, var(--text) 93%, var(--muted)); font-family: var(--serif); font-size: 1.075rem; line-height: 1.84; }
.article-body > p:first-child { color: var(--text); font-size: 1.14rem; }
.article-body h2,
.article-body h3,
.article-body h4 { color: var(--text); font-family: var(--font); letter-spacing: -0.035em; scroll-margin-top: 95px; }
.article-body h2 { margin: 2.35em 0 0.62em; font-size: clamp(1.75rem, 3.5vw, 2.55rem); line-height: 1.09; }
.article-body h3 { margin: 1.95em 0 0.55em; font-size: 1.38rem; }
.article-body h4 { margin: 1.7em 0 0.48em; font-size: 1.08rem; }
.article-body p { margin: 0 0 1.3em; }
.article-body a { color: var(--red); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.article-body ul,
.article-body ol { margin: 0 0 1.5em; padding-left: 1.35em; }
.article-body li { margin: 0.43em 0; }
.article-body blockquote { margin: 1.9em 0; padding: 20px 24px; border-left: 4px solid var(--red); background: color-mix(in srgb, var(--red) 5%, var(--surface)); color: var(--muted); font-size: 1.08rem; font-style: italic; }
.article-body hr { margin: 2.8rem 0; border: 0; border-top: 1px solid var(--line); }
.article-body img { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-soft); }
.article-figure { margin: 2.1rem 0; }
.article-figure img { width: 100%; height: auto; }
.article-figure figcaption { padding: 9px 2px 0; color: var(--muted); font: 0.76rem/1.5 var(--font); }
.article-callout { margin: 1.9rem 0; padding: 19px 21px; border: 1px solid var(--line); border-left: 4px solid var(--gold); background: var(--surface); font-family: var(--font); }
.article-callout > strong { display: block; margin-bottom: 8px; color: var(--gold-strong); font-size: 0.8rem; letter-spacing: 0.06em; text-transform: uppercase; }
.article-callout div > :last-child { margin-bottom: 0; }
.callout-warning { border-left-color: var(--red); }
.callout-warning > strong { color: var(--red); }
.callout-example { border-left-color: var(--grey); }
.callout-example > strong { color: var(--text); }
.callout-theorem,
.callout-definition,
.callout-proof { border-color: color-mix(in srgb, var(--gold) 42%, var(--line)); border-left-color: var(--gold); }
.callout-theorem > strong,
.callout-definition > strong,
.callout-proof > strong { color: var(--gold-strong); }
.article-details { margin: 1.9rem 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); font-family: var(--font); }
.article-details summary { padding: 14px 18px; cursor: pointer; color: var(--text); font-weight: 800; }
.article-details > div { padding: 0 18px 16px; color: var(--muted); }
.task-item { list-style: none; display: flex; align-items: flex-start; gap: 9px; margin-left: -1.25em !important; }
.task-item input { margin-top: 0.45em; accent-color: var(--red); }
.article-table-wrap { margin: 2rem 0; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.article-body table { width: 100%; border-collapse: collapse; background: var(--surface); font-family: var(--font); font-size: 0.82rem; }
.article-body th,
.article-body td { padding: 10px 12px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.article-body th:last-child,
.article-body td:last-child { border-right: 0; }
.article-body tr:last-child td { border-bottom: 0; }
.article-body th { color: var(--text); background: color-mix(in srgb, var(--gold) 7%, var(--surface-2)); }
.article-code { margin: 2rem 0; overflow: hidden; border: 1px solid var(--line-strong); border-radius: var(--radius); background: #25231f; color: #f4efe5; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.article-code-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 12px; border-bottom: 1px solid rgba(255,255,255,0.12); color: #c7bfb2; font: 0.68rem var(--font); }
.article-code-head button { border: 1px solid rgba(255,255,255,0.18); border-radius: 4px; background: transparent; color: #f4efe5; padding: 4px 7px; cursor: pointer; }
.article-code pre { margin: 0; overflow-x: auto; padding: 17px; line-height: 1.65; tab-size: 2; }
.article-code code { font-size: 0.82rem; }
.tok-comment { color: #a7a096; }
.tok-keyword { color: #e08a93; }
.tok-number { color: #d8b85f; }
.tok-string { color: #d8cba8; }
.tok-operator { color: #f4efe5; }
.tok-tag { color: #e08a93; }
.tok-attr { color: #d8b85f; }
.article-math {
  position: relative;
  margin: 2.05rem 0;
  overflow: hidden;
  padding: 1.18rem 3.15rem 1.1rem 1.25rem;
  border: 1px solid color-mix(in srgb, var(--gold) 34%, var(--line));
  border-left: 4px solid var(--gold);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--gold) 5%, var(--surface));
}
.article-math-render { overflow-x: auto; overflow-y: hidden; padding: 0.14rem 0.1rem; scrollbar-width: thin; }
.article-math mjx-container[display="true"] { margin: 0.32rem 0 !important; text-align: center !important; font-size: var(--post-math-size, 1.58em) !important; }
.article-body mjx-container:not([display="true"]),
.article-preview mjx-container:not([display="true"]) { font-size: 1.12em !important; }
.copy-latex-button { position: absolute; z-index: 2; top: 9px; right: 9px; padding: 5px 7px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface-2); color: var(--muted); font-family: var(--font); font-size: 0.64rem; font-weight: 760; cursor: pointer; }
.copy-latex-button:hover { border-color: var(--red); color: var(--text); }
.post-footer-meta { margin-top: 54px; padding-top: 22px; border-top: 1px solid var(--line); }
.post-tags { display: flex; flex-wrap: wrap; gap: 7px; }
.post-tags span,
.post-tags a { padding: 5px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-family: var(--font); font-size: 0.68rem; }
.post-aside { position: sticky; top: 92px; }
.post-aside-card { padding: 16px 17px; border: 1px solid var(--line); border-top: 3px solid var(--gold); border-radius: var(--radius); background: var(--surface); }
.post-aside-card > p { margin: 0 0 10px; color: var(--faint); font-size: 0.66rem; font-weight: 850; letter-spacing: 0.1em; text-transform: uppercase; }
.post-toc { display: grid; }
.post-toc a { padding: 6px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.74rem; line-height: 1.35; }
.post-toc a:hover { color: var(--red); }
.post-toc .toc-level-h3 { padding-left: 11px; font-size: 0.71rem; }
.post-toc .toc-level-h4 { padding-left: 20px; font-size: 0.68rem; }

@media (max-width: 1050px) {
  .blog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .featured-blog-link { grid-template-columns: 1fr; }
  .featured-blog-equation { min-height: 240px; border-top: 1px solid var(--line); border-left: 0; }
  .post-layout { grid-template-columns: minmax(0, 750px); }
  .post-aside { position: static; order: -1; }
  .post-toc { display: flex; flex-wrap: wrap; gap: 3px 14px; }
  .post-toc .toc-level-h3,
  .post-toc .toc-level-h4 { padding-left: 0; }
}

@media (max-width: 700px) {
  :root { --math-inline-scale: 1.07; --math-display-scale: 1.20; --math-hero-scale: 1.34; }
  .math-proof-card { filter: none; }
  .math-proof-line { font-size: clamp(0.78rem, 2.8vw, 0.95rem); }
  .blog-grid { grid-template-columns: 1fr; }
  .featured-blog-copy { padding: 28px 22px; }
  .featured-blog-equation { min-height: 205px; padding: 22px; }
  .post-hero { padding-top: 38px; }
  .post-header h1 { font-size: clamp(2.25rem, 10.4vw, 3.2rem); line-height: 1.01; }
  .post-equation-panel { min-height: 185px; padding: 40px 17px 22px; font-size: clamp(1.28rem, 6.7vw, 2rem); }
  .post-byline { align-items: flex-start; flex-direction: column; }
  .post-layout { display: block; }
  .article-body { font-size: 1rem; line-height: 1.78; }
  .article-body h2 { font-size: 1.9rem; }
  .article-math { margin: 1.65rem -3px; padding: 0.95rem 0.7rem 0.9rem; border-radius: 5px; }
  .article-math .copy-latex-button { position: static; display: block; margin: 0.62rem 0 0 auto; }
  .article-math mjx-container[display="true"] { font-size: var(--post-math-size-mobile, 1.40em) !important; }
  .post-equation-panel .copy-latex-button { top: 8px; right: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .math-background { display: none !important; }
  .reading-progress { display: none; }
  .blog-card-link,
  .featured-blog-link { transition: none !important; }
}

@media print {
  .math-background,
  .reading-progress-track,
  .post-actions,
  .post-aside { display: none !important; }
  body[data-page="post"] [data-site-header],
  body[data-page="post"] [data-site-footer] { display: none !important; }
  .post-hero { padding: 0 0 16px; border-bottom: 0; }
  .post-equation-panel { min-height: 0; padding: 18px 0; border: 0; background: transparent; }
  .post-layout { display: block; }
  .article-body { color: #111; font-size: 10.5pt; line-height: 1.55; }
  .article-body h2,
  .article-body h3,
  .article-body h4 { color: #111; }
  .post-footer-meta,
  .related-writing-section,
  .copy-latex-button { display: none !important; }
  .article-callout,
  .article-table-wrap,
  .article-code { break-inside: avoid; }
  .article-math { padding: 0.4rem 0; border: 0; background: transparent; overflow: visible; }
  mjx-container[jax="SVG"][display="true"] { font-size: 1.08em !important; }
  @page { size: A4; margin: 16mm; }
}

/* BLOG INTEGRATION ADDENDUM — Production Version 1.0.4 */
.blog-archive-hero .lead { max-width: 900px; }
.blog-corpus-metrics {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-top: 34px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--gold);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
}
.blog-corpus-metrics article { min-width: 0; }
.blog-corpus-metrics strong { font-size: clamp(1.45rem, 3vw, 2.15rem); }
.blog-corpus-metrics span { line-height: 1.35; }

.blog-continue-section { padding-top: 34px; padding-bottom: 34px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--gold) 4%, var(--surface)); }
.compact-blog-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.compact-journal-card .blog-card-equation { min-height: 88px; padding: 15px; font-size: 1.12rem; }
.compact-journal-card .blog-card-body { padding: 16px; }
.compact-journal-card h3 { margin-top: 10px; font-size: 1rem; }

.six-route-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.journal-route-card {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas:
    "symbol count"
    "title title"
    "copy copy"
    "latest latest"
    "link link";
  gap: 10px 16px;
  align-content: start;
  min-height: 285px;
  padding: 24px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--gold);
  border-radius: var(--radius);
  background: var(--surface);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.journal-route-card:hover { transform: translateY(-2px); border-color: var(--line-strong); box-shadow: var(--shadow-soft); }
.reading-route-symbol {
  grid-area: symbol;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: color-mix(in srgb, var(--red) 5%, var(--surface-2));
  color: var(--red);
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 900;
}
.reading-route-count { grid-area: count; align-self: center; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 3px 8px; color: var(--faint); font-size: .66rem; letter-spacing: .06em; text-transform: uppercase; }
.reading-route-count strong { color: var(--text); font-size: 1.35rem; line-height: 1; }
.journal-route-card h3 { grid-area: title; margin: 10px 0 0; font-size: 1.28rem; line-height: 1.18; }
.journal-route-card > p { grid-area: copy; margin: 0; color: var(--muted); font-size: .84rem; line-height: 1.58; }
.journal-route-card small { grid-area: latest; align-self: end; padding-top: 10px; border-top: 1px solid var(--line); color: var(--faint); font-size: .68rem; line-height: 1.45; }
.journal-route-card > b { grid-area: link; color: var(--red); font-size: .73rem; }

.featured-blog-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 22px; }
.featured-blog-tags span,
.journal-card-tags span { padding: 4px 7px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: .64rem; line-height: 1.2; }

.blog-toolbar-expanded {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(250px, .52fr) 160px auto;
  align-items: end;
  gap: 12px;
  margin: 0 0 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.blog-toolbar-expanded .filters { grid-column: 1 / -1; }
.blog-toolbar-expanded .filter-button { display: inline-flex; align-items: center; gap: 6px; }
.blog-toolbar-expanded .filter-button span { font-family: var(--serif); font-weight: 800; }
.blog-search-box { min-width: 0; height: 42px; }
.blog-sort-label { display: grid; gap: 5px; color: var(--faint); font-size: .63rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.blog-sort-label select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-small);
  background: var(--surface);
  color: var(--text);
  padding: 0 34px 0 10px;
  font: .76rem var(--font);
}
.blog-reset-button { min-height: 42px; }
.blog-status { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 20px; margin: 0 0 18px; color: var(--faint); font-size: .7rem; }
.blog-status #blog-count { color: var(--text); font-weight: 760; }
.journal-grid { align-items: stretch; }
.journal-card-tags { display: flex; flex-wrap: wrap; gap: 5px; margin: 16px 0 0; }
.journal-card .blog-card-footer { gap: 9px; }
.journal-card .blog-card-footer b { margin-left: auto; color: var(--red); }
.journal-card .blog-card-footer span:nth-child(2) { max-width: 48%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.section-compact { padding-top: 28px; padding-bottom: 28px; }
.post-overview-section { border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--gold) 4%, var(--surface)); }
.post-overview-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.post-overview-grid article { min-width: 0; padding: 17px 19px; border-right: 1px solid var(--line); }
.post-overview-grid article:last-child { border-right: 0; }
.post-overview-grid span,
.post-overview-grid strong { display: block; }
.post-overview-grid span { margin-bottom: 5px; color: var(--faint); font-size: .62rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.post-overview-grid strong { font-size: .82rem; line-height: 1.45; }
.post-aside { display: grid; gap: 14px; }
.post-route-card { overflow: hidden; }
.post-route-card .post-route-symbol { width: 42px; height: 42px; display: grid; place-items: center; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 50%; color: var(--red); font-family: var(--serif); font-weight: 900; }
.post-route-card h3 { margin: 0 0 8px; font-size: .98rem; line-height: 1.25; }
.post-route-card > p:not(:first-child) { margin: 0 0 10px; color: var(--muted); font-size: .72rem; line-height: 1.5; text-transform: none; letter-spacing: 0; font-weight: 400; }
.post-route-card a { color: var(--red); font-size: .72rem; font-weight: 800; }
.post-series-section { border-top: 1px solid var(--line); }
.post-series-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.post-series-nav > a { min-width: 0; display: grid; gap: 7px; padding: 19px 21px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); transition: border-color .18s ease, transform .18s ease; }
.post-series-nav > a:hover { transform: translateY(-2px); border-color: var(--red); }
.post-series-nav span { color: var(--faint); font-size: .65rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.post-series-nav strong { font-size: .92rem; line-height: 1.4; }
.post-series-next { text-align: right; }
.post-actions .is-saved { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 10%, var(--surface)); color: var(--text); }

.article-visual-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 14px; }
.article-visual-title strong { color: var(--text); font-size: .91rem; }
.article-visual-title span { max-width: 62%; color: var(--muted); font-size: .71rem; line-height: 1.48; text-align: right; }
.article-flow,
.article-plot { margin: 2.15rem 0; padding: 18px; border: 1px solid var(--line-strong); border-top: 4px solid var(--gold); border-radius: var(--radius); background: var(--surface); font-family: var(--font); }
.article-flow figcaption,
.article-plot figcaption { margin-top: 10px; color: var(--faint); font-size: .7rem; line-height: 1.5; }
.article-flow-track { display: flex; align-items: stretch; gap: 9px; overflow-x: auto; padding: 2px 1px 8px; scrollbar-width: thin; overscroll-behavior-inline: contain; }
.article-flow-step { min-width: 150px; flex: 1 0 150px; padding: 15px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface-2); }
.article-flow-step > span { display: block; color: var(--gold-strong); font-size: .61rem; font-weight: 850; letter-spacing: .09em; text-transform: uppercase; }
.article-flow-step strong { display: block; margin-top: 6px; color: var(--text); font-size: .82rem; line-height: 1.32; }
.article-flow-step p { margin: 7px 0 0; color: var(--muted); font-size: .69rem; line-height: 1.5; }
.article-flow-arrow { align-self: center; color: var(--red); font-family: var(--serif); font-size: 1.28rem; }
.article-plot-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 5px; background: var(--surface-2); scrollbar-width: thin; }
.article-plot svg { display: block; min-width: 640px; width: 100%; height: auto; }
.plot-gridline { stroke: var(--line); stroke-width: 1; }
.plot-axis { stroke: var(--text); stroke-width: 1.6; }
.plot-tick { fill: var(--faint); font: 12px var(--font); }
.plot-axis-label { fill: var(--muted); font: 700 14px var(--font); }
.plot-line { stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.plot-point { stroke-width: 1.5; }
.plot-series-0 { stroke: var(--red); fill: var(--red); }
.plot-series-1 { stroke: var(--gold); fill: var(--gold); }
.plot-series-2 { stroke: var(--text); fill: var(--text); }
.plot-series-3 { stroke: var(--muted); fill: var(--muted); }
.plot-series-4 { stroke: color-mix(in srgb, var(--red) 56%, var(--gold)); fill: color-mix(in srgb, var(--red) 56%, var(--gold)); stroke-dasharray: 10 4 2 4; }
.plot-series-5 { stroke: color-mix(in srgb, var(--text) 60%, var(--gold)); fill: color-mix(in srgb, var(--text) 60%, var(--gold)); stroke-dasharray: 4 4; }
.plot-bar { stroke: none; opacity: .82; }
.article-plot-legend { display: flex; flex-wrap: wrap; gap: 7px 16px; margin-top: 12px; }
.article-plot-legend span { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: .69rem; }
.article-plot-legend i { display: inline-block; width: 20px; height: 3px; background: var(--red); }
.article-plot-legend span:nth-child(2) i { background: var(--gold); }
.article-plot-legend span:nth-child(3) i { background: var(--text); }
.article-plot-legend span:nth-child(4) i { background: var(--muted); }
.article-plot-legend span:nth-child(5) i { background: color-mix(in srgb, var(--red) 56%, var(--gold)); }
.article-plot-legend span:nth-child(6) i { background: color-mix(in srgb, var(--text) 60%, var(--gold)); }
.article-visual-error { border-color: var(--danger); }
.article-visual-error-message { margin: 10px 0 0; color: var(--danger); font-size: .72rem; }

.article-body figure.article-figure { margin: 2.1rem 0; }
.article-body figure.article-figure img { width: 100%; height: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.article-body figure.article-figure figcaption { color: var(--faint); font-size: .72rem; line-height: 1.5; }

@media (max-width: 1050px) {
  .blog-corpus-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .blog-corpus-metrics article:nth-child(n+4) { border-top: 1px solid var(--line); }
  .six-route-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .blog-toolbar-expanded { grid-template-columns: minmax(0, 1fr) 165px auto; }
  .blog-search-box { grid-column: 1 / 2; }
  .post-overview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .post-overview-grid article:nth-child(2) { border-right: 0; }
  .post-overview-grid article:nth-child(n+3) { border-top: 1px solid var(--line); }
}

@media (max-width: 760px) {
  .blog-corpus-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .blog-corpus-metrics article:nth-child(n+3) { border-top: 1px solid var(--line); }
  .compact-blog-grid { grid-template-columns: 1fr; }
  .six-route-grid { grid-template-columns: 1fr; }
  .journal-route-card { min-height: 0; }
  .blog-toolbar-expanded { grid-template-columns: 1fr; align-items: stretch; }
  .blog-toolbar-expanded .filters,
  .blog-search-box { grid-column: 1; }
  .blog-sort-label,
  .blog-reset-button { width: 100%; }
  .post-overview-grid { grid-template-columns: 1fr; }
  .post-overview-grid article,
  .post-overview-grid article:nth-child(2) { border-right: 0; border-top: 1px solid var(--line); }
  .post-overview-grid article:first-child { border-top: 0; }
  .post-series-nav { grid-template-columns: 1fr; }
  .post-series-next { text-align: left; }
  .article-visual-title { display: grid; gap: 6px; }
  .article-visual-title span { max-width: none; text-align: left; }
  .article-flow,
  .article-plot { margin-right: -3px; margin-left: -3px; padding: 14px 11px; }
  .article-plot svg { min-width: 580px; }
  .article-flow-arrow { transform: rotate(0deg); }
}

@media (max-width: 470px) {
  .blog-corpus-metrics { grid-template-columns: 1fr; }
  .blog-corpus-metrics article { border-top: 1px solid var(--line); }
  .blog-corpus-metrics article:first-child { border-top: 0; }
  .journal-route-card { padding: 20px; }
  .reading-route-count { justify-content: flex-start; }
  .journal-card .blog-card-footer span:nth-child(2) { max-width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .journal-route-card,
  .post-series-nav > a { transition: none; }
}

@media print {
  .blog-continue-section,
  .blog-toolbar-expanded,
  .post-overview-section,
  .post-series-section { break-inside: avoid; }
  .article-flow,
  .article-plot { border: 1px solid #bbb; background: #fff; }
  .article-flow-track { overflow: visible; }
  .article-plot svg { min-width: 0; }
}

/* BLOG CONNECTED RESOURCES — Production v1.0.4 */
.connected-resources-section[hidden] { display: none; }
.connected-resources-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.connected-resource-card { min-width: 0; }
.connected-resource-card > a { height: 100%; display: flex; flex-direction: column; padding: 19px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; }
.connected-resource-card > a:hover { transform: translateY(-2px); border-color: var(--red); box-shadow: var(--shadow-sm); }
.connected-resource-card span { color: var(--gold); font-size: .61rem; font-weight: 850; letter-spacing: .09em; text-transform: uppercase; }
.connected-resource-card h3 { margin: 8px 0 0; font-size: 1.08rem; line-height: 1.35; }
.connected-resource-card p { margin: 9px 0 15px; color: var(--muted); font-size: .86rem; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.connected-resource-card strong { margin-top: auto; color: var(--red); font-size: .76rem; line-height: 1.4; }
.post-overview-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }

@media (max-width: 1100px) {
  .connected-resources-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .post-overview-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .post-overview-grid article:nth-child(3) { border-right: 0; }
  .post-overview-grid article:nth-child(n+4) { border-top: 1px solid var(--line); }
}

@media (max-width: 760px) {
  .connected-resources-grid { grid-template-columns: 1fr; }
  .post-overview-grid { grid-template-columns: 1fr; }
  .post-overview-grid article,
  .post-overview-grid article:nth-child(2),
  .post-overview-grid article:nth-child(3) { border-right: 0; border-top: 1px solid var(--line); }
  .post-overview-grid article:first-child { border-top: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .connected-resource-card > a { transition: none; }
}

@media print {
  .connected-resources-section { break-before: auto; }
  .connected-resources-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .connected-resource-card > a { box-shadow: none; }
}
