html {
  /* Allow the browser to render in either light or dark mode
     based on the user's OS preference (or what we set via JS). */
  color-scheme: light dark;

  /* Colorblind-friendly teal-blue accent (was red).
     Distinguishable for protanopia, deuteranopia, and tritanopia, and contrasts
     well in both light and dark mode. */
  --color-accent: oklch(55% 30% 230);
  accent-color: var(--color-accent);
}

body {
  font: 100%/1.5 system-ui;
  max-width: 100ch;
  margin-inline: max(1em, (100% - 100ch) / 2);
  padding: 0 1em;
}

nav {
  /* Semi-transparent border that adapts nicely to both light and dark mode. */
  --border-color: oklch(50% 10% 200 / 40%);

  display: flex;
  flex-direction: column;
  margin-bottom: 1.5em;
  border-bottom: 1px solid var(--border-color);
}

/* Top row: primary tabs (Home, Projects, Contact). */
.nav-primary {
  display: flex;
}

/* Bottom row: "Other links:" label + secondary tabs (CV, GitHub, LinkedIn). */
.nav-secondary {
  display: flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.4em 0.5em;
  border-top: 1px solid var(--border-color);
  font-size: 0.9em;
  flex-wrap: wrap;
}

.nav-secondary-label {
  color: oklch(50% 3% 200);
  font-style: italic;
  margin-right: 0.25em;
}

nav a {
  text-decoration: none;
  color: inherit;
  padding: 0.5em;
}

.nav-primary a {
  flex: 1;
  text-align: center;
}

.nav-secondary a {
  padding: 0.25em 0.6em;
  border-radius: 4px;
}

nav a.current {
  border-bottom: 0.4em solid var(--border-color);
  padding-bottom: 0.1em;
}

.nav-primary a:hover {
  border-bottom: 0.4em solid var(--color-accent);
  padding-bottom: 0.1em;
  /* Mix the accent color with the current background so the hover color
     stays legible in both light and dark mode. */
  background-color: color-mix(in oklch, var(--color-accent), canvas 85%);
}

.nav-secondary a:hover {
  background-color: color-mix(in oklch, var(--color-accent), canvas 85%);
  color: var(--color-accent);
}

input, textarea, select, button {
  font: inherit;
}

form {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1em;
}

form label {
  display: grid;
  grid-template-columns: subgrid;
  grid-column: 1 / -1;
}

form button {
  grid-column: 1 / -1;
}

h1 {
  font-size: 400%;
}

h1, h2, h3, h4, h5, h6 {
  line-height: 1.1;
  text-wrap: balance;
}

.projects {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15em, 1fr));
  gap: 1em;
}

.projects article {
  display: grid;
  grid-template-rows: subgrid;
  grid-row: span 3;
  margin: 0;
}

.projects article h2 {
  margin: 0;
}

.projects article img {
  width: 100%;
}

.projects article .project-year {
  font-style: italic;
  color: oklch(50% 3% 200);
  font-family: Baskerville, "Baskerville Old Face", Garamond, serif;
  font-variant-numeric: oldstyle-nums;
  margin: 0.25em 0 0;
}

/* ---------- GitHub profile stats ---------- */
#profile-stats {
  margin: 1.5em 0;
}

#profile-stats dl {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.25em 1em;
  margin: 0;
}

#profile-stats dt {
  grid-row: 1;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75em;
  letter-spacing: 0.05em;
  color: oklch(50% 3% 200);
}

#profile-stats dd {
  grid-row: 2;
  margin: 0;
  font-size: 1.75em;
  font-weight: 700;
}

.cv section {
  margin-bottom: 2em;
  padding-bottom: 1em;
  border-bottom: 1px solid oklch(50% 10% 200 / 40%);
}

.cv h2 {
  color: var(--color-accent);
}

.cv article {
  margin-bottom: 1em;
}

.cv article h3 {
  margin: 0;
}

.cv time {
  color: oklch(50% 3% 200);
  font-size: 0.9em;
}

/* ---------- Social buttons (LinkedIn etc.) ---------- */
.social-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.55em 1.1em;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95em;
  line-height: 1;
  transition: transform 0.15s ease,
              box-shadow 0.15s ease,
              background-color 0.15s ease;
}

.social-button svg {
  width: 1.15em;
  height: 1.15em;
  fill: currentColor;
  flex-shrink: 0;
}

.social-button:hover,
.social-button:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px oklch(50% 30% 240 / 30%);
}

.social-button:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.social-button.linkedin {
  background-color: #0a66c2;
  color: white;
}

.social-button.linkedin:hover,
.social-button.linkedin:focus-visible {
  background-color: #084d92;
  color: white;
}

.social-button.accent {
  background-color: var(--color-accent);
  color: white;
}

.social-button.accent:hover,
.social-button.accent:focus-visible {
  background-color: oklch(from var(--color-accent) calc(l - 0.05) c h);
  color: white;
}

/* ---------- Featured project block (e.g. A/B Testing Tutor) ---------- */
.featured-project {
  padding: 1.25em 1.4em;
  border: 1px solid oklch(60% 5% 200 / 30%);
  border-radius: 10px;
  background-color: color-mix(in oklch, canvas 94%, var(--color-accent) 6%);
}

.featured-project p {
  margin: 0 0 0.8em;
}

.featured-project p:last-child {
  margin-bottom: 0;
}

.project-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75em;
  align-items: center;
  margin-top: 1em !important;
}

