/* ==========================================================================
   References — field sites, clients, software, the path
   ========================================================================== */

/* ---------- Intro ---------- */
.ref-hero { padding-top: 26px; padding-bottom: clamp(70px, 8vw, 120px); }
.ref-hero .hero-meta { display: flex; justify-content: space-between; gap: 20px; color: var(--muted); }
.ref-title { margin: clamp(60px, 7vw, 120px) 0 0 -6px; font-size: clamp(74px, 11.4vw, 206px); font-weight: 500; line-height: .86; letter-spacing: -.09em; }
.ref-title em { color: var(--accent); font-family: var(--serif); font-weight: 400; letter-spacing: -.035em; }
.ref-hero-foot { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: clamp(30px, 5vw, 90px); align-items: end; margin-top: clamp(50px, 6vw, 90px); }
.ref-intro { max-width: 480px; margin: 0; font-size: clamp(17px, 1.45vw, 21px); line-height: 1.5; letter-spacing: -.02em; }
.ref-ledger { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; border-top: 1px solid var(--ink); }
.ref-ledger div { display: flex; flex-direction: column; padding: 16px 16px 0 0; }
.ref-ledger div + div { padding-left: 16px; border-left: 1px solid var(--line); }
.ref-ledger dt { color: var(--muted); }
.ref-ledger dd { margin: auto 0 0; padding-top: 18px; font-size: clamp(44px, 4.6vw, 80px); font-weight: 500; line-height: .9; letter-spacing: -.07em; }

/* ---------- Sticky section index ---------- */
.ref-subnav {
  position: sticky; top: 0; z-index: 90;
  display: flex; gap: clamp(14px, 3vw, 48px);
  padding: 0 var(--gutter);
  border-block: 1px solid var(--ink);
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  overflow-x: auto; scrollbar-width: none;
}
.ref-subnav::-webkit-scrollbar { display: none; }
.ref-subnav a { position: relative; display: inline-flex; align-items: center; gap: 8px; min-height: 52px; font-size: 14px; font-weight: 600; white-space: nowrap; color: var(--muted); transition: color .3s ease; }
.ref-subnav a span { font-size: 9px; font-weight: 700; letter-spacing: .12em; }
.ref-subnav a::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform .45s var(--ease-out); }
.ref-subnav a:hover, .ref-subnav a.is-active { color: var(--ink); }
.ref-subnav a.is-active::after { transform: scaleX(1); }

.ref-section-head { display: grid; grid-template-columns: 28% minmax(0, 1fr); gap: 30px; align-items: start; }
.ref-section-head .eyebrow { margin-top: 17px; }
.ref-section-head h2 { margin: 0; font-size: clamp(54px, 6.6vw, 118px); font-weight: 500; line-height: .95; letter-spacing: -.075em; }
.ref-section-head h2 em { color: var(--accent); font-family: var(--serif); font-weight: 400; letter-spacing: -.025em; }
.ref-section-head .intro-aside { max-width: 380px; margin: 30px 0 0 auto; color: var(--ink-soft); font-size: 16px; line-height: 1.55; }

/* ---------- Field sites ---------- */
.ref-field { position: relative; padding-block: clamp(90px, 9vw, 150px); }
.site-list { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--ink); }
.site-group { display: flex; justify-content: space-between; gap: 20px; margin: 64px 0 0; padding-bottom: 12px; color: var(--muted); }
.site-group span:first-child { color: var(--ink); }
.site-list .site-name { font-size: clamp(28px, 3.1vw, 54px); }
.site-row {
  position: relative;
  display: grid;
  grid-template-columns: 60px minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, .9fr) 90px;
  gap: 18px; align-items: baseline;
  padding: 30px 0 28px;
  border-bottom: 1px solid var(--line);
  isolation: isolate;
  transition: padding-left .5s var(--ease-out), color .35s ease;
}
.site-row::before { content: ""; position: absolute; inset: 0 calc(var(--gutter) * -1); z-index: -1; background: var(--ink); transform: scaleY(0); transform-origin: bottom; transition: transform .55s var(--ease-out); }
.site-row:hover { color: var(--paper); padding-left: 18px; }
.site-row:hover::before { transform: scaleY(1); }
.site-row:hover .site-scope, .site-row:hover .site-role, .site-row:hover .site-index { color: color-mix(in srgb, var(--paper) 72%, transparent); }
.site-index { color: var(--muted); }
.site-name { font-size: clamp(34px, 4.1vw, 72px); font-weight: 500; line-height: .95; letter-spacing: -.07em; }
.site-name em { font-family: var(--serif); font-weight: 400; letter-spacing: -.02em; }
.site-row:hover .site-name em { color: var(--coral-soft); }
.site-scope, .site-role { color: var(--ink-soft); font-size: 15px; line-height: 1.45; transition: color .35s ease; }
.site-period { justify-self: end; text-align: right; }
.site-more { display: flex; justify-content: space-between; gap: 20px; margin: 26px 0 0; color: var(--muted); font-size: 15px; }
.site-more strong { color: var(--ink); font-weight: 600; }

