/* Palette from the reference image:
   warm browns lead (oxblood, rust, tan), steel blues carry text and accents */
:root {
  --brown-deep: #452a18;
  --brown: #54331e;
  --brown-card: #653f25;
  --oxblood: #3d0f0b;
  --rust: #a34d21;
  --rust-bright: #c4622c;
  --tan: #d9b48d;
  --tan-light: #edd7bc;
  --blue: #27577a;
  --blue-bright: #4f9dc9;
  --blue-soft: #a3cde3;
  --text: #f0e8de;
  --text-dim: #cdbcab;
  --line: rgba(240, 232, 222, 0.2);
  --glow-blue: rgba(63, 169, 224, 0.4);
  --glow-rust: rgba(196, 98, 44, 0.3);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  background: var(--brown-deep);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}

.mono { font-family: 'IBM Plex Mono', monospace; }
.accent { color: var(--blue-bright); }
.divider { color: var(--tan); opacity: 0.7; }

#grid-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.5;
}

/* ---------- Nav ---------- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2.5rem;
  background: rgba(69, 42, 24, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.nav-logo {
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: 0.05em;
}

.nav-links {
  display: flex;
  gap: 1.8rem;
  align-items: center;
}

.nav-links a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.95rem;
  transition: color 0.2s;
}

.nav-links a:hover { color: var(--blue-bright); }

.nav-cta {
  padding: 0.4rem 1rem;
  border: 1px solid var(--blue);
  border-radius: 4px;
  color: var(--blue-soft) !important;
}

.nav-cta:hover {
  background: rgba(109, 158, 209, 0.12);
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 6rem 2.5rem 0;
  max-width: 1100px;
  margin: 0 auto;
}

.hero-inner {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 3rem;
  align-items: center;
}

.hero-photo {
  justify-self: end;
  width: 100%;
  max-width: 330px;
  border-radius: 12px;
  border: 2px solid var(--blue);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.4), 0 0 32px var(--glow-blue);
  overflow: hidden;
}

.hero-photo img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: 50% 32%;
  transform: translateY(-24%) scale(1.5);
  transform-origin: 50% 30%;
}

.hero-kicker {
  color: var(--blue-bright);
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

.hero-name {
  font-size: clamp(2.2rem, 5.2vw, 4.2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.05;
  white-space: nowrap;
  background: linear-gradient(100deg, var(--tan-light) 25%, var(--text) 55%, var(--blue-bright) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-title {
  font-size: clamp(1.2rem, 3vw, 1.7rem);
  color: var(--blue-soft);
  margin-top: 0.8rem;
  font-weight: 500;
}

.hero-blurb {
  max-width: 560px;
  margin-top: 1.4rem;
  color: var(--text-dim);
  font-size: 1.05rem;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  margin-top: 2.2rem;
  flex-wrap: wrap;
}

.hero-scroll {
  position: absolute;
  bottom: 2.5rem;
  left: 2.5rem;
  color: var(--text-dim);
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.scroll-line {
  display: inline-block;
  width: 60px;
  height: 1px;
  background: linear-gradient(90deg, var(--blue), transparent);
  animation: pulse-line 2.2s ease-in-out infinite;
}

@keyframes pulse-line {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  padding: 0.7rem 1.6rem;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}

.btn-primary {
  background: var(--rust);
  color: var(--text);
  border: 1px solid var(--rust-bright);
}

.btn-primary:hover {
  background: var(--rust-bright);
  transform: translateY(-2px);
  box-shadow: 0 6px 24px var(--glow-rust);
}

.btn-ghost {
  border: 1px solid var(--blue);
  color: var(--blue-bright);
}

.btn-ghost:hover {
  background: rgba(109, 158, 209, 0.12);
  transform: translateY(-2px);
  box-shadow: 0 6px 24px var(--glow-blue);
}

/* ---------- Sections ---------- */
.section {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 6rem 2.5rem 2rem;
}

.section-title {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 600;
  margin-bottom: 2.2rem;
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
}

.section-num {
  color: var(--blue-bright);
  font-size: 0.9em;
}

.section-intro {
  color: var(--text-dim);
  max-width: 640px;
  margin: -1rem 0 2.2rem;
}

