:root {
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, monospace;

  --max-width: 760px;
}

/* Dark is the default. */
:root,
:root[data-theme="dark"] {
  --bg: #0E1B2A;
  --bg-raised: #142334;
  --line: #26384E;
  --text: #EDEAE1;
  --text-dim: #9FB0C3;
  --text-faint: #6C7E92;
  --accent: #4FBFA5;
  --accent-dim: #2E5A4F;
  --gold: #C9A961;
  --chip-bg: #FFFFFF;
}

/* Warm paper light theme, keeping the ledger feel. */
:root[data-theme="light"] {
  --bg: #F6F3EC;
  --bg-raised: #FFFFFF;
  --line: #DCD4C4;
  --text: #16202B;
  --text-dim: #475665;
  --text-faint: #63707C;
  --accent: #1C7A64;
  --accent-dim: #A9CFC4;
  --gold: #8A6A28;
  --chip-bg: #FFFFFF;
}

/* Dark is the default for everyone; light is opt-in via the toggle. */

* { box-sizing: border-box; }

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
a:hover, a:focus-visible { border-bottom-color: var(--accent); }

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

.ledger-strip {
  height: 4px;
  width: 100%;
  background: repeating-linear-gradient(
    90deg,
    var(--accent) 0px, var(--accent) 24px,
    var(--gold) 24px, var(--gold) 32px,
    transparent 32px, transparent 56px
  );
  opacity: 0.85;
}

main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 48px 24px 80px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 40px;
}

.built-with {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 0;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.cv-download {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: transparent;
  border: 1px solid var(--accent-dim);
  border-bottom-color: var(--accent-dim);
  border-radius: 999px;
  padding: 5px 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.cv-download:hover,
.cv-download:focus-visible {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

.theme-toggle {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}
.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent-dim);
}
.theme-toggle .toggle-icon {
  font-size: 12px;
  line-height: 1;
}
/* Show the label for the mode you'd switch to. */
.theme-toggle .label-light { display: none; }
.theme-toggle .label-dark { display: inline; }
:root[data-theme="light"] .theme-toggle .label-light { display: inline; }
:root[data-theme="light"] .theme-toggle .label-dark { display: none; }

/* Masthead */
.masthead {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 32px;
}

.headshot {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent-dim);
  flex-shrink: 0;
}

.masthead-text h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 40px;
  line-height: 1.1;
  margin: 0 0 6px;
  color: var(--text);
}

.role-line {
  font-size: 17px;
  color: var(--accent);
  margin: 0 0 10px;
  font-weight: 500;
}

.meta {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-dim);
  margin: 0 0 14px;
}
.meta .dot { margin: 0 8px; color: var(--text-faint); }

.links {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}
.links a {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-dim);
}
.links a:hover, .links a:focus-visible { color: var(--accent); border-bottom-color: var(--accent); }

/* Intro */
.intro {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 28px 0;
}
.intro p {
  font-size: 17px;
  color: var(--text);
  margin: 0 0 16px;
  max-width: 60ch;
}
.intro-points {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.intro-points li {
  position: relative;
  padding-left: 20px;
  color: var(--text-dim);
  font-size: 15px;
}
.intro-points li::before {
  content: "\2192";
  position: absolute;
  left: 0;
  color: var(--accent);
}

/* Section headings */
.section { margin-top: 56px; }
.section-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 20px;
  line-height: 1.3;
}
.ledger-no {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1;
  color: var(--accent);
  border: 1px solid var(--accent-dim);
  border-radius: 3px;
  padding: 5px 7px 4px;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

/* Core strengths — always visible, two columns */
.strength-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px 28px;
}
.strength {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.strength-title {
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--accent);
  margin: 0 0 12px;
}
.strength ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.strength li {
  position: relative;
  padding-left: 17px;
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.5;
}
.strength li::before {
  content: "+";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
}

/* Timeline */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 30px;
}
.role {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr) auto;
  grid-template-areas:
    "mark head stat"
    "mark body body";
  column-gap: 16px;
}
.role-mark { grid-area: mark; align-self: start; }
.role-head { grid-area: head; }
.role-stat { grid-area: stat; }
.role-body { grid-area: body; min-width: 0; }

.role-mark {
  position: relative;
  width: 84px;
  height: 40px;
  border-radius: 6px;
  background: var(--chip-bg);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 6px 8px;
  margin-top: 3px;
}
.role-logo {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  /* Wordmarks differ in aspect ratio, so each can be nudged for optical balance. */
  transform: scale(var(--logo-scale, 1));
  transform-origin: center;
}
.role-monogram {
  display: none;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 16px;
  color: var(--mark);
}
/* Fallback state, applied by script.js when a logo file is missing */
.role-mark.no-logo {
  width: 40px;
  background: color-mix(in srgb, var(--mark) 28%, var(--bg-raised));
  border-color: color-mix(in srgb, var(--mark) 50%, transparent);
}
.role-mark.no-logo .role-logo { display: none; }
.role-mark.no-logo .role-monogram { display: block; }

.role-body { flex: 1; min-width: 0; }

.role-head {
  margin-bottom: 6px;
}
.role-head h3 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 3px;
  color: var(--text);
}
.role-sub {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-faint);
  margin: 0;
}

.role-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
  border-left: 1px solid var(--line);
  padding-left: 14px;
  flex-shrink: 0;
}
.stat-value {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 17px;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}
.stat-label {
  font-size: 11px;
  color: var(--text-faint);
  max-width: 15ch;
  line-height: 1.3;
}

.role-context {
  font-size: 13.5px;
  font-style: italic;
  color: var(--text-faint);
  margin: 4px 0 10px;
}

.role-body ul {
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--text-dim);
  font-size: 14.5px;
}
.role-body li { margin-bottom: 7px; }
.role-body li:last-child { margin-bottom: 0; }

.role-compact .role-head { margin-bottom: 0; }
.role-compact .role-context { margin-bottom: 0; }

/* Education */
.education {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.edu-row h3 {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  margin: 0 0 3px;
}
.edu-row .role-context { margin-bottom: 0; }
.edu-row ul {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--text-dim);
  font-size: 14.5px;
}
.edu-row li { margin-bottom: 6px; }
.edu-row li:last-child { margin-bottom: 0; }

/* Footer */
.site-footer {
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.site-footer p {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
  margin: 0;
}

/* Responsive */
@media (max-width: 620px) {
  main { padding: 32px 18px 64px; }
  .masthead { flex-direction: column; align-items: flex-start; }
  .masthead-text h1 { font-size: 32px; }
  .strength-grid { grid-template-columns: 1fr; gap: 18px; }

  /* Stat moves under the logo, sharing the left column. */
  .role {
    grid-template-columns: 84px minmax(0, 1fr);
    grid-template-areas:
      "mark head"
      "stat body";
    column-gap: 14px;
  }
  .role-stat {
    align-items: flex-start;
    text-align: left;
    border-left: none;
    padding-left: 0;
    padding-top: 10px;
    margin-top: 2px;
  }
  .stat-value { font-size: 15px; }
  .stat-label { max-width: none; font-size: 10.5px; }
  .role-body ul { margin-top: 8px; }
}
