/* =========================================================
   DEUX RIVES CAPITAL — sub-page styles
   Editorial identity: warm parchment, sage accent, Newsreader
   serif headings on IBM Plex Sans, hairline rules, no fill.
   Class names are shared with build-site.py's generated markup;
   index.html carries its own copy of this system inline.
   ========================================================= */

:root {
  --paper:      #E5E2D8;
  --paper-alt:  #EFECE2;
  --ink:        #1B2430;
  --ink-body:   #2B3542;
  --ink-muted:  #4A5566;
  --line:       #C7C2B0;
  --line-soft:  #D5D0C1;
  --accent:     #54705F;
  --accent-deep:#3A5245;
  --rule:       var(--line);
  --rule-soft:  var(--line-soft);
  --scrim:      rgba(229,226,216,.92);

  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans:  "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono:  var(--sans);

  --gut: clamp(1.25rem, 5vw, 4rem);
  --measure: 1120px;
  --ease: cubic-bezier(.22,.61,.36,1);

  color-scheme: light;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink-body);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

p { margin: 0 0 1em; max-width: 64ch; }
p:last-child { margin-bottom: 0; }
b, strong { font-weight: 600; color: var(--ink); }
a { color: inherit; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

/* ---------- icons ---------- */
.icon {
  display: block; width: 40px; height: 40px;
  fill: none; stroke: currentColor; stroke-width: 1.4;
  stroke-linecap: round; stroke-linejoin: round;
  color: var(--accent); overflow: visible; flex: none;
}
.icon-sm { width: 18px; height: 18px; stroke-width: 2.4; }
.icon-md { width: 30px; height: 30px; stroke-width: 1.6; }
.icon-lg { width: 42px; height: 42px; stroke-width: 1.3; }

/* ---------- layout ---------- */
.wrap { width: 100%; max-width: var(--measure); margin-inline: auto; padding-inline: var(--gut); }
.sec { padding-block: clamp(3rem, 7vw, 5.5rem); border-top: 1px solid var(--line); }
.sec.alt { background: var(--paper-alt); }
.sec:first-of-type { border-top: 0; }

/* ---------- type ---------- */
h1, h2, h3, h4 {
  font-family: var(--serif); color: var(--ink);
  font-weight: 500; font-optical-sizing: auto;
  letter-spacing: -.01em; line-height: 1.18; margin: 0;
  text-wrap: balance;
}
h1 { font-size: clamp(2.1rem, 4vw, 3rem); line-height: 1.14; }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
h3 { font-size: 1.05rem; font-family: var(--sans); font-weight: 600; letter-spacing: 0; line-height: 1.3; }
h4 { font-size: .95rem; font-family: var(--sans); font-weight: 600; }

.eyebrow {
  font-family: var(--serif); font-size: .95rem; font-weight: 400;
  letter-spacing: .01em; text-transform: none;
  color: var(--accent); margin: 0 0 1.1rem;
}
.eyebrow b { color: var(--accent-deep); font-weight: 600; }

.sub {
  font-size: .9rem; line-height: 1.55; color: var(--ink-muted);
  font-style: normal; margin: .5rem 0 0; max-width: 48ch;
}
.lede {
  font-size: 1.08rem; line-height: 1.55;
  color: var(--ink-muted); font-weight: 400; max-width: 60ch;
}
.sec-head { margin-bottom: clamp(2rem, 4vw, 3rem); max-width: min(100%, 54rem); }
.sec-head h2 + p { margin-top: 1.2rem; }
.note {
  font-family: var(--sans); font-size: .8rem; letter-spacing: 0;
  text-transform: none; color: var(--ink-muted);
}

/* ---------- header ---------- */
.top {
  position: sticky; top: 0; z-index: 60;
  background: var(--scrim);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.top-in { display: flex; align-items: center; gap: 1rem; min-height: 64px; }
.brand {
  display: flex; align-items: center; gap: .6rem;
  text-decoration: none; margin-right: auto;
  font-family: var(--serif); font-weight: 600; text-transform: none;
  letter-spacing: .01em; font-size: 1.15rem; color: var(--ink);
  white-space: nowrap;
}
.brand .icon { width: 20px; height: 20px; stroke-width: 1.6; color: var(--accent); }
.brand .mark { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); display: inline-block; flex: none; }
.nav { display: flex; align-items: center; gap: .25rem; }
.nav a {
  text-decoration: none; color: var(--ink-muted);
  font-family: var(--sans); font-size: .95rem; font-weight: 400;
  letter-spacing: 0; text-transform: none;
  padding: .4rem .55rem; border-bottom: 1px solid transparent;
  white-space: nowrap; transition: color .15s var(--ease), border-color .15s var(--ease);
}
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }
@media (max-width: 760px) {
  .nav { gap: 0; }
  .nav a { padding: .4rem .4rem; font-size: .82rem; }
  .top-in { gap: .5rem; }
}
@media (max-width: 400px) {
  .nav a { padding: .4rem .3rem; font-size: .76rem; }
  .brand { font-size: 1rem; }
}

