/* ==========================================================================
   Omar Badr — systems plot sheet
   One technical sheet: cool drafting paper, graphite ink, one plotter-red mark.
   Mono is reserved for code and numeric readouts; labels use the display face.
   ========================================================================== */

:root {
  color-scheme: light;

  --paper: #ECEEE8;
  --paper-raised: #F4F5F1;
  --ink: #1A1D1A;
  --ink-2: #4E5852;
  --ink-3: #5B665F;
  --rule: #C9CEC5;
  --grid: #D9DED5;
  --grid-strong: #C3CAC0;
  --signal: #A33B26;
  --signal-soft: #EADBD2;
  --code-bg: #1A1D1A;
  --code-fg: #E9EBE4;

  --font-display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1.125rem;
  --space-5: 1.75rem;
  --space-6: 2.75rem;
  --space-7: 4.5rem;

  --frame: min(1420px, calc(100vw - clamp(2rem, 6vw, 7rem)));
  --motion: 150ms ease-out;
}

[data-theme="dark"] {
  color-scheme: dark;

  --paper: #1C211D;
  --paper-raised: #232924;
  --ink: #E9EBE4;
  --ink-2: #B4BDB6;
  --ink-3: #98A39B;
  --rule: #414A43;
  --grid: #272E29;
  --grid-strong: #343C36;
  --signal: #E87158;
  --signal-soft: #3A241E;
  --code-bg: #0E100F;
  --code-fg: #E9EBE4;
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::selection,
body *::selection {
  background: var(--signal-soft);
  color: var(--ink);
}

h1, h2, h3, h4, p, figure, blockquote, dl, dd {
  margin: 0;
}

ul, ol {
  margin: 0;
  padding: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 0.06em;
  text-underline-offset: 0.16em;
  text-decoration-color: var(--rule);
  transition: color var(--motion), text-decoration-color var(--motion);
}

a:hover {
  color: var(--signal);
  text-decoration-color: currentColor;
}

:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 3px;
}

img,
svg {
  max-width: 100%;
}

code,
kbd,
pre {
  font-family: var(--font-mono);
}

kbd {
  display: inline-block;
  min-width: 1.45em;
  padding: 0.08em 0.3em;
  border: 1px solid var(--rule);
  background: var(--paper-raised);
  font-size: 0.68rem;
  line-height: 1.3;
  text-align: center;
  color: var(--ink-2);
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 100;
  padding: 10px 14px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-display);
  font-size: 0.8rem;
  text-decoration: none;
  transform: translateY(-180%);
  transition: transform var(--motion);
}

.skip-link:focus-visible {
  transform: translateY(0);
  color: var(--paper);
  outline-color: var(--signal);
}

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

.site-header {
  width: var(--frame);
  margin: 0 auto;
  padding: clamp(1.1rem, 2.4vw, 1.8rem) 0 1.1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  border-bottom: 1px solid var(--rule);
}

.identity {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.mark {
  display: block;
  width: 34px;
  height: 34px;
  flex: none;
  color: var(--ink);
  text-decoration: none;
  transition: color var(--motion);
}

.mark:hover {
  color: var(--signal);
}

.mark svg {
  display: block;
  width: 100%;
  height: 100%;
}

.identity-text {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
}

.site-name {
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 1.3vw, 1.25rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.05;
}

.site-role {
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-style: italic;
  line-height: 1.2;
  color: var(--ink-3);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: clamp(0.85rem, 2vw, 1.5rem);
}

.header-link {
  font-family: var(--font-display);
  font-size: 0.76rem;
  font-weight: 500;
  letter-spacing: 0.015em;
  text-decoration: none;
  color: var(--ink-2);
  border-bottom: 1px solid transparent;
  padding-bottom: 1px;
}

.header-link:hover {
  color: var(--signal);
  border-bottom-color: currentColor;
}

.theme-toggle {
  width: 36px;
  height: 36px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--ink);
  transition: border-color var(--motion), background-color var(--motion), color var(--motion);
}

.theme-toggle:hover {
  border-color: var(--ink);
  background: var(--paper-raised);
  color: var(--signal);
}

.theme-toggle:active {
  background: var(--paper);
}

.theme-toggle .icon-sun {
  display: none;
}

[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}

