/* ============================================================================
   PROFESSIONAL PORTFOLIO — Christopher Elliott
   Terminal Dark Theme
   ============================================================================ */

/* ── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Custom Properties ─────────────────────────────────────────────────────── */
:root {
  /* Color palette */
  --bg-void:        #0a0e13;
  --bg-surface-1:   #0f1720;
  --bg-surface-2:   #141d2b;
  --border:         #1e2d3d;
  --text-primary:   #cdd6f4;
  --text-secondary: #6b7c93;
  --text-dim:       #3d4f63;
  --accent:         #00ff9f;
  --accent-alt:     #0dbbff;
  --danger:         #ff2d55;

  /* Glow shadows */
  --glow-accent: 0 0 12px rgba(0, 255, 159, 0.33), 0 0 30px rgba(0, 255, 159, 0.13);
  --glow-blue:   0 0 12px rgba(13, 187, 255, 0.33);

  /* Typography */
  --font-display: 'Syne', sans-serif;
  --font-body:    'Inter', sans-serif;
  --font-mono:    'JetBrains Mono', monospace;

  /* Layout */
  --section-py:   120px;
  --container-px: clamp(1.25rem, 5vw, 3rem);
  --max-width:    1100px;

  /* Motion */
  --ease:      0.2s ease;
  --ease-slow: 0.55s ease;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-void);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* ── Layout ────────────────────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--container-px);
}

.section {
  padding: var(--section-py) 0;
}

.section-alt {
  background-color: var(--bg-surface-1);
}

/* ── Typography ────────────────────────────────────────────────────────────── */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--text-primary);
  line-height: 1.15;
}

h1 {
  font-size: clamp(2.75rem, 8vw, 5.5rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

h2 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  margin-bottom: 2.5rem;
}

h3 {
  font-size: 1.2rem;
  font-weight: 600;
}

p {
  color: var(--text-secondary);
  line-height: 1.8;
}

a {
  color: inherit;
  text-decoration: none;
}

ul {
  list-style: none;
}

strong {
  color: var(--text-primary);
  font-weight: 600;
}

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  color: var(--accent);
  background: var(--bg-surface-2);
  padding: 0.1em 0.35em;
  border-radius: 3px;
  border: 1px solid var(--border);
}

/* ── Section Label ─────────────────────────────────────────────────────────── */
.section-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  letter-spacing: 0.05em;
  padding: 0.75rem 1.75rem;
  border-radius: 4px;
  transition: all var(--ease);
  cursor: pointer;
}

.btn-primary {
  border: 1px solid var(--accent);
  color: var(--accent);
  background: transparent;
}

.btn-primary:hover {
  background-color: rgba(0, 255, 159, 0.08);
  box-shadow: var(--glow-accent);
}

.btn-link {
  color: var(--text-secondary);
  padding-left: 0;
}

.btn-link:hover {
  color: var(--accent);
}

/* ── Navigation ────────────────────────────────────────────────────────────── */
#nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: 60px;
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: background var(--ease), backdrop-filter var(--ease), border-color var(--ease);
}

#nav.scrolled {
  background: rgba(10, 14, 19, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom-color: var(--border);
}

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

.nav-logo {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.05em;
  transition: color var(--ease);
}

.nav-logo:hover {
  color: var(--text-primary);
}

/* Desktop: the ul lives at body level (outside #nav) to avoid the iOS
   backdrop-filter stacking context bug. We pin it back to the top-right
   visually using position:fixed so it looks identical to before. */
.nav-links {
  display: none; /* hidden on mobile until .open */
}

@media (min-width: 769px) {
  .nav-links {
    display: flex;
    position: fixed;
    top: 0;
    right: var(--container-px);
    height: 60px;
    align-items: center;
    gap: 2rem;
    z-index: 1001; /* above #nav (1000) */
    pointer-events: auto;
    width: max-content;
    margin: 0;
    padding: 0;
  }
}

.nav-links li { list-style: none; }

