/* =========================================================================
   MantaSys brand layer — "Structural Manta"
   Loaded after site.css on every page. It only overrides; delete the <link>
   to brand.css and the site falls straight back to Clay + Newsreader.

   From the brand package (Visual Identity): a restrained technical palette —
   Deep Navy #0F1623 as structure, Off-White #F7F8FA as surface, System Grey
   #6B7280 for secondary text, Ocean Teal #0D9488 as the single, functional
   accent. IBM Plex Sans (semibold headings, regular body) and IBM Plex Mono
   for uppercase labels. 1px hairlines, no rounded corners, no gradients,
   soft navy-tinted shadows on cards and none inside diagrams.
   ========================================================================= */

/* ---------- Fonts ------------------------------------------------------- */
/* Self-hosted, Latin subset, like Newsreader. Licence: fonts/OFL-IBM-Plex.txt */

@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/plex-sans-400.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/plex-sans-500.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/plex-sans-600.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/plex-mono-400.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/plex-mono-500.woff2") format("woff2");
}

/* ---------- Tokens ------------------------------------------------------ */

:root {
  --paper:     #F7F8FA;
  --surface:   #FFFFFF;
  --rule:      #E2E4E9;   /* the package's rgba(15,22,35,.1), flattened onto paper */

  --ink:       #0F1623;
  --secondary: #6B7280;

  /* Ocean Teal is 3.7:1 on white: fine for rules, strips and fills, not for
     small text. Text set in the accent uses the next step down, as the
     package's own active nav does. */
  --accent:      #0D9488;
  --accent-text: #0F766E;
  --accent-tint: rgba(13, 148, 136, 0.07);

  --accent-work:      var(--accent);
  --accent-builds:    var(--accent);
  --accent-community: var(--accent);
  --accent-games:     var(--accent);
  --accent-sandbox:   var(--accent);

  --display: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --body:    var(--display);
  --mono:    "IBM Plex Mono", ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;

  --edge:      1px solid var(--rule);
  --shadow-sm: 0 1px 3px rgba(15, 22, 35, 0.07), 0 1px 2px rgba(15, 22, 35, 0.04);
  --shadow-md: 0 4px 16px rgba(15, 22, 35, 0.09), 0 2px 6px rgba(15, 22, 35, 0.04);
}

body { font-weight: 400; line-height: 1.65; font-optical-sizing: none; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 0; }

strong { font-weight: 600; }

/* The label voice: Plex Mono, upper case, widest tracking, system grey. */
.eyebrow,
.row .lab,
.case-block .k,
.meta dt,
.status,
.step-label,
.case-tags,
figure.shot figcaption,
.case-index {
  font-family: var(--mono);
  font-weight: 500;
  letter-spacing: 0.1em;
}
.case-tags,
figure.shot figcaption { letter-spacing: 0.04em; }

.ph { border-radius: 0; }

/* ---------- Masthead ---------------------------------------------------- */

.masthead {
  background: var(--surface);
  border-bottom: var(--edge);
  box-shadow: var(--shadow-sm);
}
.nav { align-items: center; padding-block: var(--s-4); }

.nav-name {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  font-size: var(--t-1);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1;
}
.nav-name svg { display: block; width: 32px; height: 32px; flex: none; }
.nav-name .sys { color: var(--accent); }
.nav-name:hover { text-decoration: none; }

.nav-links {
  font-family: var(--display);
  font-size: var(--t--1);
  letter-spacing: 0;
}
.nav-links a { color: var(--secondary); border-bottom-width: 2px; }
.nav-links a:hover { color: var(--ink); border-bottom-color: var(--rule); }
.nav-links a[aria-current="page"] {
  color: var(--accent-text);
  font-weight: 500;
  border-bottom-color: var(--accent);
}

/* ---------- Headings ---------------------------------------------------- */

.page-head { border-bottom: var(--edge); }

.page-head h1,
.section h2,
.section > h3,
.row .ttl,
.case h3,
.build h3,
.exp h3 {
  font-weight: 600;
  letter-spacing: -0.025em;
}
.page-head h1 { line-height: 1.15; }
.section h2 { line-height: 1.2; }