.site-preview {
  position: fixed; top: 0; left: 0; z-index: 95;
  width: 300px;
  padding: 22px;
  background: var(--block); color: var(--block-ink);
  pointer-events: none;
  opacity: 0;
  transform: translate3d(var(--x, 0), var(--y, 0), 0) rotate(var(--r, 0deg)) scale(.85);
  transition: opacity .3s ease, transform .15s linear;
  box-shadow: 0 30px 60px -20px var(--shadow);
}
.site-preview.is-visible { opacity: 1; transform: translate3d(var(--x, 0), var(--y, 0), 0) rotate(var(--r, 0deg)) scale(1); }
.preview-top { display: flex; justify-content: space-between; color: var(--block-muted); }
.preview-index { display: block; margin-top: 18px; font-size: 86px; font-weight: 500; line-height: .8; letter-spacing: -.08em; }
.preview-name { margin: 18px 0 0; font-family: var(--serif); font-size: 30px; line-height: 1.02; }
.preview-systems { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 18px; }
.preview-systems span { border: 1px solid rgba(248, 246, 240, .6); padding: 6px 8px; font-size: 9px; }
.preview-role { margin: 18px 0 0; padding-top: 14px; border-top: 1px solid rgba(248, 246, 240, .35); color: var(--block-muted); font-size: 13px; line-height: 1.45; }
.preview-glyph { position: absolute; top: 62px; right: 22px; width: 58px; opacity: .55; animation: spin 18s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Clients ---------- */
.ref-clients { padding-block: clamp(90px, 9vw, 150px) clamp(80px, 8vw, 130px); background: var(--night); color: var(--night-ink); overflow: hidden; }
.ref-clients .ref-section-head h2 em { color: var(--coral-soft); }
.ref-clients .eyebrow, .ref-clients .intro-aside { color: var(--night-muted); }
.name-marquee { display: flex; margin-top: 80px; overflow: hidden; border-top: 1px solid rgba(255, 255, 255, .16); }
.name-marquee + .name-marquee { margin-top: 0; }
.name-track { display: flex; flex: 0 0 auto; align-items: center; gap: 44px; padding: 26px 44px 26px 0; white-space: nowrap; animation: band-slide 42s linear infinite; }
.name-marquee.is-reverse .name-track { animation-direction: reverse; animation-duration: 50s; }
.name-track span { font-size: clamp(40px, 5.4vw, 96px); font-weight: 500; letter-spacing: -.07em; line-height: 1; }
.name-track em { font-family: var(--serif); font-size: clamp(40px, 5.4vw, 96px); font-weight: 400; letter-spacing: -.02em; line-height: 1; color: transparent; -webkit-text-stroke: 1px rgba(248, 246, 240, .7); }
.name-track i { color: var(--coral); font-size: 34px; font-style: normal; line-height: 1; }
.client-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; margin-top: 80px; background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .16); }
.client-card { display: flex; flex-direction: column; gap: 18px; min-height: 330px; padding: 30px; background: var(--night); transition: background .5s var(--ease-out); }
.client-card:hover { background: var(--night-raise); }
.client-cards.section-shell { margin-inline: var(--gutter); padding-inline: 0; }
.client-card .mono { margin: 0; color: var(--night-muted); }
.client-card h3 { margin: 0; font-size: clamp(28px, 2.6vw, 44px); font-weight: 500; line-height: 1; letter-spacing: -.06em; }
.client-card h3 em { color: var(--coral-soft); font-family: var(--serif); font-weight: 400; letter-spacing: -.01em; }
.client-card p { margin: auto 0 0; color: var(--night-muted); font-size: 15px; line-height: 1.55; }
.client-card ul { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; font-size: 17px; }
.client-card li { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 8px; border-bottom: 1px solid rgba(255, 255, 255, .12); }
.client-card li span:last-child { color: var(--night-muted); font-size: 13px; }