/* ---------- About ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 3rem;
}

.about-text p + p { margin-top: 1.1rem; }
.about-text { color: var(--text-dim); font-size: 1.05rem; }

.about-facts {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-self: start;
  border-left: 1px solid var(--line);
  padding-left: 1.6rem;
}

.fact {
  display: flex;
  flex-direction: column;
  color: var(--tan-light);
}

.fact-label {
  color: var(--blue-bright);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 0.15rem;
}

/* ---------- Timeline ---------- */
.timeline {
  border-left: 1px solid var(--line);
  padding-left: 2rem;
  display: flex;
  flex-direction: column;
  gap: 2.6rem;
}

.timeline-item { position: relative; }

.timeline-item::before {
  content: '';
  position: absolute;
  left: -2rem;
  top: 0.5rem;
  transform: translateX(-50%);
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--blue-bright);
  box-shadow: 0 0 12px var(--glow-blue);
}

.timeline-meta {
  color: var(--blue-bright);
  font-size: 0.8rem;
  margin-bottom: 0.3rem;
}

.timeline-item h3 { font-size: 1.25rem; font-weight: 600; }

.timeline-org {
  color: var(--tan);
  font-size: 0.95rem;
  margin: 0.15rem 0 0.7rem;
}

.timeline-item ul {
  list-style: none;
  color: var(--text-dim);
  font-size: 0.98rem;
}

.timeline-item li {
  padding-left: 1.2rem;
  position: relative;
  margin-bottom: 0.4rem;
}

.timeline-item li::before {
  content: '▹';
  position: absolute;
  left: 0;
  color: var(--blue-bright);
}

/* ---------- Projects ---------- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.4rem;
}

.card {
  background: linear-gradient(160deg, var(--brown-card), var(--brown));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.6rem;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s, border-color 0.25s, box-shadow 0.25s;
}

.card:hover {
  transform: translateY(-5px);
  border-color: var(--blue);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35), 0 0 24px var(--glow-blue);
}

.card-top {
  margin-bottom: 0.8rem;
}

.card-tag {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--blue-soft);
  border: 1px solid rgba(109, 158, 209, 0.4);
  padding: 0.2rem 0.6rem;
  border-radius: 3px;
}

.card h3 { font-size: 1.15rem; font-weight: 600; margin-bottom: 0.6rem; }

.card p { color: var(--text-dim); font-size: 0.93rem; flex-grow: 1; }

.card-stack {
  margin-top: 1rem;
  color: var(--blue-bright);
  font-size: 0.78rem;
  flex-grow: 0 !important;
}

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

.skill-group h3 {
  color: var(--blue-soft);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin-bottom: 1rem;
  font-weight: 500;
}

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

.chips span {
  padding: 0.35rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.85rem;
  color: var(--text-dim);
  transition: border-color 0.2s, color 0.2s, box-shadow 0.2s;
}

.chips span:hover {
  border-color: var(--blue-bright);
  color: var(--blue-soft);
  box-shadow: 0 0 14px var(--glow-blue);
}

/* ---------- Contact ---------- */
.contact { padding-bottom: 6rem; }

.contact-blurb {
  color: var(--text-dim);
  max-width: 540px;
  margin-bottom: 2rem;
  font-size: 1.05rem;
}

.contact-links {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

/* ---------- Footer ---------- */
.footer {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 1.6rem 2.5rem;
  border-top: 1px solid var(--line);
  color: var(--text-dim);
  font-size: 0.8rem;
}

/* ---------- Reveal animation (only when JS is running) ---------- */
body.js .reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

body.js .reveal.visible {
  opacity: 1;
  transform: none;
}

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .nav { padding: 0.9rem 1.2rem; }
  .nav-links { gap: 1rem; }
  .nav-links a:not(.nav-cta) { display: none; }
  .hero, .section { padding-left: 1.2rem; padding-right: 1.2rem; }
  .hero-scroll { left: 1.2rem; }
  .hero { padding-top: 7rem; padding-bottom: 3rem; }
  .hero-inner { grid-template-columns: minmax(0, 1fr); gap: 2.2rem; }
  .hero-photo { justify-self: start; max-width: min(240px, 100%); }
  .hero-scroll { display: none; }
  .about-grid { grid-template-columns: 1fr; gap: 2rem; }
  .about-facts { border-left: none; padding-left: 0; border-top: 1px solid var(--line); padding-top: 1.4rem; }
  .footer { padding: 1.4rem 1.2rem; }
}
