/* ==========================================================================
   Tokens
   Light is the base palette; dark overrides follow. The inline script in
   <head> stamps data-theme on <html> before paint, defaulting to dark.
   ========================================================================== */

:root {
  --bg: #fbfaf8;
  --bg-alt: #f2efea;
  --surface: #ffffff;
  --surface-hover: #f7f5f1;
  --border: #e0dcd4;
  --border-strong: #c9c3b8;

  --text: #1b2430;
  --text-muted: #5c6672;
  --text-faint: #8a939f;

  --accent: #0f766e;
  --accent-hover: #0d5f59;
  --accent-soft: rgba(15, 118, 110, 0.1);
  --meta: #a16207;
  --add: #15803d;

  --shadow-sm: 0 1px 2px rgba(27, 36, 48, 0.06);
  --shadow-md: 0 4px 16px rgba(27, 36, 48, 0.08);

  --mono: 'Fira Code', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI',
    Helvetica, Arial, sans-serif;

  --wrap: 1000px;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0c1016;
    --bg-alt: #11161f;
    --surface: #141b25;
    --surface-hover: #1a222e;
    --border: #232d3b;
    --border-strong: #33404f;

    --text: #ccd6e0;
    --text-muted: #8b98a8;
    --text-faint: #6b7787;

    --accent: #5eead4;
    --accent-hover: #99f6e4;
    --accent-soft: rgba(94, 234, 212, 0.12);
    --meta: #fbbf24;
    --add: #4ade80;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.45);
  }
}

:root[data-theme='dark'] {
  --bg: #0c1016;
  --bg-alt: #11161f;
  --surface: #141b25;
  --surface-hover: #1a222e;
  --border: #232d3b;
  --border-strong: #33404f;

  --text: #ccd6e0;
  --text-muted: #8b98a8;
  --text-faint: #6b7787;

  --accent: #5eead4;
  --accent-hover: #99f6e4;
  --accent-soft: rgba(94, 234, 212, 0.12);
  --meta: #fbbf24;
  --add: #4ade80;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.45);
}

/* ==========================================================================
   Base
   ========================================================================== */

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 90px; /* clears the sticky header on anchor jumps */
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

h1,
h2,
h3,
h4 {
  font-family: var(--mono);
  margin: 0 0 10px;
  line-height: 1.25;
  color: var(--text);
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
  text-underline-offset: 3px;
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ==========================================================================
   Scroll progress
   ========================================================================== */

#scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0%;
  background: var(--accent);
  z-index: 2000;
  transition: width 0.1s linear;
}

/* ==========================================================================
   Header
   ========================================================================== */

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 16px max(32px, calc((100% - var(--wrap)) / 2 + 24px));
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.logo {
  font-family: var(--mono);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.02em;
}

.logo::before {
  content: '$ ';
  color: var(--text-faint);
  font-weight: 400;
}

#theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  font-size: 0.95rem;
  line-height: 1;
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease,
    border-color 0.2s ease;
}

#theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* ==========================================================================
   Terminal window — the whole site lives inside it
   ========================================================================== */

.terminal {
  max-width: var(--wrap);
  margin: 40px auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.terminal-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
}

.terminal-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--border-strong);
  flex-shrink: 0;
}

.terminal-title {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-faint);
  margin-left: 6px;
}

/* Tab bar */

.tabbar {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 0 10px;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
}

.tab {
  font-family: var(--mono);
  font-size: 0.84rem;
  padding: 11px 15px;
  background: transparent;
  color: var(--text-muted);
  border: 0;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color 0.18s ease, border-color 0.18s ease,
    background-color 0.18s ease;
}

.tab::before {
  content: '';
  color: var(--text-faint);
}

.tab:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: var(--surface);
}

.terminal-body {
  padding: 32px 36px 40px;
  font-family: var(--mono);
  min-height: 460px;
}

/* Panes */

.pane:focus {
  outline: none;
}

.pane-enter {
  animation: paneIn 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes paneIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.prompt-line {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0 0 20px;
}

.prompt-line .prompt {
  color: var(--accent);
  user-select: none;
}

.profile-pic {
  width: 150px;
  height: 150px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  margin-bottom: 22px;
  display: block;
}

.terminal-body h1 {
  font-size: 2.1rem;
  margin: 0 0 12px;
  letter-spacing: -0.01em;
}

.role-line {
  font-family: var(--mono);
  font-size: 1.05rem;
  color: var(--text-muted);
  margin: 0 0 18px;
  min-height: 1.6em; /* reserves space so typing does not shift layout */
}

.role-line::before {
  content: '> ';
  color: var(--accent);
}

.cursor {
  display: inline-block;
  width: 9px;
  height: 1.05em;
  background: var(--accent);
  vertical-align: text-bottom;
  margin-left: 2px;
  animation: blink 1.1s step-end infinite;
}

@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

.hero-tagline {
  font-family: var(--mono);
  font-size: 0.88rem;
  line-height: 1.85;
  color: var(--text-muted);
  max-width: 68ch;
  margin: 0 0 26px;
}

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

.btn {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.88rem;
  padding: 9px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  color: var(--text);
  background: transparent;
  transition: background-color 0.2s ease, border-color 0.2s ease,
    color 0.2s ease, transform 0.15s ease;
}

.btn:hover {
  text-decoration: none;
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-1px);
}

