/* Palette and rhythm. Everything else refers to these. */
:root {
  --bg: #f7f6f1;
  --surface: #ffffff;
  --text: #1b1d1c;
  --muted: #5d6662;
  --line: #e2e0d8;
  --accent: #2f7a5b;
  --accent-soft: #e3efe8;
  --radius: 14px;
  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
  --content-width: 64rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111413;
    --surface: #181c1a;
    --text: #e6e8e5;
    --muted: #97a19c;
    --line: #262c29;
    --accent: #6fcf9f;
    --accent-soft: #1c2b24;
  }
}

/* --- Base ---------------------------------------------------------------- */

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

h1, h2, h3 { line-height: 1.2; letter-spacing: -0.015em; }

h3 { font-size: 1.1rem; margin: 0 0 0.35rem; }

p { margin: 0; }

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

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  align-items: center;
  min-height: 92vh;
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 3rem 1.5rem;
  overflow: hidden;
}

.hero__text { position: relative; z-index: 1; }

.hero__plant {
  grid-column: 2;
  grid-row: 1;
  width: 100%;
  height: 80vh;
  stroke: var(--accent);
  stroke-width: 1px;
  fill: none;
  opacity: 0.85;
}

.hero__plant path {
  vector-effect: non-scaling-stroke;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  transform-box: fill-box;
  transform-origin: 50% 100%;
}

.eyebrow {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1 {
  font-size: clamp(2.6rem, 7vw, 4.6rem);
  margin: 0.6rem 0 1.2rem;
}

.lede {
  max-width: 32rem;
  font-size: 1.2rem;
  color: var(--muted);
}

.hero__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.6rem;
  margin-top: 2.2rem;
}

.hero__nav a {
  text-decoration: none;
  font-weight: 500;
  background: linear-gradient(var(--accent), var(--accent)) no-repeat 0 100% / 0 2px;
  transition: background-size 0.3s var(--ease-out);
}

.hero__nav a:hover,
.hero__nav a:focus-visible { background-size: 100% 2px; }

/* --- Sections ------------------------------------------------------------ */

.section {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 4rem 1.5rem;
}

.section__title {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 2rem;
}

/* --- Timeline ------------------------------------------------------------ */

.timeline {
  list-style: none;
  margin: 0;
  padding: 0 0 0 1.6rem;
  border-left: 2px solid var(--line);
}

.timeline__item {
  position: relative;
  padding-bottom: 2.2rem;
}

.timeline__item::before {
  content: "";
  position: absolute;
  left: calc(-1.6rem - 7px);
  top: 0.35rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
}

.timeline__item:first-child::before { background: var(--accent); }

.timeline__when {
  display: block;
  font-size: 0.9rem;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  margin-bottom: 0.2rem;
}

.timeline__item p,
.card p,
.interest p { color: var(--muted); }

/* --- Project cards ------------------------------------------------------- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: 1.1rem;
}

.project-group {
  font-size: 1rem;
  font-weight: 600;
  margin: 2.5rem 0 1rem;
}

.project-group:first-of-type { margin-top: 0; }

.card {
  display: flex;
  flex-direction: column;
  padding: 1.4rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  transition: transform 0.35s var(--ease-out), border-color 0.35s, box-shadow 0.35s;
}

.card:hover,
.card:focus-visible {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 12px 30px -18px var(--accent);
}

.card--wide { grid-column: 1 / -1; }

.card__kicker {
  font-size: 0.8rem;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.card p { flex-grow: 1; }

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
}

.tags li {
  font-size: 0.8rem;
  padding: 0.1rem 0.6rem;
  border-radius: 999px;
  background: var(--accent-soft);
}

/* --- Interests ----------------------------------------------------------- */

.interests {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 2rem;
}

.interest {
  padding-top: 1rem;
  border-top: 2px solid var(--accent);
}

.languages {
  margin-top: 3rem;
  color: var(--muted);
}

/* --- Footer -------------------------------------------------------------- */

.footer {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}

.footer__github {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  transition: color 0.2s;
}

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

/* --- Small screens: the plant moves behind the text ---------------------- */

@media (max-width: 48rem) {
  .hero { grid-template-columns: minmax(0, 1fr); min-height: 85vh; }
  .hero__plant {
    grid-area: auto; /* else its containing block is the missing column 2 */
    position: absolute;
    inset: auto 0 0 auto;
    width: 75%;
    height: 90%;
    opacity: 0.3;
  }
}

/* --- Motion: only for people who haven't asked to reduce it -------------- */

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

@keyframes grow {
  from { stroke-dashoffset: 1; }
  to   { stroke-dashoffset: 0; }
}

@keyframes sway {
  from { transform: rotate(-0.6deg); }
  to   { transform: rotate(0.6deg); }
}

@media (prefers-reduced-motion: no-preference) {
  .hero__text > * {
    animation: rise 0.8s var(--ease-out) both;
    animation-delay: calc(var(--i) * 110ms + 150ms);
  }

  .hero__plant path {
    animation:
      grow 4.5s ease-out both,
      sway 7s ease-in-out 4.5s infinite alternate;
  }

  /* Scroll-driven reveal where supported; elsewhere content is simply shown. */
  @supports (animation-timeline: view()) {
    .reveal {
      animation: rise linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 35%;
    }
  }
}
