/* Layout: sticky top bar, hero + stats, then label-left / body-right section rows */
:root {
  --bg: #f3f5f4;
  --surface: #ffffff;
  --text: #111715;
  --muted: #4f5b57;
  --faint: #7f8a86;
  --line: #d9e0dd;
  --accent: #0a6b5c;
  --accent-strong: #07574a;
  --accent-soft: #e0efeb;
  --on-accent: #ffffff;
  --display: "Bricolage Grotesque", "Helvetica Neue", Arial, sans-serif;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --serif: var(--display);
  --max: 1120px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1211; --surface: #141b19; --text: #e4ebe8; --muted: #a0aca7; --faint: #6f7b77;
    --line: #243029; --accent: #5cc4ad; --accent-strong: #7dd6c1; --accent-soft: #15302a; --on-accent: #06201a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1211; --surface: #141b19; --text: #e4ebe8; --muted: #a0aca7; --faint: #6f7b77;
  --line: #243029; --accent: #5cc4ad; --accent-strong: #7dd6c1; --accent-soft: #15302a; --on-accent: #06201a;
  color-scheme: dark;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
strong { font-weight: 600; }
.muted { color: var(--faint); }

.skip {
  position: absolute; left: 16px; top: -48px; z-index: 20;
  background: var(--text); color: var(--bg);
  padding: 8px 12px; border-radius: 6px;
}
.skip:focus { top: 12px; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 32px; } }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px;
  font: 600 0.94rem/1 var(--sans);
  color: var(--on-accent); background: var(--accent);
  border: 1px solid var(--accent); border-radius: 999px;
  cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--accent-strong); border-color: var(--accent-strong); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface); border-color: var(--text); color: var(--text); }
.btn-small { min-height: 36px; padding: 8px 14px; font-size: 0.86rem; }
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Top bar */
.bar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.bar-inner {
  max-width: var(--max); margin: 0 auto;
  display: flex; align-items: center; gap: 24px;
  height: 60px; padding: 0 16px;
}
@media (min-width: 720px) { .bar-inner { padding: 0 32px; } }
.brand { font: 600 1.15rem var(--serif); color: var(--text); margin-right: auto; }
.brand:hover { text-decoration: none; }
.nav { display: none; gap: 4px; }
@media (min-width: 760px) { .nav { display: flex; } }
.nav a {
  color: var(--muted); font-size: 0.9rem; font-weight: 500;
  padding: 6px 10px; border-radius: 999px;
}
.nav a:hover { color: var(--text); text-decoration: none; }
.nav a.active { color: var(--text); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }

/* Hero */
.hero {
  display: grid; gap: 32px;
  padding-top: 56px; padding-bottom: 40px;
}
@media (min-width: 900px) {
  .hero { grid-template-columns: minmax(0, 1fr) 300px; align-items: center; gap: 64px; padding-top: 96px; padding-bottom: 64px; }
}
.eyebrow {
  margin: 0 0 16px;
  font-family: var(--mono); font-size: 0.8rem; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--accent);
}
.hero h1 {
  font: 600 clamp(2.1rem, 5.4vw, 3.5rem)/1.06 var(--display);
  letter-spacing: -0.03em;
  margin: 0 0 20px;
  text-wrap: balance;
}
.hero-sub { font-size: 1.1rem; color: var(--muted); max-width: 60ch; margin: 0 0 28px; }
.hero-sub strong { color: var(--text); }
.cta { display: flex; flex-wrap: wrap; gap: 10px; }

.hero-photo { margin: 0; order: -1; }
@media (min-width: 900px) { .hero-photo { order: 0; } }
.hero-photo img {
  display: block; width: 96px; height: 96px;
  border-radius: 50%; object-fit: cover; background: var(--line);
}
@media (min-width: 900px) {
  .hero-photo img { width: 300px; height: 340px; border-radius: 20px; object-position: 50% 30%; }
}
.hero-photo figcaption { display: none; }
@media (min-width: 900px) {
  .hero-photo figcaption { display: block; margin-top: 12px; font-size: 0.85rem; color: var(--faint); }
}