.no-js .theme-toggle,
.no-js .canvas-figure,
.no-js .key-hint,
.no-js .reading-key {
  display: none;
}

/* --------------------------------------------------------------------------
   Sheet layout
   -------------------------------------------------------------------------- */

.sheet {
  width: var(--frame);
  margin: 0 auto;
  padding: clamp(2rem, 4.5vw, 4rem) 0 clamp(2.4rem, 4.5vw, 4rem);
  display: grid;
  grid-template-columns: minmax(235px, 300px) minmax(0, 1fr);
  gap: clamp(2rem, 4.5vw, 4.25rem);
  align-items: start;
}

.intro {
  min-width: 0;
}

.lede {
  max-width: 22ch;
  font-family: var(--font-body);
  font-size: clamp(1.35rem, 1.85vw, 1.6rem);
  font-weight: 400;
  line-height: 1.32;
  letter-spacing: -0.012em;
  text-wrap: pretty;
}

.facts {
  margin-top: clamp(1.6rem, 3vw, 2.4rem);
  padding-top: 0.9rem;
  border-top: 1px solid var(--rule);
  font-family: var(--font-display);
  font-size: 0.76rem;
  line-height: 1.5;
  color: var(--ink-2);
  max-width: 32ch;
}

.reading-key {
  margin-top: 1.25rem;
  max-width: 33ch;
  font-family: var(--font-display);
  font-size: 0.76rem;
  line-height: 1.55;
  color: var(--ink-2);
}

.key-hint {
  margin-top: 1.5rem;
  font-family: var(--font-display);
  font-size: 0.7rem;
  line-height: 1.7;
  color: var(--ink-3);
}

.key-hint kbd {
  margin: 0 0.05em;
}

.work {
  min-width: 0;
  border-left: 1px solid var(--rule);
  padding-left: clamp(1.5rem, 3.4vw, 3.25rem);
}

/* --------------------------------------------------------------------------
   Canvas figure
   -------------------------------------------------------------------------- */

.canvas-figure {
  margin: 0;
}

.canvas {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  touch-action: manipulation;
}

.canvas-caption {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem 2rem;
}

.canvas-status {
  min-height: 2.8em;
  max-width: 58ch;
  font-family: var(--font-display);
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--ink-2);
}

.canvas-note {
  max-width: 35ch;
  font-family: var(--font-body);
  font-size: 0.78rem;
  line-height: 1.45;
  font-style: italic;
  color: var(--ink-3);
  text-align: right;
}

.canvas.has-active .plot-node:not(.is-active) {
  opacity: 0.34;
}

.canvas.has-active .edge-group:not(.is-conn) {
  opacity: 0.18;
}

.canvas.has-active .thread-annotation:not(.is-conn) {
  opacity: 0.28;
}

.canvas.has-active .edge-group.is-active {
  opacity: 1;
}

.mark-signal {
  fill: var(--signal);
}

/* --------------------------------------------------------------------------
   Plot: grid, axes, links, nodes
   -------------------------------------------------------------------------- */

.canvas #plot-grid {
  pointer-events: none;
}

.canvas .grid-line {
  stroke: var(--grid);
  stroke-width: 1;
  shape-rendering: crispEdges;
}

.canvas .grid-line.is-year {
  stroke: var(--grid-strong);
}

.canvas .lane-line {
  stroke: var(--grid-strong);
  stroke-width: 1;
  shape-rendering: crispEdges;
}

.canvas .axis-line {
  stroke: var(--ink-2);
  stroke-width: 1;
  shape-rendering: crispEdges;
}

.canvas .axis-tick {
  stroke: var(--ink-3);
  stroke-width: 1;
  shape-rendering: crispEdges;
}

.canvas .axis-label {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  fill: var(--ink-3);
}

.canvas .year-label {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  fill: var(--ink-2);
}

.canvas .lane-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  fill: var(--ink);
}

.canvas .lane-desc {
  font-family: var(--font-body);
  font-size: 12px;
  font-style: italic;
  fill: var(--ink-3);
}

.canvas .lane-tick {
  stroke: var(--rule);
  stroke-width: 1;
  shape-rendering: crispEdges;
}

.canvas .edge-group,
.canvas .plot-node,
.canvas .thread-annotation {
  transition: opacity 160ms ease-out;
}

