/* ---------------------------------------------------------------
   Design tokens
   Light: warm cool-gray "paper" / graphite ink
   Dark:  blue-black "ink" / warm paper text
   Accent: "signal" teal -- an annotation/overlay color, nodding to
   keypoint boxes + OCR bounding boxes (the subject's own CV work)
   --------------------------------------------------------------- */
:root {
  --ink: #14181c;
  --paper: #f5f4f0;
  --paper-raised: #fbfaf7;
  --text: #3a3f45;
  --text-muted: #62686f;
  --border: #dcdad3;
  --signal: #2fa8a0;
  --signal-text: #1f7871;
  --signal-soft: rgba(47, 168, 160, 0.12);
  --shadow: 0 1px 2px rgba(20, 24, 28, 0.04), 0 8px 24px rgba(20, 24, 28, 0.06);
  --texture-dot: rgba(58, 63, 69, 0.14);
  --texture-opacity: 0.5;

  --font-display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-sans: "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, monospace;

  --container: 1024px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #14181c;
    --paper-raised: #1b2126;
    --text: #ececea;
    --text-muted: #a2a9b0;
    --border: #2a3037;
    --signal-text: #7ee4da;
    --signal-soft: rgba(126, 228, 218, 0.1);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 32px rgba(0, 0, 0, 0.4);
    --texture-dot: rgba(126, 228, 218, 0.06);
    --texture-opacity: 1;
  }
}

:root[data-theme="dark"] {
  --paper: #14181c;
  --paper-raised: #1b2126;
  --text: #ececea;
  --text-muted: #a2a9b0;
  --border: #2a3037;
  --signal-text: #7ee4da;
  --signal-soft: rgba(126, 228, 218, 0.1);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 32px rgba(0, 0, 0, 0.4);
  --texture-dot: rgba(126, 228, 218, 0.06);
  --texture-opacity: 1;
}

/* ---------------------------------------------------------------
   Reset & base
   --------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }

body {
  background: var(--paper);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

#page-root { position: relative; z-index: 1; min-height: 100%; display: flex; flex-direction: column; }

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: var(--texture-opacity);
  background-image: radial-gradient(var(--texture-dot) 1px, transparent 1px);
  background-size: 28px 28px;
}

::selection { background: var(--signal-soft); color: var(--signal-text); }

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

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.01em; color: var(--text); }

/* ---------------------------------------------------------------
   Layout helpers
   --------------------------------------------------------------- */
.section-inner, .nav-inner, .hero, .footer-inner {
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 24px;
}

.section { padding-block: 56px; }
@media (min-width: 1024px) { .section { padding-block: 80px; } }

.eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--signal-text);
}

.section-heading { margin-bottom: 40px; }
.heading-row { margin-top: 8px; display: flex; align-items: center; gap: 16px; }
.heading-row h2 { font-size: 1.5rem; }
@media (min-width: 640px) { .heading-row h2 { font-size: 1.75rem; } }
.hr { height: 1px; flex: 1; background: var(--border); }

/* ---------------------------------------------------------------
   Nav
   --------------------------------------------------------------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--paper);
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 16px;
}
.nav-name { font-family: var(--font-display); font-weight: 600; font-size: 0.9rem; }
.nav-links { display: none; align-items: center; gap: 28px; }
.nav-links a {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  transition: color 0.15s ease;
}
.nav-links a:hover { color: var(--signal-text); }
@media (min-width: 768px) { .nav-links { display: flex; } }

.nav-actions { display: flex; align-items: center; gap: 12px; }
.nav-resume {
  display: none;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  transition: color 0.15s ease;
}
.nav-resume:hover { color: var(--signal-text); }
@media (min-width: 640px) { .nav-resume { display: inline; } }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  width: 36px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: color 0.15s ease, border-color 0.15s ease;
}
.icon-btn:hover { border-color: var(--signal); color: var(--signal-text); }
.icon-btn-lg { height: 40px; width: 40px; }

#theme-toggle .icon-moon { display: block; }
#theme-toggle .icon-sun { display: none; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) #theme-toggle .icon-moon { display: none; }
  :root:not([data-theme="light"]) #theme-toggle .icon-sun { display: block; }
}

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

/* ---------------------------------------------------------------
   Hero
   --------------------------------------------------------------- */
.hero {
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 48px;
  padding-block: 64px 56px;
}
@media (min-width: 1024px) {
  .hero {
    flex-direction: row;
    align-items: center;
    gap: 64px;
    padding-block: 128px 80px;
  }
}

