/* ==========================================================
   sancamac — personal site
   Pale lavender + midnight blue (Notion-style)
   ========================================================== */

:root {
  /* Notion dev-page palette — pure white + vibrant mediumblue accents */
  --bg: #f6f6fc;            /* page background — Notion ghostwhite tint */
  --bg-2: #ffffff;          /* surface — pure white cards pop */
  --bg-3: #e8e8f4;          /* deeper light tint */
  --fg: #1313ba;            /* mediumblue — primary text (vibrant) */
  --fg-2: #3838c8;          /* secondary text */
  --muted: #7572c1;         /* cornflowerblue — muted text */
  --line: #c3c3e0;          /* hairline rule — lightsteelblue */
  --line-2: #e8e8f3;        /* softer rule */
  --node-bg: #ffffff;       /* card surface — white */
  --node-line: #d4d4ea;
  --accent: #1313ba;        /* mediumblue — CTAs, code blocks */

  --serif: "Source Serif 4", "Iowan Old Style", "Times New Roman", serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --gap: 24px;
  --pad-block: 120px;
  --pad-inline: clamp(20px, 5vw, 80px);

  --max: 1280px;
}

[data-density="compact"] {
  --pad-block: 80px;
  --gap: 16px;
}
[data-density="roomy"] {
  --pad-block: 160px;
  --gap: 32px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
html, body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.5;
  font-feature-settings: "ss01", "kern";
  -webkit-font-smoothing: antialiased;
}
body { overflow-x: hidden; }

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }

.mono { font-family: var(--mono); font-feature-settings: "ss01"; letter-spacing: -0.01em; }

/* ----- top nav ----- */
.topnav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px var(--pad-inline);
  background: color-mix(in oklab, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color .25s ease, background .25s ease;
}
.topnav[data-scrolled="true"] { border-bottom-color: var(--line-2); }
.topnav .brand {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: -0.01em;
  display: flex; align-items: center; gap: 8px;
}
.topnav .brand-dot { width: 7px; height: 7px; background: var(--fg); border-radius: 50%; display: inline-block; }
.topnav .links { display: flex; gap: 28px; font-family: var(--mono); font-size: 13px; color: var(--fg-2); }
.topnav .links a { padding: 4px 0; }
@media (max-width: 720px) { .topnav .links { display: none; } }

/* ----- hero ----- */
.hero {
  position: relative;
  min-height: 100vh;
  padding: 140px var(--pad-inline) 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  isolation: isolate;
  overflow: hidden;
}
.hero-header {
  max-width: 900px;
  width: 100%;
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 28px;
}
.hero-handle {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
  display: inline-flex; align-items: center; gap: 10px;
}
.hero-handle::before, .hero-handle::after {
  content: ""; width: 32px; height: 1px; background: var(--line); display: inline-block;
}
.hero-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(56px, 9vw, 124px);
  letter-spacing: -0.035em;
  line-height: 0.92;
  font-style: italic;
  font-optical-sizing: auto;
}
.hero-title .slash {
  font-style: normal;
  font-weight: 300;
  color: var(--muted);
  letter-spacing: -0.05em;
}

/* multilingual rotation */
.hero-title.rotating {
  transition: none;
  text-wrap: balance;
  /* sized so even the longest phrase ("Les choses les plus importantes ne sont pas des choses")
     still fits in two lines at the chosen font-size */
  max-width: min(92vw, 26ch);
  min-height: 3.1em;        /* reserve 3 lines so layout doesn't accordion as text types in */
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  white-space: normal;
  overflow-wrap: break-word;
}
.hero-title.rotating .typed {
  white-space: pre-wrap;
}
.hero-title.rotating .caret {
  display: inline-block;
  width: 0.04em;
  height: 0.92em;
  background: var(--fg);
  margin-left: 0.04em;
  vertical-align: -0.08em;
  animation: caretBlink 0.9s steps(2) infinite;
}
@keyframes caretBlink { 50% { opacity: 0; } }
.hero-title[lang="ja"], .hero-title[lang="zh"], .hero-title[lang="ko"] {
  font-family: "Noto Sans JP", "Noto Sans SC", "Noto Sans KR", Inter, sans-serif !important;
  letter-spacing: 0 !important;
}
.hero-title[lang="zh"] { font-family: "Noto Sans SC", "Noto Sans JP", Inter, sans-serif !important; }
.hero-title[lang="ko"] { font-family: "Noto Sans KR", "Noto Sans JP", Inter, sans-serif !important; }
.hero-title[lang="hi"] {
  font-family: "Noto Sans Devanagari", Inter, sans-serif !important;
  letter-spacing: -0.01em !important;
}
.hero-title[lang="ar"] {
  font-family: "Noto Naskh Arabic", Inter, serif !important;
  letter-spacing: 0 !important;
  direction: rtl;
}
.lang-badge {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: -8px;
  height: 16px;
}
.lang-badge .dot {
  width: 5px; height: 5px; background: var(--fg); border-radius: 50%;
  animation: blink 1.4s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0.25; } }