.canvas .edge {
  fill: none;
  stroke: var(--ink-3);
  stroke-width: 1.25;
  opacity: 0.72;
  pointer-events: none;
  transition: stroke 140ms ease-out, stroke-width 140ms ease-out, opacity 140ms ease-out;
}

.canvas .edge-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 16;
  pointer-events: stroke;
  cursor: default;
}

.canvas .edge-label {
  font-family: var(--font-body);
  font-size: 12px;
  font-style: italic;
  fill: var(--ink-2);
  paint-order: stroke fill;
  stroke: var(--paper);
  stroke-width: 4px;
  stroke-linejoin: round;
  pointer-events: none;
  transition: fill 140ms ease-out;
}

.canvas .edge-group.is-active .edge,
.canvas .edge-group.is-conn .edge {
  stroke: var(--signal);
  stroke-width: 1.8;
  opacity: 1;
}

.canvas .edge-group.is-active .edge-label,
.canvas .edge-group.is-conn .edge-label {
  fill: var(--signal);
}

.canvas .thread-line {
  fill: none;
  stroke: var(--ink-3);
  stroke-width: 1;
  stroke-dasharray: 3 4;
  opacity: 0.75;
}

.canvas .thread-tick {
  stroke: var(--ink-3);
  stroke-width: 1;
  shape-rendering: crispEdges;
}

.canvas .thread-label {
  font-family: var(--font-body);
  font-size: 11.5px;
  font-style: italic;
  fill: var(--ink-3);
  paint-order: stroke fill;
  stroke: var(--paper);
  stroke-width: 4px;
  stroke-linejoin: round;
}

.canvas .plot-node {
  cursor: pointer;
  text-decoration: none;
  outline: none;
  animation: node-in 280ms ease-out both;
}

.canvas .node-hit {
  fill: transparent;
  pointer-events: all;
}

.canvas .node-halo {
  fill: none;
  stroke: transparent;
  stroke-width: 1;
  transition: stroke 140ms ease-out;
}

.canvas .node-ring {
  fill: var(--paper);
  stroke: var(--ink);
  stroke-width: 1.4;
  transition: stroke 140ms ease-out, stroke-width 140ms ease-out;
}

.canvas .node-core {
  fill: var(--ink);
  transition: fill 140ms ease-out;
}

.canvas .node-leader {
  fill: none;
  stroke: var(--ink-3);
  stroke-width: 0.8;
  opacity: 0.55;
  pointer-events: none;
  transition: stroke 140ms ease-out, opacity 140ms ease-out;
}

.canvas .node-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.008em;
  fill: var(--ink);
  paint-order: stroke fill;
  stroke: var(--paper);
  stroke-width: 3px;
  stroke-linejoin: round;
  transition: fill 140ms ease-out;
}

/* avoid-ai-design-ignore: SD4m — the node metric is a numeric readout, not decorative chrome. */
.canvas .node-metric {
  font-family: var(--font-mono);
  font-size: 11px;
  fill: var(--ink-3);
  paint-order: stroke fill;
  stroke: var(--paper);
  stroke-width: 3px;
  stroke-linejoin: round;
  transition: fill 140ms ease-out;
}

.canvas .node-date {
  font-family: var(--font-display);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  fill: var(--ink-3);
  paint-order: stroke fill;
  stroke: var(--paper);
  stroke-width: 3px;
  stroke-linejoin: round;
  transition: fill 140ms ease-out;
}

.canvas .plot-node:hover .node-ring,
.canvas .plot-node:focus-visible .node-ring,
.canvas .plot-node.is-active .node-ring {
  stroke: var(--signal);
  stroke-width: 2.4;
}

.canvas .plot-node:hover .node-core,
.canvas .plot-node:focus-visible .node-core,
.canvas .plot-node.is-active .node-core {
  fill: var(--signal);
}

.canvas .plot-node:hover .node-title,
.canvas .plot-node:focus-visible .node-title,
.canvas .plot-node.is-active .node-title {
  fill: var(--signal);
}

.canvas .plot-node:hover .node-metric,
.canvas .plot-node:focus-visible .node-metric,
.canvas .plot-node.is-active .node-metric,
.canvas .plot-node:hover .node-date,
.canvas .plot-node:focus-visible .node-date,
.canvas .plot-node.is-active .node-date {
  fill: var(--ink-2);
}