.btn-primary {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

/* ==========================================================================
   Sections
   ========================================================================== */

.pane p {
  margin: 0 0 1.1rem;
  max-width: 74ch;
  color: var(--text-muted);
  font-family: var(--sans);
}

/* whoami and about read as terminal output. Mono at a smaller size with
   extra line-height stays legible for paragraph-length text. */
#whoami p,
#about p {
  font-family: var(--mono);
}

#about p {
  font-size: 0.86rem;
  line-height: 1.95;
  max-width: 82ch;
}

.pane h3 {
  font-size: 1.05rem;
}

.pane .hint {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--text-faint);
  margin-top: 1.8rem;
}

.pane .hint::before {
  content: '// ';
}

/* Photo block — floats beside the about text so the prose wraps around it. */
.photo {
  float: right;
  width: 232px;
  max-width: 42%;
  margin: 4px 0 18px 26px;
}

.photo img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.photo figcaption {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-faint);
  margin-top: 8px;
  line-height: 1.5;
}

.photo figcaption::before {
  content: '// ';
}

/* Coursework sits below the float rather than beside it. */
#about h3 {
  clear: both;
}

/* Coursework chips */

.course-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
}

.course-tags li {
  font-family: var(--mono);
  font-size: 0.8rem;
  background: var(--surface);
  color: var(--text-muted);
  padding: 5px 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.course-tags li:hover {
  color: var(--accent);
  border-color: var(--accent);
}

#about h3 {
  margin-top: 2rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  text-transform: lowercase;
  letter-spacing: 0.04em;
}

#about h3::before {
  content: '// ';
  color: var(--text-faint);
}

/* ==========================================================================
   Experience — styled as `git log` output
   ========================================================================== */

.commits {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  margin-top: 1.75rem;
  border-left: 1px solid var(--border);
  padding-left: 1.9rem;
}

.commit {
  position: relative;
}

/* The commit node on the graph rail. */
.commit::before {
  content: '';
  position: absolute;
  left: calc(-1.9rem - 5px);
  top: 0.42rem;
  width: 9px;
  height: 9px;
  background: var(--bg);
  border: 2px solid var(--accent);
  border-radius: 50%;
}

.commit-line {
  font-family: var(--mono);
  font-size: 0.82rem;
  margin: 0 0 12px;
  line-height: 1.5;
}

.hash {
  color: var(--meta);
  font-weight: 500;
}

.hash::before {
  content: 'commit ';
  color: var(--text-faint);
  font-weight: 400;
}

.refs {
  color: var(--text-faint);
  margin-left: 8px;
}

.ref-head {
  color: var(--accent);
  font-weight: 500;
}

.ref-tag {
  color: var(--meta);
}

.commit .org-mark {
  margin: 0 0 10px;
}

.commit h3 {
  margin: 0 0 6px;
  font-size: 1.02rem;
  line-height: 1.4;
  color: var(--text);
}

.commit .meta {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0 0 4px;
  max-width: none;
}

.commit .k {
  color: var(--text-faint);
  display: inline-block;
  min-width: 4.2em;
}

/* Accomplishments read as added lines in a diff. */
.diff {
  list-style: none;
  margin: 14px 0 12px;
  padding: 0;
  font-size: 0.92rem;
  color: var(--text-muted);
}

.diff li {
  position: relative;
  padding-left: 1.4rem;
  margin-bottom: 0.5rem;
  line-height: 1.65;
}

.diff li::before {
  content: '+';
  position: absolute;
  left: 0;
  top: 0;
  font-family: var(--mono);
  font-weight: 700;
  color: var(--add);
}

.stack {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-faint);
  margin: 0;
  max-width: none;
}

.stack .k {
  color: var(--text-faint);
  min-width: 0;
  margin-right: 6px;
}


.item-head {
  margin-bottom: 14px;
}

.org-mark {
  display: block;
  width: auto;
  max-width: 190px;
  margin-bottom: 10px;
}

/* Monochrome marks are dark navy, which disappears on the dark palette.
   Flattening to white keeps them legible; colored marks are left alone. */
:root[data-theme='dark'] .org-mark.mono {
  filter: brightness(0) invert(1) opacity(0.85);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .org-mark.mono {
    filter: brightness(0) invert(1) opacity(0.85);
  }
}

.org-text {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  line-height: 1.6;
}


/* Inline "jump to another pane" trigger — a button that reads as a link. */
.inline-link {
  font: inherit;
  color: var(--accent);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  border-bottom: 1px solid transparent;
}

.inline-link:hover {
  border-bottom-color: var(--accent);
}


/* ==========================================================================
   Teaching — a columnar roster, read as tab-separated shell output
   ========================================================================== */

.roster {
  list-style: none;
  padding: 0;
  margin: 1.75rem 0 0;
  font-family: var(--mono);
  font-size: 0.82rem;
  border-top: 1px solid var(--border);
}