.hero-tagline {
  font-family: var(--serif);
  font-size: clamp(20px, 2.2vw, 26px);
  color: var(--fg-2);
  max-width: 540px;
  text-wrap: pretty;
  font-style: italic;
  line-height: 1.35;
}
.hero-nav {
  display: flex; gap: 6px; flex-wrap: wrap; justify-content: center;
  padding: 6px;
  background: var(--node-bg);
  border: 1px solid var(--node-line);
  border-radius: 999px;
  box-shadow: 0 1px 0 rgba(0,0,0,0.02), 0 12px 30px -18px rgba(20,18,14,0.18);
}
.hero-nav a {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--fg-2);
  padding: 7px 14px;
  border-radius: 999px;
  transition: background .15s ease, color .15s ease;
}
.hero-nav a:hover { text-decoration: none; background: var(--bg-2); color: var(--fg); }

/* ----- hero asset (background diagram + tool nodes) ----- */
.hero-asset {
  position: relative;
  width: 100%;
  max-width: 1400px;
  margin-top: 60px;
  aspect-ratio: 1400 / 720;
  flex: none;
}
.hero-asset .diagram-frame {
  position: absolute;
  inset: 0;
  -webkit-mask-image: linear-gradient(to bottom, #000 60%, transparent 100%);
          mask-image: linear-gradient(to bottom, #000 60%, transparent 100%);
}
.hero-asset svg.blueprint { width: 100%; height: 100%; display: block; }

/* ----- tool node ----- */
.tool-node {
  position: absolute;
  background: var(--node-bg);
  border: 1px solid var(--node-line);
  border-radius: 12px;
  padding: 10px 14px 10px 10px;
  display: flex; align-items: center; gap: 10px;
  font-family: var(--mono);
  font-size: 12.5px;
  white-space: nowrap;
  box-shadow:
    0 1px 0 rgba(0,0,0,0.02),
    0 4px 8px -2px rgba(20,18,14,0.05),
    0 18px 40px -22px rgba(20,18,14,0.30);
  animation: nodeIn .6s ease both;
}
@keyframes nodeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.tool-node .ico {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  display: grid; place-items: center;
  flex: none;
  color: var(--fg);
}
.tool-node .ico svg { width: 18px; height: 18px; }
.tool-node .title { color: var(--fg); }
.tool-node .desc { color: var(--muted); position: relative; padding-left: 10px; }
.tool-node .desc::before {
  content: "·"; position: absolute; left: 2px; color: var(--line);
}

/* shimmer */
.shimmer {
  display: inline-block;
  background: linear-gradient(
    90deg,
    var(--muted) 0%,
    var(--muted) 30%,
    var(--fg) 50%,
    var(--muted) 70%,
    var(--muted) 100%
  );
  background-size: 220% 100%;
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
  animation: shimmerSlide 2.4s linear infinite;
}
@keyframes shimmerSlide {
  from { background-position: 110% 0; }
  to { background-position: -110% 0; }
}

/* network vertex + edges (faint lines connecting nodes back to the diagram) */
.vertex {
  position: absolute;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--bg);
  border: 1.5px solid var(--fg);
  transform: translate(-50%, -50%);
  z-index: 2;
}
.edge {
  position: absolute;
  background: var(--line);
  z-index: 1;
}
.edge.h { height: 1px; }
.edge.v { width: 1px; }

/* signal pulse along edges */
.edge.pulse {
  background: linear-gradient(90deg, transparent 0%, var(--line) 30%, var(--line) 70%, transparent 100%);
}
.edge.h.pulse::after,
.edge.v.pulse::after {
  content: "";
  position: absolute;
  background: var(--fg);
  border-radius: 50%;
}
.edge.h.pulse::after {
  top: 50%; left: 0;
  width: 4px; height: 4px;
  transform: translate(-2px, -50%);
  animation: pulseH 3s linear infinite;
}
.edge.v.pulse::after {
  left: 50%; top: 0;
  width: 4px; height: 4px;
  transform: translate(-50%, -2px);
  animation: pulseV 3s linear infinite;
}
@keyframes pulseH {
  0% { left: 0%; opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { left: 100%; opacity: 0; }
}
@keyframes pulseV {
  0% { top: 0%; opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

/* ----- ticker (floating link strip) ----- */
.ticker {
  margin: 60px auto 0;
  max-width: 720px;
  display: flex; align-items: center; gap: 14px;
  padding: 10px 18px 10px 10px;
  background: var(--node-bg);
  border: 1px solid var(--node-line);
  border-radius: 999px;
  box-shadow: 0 16px 40px -24px rgba(20,18,14,0.18);
  font-family: var(--mono);
  font-size: 12.5px;
}
.ticker .thumb {
  width: 56px; height: 36px;
  border-radius: 6px;
  background: var(--bg-3);
  position: relative;
  flex: none;
  overflow: hidden;
}
.ticker .thumb::before {
  content: "";
  position: absolute; inset: 0;
  background:
    repeating-linear-gradient(45deg, transparent 0 6px, color-mix(in oklab, var(--fg) 6%, transparent) 6px 7px);
}
.ticker .thumb .play {
  position: absolute; inset: 0; display: grid; place-items: center; color: var(--fg);
}
.ticker .label { color: var(--fg-2); }
.ticker a.cta { display: inline-flex; align-items: center; gap: 6px; color: var(--fg); border-bottom: 1px solid var(--fg); padding-bottom: 1px; }
.ticker a.cta .arrow { transition: transform .2s ease; }
.ticker a.cta:hover { text-decoration: none; }
.ticker a.cta:hover .arrow { transform: translateX(3px); }

/* ----- sections ----- */
section.block {
  padding: var(--pad-block) var(--pad-inline);
  max-width: var(--max);
  margin: 0 auto;
}
.block-eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: lowercase;
  display: inline-flex; align-items: center; gap: 10px;
  margin-bottom: 28px;
}
.block-eyebrow::before {
  content: ""; width: 24px; height: 1px; background: var(--line);
}
.block-title {
  font-family: "Inter", sans-serif;
  font-size: clamp(36px, 5vw, 60px);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.02;
  max-width: 880px;
  text-wrap: balance;
}
.block-title em { font-style: italic; color: var(--fg-2); font-weight: 500; }
.block-lede {
  margin-top: 20px;
  font-size: 19px;
  color: var(--fg-2);
  max-width: 620px;
  font-family: var(--serif);
  text-wrap: pretty;
}

/* WORK rows */
.work-list {
  margin-top: 60px;
  border-top: 1px solid var(--line-2);
}
.work-row {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 24px;
  padding: 26px 0;
  border-bottom: 1px solid var(--line-2);
  align-items: baseline;
}
.work-row .when { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.work-row .what {
  font-family: var(--serif);
  font-size: 22px;
  letter-spacing: -0.01em;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.work-row .what .role {
  color: var(--muted);
  margin-left: 0;
  font-style: italic;
  font-size: 15px;
  font-family: var(--mono);
  letter-spacing: 0.01em;
}
.work-row .what .work-desc {
  margin-top: 6px;
  font-size: 17px;
  color: var(--fg-2);
  font-style: italic;
  font-family: var(--serif);
  max-width: 56ch;
  text-wrap: pretty;
}
.work-row .meta { font-family: var(--mono); font-size: 12px; color: var(--muted); }
@media (max-width: 720px) {
  .work-row { grid-template-columns: 1fr; gap: 4px; }
  .work-row .meta { order: 3; }
}

/* VERTICALS — horizontal scrollable row, always room for one more */
.verticals-scroll {
  margin-top: 40px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(240px, 280px);
  gap: 14px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 6px 2px 22px;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
  /* fade the right edge to hint at scrollability */
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 60px), transparent 100%);
          mask-image: linear-gradient(to right, #000 calc(100% - 60px), transparent 100%);
}
.verticals-scroll::-webkit-scrollbar { height: 8px; }
.verticals-scroll::-webkit-scrollbar-track { background: transparent; }
.verticals-scroll::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 4px;
}
.verticals-scroll > .vertical-card { scroll-snap-align: start; }

.vertical-card {
  border: 1px solid var(--line-2);
  border-radius: 14px;
  padding: 22px;
  background: var(--node-bg);
  display: flex; flex-direction: column; gap: 10px;
  min-height: 200px;
  position: relative;
  overflow: hidden;
}
.vertical-card .v-num {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.vertical-card .v-name {
  font-family: var(--serif);
  font-size: 26px;
  letter-spacing: -0.01em;
  font-style: italic;
}
.vertical-card .v-note {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  margin-top: auto;
}

/* diagram-with-nodes — a blueprint that hosts floating ToolNode cards
   inside a Work/Lab figure (same idiom the hero used to have). */
.diagram-with-nodes {
  position: relative;
  width: 100%;
}
.diagram-with-nodes > svg.blueprint {
  display: block;
  width: 100%;
  height: auto;
}
.diagram-with-nodes > .tool-node {
  /* on a dense diagram, slightly tighter cards read better */
  padding: 8px 12px 8px 8px;
  font-size: 11.5px;
}
.diagram-with-nodes > .tool-node .ico { width: 26px; height: 26px; }
.diagram-with-nodes > .tool-node .ico svg { width: 15px; height: 15px; }
@media (max-width: 720px) {
  /* on phones the diagram is small — keep only the two most useful cards. */
  .diagram-with-nodes > .tool-node:nth-of-type(n+3),
  .diagram-with-nodes > .vertex:nth-of-type(n+3),
  .diagram-with-nodes > .edge:nth-of-type(n+5) {
    display: none;
  }
  .diagram-with-nodes > .tool-node { font-size: 10.5px; padding: 6px 10px 6px 6px; }
}

/* LAB — featured diagram */
.lab-figure {
  margin-top: 56px;
  position: relative;
  border: 1px solid var(--line-2);
  border-radius: 16px;
  background: var(--bg-2);
  padding: 24px;
  overflow: hidden;
}
.lab-figure .legend {
  margin-top: 18px;
  display: flex; gap: 22px; flex-wrap: wrap;
  font-family: var(--mono); font-size: 12px; color: var(--fg-2);
}
.lab-figure .legend .swatch {
  display: inline-block; width: 14px; height: 14px; vertical-align: -2px; margin-right: 8px;
  border: 1px solid var(--fg); border-radius: 2px;
}
.lab-figure svg.blueprint { width: 100%; height: auto; display: block; }

/* WRITING (organic + slop) */
.writing-grid {
  margin-top: 56px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 56px;
}
@media (max-width: 820px) { .writing-grid { grid-template-columns: 1fr; gap: 32px; } }
.writing-col h3 {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.04em;
  margin-bottom: 16px;
  display: flex; align-items: center; gap: 10px;
}
.writing-col h3 .tag {
  background: var(--bg-2);
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid var(--line-2);
  color: var(--fg-2);
}
.post {
  display: grid;
  grid-template-columns: 80px 1fr;
  padding: 16px 0;
  border-bottom: 1px solid var(--line-2);
  gap: 18px;
  align-items: baseline;
}
.post:first-of-type { border-top: 1px solid var(--line-2); }
.post .date { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.post .title { font-family: var(--serif); font-size: 19px; letter-spacing: -0.01em; }
.post .title em { font-style: italic; color: var(--fg-2); }

/* empty / placeholder note — used by Organic & Slop until they ship */
.empty-note {
  margin-top: 56px;
  padding: 28px 26px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: color-mix(in oklab, var(--bg-2) 70%, transparent);
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.empty-note .empty-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent, var(--fg));
  opacity: 0.7;
  animation: blink 1.6s steps(2) infinite;
}
.empty-note .empty-text { font-style: italic; }
.empty-note .empty-text::before { content: "// "; opacity: 0.5; }

/* footer */
footer.foot {
  border-top: 1px solid var(--line-2);
  padding: 32px var(--pad-inline) 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}
footer.foot .foot-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

/* footer-disclaimer — the quieter sibling of the hero phrase */
.foot-disclaimer {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: 0.02em;
  opacity: 0.75;
  min-height: 1.4em;          /* hold one line so layout doesn't twitch */
  max-width: 100%;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.foot-disclaimer .d-caret {
  display: inline-block;
  width: 0.06em;
  height: 0.95em;
  background: currentColor;
  margin-left: 0.15em;
  vertical-align: -0.12em;
  animation: caretBlink 0.9s steps(2) infinite;
  opacity: 0.7;
}
.foot-disclaimer[lang="ja"],
.foot-disclaimer[lang="zh"],
.foot-disclaimer[lang="ko"] {
  font-family: "Noto Sans JP", "Noto Sans SC", "Noto Sans KR", var(--mono) !important;
  letter-spacing: 0 !important;
}
.foot-disclaimer[lang="zh"] { font-family: "Noto Sans SC", "Noto Sans JP", var(--mono) !important; }
.foot-disclaimer[lang="ko"] { font-family: "Noto Sans KR", "Noto Sans JP", var(--mono) !important; }
.foot-disclaimer[lang="hi"] { font-family: "Noto Sans Devanagari", var(--mono) !important; }
.foot-disclaimer[lang="ar"] {
  font-family: "Noto Naskh Arabic", var(--mono) !important;
  direction: rtl;
  text-align: right;
}
@media (max-width: 600px) {
  .foot-disclaimer { white-space: normal; }
}

/* ============= universe diagram ============= */
.universe-wrap {
  width: 100%;
  max-width: 1400px;
  margin: 40px auto 20px;
}
.universe-svg {
  width: 100%;
  height: auto;
  display: block;
  /* fade the edges so the explosion bleeds into the page */
  -webkit-mask-image: radial-gradient(ellipse at center, #000 60%, transparent 92%);
          mask-image: radial-gradient(ellipse at center, #000 60%, transparent 92%);
}
.u-edge {
  fill: none;
  stroke: var(--fg);
  stroke-width: 0.5;
  vector-effect: non-scaling-stroke;
  opacity: 0.32;
}
.u-blink { animation: uBlink 3.4s steps(2) infinite; }
@keyframes uBlink { 50% { opacity: 0.15; } }
.u-ray {
  stroke-dasharray: 5 9;
  animation: uRay 4.5s linear infinite;
  opacity: 0.7;
}
@keyframes uRay { to { stroke-dashoffset: -28; } }

@media (prefers-reduced-motion: reduce) {
  .u-blink, .u-ray, .universe-svg animate { animation: none !important; }
}
.bp-stroke { fill: none; stroke: var(--fg); stroke-width: 1; vector-effect: non-scaling-stroke; }
.bp-stroke-thick { fill: none; stroke: var(--fg); stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.bp-stroke-thin { fill: none; stroke: var(--fg); stroke-width: 0.6; vector-effect: non-scaling-stroke; opacity: 0.55; }
.bp-fill { fill: var(--fg); }
.bp-fill-muted { fill: var(--bg-3); stroke: var(--fg); stroke-width: 1; vector-effect: non-scaling-stroke; }
.bp-dash { stroke-dasharray: 4 4; }
.bp-dash-fine { stroke-dasharray: 2 3; }
.bp-label { font-family: var(--mono); font-size: 11px; fill: var(--fg); letter-spacing: 0.02em; }
.bp-label-sm { font-family: var(--mono); font-size: 9px; fill: var(--muted); letter-spacing: 0.04em; }
.bp-grid line { stroke: var(--line); stroke-width: 0.4; vector-effect: non-scaling-stroke; opacity: 0.4; }

/* fill mode tweak */
[data-fill="filled"] .bp-fill-muted { fill: color-mix(in oklab, var(--fg) 7%, var(--bg)); }
[data-fill="line"] .bp-fill-muted { fill: transparent; }

/* visibility toggles driven by html data-attrs */
html[data-show-grid="false"] .bp-grid { display: none; }
html[data-show-signals="false"] .bp-signal {
  stroke-dasharray: 4 4;
  animation: none !important;
}
html[data-show-signals="false"] .bp-pulse { display: none; }
html[data-show-vertices="false"] .vertex,
html[data-show-vertices="false"] .edge { display: none; }

/* accent — used for the brand dot, ticker arrow, lang-badge dot */
.topnav .brand-dot { background: var(--accent, var(--fg)); }
.lang-badge .dot { background: var(--accent, var(--fg)); }
.ticker .play { color: var(--accent, var(--fg)); }
.hero-title.rotating .caret { background: var(--accent, var(--fg)); }

/* animated network signals along dashed lines */
.bp-signal {
  stroke-dasharray: 4 4;
  stroke-dashoffset: 0;
  animation: dashFlow 1.4s linear infinite;
}
@keyframes dashFlow { to { stroke-dashoffset: -16; } }

/* radio/sonar pulse */
.bp-pulse {
  transform-origin: center;
  animation: sonarPulse 2.6s ease-out infinite;
}
@keyframes sonarPulse {
  0%   { r: 2; opacity: 0.9; }
  100% { r: 28; opacity: 0; }
}

/* arrows */
.bp-arrow-head { fill: var(--fg); }

/* visually hidden */
.vh { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }

/* ==========================================================
   MOBILE — everything below lives inside max-width media
   queries so desktop is completely unaffected. Touch only
   what's broken on phones.
   ========================================================== */

@media (max-width: 720px) {
  /* tighter rhythm — each section was eating a full phone screen of padding */
  :root {
    --pad-block: 64px;
    --pad-inline: 20px;
    --gap: 16px;
  }
  [data-density="compact"] { --pad-block: 48px; --gap: 12px; }
  [data-density="roomy"]   { --pad-block: 88px; --gap: 24px; }

  /* ----- top nav ----- hidden on phones. The hero's own pill nav
     already exposes every section anchor and the brand is just visual
     noise once you're scrolling. Reclaiming the fixed-bar height also
     lets the hero start near the top of the viewport. */
  .topnav { display: none; }

  /* ----- hero ----- the hardcoded 78px from tweak defaults is the
     single biggest mobile bug — it forces 5-letter lines and a 200px
     vertical gap. Override with !important to beat the inline style. */
  .hero {
    padding: 32px 20px 48px;
    min-height: auto;
  }
  .hero-header { gap: 18px; }
  .hero-title.rotating {
    font-size: clamp(28px, 8vw, 42px) !important;
    max-width: 96vw;
    min-height: 3.4em;     /* reserve 3-4 lines for the longest phrases */
    word-break: break-word;
  }
  .hero-tagline { font-size: 16px; }
  .hero-handle { font-size: 12px; gap: 8px; }
  .hero-handle::before, .hero-handle::after { width: 22px; }

  /* hero-nav pill — tighten so all 5 chips fit on one row */
  .hero-nav { padding: 4px; gap: 2px; }
  .hero-nav a { font-size: 11.5px; padding: 6px 9px; }

  /* hero asset — universe diagram is fine, just less top gap */
  .hero-asset { margin-top: 28px; }
  .universe-wrap { margin: 20px auto 10px; }

  /* ----- sections ----- block titles already clamp(36px..); the
     eyebrow and lede get tightened. */
  .block-eyebrow { margin-bottom: 18px; }
  .block-lede { margin-top: 14px; font-size: 17px; }

  /* ----- work + lab figures ----- the absolute-positioned tool
     nodes overflow the figure (.diagram-with-nodes places them at
     left:44%/right:4% with nowrap text — at 320-375px they bleed
     into the next column). On a phone the diagram alone tells the
     story; the legend caption already names what's connected. */
  .lab-figure {
    padding: 12px;
    border-radius: 12px;
    margin-top: 32px !important;
  }
  .lab-figure .legend {
    margin-top: 12px;
    gap: 10px 14px;
    font-size: 11px;
  }
  .diagram-with-nodes > .tool-node,
  .diagram-with-nodes > .vertex,
  .diagram-with-nodes > .edge {
    display: none !important;
  }

  /* ----- work rows ----- desktop already collapses to one column;
     just tune typography for legibility. */
  .work-list { margin-top: 36px; }
  .work-row { padding: 20px 0; gap: 6px; }
  .work-row .what { font-size: 20px; }
  .work-row .what .role { font-size: 13px; }
  .work-row .what .work-desc { font-size: 16px; margin-top: 4px; }

  /* ----- verticals scroller ----- desktop card minmax(240, 280)
     is too wide for phones — one card eats the viewport and the
     peek hint disappears. Use viewport-relative width so the next
     card always shows. */
  .verticals-scroll {
    margin-top: 28px;
    grid-auto-columns: 76vw;
    gap: 10px;
    padding: 4px 2px 16px;
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent 100%);
            mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent 100%);
  }
  .vertical-card { padding: 18px; min-height: 156px; }
  .vertical-card .v-name { font-size: 22px; }

  /* ----- writing grids ----- already stacks at 820; just tighten */
  .writing-grid { margin-top: 32px; gap: 24px; }
  .post { grid-template-columns: 64px 1fr; gap: 12px; padding: 14px 0; }
  .post .title { font-size: 17px; }
  .empty-note { margin-top: 32px; padding: 20px 18px; font-size: 12px; }

  /* ----- footer ----- stack the row vertically; flex-wrap was
     producing awkward orphan items. */
  footer.foot { padding: 24px 20px 20px; gap: 14px; }
  footer.foot .foot-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

/* very small phones (≤340px — iPhone SE 1st-gen and below).
   Pull the hero pill and rotating title down one more notch. */
@media (max-width: 340px) {
  .hero-nav a { font-size: 11px; padding: 5px 8px; }
  .hero-title.rotating { font-size: clamp(26px, 9vw, 36px) !important; }
}
