/* =========================================================
   Palette & type
   ---------------------------------------------------------
   paper   #F3F6F1  pale sage paper
   ink     #17301F  deep green-black (text)
   ink-2   #40584A  softened ink (secondary text)
   line    #C6D2C4  hairline rules
   accent  #E0A63A  marigold (focus, active, highlights)
   ========================================================= */

:root {
  --paper: #F3F6F1;
  --paper-2: #E9EFE6;
  --ink: #17301F;
  --ink-2: #40584A;
  --line: #C6D2C4;
  --accent: #E0A63A;
  --display: "Fraunces", Georgia, serif;
  --body: "Archivo", system-ui, sans-serif;
  --measure: 60ch;
  --gutter: clamp(1.25rem, 5vw, 5rem);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html { scroll-behavior: smooth; scroll-padding-top: 5rem; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.6;
}

body.no-scroll { overflow: hidden; }

a { color: inherit; }

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

h2 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  line-height: 1.1;
}

/* ============ Scroll progress bar ============ */

.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 4px;
  width: 0;
  background: var(--accent);
  z-index: 60;
}

/* ============ Header ============ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.1rem var(--gutter);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.wordmark {
  font-family: var(--display);
  font-weight: 900;
  font-size: 1.25rem;
  text-decoration: none;
}

.site-nav { display: flex; gap: 1.75rem; }

.site-nav a {
  position: relative;
  text-decoration: none;
  font-weight: 500;
  padding-bottom: 0.2rem;
}

.site-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 260ms var(--ease);
}

.site-nav a:hover::after,
.site-nav a.is-active::after { transform: scaleX(1); }

/* Hamburger — hidden on desktop */

.menu-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 2.5rem;
  height: 2.5rem;
  background: transparent;
  border: none;
  cursor: pointer;
}

.menu-btn span {
  display: block;
  height: 2px;
  width: 1.5rem;
  margin: 0 auto;
  background: var(--ink);
  transition: transform 260ms var(--ease), opacity 200ms ease;
}

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

/* ============ Drawer (slide-in sidebar) ============ */

.drawer-scrim {
  position: fixed;
  inset: 0;
  background: rgba(23, 48, 31, 0.45);
  z-index: 54;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(20rem, 82vw);
  background: var(--paper);
  border-left: 1px solid var(--line);
  z-index: 55;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 5.5rem 2rem 2rem;
  transform: translateX(100%);
  transition: transform 340ms var(--ease);
}

.drawer.is-open { transform: translateX(0); }

.drawer-nav { display: flex; flex-direction: column; gap: 0.4rem; }

.drawer-nav a {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.75rem;
  text-decoration: none;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--line);
  transition: color 180ms ease, padding-left 220ms var(--ease);
}

.drawer-nav a:hover { color: var(--ink-2); padding-left: 0.5rem; }

.drawer-foot { display: flex; gap: 1.5rem; }

.drawer-foot a {
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

/* ============ Hero + entrance sequence ============ */

.hero {
  padding: clamp(3rem, 8vh, 5.5rem) var(--gutter) clamp(3rem, 8vh, 5rem);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(1.5rem); }
  to { opacity: 1; transform: translateY(0); }
}

.intro-1, .intro-2, .intro-3, .intro-4, .intro-5 {
  animation: rise 700ms var(--ease) both;
}

.intro-1 { animation-delay: 80ms; }
.intro-2 { animation-delay: 180ms; }
.intro-3 { animation-delay: 300ms; }
.intro-4 { animation-delay: 420ms; }
.intro-5 { animation-delay: 520ms; }

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  margin-bottom: 2.5rem;
}

.hero-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(224, 166, 58, 0.55); }
  55% { box-shadow: 0 0 0 7px rgba(224, 166, 58, 0); }
}

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

.hero-name {
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(2.75rem, 8vw, 5.5rem);
  line-height: 0.98;
  letter-spacing: -0.02em;
  margin-bottom: 1.25rem;
}

.hero-lede {
  max-width: var(--measure);
  font-size: 1.1875rem;
  color: var(--ink-2);
  margin-bottom: 2rem;
}

.hero-links { display: flex; flex-wrap: wrap; gap: 0.875rem; margin-bottom: 1.75rem; }

