@layer reset, base, layout, components;

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  body, h1, h2, h3, p, ul { margin: 0; }
  img, svg { display: block; max-width: 100%; }
}

@layer base {
  :root {
    color-scheme: light dark;
    --bg: light-dark(#fdfcfa, #16181a);
    --text: light-dark(#1f2328, #e8e6e3);
    --muted: light-dark(#59636e, #9aa3ab);
    --line: light-dark(#e4e1dc, #2c3135);
    --accent: light-dark(#b5541c, #f08a4b);
    --measure: 40rem;
    --space: clamp(1rem, 4vw, 2rem);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 1.125rem;
    line-height: 1.6;
  }

  body {
    min-height: 100dvh;
    background: var(--bg);
    color: var(--text);
  }

  h1, h2, h3 { line-height: 1.2; text-wrap: balance; }
  h1 { font-size: clamp(2rem, 6vw, 3rem); }
  h2 { font-size: 1.4rem; }
  p { text-wrap: pretty; }

  a { color: var(--accent); text-underline-offset: 0.2em; }
  a:hover { text-decoration-thickness: 2px; }

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

@layer layout {
  body {
    display: grid;
    grid-template-rows: auto 1fr auto;
  }

  .wrap {
    width: min(100% - 2 * var(--space), var(--measure));
    margin-inline: auto;
  }

  header, footer { padding-block: 1.25rem; }
  main { padding-block: clamp(2rem, 8vw, 4rem); }

  header .wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1.5rem;
  }

  footer .wrap {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.5rem 1.5rem;
  }

  footer {
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.9rem;
  }

  main .wrap > * + * { margin-top: 1rem; }
  main .wrap > h2 { margin-top: 2rem; }
  main .wrap > h3 { margin-top: 1.5rem; }
  main .wrap > ul { padding-inline-start: 1.25rem; }
  main li + li { margin-top: 0.4rem; }
}

@layer components {
  .brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text);
    font-weight: 700;
    text-decoration: none;
  }

  .logo { border-radius: 22%; }

  .hero {
    width: 100%;
    height: auto;
    border-radius: 0.75rem;
  }

  nav ul {
    display: flex;
    gap: 1.25rem;
    padding: 0;
    list-style: none;
  }

  nav a { color: var(--muted); }
  nav a:hover, nav a[aria-current] { color: var(--text); }

  .lead { font-size: 1.25rem; color: var(--muted); }
  .meta { font-size: 0.9rem; color: var(--muted); }

  /* Placeholder to be filled in before publishing */
  .todo {
    padding-inline: 0.25em;
    border-radius: 0.25rem;
    background: light-dark(#fff3b0, #4a4000);
  }

  .button {
    display: inline-block;
    padding: 0.6em 1.2em;
    border-radius: 0.5rem;
    background: var(--accent);
    color: light-dark(#fff, #16181a);
    font-weight: 600;
    text-decoration: none;
  }
  .button:hover { filter: brightness(1.1); }
}
