/* =========================================================
   Sections
   Page sections in page order. Each section keeps its own
   media queries right after its rules.
   ========================================================= */

/* ---------------------------------------------------------
   Site header (blends into the hero, then frosts on scroll)
   --------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid transparent;
  background: var(--paper);
  box-shadow: 0 6px 20px -12px transparent;
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  backdrop-filter: saturate(140%) blur(12px);
}

.site-header.is-scrolled {
  border-bottom-color: var(--line);
  background: var(--header-bg);
  box-shadow: 0 6px 20px -12px color-mix(in srgb, var(--ink) 20%, transparent);
}

@media (prefers-reduced-motion: no-preference) {
  .site-header {
    transition: border-color 320ms var(--ease),
                background-color 320ms var(--ease),
                box-shadow 320ms var(--ease);
  }
}

/* Short windows (landscape phones, 300-400% zoom): let the header scroll away
   instead of covering a big share of the screen. In em, so it also applies when
   enlarged text makes the header taller (wins over base.css's scroll padding). */
@media (max-height: 30em) {
  .site-header {
    position: relative;
  }

  html {
    scroll-padding-top: var(--space-4);
  }
}

.site-header__inner {
  display: flex;
  flex-wrap: wrap;  /* with enlarged text the icons drop to a second row instead of overlapping */
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  min-height: var(--header-h);
}

.site-header .brand {
  flex-shrink: 0;  /* never narrower than its own name */
}

.site-header__right {
  display: flex;
  align-items: center;
  gap: var(--space-5);
}

.site-nav {
  display: flex;
  gap: var(--space-5);
  padding-right: var(--space-5);
  border-right: 1px solid var(--line);
}

.site-nav a {
  font-size: var(--text-md);
  font-weight: 500;
  color: var(--ink-muted);
  white-space: nowrap;
  transition: color var(--speed) var(--ease);
}

@media (hover: hover) {
  .site-nav a:hover {
    color: var(--ink);
  }
}

/* Taller tap area for nav links on touch screens (phones never show the nav) */
@media (pointer: coarse) {
  .site-nav a {
    padding-block: var(--space-3);            /* ~49px-tall hit area ...        */
    margin-block: calc(var(--space-3) * -1);  /* ... without changing the layout */
  }
}

/* Nav breakpoint: at this width and below the nav hides to keep the phone
   header compact (socials stay; About is a short scroll away).
   One link fits from 641px; raise this to 740px for two links, 900px for three. */
@media (max-width: 640px) {
  .site-nav {
    display: none;
  }
}

/* Phones: a shorter header with tighter spacing */
@media (max-width: 640px) {
  .site-header__inner {
    min-height: var(--header-h-sm);
    gap: var(--space-3);
  }

  .site-header .socials {
    gap: var(--space-1);
  }
}

/* Header fit on phones: mark + name + four 44px icons need about 345px of room */
@media (max-width: 440px) {
  .site-header .brand span {
    font-size: var(--text-base);
  }
}

@media (max-width: 389px) {
  .site-header .brand span {
    display: none;  /* mark alone on small phones; the hero wordmark names us */
  }
}

/* ---------------------------------------------------------
   Hero
   --------------------------------------------------------- */
.hero {
  position: relative;
  isolation: isolate;  /* keeps the decorative dot grid below behind the content */
  overflow: hidden;
  /* Bottom: room for the About wave (which overlaps it) plus a generous pause above it */
  padding-block: clamp(3rem, 1.75rem + 4vw, 5.5rem) calc(var(--divider-h) + clamp(3rem, 4.5vw, 5.5rem));
  text-align: center;
}

/* Atmosphere: very faint ink dot grid that fades out toward the edges */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background-image: radial-gradient(var(--hero-dots) 1px, transparent 1.6px);
  background-position: center top;
  background-size: 26px 26px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 20%, transparent 75%);
  mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 20%, transparent 75%);
}

.hero__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Keep in step with the wordmark's sizes attribute in index.html */
.hero__title {
  width: min(1000px, 100%);
  margin-top: var(--space-5);
}

.hero__title img {
  width: 100%;
}

/* Display type comes from .display-text (base.css) */
.hero__tagline {
  margin-top: var(--space-6);
  font-size: var(--text-tagline);
}

.hero__lead {
  max-width: 38rem;
  margin-top: var(--space-4);
  font-size: var(--text-lead);
  color: var(--ink-muted);
  text-wrap: pretty;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-3);
  margin-top: var(--space-6);
}

/* Stacked, full-width buttons on phones */
@media (max-width: 640px) {
  .hero__actions {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    max-width: 340px;
  }
}

/* Short laptop screens (e.g. a 1366x657 window): the wordmark and tagline shrink
   with the window height, so the tagline and both buttons fit on the first screen.
   Phones and screens taller than 820px are unchanged; browsers without svh units
   keep the full-size wordmark. */
@media (min-width: 641px) and (max-height: 820px) {
  .hero {
    padding-top: clamp(1.5rem, 5svh, 3rem);
  }

  .hero__title {
    width: min(1000px, 100%, 88svh);
  }

  .hero__tagline {
    margin-top: var(--space-5);
    font-size: min(var(--text-tagline), 6.5svh);
  }

  .hero__actions {
    margin-top: var(--space-5);
  }
}

/* ---------------------------------------------------------
   About
   --------------------------------------------------------- */
.about {
  position: relative;
  padding-block: clamp(2.5rem, 1.5rem + 3vw, 4.5rem) var(--section-y);
  background: linear-gradient(to bottom, var(--cream), var(--paper) 85%);
}