.btn {
  display: inline-block;
  padding: 0.7rem 1.4rem;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  border: 2px solid var(--ink);
  transition: background-color 180ms ease, color 180ms ease, transform 220ms var(--ease);
}

.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }

.btn-solid { background: var(--ink); color: var(--paper); }
.btn-solid:hover { background: transparent; color: var(--ink); }
.btn-ghost:hover { background: var(--ink); color: var(--paper); }

.hero-socials { display: flex; flex-wrap: wrap; gap: 1.5rem; }

.hero-socials a {
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
  transition: text-decoration-color 160ms ease;
}

.hero-socials a:hover { text-decoration-color: var(--ink); }

.hero-portrait {
  width: clamp(7rem, 16vw, 11rem);
  height: clamp(7rem, 16vw, 11rem);
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(2rem, 5vw, 3rem);
  flex-shrink: 0;
  border: 3px solid var(--ink);
  box-shadow: 0.5rem 0.5rem 0 var(--accent);
  overflow: hidden;
  object-fit: cover;
}

/* ============ Scroll reveals ============ */

.reveal {
  opacity: 0;
  transform: translateY(1.25rem);
  transition: opacity 600ms var(--ease), transform 600ms var(--ease);
}

.reveal.is-visible { opacity: 1; transform: none; }

/* ============ About ============ */

.about {
  padding: clamp(3rem, 7vh, 5rem) var(--gutter);
  border-top: 1px solid var(--line);
}

.about h2 { margin-bottom: 2rem; }

.about-grid {
  display: grid;
  grid-template-columns: 1fr minmax(14rem, 20rem);
  gap: 3rem;
}

.about-bio {
  max-width: var(--measure);
  color: var(--ink-2);
  font-size: 1.125rem;
}

.about-facts { border-top: 1px solid var(--line); }

.about-fact {
  display: grid;
  grid-template-columns: 6rem 1fr;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line);
}

.about-fact dt { font-weight: 600; }
.about-fact dd { color: var(--ink-2); }
.about-fact a { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }

/* ============ Work ============ */

.work { padding: clamp(3rem, 7vh, 5rem) var(--gutter); border-top: 1px solid var(--line); }

.work-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.work-count { color: var(--ink-2); }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2.5rem;
}

.filter-btn {
  font: inherit;
  font-weight: 500;
  padding: 0.35rem 1rem;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease, transform 200ms var(--ease);
}

.filter-btn:hover { border-color: var(--ink); transform: translateY(-1px); }

.filter-btn.is-active {
  background: var(--accent);
  border-color: var(--accent);
}

/* --- Project rows --- */

.project-list {
  list-style: none;
  counter-reset: project-counter;
}

.project {
  counter-increment: project-counter;
  display: grid;
  grid-template-columns: 3rem 1fr auto;
  gap: 1rem 1.5rem;
  padding: 2rem 1.25rem;
  margin: 0 -1.25rem;
  border-top: 1px solid var(--line);
  opacity: 0;
  transform: translateY(1.25rem);
  transition: opacity 600ms var(--ease), transform 600ms var(--ease),
              background-color 200ms ease, padding-left 260ms var(--ease);
}

.project.is-visible { opacity: 1; transform: none; }

.project:last-child { border-bottom: 1px solid var(--line); }

.project:hover {
  background: var(--paper-2);
  padding-left: 1.75rem;
}

.project::before {
  content: counter(project-counter, decimal-leading-zero);
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--ink-2);
  opacity: 0.5;
  padding-top: 0.2rem;
}

.project-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.5rem, 3vw, 2.125rem);
  line-height: 1.15;
}

.project-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  background: transparent;
  border: none;
  cursor: pointer;
  font: inherit;
  color: inherit;
  text-align: left;
  padding: 0;
  margin-bottom: 0.5rem;
}

.project-chev {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--ink-2);
  transition: transform 260ms var(--ease), color 180ms ease;
  flex-shrink: 0;
}

.project:hover .project-chev { color: var(--ink); }
.project.is-open .project-chev { transform: rotate(180deg); }

/* Expandable details */

.project-details {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 380ms var(--ease);
}