/* ---------- Software ---------- */
.ref-software { padding-block: clamp(90px, 9vw, 150px); }
.gh-status { display: inline-flex; align-items: center; gap: 10px; margin-top: 22px; color: var(--muted); }
.gh-status i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.gh-status[data-state="live"] i { background: var(--lamp); box-shadow: 0 0 0 4px rgba(47, 158, 98, .18); }
.gh-status[data-state="snapshot"] i { background: var(--coral); }
.repo-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-top: 70px; perspective: 1400px; }
.repo-card {
  --rx: 0deg; --ry: 0deg; --gx: 50%; --gy: 50%;
  position: relative;
  display: flex; flex-direction: column; gap: 16px;
  min-height: 300px;
  padding: 26px;
  background: var(--paper-light);
  border: 1px solid var(--card-border);
  overflow: hidden;
  transform: rotateX(var(--rx)) rotateY(var(--ry));
  transform-style: preserve-3d;
  transition: transform .5s var(--ease-out), border-color .3s ease, box-shadow .5s var(--ease-out);
}
.repo-card:hover { border-color: var(--ink); box-shadow: 0 30px 50px -30px var(--shadow); }
.repo-card.is-wide { grid-column: span 2; }
.repo-card.is-flagship { grid-column: span 2; background: var(--block); color: var(--block-ink); border-color: var(--block); }
.repo-card::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(circle at var(--gx) var(--gy), rgba(255, 255, 255, .55), transparent 45%); opacity: 0; transition: opacity .4s ease; mix-blend-mode: soft-light; }
.repo-card:hover::after { opacity: 1; }
.repo-top { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); }
.is-flagship .repo-top { color: var(--block-muted); }
.repo-lang { display: inline-flex; align-items: center; gap: 8px; }
.repo-lang i { width: 9px; height: 9px; border-radius: 50%; background: var(--lang, var(--muted)); box-shadow: 0 0 0 1px rgba(255, 255, 255, .5); }
.repo-badge { padding: 4px 7px; border: 1px solid currentColor; font-size: 9px; }
.repo-card h3 { margin: 8px 0 0; font-size: clamp(26px, 2.3vw, 38px); font-weight: 500; line-height: 1; letter-spacing: -.06em; overflow-wrap: anywhere; }
.is-flagship h3 { font-size: clamp(34px, 3.6vw, 60px); }
.repo-card h3 a::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.repo-card p { margin: 0; color: var(--ink-soft); font-size: 15px; line-height: 1.5; }
.is-flagship p { max-width: 560px; color: var(--block-muted); font-size: 17px; }
.repo-links { position: relative; z-index: 2; display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; font-weight: 600; }
.repo-links a { border-bottom: 1px solid currentColor; padding-bottom: 2px; }
.repo-links a:hover { color: var(--coral-ink); }
.repo-stats { display: flex; gap: 22px; margin: auto 0 0; padding-top: 16px; border-top: 1px solid var(--line); }
.is-flagship .repo-stats { border-color: rgba(255, 255, 255, .3); }
.repo-stats dt { color: var(--muted); font-size: 9px; }
.is-flagship .repo-stats dt { color: var(--block-muted); }
.repo-stats dd { margin: 6px 0 0; font-size: 13px; letter-spacing: .06em; font-variant-numeric: tabular-nums; }

.platforms { margin-top: 90px; }
.platforms h3, .archive summary { display: flex; justify-content: space-between; margin: 0; padding-bottom: 14px; border-bottom: 1px solid var(--ink); }
.platform-list { margin: 0; padding: 0; list-style: none; }
.platform-list li { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) 150px; gap: 18px; align-items: baseline; padding: 22px 0; border-bottom: 1px solid var(--line); }
.platform-list strong { font-size: clamp(24px, 2.3vw, 36px); font-weight: 500; letter-spacing: -.055em; }
.platform-list p { margin: 0; color: var(--ink-soft); font-size: 15px; line-height: 1.5; }
.platform-list .mono { justify-self: end; text-align: right; }
.platform-list a.mono { color: var(--accent); }
.platform-list a.mono:hover { color: var(--coral); }

