/* =============================================
   BAUHAUS DESIGN SYSTEM — AP LEITH
   Color palette: Classic Primary
   Font: Jost (geometric sans)
============================================= */
:root {
  --cream:  #F5F0E8;
  --black:  #111111;
  --red:    #D62828;
  --yellow: #F7B731;
  --blue:   #1A4FA0;
  --gray:   #888888;
  --border: 3px solid #111111;
  --border-thick: 5px solid #111111;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Jost', sans-serif;
  background: var(--cream);
  color: var(--black);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
}

/* ── UTILITIES ── */
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap;
}

/* ── SKIP LINK ── */
.skip-link {
  position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden;
}
.skip-link:focus {
  position: fixed; top: 0; left: 0; width: auto; height: auto;
  padding: 0.5rem 1rem; background: var(--yellow); color: var(--black);
  font-weight: 700; z-index: 9999; overflow: visible;
  font-family: 'Jost', sans-serif; font-size: 0.875rem; text-decoration: none;
}

/* ══════════════════════════════════════════
   NAVIGATION
══════════════════════════════════════════ */
nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  background: var(--black);
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  border-bottom: 4px solid var(--red);
}

.nav-logo {
  font-size: 1.1rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cream);
  text-decoration: none;
  flex-shrink: 0;
}
.nav-logo em { color: var(--yellow); font-style: normal; }

/* Bauhaus stripe accent beside logo */
.nav-accent {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-left: 1rem;
  flex-shrink: 0;
}
.nav-accent span {
  display: block;
  width: 20px;
  height: 3px;
}
.nav-accent span:nth-child(1) { background: var(--red); }
.nav-accent span:nth-child(2) { background: var(--yellow); }
.nav-accent span:nth-child(3) { background: var(--blue); }

.nav-logo-wrap { display: flex; align-items: center; }

.nav-links {
  list-style: none;
  display: flex;
  align-items: stretch;
  height: 56px;
}
.nav-links li a {
  display: flex;
  align-items: center;
  padding: 0 1rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--cream);
  text-decoration: none;
  border-left: 1px solid rgba(255,255,255,0.12);
  transition: background 0.15s, color 0.15s;
}
.nav-links li a:hover,
.nav-links li a.active { background: var(--red); color: var(--cream); }

.nav-toggle {
  display: none;
  background: none;
  border: 2px solid var(--cream);
  padding: 5px 7px;
  cursor: pointer;
  flex-direction: column;
  gap: 4px;
}
.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--cream);
  transition: transform 0.2s, opacity 0.2s;
}
.nav-toggle.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ══════════════════════════════════════════
   LAYOUT SHELL
══════════════════════════════════════════ */
main { margin-top: 56px; }
section { border-bottom: var(--border-thick); }

/* Shared section header band */
.section-header {
  background: var(--black);
  color: var(--cream);
  padding: 1.25rem 2.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  border-bottom: var(--border);
}
.sh-index {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--yellow);
  flex-shrink: 0;
}
.section-header h2 {
  font-size: clamp(1.2rem, 2.5vw, 1.75rem);
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  flex-shrink: 0;
}
.sh-rule {
  flex: 1;
  height: 3px;
}
.sh-rule.red    { background: var(--red); }
.sh-rule.yellow { background: var(--yellow); }
.sh-rule.blue   { background: var(--blue); }
.sh-rule.white  { background: rgba(255,255,255,0.3); }

/* ══════════════════════════════════════════
   01 — ABOUT
══════════════════════════════════════════ */
#about {
  display: grid;
  grid-template-columns: 340px 1fr;
  min-height: calc(100vh - 56px);
}

