/* Mondivio — /portfolio/ and the case notes underneath it.
   Tokens mirror the inline system in index.html. Each case note overrides
   --accent with a colour borrowed from its own real context. */

:root {
  --ink: #0a1633;
  --ink-2: #0e1a3d;
  --ink-3: #182553;
  --white: #ffffff;
  --mist: #c9d6ea;
  --mist-2: #8a9bbd;
  --signal: #2563ff;
  --glow: #5b8cff;
  --accent: #5b8cff;
  --border: rgba(255,255,255,0.12);
  --hair: rgba(255,255,255,0.08);
  --container: 1240px;
  --pad: clamp(20px, 4vw, 56px);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--ink);
  color: var(--white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "cv11";
  letter-spacing: -0.005em;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
.container { max-width: var(--container); margin: 0 auto; padding: 0 var(--pad); }

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.03em; line-height: 1.06; }
h1 { font-size: clamp(38px, 5.6vw, 72px); letter-spacing: -0.04em; }
h2 { font-size: clamp(26px, 3.2vw, 40px); }
h3 { font-size: clamp(19px, 1.8vw, 23px); letter-spacing: -0.025em; }
p { margin: 0; }
.serif { font-family: "Instrument Serif", "Times New Roman", serif; font-weight: 400; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 500; color: var(--accent);
}
.eyebrow::before { content: ''; width: 7px; height: 7px; border-radius: 99px; background: var(--accent); }
.lede { font-size: clamp(16px, 1.4vw, 19px); line-height: 1.55; color: var(--mist); }

.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(10,22,51,0.80);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: var(--container); margin: 0 auto; padding: 16px var(--pad);
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 600; letter-spacing: -0.025em; }
.brand-mark { width: 22px; height: 22px; }
.nav-links { display: flex; gap: 26px; font-size: 14px; color: var(--mist); font-weight: 500; }
.nav-links a:hover { color: #fff; }
@media (max-width: 900px) { .nav-links { display: none; } }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: none; padding: 14px 22px; border-radius: 999px;
  font-size: 15px; font-weight: 600; letter-spacing: -0.005em;
  transition: transform .15s ease, background .15s ease;
}
.btn-primary { background: var(--signal); color: #fff; }
.btn-primary:hover { background: #1a55ee; transform: translateY(-1px); }
.btn-ghost { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,0.22); }
.btn-ghost:hover { background: rgba(255,255,255,0.06); }

section.block { padding: clamp(56px, 7vw, 104px) 0; }
.block-alt { background: var(--ink-2); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }

/* ---------- Index ---------- */

.masthead { position: relative; padding: clamp(56px, 8vw, 116px) 0 clamp(28px, 4vw, 44px); }
.masthead h1 { margin-top: 20px; max-width: 14ch; }
.masthead .lede { margin-top: 26px; max-width: 64ch; }

/* The same faint drafting grid the homepage hero carries */
.masthead::before, .case-head::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse at 70% 20%, #000 0%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at 70% 20%, #000 0%, transparent 70%);
}
.masthead > .container, .case-head > .container { position: relative; }

/* One band per project, alternating, with a large recessive numeral.
   A grid of equal cards reads as a template; this reads as an index. */
.entry {
  display: grid; grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(28px, 5vw, 72px); align-items: center;
  padding: clamp(44px, 6vw, 80px) 0;
  border-top: 1px solid var(--hair);
}
.entry:first-of-type { border-top: 1px solid var(--border); }
.entry:nth-of-type(even) .entry-art { order: -1; }
@media (max-width: 940px) {
  .entry { grid-template-columns: 1fr; gap: 30px; }
  .entry:nth-of-type(even) .entry-art { order: 0; }
}

.entry-idx {
  display: block;
  font-family: "Instrument Serif", "Times New Roman", serif;
  font-size: clamp(56px, 7vw, 96px); line-height: 0.8; font-weight: 400;
  color: color-mix(in srgb, var(--accent) 30%, transparent);
  margin-bottom: 14px; user-select: none;
}
.entry-shape {
  display: inline-block; margin-bottom: 14px;
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.11em; text-transform: uppercase;
  color: var(--accent);
}
.entry h2 { letter-spacing: -0.035em; }
.entry h2 a:hover { color: var(--accent); }
.entry-line { margin-top: 18px; color: var(--mist); font-size: 17px; line-height: 1.6; max-width: 52ch; }

