:root {
  --bg: #faf9f6;
  --fg: #1d1d1b;
  --muted: #66615b;
  --line: #d8d5cf;
  --accent: #304d74;
  --max: 1100px;
  --gutter: 30px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "Source Serif 4", serif;
  font-size: 18px;
  line-height: 1.65;
}

a {
  color: inherit;
}

.topbar {
  max-width: var(--max);
  margin: 0 auto;
  padding: 42px var(--gutter) 0;

  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 40px;

  font-family: Inter, sans-serif;
}

.brand {
  font-size: 1.25rem;
  font-weight: 600;
}

.brand a {
  text-decoration: none;
}

.topbar nav {
  display: flex;
  justify-content: flex-end;
  gap: 28px;
}

.topbar nav a {
  text-decoration: none;
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

.topbar nav a:hover {
  color: var(--fg);
}

#theme-toggle {
  border: 0;
  background: transparent;
  color: var(--fg);
  padding: 4px;
  font-size: 1.1rem;
  cursor: pointer;
}

main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter) 100px;
}

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

.hero {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(240px, 1fr);
  gap: 70px;

  margin-top: 120px;
  margin-bottom: 130px;
}

.hero h1 {
  margin: 0;

  font-size: clamp(3.5rem, 7vw, 6.5rem);
  line-height: 0.98;
  letter-spacing: -0.035em;
  font-weight: 600;
}

.hero .lead {
  margin: 0;
  align-self: end;

  max-width: 25rem;

  font-size: 1.25rem;
  color: var(--muted);
}

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

section {
  margin-top: 110px;
}

section:first-of-type {
  margin-top: 0;
}

h2 {
  margin: 0 0 28px;

  font-size: 2rem;
  line-height: 1.2;
  font-weight: 600;
}

p {
  max-width: 48rem;
}

section > p {
  font-size: 1.2rem;
}

/* --------------------------------------------------
   Grids
-------------------------------------------------- */

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 55px;
}

.card {
  min-width: 0;
}

.card h3 {
  margin: 0 0 12px;

  font-family: Inter, sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.card p {
  margin: 0;
  color: var(--muted);
}

/* Projects has four items, so let them make
   a sensible four-column desktop layout. */

#projects .grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 40px;
}

/* --------------------------------------------------
   Lists
-------------------------------------------------- */

ul {
  max-width: 48rem;
  margin: 0;
  padding-left: 1.3em;
}

li {
  margin-bottom: 0.5rem;
}

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

footer {
  margin-top: 130px;
  padding-top: 30px;
  border-top: 1px solid var(--line);

  color: var(--muted);
  font-size: 0.95rem;
}

footer p {
  margin: 0 0 8px;
}

footer a {
  color: inherit;
}


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

/*
   We are NOT creating a separate mobile design.

   We simply allow the desktop composition to collapse
   when the available width becomes insufficient.
*/

@media (max-width: 850px) {

  :root {
    --gutter: 28px;
  }

  .topbar {
    grid-template-columns: auto 1fr auto;
    gap: 20px;
  }

  .topbar nav {
    gap: 18px;
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 30px;

    margin-top: 90px;
    margin-bottom: 100px;
  }

  .hero .lead {
    max-width: 42rem;
  }

  .grid,
  #projects .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}


@media (max-width: 620px) {

  :root {
    --gutter: 24px;
  }

  body {
    font-size: 18px;
  }

  .topbar {
    padding-top: 28px;

    /*
       Keep the same navigation rather than replacing it
       with a hamburger menu.
    */
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
  }

  .brand {
    margin-right: auto;
  }

  .topbar nav {
    order: 3;
    width: 100%;

    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 14px 22px;
  }

  #theme-toggle {
    flex: 0 0 auto;
  }

  main {
    padding-bottom: 70px;
  }

  .hero {
    margin-top: 75px;
    margin-bottom: 90px;
  }

  .hero h1 {
    font-size: clamp(3rem, 13vw, 4.5rem);
  }

  .hero .lead {
    font-size: 1.2rem;
  }

  section {
    margin-top: 85px;
  }

  h2 {
    font-size: 1.8rem;
  }

  section > p {
    font-size: 1.15rem;
  }

  .grid,
  #projects .grid {
    grid-template-columns: 1fr;
    gap: 42px;
  }

  footer {
    margin-top: 90px;
  }
}