/* Three chosen finalists: 01 RFC Base, 02 Studio Grid, 03 Timeline (with Front Matter title plate). */

/* ---------- 01 · RFC BASE & 03-08 · TIMELINE · Space Grotesk + JetBrains Mono ---------- */
body[data-opt="1"],
body[data-fm="1"] {
  --paper: #fcfcfc;
  --bar-bg: rgba(252, 252, 252, 0.92);
  --ink-1: #121314;
  --ink-2: #27292c;
  --ink-3: #545652;
  --rule: rgba(18, 19, 20, 0.14);
  --rule-strong: rgba(18, 19, 20, 0.26);
  --tone: rgba(18, 19, 20, 0.06);
  --tone-active: rgba(18, 19, 20, 0.09);
  --f-display: "Space Grotesk", system-ui, sans-serif;
  --f-body: "JetBrains Mono", ui-monospace, monospace;
  --f-mono: "JetBrains Mono", ui-monospace, monospace;
  --f-lead: "JetBrains Mono", ui-monospace, monospace;
  --mono-features: "zero" 1;
  --bullet-glyph: "›";
}

body[data-opt="1"] {
  --name-size: 56px;
  --kpi-size: 25px;
  --body-size: 13px;
  --body-lh: 1.68;
}

/* ---------- 02 · STUDIO GRID · Schibsted Grotesk + Spline Sans Mono (Round 2 pick) ---------- */
body[data-opt="2"] {
  --paper: #fcfcfd;
  --bar-bg: rgba(252, 252, 253, 0.92);
  --ink-1: #0f1115;
  --ink-2: #282b33;
  --ink-3: #515662;
  --rule: rgba(15, 17, 21, 0.13);
  --rule-strong: rgba(15, 17, 21, 0.24);
  --tone: rgba(15, 17, 21, 0.06);
  --tone-active: rgba(15, 17, 21, 0.09);
  --f-display: "Schibsted Grotesk", system-ui, sans-serif;
  --f-body: "Spline Sans Mono", ui-monospace, monospace;
  --f-mono: "Spline Sans Mono", ui-monospace, monospace;
  --f-lead: "Spline Sans Mono", ui-monospace, monospace;
  --mono-features: "tnum" 1;
  --bullet-glyph: "·";
  --name-size: 58px;
  --name-lh: 1;
  --kpi-size: 26px;
  --body-size: 13px;
  --body-lh: 1.7;
}

/* ---------- 03-08 · TIMELINE · Front Matter Title Plate + Left Date & Location Gutter ---------- */
body[data-fm="1"] {
  --sheet-w: 780px;
  --name-size: 64px;
  --name-lh: 1;
  --kpi-size: 24px;
  --body-size: 13px;
  --body-lh: 1.68;
  --sec-pt: 56px;
  --co-gap: 44px;
  --role-gap: 32px;
  --li-gap: 10px;
}

body[data-fm="1"] .m-sheet { --tab-col: 160px; }

/* Serene Front Matter opening title plate */
body[data-fm="1"] .m-head {
  position: relative;
  min-height: 62vh;
  padding: 40px 0 80px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

body[data-fm="1"] .m-title {
  margin-top: 20px;
  font-size: 18px;
  line-height: 1.35;
  color: var(--ink-1);
}

body[data-fm="1"] .m-org {
  margin-top: 4px;
  font-family: var(--f-display);
  font-size: 15px;
  line-height: 1.4;
  color: var(--ink-3);
}

body[data-fm="1"] .theme-toggle {
  margin: 28px auto 0;
}

body[data-fm="1"] .m-foot-tag {
  margin-top: 20px;
  text-align: left;
}

body[data-fm="1"] .m-foot-imprint {
  margin-top: 12px;
  font-family: var(--f-mono);
  font-size: 12px;
  line-height: 1.6;
  font-variant-numeric: lining-nums tabular-nums;
  font-feature-settings: "zero" 1;
  color: var(--ink-3);
  text-align: left;
}

body[data-fm="1"] .m-foot-links {
  margin-top: 6px;
  text-align: left;
}

body[data-fm="1"] .m-folio {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--f-mono);
  font-size: 12px;
  font-variant-numeric: lining-nums tabular-nums;
  color: var(--ink-3);
}

/* Profile KPIs placed calmly inside Summary below the cover plate */
body[data-fm="1"] .m-sec-facts {
  margin: 20px 0 0;
  padding: 4px 0 8px;
}