.entry-facts {
  margin: 26px 0 0; padding: 0; list-style: none;
  display: flex; flex-wrap: wrap; gap: 10px 0;
}
.entry-facts li {
  font-size: 13px; color: var(--mist-2); padding: 0 16px;
  border-left: 1px solid var(--border);
}
.entry-facts li:first-child { padding-left: 0; border-left: none; }
.entry-facts li b { display: block; color: #fff; font-size: 15px; font-weight: 600; letter-spacing: -0.02em; margin-bottom: 2px; }

.entry-go {
  display: inline-flex; align-items: center; gap: 7px;
  margin-top: 28px; font-size: 14.5px; font-weight: 600; color: var(--accent);
}
.entry-go:hover { gap: 11px; }
.entry-go { transition: gap .15s ease; }

.entry-art {
  display: block;
  border-radius: 18px; border: 1px solid var(--border);
  background:
    radial-gradient(ellipse at 75% 22%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 62%),
    linear-gradient(180deg, var(--ink-3) 0%, var(--ink-2) 100%);
  padding: clamp(18px, 3vw, 34px);
}

/* A product shown in its own window, rather than an abstract stand-in */
.window {
  display: block; border-radius: 12px; overflow: hidden;
  border: 1px solid rgba(255,255,255,0.16);
  background: #eef2f8;
  box-shadow: 0 28px 64px rgba(3,8,22,0.55), 0 3px 12px rgba(3,8,22,0.4);
  transition: transform .25s ease, box-shadow .25s ease;
}
a.entry-art:hover .window { transform: translateY(-4px); box-shadow: 0 36px 76px rgba(3,8,22,0.6), 0 4px 14px rgba(3,8,22,0.45); }
.window-bar {
  display: flex; align-items: center; gap: 6px;
  padding: 9px 13px; background: var(--ink);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.window-bar i { width: 8px; height: 8px; border-radius: 99px; background: rgba(255,255,255,0.16); }
.window-bar i:first-child { background: color-mix(in srgb, var(--accent) 80%, transparent); }
.window-bar em {
  font-style: normal; margin-left: 8px;
  font-size: 11px; font-weight: 500; letter-spacing: 0.05em; color: var(--mist-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.window img, .window svg { display: block; width: 100%; height: auto; }

/* Case-note figure using the same window treatment */
.figure-shot { margin: 32px 0 0; max-width: 66ch; }
.figure-shot figcaption { margin-top: 16px; font-size: 13.5px; color: var(--mist-2); line-height: 1.55; }

.entry-status {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 18px;
  font-size: 12.5px; font-weight: 600;
  padding: 5px 12px 5px 9px; border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent) 42%, transparent);
  background: color-mix(in srgb, var(--accent) 11%, transparent);
  color: #fff;
}
.entry-status::before { content: ''; width: 7px; height: 7px; border-radius: 99px; background: var(--accent); flex-shrink: 0; }

/* ---------- Case note ---------- */

.case-head { position: relative; padding: clamp(48px, 7vw, 96px) 0 clamp(24px, 4vw, 44px); }
.crumb { font-size: 13.5px; color: var(--mist-2); }
.crumb a:hover { color: #fff; }
.case-head h1 { margin-top: 18px; max-width: 20ch; }
.case-head h1 em { font-style: normal; color: var(--accent); }
.case-head .lede { margin-top: 26px; max-width: 62ch; }
.case-head .entry-status { margin-top: 26px; }

.case-meta {
  display: flex; flex-wrap: wrap; gap: 26px 44px;
  margin-top: 40px; padding-top: 26px; border-top: 1px solid var(--border);
}
.case-meta div strong { display: block; font-size: 20px; font-weight: 600; letter-spacing: -0.025em; }
.case-meta div span { font-size: 13px; color: var(--mist-2); }

.case-body h2 {
  margin: clamp(48px, 6vw, 76px) 0 0; max-width: 22ch;
  font-size: clamp(24px, 2.8vw, 34px);
}
.case-body h3 { margin: 34px 0 0; }
.case-body p { margin: 18px 0 0; color: var(--mist); font-size: 16.5px; line-height: 1.68; max-width: 66ch; }
.case-body p strong { color: #fff; font-weight: 600; }
.case-body ul { margin: 18px 0 0; padding-left: 20px; max-width: 66ch; }
.case-body li { margin-top: 9px; color: var(--mist); font-size: 16.5px; line-height: 1.6; }
.case-body li::marker { color: var(--accent); }
.case-body code {
  font-family: ui-monospace, "SFMono-Regular", "Consolas", monospace;
  font-size: 0.87em; color: #fff;
  background: rgba(255,255,255,0.07); border-radius: 5px; padding: 1px 6px;
}

/* A pulled-out fact — used once or twice per note, never more */
.pull {
  margin: 34px 0 0; max-width: 66ch;
  padding-left: 26px; border-left: 2px solid var(--accent);
}
.pull p {
  margin: 0; max-width: none;
  font-family: "Instrument Serif", "Times New Roman", serif;
  font-size: clamp(22px, 2.4vw, 30px); line-height: 1.3; color: #fff; letter-spacing: -0.015em;
}
.pull span { display: block; margin-top: 12px; font-family: inherit; font-size: 13.5px; color: var(--mist-2); line-height: 1.5; }

.spec { margin-top: 24px; width: 100%; border-collapse: collapse; max-width: 66ch; }
.spec th, .spec td {
  text-align: left; vertical-align: top; padding: 13px 0;
  border-bottom: 1px solid var(--hair); font-size: 15.5px; line-height: 1.55;
}
.spec th {
  width: 32%; padding-right: 24px; padding-top: 16px; color: var(--mist-2); font-weight: 500;
  font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase;
}
.spec td { color: var(--mist); }
.spec td strong { color: #fff; font-weight: 600; }
@media (max-width: 620px) {
  .spec, .spec tbody, .spec tr, .spec th, .spec td { display: block; width: 100%; }
  .spec th { border-bottom: none; padding-bottom: 2px; }
  .spec td { padding-top: 2px; }
}

.postmortem {
  margin-top: 26px; max-width: 66ch;
  background: var(--ink-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  padding: 24px 26px;
}
.postmortem p { margin: 0; color: var(--mist); font-size: 16px; line-height: 1.65; max-width: none; }
.postmortem p + p { margin-top: 14px; }
.postmortem .label {
  display: block; margin-bottom: 12px;
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--accent);
}

.diagram {
  margin: 32px 0 0; max-width: 66ch;
  background: linear-gradient(180deg, var(--ink-3) 0%, var(--ink-2) 100%);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 24px 20px;
  overflow-x: auto;
}
.diagram svg { display: block; width: 100%; height: auto; min-width: 480px; }
.diagram figcaption { margin-top: 16px; font-size: 13.5px; color: var(--mist-2); line-height: 1.55; }

/* Capability ledger */
.ledger { width: 100%; border-collapse: collapse; margin-top: clamp(28px, 4vw, 44px); }
.ledger th, .ledger td {
  text-align: left; vertical-align: top;
  padding: 15px 18px 15px 0; border-bottom: 1px solid var(--hair);
  font-size: 15.5px; line-height: 1.5;
}
.ledger thead th {
  font-size: 11.5px; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--mist-2); font-weight: 600; padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.ledger tbody th { color: #fff; font-weight: 600; width: 46%; }
.ledger td { color: var(--mist-2); font-size: 14.5px; }
@media (max-width: 720px) {
  .ledger thead { display: none; }
  .ledger tbody th, .ledger td { display: block; width: 100%; padding-right: 0; }
  .ledger tbody th { border-bottom: none; padding-bottom: 2px; }
  .ledger td { padding-top: 0; }
}

.close { margin-top: clamp(56px, 7vw, 96px); padding-top: clamp(36px, 5vw, 56px); border-top: 1px solid var(--border); }
.close h2 { max-width: 20ch; }
.close p { margin-top: 18px; max-width: 58ch; color: var(--mist); font-size: 16.5px; line-height: 1.62; }
.close .actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 30px; }

footer { border-top: 1px solid var(--border); padding: 30px 0 44px; margin-top: clamp(48px, 6vw, 88px); }
.foot-bar {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 14px;
  font-size: 13px; color: var(--mist-2);
}
.foot-bar .links { display: flex; gap: 18px; flex-wrap: wrap; }
.foot-bar a:hover { color: #fff; }
