/* ============================================================
   Sam McDevitt — portfolio
   Palette: paper / blue-black ink / international orange
   Type: Archivo (display + body) · IBM Plex Mono (labels, data)
   ============================================================ */

:root {
  --bg: #F8F7F4;
  --surface: #FFFFFF;
  --ink: #16191D;
  --ink-2: #4C535B;
  --line: #E2DFD8;
  --line-strong: #C9C5BC;
  --accent: #D6491B;
  --accent-soft: rgba(214, 73, 27, 0.09);
  --accent-contrast: #FFFFFF;
  --grid-line: rgba(22, 25, 29, 0.045);

  --font-body: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;

  --container: 1080px;
  --radius: 6px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101317;
    --surface: #171B21;
    --ink: #E9E7E2;
    --ink-2: #9BA1A9;
    --line: #262B32;
    --line-strong: #3A414A;
    --accent: #FF6B42;
    --accent-soft: rgba(255, 107, 66, 0.12);
    --accent-contrast: #16191D;
    --grid-line: rgba(233, 231, 226, 0.04);
  }
}

:root[data-theme="light"] {
  --bg: #F8F7F4;
  --surface: #FFFFFF;
  --ink: #16191D;
  --ink-2: #4C535B;
  --line: #E2DFD8;
  --line-strong: #C9C5BC;
  --accent: #D6491B;
  --accent-soft: rgba(214, 73, 27, 0.09);
  --accent-contrast: #FFFFFF;
  --grid-line: rgba(22, 25, 29, 0.045);
}

:root[data-theme="dark"] {
  --bg: #101317;
  --surface: #171B21;
  --ink: #E9E7E2;
  --ink-2: #9BA1A9;
  --line: #262B32;
  --line-strong: #3A414A;
  --accent: #FF6B42;
  --accent-soft: rgba(255, 107, 66, 0.12);
  --accent-contrast: #16191D;
  --grid-line: rgba(233, 231, 226, 0.04);
}

/* ---------- reset & base ---------- */

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 56px 56px;
}

h1, h2, h3, h4 {
  margin: 0;
  line-height: 1.15;
  font-weight: 700;
  text-wrap: balance;
}

p { margin: 0; }
a { color: inherit; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img { max-width: 100%; }

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-contrast);
  padding: 10px 16px;
  z-index: 100;
}
.skip-link:focus { left: 0; }

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

/* ---------- shared text roles ---------- */

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}

.section-lede {
  color: var(--ink-2);
  max-width: 58ch;
  margin-top: 14px;
}

/* ---------- header / nav ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.nav {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.nav-brand {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 10px;
  height: 10px;
  background: var(--accent);
  display: inline-block;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
}

.nav-links a {
  font-size: 14.5px;
  font-weight: 500;
  text-decoration: none;
  color: var(--ink-2);
  transition: color 0.15s ease;
}
.nav-links a:hover { color: var(--ink); }

.nav-links a.nav-cta {
  color: var(--accent);
  font-weight: 600;
}

.theme-toggle {
  background: none;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-2);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--ink-2); }
.icon-moon { display: none; }
:root[data-theme="dark"] .icon-moon { display: block; }
:root[data-theme="dark"] .icon-sun { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-moon { display: block; }
  :root:not([data-theme="light"]) .icon-sun { display: none; }
}

.nav-toggle {
  display: none;
  background: none;
  border: 0;
  width: 40px;
  height: 40px;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--ink);
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-toggle[aria-expanded="true"] span:first-child { transform: translateY(4px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:last-child { transform: translateY(-4px) rotate(-45deg); }

/* ---------- hero ---------- */

.hero {
  position: relative;
  padding: 110px 0 90px;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}

#hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.hero-inner { position: relative; }

.hero-title {
  font-size: clamp(38px, 6.4vw, 68px);
  font-weight: 800;
  letter-spacing: -0.022em;
  line-height: 1.04;
  max-width: 16ch;
}

.hero-lede {
  margin-top: 26px;
  max-width: 62ch;
  font-size: 18.5px;
  color: var(--ink-2);
}

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

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--accent);
  color: var(--accent-contrast);
}
.btn-primary:hover { filter: brightness(1.07); }

.btn-ghost {
  border-color: var(--line-strong);
  color: var(--ink);
  background: transparent;
}
.btn-ghost:hover { border-color: var(--ink-2); background: var(--surface); }

.btn-lg { padding: 15px 30px; font-size: 17px; }

/* ---------- stat row ---------- */

.stat-row {
  margin: 64px 0 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--line);
  background: var(--surface);
}

.stat {
  padding: 22px 24px;
  border-right: 1px solid var(--line);
}
.stat:last-child { border-right: 0; }