/* Overlap the hero's bottom padding; the fill meets the About band without
   a seam. Non-scaling strokes keep the rounded dashes consistent on phones. */
.about__divider {
  position: absolute;
  bottom: calc(100% - 1px);
  left: 0;
  width: 100%;
  height: var(--divider-h);
  overflow: hidden;
  pointer-events: none;
}

.about__wave {
  fill: var(--cream);
}

.about__trail {
  fill: none;
  stroke: color-mix(in srgb, var(--gold) 65%, var(--ink) 35%);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 9 15;
  opacity: 0.7;
}

/* High-contrast modes repaint the page but not SVG fills, which would leave a
   bright cream band here. The wave is only decoration, so drop it. */
@media (forced-colors: active) {
  .about__divider {
    display: none;
  }
}

.about__intro {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;            /* fallback for browsers without "last baseline" */
  align-items: last baseline;  /* the heading and the blurb's last line share a baseline */
  gap: var(--space-5) var(--space-8);
}

.about__intro h2 {
  margin-top: var(--space-4);
  font-size: var(--text-title);
}

.about__blurb {
  font-size: var(--text-blurb);
  color: var(--ink-muted);
  text-wrap: balance;
}

.values {
  margin-top: var(--space-8);
}

/* Stacked below 1280px, the same width as the value cards */
@media (max-width: 1279px) {
  .about__intro {
    grid-template-columns: minmax(0, 1fr);  /* the column can never grow wider than the container */
  }

  .about__blurb {
    max-width: 30em;  /* ~70 characters a line once stacked */
  }
}

@media (max-width: 640px) {
  .values {
    margin-top: var(--space-7);
  }
}

/* ---------------------------------------------------------
   Work with us: the one cocoa panel on the page
   --------------------------------------------------------- */
.work {
  padding-bottom: var(--section-y);
}

.work__panel {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  align-items: center;
  gap: var(--space-7) var(--space-8);
  padding: clamp(1.5rem, 6.2vw, 5rem);
  border-radius: var(--radius-panel);
  background: var(--ink);
  color: var(--on-ink);
  box-shadow: var(--shadow-panel);
}

/* Dashed trail echoing the loop under the wordmark */
.work__trail {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: -1;
  width: min(560px, 60%);
  height: auto;
  overflow: visible;  /* the panel itself clips the trail at its rounded edge */
  color: var(--gold);
  opacity: 0.55;
  pointer-events: none;
}

.work .eyebrow {
  color: var(--on-ink-accent);
}

.work :focus-visible {
  outline-color: var(--cream);  /* the default ink outline would vanish on the cocoa panel */
}

.work h2 {
  margin-top: var(--space-4);
  font-size: var(--text-title-sm);
  overflow-wrap: anywhere;  /* very large browser text breaks "something" rather than clipping it at the panel edge */
}

.work__lead {
  max-width: 28em;
  margin-top: var(--space-4);
  font-size: var(--text-lg);
  color: var(--on-ink-muted);
  text-wrap: pretty;
}

.work__contact {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-5);
}

.work__note {
  display: inline-flex;
  align-items: flex-start;
  gap: var(--space-2);
  font-size: var(--text-md);
  color: var(--on-ink-muted);
  overflow-wrap: anywhere;  /* very large browser text wraps instead of running out of the panel */
  text-wrap: balance;       /* on small phones, two even lines rather than one word alone */
}

.work__note svg {
  flex: none;
  width: 1.2em;  /* follows the note's text size */
  height: 1.2em;
  margin-top: calc((var(--leading-body) * 1em - 1.2em) / 2);  /* (line height - icon height) / 2: centres it on the first line */
}

/* Stacked until the heading fits on two lines beside the email pill.
   84.9375em is 1359px at the default text size; in em, enlarged browser text
   stacks the panel sooner, so the email address keeps room for one line. */
@media (max-width: 84.9375em) {
  .work__panel {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Extra room at the bottom gives the trail its own strip, so it never runs through the Discord note */
@media (max-width: 640px) {
  .work__panel {
    padding-bottom: var(--space-8);
    border-radius: var(--radius-card);
  }

  .work__trail {
    width: 72%;
    opacity: 0.45;
  }
}

/* ---------------------------------------------------------
   Site footer
   --------------------------------------------------------- */
.site-footer {
  padding-block: var(--space-8) var(--space-7);
  border-top: 1px solid var(--line);
}

.site-footer__top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
}

.site-footer__bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-2) var(--space-6);
  margin-top: var(--space-7);
  padding-top: var(--space-6);
  border-top: 1px solid var(--line);
  font-size: var(--text-sm);
  line-height: var(--leading-snug);
  color: var(--ink-muted);
}

.site-footer__bottom p {
  text-wrap: pretty;
}

@media (max-width: 640px) {
  .site-footer__top {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ---------------------------------------------------------
   Not found (404.html): reuses the hero's band and type
   --------------------------------------------------------- */
/* The page fills the window and the message centres in the space under the header */
.not-found-page {
  display: flex;
  flex-direction: column;
  min-height: 100svh;
}

.not-found {
  flex: 1;
  display: grid;
  align-content: center;
  padding-bottom: clamp(4rem, 2.5rem + 4vw, 6rem);  /* no About wave here, so no room reserved for it */
}

.not-found__mark {
  width: 64px;  /* also sizes="64px" on this <img> in 404.html */
  margin-bottom: var(--space-5);
}

.not-found__title {
  margin-top: var(--space-4);
  font-size: var(--text-not-found);
}

/* The footer here holds only the small print: one hairline and a slimmer band */
.not-found-page .site-footer {
  padding-block: var(--space-6);
}

.not-found-page .site-footer__bottom {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}