.nav-links a {
  font-family: var(--font-body);
  font-size: 0.875rem;
  color: var(--text-secondary);
  position: relative;
  transition: color var(--ease);
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 0;
  width: 100%;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--ease);
}

.nav-links a:hover {
  color: var(--text-primary);
}

.nav-links a:hover::after {
  transform: scaleX(1);
}

/* ── Hamburger ─────────────────────────────────────────────────────────────── */
.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px;
}

.nav-hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.nav-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile nav overlay — rendered at body level so it is never
   clipped by #nav's backdrop-filter stacking context */
.nav-links.open {
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0;
  background: var(--bg-void);
  justify-content: center;
  align-items: center;
  gap: 2.5rem;
  z-index: 999;
}

.nav-links.open a {
  font-size: 1.5rem;
  color: var(--text-primary);
}

/* ── Hero ──────────────────────────────────────────────────────────────────── */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: center;
  background-color: var(--bg-void);
  /* grid overlay */
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 40px 40px;
  overflow: hidden;
}

/* scanline overlay */
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    180deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.06) 2px,
    rgba(0, 0, 0, 0.06) 4px
  );
  pointer-events: none;
  z-index: 0;
}

.hero-content {
  position: relative;
  z-index: 1;
  padding-top: 80px;
  padding-bottom: 4rem;
}

.hero-content .section-label {
  margin-bottom: 1rem;
}

h1.glitch {
  position: relative;
  display: inline-block;
  margin-bottom: 1rem;
  cursor: default;
}

.hero-subtitle {
  font-family: var(--font-mono);
  font-size: clamp(1rem, 2.5vw, 1.4rem);
  color: var(--accent);
  margin-bottom: 1.5rem;
  line-height: 1.4;
  min-height: 1.6em;
}

/* Blinking cursor after the typewriter span */
.typewriter-cursor::after {
  content: '_';
  color: var(--accent);
  animation: blink 1s step-end infinite;
}

.hero-bio {
  font-size: 1rem;
  color: var(--text-secondary);
  max-width: 52ch;
  margin-bottom: 2.5rem;
  line-height: 1.8;
}

.hero-ctas {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  flex-wrap: wrap;
}

/* ── About ─────────────────────────────────────────────────────────────────── */
.about-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 4rem;
  align-items: start;
}

.about-text p {
  max-width: 65ch;
  margin-bottom: 1.25rem;
}

.about-facts {
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
}

.fact-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 1rem;
  align-items: baseline;
}

.fact-row dt {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.fact-row dd {
  font-size: 0.9rem;
  color: var(--text-primary);
}

.about-photo {
  display: flex;
  justify-content: center;
  padding-top: 0.5rem;
}

.photo-frame {
  border: 2px solid var(--accent);
  border-radius: 4px;
  overflow: hidden;
  transform: rotate(2deg);
  transition: transform var(--ease), box-shadow var(--ease);
  max-width: 280px;
  width: 100%;
}

.photo-frame:hover {
  transform: rotate(0deg);
  box-shadow: var(--glow-accent);
}

.photo-frame img {
  display: block;
  width: 100%;
  height: auto;
}

/* ── Skills ────────────────────────────────────────────────────────────────── */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
}

.skill-category {
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.5rem;
}

.skill-cat-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent-alt);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 1rem;
  font-weight: 500;
}

.badge-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
  background: var(--bg-void);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.3rem 0.65rem;
  transition: border-color var(--ease), color var(--ease), box-shadow var(--ease);
}

.badge:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 6px rgba(0, 255, 159, 0.2);
}