.stat dt {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.stat dd {
  margin: 0 0 6px;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 34px;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.stat-unit { color: var(--accent); }

/* ---------- sections ---------- */

.section { padding: 96px 0; }

.section-alt {
  background: var(--surface);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.section-head { margin-bottom: 52px; }
.section-head h2 {
  font-size: clamp(28px, 3.6vw, 40px);
  font-weight: 800;
  letter-spacing: -0.015em;
}

/* ---------- work grid ---------- */

.work-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.work-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 30px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.work-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.section-alt .work-card { background: var(--bg); }

.work-tag {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.work-card h3 { font-size: 21px; }

.work-card p { color: var(--ink-2); font-size: 15.5px; }
.work-card p strong { color: var(--ink); }

.work-meta {
  margin-top: auto;
  padding-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.work-meta li {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-2);
  border: 1px solid var(--line);
  padding: 3px 10px;
  border-radius: 999px;
}

/* ---------- timeline ---------- */

.timeline {
  display: flex;
  flex-direction: column;
}

.timeline-item {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 32px;
  padding: 30px 0;
  border-bottom: 1px solid var(--line);
}
.timeline-item:first-child { border-top: 1px solid var(--line); }

.timeline-date {
  font-family: var(--font-mono);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
  padding-top: 4px;
  white-space: nowrap;
}

.timeline-body h3 { font-size: 19px; }
.timeline-body .at { color: var(--ink-2); font-weight: 500; }
.timeline-body p { margin-top: 10px; color: var(--ink-2); font-size: 15.5px; max-width: 68ch; }

.clearance {
  margin-top: 36px;
  font-size: 14px;
  color: var(--ink-2);
}
.clearance-label {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-right: 12px;
}

/* ---------- featured project ---------- */

.project-panel {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 30px 40px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 40px;
}

.project-panel + .project-panel { margin-top: 28px; }

.project-head {
  grid-column: 1 / -1;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}
.project-head h3 {
  font-size: 25px;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.project-head p {
  margin-top: 8px;
  color: var(--ink-2);
  max-width: 68ch;
}

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

.project-points {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 32px;
}
.project-points li {
  color: var(--ink-2);
  font-size: 15.5px;
  padding-left: 22px;
  position: relative;
}
.project-points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  width: 8px;
  height: 8px;
  background: var(--accent-soft);
  border: 1.5px solid var(--accent);
}
.project-points strong {
  color: var(--ink);
  display: block;
  margin-bottom: 3px;
}

.project-side h4 {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-bottom: 12px;
}
.project-side h4 + .side-list { margin-bottom: 28px; }

.side-list li {
  font-size: 14.5px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
}
.side-list li:first-child { border-top: 1px solid var(--line); }

.mono-list li {
  font-family: var(--font-mono);
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}

/* ---------- skills ---------- */

.skills-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px 56px;
}

.skill-group h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--accent);
  display: inline-block;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip-list li {
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 6px 13px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-2);
}

.section:not(.section-alt) .chip-list li { background: var(--surface); }

/* ---------- education & publication ---------- */

.edu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 56px;
}

.edu-list { display: flex; flex-direction: column; gap: 24px; }
.edu-list h3 { font-size: 17px; }
.edu-meta {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-2);
  margin-top: 5px;
}

.pub-cite {
  color: var(--ink-2);
  font-size: 15.5px;
  max-width: 52ch;
  border-left: 3px solid var(--accent);
  padding-left: 18px;
}

/* ---------- contact ---------- */

.section-contact {
  text-align: center;
  border-top: 1px solid var(--line);
  padding: 120px 0;
}

.contact-title {
  font-size: clamp(28px, 4.4vw, 46px);
  font-weight: 800;
  letter-spacing: -0.018em;
  margin-bottom: 36px;
}

.section-contact .hero-actions { justify-content: center; }

.contact-links {
  margin-top: 32px;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px 32px;
  font-family: var(--font-mono);
  font-size: 13.5px;
  color: var(--ink-2);
}
.contact-links a {
  text-decoration: none;
  border-bottom: 1px solid var(--line-strong);
  transition: color 0.15s ease, border-color 0.15s ease;
}
.contact-links a:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- footer ---------- */

.site-footer {
  border-top: 1px solid var(--line);
  padding: 28px 0;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ink-2);
}

/* ---------- reveal animation ---------- */

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}
.reveal.in {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  #hero-canvas { display: none; }
}

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .stat-row { grid-template-columns: 1fr 1fr; }
  .stat:nth-child(2) { border-right: 0; }
  .stat:nth-child(1), .stat:nth-child(2) { border-bottom: 1px solid var(--line); }
  .work-grid { grid-template-columns: 1fr; }
  .project-panel { grid-template-columns: 1fr; padding: 30px 24px; }
  .edu-grid { grid-template-columns: 1fr; gap: 40px; }
}

@media (max-width: 720px) {
  .section { padding: 68px 0; }
  .hero { padding: 72px 0 60px; }

  .nav-toggle { display: flex; }

  .nav-links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: flex-start;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    padding: 20px 24px 24px;
    gap: 18px;
  }
  .nav-links.open { display: flex; }

  .timeline-item {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 24px 0;
  }

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