body[data-fm="1"] .m-sec[data-sec="experience"] {
  padding-top: 40px;
}

body[data-fm="1"] .m-fig { align-items: flex-start; }
body[data-fm="1"] .m-foot { text-align: left; }

body[data-fm="1"] .m-co-row {
  display: grid;
  grid-template-columns: var(--tab-col) minmax(0, 1fr);
  gap: 24px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule);
}

body[data-fm="1"] .m-co-row .m-co-name { grid-column: 2; grid-row: 1; }
body[data-fm="1"] .m-co-row .m-meta { grid-column: 1; grid-row: 1; }
body[data-fm="1"] .m-co-row + .m-role { margin-top: 16px; }

body[data-fm="1"] .m-role {
  display: grid;
  grid-template-columns: var(--tab-col) minmax(0, 1fr);
  column-gap: 24px;
  align-items: baseline;
}

body[data-fm="1"] .m-role > .m-row { display: contents; }
body[data-fm="1"] .m-role > .m-row > .m-meta { grid-column: 1; grid-row: 1; padding-top: 3px; }
body[data-fm="1"] .m-role > .m-row > .m-role-t { grid-column: 2; grid-row: 1; }
body[data-fm="1"] .m-role > .m-scope,
body[data-fm="1"] .m-role > .m-list { grid-column: 2; }

body[data-fm="1"] .m-edu-row {
  display: grid;
  grid-template-columns: var(--tab-col) minmax(0, 1fr);
  gap: 24px;
  align-items: baseline;
}

body[data-fm="1"] .m-edu-row .m-meta { grid-column: 1; grid-row: 1; }
body[data-fm="1"] .m-edu-row .m-role-t { grid-column: 2; grid-row: 1; }
body[data-fm="1"] .m-lang { padding-left: calc(var(--tab-col) + 24px); }

/* Explicit dark-theme overrides for toggle and automated dark probe. */
:is(html[data-theme="dark"], html.dark) body[data-opt] {
  --paper: #0d0e0f;
  --bar-bg: rgba(13, 14, 15, 0.9);
  --ink-1: #f2f2ef;
  --ink-2: #c8cac6;
  --ink-3: #9a9d98;
  --rule: rgba(242, 242, 239, 0.16);
  --rule-strong: rgba(242, 242, 239, 0.34);
  --tone: rgba(242, 242, 239, 0.08);
  --tone-active: rgba(242, 242, 239, 0.14);
}

:is(html[data-theme="dark"], html.dark) body[data-opt="2"] {
  --paper: #0c0e12;
  --bar-bg: rgba(12, 14, 18, 0.9);
}

/* High-contrast readability boost (adapts automatically to light & dark modes) */
html[data-contrast="high"] body[data-opt] {
  --paper: #ffffff;
  --bar-bg: rgba(255, 255, 255, 0.96);
  --ink-1: #000000;
  --ink-2: #0a0b0c;
  --ink-3: #2a2c2f;
  --rule: rgba(0, 0, 0, 0.28);
  --rule-strong: rgba(0, 0, 0, 0.56);
  --tone: rgba(0, 0, 0, 0.08);
  --tone-active: rgba(0, 0, 0, 0.14);
}

:is(html[data-theme="dark"], html.dark)[data-contrast="high"] body[data-opt] {
  --paper: #000000;
  --bar-bg: rgba(0, 0, 0, 0.96);
  --ink-1: #ffffff;
  --ink-2: #f0f0ee;
  --ink-3: #cbcdc9;
  --rule: rgba(255, 255, 255, 0.30);
  --rule-strong: rgba(255, 255, 255, 0.62);
  --tone: rgba(255, 255, 255, 0.12);
  --tone-active: rgba(255, 255, 255, 0.20);
}

@media (max-width: 760px) {
  body[data-opt] {
    --name-size: 40px;
    --kpi-size: 20px;
  }

  body[data-fm="1"] .m-head {
    min-height: 52vh;
    padding: 32px 0 64px;
  }

  body[data-fm="1"] .m-co-row,
  body[data-fm="1"] .m-role,
  body[data-fm="1"] .m-role > .m-row,
  body[data-fm="1"] .m-edu-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  body[data-fm="1"] .m-lang { padding-left: 0; }
  body[data-fm="1"] .m-foot-links { justify-content: flex-start; }
}

@media print {
  body[data-fm="1"] .m-head {
    min-height: 0;
    padding: 16px 0 32px;
  }

  body[data-fm="1"] .m-folio {
    display: none;
  }
}