.canvas .plot-node:focus-visible .node-halo {
  stroke: var(--signal);
  stroke-width: 1.2;
  stroke-dasharray: 2 3;
}

@keyframes node-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* --------------------------------------------------------------------------
   Mobile / no-JS project index
   -------------------------------------------------------------------------- */

.project-index {
  display: none;
}

.index-summary {
  margin-bottom: 0.9rem;
  font-family: var(--font-display);
  font-size: 0.76rem;
  color: var(--ink-3);
}

.index-list {
  list-style: none;
  border-top: 1px solid var(--ink);
}

.index-project {
  border-bottom: 1px solid var(--rule);
}

.index-open {
  display: grid;
  grid-template-columns: 5.2rem minmax(0, 1fr);
  gap: 0 1.25rem;
  padding: 1.2rem 0 1.35rem;
  color: inherit;
  text-decoration: none;
}

.index-open:hover,
.index-open:focus-visible {
  color: inherit;
}

.index-meta {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding-top: 0.22rem;
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  line-height: 1.4;
  color: var(--ink-3);
}

.index-domain {
  font-family: var(--font-display);
  font-size: 0.7rem;
  color: var(--ink-2);
}

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

.index-title {
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 4.6vw, 1.6rem);
  font-weight: 600;
  letter-spacing: -0.018em;
  line-height: 1.12;
  transition: color var(--motion);
}

.index-open:hover .index-title,
.index-open:focus-visible .index-title {
  color: var(--signal);
}

.index-desc {
  margin-top: 0.45rem;
  max-width: 55ch;
  font-family: var(--font-body);
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--ink-2);
}

.index-tech {
  margin-top: 0.65rem;
  font-family: var(--font-display);
  font-size: 0.7rem;
  line-height: 1.5;
  color: var(--ink-3);
}

.index-rel {
  margin-top: 0.35rem;
  max-width: 55ch;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-style: italic;
  line-height: 1.45;
  color: var(--ink-2);
}

.index-cta {
  align-self: flex-start;
  margin-top: 0.8rem;
  padding-bottom: 0.08rem;
  border-bottom: 1px solid var(--rule);
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--ink-2);
  transition: color var(--motion), border-color var(--motion);
}

.index-open:hover .index-cta,
.index-open:focus-visible .index-cta {
  color: var(--signal);
  border-bottom-color: currentColor;
}

/* --------------------------------------------------------------------------
   About / general notes
   -------------------------------------------------------------------------- */

.about {
  width: var(--frame);
  margin: 0 auto;
  padding: clamp(2rem, 3.8vw, 3.4rem) 0 clamp(2.6rem, 4vw, 3.8rem);
  border-top: 1px solid var(--rule);
  display: grid;
  grid-template-columns: minmax(235px, 300px) minmax(0, 1fr);
  gap: clamp(2rem, 4.5vw, 4.25rem);
  align-items: start;
}

.about-head {
  min-width: 0;
}

.about-kicker {
  margin-bottom: 0.35rem;
  font-family: var(--font-display);
  font-size: 0.7rem;
  line-height: 1.4;
  color: var(--ink-3);
}

.about-title {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 2vw, 1.7rem);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.022em;
}

.about-sub {
  margin-top: 0.7rem;
  max-width: 26ch;
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-style: italic;
  line-height: 1.5;
  color: var(--ink-3);
  text-wrap: pretty;
}

.about-body {
  min-width: 0;
  border-left: 1px solid var(--rule);
  padding-left: clamp(1.5rem, 3.4vw, 3.25rem);
}

.about-lede {
  max-width: 58ch;
  font-family: var(--font-body);
  font-size: clamp(1.2rem, 1.7vw, 1.4rem);
  line-height: 1.45;
  letter-spacing: -0.008em;
  text-wrap: pretty;
}

.about-detail {
  margin-top: clamp(1.5rem, 2.4vw, 2rem);
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(210px, 0.7fr);
  gap: clamp(1.5rem, 3.5vw, 3.25rem);
  align-items: start;
}