/* Stats */
.stats {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
@media (min-width: 900px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stats li { padding: 22px 16px 22px 0; }
.stats li + li { padding-left: 16px; border-left: 1px solid var(--line); }
@media (max-width: 899px) {
  .stats li:nth-child(3) { border-left: 0; padding-left: 0; }
  .stats li:nth-child(n+3) { border-top: 1px solid var(--line); }
}
.stats strong { display: block; font: 600 clamp(1.6rem, 3.4vw, 2.2rem)/1.1 var(--serif); margin-bottom: 6px; }
.stats span { display: block; font-size: 0.86rem; color: var(--muted); line-height: 1.45; }

/* Section blocks: label left, body right */
.block { display: grid; gap: 20px; padding-top: 72px; }
@media (min-width: 900px) { .block { grid-template-columns: 200px minmax(0, 1fr); gap: 48px; padding-top: 104px; } }
.label {
  margin: 0;
  font: 500 0.78rem/1.4 var(--mono); letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--faint);
}
@media (min-width: 900px) { .label { position: sticky; top: 92px; align-self: start; } }
.body { min-width: 0; }
h3 { font: 600 1.06rem/1.35 var(--sans); margin: 0; }
.note { margin: 0 0 16px; font-size: 0.86rem; color: var(--faint); }

/* Approach */
.approach { list-style: none; margin: 0; padding: 0; display: grid; gap: 28px 40px; }
@media (min-width: 640px) { .approach { grid-template-columns: 1fr 1fr; } }
.step { display: block; font: 500 0.8rem var(--mono); color: var(--accent); margin-bottom: 8px; font-variant-numeric: tabular-nums; }
.approach h3 { margin-bottom: 6px; }
.approach p { margin: 0; color: var(--muted); }

/* Cards */
.cards { display: grid; gap: 14px; }
@media (min-width: 640px) { .cards { grid-template-columns: 1fr 1fr; } .card-wide { grid-column: 1 / -1; } }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 22px;
  transition: border-color .15s, transform .15s;
}
.card:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.tag {
  display: inline-block; margin: 0 0 12px;
  font-family: var(--mono); font-size: 0.72rem; font-weight: 500;
  color: var(--accent); background: var(--accent-soft);
  padding: 3px 8px; border-radius: 4px;
}
.card h3 { margin-bottom: 8px; }
.card p:last-child { margin: 0; color: var(--muted); font-size: 0.95rem; }

/* Experience */
.job { padding: 0 0 32px; }
.job + .job { padding-top: 32px; border-top: 1px solid var(--line); }
.job-head h3 { font: 600 1.4rem/1.2 var(--serif); }
.job-head p { margin: 4px 0 16px; font-size: 0.92rem; }
.roles {
  list-style: none; margin: 0 0 18px; padding: 0 0 0 18px;
  border-left: 2px solid var(--line);
  display: grid; gap: 10px;
}
.roles li { position: relative; display: flex; flex-wrap: wrap; gap: 2px 12px; justify-content: space-between; }
.roles li::before {
  content: ""; position: absolute; left: -24px; top: 8px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--faint);
}
.roles li:first-child::before { background: var(--accent); border-color: var(--accent); }
.role-title { font-weight: 600; }
.role-date { color: var(--faint); font-family: var(--mono); font-size: 0.82rem; font-variant-numeric: tabular-nums; }
.points { margin: 0; padding-left: 18px; color: var(--muted); }
.points li + li { margin-top: 8px; }
.points li::marker { color: var(--faint); }

