/* Layout: a two-column index. Mono section labels sit in a narrow left column and
   stay pinned while their section scrolls; the content reads in the right column.
   Below 48rem everything stacks into one column. */
:root {
  /* Colour: black with a cyan accent by default; the theme button switches to a light version */
  --paper: #030607;
  --surface: #0c1517;
  --ink: #e6f4f6;
  --muted: #8ba4a9;
  --rule: #1a292c;
  --accent: #22d3ee;
  --header-bg: rgb(3 6 7 / 0.85);
  color-scheme: dark;

  /* Type: grotesque display, serif body, mono for labels and data */
  --font-display: "Bricolage Grotesque", "Arial Narrow", system-ui, sans-serif;
  --font-body: "Newsreader", Georgia, "Times New Roman", serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --step--1: 0.8125rem;
  --step-0: 1.1875rem;
  --step-1: 1.4375rem;
  --step-2: clamp(1.75rem, 4vw, 2.5rem);
  --step-hero: clamp(4rem, 17vw, 11rem);

  --max-width: 72rem;
  --label-col: 11rem;
  --header-h: 3.75rem;
  --radius: 6px;
}

/* Black is the default for everyone; light only when chosen with the theme button */
:root[data-theme="light"] {
  --paper: #ffffff;
  --surface: #ecf6f8;
  --ink: #061316;
  --muted: #4a6166;
  --rule: #d4e3e6;
  --accent: #0b6f86;
  --header-bg: rgb(255 255 255 / 0.85);
  color-scheme: light;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
  font-optical-sizing: auto;
}

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

p {
  margin: 0;
}

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

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

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

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

.wrap {
  max-width: var(--max-width);
  margin-inline: auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px), 4vw);
  padding-right: max(16px, env(safe-area-inset-right, 0px), 4vw);
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 20;
  padding: 0.5rem 0.75rem;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: var(--step--1);
}

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

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  height: var(--header-h);
}

.logo {
  margin-right: auto;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-links a {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  letter-spacing: 0.04em;
  color: var(--muted);
  text-decoration: none;
}

.nav-links a:hover,
.nav-links a[aria-current] {
  color: var(--ink);
}

.nav-links a[aria-current] {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.45em;
}

.nav-private {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.nav-private .lock {
  color: var(--accent);
  flex: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

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

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

/* Show the icon for the theme you would switch to: sun on black, moon on light */
.theme-toggle .icon-moon {
  display: none;
}

:root[data-theme="light"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: block; }

/* ---------- Hero ---------- */
.hero {
  display: grid;
  gap: 2rem;
  padding-block: clamp(3rem, 10vw, 7rem) clamp(3rem, 8vw, 5rem);
  scroll-margin-top: var(--header-h);
}

.hero-name {
  font-family: var(--font-display);
  font-size: var(--step-hero);
  font-weight: 800;
  font-variation-settings: "opsz" 96;
  line-height: 0.85;
  letter-spacing: -0.045em;
  /* nudge the cap so it optically lines up with the text below */
  margin-left: -0.04em;
}

.hero-meta {
  display: grid;
  grid-template-columns: minmax(0, 32rem) auto;
  align-items: end;
  justify-content: space-between;
  gap: 1.5rem 3rem;
}

.tagline {
  font-size: var(--step-1);
  line-height: 1.4;
}

.status {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--muted);
}

.status-dot {
  flex: none;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 var(--accent);
  animation: pulse 2.4s ease-out infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 50%, transparent); }
  70%, 100% { box-shadow: 0 0 0 0.6rem color-mix(in srgb, var(--accent) 0%, transparent); }
}

/* ---------- Sections ---------- */
.section {
  display: grid;
  grid-template-columns: var(--label-col) minmax(0, 1fr);
  gap: 2rem;
  padding-block: clamp(3rem, 8vw, 5.5rem);
  scroll-margin-top: var(--header-h);
}

/* The rule sits on a pseudo-element so it spans the content width, not the padding */
.section {
  position: relative;
}

.section::before {
  content: "";
  position: absolute;
  top: 0;
  left: max(16px, env(safe-area-inset-left, 0px), 4vw);
  right: max(16px, env(safe-area-inset-right, 0px), 4vw);
  border-top: 1px solid var(--rule);
}

.section-label {
  position: sticky;
  top: calc(var(--header-h) + 1.5rem);
  align-self: start;
  padding-top: 0.35rem;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.section-body {
  display: grid;
  gap: 2.5rem;
  min-width: 0;
}

/* ---------- About ---------- */
.prose {
  display: grid;
  gap: 1.1rem;
  max-width: 36rem;
}

.lead {
  font-family: var(--font-display);
  font-size: var(--step-2);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 1.5rem;
  margin: 0;
  max-width: 40rem;
}

.facts div {
  display: grid;
  gap: 0.25rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--rule);
}