.about-copy p {
  max-width: 58ch;
  font-family: var(--font-body);
  font-size: 0.94rem;
  line-height: 1.65;
  color: var(--ink-2);
  text-wrap: pretty;
}

.about-copy p + p {
  margin-top: 0.85rem;
}

.about-contact h3 {
  margin-bottom: 0.35rem;
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--ink-3);
}

.contact-list {
  list-style: none;
  border-top: 1px solid var(--rule);
}

.contact-list li {
  border-bottom: 1px solid var(--rule);
}

.contact-list a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.85rem;
  padding: 0.55rem 0 0.5rem;
  font-family: var(--font-display);
  font-size: 0.74rem;
  line-height: 1.4;
  text-decoration: none;
  transition: color var(--motion);
}

.contact-network {
  flex: none;
  font-weight: 500;
  color: var(--ink);
}

.contact-handle {
  min-width: 0;
  overflow-wrap: anywhere;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-style: italic;
  text-align: right;
  color: var(--ink-3);
}

.contact-list a:hover,
.contact-list a:focus-visible {
  color: var(--signal);
}

.contact-list a:hover .contact-network,
.contact-list a:focus-visible .contact-network,
.contact-list a:hover .contact-handle,
.contact-list a:focus-visible .contact-handle {
  color: var(--signal);
}

.contact-list a:hover .contact-handle,
.contact-list a:focus-visible .contact-handle {
  text-decoration: underline;
  text-underline-offset: 0.16em;
}

/* --------------------------------------------------------------------------
   Footer / drawing title block
   -------------------------------------------------------------------------- */

.site-footer {
  width: var(--frame);
  margin: 0 auto;
  padding: 1.2rem 0 2rem;
  border-top: 1px solid var(--ink);
  display: grid;
  grid-template-columns: minmax(150px, 0.8fr) minmax(0, 3.4fr);
  gap: 1.5rem 2.5rem;
  align-items: start;
}

.footer-identity {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.footer-name {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.footer-name::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-right: 0.45rem;
  background: var(--signal);
  vertical-align: 0.18em;
}

.footer-role {
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-style: italic;
  color: var(--ink-3);
}

.title-block {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.9rem 1.5rem;
}

.field dt {
  margin-bottom: 0.15rem;
  font-family: var(--font-display);
  font-size: 0.64rem;
  font-weight: 500;
  line-height: 1.3;
  color: var(--ink-3);
}

.field dd {
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  line-height: 1.5;
  color: var(--ink-2);
}

.field code {
  font-family: inherit;
  font-size: inherit;
}

.field-links {
  display: flex;
  flex-wrap: wrap;
  column-gap: 0.35rem;
  row-gap: 0.1rem;
}

.field-links span {
  color: var(--ink-3);
}

.field-links a {
  text-decoration-color: var(--rule);
}

.field-links svg {
  width: 18px;
  height: 18px;
  vertical-align: middle;
  stroke: currentColor;
}

/* --------------------------------------------------------------------------
   No-JS fallback
   -------------------------------------------------------------------------- */

.nojs {
  padding-top: 1.4rem;
  border-top: 1px solid var(--ink);
}

.nojs h2 {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.nojs-intro {
  margin-top: 0.45rem;
  max-width: 55ch;
  font-family: var(--font-body);
  font-size: 0.92rem;
  color: var(--ink-2);
}

.nojs-list {
  list-style: none;
  margin-top: 1.8rem;
  border-top: 1px solid var(--rule);
}

.nojs-project {
  padding: 1.4rem 0;
  border-bottom: 1px solid var(--rule);
}

.nojs-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.8rem;
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  color: var(--ink-3);
}

.nojs-meta span::before {
  content: "/";
  margin-right: 0.8rem;
  color: var(--rule);
}

.nojs-project h3 {
  margin-top: 0.25rem;
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.nojs-slug code {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--ink-3);
}

.nojs-project p {
  margin-top: 0.55rem;
  max-width: 62ch;
  font-family: var(--font-body);
  font-size: 0.94rem;
  color: var(--ink-2);
}

.nojs-rel {
  font-style: italic;
  color: var(--ink-2);
}

.nojs-tech {
  font-size: 0.8rem !important;
  color: var(--ink-3) !important;
}

.nojs-project details {
  margin-top: 0.8rem;
}

.nojs-project summary {
  font-family: var(--font-display);
  font-size: 0.76rem;
  color: var(--ink);
  cursor: pointer;
}

.nojs-project h4 {
  margin-top: 1.2rem;
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 600;
}

.nojs-project ul {
  margin-top: 0.4rem;
  padding-left: 1.1em;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--ink-2);
}

