:root {
  /* Warm ivory / charcoal / sage palette, kept from the original direction */
  --bg: #faf7f2;
  --ink: #2e2a25;
  --muted: #6f6759;
  --accent: #5c715e;
  --accent-dark: #48594a;
  /* Single hairline treatment used everywhere a border appears */
  --hairline: 1px solid #2b272a;
  --font-sans: "Be Vietnam Pro", sans-serif;
  --font-display: "Lexend Deca", sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  /* One deliberate pace for every micro-interaction */
  --ease: 150ms ease-out;
  /* The drawer travels farther than a micro-interaction, so it gets a longer beat */
  --ease-drawer: 300ms ease-out;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

a {
  color: black;
  text-decoration: underline;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  header nav,
  .nav-backdrop,
  .nav-toggle-line {
    transition: none;
  }
}

body {
  background-color: var(--bg);
  color: var(--ink);
  margin: 0;
  font-family: var(--font-sans);
  font-weight: 400;
  line-height: 1.8;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.2;
  margin: 0;
}

/* ---------- Floating header ---------- */

header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: var(--hairline);
}

/* The frosted background lives on a pseudo-element: backdrop-filter on the
   header itself would make it the containing block for the fixed-position
   drawer and backdrop, pinning them to the header instead of the viewport */
header::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-color: rgba(250, 247, 242, 0.92);
  backdrop-filter: blur(8px);
}

.wordmark {
  color: var(--ink);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* Mobile: the nav is an off-canvas drawer that slides in from the right */
header nav {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  width: min(70vw, 18rem);
  padding: 5.5rem 2rem 2rem;
  background-color: var(--bg);
  border-left: var(--hairline);
  transform: translateX(100%);
  transition: transform var(--ease-drawer);
}

body.nav-open header nav {
  transform: translateX(0);
}

/* Dims the page behind the open drawer; tapping it closes the menu */
.nav-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background-color: rgba(46, 42, 37, 0.35);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--ease-drawer), visibility var(--ease-drawer);
}

body.nav-open .nav-backdrop {
  opacity: 1;
  visibility: visible;
}

/* Keep the page from scrolling behind the open drawer */
body.nav-open {
  overflow: hidden;
}

header nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

header nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 1.05rem;
  transition: color var(--ease);
}

/* ---------- Hamburger toggle ---------- */

.nav-toggle {
  position: relative;
  z-index: 40; /* stays above the drawer so the X can close it */
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
}

.nav-toggle-line {
  width: 1.25rem;
  height: 2px;
  background-color: var(--ink);
  transition: transform var(--ease), opacity var(--ease);
}

/* The three lines fold into an X while the drawer is open */
body.nav-open .nav-toggle-line:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

body.nav-open .nav-toggle-line:nth-child(2) {
  opacity: 0;
}

body.nav-open .nav-toggle-line:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

header nav a:hover,
.wordmark:hover {
  color: var(--accent-dark);
}

/* ---------- Page column & section rhythm ---------- */

main {
  max-width: 62rem;
  margin: 0 auto;
  padding: 0 1.5rem;
}

section {
  padding: 5rem 0;
  border-top: var(--hairline);
  scroll-margin-top: 5rem;
}

/* The hero opens the page; no rule above it */
section:first-child {
  border-top: none;
}

h2 {
  font-size: 1.6rem;
}

.section-intro {
  color: var(--muted);
  max-width: 36rem;
  margin: 1.25rem 0 4rem;
}

/* ---------- Hero ---------- */

.hero {
  min-height: calc(100vh - 5rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 1.25rem;
}

.hero img {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 50%;
  margin-bottom: 1rem;
}

.hero-eyebrow {
  margin: 0;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.hero h1 {
  font-size: 2.75rem;
}

.hero-tagline {
  margin: 0;
  max-width: 32rem;
  color: var(--muted);
  font-size: 1.05rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  margin-top: 2rem;
}

/* ---------- Buttons & links ---------- */

.button {
  display: inline-block;
  padding: 0.8rem 2rem;
  background-color: var(--accent);
  color: #fff;
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.95rem;
  transition: background-color var(--ease);
}

.button:hover {
  background-color: var(--accent-dark);
}

.link-arrow {
  color: var(--accent-dark);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.95rem;
  transition: opacity var(--ease);
}

.link-arrow:hover {
  opacity: 0.6;
}

/* ---------- About pillars ---------- */

.pillars {
  list-style: none;
  margin: 0;
  margin-top: 20px;
  padding: 0;
  display: grid;
  gap: 3rem;
}

.pillars h3 {
  font-size: 1.05rem;
  margin-bottom: 0.75rem;
}

.pillars p {
  margin: 0;
  margin-top: 20px;
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 36rem;
}

/* ---------- Projects ---------- */

.project-list {
  display: grid;
  gap: 5rem;
}

/* Quiet browser-frame wireframe, shown until a real screenshot replaces it */
.project-wrap {
  display: flex;
  justify-content: center;
  gap: 40px;
}

/* Mobile baseline: only the phone screenshot fits, so hide the desktop one */
.project-preview {
  display: none;
  margin: 0 0 1.75rem;
  max-width: 36rem;
  border: var(--hairline);
}

.preview-mobile {
  display: block;
  height: 332px;
}

.preview-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0.6rem 0.9rem;
  border-bottom: var(--hairline);
}

.preview-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: 1px solid var(--muted);
}