.about-left {
  background: var(--black);
  border-right: var(--border-thick);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* Color stripe bar at top */
.about-stripes {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.about-stripes span {
  display: block;
  height: 14px;
}
.about-stripes span:nth-child(1) { background: var(--red); }
.about-stripes span:nth-child(2) { background: var(--yellow); }
.about-stripes span:nth-child(3) { background: var(--blue); }

/* Large background circle decoration */
.about-geo-circle {
  position: absolute;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  border: 40px solid rgba(247,183,49,0.12);
  top: 80px;
  right: -40px;
  pointer-events: none;
}

.about-photo {
  flex: 1;
  display: flex;
  align-items: flex-end;
  padding-top: 2rem;
  position: relative;
  z-index: 1;
}
.about-photo img {
  width: 100%;
  display: block;
  object-fit: cover;
  object-position: top;
}

.about-right {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 4rem 3.5rem;
  position: relative;
}

/* Subtle grid dot background */
.about-right::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(17,17,17,0.08) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
}

.section-tag {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  background: var(--blue);
  color: var(--cream);
  padding: 3px 10px;
  margin-bottom: 1.75rem;
  position: relative;
  z-index: 1;
  align-self: flex-start;
}

.about-right h1 {
  font-size: clamp(2.2rem, 5vw, 4rem);
  font-weight: 900;
  line-height: 0.95;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  margin-bottom: 1rem;
  position: relative;
  z-index: 1;
}
.about-right h1 em {
  font-style: normal;
  color: var(--red);
}

.about-subtitle {
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--blue);
  border-left: 5px solid var(--yellow);
  padding-left: 0.875rem;
  margin-bottom: 2rem;
  line-height: 1.5;
  position: relative;
  z-index: 1;
}

.about-bio {
  font-size: 1rem;
  font-weight: 300;
  max-width: 58ch;
  line-height: 1.85;
  margin-bottom: 2.5rem;
  position: relative;
  z-index: 1;
}

.about-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  position: relative;
  z-index: 1;
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Jost', sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.55rem 1.15rem;
  border: 2px solid var(--black);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  line-height: 1;
}
.btn-red  { background: var(--red);    color: var(--cream); border-color: var(--red);  }
.btn-red:hover  { background: var(--black); border-color: var(--black); }
.btn-blue { background: var(--blue);   color: var(--cream); border-color: var(--blue); }
.btn-blue:hover { background: var(--black); border-color: var(--black); }
.btn-outline { background: transparent; color: var(--black); }
.btn-outline:hover { background: var(--black); color: var(--cream); }

/* ══════════════════════════════════════════
   02 — EMPLOYMENT
══════════════════════════════════════════ */
#employment .emp-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.emp-summary {
  padding: 2.5rem;
  border-right: var(--border);
}
.emp-summary p {
  font-weight: 300;
  line-height: 1.85;
  font-size: 0.95rem;
}

.emp-positions { padding: 2.5rem; }

.position-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0 1.25rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid rgba(17,17,17,0.12);
}
.position-item:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

.pos-year-block {
  width: 56px;
  flex-shrink: 0;
  padding-top: 3px;
}
.pos-year {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--cream);
  background: var(--blue);
  display: block;
  padding: 2px 5px;
  text-align: center;
  line-height: 1.4;
}
.pos-year.red { background: var(--red); }
.pos-year.yellow { background: var(--yellow); color: var(--black); }

.pos-details h3 {
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.2;
}
.pos-org {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--blue);
  margin-top: 2px;
}
.pos-date {
  font-size: 0.75rem;
  font-weight: 300;
  color: var(--gray);
}

/* ══════════════════════════════════════════
   03 — EDUCATION
══════════════════════════════════════════ */
#education .edu-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 2.5rem;
  gap: 2rem;
}

.edu-card {
  border: var(--border);
  padding: 2rem;
  position: relative;
  overflow: hidden;
}
/* Top color bar */
.edu-card::before {
  content: '';
  display: block;
  height: 8px;
  position: absolute;
  top: 0; left: 0; right: 0;
}
.edu-card:nth-child(1)::before { background: var(--red); }
.edu-card:nth-child(2)::before { background: var(--blue); }
.edu-card:nth-child(3)::before { background: var(--yellow); }

/* Giant ghost year */
.edu-year-ghost {
  font-size: 5rem;
  font-weight: 900;
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 2px rgba(17,17,17,0.1);
  letter-spacing: -0.04em;
  margin-top: 1rem;
  margin-bottom: 0.25rem;
  display: block;
}
.edu-degree {
  font-size: 1rem;
  font-weight: 900;
  text-transform: uppercase;
  line-height: 1.2;
  margin-bottom: 0.5rem;
}
.edu-school { font-weight: 700; font-size: 0.875rem; }
.edu-field  { font-weight: 300; font-size: 0.8rem; color: var(--gray); margin-top: 2px; }

/* ══════════════════════════════════════════
   04 — SKILLS
══════════════════════════════════════════ */
#skills .skills-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.skill-card {
  padding: 2rem;
  border-right: var(--border);
  border-bottom: var(--border);
}
/* Remove right border on last column */
.skill-card:nth-child(3n) { border-right: none; }
/* Remove bottom border on last row (3 cards) */
.skill-card:nth-last-child(-n+3) { border-bottom: none; }