.nojs-project li {
  margin: 0.3rem 0;
}

.nojs-repo a,
.nojs-private {
  font-family: var(--font-display);
  font-size: 0.72rem;
}

.nojs-private {
  color: var(--ink-3);
}

.load-error {
  margin-top: 2rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--signal);
  font-family: var(--font-display);
  font-size: 0.82rem;
  line-height: 1.5;
}

.load-failed .canvas-figure,
.load-failed .project-index {
  display: none !important;
}

/* --------------------------------------------------------------------------
   Case-study sheet
   -------------------------------------------------------------------------- */

html.panel-open,
html.panel-open body {
  overflow: hidden;
}

.case-study {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(680px, 100vw);
  max-width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--ink);
  background: var(--paper-raised);
  color: var(--ink);
  overflow: hidden;
}

.case-study::backdrop {
  background: rgb(12 15 12 / 0.48);
}

.case-study[open] {
  animation: panel-in 220ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.case-study[open]::backdrop {
  animation: backdrop-in 220ms ease-out;
}

@keyframes panel-in {
  from { transform: translateX(30px); opacity: 0.65; }
  to { transform: none; opacity: 1; }
}

@keyframes backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.case-sheet {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.case-header {
  position: sticky;
  top: 0;
  z-index: 2;
  flex: none;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 1.4rem clamp(1.2rem, 4vw, 2.4rem) 1.1rem;
  background: var(--paper-raised);
  border-bottom: 1px solid var(--rule);
}

.case-heading {
  min-width: 0;
}

.case-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 0.55rem;
  margin-bottom: 0.35rem;
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  line-height: 1.4;
  color: var(--ink-3);
}

.case-meta span::before {
  content: "/";
  margin-right: 0.55rem;
  color: var(--rule);
}

.case-title {
  max-width: 20ch;
  font-family: var(--font-display);
  font-size: clamp(1.55rem, 3.4vw, 2.15rem);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.case-close {
  flex: none;
  width: 38px;
  height: 38px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--ink);
  transition: border-color var(--motion), color var(--motion), background-color var(--motion);
}

.case-close:hover {
  border-color: var(--ink);
  color: var(--signal);
  background: var(--paper);
}

.case-close:active {
  background: var(--signal-soft);
}

.case-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1.55rem clamp(1.2rem, 4vw, 2.4rem) 3.2rem;
  scrollbar-gutter: stable;
}

.case-lede {
  max-width: 58ch;
  font-family: var(--font-body);
  font-size: 1.08rem;
  line-height: 1.6;
  color: var(--ink);
  text-wrap: pretty;
}

.case-section {
  margin-top: 1.9rem;
  max-width: 62ch;
}

.case-section h3 {
  margin-bottom: 0.5rem;
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 600;
  letter-spacing: -0.008em;
  color: var(--ink);
}

.case-section p {
  margin-bottom: 0.7rem;
  font-family: var(--font-body);
  font-size: 0.97rem;
  line-height: 1.65;
  color: var(--ink-2);
}

.case-section ul {
  padding-left: 1.05em;
  font-family: var(--font-body);
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--ink-2);
}

.case-section li {
  margin: 0.3rem 0;
  padding-left: 0.15rem;
}

.case-section li::marker {
  color: var(--signal);
}

.case-related {
  display: grid;
  gap: 0.35rem;
  list-style: none;
  padding: 0 !important;
}

.case-related li {
  padding: 0;
  font-size: 0.92rem;
}

.case-related strong {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink);
}

.case-repo {
  margin-top: 2.3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.4rem 1rem;
}

.case-repo-label {
  font-family: var(--font-display);
  font-size: 0.7rem;
  color: var(--ink-3);
}

.case-repo a,
.case-private {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  word-break: break-all;
}

.case-private {
  color: var(--ink-3);
}

/* --------------------------------------------------------------------------
   README
   -------------------------------------------------------------------------- */

.readme-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  margin-bottom: 0.45rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--rule);
}

