/* Layout: fixed left rail (identity + section nav) beside one long reading column;
   the rail collapses to a sticky top bar on narrow screens. */

:root {
  --paper: #f3f6f7;
  --surface: #ffffff;
  --ink: #132235;
  --muted: #55657a;
  --line: #d3dbe2;
  --accent: #0b6b5d;
  --accent-soft: #dcefeb;
  --on-accent: #ffffff;
  --gold: #a96a12;

  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Instrument Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --rail: 15rem;
  --gutter: clamp(1rem, 4vw, 3rem);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0d151e;
    --surface: #15212e;
    --ink: #e6ecf2;
    --muted: #94a4b6;
    --line: #27384b;
    --accent: #56c7b2;
    --accent-soft: #143a37;
    --on-accent: #06211d;
    --gold: #e2ab4f;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --paper: #0d151e;
  --surface: #15212e;
  --ink: #e6ecf2;
  --muted: #94a4b6;
  --line: #27384b;
  --accent: #56c7b2;
  --accent-soft: #143a37;
  --on-accent: #06211d;
  --gold: #e2ab4f;
  color-scheme: dark;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 1.5rem;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
}

h1,
h2,
h3,
h4,
p,
ul,
ol,
dl,
dd {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

h1,
h2,
h3,
h4 {
  text-wrap: balance;
}

a {
  color: var(--accent);
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-thickness: 2px;
}

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

.skip {
  position: absolute;
  left: -999rem;
  top: 0.5rem;
  z-index: 10;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: var(--on-accent);
}

.skip:focus {
  left: 0.5rem;
}

/* ---------- Shell ---------- */

.shell {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  gap: var(--gutter);
  max-width: 72rem;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.side {
  position: sticky;
  top: 0;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  height: 100vh;
  padding-block: 2.5rem;
}

.side-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  flex: none;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.6rem;
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--font-display);
  font-weight: 700;
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
}

.brand-role {
  color: var(--muted);
  font-size: 0.8125rem;
}