.skill-card h3 {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding-bottom: 0.6rem;
  margin-bottom: 1.25rem;
  border-bottom: 3px solid;
}
/* Cycle colors across any number of cards */
.skill-card:nth-child(3n+1) h3 { color: var(--red);  border-color: var(--red); }
.skill-card:nth-child(3n+2) h3 { color: var(--blue); border-color: var(--blue); }
.skill-card:nth-child(3n)   h3 { color: #b38900;     border-color: var(--yellow); }

.skill-icons {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}
.skill-icons img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  display: block;
}

/* Text-tag skill chips for method/domain cards */
.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.skill-tag {
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  padding: 3px 9px;
  border: 1.5px solid var(--black);
  line-height: 1.5;
}

/* ══════════════════════════════════════════
   05 — PROJECTS
══════════════════════════════════════════ */
#projects .projects-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
}

.project-card {
  display: flex;
  flex-direction: column;
  border-right: var(--border);
  border-bottom: var(--border);
}
.project-card:nth-child(2n) { border-right: none; }
.project-card:nth-child(5),
.project-card:nth-child(6) { border-bottom: none; }

.project-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.5rem;
  border-bottom: var(--border);
}
/* Alternating header colors */
.project-card:nth-child(1) .project-header { background: var(--red);    color: var(--cream); }
.project-card:nth-child(2) .project-header { background: var(--blue);   color: var(--cream); }
.project-card:nth-child(3) .project-header { background: var(--yellow); color: var(--black); }
.project-card:nth-child(4) .project-header { background: var(--black);  color: var(--cream); }
.project-card:nth-child(5) .project-header { background: var(--blue);   color: var(--cream); }
.project-card:nth-child(6) .project-header { background: var(--red);    color: var(--cream); }