.readme-file {
  font-family: var(--font-display);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  color: var(--ink-3);
}

.readme-source {
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 500;
}

.readme-status {
  padding: 0.55rem 0.1rem;
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-style: italic;
  color: var(--ink-3);
}

.readme-status a {
  font-style: normal;
}

.readme-content {
  font-family: var(--font-body);
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--ink-2);
  overflow-wrap: break-word;
}

.readme-content > :first-child {
  margin-top: 0;
}

.readme-heading {
  font-family: var(--font-display);
  color: var(--ink);
  text-wrap: balance;
}

.case-readme .readme-h3 {
  margin: 0.5rem 0 0.85rem;
  font-size: 1.28rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.018em;
}

.case-readme .readme-h4 {
  margin: 1.6rem 0 0.45rem;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.008em;
}

.case-readme .readme-h5 {
  margin: 1.3rem 0 0.35rem;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.4;
}

.case-readme .readme-h6 {
  margin: 1.15rem 0 0.3rem;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.4;
}

.readme-content p,
.readme-content li {
  font-size: 0.95rem;
  line-height: 1.65;
}

.readme-content p,
.readme-content ul,
.readme-content ol,
.readme-content blockquote,
.readme-content dl,
.readme-content figure,
.readme-content .readme-table,
.readme-content pre {
  margin: 0 0 0.9rem;
}

.readme-content ul,
.readme-content ol {
  padding-left: 1.15em;
}

.readme-content li {
  margin: 0.28rem 0;
  padding-left: 0.1rem;
}

.readme-content li::marker {
  color: var(--signal);
}

.readme-content strong {
  font-weight: 600;
  color: var(--ink);
}

.readme-content a {
  color: var(--signal);
  text-decoration-color: var(--signal);
}

.readme-content code {
  padding: 0.06em 0.3em;
  border: 1px solid var(--rule);
  background: var(--paper);
  font-family: var(--font-mono);
  font-size: 0.82em;
}

.readme-content pre {
  padding: 0.85rem 1rem;
  overflow-x: auto;
  border: 1px solid var(--rule);
  background: var(--code-bg);
  color: var(--code-fg);
  font-size: 0.8rem;
  line-height: 1.6;
  tab-size: 2;
}

.readme-content pre code {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font-size: inherit;
}

.readme-content pre:focus-visible {
  outline-offset: -3px;
  outline-color: var(--signal);
}

.readme-table {
  overflow-x: auto;
  border: 1px solid var(--rule);
  background: var(--paper-raised);
}

.readme-table:focus-visible {
  outline-offset: -3px;
  outline-color: var(--signal);
}

.readme-content table {
  width: 100%;
  min-width: 32rem;
  border-collapse: collapse;
  font-size: 0.8rem;
  line-height: 1.45;
}

.readme-content th,
.readme-content td {
  padding: 0.42rem 0.55rem;
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
}

.readme-content th:last-child,
.readme-content td:last-child {
  border-right: 0;
}

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

.readme-content th {
  background: var(--paper);
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink);
}

.readme-content td code {
  padding: 0;
  border: 0;
  background: none;
}

.readme-content blockquote {
  padding-left: 0.9rem;
  border-left: 2px solid var(--signal-soft);
  color: var(--ink-3);
  font-style: italic;
}

.readme-content hr {
  height: 0;
  margin: 1.5rem 0;
  border: 0;
  border-top: 1px solid var(--rule);
}

.readme-content img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0.65rem 0;
  border: 1px solid var(--rule);
}

.readme-image-note {
  padding: 0.55rem 0.6rem;
  border: 1px solid var(--rule);
  background: var(--paper-raised);
  font-family: var(--font-body);
  font-size: 0.82rem !important;
  line-height: 1.5 !important;
  color: var(--ink-3);
}

.readme-content input[type="checkbox"] {
  margin-right: 0.35rem;
  accent-color: var(--signal);
}

/* --------------------------------------------------------------------------
   Mermaid diagram
   -------------------------------------------------------------------------- */

.diagram {
  margin: 0.5rem 0 0.8rem;
  padding: 0.85rem 0.75rem;
  border: 1px solid var(--rule);
  background: var(--paper);
  overflow-x: auto;
}

.diagram svg {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}