.hero-text { flex: 1; text-align: center; }
@media (min-width: 1024px) { .hero-text { text-align: left; } }

.hero-name {
  margin-top: 16px;
  font-size: 2.5rem;
  line-height: 1.05;
}
@media (min-width: 640px) { .hero-name { font-size: 3rem; } }
@media (min-width: 1024px) { .hero-name { font-size: 3.75rem; } }

.hero-tagline {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
@media (min-width: 1024px) { .hero-tagline { align-items: flex-start; } }
.hero-role { font-family: var(--font-display); font-weight: 500; font-size: 1.125rem; color: var(--signal-text); }
@media (min-width: 640px) { .hero-role { font-size: 1.25rem; } }
.hero-domains { font-family: var(--font-mono); font-size: 0.875rem; color: var(--text-muted); }
@media (min-width: 640px) { .hero-domains { font-size: 1rem; } }

.hero-summary {
  margin: 24px auto 0;
  max-width: 36rem;
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text-muted);
}
@media (min-width: 1024px) { .hero-summary { margin-left: 0; } }

.hero-actions {
  margin-top: 32px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
@media (min-width: 1024px) { .hero-actions { justify-content: flex-start; } }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 10px 20px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  transition: transform 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn-primary { background: var(--signal); color: #0b1210; }
.btn-primary:hover { transform: translateY(-2px); }
.btn-outline { border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--signal); color: var(--signal-text); }

.divider { display: none; width: 1px; height: 24px; background: var(--border); margin-inline: 4px; }
@media (min-width: 640px) { .divider { display: block; } }

.hero-photo { flex-shrink: 0; }
.reticle { position: relative; }
.photo-frame {
  position: relative;
  height: 176px;
  width: 176px;
  overflow: hidden;
  border-radius: 1.75rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  background:
    radial-gradient(circle at 50% 30%, var(--signal-soft), transparent 65%),
    var(--paper-raised);
}
.photo-frame img { height: 100%; width: 100%; object-fit: cover; object-position: center 18%; }
@media (min-width: 640px) { .photo-frame { height: 224px; width: 224px; } }
@media (min-width: 1024px) { .photo-frame { height: 256px; width: 256px; } }

.reticle-mark {
  position: absolute;
  width: 22px;
  height: 22px;
  border: 2px solid var(--signal);
  opacity: 0.9;
}
.reticle-tl { top: -10px; left: -10px; border-right: none; border-bottom: none; }
.reticle-tr { top: -10px; right: -10px; border-left: none; border-bottom: none; }
.reticle-bl { bottom: -10px; left: -10px; border-right: none; border-top: none; }
.reticle-br { bottom: -10px; right: -10px; border-left: none; border-top: none; }

@media (prefers-reduced-motion: no-preference) {
  #hero-reticle .reticle-tl { animation: snap-tl 0.7s cubic-bezier(0.16, 1, 0.3, 1) both; }
  #hero-reticle .reticle-tr { animation: snap-tr 0.7s cubic-bezier(0.16, 1, 0.3, 1) both; }
  #hero-reticle .reticle-bl { animation: snap-bl 0.7s cubic-bezier(0.16, 1, 0.3, 1) both; }
  #hero-reticle .reticle-br { animation: snap-br 0.7s cubic-bezier(0.16, 1, 0.3, 1) both; }
}
@keyframes snap-tl { from { transform: translate(-14px, -14px); opacity: 0; } to { transform: translate(0, 0); opacity: 0.9; } }
@keyframes snap-tr { from { transform: translate(14px, -14px); opacity: 0; } to { transform: translate(0, 0); opacity: 0.9; } }
@keyframes snap-bl { from { transform: translate(-14px, 14px); opacity: 0; } to { transform: translate(0, 0); opacity: 0.9; } }
@keyframes snap-br { from { transform: translate(14px, 14px); opacity: 0; } to { transform: translate(0, 0); opacity: 0.9; } }

/* Project card hover reticle -- hidden until interaction */
.project-card .reticle-mark { opacity: 0; transition: opacity 0.2s ease; animation: none; }
.project-card:hover .reticle-mark,
.project-card:focus-visible .reticle-mark { opacity: 0.9; }

/* ---------------------------------------------------------------
   About / skills
   --------------------------------------------------------------- */
.skills-grid { display: grid; gap: 24px; }
@media (min-width: 640px) { .skills-grid { grid-template-columns: 1fr 1fr; } }

.skill-card {
  border: 1px solid var(--border);
  background: var(--paper-raised);
  border-radius: 1rem;
  padding: 24px;
}
.skill-card h3 {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--signal-text);
  font-weight: 400;
}

