/* ---------- Colours & type (shared with the home page) ---------- */
:root {
  color-scheme: dark;
  --sky: #04050b;
  --surface: #0a0c16;
  --ink: #ece9e2;
  --body: #c4c3c4;
  --muted: #a3a5b2;
  --faint: #727587;
  --line: rgba(236, 233, 226, 0.12);
  --accent: #e8cb92;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "IBM Plex Sans", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--sky);
  scroll-behavior: smooth;
  scroll-padding-top: 72px; /* room for the sticky nav */
}

body {
  margin: 0;
  background: var(--sky);
  color: var(--body);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  color: var(--ink);
  font-weight: 400;
  line-height: 1.2;
}

.container {
  width: min(100% - 48px, 1040px);
  margin-inline: auto;
}

.skip-link {
  position: fixed;
  z-index: 10;
  top: 12px;
  left: 12px;
  padding: 8px 12px;
  transform: translateY(-150%);
  background: var(--ink);
  color: var(--sky);
}

.skip-link:focus {
  transform: translateY(0);
}

a:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 4px;
}

/* ---------- Header with stars ---------- */
.site-header {
  position: relative;
  overflow: hidden;
  background: radial-gradient(ellipse 90% 70% at 85% 0%, #0d1430 0%, transparent 70%), var(--sky);
}

.starfield {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  /* fade the stars out towards the bottom of the header */
  -webkit-mask-image: linear-gradient(to bottom, #000 55%, transparent);
  mask-image: linear-gradient(to bottom, #000 55%, transparent);
}

.topline,
.hero {
  position: relative;
}

.topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 80px;
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.06em;
}

.home-link {
  color: var(--muted);
  text-decoration: none;
}

.home-link:hover {
  color: var(--ink);
}

.coords {
  margin: 0;
  color: var(--faint);
}

.hero {
  padding: clamp(56px, 10vw, 120px) 0 clamp(56px, 8vw, 96px);
}

.eyebrow,
.section-label,
.project-meta,
.when,
.tags,
.list-heading,
.facts dt {
  font-family: var(--mono);
  font-size: 0.74rem;
  font-weight: 400;
  letter-spacing: 0.06em;
}

.eyebrow {
  margin-bottom: 20px;
  color: var(--accent);
  text-transform: uppercase;
}

h1 {
  margin-bottom: 22px;
  font-family: var(--serif);
  font-size: clamp(3rem, 8vw, 5.75rem);
  letter-spacing: -0.025em;
  line-height: 1;
}

.intro-text {
  max-width: 34rem;
  margin-bottom: 32px;
  font-size: 1.15rem;
  line-height: 1.65;
}

.contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.button {
  display: inline-block;
  padding: 10px 18px;
  border: 1px solid rgba(236, 233, 226, 0.3);
  border-radius: 999px;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1.4;
  text-decoration: none;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.button:hover {
  border-color: var(--ink);
}

.button-primary {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--sky);
}

.button-primary:hover {
  border-color: var(--accent);
  background: var(--accent);
}

/* ---------- Sticky section nav ---------- */
.site-nav {
  position: sticky;
  z-index: 5;
  top: 0;
  border-block: 1px solid var(--line);
  background: rgba(4, 5, 11, 0.86);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.site-nav-inner {
  position: relative;
  display: flex;
  gap: 28px;
  overflow-x: auto;
  scrollbar-width: none;
}

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

.site-nav a {
  padding: 16px 0 15px;
  border-bottom: 1px solid transparent;
  color: var(--muted);
  font-size: 0.88rem;
  text-decoration: none;
  white-space: nowrap;
  transition: color 160ms ease, border-color 160ms ease;
}

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

.site-nav a[aria-current] {
  border-bottom-color: var(--accent);
  color: var(--ink);
}

/* ---------- Sections: label on the left, content on the right ---------- */
.section {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 40px;
  padding: 72px 0;
  border-bottom: 1px solid var(--line);
}

.section:last-child {
  border-bottom: 0;
}

.section-label {
  position: sticky;
  top: 96px;
  align-self: start;
  margin: 8px 0 0;
  color: var(--faint);
  text-transform: uppercase;
}

/* a small star before each section label */
.section-label::before {
  display: inline-block;
  width: 5px;
  height: 5px;
  margin: 0 12px 2px 0;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(232, 203, 146, 0.7);
  content: "";
}

h2 {
  margin-bottom: 24px;
  font-family: var(--serif);
  font-size: clamp(1.8rem, 3.4vw, 2.4rem);
  letter-spacing: -0.015em;
}

.lead {
  max-width: 62ch;
  margin-bottom: 36px;
  font-size: 1.08rem;
}

.subtle {
  color: var(--muted);
}

/* About: quick facts */
.facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  margin: 0;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.facts dt {
  margin-bottom: 4px;
  color: var(--faint);
  text-transform: uppercase;
}

.facts dd {
  margin: 0;
  color: var(--ink);
}

/* Education */
.list-heading {
  margin: 32px 0 12px;
  color: var(--faint);
  text-transform: uppercase;
}

.course-list,
.skill-grid,
.ledger,
.timeline {
  margin: 0;
  padding: 0;
  list-style: none;
}

.course-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.course-list li {
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  font-size: 0.92rem;
}

/* Skills */
.skill-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 40px;
}

.skill-grid li {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}

/* ---------- Projects ---------- */
.project-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.project {
  display: flex;
  flex-direction: column;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  transition: border-color 200ms ease;
}

.project:hover {
  border-color: rgba(236, 233, 226, 0.28);
}

.project .project-meta {
  margin-bottom: 10px;
  font-size: 0.74rem;
  color: var(--accent);
}

.project h3 {
  margin-bottom: 12px;
  font-family: var(--serif);
  font-size: 1.5rem;
}

.project p {
  margin-bottom: 18px;
  font-size: 0.95rem;
}

.tags {
  margin-top: auto; /* push tags and links to the bottom of the card */
  color: var(--faint);
  line-height: 1.6;
}

.project .tags {
  margin-bottom: 0;
  font-size: 0.72rem;
}

.project-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.project-links a {
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
}

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

/* ---------- Experience timeline ---------- */
.timeline li {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 24px;
  padding: 24px 0;
  border-top: 1px solid var(--line);
}

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

.when {
  margin: 4px 0 0;
  color: var(--faint);
}

.timeline h3 {
  margin-bottom: 8px;
  font-family: var(--serif);
  font-size: 1.35rem;
}

.org {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.9rem;
}

.timeline p {
  max-width: 62ch;
  margin-bottom: 0;
}

/* ---------- Community & awards ---------- */
.ledger li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.ledger li:first-child {
  border-top: 1px solid var(--line);
}

.ledger span:first-child {
  color: var(--ink);
}

.ledger span:last-child {
  color: var(--faint);
  font-size: 0.88rem;
  text-align: right;
}

/* ---------- Footer ---------- */
.site-footer {
  padding: 36px 0 44px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-family: var(--mono);
  font-size: 0.78rem;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  gap: 24px;
}

.footer-content p {
  margin: 0;
}

.footer-links {
  display: flex;
  gap: 20px;
}

.footer-links a {
  color: var(--muted);
  text-decoration: none;
}

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

/* ---------- Smaller screens ---------- */
@media (max-width: 820px) {
  .section {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 56px 0;
  }

  .section-label {
    position: static;
    margin: 0;
  }

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

@media (max-width: 560px) {
  .container {
    width: calc(100% - 40px);
  }

  .site-nav-inner {
    gap: 22px;
  }

  .facts,
  .skill-grid {
    grid-template-columns: 1fr;
  }

  .facts {
    gap: 16px;
  }

  .project {
    padding: 22px;
  }

  .timeline li {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .ledger li {
    flex-direction: column;
    gap: 2px;
  }

  .ledger span:last-child {
    text-align: left;
  }

  .footer-content {
    flex-direction: column;
    gap: 12px;
  }
}

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

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}
