/* =========================================================
   Zack Hadley — restrained, editorial design system
   ========================================================= */
:root {
  color-scheme: dark;

  --bg: #0a0a0b;
  --bg-2: #0e0e10;
  --surface: #101012;
  --surface-2: #16161a;
  --line: rgb(255 255 255 / 0.08);
  --line-strong: rgb(255 255 255 / 0.16);

  --ink: #f6f6f7;
  --ink-soft: #cfd2da;
  --muted: #969aa6;
  --muted-2: #6c707c;

  --accent: #5b8def;
  --accent-bright: #6f9bf2;
  --accent-ink: #0a0c12;
  --accent-tint: rgb(91 141 239 / 0.12);
  --accent-line: rgb(91 141 239 / 0.32);
  --grid-line: rgb(91 141 239 / 0.13);

  --radius: 10px;
  --radius-sm: 8px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --shell: min(100% - 48px, 1120px);

  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

[data-theme="light"] {
  color-scheme: light;

  --bg: #f5f6f8;
  --bg-2: #eceef2;
  --surface: #ffffff;
  --surface-2: #eceef2;
  --line: rgb(0 0 0 / 0.08);
  --line-strong: rgb(0 0 0 / 0.14);

  --ink: #0d0f14;
  --ink-soft: #2e3240;
  --muted: #5a5f6e;
  --muted-2: #8a8f9e;

  --accent: #3b6fd4;
  --accent-bright: #2d5dbf;
  --accent-ink: #ffffff;
  --accent-tint: rgb(59 111 212 / 0.1);
  --accent-line: rgb(59 111 212 / 0.28);
  --grid-line: rgb(59 111 212 / 0.09);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
::selection { background: rgb(255 255 255 / 0.16); }

/* =========================================================
   Retro grid background
   ========================================================= */
.bg-grid-wrap {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  perspective: 360px;
  perspective-origin: 50% 50%;
  pointer-events: none;
}
.bg-grid-top,
.bg-grid-bottom {
  width: 200%;
  height: 130%;
  position: absolute;
  left: -50%;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px);
  background-size: 100px 100px;
  background-position: -1px -1px;
}
.bg-grid-top {
  bottom: -30%;
  transform: rotateX(85deg);
  animation: bgGridTop 2s infinite linear;
}
.bg-grid-bottom {
  top: -30%;
  transform: rotateX(-85deg);
  animation: bgGridBottom 2s infinite linear;
}
@keyframes bgGridTop {
  from { background-position: 0px -100px, 0px 0px; }
  to   { background-position: 0px 0px, 100px 0px; }
}
@keyframes bgGridBottom {
  from { background-position: 0px 0px, 0px 0px; }
  to   { background-position: 0px -100px, 100px 0px; }
}

main { position: relative; z-index: 1; }

/* =========================================================
   Typography
   ========================================================= */
h1, h2, h3 {
  margin: 0;
  color: var(--ink);
  font-weight: 600;
  letter-spacing: -0.025em;
}
h1 { font-size: clamp(2.4rem, 5vw, 3.9rem); line-height: 1.05; }
h2 { font-size: clamp(1.6rem, 2.8vw, 2.3rem); line-height: 1.12; }
h3 { font-size: 1.12rem; line-height: 1.3; letter-spacing: -0.015em; }
p { margin: 0; color: var(--muted); }

.eyebrow {
  display: block;
  margin: 0 0 18px;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

/* =========================================================
   Layout
   ========================================================= */
.shell { width: var(--shell); margin-inline: auto; }
main { padding-bottom: 24px; }

.section-shell { width: var(--shell); margin: clamp(64px, 9vw, 104px) auto 0; }

.section-heading { max-width: 680px; margin-bottom: 40px; }
.section-heading h2 { max-width: 18ch; }
.section-heading p:not(.eyebrow) {
  margin-top: 16px;
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--ink-soft);
}

.resume-name {
  margin-bottom: 18px;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.05;
}

.resume-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 32px;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: rgb(255 255 255 / 0.035);
  color: var(--ink-soft);
  transition: transform 0.18s var(--ease), background 0.18s var(--ease), border-color 0.18s var(--ease), color 0.18s var(--ease);
}
.icon-button:hover,
.icon-button:focus-visible {
  transform: translateY(-2px);
  border-color: var(--accent-line);
  background: var(--accent-tint);
  color: var(--ink);
  outline: none;
}
.icon-button svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* =========================================================
   Header
   ========================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid transparent;
  transition: background 0.25s var(--ease), border-color 0.25s var(--ease);
}
.site-header.scrolled {
  background: rgb(10 10 11 / 0.8);
  backdrop-filter: blur(12px);
  border-bottom-color: var(--line);
}
.header-inner {
  width: var(--shell);
  margin-inline: auto;
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand {
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: -0.02em;
  color: var(--ink);
}

/* =========================================================
   Hero
   ========================================================= */
.hero {
  width: var(--shell);
  margin-inline: auto;
  padding: clamp(56px, 9vw, 112px) 0 clamp(48px, 7vw, 88px);
}
.resume-hero {
  max-width: 760px;
  margin-inline: auto;
  text-align: center;
}
.hero-copy { max-width: 760px; }
.hero h1 { margin-bottom: 22px; }
.hero-role {
  margin: 0 0 22px;
  font-size: clamp(1.7rem, 3.4vw, 2.6rem);
  line-height: 1.12;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--ink);
}
.hero .lede {
  max-width: 620px;
  margin-inline: auto;
  font-size: clamp(1.05rem, 1.5vw, 1.2rem);
  line-height: 1.6;
  color: var(--ink-soft);
}
.hero-meta {
  margin-bottom: 26px;
  font-size: 0.9rem;
  color: var(--muted);
  letter-spacing: 0.01em;
}