.chip-row { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.875rem;
  color: var(--text-muted);
}
.chip-mono {
  border: none;
  background: var(--signal-soft);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--signal-text);
}

/* ---------------------------------------------------------------
   Experience timeline
   --------------------------------------------------------------- */
.timeline { position: relative; border-left: 1px solid var(--border); padding-left: 32px; }
@media (min-width: 640px) { .timeline { padding-left: 40px; } }

.timeline > li { margin-bottom: 48px; position: relative; }
.timeline > li:last-child { margin-bottom: 0; }

.timeline-dot {
  position: absolute;
  left: -37px;
  top: 6px;
  height: 12px;
  width: 12px;
  border-radius: 999px;
  border: 2px solid var(--signal);
  background: var(--paper);
}
@media (min-width: 640px) { .timeline-dot { left: -45px; } }

.timeline-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
}
.timeline-head h3 { font-size: 1.125rem; }
.timeline-head h3 span { font-family: var(--font-sans); font-weight: 400; color: var(--text-muted); }
.timeline-date {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  white-space: nowrap;
}

.bullets { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.bullets li {
  position: relative;
  padding-left: 18px;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-muted);
}
.bullets li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.6em;
  height: 4px;
  width: 4px;
  border-radius: 999px;
  background: var(--signal);
}

.education-card {
  margin-top: 16px;
  border: 1px solid var(--border);
  background: var(--paper-raised);
  border-radius: 1rem;
  padding: 20px 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
}
.education-card h3 { font-size: 1rem; }
.education-card h3 span { font-family: var(--font-sans); font-weight: 400; color: var(--text-muted); }

/* ---------------------------------------------------------------
   Projects
   --------------------------------------------------------------- */
.projects-grid { display: grid; gap: 24px; }
@media (min-width: 640px) { .projects-grid { grid-template-columns: 1fr 1fr; } }

.project-card {
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  background: var(--paper-raised);
  border-radius: 1rem;
  padding: 24px;
  transition: border-color 0.15s ease;
}
.project-card:hover { border-color: transparent; }

.project-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.project-head h3 { font-size: 1.125rem; }
.project-head svg { flex-shrink: 0; margin-top: 4px; color: var(--text-muted); transition: color 0.15s ease; }
.project-card:hover .project-head svg { color: var(--signal-text); }

.project-card .chip-row { margin-top: 12px; }
.project-bullets { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.project-bullets li { font-size: 0.9rem; line-height: 1.6; color: var(--text-muted); }

/* ---------------------------------------------------------------
   Research
   --------------------------------------------------------------- */
.research-grid { display: grid; gap: 40px; }
@media (min-width: 640px) { .research-grid { grid-template-columns: 1fr 1fr; } }

.research-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--text-muted);
  font-weight: 400;
}
.research-list { margin-top: 16px; display: flex; flex-direction: column; gap: 20px; }

.research-title {
  display: inline-flex;
  align-items: flex-start;
  gap: 6px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--text);
}
.research-title:hover { color: var(--signal-text); }
.research-title svg { margin-top: 4px; flex-shrink: 0; color: var(--text-muted); }
.research-title:hover svg { color: var(--signal-text); }

.research-meta { margin-top: 4px; font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-muted); }
.research-text { font-weight: 500; line-height: 1.4; color: var(--text); }
.research-meta-link {
  margin-top: 4px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}
.research-meta-link:hover { color: var(--signal-text); }

/* ---------------------------------------------------------------
   Footer
   --------------------------------------------------------------- */
.footer { margin-top: auto; border-top: 1px solid var(--border); }
.footer-inner { padding-block: 64px; text-align: center; }
.footer-inner h2 {
  margin: 12px auto 0;
  max-width: 28rem;
  font-size: 1.5rem;
}
@media (min-width: 640px) { .footer-inner h2 { font-size: 1.875rem; } }

.footer-email {
  margin-top: 24px;
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 1rem;
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-underline-offset: 4px;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}
.footer-email:hover { color: var(--signal-text); text-decoration-color: var(--signal); }
@media (min-width: 640px) { .footer-email { font-size: 1.125rem; } }

.footer-icons { margin-top: 32px; display: flex; align-items: center; justify-content: center; gap: 12px; }
.footer-copy { margin-top: 48px; font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-muted); }

/* ---------------------------------------------------------------
   Scroll reveal
   --------------------------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
  .reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1); }
  .reveal.is-visible { opacity: 1; transform: translateY(0); }
}
