/*
  MOBILE-FIRST TEMPLATE STYLES
  ----------------------------
  This file controls layout, spacing, typography, and responsive behavior.
  Edit css/palette.css for colors.
*/

/* Use predictable sizing everywhere. */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--color-page-bg);
  color: var(--color-text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 1rem;
  line-height: 1.6;
}

/*
  Main width rule:
  - On phones, the page uses the available width with side padding.
  - On tablets/desktops, the content stops growing at 760px.
  Change --page-max-width if you want it wider or narrower.
*/
:root {
  --page-max-width: 760px;
  --page-padding: clamp(1rem, 4vw, 1.5rem);
  --section-gap: clamp(1.75rem, 5vw, 3rem);
}

.page-shell {
  width: min(100% - (var(--page-padding) * 2), var(--page-max-width));
  margin-inline: auto;
}

.site-header {
  padding: clamp(2.5rem, 10vw, 5rem) 0 clamp(2rem, 8vw, 4rem);
  background:
    radial-gradient(circle at top left, var(--color-accent-soft), transparent 34rem),
    var(--color-surface-alt);
  border-bottom: 1px solid var(--color-border);
}

.site-kicker {
  margin: 0 0 0.5rem;
  color: var(--color-accent-strong);
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

main {
  padding: var(--section-gap) 0;
}

section {
  margin-block: 0 var(--section-gap);
  padding: clamp(1.1rem, 4vw, 1.75rem);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 1.25rem;
  box-shadow: var(--shadow-soft);
}

section:last-child {
  margin-bottom: 0;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0 0 0.65em;
  color: var(--color-heading);
  line-height: 1.15;
}

h1 {
  max-width: 12ch;
  font-size: clamp(2.2rem, 12vw, 4rem);
  letter-spacing: -0.055em;
}

h2 {
  font-size: clamp(1.5rem, 6vw, 2rem);
  letter-spacing: -0.035em;
}

h3 {
  font-size: 1.25rem;
}

p,
ul,
ol,
figure {
  margin: 0 0 1.1rem;
}

p:last-child,
ul:last-child,
ol:last-child,
figure:last-child {
  margin-bottom: 0;
}

.intro {
  max-width: 42rem;
  color: var(--color-text-muted);
  font-size: clamp(1.05rem, 4vw, 1.25rem);
}

ul,
ol {
  padding-left: 1.35rem;
}

li + li {
  margin-top: 0.35rem;
}

a {
  color: var(--color-link);
  font-weight: 700;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

a:hover,
a:focus-visible {
  color: var(--color-link-hover);
}

code {
  padding: 0.12em 0.35em;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: 0.35rem;
  font-size: 0.92em;
}

/*
  Responsive image handling:
  Any regular image inside your content automatically scales down to fit.
*/
img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: 0.95rem;
}

figure {
  overflow: hidden;
}

figcaption {
  margin-top: 0.65rem;
  color: var(--color-text-muted);
  font-size: 0.92rem;
  text-align: left;
}

/*
  Optional two-figure layout:
  Wrap two <figure> elements in <div class="figure-pair">...</div>.
  - On narrow phones, figures stack naturally.
  - On wider screens, they sit side by side in two equal columns.
  - Captions stay left-aligned with their own images.
*/
.figure-pair {
  display: grid;
  gap: 1rem;
  margin-block: 0 1.1rem;
}

.figure-pair:last-child {
  margin-bottom: 0;
}

.figure-pair figure {
  margin: 0;
}

@media (min-width: 560px) {
  .figure-pair {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }
}

.site-footer {
  padding: 2rem 0;
  color: var(--color-text-muted);
  text-align: center;
  border-top: 1px solid var(--color-border);
}

.site-footer p {
  margin: 0;
  font-size: 0.9rem;
}

/*
  Slight desktop refinement.
  The page width remains capped by --page-max-width above.
*/
@media (min-width: 900px) {
  body {
    font-size: 1.05rem;
  }

  section {
    border-radius: 1.5rem;
  }
}