.project-header h3 {
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.project-lang {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.75;
}

.project-body {
  padding: 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.project-body p {
  font-size: 0.875rem;
  font-weight: 300;
  line-height: 1.75;
  flex: 1;
  margin-bottom: 1.25rem;
}
.project-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

/* ══════════════════════════════════════════
   06 — GRANTS
══════════════════════════════════════════ */
#grants .grants-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2rem;
  padding: 2.5rem;
}

.grant-card {
  border: var(--border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.grant-card-top { height: 8px; flex-shrink: 0; }
.grant-card.completed .grant-card-top { background: var(--gray); }
.grant-card.active    .grant-card-top { background: var(--blue); }
.grant-card.pending   .grant-card-top { background: var(--yellow); }

.grant-body { padding: 1.5rem; flex: 1; display: flex; flex-direction: column; }

.grant-meta {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.grant-agency {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--cream);
  background: var(--black);
  padding: 3px 8px;
  flex-shrink: 0;
}
.grant-status {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 8px;
}
.grant-card.completed .grant-status { background: rgba(17,17,17,0.07); color: var(--gray); }
.grant-card.active    .grant-status { background: rgba(26,79,160,0.1); color: var(--blue); }
.grant-card.pending   .grant-status { background: rgba(247,183,49,0.2); color: #a07800; }

.grant-card h3 {
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  line-height: 1.3;
  margin-bottom: 0.4rem;
  flex: 1;
}
.grant-amount {
  font-size: 1.9rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 0.25rem;
}
.grant-card.completed .grant-amount { color: var(--gray); }
.grant-card.active    .grant-amount { color: var(--blue); }
.grant-card.pending   .grant-amount { color: #a07800; }

.grant-details {
  font-size: 0.78rem;
  font-weight: 300;
  color: var(--gray);
  margin-bottom: 0.75rem;
}
.grant-role {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-left: 3px solid;
  padding-left: 0.6rem;
}
.grant-card.completed .grant-role { border-color: var(--gray); color: var(--gray); }
.grant-card.active    .grant-role { border-color: var(--blue); color: var(--blue); }
.grant-card.pending   .grant-role { border-color: #a07800;     color: #a07800; }

/* ══════════════════════════════════════════
   07 — RESEARCH
══════════════════════════════════════════ */
#research .research-content {
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 3rem;
}

.research-sub h3 {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--cream);
  display: inline-block;
  padding: 4px 12px;
  margin-bottom: 1.25rem;
}
.research-sub:nth-child(1) h3 { background: var(--red); }
.research-sub:nth-child(2) h3 { background: var(--blue); }
.research-sub:nth-child(3) h3 { background: var(--black); }
.research-sub:nth-child(4) h3 { background: var(--blue); }
.research-sub:nth-child(5) h3 { background: var(--black); }

.pub-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.pub-list li {
  font-size: 0.875rem;
  font-weight: 300;
  line-height: 1.75;
  padding: 0.875rem 1rem 0.875rem 1.25rem;
  border-left: 4px solid;
  background: rgba(17,17,17,0.03);
}
.research-sub:nth-child(1) .pub-list li { border-color: var(--blue); }
.research-sub:nth-child(2) .pub-list li { border-color: var(--red); }
.research-sub:nth-child(3) .pub-list li { border-color: var(--black); }
.research-sub:nth-child(4) .pub-list li { border-color: var(--blue); }

.pub-list li b  { font-weight: 700; }
.pub-list li em { font-style: italic; }
.pub-list li a  { color: var(--blue); word-break: break-all; }
.pub-list li a:hover { color: var(--red); }

/* ══════════════════════════════════════════
   FOOTER
══════════════════════════════════════════ */
footer {
  background: var(--black);
  color: var(--cream);
  border-top: 5px solid var(--red);
  padding: 2rem 2.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.footer-logo {
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.footer-logo em { color: var(--yellow); font-style: normal; }

.footer-icons {
  display: flex;
  gap: 1.25rem;
}
.footer-icons a {
  color: var(--cream);
  font-size: 1.25rem;
  text-decoration: none;
  transition: color 0.15s;
}
.footer-icons a:hover { color: var(--yellow); }

.footer-copy {
  width: 100%;
  font-size: 0.7rem;
  font-weight: 300;
  opacity: 0.5;
  letter-spacing: 0.05em;
}

/* ══════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════ */
@media (max-width: 900px) {
  .nav-links { display: none; }
  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 56px; left: 0; right: 0;
    background: var(--black);
    border-top: 1px solid rgba(255,255,255,0.1);
    z-index: 199;
  }
  .nav-links li a {
    height: auto;
    padding: 1rem 2rem;
    border-left: none;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    font-size: 0.75rem;
  }
  .nav-toggle { display: flex; }

  /* About */
  #about {
    grid-template-columns: 1fr;
    min-height: auto;
  }
  .about-left {
    height: 55vw;
    max-height: 320px;
    border-right: none;
    border-bottom: var(--border-thick);
  }
  .about-right { padding: 2rem; }
  .about-right h1 { font-size: 2.5rem; }

  /* Employment */
  #employment .emp-grid { grid-template-columns: 1fr; }
  .emp-summary { border-right: none; border-bottom: var(--border); }

  /* Education */
  #education .edu-grid { grid-template-columns: 1fr; gap: 1.25rem; padding: 1.5rem; }

  /* Skills — 2-col at tablet */
  #skills .skills-grid { grid-template-columns: 1fr 1fr; }
  .skill-card:nth-child(3n)          { border-right: var(--border); }
  .skill-card:nth-child(2n)          { border-right: none; }
  .skill-card:nth-last-child(-n+3)   { border-bottom: var(--border); }  /* re-add desktop removal */
  .skill-card:last-child,
  .skill-card:nth-last-child(-n+2):nth-child(odd) { border-bottom: none; }
  /* Grants */
  #grants .grants-grid { grid-template-columns: 1fr; gap: 1.25rem; padding: 1.5rem; }

  /* Projects */
  #projects .projects-grid { grid-template-columns: 1fr; }
  .project-card             { border-right: none; }
  .project-card:nth-child(5),
  .project-card:nth-child(6) { border-bottom: var(--border); }
  .project-card:last-child   { border-bottom: none; }

  /* Section header */
  .section-header { padding: 1rem 1.5rem; }
  #research .research-content { padding: 1.5rem; }
}

@media (max-width: 500px) {
  nav { padding: 0 1rem; }
  .about-right { padding: 1.5rem; }
  .about-right h1 { font-size: 2rem; }
  #skills .skills-grid { grid-template-columns: 1fr; }
  .skill-card { border-right: none !important; border-bottom: var(--border) !important; }
  .skill-card:last-child { border-bottom: none !important; }
  #education .edu-grid { padding: 1rem; }
  .emp-summary, .emp-positions { padding: 1.5rem; }
  footer { padding: 1.5rem; }
}
