/* =========================================================
   LAYOUT — page frame and grid
   ========================================================= */

/* ---------- Page frame ----------
   Sections stretch edge to edge (so a background colour or grid
   pattern can fill the full width), while their content stays
   within --max-width and keeps a side margin of --gutter.
   The max() picks whichever is larger: the normal side margin,
   or the extra space needed to centre content on wide screens. */
.site-header,
main > section,
main > .pillars,
.site-footer {
  padding-inline: max(var(--gutter), calc((100% - var(--max-width)) / 2 + var(--gutter)));
}

main > section {
  padding-block: var(--section-space);
}

/* ---------- 12-column grid ----------
   4 columns on phones, 6 on tablets, 12 on laptops and up.
   Use with e.g.  <div class="grid">  and place children with
   grid-column, e.g.  grid-column: 1 / span 6;  */
.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  column-gap: var(--column-gap);
}

@media (min-width: 40em) {   /* 640px and wider */
  .grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

@media (min-width: 64em) {   /* 1024px and wider */
  .grid { grid-template-columns: repeat(12, minmax(0, 1fr)); }
}

/* When a nav link jumps to a section, stop just below the sticky bar
   instead of hiding the section's top behind it */
[id] { scroll-margin-top: var(--nav-height); }

/* ---------- Nav (sticky top bar) ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--white);
  border-bottom: var(--border);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--nav-height);
}

.nav__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.0625rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
}

.nav__list {
  display: flex;
  gap: 0.125rem;
  height: 100%;
}

.nav__list a {
  /* Full bar height = big, easy tap target on phones */
  display: flex;
  align-items: center;
  gap: 0.5em;
  height: 100%;
  padding-inline: 0.375rem;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  transition: color var(--duration) var(--ease);
}
.nav__num { color: var(--cobalt); }

.nav__name:hover,
.nav__list a:hover { color: var(--cobalt); }

/* "Story" in cobalt; turns near-black on hover */
.nav__list a.nav__story       { color: var(--cobalt); }
.nav__list a.nav__story:hover { color: var(--ink); }

/* Phones & tablets: "SA." instead of the full name; section names hidden
   visually (screen readers still read them) */
.nav__name-full,
.nav__text {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.nav__dot { color: var(--cobalt); }
.nav__name-short { letter-spacing: -0.04em; font-weight: 800; }

/* Laptop and up: full name + section names = a small table of contents */
@media (min-width: 64em) {
  .nav__name-full,
  .nav__text {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip-path: none;
  }
  .nav__name-short { display: none; }
  .nav__list { gap: var(--space-1); }
  .nav__list a { padding-inline: var(--space-1); }
}

/* ---------- Buttons ---------- */
.button {
  display: inline-flex;
  align-items: center;
  gap: 0.75em;
  padding: 0.85em 1.25em;
  border: 1px solid var(--cobalt);
  border-radius: var(--radius);
  background: var(--cobalt);
  color: var(--white);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  transition: background-color var(--duration) var(--ease),
              border-color var(--duration) var(--ease),
              color var(--duration) var(--ease);
}

.button:hover {
  background: var(--ink);
  border-color: var(--ink);
}

.button--outline {
  background: transparent;
  color: var(--cobalt);
}

.button--outline:hover {
  background: var(--cobalt);
  border-color: var(--cobalt);
  color: var(--white);
}

/* The arrow nudges right on hover */
.button span[aria-hidden] {
  transition: transform var(--duration) var(--ease);
}
.button:hover span[aria-hidden] { transform: translateX(3px); }

/* ---------- Footer: one compact line ----------
   Phones: icons on top, then © left + legal links right.
   Tablet and up: © · icons · legal links on a single line. */
.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  column-gap: var(--space-4);
  row-gap: var(--space-1);
  padding-block: var(--space-3);
  border-top: var(--border);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--ink-muted);
}

.footer__social {
  order: -1;            /* phones: icons first */
  width: 100%;
  display: flex;
  /* pull the first icon's tap area out so the icon itself lines up with the text edge */
  margin-inline-start: calc((2.75rem - 1.125rem) / -2);
}

.footer__social a {
  display: grid;
  place-items: center;
  width: 2.75rem;       /* 44px tap target */
  height: 2.75rem;
  color: var(--ink);
  transition: color var(--duration) var(--ease);
}
.footer__social a:hover { color: var(--cobalt); }

.footer__social svg {
  width: 1.125rem;      /* 18px icon */
  height: 1.125rem;
  fill: currentColor;   /* takes the link colour, so hover turns it cobalt */
}

.footer__legal {
  display: flex;
  gap: var(--space-3);
}
.footer__legal a {
  color: inherit;
  text-decoration: none;
}
.footer__legal a:hover {
  color: var(--cobalt);
  text-decoration: underline;
}

@media (min-width: 40em) {
  .footer__social {
    order: 0;
    width: auto;
    margin-inline-start: 0;
  }
}

/* Thin divider line */
.rule {
  border: 0;
  border-top: var(--border);
  margin: 0;
}