.archive { margin-top: 60px; }
.archive summary { cursor: pointer; list-style: none; align-items: center; min-height: 44px; }
.archive summary::-webkit-details-marker { display: none; }
.archive summary .toggle { font-size: 22px; font-weight: 400; transition: transform .4s var(--ease-out); }
.archive[open] summary .toggle { transform: rotate(45deg); }
.archive-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 30px; margin: 0; padding: 12px 0 0; list-style: none; }
.archive-grid li { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.archive-grid a:hover { color: var(--accent); }
.archive-grid span { color: var(--muted); font-size: 12px; white-space: nowrap; }

/* ---------- The path (pinned horizontal on wide screens) ---------- */
.ref-path { position: relative; background: var(--paper-deep); }
.path-pin { position: sticky; top: 0; display: flex; flex-direction: column; justify-content: center; min-height: 100vh; overflow: hidden; padding-block: 60px; }
.path-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 30px; }
.path-head h2 { margin: 18px 0 0; font-size: clamp(56px, 7vw, 124px); font-weight: 500; line-height: .95; letter-spacing: -.075em; }
.path-head h2 em { color: var(--accent); font-family: var(--serif); font-weight: 400; letter-spacing: -.02em; }
.path-meter { width: min(320px, 40%); height: 2px; background: var(--line); }
.path-meter span { display: block; height: 100%; background: var(--accent); transform: scaleX(var(--p, 0)); transform-origin: left; }
.path-track { position: relative; display: flex; gap: 0; width: max-content; margin: 70px 0 0; padding: 0 var(--gutter); list-style: none; will-change: transform; }
.path-track::before { content: ""; position: absolute; left: var(--gutter); right: var(--gutter); top: 86px; height: 1px; background: var(--ink); }
.path-step { position: relative; width: clamp(300px, 30vw, 440px); padding-right: 50px; }
.path-step time { display: block; font-family: var(--serif); font-size: clamp(44px, 4vw, 70px); font-style: italic; line-height: .8; letter-spacing: -.02em; color: var(--muted); transition: color .5s ease; }
.path-step::before { content: ""; position: absolute; left: 0; top: 80px; width: 13px; height: 13px; border-radius: 50%; background: var(--paper-deep); border: 1.5px solid var(--ink); transition: background .4s ease, transform .5s var(--ease-out); }
.path-step.is-active::before { background: var(--coral); border-color: var(--coral); transform: scale(1.4); }
.path-step.is-active time { color: var(--accent); }
.path-step h3 { margin: 64px 0 0; font-size: clamp(24px, 2.2vw, 34px); font-weight: 500; line-height: 1.05; letter-spacing: -.055em; }
.path-step p { max-width: 330px; margin: 16px 0 0; color: var(--ink-soft); font-size: 15px; line-height: 1.55; }
.path-tag { display: inline-block; margin-top: 18px; padding: 5px 8px; border: 1px solid currentColor; font-size: 9px; color: var(--muted); }
.path-step.is-software .path-tag { color: var(--accent); }

.sources { padding-block: 50px 110px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.sources p { max-width: 760px; margin: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 1050px) {
  .ref-hero-foot { grid-template-columns: 1fr; }
  .ref-ledger { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ref-ledger div:nth-child(3) { padding-left: 0; border-left: 0; }
  .ref-ledger div:nth-child(n + 3) { margin-top: 24px; border-top: 1px solid var(--line); }
  .site-row { grid-template-columns: 44px minmax(0, 1.2fr) minmax(0, 1fr) 80px; }
  .site-role { display: none; }
  .repo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .repo-card.is-wide { grid-column: auto; }
  .client-cards { grid-template-columns: 1fr; }
  .client-card { min-height: 0; }
  .archive-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 850px) {
  .ref-section-head { grid-template-columns: 1fr; gap: 26px; }
  .ref-section-head .intro-aside { margin-left: 0; }
  .site-row { grid-template-columns: 36px minmax(0, 1fr); gap: 6px 14px; padding: 24px 0; }
  .site-scope, .site-period { grid-column: 2; }
  .site-period { justify-self: start; text-align: left; }
  .site-row:hover { padding-left: 0; color: inherit; }
  .site-row:hover::before { transform: none; }
  .site-row:hover .site-scope, .site-row:hover .site-index { color: inherit; }
  .site-preview { display: none; }
  .platform-list li { grid-template-columns: 1fr; gap: 8px; }
  .platform-list .mono { justify-self: start; text-align: left; }
  .path-pin { position: static; min-height: 0; padding-block: 90px; }
  .path-head { flex-direction: column; align-items: flex-start; }
  .path-meter { display: none; }
  .path-track { flex-direction: column; width: auto; margin-top: 50px; transform: none !important; }
  .path-track::before { left: calc(var(--gutter) + 6px); right: auto; top: 0; bottom: 0; width: 1px; height: auto; }
  .path-step { width: auto; padding: 0 0 50px 44px; }
  .path-step::before { top: 6px; }
  .path-step h3 { margin-top: 18px; }
  .path-step time { color: var(--accent); }
}
@media (max-width: 600px) {
  .ref-hero .hero-meta span:last-child { display: none; }
  .ref-title { font-size: clamp(58px, 15vw, 90px); }
  .ref-ledger dd { font-size: 44px; }
  .ref-section-head h2 { font-size: clamp(46px, 11.5vw, 72px); }
  .site-list { margin-top: 44px; }
  .site-name { font-size: 34px; }
  .site-more { flex-direction: column; }
  .repo-grid { grid-template-columns: 1fr; margin-top: 44px; }
  .repo-card.is-flagship { grid-column: auto; }
  .archive-grid { grid-template-columns: 1fr; }
  .client-card { padding: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  .name-track { animation: none; }
  .path-pin { position: static; min-height: 0; }
  .path-track { flex-wrap: wrap; width: auto; row-gap: 40px; transform: none !important; }
}

/* Rows that open a case-study sheet */
.site-link { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; }
.site-link:hover { color: var(--accent); }
.site-row:hover .site-link:hover { color: var(--coral-soft); }
.case-flag { color: var(--coral-ink); font-size: 10px; letter-spacing: .06em; white-space: nowrap; }
