/* Paint buckets. Components never hard-code a color. */
:root,
html[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f1ea;
  --surface: #fffcf7;
  --text: #1c1917;
  --muted: #57534e;
  --accent: #0f5248;
  --on-accent: #f4fffb;
  --line: #e4dcd0;
  --header: #10211e;
  --header-text: #f4f1ea;
  --header-muted: #c9ddd6;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101413;
  --surface: #1a211f;
  --text: #f3efe7;
  --muted: #c4bdb2;
  --accent: #8fd9c8;
  --on-accent: #06211c;
  --line: #2e3b37;
  --header: #0b100f;
  --header-text: #f3efe7;
  --header-muted: #b7c9c2;
}

html[data-theme="system"] {
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  html[data-theme="system"] {
    --bg: #101413;
    --surface: #1a211f;
    --text: #f3efe7;
    --muted: #c4bdb2;
    --accent: #8fd9c8;
    --on-accent: #06211c;
    --line: #2e3b37;
    --header: #0b100f;
    --header-text: #f3efe7;
    --header-muted: #b7c9c2;
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family:
    "Segoe UI",
    system-ui,
    -apple-system,
    sans-serif;
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
}

img {
  max-width: 100%;
}

a {
  color: var(--accent);
}

a:hover {
  text-decoration: none;
}

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

.skip-link {
  position: absolute;
  left: 0.75rem;
  top: -4rem;
  background: var(--accent);
  color: var(--on-accent);
  padding: 0.5rem 0.8rem;
  z-index: 20;
}

.skip-link:focus {
  top: 0.75rem;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  padding: 0.75rem max(1rem, env(safe-area-inset-right)) 0.75rem
    max(1rem, env(safe-area-inset-left));
  background: var(--header);
  color: var(--header-text);
}

.brand {
  color: var(--header-text);
  font-weight: 700;
  text-decoration: none;
  margin-right: auto;
}

.nav-toggle,
.theme-switch button,
.site-header nav a,
.button {
  min-height: 44px;
}

.nav-toggle {
  display: none;
  background: transparent;
  color: var(--header-text);
  border: 1px solid var(--header-muted);
  border-radius: 999px;
  padding: 0 0.9rem;
}

.site-header nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-header nav a {
  color: var(--header-text);
  text-decoration: none;
  font-weight: 600;
}

.theme-switch {
  display: flex;
  border: 1px solid var(--header-muted);
  border-radius: 999px;
  overflow: hidden;
}

.theme-switch button {
  background: transparent;
  color: var(--header-text);
  border: 0;
  padding: 0 0.75rem;
  cursor: pointer;
}

.theme-switch button[aria-pressed="true"] {
  background: var(--accent);
  color: var(--on-accent);
}

main {
  width: min(68rem, calc(100% - 2rem));
  margin: 0 auto;
  padding-bottom: 3rem;
}

section {
  padding: 2.5rem 0;
  border-bottom: 1px solid var(--line);
}

.hero {
  padding-top: 3rem;
}

.eyebrow,
.role,
.meta,
.note {
  color: var(--muted);
}

.eyebrow {
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
}

h1 {
  font-size: clamp(2rem, 1.2rem + 3vw, 3.4rem);
  line-height: 1.1;
  margin: 0 0 0.75rem;
}

h2 {
  font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem);
  margin: 0 0 1rem;
}

h3 {
  margin: 0 0 0.35rem;
}

.lede {
  max-width: 42rem;
  font-size: 1.15rem;
}

.cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1.5rem 0;
}

.button {
  display: inline-flex;
  align-items: center;
  padding: 0 1rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  text-decoration: none;
  font-weight: 700;
}

.button-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}

.facts,
.cards,
.certs,
.contact-list {
  display: grid;
  gap: 0.75rem;
  padding: 0;
  list-style: none;
}

.facts {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
}

.facts li,
.cards li,
.certs li,
.job {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem;
}

.facts strong {
  display: block;
  font-size: 1.4rem;
}

.cards {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
}

.job + .job {
  margin-top: 0.75rem;
}

.job ul {
  margin: 0.75rem 0 0;
  padding-left: 1.1rem;
}

.certs li {
  display: grid;
  gap: 0.15rem;
}

footer {
  padding: 1.5rem max(1rem, env(safe-area-inset-left));
  padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
  color: var(--muted);
}

/* Phone / fold cover: one column, menu tucked away */
@media (max-width: 760px) {
  .nav-toggle {
    display: inline-flex;
    align-items: center;
  }

  .site-header nav {
    display: none;
    flex-basis: 100%;
  }

  .site-header nav.is-open {
    display: block;
  }

  .site-header nav ul {
    flex-direction: column;
    padding-bottom: 0.5rem;
  }
}

/* Tablet and small laptop: a little more air */
@media (min-width: 761px) {
  .hero {
    padding-top: 4.5rem;
  }
}

/* Open fold / wide tablet: two reading panes when the browser supports it */
@media (horizontal-viewport-segments: 2) {
  #about,
  #skills {
    display: grid;
    grid-template-columns: env(viewport-segment-width 0 0) 1fr;
    column-gap: 1.5rem;
  }
}

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

@media print {
  .site-header,
  .skip-link,
  .cta,
  .note {
    display: none;
  }

  body {
    background: #fff;
    color: #000;
  }

  .job,
  .cards li,
  .facts li,
  .certs li {
    break-inside: avoid;
  }
}