.facts dt {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.facts dd {
  margin: 0;
}

/* ---------- Projects ---------- */
.projects {
  margin: 0;
  padding: 0;
  list-style: none;
  border-bottom: 1px solid var(--rule);
}

.project {
  display: grid;
  grid-template-columns: 4rem minmax(0, 1fr) auto 1.5rem;
  align-items: baseline;
  gap: 0.5rem 1.5rem;
  padding: 1.4rem 0.75rem;
  margin-inline: -0.75rem;
  border-top: 1px solid var(--rule);
  border-radius: var(--radius);
  color: inherit;
  text-decoration: none;
  transition: background-color 160ms ease;
}

.projects li:first-child .project {
  border-top-color: transparent;
}

.project:hover {
  background: var(--surface);
}

.project-year,
.project-tags {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.project-main {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.project-title {
  font-family: var(--font-display);
  font-size: var(--step-1);
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.project-desc {
  color: var(--muted);
}

.project-arrow {
  justify-self: end;
  color: var(--accent);
  transition: transform 160ms ease;
}

.project:hover .project-title {
  color: var(--accent);
}

.project:hover .project-arrow {
  transform: translate(3px, -3px);
}

/* ---------- Inner page heading (Personal, 404) ---------- */
.page-head {
  display: grid;
  gap: 1rem;
  padding-block: clamp(2.5rem, 8vw, 5rem) clamp(2rem, 6vw, 3.5rem);
  scroll-margin-top: var(--header-h);
}

.page-title {
  font-family: var(--font-display);
  font-size: clamp(3rem, 11vw, 6.5rem);
  font-weight: 800;
  font-variation-settings: "opsz" 96;
  line-height: 0.9;
  letter-spacing: -0.04em;
  margin-left: -0.03em;
}

.page-head .tagline {
  max-width: 34rem;
}

.private-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  justify-self: start;
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--accent);
}

/* ---------- Personal ---------- */
.shelf {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
  gap: 1px;
  margin: 0;
  padding: 0;
  list-style: none;
  /* the 1px gaps show this colour, drawing hairlines between the tiles */
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
}

.shelf li {
  display: grid;
  align-content: start;
  gap: 0.15rem;
  min-width: 0;
  padding: 1rem 1.1rem 1.15rem;
  background: var(--paper);
  transition: background-color 160ms ease;
}

.shelf li:hover {
  background: var(--surface);
}

.shelf-label {
  margin-bottom: 0.4rem;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

.shelf-title {
  font-family: var(--font-display);
  font-size: var(--step-1);
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.shelf-by {
  color: var(--muted);
}

.checklist {
  display: grid;
  gap: 0;
  max-width: 36rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.checklist li {
  display: flex;
  align-items: baseline;
  gap: 0.85rem;
  padding-block: 0.7rem;
  border-bottom: 1px solid var(--rule);
}

.checklist .check {
  flex: none;
  width: 0.9rem;
  height: 0.9rem;
  border: 1.5px solid var(--muted);
  border-radius: 3px;
  transform: translateY(0.1rem);
}

.checklist .done .check {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: inset 0 0 0 2px var(--paper);
}

.checklist .done > span:last-child {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: var(--accent);
}

code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  padding: 0.05em 0.35em;
  border-radius: 4px;
  background: var(--surface);
}

/* ---------- Contact ---------- */
.contact-intro {
  color: var(--muted);
}

.email-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.25rem;
  margin-top: -1.5rem;
}

.email {
  font-family: var(--font-display);
  font-size: var(--step-2);
  font-weight: 650;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.15em;
}

.copy-btn {
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: var(--step--1);
  cursor: pointer;
}

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

.elsewhere {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 2rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-family: var(--font-mono);
  font-size: var(--step--1);
}

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

/* ---------- Link rows (homepage) ---------- */
.logo-domain {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: 0.02em;
}

.link-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-bottom: 1px solid var(--rule);
}

.link-row {
  display: grid;
  grid-template-columns: 9rem minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 0.35rem 1.5rem;
  padding: 1.15rem 0.75rem;
  margin-inline: -0.75rem;
  border-top: 1px solid var(--rule);
  border-radius: var(--radius);
  color: inherit;
  text-decoration: none;
  transition: background-color 160ms ease;
}

.link-list > li:first-child > .link-row,
.link-list > .link-row:first-child {
  border-top-color: transparent;
}

a.link-row:hover {
  background: var(--surface);
}

.link-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.link-label .lock {
  color: var(--accent);
}

.link-value {
  min-width: 0;
  font-family: var(--font-display);
  font-size: var(--step-1);
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.3;
  color: var(--ink);
  overflow-wrap: anywhere;
  transition: color 160ms ease;
}

a.link-row:hover .link-value,
.link-email:hover {
  color: var(--accent);
}

.link-email {
  text-decoration: none;
}

.link-note {
  display: block;
  margin-top: 0.15rem;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  font-weight: 400;
  letter-spacing: 0;
  color: var(--muted);
}

.link-arrow {
  color: var(--accent);
  transition: transform 160ms ease;
}

a.link-row:hover .link-arrow {
  transform: translateX(3px);
}

@media (max-width: 30rem) {
  .link-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .link-label {
    grid-column: 1 / -1;
  }
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--muted);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  padding-block: 1.75rem;
}

/* ---------- Narrow screens ---------- */
@media (max-width: 48rem) {
  .hero-meta {
    grid-template-columns: minmax(0, 1fr);
  }

  .section {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.25rem;
  }

  .section-label {
    position: static;
    padding-top: 0;
  }

  .project {
    grid-template-columns: minmax(0, 1fr) 1.5rem;
  }

  .project-year {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .project-main {
    grid-column: 1;
    grid-row: 2;
  }

  .project-arrow {
    grid-column: 2;
    grid-row: 2;
  }

  .project-tags {
    grid-column: 1 / -1;
    grid-row: 3;
  }
}

/* On phones the four menu links get their own row under the name */
@media (max-width: 30rem) {
  :root {
    --header-h: 5.75rem;
  }

  .header-inner {
    flex-wrap: wrap;
    height: auto;
    row-gap: 0.35rem;
    padding-block: 0.6rem;
  }

  .site-header nav {
    order: 3;
    width: 100%;
  }

  .nav-links {
    justify-content: space-between;
    gap: 0.75rem;
  }
}

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

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