/* =========================================================
   Stats
   ========================================================= */
.stats-strip {
  width: var(--shell);
  margin: clamp(8px, 2vw, 20px) auto 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.stats-strip div {
  padding: 28px;
  border-right: 1px solid var(--line);
}
.stats-strip div:last-child { border-right: 0; }
.stats-strip strong {
  display: block;
  margin-bottom: 6px;
  font-size: 1.55rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.stats-strip span { color: var(--muted); font-size: 0.94rem; }

/* =========================================================
   Resume entries
   ========================================================= */
.experience-grid {
  display: grid;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.experience-card {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 22px;
  padding: 30px;
  border-top: 1px solid var(--line);
  transition: background 0.18s var(--ease);
}
.experience-card:first-child { border-top: 0; }
.experience-card:hover { background: var(--bg-2); }

.resume-logo {
  width: 52px;
  height: 52px;
  display: block;
  object-fit: contain;
  border-radius: var(--radius-sm);
}
.experience-body { min-width: 0; }
.date-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.date {
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--accent);
}
.duration {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 7px;
}
.experience-body h3, .education-row h3 { margin-bottom: 6px; }
.meta { margin-bottom: 12px; color: var(--muted); font-size: 0.9rem; }
.experience-body > p:not(.meta) { color: var(--ink-soft); line-height: 1.6; max-width: 60ch; }

.tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 16px; }
.tags span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 11px;
  border-radius: 6px;
  border: 1px solid var(--accent-line);
  background: var(--accent-tint);
  color: var(--accent-bright);
  font-size: 0.78rem;
  font-weight: 500;
}
[data-theme="light"] .tags span {
  color: var(--accent);
  background: rgb(59 111 212 / 0.08);
  border-color: rgb(59 111 212 / 0.3);
}

/* =========================================================
   Education + strengths
   ========================================================= */
.resume-lower {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(260px, 0.9fr);
  gap: 16px;
}
.education-section {
  margin-bottom: 20px;
}
.education-block {
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  transition: background 0.18s var(--ease);
}
.education-block:hover { background: var(--bg-2); }
.strengths-block {
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.education-block .section-heading,
.strengths-block .section-heading { margin-bottom: 24px; }
.education-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 22px;
  align-items: center;
}
.education-row p { color: var(--ink-soft); font-size: 0.95rem; margin-top: 2px; }
.project-header .eyebrow,
.experience-header .eyebrow {
  color: var(--ink-soft);
  font-size: 0.95rem;
  margin-top: 2px;
}

/* =========================================================
   Projects
   ========================================================= */
.projects-section {
  margin-bottom: 20px;
}
.project-card {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 22px;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  transition: background 0.18s var(--ease);
}
.project-card:hover { background: var(--bg-2); }
.project-logo {
  background: #fff;
  object-fit: cover;
}
.project-body {
  min-width: 0;
}
.project-header h3,
.experience-header h3,
.education-row h3 {
  margin-bottom: 6px;
}
.project-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.project-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgb(255 255 255 / 0.14);
  background: rgb(255 255 255 / 0.05);
  color: var(--accent-bright);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  animation: statusFade 2.2s ease-in-out infinite;
}
@keyframes statusFade {
  0%, 100% { opacity: 0.38; }
  50% { opacity: 1; }
}
.experience-header {
  display: block;
}
.project-body > p:not(.meta) {
  color: var(--ink-soft);
  line-height: 1.6;
  max-width: 68ch;
}
.project-body > p:not(.meta) + p:not(.meta) {
  margin-top: 14px;
}

.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.checklist li {
  position: relative;
  padding: 14px 0 14px 26px;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.98rem;
}
.checklist li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 7px;
  height: 7px;
  margin-top: -3px;
  border-radius: 50%;
  background: var(--accent);
}
.checklist li:first-child { border-top: 0; padding-top: 0; }
.checklist li:first-child::before { top: 9px; margin-top: 0; }

/* =========================================================
   Theme toggle
   ========================================================= */
.theme-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 200;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease), transform 0.18s var(--ease);
  padding: 0;
}
.theme-toggle:hover {
  border-color: var(--accent-line);
  background: var(--accent-tint);
  color: var(--ink);
  transform: rotate(12deg);
}
.theme-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-sun { display: none; }
[data-theme="light"] .icon-sun { display: block; }
[data-theme="light"] .icon-moon { display: none; }

/* smooth color transitions on theme switch */
body, .site-header, .education-block, .experience-card, .experience-grid,
.project-card, .service-card, .service-grid, .cta-band, .site-footer, .icon-button, .theme-toggle {
  transition: background 0.25s var(--ease), border-color 0.25s var(--ease), color 0.25s var(--ease);
}

/* =========================================================
   Scroll reveal (subtle)
   ========================================================= */
.reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
}
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .project-status { animation: none; opacity: 1; }
}

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 900px) {
  .stats-strip { grid-template-columns: 1fr; }
  .stats-strip div { border-right: 0; border-bottom: 1px solid var(--line); }
  .stats-strip div:last-child { border-bottom: 0; }
}

@media (max-width: 640px) {
  :root { --shell: min(100% - 32px, 1120px); }

  .experience-card { grid-template-columns: 44px minmax(0, 1fr); gap: 16px; padding: 24px; }
  .project-card { grid-template-columns: 44px minmax(0, 1fr); gap: 16px; padding: 24px; }
  .resume-logo { width: 44px; height: 44px; }
  .education-block, .strengths-block { padding: 24px; }
}