.theme-toggle {
  display: grid;
  place-items: center;
  flex: none;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.theme-toggle:hover {
  color: var(--ink);
  border-color: var(--muted);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  border-left: 1px solid var(--line);
}

.nav a {
  margin-left: -1px;
  padding: 0.35rem 0 0.35rem 1rem;
  border-left: 2px solid transparent;
  color: var(--muted);
  font-size: 0.9375rem;
  text-decoration: none;
}

.nav a:hover {
  color: var(--ink);
}

.nav a[aria-current="true"] {
  border-left-color: var(--accent);
  color: var(--ink);
  font-weight: 600;
}

/* ---------- Main column ---------- */

main {
  display: flex;
  flex-direction: column;
  gap: 4.5rem;
  min-width: 0;
  padding-block: 4rem 3rem;
}

main > section {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

h2 {
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.section-intro,
.prose {
  max-width: 65ch;
}

.section-intro {
  color: var(--muted);
}

.prose {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  font-size: 1.0625rem;
}

.sub {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---------- Hero ---------- */

.hero {
  gap: 1.5rem;
}

.portrait {
  width: 8.5rem;
  height: 8.5rem;
  max-width: 100%;
  border-radius: 1.25rem;
  object-fit: cover;
  background: var(--line);
}

[hidden] {
  display: none !important;
}

.eyebrow {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.02em;
}

h1 {
  max-width: 18ch;
  font-family: var(--font-display);
  font-size: clamp(2.25rem, 1.4rem + 3.6vw, 4rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.04;
}

.lede {
  max-width: 60ch;
  color: var(--muted);
  font-size: 1.125rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.btn {
  display: inline-block;
  padding: 0.65rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}

.btn:hover {
  border-color: var(--muted);
}

.btn-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
}

.btn-primary:hover {
  border-color: var(--accent);
  filter: brightness(1.08);
}

/* The route: four stops joined by a line, dot per stop */
.journey {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 1.5rem;
}

.journey li {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 1.5rem 1rem 0 0;
  border-top: 2px solid var(--line);
}

.journey li::before {
  content: "";
  position: absolute;
  top: -0.4375rem;
  left: 0;
  width: 0.75rem;
  height: 0.75rem;
  border: 2px solid var(--gold);
  border-radius: 50%;
  background: var(--paper);
}

.journey li.is-now::before {
  background: var(--gold);
}

.journey-years {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.journey-place {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.25;
}

.journey-what {
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.35;
}

/* ---------- Tags ---------- */

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tags li {
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.875rem;
}

/* ---------- Timeline (experience, education) ---------- */

.timeline {
  display: flex;
  flex-direction: column;
}

.timeline > li {
  display: grid;
  grid-template-columns: 10.5rem minmax(0, 1fr);
  gap: 1.5rem;
  padding-block: 1.25rem;
  border-bottom: 1px solid var(--line);
}

.timeline > li:first-child {
  padding-top: 0;
}

.timeline > li:last-child {
  border-bottom: 0;
}

.when {
  padding-top: 0.2rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}

.timeline > li > div {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
  max-width: 62ch;
}

.timeline h3 {
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.35;
}

.org {
  color: var(--accent);
  font-size: 0.9375rem;
  font-weight: 500;
}

.timeline ul {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-top: 0.25rem;
  padding-left: 1.1rem;
  list-style: disc;
  color: var(--muted);
}

.timeline div > p:not(.org) {
  color: var(--muted);
}

/* ---------- Events ---------- */

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.filter {
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.875rem;
  cursor: pointer;
}

.filter:hover {
  border-color: var(--muted);
}

.filter[aria-pressed="true"] {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

.filter-count {
  margin-left: 0.25rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

.years {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.year {
  display: grid;
  grid-template-columns: 5rem minmax(0, 1fr);
  gap: 1.5rem;
}

.year-label {
  position: sticky;
  top: 1.5rem;
  align-self: start;
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.events {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--line);
}

.ev {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr) auto;
  align-items: start;
  gap: 0.35rem 1.25rem;
  padding-block: 1rem;
  border-bottom: 1px solid var(--line);
}

.ev-date {
  padding-top: 0.15rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}

.ev-body {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.ev-body h4 {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.35;
}

.ev-where {
  font-size: 0.875rem;
  font-weight: 500;
}

.ev-body p:not(.ev-where) {
  max-width: 62ch;
  color: var(--muted);
  font-size: 0.9375rem;
}

.chip {
  padding: 0.2rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}

.ev[data-kind="led"] .chip {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
}

.ev[data-kind="organised"] .chip {
  border-color: transparent;
  background: var(--accent-soft);
  color: var(--ink);
}

/* ---------- Projects ---------- */

.projects {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: 1rem;
}

.project {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: var(--surface);
}

.project-meta {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.project h3 {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.25;
}

.project > p:not(.project-meta):not(.project-role) {
  color: var(--muted);
  font-size: 0.9375rem;
}

.project-role {
  margin-top: auto;
  padding-top: 0.5rem;
  color: var(--accent);
  font-size: 0.8125rem;
  font-weight: 600;
}

/* ---------- Skills ---------- */

.skills {
  display: flex;
  flex-direction: column;
}

.skills > div {
  display: grid;
  grid-template-columns: 14rem minmax(0, 1fr);
  align-items: start;
  gap: 0.75rem 1.5rem;
  padding-block: 1rem;
  border-bottom: 1px solid var(--line);
}

.skills > div:first-child {
  padding-top: 0;
}

.skills > div:last-child {
  border-bottom: 0;
}

.skills dt {
  padding-top: 0.3rem;
  font-weight: 600;
}

/* ---------- Certificates ---------- */

.certs {
  columns: 2 18rem;
  column-gap: 2.5rem;
}

.certs li {
  padding-block: 0.6rem;
  border-bottom: 1px solid var(--line);
  break-inside: avoid;
}

.certs span {
  display: block;
  color: var(--muted);
  font-size: 0.8125rem;
}

/* ---------- Press, contact, footer ---------- */

.press {
  display: flex;
  flex-direction: column;
}

.press li {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding-block: 0.85rem;
  border-bottom: 1px solid var(--line);
}

.press li:first-child {
  padding-top: 0;
}

.press a {
  font-weight: 600;
}

.press span {
  color: var(--muted);
  font-size: 0.8125rem;
}

.contact {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  font-size: 1.0625rem;
}

.contact li {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr);
  gap: 1rem;
  align-items: baseline;
}

.contact a,
.contact li > span:last-child {
  overflow-wrap: anywhere;
}

.contact-label {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.aside {
  max-width: 65ch;
  color: var(--muted);
  font-size: 0.9375rem;
}

.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.875rem;
}

/* ---------- Narrow screens ---------- */

@media (max-width: 56rem) {
  html {
    scroll-padding-top: 7rem;
  }

  .shell {
    display: block;
  }

  .side {
    z-index: 5;
    height: auto;
    gap: 0.75rem;
    margin-inline: calc(var(--gutter) * -1);
    padding: 0.75rem var(--gutter);
    border-bottom: 1px solid var(--line);
    background: var(--paper);
  }

  .nav {
    flex-direction: row;
    gap: 1.25rem;
    margin-inline: calc(var(--gutter) * -1);
    padding-inline: var(--gutter);
    border-left: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .nav::-webkit-scrollbar {
    display: none;
  }

  .nav a {
    flex: none;
    margin: 0;
    padding: 0.25rem 0;
    border-left: 0;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
  }

  .nav a[aria-current="true"] {
    border-bottom-color: var(--accent);
  }

  main {
    gap: 3.5rem;
    padding-block: 2.5rem 2rem;
  }

  .year-label {
    top: 7rem;
  }
}

@media (max-width: 40rem) {
  .journey {
    grid-template-columns: 1fr;
    margin-left: 0.375rem;
  }

  .journey li {
    padding: 0 0 1.25rem 1.5rem;
    border-top: 0;
    border-left: 2px solid var(--line);
  }

  .journey li:last-child {
    padding-bottom: 0;
  }

  .journey li::before {
    top: 0.25rem;
    left: -0.4375rem;
  }

  .timeline > li,
  .skills > div,
  .year {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .year-label {
    position: static;
  }

  .ev {
    grid-template-columns: 1fr;
  }

  .chip {
    justify-self: start;
    margin-top: 0.25rem;
  }

  .contact li {
    grid-template-columns: 1fr;
    gap: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

/* ---------- Print: a clean CV ---------- */

@media print {
  :root,
  :root[data-theme="dark"],
  :root:not([data-theme="light"]) {
    --paper: #ffffff;
    --surface: #ffffff;
    --ink: #000000;
    --muted: #333333;
    --line: #bbbbbb;
    --accent: #0b6b5d;
    --accent-soft: #eeeeee;
    --on-accent: #ffffff;
    --gold: #000000;
    color-scheme: light;
  }

  body {
    font-size: 10.5pt;
  }

  .shell {
    display: block;
    max-width: none;
    padding: 0;
  }

  .side,
  .skip,
  .hero-actions,
  .filters {
    display: none;
  }

  main {
    gap: 1.75rem;
    padding: 0;
  }

  h1 {
    font-size: 22pt;
  }

  h2 {
    font-size: 14pt;
    break-after: avoid;
  }

  .ev,
  .timeline > li,
  .project {
    break-inside: avoid;
  }

  .ev[hidden] {
    display: grid !important;
  }

  .year-label {
    position: static;
  }

  a {
    color: inherit;
    text-decoration: none;
  }
}