.roster li {
  display: grid;
  grid-template-columns: 12rem 5.5rem minmax(0, 1fr) 10.5rem;
  gap: 0 0.9rem;
  padding: 11px 6px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  transition: background-color 0.2s ease;
}

.roster li:not(.roster-head):hover {
  background: var(--surface-hover);
}

.roster-head {
  color: var(--text-faint);
  text-transform: lowercase;
  letter-spacing: 0.04em;
}

.roster-head .r-term::before {
  content: '# ';
}

.r-term {
  color: var(--meta);
}

.roster-head .r-term {
  color: var(--text-faint);
}

.r-role {
  color: var(--text-faint);
}

.roster .current .r-role {
  color: var(--accent);
  font-weight: 500;
}

/* Marks the appointment currently in progress. */
.roster .current .r-term::after {
  content: ' ●';
  color: var(--accent);
  font-size: 0.7em;
  vertical-align: middle;
}

.r-course {
  color: var(--text);
}

.r-course b {
  color: var(--accent);
  font-weight: 500;
  margin-right: 0.5em;
}

.r-prof {
  color: var(--text-faint);
}

.roster-summary {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-faint);
  margin-top: 1rem;
  max-width: none;
}

.roster-summary::before {
  content: '// ';
}

#teaching .org-mark {
  margin-bottom: 18px;
}


/* ==========================================================================
   Projects
   ========================================================================== */

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 26px;
}

.filter-chip {
  font-family: var(--mono);
  font-size: 0.8rem;
  padding: 6px 13px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease,
    background-color 0.2s ease;
}

.filter-chip:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.filter-chip[aria-pressed='true'] {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
  align-items: start;
}

/* Each project is a small terminal pane: a `cat` command line above the
   file's contents. */
.project {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease,
    border-color 0.2s ease;
}

.project:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.file-line {
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--text-faint);
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  padding: 8px 14px;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-line .prompt {
  color: var(--accent);
  margin-right: 6px;
  user-select: none;
}

.file-line .path {
  color: var(--text-muted);
}

.project-body {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  flex: 1;
}

.project h3 {
  font-size: 0.98rem;
  margin: 0;
}

.project .ext {
  font-size: 0.8em;
  opacity: 0.7;
}

.project p {
  font-size: 0.86rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.7;
  font-family: var(--sans);
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
  padding-top: 4px;
}

.project-tags span {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-faint);
  padding: 2px 0;
}

.project-tags span::before {
  content: '#';
  color: var(--accent);
  opacity: 0.65;
}

/* Hidden by the tag filter. Uses a class rather than inline styles so the
   entry animation state is not clobbered. */
.project.filtered-out {
  display: none;
}


/* ==========================================================================
   Contact
   ========================================================================== */

.contact-list {
  list-style: none;
  padding: 0;
  margin: 0;
  font-family: var(--mono);
  font-size: 0.92rem;
}

.contact-list li {
  margin: 0 0 12px;
  color: var(--text-muted);
}

.contact-list li::before {
  content: '$ ';
  color: var(--accent);
}

.contact-list .label {
  color: var(--text-faint);
  margin-right: 8px;
}

/* ==========================================================================
   Footer
   ========================================================================== */

footer {
  padding: 28px 24px;
  border-top: 1px solid var(--border);
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 0.8rem;
  text-align: center;
  margin-top: 40px;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 780px) {
  header {
    padding: 12px 18px;
  }

  .terminal {
    margin: 18px 14px;
  }

  .tabbar {
    padding: 0 6px;
  }

  .tab {
    font-size: 0.78rem;
    padding: 10px 10px;
  }

  .terminal-body {
    padding: 24px 20px 28px;
    min-height: 0;
  }

  .terminal-body h1 {
    font-size: 1.65rem;
  }

  .role-line {
    font-size: 0.95rem;
  }

  .photo {
    float: none;
    width: 100%;
    max-width: 320px;
    margin: 0 0 20px;
  }

  .commits {
    padding-left: 1.25rem;
    gap: 1.75rem;
  }

  .commit::before {
    left: calc(-1.25rem - 5px);
  }

  .commit .k {
    min-width: 0;
    margin-right: 6px;
  }

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

  /* The roster drops its columns and stacks each appointment as a block.
     Qualified with li so it outranks the `.roster li { display: grid }` base
     rule, which is one specificity point higher than `.roster-head` alone. */
  .roster li.roster-head {
    display: none;
  }

  .roster li {
    grid-template-columns: auto 1fr;
    gap: 3px 0.85rem;
    padding: 14px 4px;
  }

  .roster .r-course,
  .roster .r-prof {
    grid-column: 1 / -1;
  }

  .roster .r-course {
    margin-top: 4px;
  }
}

@media (max-width: 460px) {
  .logo {
    font-size: 1rem;
  }

  .terminal-title {
    display: none;
  }

  .hero-actions .btn {
    flex: 1 1 100%;
    text-align: center;
  }
}

/* ==========================================================================
   Reduced motion
   ========================================================================== */

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

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .pane-enter {
    animation: none;
  }
}