@media (max-width: 720px) {
  .diagram svg.is-wide {
    max-width: none !important;
    width: var(--diagram-width, 640px) !important;
    margin-left: 0;
  }
}

.diagram-loading,
.diagram-error {
  padding: 0.8rem 0.2rem;
  font-family: var(--font-body);
  font-size: 0.84rem;
  font-style: italic;
  color: var(--ink-3);
}

.diagram-hint {
  display: none;
  margin-left: 0.55rem;
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 400;
  letter-spacing: 0.01em;
  color: var(--ink-3);
}

@media (max-width: 720px) {
  .has-wide-diagram .diagram-hint {
    display: inline;
  }
}

.diagram-error {
  color: var(--ink-2);
  font-style: normal;
}

/* --------------------------------------------------------------------------
   Theme cross-fade
   -------------------------------------------------------------------------- */

html.theme-changing,
html.theme-changing *,
html.theme-changing *::before,
html.theme-changing *::after {
  transition:
    background-color 220ms ease,
    color 220ms ease,
    border-color 220ms ease,
    fill 220ms ease,
    stroke 220ms ease !important;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1279px) {
  .sheet {
    grid-template-columns: minmax(0, 1fr);
    gap: 2.6rem;
  }

  .intro {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(210px, 0.7fr);
    column-gap: clamp(2rem, 5vw, 4rem);
    align-items: start;
  }

  .lede {
    grid-column: 1;
    grid-row: 1 / span 3;
    max-width: 30ch;
    font-size: clamp(1.5rem, 3.1vw, 1.95rem);
  }

  .facts {
    grid-column: 2;
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
  }

  .reading-key {
    grid-column: 2;
    margin-top: 1rem;
  }

  .key-hint {
    grid-column: 2;
    margin-top: 1rem;
  }

  .work {
    border-left: 0;
    padding-left: 0;
  }

  .about {
    grid-template-columns: minmax(190px, 0.55fr) minmax(0, 1.45fr);
    gap: clamp(2rem, 5vw, 4rem);
  }

  .about-body {
    border-left: 0;
    padding-left: 0;
  }
}

@media (max-width: 899px) {
  .canvas-figure {
    display: none;
  }

  .project-index:not([hidden]) {
    display: block;
  }

  .key-hint {
    display: none;
  }

  .reading-key {
    display: none;
  }

  .work {
    padding-top: 0.4rem;
  }

  .about {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.4rem;
  }

  .about-sub {
    max-width: 52ch;
  }
}

@media (max-width: 760px) {
  .intro {
    display: block;
  }

  .lede {
    max-width: 32ch;
  }

  .facts {
    margin-top: 1.55rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--rule);
  }

  .reading-key {
    margin-top: 1rem;
  }

  .site-footer {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.25rem;
  }

  .title-block {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .about-detail {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.7rem;
  }

  .about-contact {
    max-width: 420px;
  }

  .canvas-caption {
    display: block;
  }

  .canvas-note {
    margin-top: 0.45rem;
    text-align: left;
  }
}

@media (max-width: 720px) {
  .case-study {
    width: 100vw;
    height: 100dvh;
    border-left: 0;
    border-top: 1px solid var(--ink);
  }

  .case-study[open] {
    animation-name: panel-up;
  }

  @keyframes panel-up {
    from { transform: translateY(24px); opacity: 0.7; }
    to { transform: none; opacity: 1; }
  }
}

@media (max-width: 620px) {
  .title-block {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .site-header {
    gap: 0.8rem;
  }

  .header-actions {
    gap: 0.8rem;
  }
}

@media (max-width: 520px) {
  .index-open {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.5rem;
  }

  .index-meta {
    flex-direction: row;
    align-items: baseline;
    gap: 0.5rem;
    padding-top: 0;
  }

  .index-meta .index-domain::before {
    content: "/";
    margin-right: 0.5rem;
    color: var(--rule);
  }

  .index-title {
    font-size: 1.35rem;
  }

  .case-header {
    padding-top: 1.1rem;
  }

  .case-title {
    max-width: 16ch;
  }
}

/* --------------------------------------------------------------------------
   Reduced motion
   -------------------------------------------------------------------------- */

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

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

  .canvas .plot-node {
    animation: none;
  }
}
