/* =========================================================
   Colours — change these to re-theme the whole site.
   Light theme first, dark theme below.
   ========================================================= */
:root {
  --bg: #f2f4f1;
  --surface: #e7ebe6;
  --ink: #17201b;
  --muted: #56635c;
  --line: #d3dad4;
  --accent: #2c6a50;
  --accent-ink: #f2f4f1;
  --focus: #2c6a50;

  --font: "Bricolage Grotesque", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --measure: 38rem;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121714;
    --surface: #1a211d;
    --ink: #e3e9e4;
    --muted: #9aa69f;
    --line: #2a332e;
    --accent: #8acaa7;
    --accent-ink: #0f1712;
    --focus: #8acaa7;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121714;
  --surface: #1a211d;
  --ink: #e3e9e4;
  --muted: #9aa69f;
  --line: #2a332e;
  --accent: #8acaa7;
  --accent-ink: #0f1712;
  --focus: #8acaa7;
  color-scheme: dark;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}
a:hover { color: var(--accent); }

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

::selection { background: var(--accent); color: var(--accent-ink); }

.wrap {
  width: 100%;
  max-width: 68rem;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  padding: 0.5rem 0.9rem;
  background: var(--ink);
  color: var(--bg);
  z-index: 10;
  border-radius: 6px;
}
.skip-link:focus { top: 1rem; }

/* =========================================================
   Header
   ========================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  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 transparent;
  transition: border-color 0.2s ease;
}
.site-header.is-scrolled { border-bottom-color: var(--line); }

.header-inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  min-height: 4rem;
}

.wordmark {
  font-weight: 650;
  font-variation-settings: "wdth" 90;
  letter-spacing: -0.01em;
  text-decoration: none;
  margin-right: auto;
}

.nav-list {
  display: flex;
  gap: 1.5rem;
  font-size: 0.95rem;
}
.nav-list a {
  color: var(--muted);
  text-decoration: none;
}
.nav-list a:hover,
.nav-list a[aria-current="true"] { color: var(--ink); }

.theme-toggle {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.theme-toggle:hover { border-color: var(--muted); }
.theme-toggle svg {
  width: 1.05rem;
  height: 1.05rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-sun { display: none; }
:root[data-theme="dark"] .icon-sun { display: block; }
:root[data-theme="dark"] .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: block; }
  :root:not([data-theme="light"]) .icon-moon { display: none; }
}

/* =========================================================
   Intro
   ========================================================= */
.hero {
  padding-top: clamp(4rem, 14vh, 9rem);
  padding-bottom: clamp(4rem, 12vh, 8rem);
}

.hero-title {
  font-size: clamp(2.5rem, 6.4vw, 5.25rem);
  font-weight: 600;
  font-variation-settings: "wdth" 82, "opsz" 96;
  line-height: 1.02;
  letter-spacing: -0.025em;
  max-width: 17ch;
  text-wrap: balance;
}
.hero-title .line { display: block; }

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem 2rem;
  margin-top: clamp(2rem, 5vw, 3.5rem);
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

.status {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  color: var(--muted);
}
.status-dot {
  width: 0.55rem;
  height: 0.55rem;
  flex: none;
  transform: translateY(-0.08em);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent);
}

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

.button {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0 1.15rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}
.button:hover { border-color: var(--ink); color: var(--ink); }
.button-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.button-primary:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

/* One orchestrated entrance: the intro lines rise in turn */
@media (prefers-reduced-motion: no-preference) {
  .js .hero-title .line,
  .js .hero-meta {
    opacity: 0;
    transform: translateY(0.4em);
    animation: rise 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
  }
  .js .hero-title .line:nth-child(2) { animation-delay: 0.12s; }
  .js .hero-title .line:nth-child(3) { animation-delay: 0.24s; }
  .js .hero-meta { transform: translateY(12px); animation-delay: 0.4s; }
}
@keyframes rise { to { opacity: 1; transform: none; } }

/* =========================================================
   Sections: title in a narrow left column, content on the right
   ========================================================= */
.section {
  display: grid;
  grid-template-columns: minmax(9rem, 14rem) minmax(0, 1fr);
  gap: 1rem 3rem;
  padding-top: clamp(3rem, 8vw, 5rem);
  padding-bottom: clamp(3rem, 8vw, 5rem);
}

/* Divider lines that line up with the content, not the screen edge */
.section,
.site-footer {
  background: linear-gradient(var(--line), var(--line)) center top / calc(100% - 2 * var(--gutter)) 1px no-repeat;
}

.section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--muted);
  padding-top: 0.3rem;
}

.section-body { max-width: var(--measure); }

.prose p + p { margin-top: 1rem; }
.lede {
  font-size: clamp(1.3rem, 2.2vw, 1.55rem);
  line-height: 1.35;
  font-weight: 500;
  font-variation-settings: "opsz" 40;
  letter-spacing: -0.01em;
  margin-bottom: 1.5rem;
}
.prose p:not(.lede) { color: var(--muted); }

/* Experience */
.timeline { display: grid; gap: 2.25rem; }
.role {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr);
  gap: 0.25rem 1.5rem;
}
.role-dates {
  color: var(--muted);
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  padding-top: 0.15rem;
}
.role-title {
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 0.35rem;
}
.role-org { font-weight: 400; color: var(--muted); }
.role p { color: var(--muted); }
.role-points { margin-top: 0.6rem; display: grid; gap: 0.35rem; }
.role-points li {
  position: relative;
  padding-left: 1.1rem;
  color: var(--muted);
}
.role-points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.72em;
  width: 0.45rem;
  height: 1px;
  background: var(--accent);
}

/* Projects */
.project {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--line);
}
.project:first-child { padding-top: 0; }
.project:last-child { border-bottom: 0; padding-bottom: 0; }
.project-title {
  font-size: 1.3rem;
  font-weight: 600;
  font-variation-settings: "wdth" 92;
  letter-spacing: -0.01em;
  margin-bottom: 0.4rem;
}
.project-title a { text-decoration: none; }
.project-title a::after {
  content: "↗";
  display: inline-block;
  margin-left: 0.3em;
  font-size: 0.8em;
  color: var(--muted);
  transition: transform 0.15s ease, color 0.15s ease;
}
.project-title a:hover { text-decoration: underline; }
.project-title a:hover::after { transform: translate(2px, -2px); color: var(--accent); }
.project p { color: var(--muted); }
.project .project-tags { margin-top: 0.6rem; font-size: 0.9rem; }

/* Contact */
.contact-intro { color: var(--muted); margin-bottom: 1.25rem; }
.email-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
}
.email-link {
  font-size: clamp(1.5rem, 4vw, 2.4rem);
  font-weight: 600;
  font-variation-settings: "wdth" 85, "opsz" 72;
  letter-spacing: -0.02em;
  line-height: 1.15;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  overflow-wrap: anywhere;
}
.copy-button {
  padding: 0.35rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}
.copy-button:hover { border-color: var(--ink); }
.copy-status { color: var(--accent); font-size: 0.9rem; }

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin-top: 1.75rem;
}
.links a { color: var(--muted); }
.links a:hover { color: var(--accent); }

/* =========================================================
   Footer
   ========================================================= */
.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1.5rem;
  padding-bottom: 2.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}
.site-footer a { color: inherit; }

/* =========================================================
   Small screens
   ========================================================= */
@media (max-width: 760px) {
  .nav-list { display: none; }
  .section { grid-template-columns: 1fr; }
  .section-title { padding-top: 0; }
  .role { grid-template-columns: 1fr; }
  .hero-meta { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
