/* Base layout: page ground, type, header, nav, footer.
   The shell rules for body font, headings, .wrap and .measure sit inline in base.html. */

*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--wa-ground);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  background: var(--wa-ground);
  color: var(--wa-ink-body);
  font-size: var(--wa-t-ui);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-wrap: break-word;
}

::selection { background: var(--wa-accent-wash); color: var(--wa-ink); }

h1, h2, h3, h4 { color: var(--wa-ink); text-wrap: balance; margin: 0; }
h1 { font-size: var(--wa-t-1); font-weight: 400; line-height: 1.14; letter-spacing: -.018em; }
h2 { font-size: var(--wa-t-2); font-weight: 400; line-height: 1.2; letter-spacing: -.015em; }
h3 { font-size: var(--wa-t-3); font-weight: 500; line-height: 1.28; letter-spacing: -.01em; }
h4 { font-size: var(--wa-t-4); font-weight: 500; line-height: 1.4; letter-spacing: -.005em; }

p { margin: 0; }

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

:focus-visible { outline: 2px solid var(--wa-accent); outline-offset: 2px; }
.site-main:focus { outline: none; }

.skip {
  position: absolute;
  left: var(--wa-s-4);
  top: var(--wa-s-2);
  z-index: 10;
  background: var(--wa-ink);
  color: var(--wa-sheet);
  padding: var(--wa-s-2) var(--wa-s-3);
  font-weight: 500;
  text-decoration: none;
  transform: translateY(-200%);
}
.skip:focus { transform: none; }
.skip:hover, .skip:focus { color: var(--wa-sheet); text-decoration: none; }

/* ---------------------------------------------------------------- header */
.site-head {
  background: var(--wa-sheet);
  border-bottom: 1px solid var(--wa-hairline);
}
.head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--wa-s-5);
  min-height: 72px;
}
.brand { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: var(--wa-s-3) 0; }
.lockup {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--wa-ink);
  text-decoration: none;
}
.lockup:hover { color: var(--wa-ink); }
.mark { flex: 0 0 auto; display: block; }
.mark-ink { stroke: var(--wa-ink); }
.mark-accent { stroke: var(--wa-accent); }
.wordmark {
  font-family: var(--wa-font-operate);
  font-size: var(--wa-t-4);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -.005em;
  white-space: nowrap;
}
.tagline {
  font-size: var(--wa-t-meta);
  line-height: 1.45;
  color: var(--wa-ink-muted);
  padding-left: 34px; /* aligns with the wordmark: mark 24px plus the 10px gap */
}

/* nav: one row on desktop */
.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: var(--wa-s-5);
}
.site-nav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--wa-ink-muted);
  text-decoration: none;
  font-size: var(--wa-t-ui);
  white-space: nowrap;
}
.site-nav a:not(.cta)::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 8px;
  height: 2px;
  background: var(--wa-accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--wa-dur-state) var(--wa-ease);
}
.site-nav a:not(.cta):hover { color: var(--wa-ink); }
.site-nav a:not(.cta):hover::after,
.site-nav a[aria-current="page"]::after { transform: scaleX(1); }
.site-nav a[aria-current="page"] { color: var(--wa-ink); }

.site-nav a.cta {
  background: var(--wa-ink);
  color: var(--wa-sheet);
  font-weight: 500;
  padding: 0 20px;
}
.site-nav a.cta:hover,
.site-nav a.cta[aria-current="page"] { background: var(--wa-accent); color: var(--wa-sheet); }

/* tablet: the nav takes its own row under the brand */
@media (max-width: 1080px) {
  .head-row { flex-direction: column; align-items: stretch; gap: 0; }
  .site-nav { border-top: 1px solid var(--wa-hairline); margin: 0 calc(-1 * var(--wa-gutter)); padding: 0 var(--wa-gutter); }
  .site-nav ul { justify-content: space-between; gap: var(--wa-s-3); }
}

/* phone: the nav becomes a four-column grid of full-size targets, nothing hidden */
@media (max-width: 640px) {
  .head-row { min-height: 0; }
  .brand { padding: var(--wa-s-4) 0 var(--wa-s-3); }
  .site-nav { margin: 0 -16px; padding: 0; }
  .site-nav ul {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    background: var(--wa-hairline);
  }
  .site-nav li { background: var(--wa-sheet); min-width: 0; }
  .site-nav a { width: 100%; justify-content: center; min-height: 48px; padding: 0 var(--wa-s-1); }
  .site-nav a:not(.cta)::after { left: 25%; right: 25%; bottom: 6px; }
  .site-nav a.cta { padding: 0 var(--wa-s-1); }
  .site-nav li.nav-cta-item:nth-child(4n + 1) { grid-column: 1 / -1; }
}

/* ---------------------------------------------------------------- main */
.site-main { flex: 1 0 auto; padding: var(--wa-s-8) 0 var(--wa-s-10); }
@media (max-width: 640px) {
  .site-main { padding: var(--wa-s-6) 0 var(--wa-s-8); }
  h1 { font-size: var(--wa-t-2); }
  h2 { font-size: var(--wa-t-3); }
}

/* ---------------------------------------------------------------- footer */
.site-foot {
  padding: 0 0 var(--wa-s-6);
  color: var(--wa-ink-muted);
}
.foot-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 2fr);
  gap: var(--wa-s-5) var(--wa-s-6);
  padding: var(--wa-s-6) 0 var(--wa-s-5);
}
.foot-name {
  font-size: var(--wa-t-ui);
  font-weight: 500;
  color: var(--wa-ink);
  letter-spacing: -.005em;
}
.foot-brand .tagline { padding-left: 0; }
.foot-links ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--wa-s-1); }
.foot-links a { display: inline-flex; align-items: center; min-height: 32px; color: var(--wa-ink-body); text-decoration: none; }
.foot-links a:hover { color: var(--wa-accent); text-decoration: underline; }
.foot-sources { font-size: var(--wa-t-ui); line-height: 1.5; }
.foot-refresh { border-top: 1px solid var(--wa-hairline); padding-top: var(--wa-s-3); }
.foot-refresh a { color: var(--wa-ink-muted); }
.foot-refresh a:hover { color: var(--wa-accent); }

@media (max-width: 900px) {
  .foot-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .foot-sources { grid-column: 1 / -1; }
}
@media (max-width: 480px) {
  .foot-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ---------------------------------------------------------------- motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0ms !important;
    animation-duration: 0ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}