.status-pill {
  display: inline-block;
  padding: 0.25em 0.7em;
  border-radius: 999px;
  font-size: 0.8em;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background-color: oklch(85% 8% 90 / 50%);
  color: oklch(40% 8% 90);
}

.footnote {
  font-size: 0.85em;
  color: oklch(50% 3% 200);
  font-style: italic;
}

/* ---------- Hero (homepage) ---------- */
.hero {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2em;
  align-items: center;
  margin: 1em 0 3em;
}

.hero-photo {
  width: 100%;
  max-width: 220px;
  height: auto;
  border-radius: 50%;
  object-fit: cover;
  aspect-ratio: 1 / 1;
  box-shadow: 0 4px 20px oklch(50% 5% 200 / 25%);
}

.hero-location {
  margin: 0 0 0.4em !important;
  font-size: 0.95em;
  color: oklch(45% 3% 200);
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
}

.hero-location .location-pin {
  /* Render the 📍 emoji glyph itself rather than a coloured fallback,
     and nudge it slightly so it sits visually centered with the text. */
  font-size: 1.05em;
  line-height: 1;
}

.hero-text h1 {
  font-size: 320%;
  margin: 0 0 0.25em;
}

.hero-text p {
  margin: 0.5em 0;
}

/* On narrow screens, stack the photo above the text. */
@media (max-width: 600px) {
  .hero {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 1.25em;
  }
  .hero-photo {
    margin-inline: auto;
    max-width: 160px;
  }
}

/* ---------- Anchor pills (Rampure-style "On this page:" / "Other links:") ---------- */
.page-anchors {
  margin: 0 0 2.5em;
  border: none;
  display: block;
}

.page-anchors p {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5em 0.6em;
  margin: 0.4em 0;
}

.page-anchors-label {
  color: oklch(50% 3% 200);
  font-size: 0.95em;
  margin-right: 0.25em;
  /* Reserve a fixed minimum width so the first pill of every row starts at
     the same X position across "On this page", "Other links", "Learning resources". */
  min-width: 11em;
  flex-shrink: 0;
}

/* Stack labels above pills on narrow screens so labels still align with each other
   visually but don't squeeze the pill row. */
@media (max-width: 600px) {
  .page-anchors-label {
    min-width: 0;
    width: 100%;
  }
}

.anchor-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.3em 0.75em;
  border: 1px solid oklch(60% 5% 200 / 35%);
  border-radius: 6px;
  text-decoration: none;
  color: var(--color-accent);
  font-size: 0.95em;
  background-color: color-mix(in oklch, canvas 96%, var(--color-accent) 4%);
  transition: background-color 0.15s ease,
              border-color 0.15s ease,
              transform 0.15s ease;
}

.anchor-pill:hover,
.anchor-pill:focus-visible {
  background-color: color-mix(in oklch, canvas 88%, var(--color-accent) 12%);
  border-color: var(--color-accent);
  transform: translateY(-1px);
}

.anchor-pill .pill-icon {
  font-size: 1em;
  line-height: 1;
}

/* ---------- Generic homepage section ---------- */
.home-section {
  margin-bottom: 3.5em;
}

.section-heading {
  font-size: 200%;
  margin: 0 0 0.25em;
}

.section-subhead {
  margin: 0 0 1em;
  color: oklch(50% 3% 200);
  font-size: 0.95em;
}

/* Make a heading itself a link without losing its visual weight. */
.section-link {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: baseline;
  gap: 0.3em;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.section-link:hover,
.section-link:focus-visible {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}

.section-link-arrow {
  font-size: 0.8em;
  transition: transform 0.15s ease;
}

.section-link:hover .section-link-arrow,
.section-link:focus-visible .section-link-arrow {
  transform: translateX(0.25em);
}

/* ---------- Course Schedule ---------- */
.quarter-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1em;
  display: grid;
  gap: 0.5em;
}

.quarter-list li {
  padding: 0.85em 1.1em;
  border: 1px solid oklch(60% 5% 200 / 30%);
  border-radius: 8px;
  background-color: color-mix(in oklch, canvas 96%, var(--color-accent) 4%);
}

.quarter-list li.quarter-current {
  border-color: var(--color-accent);
  background-color: color-mix(in oklch, canvas 90%, var(--color-accent) 10%);
}

.quarter-link {
  display: inline-block;
  font-weight: 600;
  color: inherit;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.quarter-link:hover,
.quarter-link:focus-visible {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}

.quarter-note {
  margin: 0.3em 0 0;
  font-size: 0.88em;
  color: oklch(50% 3% 200);
}

/* ---------- Awards & Distinctions ---------- */
.awards-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 1.25em;
}

.awards-list li {
  padding: 1em 1.2em;
  border: 1px solid oklch(50% 10% 200 / 30%);
  border-radius: 8px;
  background-color: color-mix(in oklch, canvas 92%, var(--color-accent) 8%);
}

.awards-list li strong {
  font-size: 1.05em;
}

.award-meta {
  display: block;
  color: oklch(50% 3% 200);
  font-size: 0.85em;
  margin-top: 0.15em;
  margin-bottom: 0.5em;
}

.awards-list li p {
  margin: 0;
  font-size: 0.95em;
}

/* ---------- Dark-mode switcher ---------- */
.color-scheme {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 80%;
  font-family: inherit;
}

.color-scheme select {
  font-family: inherit;
}