.project-details-inner { overflow: hidden; }

.project.is-open .project-details { grid-template-rows: 1fr; }

.project-bullets {
  list-style: none;
  margin: 0.75rem 0 0;
  color: var(--ink-2);
  max-width: var(--measure);
}

.project-bullets li {
  position: relative;
  padding-left: 1.25rem;
  margin-bottom: 0.5rem;
}

.project-bullets li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--accent);
}

.tech-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0 0.25rem;
}

.tech-chip {
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.2rem 0.75rem;
  background: var(--paper);
}

.project-desc {
  max-width: var(--measure);
  color: var(--ink-2);
}

.project-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-top: 0.875rem;
}

.project-link {
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
  text-decoration-color: var(--accent);
  transition: text-decoration-color 160ms ease;
}

.project-link:hover { text-decoration-color: var(--ink); }

.project-meta {
  text-align: right;
  color: var(--ink-2);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.project-year {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--ink);
}

/* ============ Skills (grouped grid) ============ */

.skills-section {
  padding: clamp(3rem, 7vh, 5rem) var(--gutter);
  border-top: 1px solid var(--line);
}

.skills-section h2 { margin-bottom: 2rem; }

.skills-groups {
  display: grid;
  gap: 2rem;
}

.skills-group-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.25rem;
  margin-bottom: 0.85rem;
}

.skills-group-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.skill-chip {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.5rem 1rem 0.5rem 0.65rem;
  font-weight: 500;
  white-space: nowrap;
  background: var(--paper);
  transition: border-color 160ms ease, background-color 160ms ease;
}

.skill-chip:hover { border-color: var(--ink); background: var(--paper-2); }

.skill-chip.is-learning {
  border-style: dashed;
  color: var(--ink-2);
}

.skill-icon { width: 1.25rem; height: 1.25rem; object-fit: contain; }

/* ============ Footer ============ */

.site-footer {
  background: var(--ink);
  color: var(--paper);
  padding: clamp(3.5rem, 9vh, 6rem) var(--gutter) 2.5rem;
}

.footer-lede {
  max-width: var(--measure);
  opacity: 0.85;
  font-size: 1.0625rem;
  margin-top: 0.75rem;
}

.footer-email {
  display: inline-block;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.5rem, 4.5vw, 3rem);
  margin: 1.5rem 0 2rem;
  text-decoration: none;
  border-bottom: 3px solid var(--accent);
  padding-bottom: 0.2rem;
  transition: border-color 180ms ease;
}

.footer-email:hover { border-bottom-color: var(--paper); }

.footer-links { display: flex; gap: 1.75rem; margin-bottom: 3rem; }

.footer-links a {
  text-decoration: none;
  font-weight: 500;
  opacity: 0.85;
  transition: opacity 160ms ease;
}

.footer-links a:hover { opacity: 1; text-decoration: underline; text-underline-offset: 4px; }

.footer-fine { opacity: 0.55; font-size: 0.9375rem; }

/* ============ Back to top ============ */

.back-top {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  font-size: 1.25rem;
  cursor: pointer;
  z-index: 40;
  transition: background-color 180ms ease, color 180ms ease, transform 220ms var(--ease);
}

.back-top:hover { background: var(--ink); color: var(--paper); transform: translateY(-3px); }

/* ============ Responsive ============ */

@media (max-width: 760px) {
  .site-nav { display: none; }
  .menu-btn { display: flex; }

  .hero-grid { grid-template-columns: 1fr; gap: 1.75rem; }
  .hero-portrait { order: -1; }

  .project { grid-template-columns: 1fr; }
  .project::before { padding-top: 0; }
  .project:hover { padding-left: 1.25rem; }

  .project-meta {
    text-align: left;
    flex-direction: row;
    align-items: baseline;
    gap: 0.75rem;
    order: -1;
  }

  .project-year { font-size: 1.0625rem; }

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

/* ============ Reduced motion ============ */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
  .reveal, .project { opacity: 1; transform: none; }
  .intro-1, .intro-2, .intro-3, .intro-4, .intro-5 { opacity: 1; transform: none; }
}

.skill-chip.no-icon { padding-left: 1rem; }