.badge-accent {
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Timeline ──────────────────────────────────────────────────────────────── */
.timeline {
  position: relative;
  padding-left: 2.25rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 8px;
  bottom: 0;
  width: 1px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  padding-bottom: 2.75rem;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-dot {
  position: absolute;
  left: -2.25rem;
  top: 6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: var(--glow-accent);
  transform: translateX(0.5px);
}

.timeline-card {
  background: var(--bg-surface-1);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 1.5rem;
  transition: box-shadow var(--ease), border-color var(--ease);
}

.timeline-card:hover {
  box-shadow: var(--glow-accent);
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.4rem;
  flex-wrap: wrap;
}

.timeline-header h3 {
  font-size: 1.05rem;
  color: var(--text-primary);
}

.timeline-date {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent);
  white-space: nowrap;
}

.timeline-company {
  font-size: 0.85rem;
  color: var(--accent-alt);
  margin-bottom: 0.85rem;
  line-height: 1.4;
}

.timeline-bullets {
  list-style: none;
  padding: 0;
  margin-bottom: 1rem;
}

.timeline-bullets li {
  font-size: 0.9rem;
  color: var(--text-secondary);
  padding-left: 1.1rem;
  position: relative;
  margin-bottom: 0.55rem;
  line-height: 1.65;
}

.timeline-bullets li::before {
  content: '\25B8';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-size: 0.7rem;
  top: 0.15em;
}

/* ── Shared Tags ───────────────────────────────────────────────────────────── */
.timeline-tags,
.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  background: var(--bg-void);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.2rem 0.5rem;
}

/* ── Projects ──────────────────────────────────────────────────────────────── */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.project-card {
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: border-color var(--ease), box-shadow var(--ease), transform var(--ease);
}

.project-card:hover {
  border-color: var(--accent);
  box-shadow: var(--glow-accent);
  transform: translateY(-4px);
}

.project-type {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent);
  letter-spacing: 0.1em;
}

.project-card h3 {
  font-size: 1.1rem;
  color: var(--text-primary);
}

.project-card > p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.7;
  flex: 1;
}

.project-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: auto;
  transition: color var(--ease);
}

.project-link:hover {
  color: var(--accent);
}

.project-link svg {
  fill: currentColor;
  flex-shrink: 0;
}

/* ── Education ─────────────────────────────────────────────────────────────── */
.edu-card {
  background: var(--bg-surface-1);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-alt);
  border-radius: 6px;
  padding: 1.75rem;
  margin-bottom: 3rem;
}

.edu-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.edu-school {
  font-size: 0.9rem;
  color: var(--accent-alt);
  margin-top: 0.25rem;
  line-height: 1.4;
}

.edu-date {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent);
  white-space: nowrap;
}

.subsection-title {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 1.5rem;
  border-top: 1px solid var(--border);
  padding-top: 2.5rem;
  font-weight: 400;
}

.internship-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.internship-card {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.25rem;
  transition: border-color var(--ease);
}

.internship-card:hover {
  border-color: var(--accent-alt);
}

.internship-year {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--accent);
  min-width: 48px;
  padding-top: 2px;
  font-weight: 600;
}

.internship-card h4 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
  font-weight: 600;
}

.internship-org {
  font-size: 0.8rem;
  color: var(--accent-alt);
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.internship-card > div > p:not(.internship-org) {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.65;
}

/* ── Contact ───────────────────────────────────────────────────────────────── */
.contact-container {
  text-align: center;
}

.contact-container h2 {
  margin-bottom: 1rem;
}

.section-intro {
  margin-bottom: 2.5rem;
  max-width: 60ch;
  color: var(--text-muted);
  font-size: 1rem;
}

.contact-sub {
  margin: 0 auto 3rem;
  max-width: 48ch;
  font-size: 1rem;
}

.contact-links {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
}

.contact-link {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.95rem;
  color: var(--text-secondary);
  padding: 0.85rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: border-color var(--ease), color var(--ease), box-shadow var(--ease);
  width: 100%;
  max-width: 420px;
  justify-content: center;
}

.contact-link:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: var(--glow-accent);
}

.contact-link svg {
  fill: currentColor;
  flex-shrink: 0;
}