/* The title rule stays — the robot on the home page levels it — but in the
   structure colour: teal is kept for things that act or flow. */
.page-head h1::after { height: 1px; background: var(--ink); }

/* ---------- Ruled rows become cards ------------------------------------- */
/* The package's unit is the white card on a hairline with a soft shadow.
   Linked rows gain the 2px teal strip on hover, as its rule cards carry. */

.rows {
  border-top: 0;
  display: grid;
  gap: var(--s-4);
}

.row {
  background: var(--surface);
  border: var(--edge);
  box-shadow: var(--shadow-sm);
  padding: var(--s-5);
}

.row-link {
  box-shadow: inset 2px 0 0 transparent, var(--shadow-sm);
  transition: box-shadow .15s ease;
}
.row-link:hover {
  box-shadow: inset 2px 0 0 var(--accent), var(--shadow-md);
}
.row-link:hover .ttl { text-decoration-thickness: 1px; }
.row-link:hover .arw { color: var(--accent-text); }

/* ---------- Cases, builds, experiments: same card ---------------------- */

.case,
.build,
.exp {
  background: var(--surface);
  border: var(--edge);
  box-shadow: var(--shadow-sm);
  padding: var(--s-6);
  margin-bottom: var(--s-5);
}
.case:last-of-type,
.build:last-of-type { border-bottom: var(--edge); }
.exps { border-top: 0; }
.prose + .exps { margin-top: var(--s-6); }

.exp .why { border-left: 2px solid var(--accent); }

.exp-links a:hover { color: var(--accent-text); }
.exp-links .graduated a { color: var(--accent-text); border-bottom-color: var(--accent); }
.exp-links .graduated a:hover { color: var(--ink); }

.status::before { border-radius: 0; }
.status[data-status="running"]::before { background: var(--accent); border-color: var(--accent); }

figure.shot img,
figure.shot .placeholder {
  border: var(--edge);
  border-radius: 0;
  box-shadow: var(--shadow-sm);
}

/* ---------- Links and the call to action ------------------------------- */

.prose a:hover,
.link:hover { color: var(--accent-text); text-decoration-thickness: 1px; }

/* Primary button: navy fill, white text, square. */
.cta .link {
  display: inline-block;
  background: var(--ink);
  color: var(--surface);
  text-decoration: none;
  font-size: var(--t--1);
  font-weight: 500;
  padding: var(--s-3) var(--s-5);
  box-shadow: var(--shadow-sm);
  transition: background-color .15s ease;
}
.cta .link:hover { background: #1F2937; color: var(--surface); }

/* ---------- Diagram ----------------------------------------------------- */
/* The package's grammar: angular geometry, 1px strokes, navy for structure,
   teal for flow and for the node that matters, no shadows. */

.diagram-steps { border-block: var(--edge); }
.diagram-steps svg { stroke-width: 1; stroke-linecap: square; stroke-linejoin: miter; }
.diagram-steps rect { rx: 0; fill: var(--surface); }
.diagram-steps li + li::before { color: var(--accent); }
.diagram-steps .is-system { color: var(--accent); }
.diagram-steps .is-system svg { stroke-width: 1; }
.diagram-steps .is-system rect { fill: var(--accent-tint); }
.diagram-steps .is-system circle { fill: var(--accent); }
.is-system .step-label { color: var(--accent-text); }

.diagram.flows { border-block: var(--edge); }
.node { font-size: 0.75rem; }
.node-k { font-weight: 500; }
.node.is-core { border-color: var(--ink); }
.node.is-out { background: var(--accent-tint); color: var(--accent-text); }
.node.is-muted { border-color: #C9CDD5; }
.flow-return { color: var(--accent-text); }

/* ---------- Footer ------------------------------------------------------ */

.foot { background: var(--surface); border-top: var(--edge); }
.foot-inner a:hover { color: var(--accent-text); }

@media print {
  .masthead, .row, .case, .build, .exp { box-shadow: none; }
  .foot { background: none; }
}