/* theme switch removed in the Deux Rives identity */
.theme { display: none; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  border: 1px solid var(--ink); background: none; color: var(--ink);
  text-decoration: none; cursor: pointer;
  padding: .75rem 1.4rem;
  font-family: var(--sans); font-size: .95rem; font-weight: 400;
  letter-spacing: 0; text-transform: none;
  transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.btn:hover { background: var(--ink); color: var(--paper); }
.btn-ghost { border-color: var(--line); color: var(--ink-muted); }
.btn-ghost:hover { border-color: var(--ink); background: none; color: var(--ink); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.btns { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 2rem; }

/* ---------- hero (unused by sub-pages; kept minimal) ---------- */
.hero { padding-block: clamp(3rem, 8vw, 6rem); position: relative; }
.hero h1 { margin-bottom: 1.4rem; }
.hero .lede { max-width: 52ch; }
.hero-grid { display: grid; grid-template-columns: minmax(0,1.1fr) minmax(0,.9fr); gap: clamp(2rem,5vw,3.5rem); align-items: center; }
@media (max-width: 900px) { .hero-grid { grid-template-columns: 1fr; } }
.hero-canvas { width: 100%; aspect-ratio: 4/3; display: block; color: var(--accent); }

/* ---------- stat strip ---------- */
.strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); border-top: 1px solid var(--ink); }
.strip div { padding: 1.4rem 1.1rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.strip div:last-child { border-right: 0; }
.strip .v { font-family: var(--serif); font-size: clamp(1.6rem,3.4vw,2.3rem); font-weight: 500; letter-spacing: -.01em; color: var(--ink); line-height: 1.1; }
.strip .v small { font-size: .42em; font-weight: 500; vertical-align: .45em; margin-right: .15em; color: var(--ink-muted); }
.strip .k { font-family: var(--sans); font-size: .82rem; letter-spacing: 0; text-transform: none; color: var(--ink-muted); margin-top: .6rem; }
@media (max-width: 620px) { .strip div { border-right: 0; } }

/* ---------- generic grids ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(255px,1fr)); border-top: 1px solid var(--line); }
.cards > article { padding: clamp(1.6rem,3vw,2.2rem) clamp(1.2rem,2vw,1.8rem); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.cards > article:last-child { border-right: 0; }
.cards .icon { margin-bottom: 1rem; }
.cards h3 { margin-bottom: .2rem; }
.cards .sub { margin-top: .2rem; }
.cards p { font-size: .95rem; line-height: 1.6; margin: .8rem 0 0; }
@media (max-width: 860px) { .cards > article { border-right: 0; } }

.flow { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5,1fr); border-top: 1px solid var(--line); }
.flow li { padding: clamp(1.5rem,3vw,2rem) 1rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.flow li:last-child { border-right: 0; }
.flow .n { font-family: var(--serif); font-size: 1rem; letter-spacing: 0; color: var(--accent); display: block; margin-bottom: 1rem; }
.flow .icon { margin-bottom: 1rem; }
@media (max-width: 950px) { .flow { grid-template-columns: repeat(2,1fr); } .flow li:nth-child(2n) { border-right: 0; } }
@media (max-width: 520px) { .flow { grid-template-columns: 1fr; } .flow li { border-right: 0; } }

/* ---------- listing cards (projects / deals) ---------- */
.list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px,1fr)); gap: 0; border-top: 1px solid var(--line); }
.tile {
  display: flex; flex-direction: column;
  padding: clamp(1.5rem,3vw,2.1rem) clamp(1.3rem,2.2vw,1.9rem);
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  text-decoration: none; color: inherit; position: relative;
  transition: background .18s var(--ease);
}
.tile:hover { background: var(--paper-alt); }
.tile:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
.tile-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; }
.tag {
  font-family: var(--sans); font-size: .78rem; letter-spacing: 0;
  text-transform: none; color: var(--accent-deep);
  border: 1px solid var(--line); padding: .2rem .5rem; white-space: nowrap;
}
.tile h3 { margin-bottom: .35rem; font-family: var(--serif); font-weight: 500; font-size: 1.25rem; }
.tile .role { font-family: var(--sans); font-size: .85rem; letter-spacing: 0; text-transform: none; color: var(--ink-muted); }
.tile p { font-size: .92rem; line-height: 1.55; margin: 1rem 0 0; }
.tile .foot { margin-top: auto; padding-top: 1.3rem; display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.tile .ask { font-family: var(--serif); font-weight: 500; font-size: 1.15rem; letter-spacing: 0; color: var(--ink); }
.tile .ask small { font-size: .64em; font-weight: 500; }
.tile .go { font-family: var(--sans); font-size: .85rem; letter-spacing: 0; text-transform: none; color: var(--accent); }
.tile:hover .go { color: var(--accent-deep); }
@media (max-width: 860px) { .tile { border-right: 0; } }

/* ---------- detail pages ---------- */
.detail-head { padding-block: clamp(2.5rem,6vw,4rem) clamp(2rem,4vw,2.5rem); }
.back { font-family: var(--sans); font-size: .85rem; letter-spacing: 0; text-transform: none; color: var(--ink-muted); text-decoration: none; display: inline-flex; gap: .5rem; align-items: center; margin-bottom: 1.8rem; }
.back:hover { color: var(--ink); }
.back .icon { color: var(--accent); }
.detail-grid { display: grid; grid-template-columns: minmax(0,1.4fr) minmax(0,.6fr); gap: clamp(2rem,5vw,3.5rem); align-items: start; }
@media (max-width: 900px) { .detail-grid { grid-template-columns: 1fr; } }
.facts { border-top: 1px solid var(--line); }
.facts div { display: flex; justify-content: space-between; gap: 1rem; padding: .8rem 0; border-bottom: 1px solid var(--line); }
.facts dt, .facts .k { font-family: var(--sans); font-size: .85rem; letter-spacing: 0; text-transform: none; color: var(--ink-muted); }
.facts dd, .facts .v { margin: 0; font-size: .9rem; font-weight: 600; color: var(--ink); text-align: right; }
.prose p { font-size: 1rem; line-height: 1.65; max-width: 64ch; }
.prose h3 { margin: 2.2rem 0 .9rem; }
.bullets { list-style: none; margin: 0; padding: 0; display: grid; gap: .7rem; }
.bullets li { position: relative; padding-left: 1.5rem; font-size: .95rem; line-height: 1.55; }
.bullets li::before { content: ""; position: absolute; left: 0; top: .62em; width: 12px; height: 1px; background: var(--accent); }
.team { display: grid; grid-template-columns: repeat(auto-fit,minmax(200px,1fr)); border-top: 1px solid var(--line); }
.team div { padding: 1.3rem 1rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.team div:last-child { border-right: 0; }
.team .nm { font-family: var(--sans); font-weight: 600; text-transform: none; font-size: .95rem; letter-spacing: 0; color: var(--ink); }
.team .rl { font-size: .85rem; font-style: normal; color: var(--ink-muted); margin-top: .35rem; }
@media (max-width: 700px) { .team div { border-right: 0; } }

/* ---------- thesis / numbers (unused; kept harmless) ---------- */
.funnel { display: grid; gap: .9rem; margin-bottom: clamp(2rem,4vw,3rem); }
.funnel-row { display: grid; grid-template-columns: minmax(0,10rem) 1fr; gap: 1rem; align-items: center; }
.funnel-row .lbl { font-family: var(--sans); font-size: .85rem; letter-spacing: 0; text-transform: none; color: var(--ink-muted); }
.bar { height: 34px; border: 1px solid var(--ink); position: relative; display: flex; align-items: center; }
.bar i { display: block; height: 100%; background: var(--accent); width: 0; transition: width 1.1s var(--ease); }
.bar span { position: absolute; right: .6rem; font-family: var(--sans); font-size: .8rem; letter-spacing: 0; color: var(--ink); }
@media (max-width: 620px) { .funnel-row { grid-template-columns: 1fr; gap: .35rem; } }

.outcomes { display: grid; grid-template-columns: repeat(auto-fit,minmax(112px,1fr)); border-top: 1px solid var(--ink); }
.outcomes div { padding: 1.2rem .9rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.outcomes div:last-child { border-right: 0; }
.outcomes .sq { width: 100%; height: 46px; border: 1px solid var(--ink); margin-bottom: .8rem; }
.outcomes .cnt { font-family: var(--serif); font-size: 1.5rem; font-weight: 500; letter-spacing: 0; color: var(--ink); line-height: 1; }
.outcomes .lb { font-family: var(--sans); font-size: .8rem; letter-spacing: 0; text-transform: none; color: var(--ink-muted); margin-top: .5rem; }
@media (max-width: 620px) { .outcomes div { border-right: 0; } }

.maths { border: 1px solid var(--ink); padding: clamp(1.3rem,3vw,2rem); margin-top: clamp(2rem,4vw,3rem); }
.maths table { width: 100%; border-collapse: collapse; font-family: var(--sans); font-size: .85rem; }
.maths td, .maths th { padding: .5rem .3rem; text-align: right; border-bottom: 1px solid var(--line-soft); }
.maths th { text-align: right; font-weight: 500; letter-spacing: 0; text-transform: none; font-size: .8rem; color: var(--ink-muted); }
.maths td:first-child, .maths th:first-child { text-align: left; }
.maths tr:last-child td { border-bottom: 0; font-weight: 600; color: var(--ink); border-top: 1px solid var(--ink); padding-top: .7rem; }
.maths .out { display: flex; flex-wrap: wrap; align-items: baseline; gap: .8rem 1.6rem; margin-top: 1.4rem; padding-top: 1.2rem; border-top: 1px solid var(--line); }
.maths .out b { font-family: var(--serif); font-size: clamp(1.6rem,4vw,2.3rem); font-weight: 500; letter-spacing: 0; }

/* ---------- footer ---------- */
footer { border-top: 1px solid var(--ink); padding-block: clamp(2rem,4vw,2.6rem); background: var(--paper); }
.f-in { display: flex; flex-wrap: wrap; gap: 1.2rem 2rem; align-items: baseline; justify-content: space-between; }
.f-mark { font-family: var(--serif); font-weight: 600; text-transform: none; letter-spacing: .01em; font-size: 1.05rem; color: var(--ink); }
.f-nav { display: flex; flex-wrap: wrap; gap: 1rem; }
.f-nav a { font-family: var(--sans); font-size: .85rem; letter-spacing: 0; text-transform: none; color: var(--ink-muted); text-decoration: none; }
.f-nav a:hover { color: var(--ink); }
.f-note { font-family: var(--sans); font-size: .8rem; letter-spacing: 0; color: var(--ink-muted); width: 100%; line-height: 1.7; max-width: 78ch; }

/* ---------- reveal ---------- */
.js .rv { opacity: 0; transform: translateY(14px); }
.js .rv.in { opacity: 1; transform: none; transition: opacity .7s var(--ease), transform .7s var(--ease); }
@media (prefers-reduced-motion: reduce) {
  .js .rv { opacity: 1; transform: none; transition: none; }
}

@media print {
  .top, .theme, .btns { display: none !important; }
  body { background: #fff; color: #000; }
}
