/* ---------------------------------------------------------------------------
   Theme tokens
--------------------------------------------------------------------------- */
:root {
  --bg:      #f7f6f3;
  --fg:      #1a1a1a;
  --muted:   #6b6b6b;
  --border:  #d9d7d1;
  --accent:  #8c1515;   /* cardinal red (Stanford) */
  --code-bg: #eeece7;

  --maxw: 720px;
  --space: 1.5rem;

  --sans: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

:root[data-theme="dark"] {
  --bg:      #121211;
  --fg:      #e8e6e1;
  --muted:   #8f8d87;
  --border:  #2c2b28;
  --accent:  #b1040e;
  --code-bg: #1d1c1a;
}

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

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

html { font-size: 15px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 0.95rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 1.5rem;
}

a {
  color: var(--fg);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: color 0.15s ease, border-color 0.15s ease;
}
a:hover {
  color: var(--accent);
  border-color: var(--accent);
}

h1, h2, h3 {
  font-family: var(--mono);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

section { scroll-margin-top: 2rem; }

/* ---------------------------------------------------------------------------
   Left rail: dot navigation + theme toggle
--------------------------------------------------------------------------- */
.sidebar {
  position: fixed;
  right: 2rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}
.dotnav ul {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.dotnav a {
  display: block;
  padding: 3px;          /* larger hit target around the dot */
  border: none;
  line-height: 1;
  position: relative;
}
/* Section name revealed on hover/focus, as plain text beside the number */
.dotnav a::after {
  content: attr(data-label);
  position: absolute;
  right: calc(100% + 0.7rem);
  top: 50%;
  transform: translateY(-50%);
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}
.dotnav a:hover::after,
.dotnav a:focus-visible::after { opacity: 1; }
.dotnav a.is-active::after { color: var(--accent); }
.dotnum {
  display: block;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  transition: color 0.15s ease;
}
.dotnav a:hover .dotnum { color: var(--accent); }
.dotnav a.is-active .dotnum { color: var(--accent); }

/* ---------------------------------------------------------------------------
   Theme toggle (a button on the rail)
--------------------------------------------------------------------------- */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.theme-toggle:hover {
  color: var(--accent);
}
.monogram {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #fff;
  background: var(--accent);
  transition: background-color 0.15s ease, color 0.15s ease;
}
/* Hover: light mode → black square / white type; dark mode → white square / black type */
.theme-toggle:hover .monogram { background: #000; color: #fff; }
:root[data-theme="dark"] .theme-toggle:hover .monogram { background: #fff; color: #000; }

/* ---------------------------------------------------------------------------
   Intro
--------------------------------------------------------------------------- */
.intro {
  padding: 5rem 0 2rem;
}
.intro h1 {
  margin: 0 0 0.6rem;
  font-size: clamp(2rem, 6vw, 2.75rem);
}
.role {
  margin: 0 0 1.5rem;
  font-family: var(--mono);
  font-size: 0.9rem;
  color: var(--accent);
}
.lede {
  margin: 0 0 1.25rem;
  font-size: 1.05rem;
  max-width: 60ch;
}
.inline-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-family: var(--mono);
  font-size: 0.85rem;
}
/* ---------------------------------------------------------------------------
   Sections
--------------------------------------------------------------------------- */
.section {
  padding: 3rem 0;
}
/* The label sits ON the divider line: text on the left, a hairline rule
   filling the rest of the row. */
.section-label {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0 0 1.75rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.section-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}
.section-body p { margin: 0 0 1.1rem; max-width: 62ch; }
.about-list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.about-list li {
  position: relative;
  padding-left: 1.5rem;
  margin: 0 0 0.7rem;
  max-width: 62ch;
}
.about-list li:last-child { margin-bottom: 0; }
.about-list li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--accent);
}

.subhead {
  margin: 2.25rem 0 1rem;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  color: var(--muted);
  text-transform: uppercase;
}

/* ---------------------------------------------------------------------------
   Timeline (experience / education)
--------------------------------------------------------------------------- */
.timeline {
  margin: 0;
  padding: 0;
  list-style: none;
}
.timeline li {
  display: flex;
  gap: 1.25rem;
  padding: 0.85rem 0;
  border-top: 1px solid var(--border);
}
.timeline li:first-child { border-top: none; }
.timeline__meta {
  flex: 0 0 8.5rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  padding-top: 0.1rem;
}
.timeline__body { flex: 1; }

/* ---------------------------------------------------------------------------
   Projects
--------------------------------------------------------------------------- */
.projects {
  margin: 0;
  padding: 0;
  list-style: none;
}
.project {
  padding: 1.5rem 0;
  border-top: 1px solid var(--border);
}
.project:first-child { border-top: none; padding-top: 0; }

.project__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.4rem;
}
.project__title {
  margin: 0;
  font-size: 1.05rem;
}
.project__title a { border: none; }
.project__year {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
}
.project__desc {
  margin: 0 0 0.75rem;
  max-width: 60ch;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.tags li {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 0.15rem 0.5rem;
}

/* ---------------------------------------------------------------------------
   Spotify
--------------------------------------------------------------------------- */
.spotify {
  max-width: 560px;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.spotify iframe { display: block; }

/* ---------------------------------------------------------------------------
   Footer
--------------------------------------------------------------------------- */
.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 2.5rem 0 3.5rem;
  border-top: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
}

/* ---------------------------------------------------------------------------
   Responsive
--------------------------------------------------------------------------- */
@media (max-width: 900px) {
  /* Not enough room for the dot rail — hide the dots, keep the toggle in the
     top-right corner. */
  .sidebar {
    left: auto;
    top: 1rem;
    right: 1rem;
    transform: none;
    gap: 0;
  }
  .dotnav { display: none; }
}

@media (max-width: 640px) {
  .intro { padding: 3.5rem 0 2.5rem; }
  .timeline li { flex-direction: column; gap: 0.25rem; }
  .timeline__meta { flex-basis: auto; }
  .site-footer { flex-direction: column; gap: 0.35rem; }
}
