/* Ħakke site. Colour, space, radius and stroke come from /brand/tokens.css; type from its .text-* classes. */

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--surface-100);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 26px;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

h1, p { margin: 0; }

a {
  color: var(--ember-text);
  text-decoration-thickness: var(--stroke-hairline);
  text-underline-offset: 3px;
  transition: color 120ms linear;
}

.nobr { white-space: nowrap; }

.wrap {
  width: 100%;
  max-width: 1312px;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-7);
  padding-right: var(--space-7);
}

/* Header */

.site-header { border-bottom: var(--stroke-hairline) solid var(--hairline); }

.header-row {
  display: flex;
  align-items: center;
  min-height: 72px;
}

.home { display: block; line-height: 0; }

.logo { display: block; width: 144px; height: auto; }

/* Main */

.hero {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: var(--space-9);
  padding-bottom: var(--space-9);
}

.tagline { max-width: 11em; }

/* Topographic background (brand/patterns, generated by build_topo.py): hairline contours, decoration only. */
.topo {
  position: relative;
  background: var(--surface-100) url("/brand/patterns/topo-paper.svg") center / cover no-repeat;
}
.topo > .wrap { position: relative; z-index: 1; }

/* Pulse: every 20s a narrow diagonal band sweeps the field from bottom left to top right, lifting the
   same contours in ink-muted at low opacity. It is a mask over identical lines, so nothing moves but
   the band. A deliberate exception to the 150ms motion rule (Craig's call); off for reduced motion. */
.topo::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: url("/brand/patterns/topo-paper-pulse.svg") center / cover no-repeat;
  opacity: 0.35;
  -webkit-mask-image: linear-gradient(45deg, transparent 41%, #000 50%, transparent 59%);
          mask-image: linear-gradient(45deg, transparent 41%, #000 50%, transparent 59%);
  -webkit-mask-size: 300% 300%;
          mask-size: 300% 300%;
  -webkit-mask-repeat: no-repeat;
          mask-repeat: no-repeat;
  -webkit-mask-position: 100% 0%;
          mask-position: 100% 0%;
  animation: topo-pulse 20s linear infinite;
}

@keyframes topo-pulse {
  0%   { -webkit-mask-position: 100% 0%; mask-position: 100% 0%; }
  60%  { -webkit-mask-position: 0% 100%; mask-position: 0% 100%; }
  100% { -webkit-mask-position: 0% 100%; mask-position: 0% 100%; }
}

@media (prefers-color-scheme: dark) {
  .topo { background-image: url("/brand/patterns/topo-graphite.svg"); }
  .topo::before { background-image: url("/brand/patterns/topo-graphite-pulse.svg"); }
}

@media (prefers-reduced-motion: reduce) {
  .topo::before { display: none; }
}

/* The tagline opens on Ħ, which is the mark, so it takes the mark's colour (display size, so ember passes). */
.mark-letter { color: var(--ember); }

.back { margin-top: var(--space-4); }

/* Footer */

.site-footer { background: var(--surface-200); color: var(--ink-muted); }

.footer-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: var(--space-3) var(--space-5);
  padding-top: var(--space-4);
  padding-bottom: var(--space-4);
}

.footer-start { text-align: left; }
.footer-mid { text-align: center; }
.footer-end { text-align: right; }

/* Narrower screens: step the tagline down the display scale (display-lg, then display-md). */

@media (max-width: 1100px) {
  .tagline { font-size: 64px; line-height: 64px; }
}

@media (max-width: 960px) {
  .wrap { padding-left: var(--space-5); padding-right: var(--space-5); }
  .hero { padding-top: var(--space-8); padding-bottom: var(--space-8); }
}

@media (max-width: 640px) {
  .wrap { padding-left: var(--space-3); padding-right: var(--space-3); }
  .header-row { min-height: 64px; }
  .hero { padding-top: var(--space-7); padding-bottom: var(--space-7); }
  .tagline { font-size: 44px; line-height: 48px; }
  .footer-row { grid-template-columns: minmax(0, 1fr); gap: var(--space-2); }
  .footer-start, .footer-mid, .footer-end { text-align: center; }
  .footer-mid { order: -1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