/* Skills */
.skills { margin: 0; }
.skills > div { display: grid; gap: 2px 32px; padding: 14px 0; border-top: 1px solid var(--line); }
.skills > div:first-child { border-top: 0; padding-top: 0; }
@media (min-width: 640px) { .skills > div { grid-template-columns: 180px minmax(0, 1fr); } }
.skills dt { font-weight: 600; font-size: 0.94rem; }
.skills dd { margin: 0; color: var(--muted); }

/* Lab + creds */
.lab, .creds { list-style: none; margin: 0; padding: 0; }
.lab li { padding: 14px 0; border-top: 1px solid var(--line); color: var(--muted); }
.lab li:first-child { border-top: 0; padding-top: 0; }
.lab strong { color: var(--text); }
.creds li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 16px; padding: 12px 0; border-top: 1px solid var(--line); }
.creds li:first-child { border-top: 0; padding-top: 0; }
.creds li span:first-child { font-weight: 500; }
.creds .muted { font-size: 0.9rem; }

/* Contact */
.contact-block {
  margin-top: 104px;
  padding-top: 48px; padding-bottom: 48px;
  text-align: left;
}
.contact-block h2 {
  font: 500 clamp(1.6rem, 3.6vw, 2.4rem)/1.15 var(--serif);
  letter-spacing: -0.01em; margin: 0 0 12px; max-width: 22ch; text-wrap: balance;
}
.contact-block p { color: var(--muted); margin: 0 0 24px; max-width: 56ch; }
.contact-block .btn { overflow-wrap: anywhere; }

.foot { padding-top: 24px; padding-bottom: 40px; border-top: 1px solid var(--line); font-size: 0.86rem; color: var(--faint); }
.foot p { margin: 0; }

/* Print: compact CV */
@media print {
  @page { margin: 14mm 15mm; }
  :root {
    --bg: #fff; --surface: #fff; --text: #111; --muted: #333; --faint: #666;
    --line: #ddd; --accent: #933f1c; --accent-soft: #fff;
  }
  html { scroll-padding-top: 0; }
  body { font-size: 9.6pt; line-height: 1.45; }
  .bar, .skip, .cta, .stats, #approach, .contact-block, .note, .hero-photo figcaption { display: none !important; }
  .wrap { padding: 0; max-width: none; }
  .hero { display: grid; grid-template-columns: 1fr 70px; gap: 16px; padding: 0 0 8px; align-items: start; }
  .hero-photo { order: 0; }
  .hero-photo img { width: 70px; height: 70px; border-radius: 50%; }
  .hero h1 { font-size: 15pt; margin-bottom: 6px; }
  .hero h1::before { content: "Morgan Atkins"; display: block; font-size: 22pt; font-weight: 600; margin-bottom: 4px; }
  .hero-sub { font-size: 9.6pt; margin: 0; max-width: none; }
  .hero-sub::after { content: " · morgan.atkins@mea-tech.co.uk · linkedin.com/in/morgan-thomas-atkins · Newport, Wales"; color: #666; }
  .block { display: block; padding-top: 14px; }
  .label { position: static; margin-bottom: 8px; color: #444; border-bottom: 1px solid #ddd; padding-bottom: 4px; }
  .cards { grid-template-columns: 1fr 1fr; gap: 6px; }
  .card { padding: 8px 10px; border-radius: 6px; break-inside: avoid; }
  .tag { padding: 0; margin-bottom: 2px; }
  .card p:last-child { font-size: 9pt; }
  .job { padding-bottom: 10px; break-inside: avoid; }
  .job + .job { padding-top: 10px; }
  .job-head h3 { font-size: 12pt; }
  .job-head p { margin-bottom: 6px; }
  .roles { margin-bottom: 6px; gap: 2px; }
  .points li + li { margin-top: 2px; }
  .skills > div { grid-template-columns: 130px 1fr; padding: 4px 0; }
  .lab li, .creds li { padding: 4px 0; }
  .foot { border: 0; padding: 8px 0 0; }
  a { color: inherit; }
}