.preview-url {
  margin-left: 0.5rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.ph-hero {
  height: 3rem;
  background-color: rgba(92, 113, 94, 0.14);
}

.ph-line {
  height: 0.45rem;
  width: 75%;
  background-color: rgba(46, 42, 37, 0.1);
}

.ph-line-short {
  width: 50%;
}

/* Simple stack: mono meta, bold title, muted summary */
.project-meta {
  margin: 0 0 1rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.project h3 {
  font-size: 1.25rem;
}

.project-summary {
  margin: 0.75rem 0 0;
  color: var(--muted);
  max-width: 36rem;
}

.project .link-arrow {
  display: inline-block;
  margin-top: 1.25rem;
}

/* ---------- Progressive disclosure ---------- */

details {
  margin-top: 1.25rem;
  max-width: 36rem;
}

summary {
  cursor: pointer;
  list-style: none;
  color: var(--accent-dark);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.95rem;
  transition: opacity var(--ease);
}

summary::-webkit-details-marker {
  display: none;
}

summary:hover {
  opacity: 0.6;
}

/* Quiet plus / minus cue instead of the default triangle */
summary::after {
  content: " +";
  color: var(--muted);
}

details[open] summary::after {
  content: " −";
}

details > p {
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

/* ---------- Work history ---------- */

.timeline {
  display: grid;
  gap: 2.5rem;
}

.timeline-entry {
  margin-top: 0;
  max-width: none;
  border-bottom: var(--hairline);
  padding-bottom: 2.5rem;
}

/* Mobile: the contact section's own top rule follows, so the last
   entry's rule would read as a doubled divider */
.timeline-entry:last-child {
  border-bottom: none;
}

.timeline-entry summary {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  color: var(--ink);
}

.timeline-period {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.timeline-role {
  font-size: 1.05rem;
}

.timeline-entry > p {
  max-width: 36rem;
}

/* ---------- Contact & footer ---------- */

#contact .section-intro {
  margin-bottom: 3rem;
}

footer {
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  border-top: var(--hairline);
}

footer p {
  margin: 0;
}

/* ---------- Desktop overrides ---------- */

@media (min-width: 768px) {
  header {
    padding: 1.25rem 3rem;
  }

  /* Desktop: no drawer — hide the toggle and return the nav to the header row */
  .nav-toggle,
  .nav-backdrop {
    display: none;
  }

  header nav {
    position: static;
    width: auto;
    padding: 0;
    background-color: transparent;
    border-left: none;
    transform: none;
    transition: none;
  }

  header nav ul {
    flex-direction: row;
    gap: 2rem;
  }

  header nav a {
    font-size: 0.9rem;
  }

  /* A leftover open-drawer state must not keep desktop scrolling locked */
  body.nav-open {
    overflow: auto;
  }

  section {
    padding: 7rem 0;
  }

  /* Asymmetric grid: heading rests in the left column, content in the right */
  section:not(.hero) {
    display: grid;
    grid-template-columns: 1fr 2fr;
    column-gap: 4rem;
  }

  section:not(.hero) > h2 {
    grid-column: 1;
  }

  section:not(.hero) > :not(h2) {
    grid-column: 2;
  }

  .section-intro {
    margin-top: 0.5rem;
  }

  /* Tablet: swap to the desktop screenshot alone — both don't fit yet */
  .project-preview {
    display: block;
  }

  .preview-mobile {
    display: none;
  }

  /* Desktop: the timeline sits in its own column, so its closing rule
     doesn't double up with the contact section's top rule */
  .timeline-entry:last-child {
    border-bottom: var(--hairline);
  }

  .hero h1 {
    font-size: 3.5rem;
  }

  .hero img {
    width: 150px;
    height: 150px;
  }

  .timeline-entry summary {
    flex-direction: row;
    justify-content: space-between;
    align-items: baseline;
    gap: 2rem;
  }
  .pillars {
    margin-top: 0;
  }
}

@media (min-width: 1024px) {
  /* Wide desktop: room for the desktop and mobile screenshots side-by-side */
  .preview-mobile {
    display: block;
  }
}