/* ── Footer ────────────────────────────────────────────────────────────────── */
.footer {
  background: var(--bg-void);
  border-top: 1px solid var(--border);
  padding: 2rem 0;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-inner span {
  font-size: 0.85rem;
  color: var(--text-dim);
}

.footer-mono {
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

/* ── Scroll Reveal ─────────────────────────────────────────────────────────── */

/* Non-stagger elements: hidden until .visible is added by IntersectionObserver */
[data-reveal]:not([data-reveal="stagger"]) {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity var(--ease-slow), transform var(--ease-slow);
}

[data-reveal="left"]  { transform: translateX(-24px); }
[data-reveal="right"] { transform: translateX(24px); }

[data-reveal]:not([data-reveal="stagger"]).visible {
  opacity: 1;
  transform: none;
}

/* Stagger container: always visible; only children are hidden */
[data-reveal="stagger"] > * {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

[data-reveal="stagger"].visible > *:nth-child(1) { opacity: 1; transform: none; transition-delay: 0ms; }
[data-reveal="stagger"].visible > *:nth-child(2) { opacity: 1; transform: none; transition-delay: 80ms; }
[data-reveal="stagger"].visible > *:nth-child(3) { opacity: 1; transform: none; transition-delay: 160ms; }
[data-reveal="stagger"].visible > *:nth-child(4) { opacity: 1; transform: none; transition-delay: 240ms; }

/* ── Animations ────────────────────────────────────────────────────────────── */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* Glitch — wrapped in reduced-motion query; only plays on devices that allow it */
@media (prefers-reduced-motion: no-preference) {
  h1.glitch:hover::before,
  h1.glitch:hover::after {
    content: attr(data-text);
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
  }

  h1.glitch:hover::before {
    color: var(--accent-alt);
    clip-path: polygon(0 20%, 100% 20%, 100% 40%, 0 40%);
    animation: glitch-1 0.3s steps(2) infinite;
  }

  h1.glitch:hover::after {
    color: var(--danger);
    clip-path: polygon(0 60%, 100% 60%, 100% 80%, 0 80%);
    animation: glitch-2 0.3s steps(2) infinite reverse;
  }

  @keyframes glitch-1 {
    0%   { transform: translate(-2px, 0); }
    100% { transform: translate( 2px, 0); }
  }

  @keyframes glitch-2 {
    0%   { transform: translate( 2px, 0); }
    100% { transform: translate(-2px, 0); }
  }
}

/* ── Reduced Motion ────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  [data-reveal]:not([data-reveal="stagger"]),
  [data-reveal="stagger"] > * {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .typewriter-cursor::after {
    animation: none;
    opacity: 1;
  }

  .project-card:hover {
    transform: none;
  }
}

/* ── 404 Error Page ────────────────────────────────────────────────────────── */
.error-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 1.5rem;
  padding: 2rem;
  background-color: var(--bg-void);
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 40px 40px;
}

.error-code {
  font-size: clamp(5rem, 20vw, 10rem);
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  letter-spacing: -0.04em;
  font-family: var(--font-display);
  text-shadow: var(--glow-accent);
}

.error-msg {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--text-secondary);
  max-width: 40ch;
  text-align: center;
}

/* ── Responsive: Tablet ────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  :root {
    --section-py: 70px;
  }

  .nav-links { display: none; }
  .nav-hamburger { display: flex; }

  .about-grid {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  .about-photo {
    order: -1;
    justify-content: flex-start;
  }

  .photo-frame {
    max-width: 200px;
    transform: none;
  }

  .photo-frame:hover {
    transform: none;
  }

  .timeline {
    padding-left: 1.5rem;
  }

  .timeline-dot {
    left: -1.5rem;
  }

  .timeline-header {
    flex-direction: column;
    gap: 0.25rem;
  }

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

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

/* ── Responsive: Mobile ────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  h1 {
    font-size: clamp(2rem, 11vw, 2.75rem);
  }

  .hero-ctas {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .fact-row {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }

  .internship-card {
    flex-direction: column;
    gap: 0.75rem;
  }

  .footer-inner {
    flex-direction: column;
    text-align: center;
  }
}
