/* layout.css — the page shell. One content width (--wrap) shared by the
   header, every listing, and the article measure, so the whole site keeps
   the same left and right edges against the canvas. Section spacing is
   deliberately wide: the black between regions is the material. */

main {
  padding-block: calc(var(--space) * 5) calc(var(--space) * 10);
}

/* Every top-level region of a page is a centred column of the same width.
   The article grid opts out of the cap below, because its sidenote column
   needs the extra room. */
main > * {
  width: min(100% - var(--gutter) * 2, var(--wrap));
  margin-inline: auto;
}

main > * + * {
  margin-block-start: calc(var(--space) * 9);
}

/* ---------------------------------------------------------------------- */
/* Masthead — front page only. Display type against the black, with the
   accent glow behind it and nothing competing. */

.masthead {
  padding-block: calc(var(--space) * 6) 0;
}

.masthead__title {
  font-size: clamp(2.25rem, 6vw, 3.75rem);
  letter-spacing: -0.03em;
  line-height: 0.98;
  margin: 0 0 calc(var(--space) * 2);
}

.masthead__tagline {
  max-width: 46ch;
  margin: 0;
  font: clamp(1.0625rem, 2.2vw, 1.375rem)/1.45 var(--font-ui);
  color: var(--text-secondary);
}

.masthead__rule {
  display: block;
  height: 2px;
  margin-top: calc(var(--space) * 4);
  border-radius: 1px;
  background: linear-gradient(
    90deg,
    var(--accent) 0%,
    color-mix(in srgb, var(--accent) 30%, transparent) 35%,
    transparent 75%
  );
}

/* ---------------------------------------------------------------------- */
/* Page head — category, page, article, search, and 404 all share it */

.page-head {
  padding-block: calc(var(--space) * 5) 0;
}

.page-head__eyebrow {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em;
  margin: 0 0 calc(var(--space) * 2);
  font: 0.875rem var(--font-ui);
  letter-spacing: 0.02em;
  color: var(--text-secondary);
}

.page-head__eyebrow a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--motion-hover) var(--ease-standard);
}

.page-head__eyebrow a:hover {
  color: var(--accent);
}

.page-head__title {
  font-size: clamp(1.875rem, 4.5vw, 2.875rem);
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin: 0;
}

.page-head__blurb {
  max-width: 56ch;
  margin: calc(var(--space) * 2) 0 0;
  font: clamp(1rem, 1.8vw, 1.1875rem)/1.5 var(--font-ui);
  color: var(--text-secondary);
}

.page-head__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em;
  margin: calc(var(--space) * 2.5) 0 0;
  font: 0.9375rem var(--font-ui);
  color: var(--text-secondary);
}

/* The article body follows its own header directly, without the full
   between-regions gap, so the title and the first paragraph read as one
   unit. */
.page-head--article {
  padding-bottom: calc(var(--space) * 2);
}

.page-head--article + .article {
  margin-block-start: calc(var(--space) * 4);
}

/* ---------------------------------------------------------------------- */
/* Section head — the rule above a listing */

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: calc(var(--space) * 2);
  margin-bottom: calc(var(--space) * 3);
  padding-bottom: calc(var(--space) * 1.5);
  border-bottom: var(--border) solid var(--panel-border);
}

.section-head__title {
  margin: 0;
  font-size: 0.9375rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.section-head__meta {
  margin: 0;
  font: 0.9375rem var(--font-ui);
  color: var(--text-secondary);
}

/* ---------------------------------------------------------------------- */
/* Article listings */

.article-list,
.search__results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 26rem), 1fr));
  gap: calc(var(--space) * 3);
  align-items: stretch;
}

/* ---------------------------------------------------------------------- */
/* Empty state — the only content on a page with no articles, so it carries
   the atmosphere: glass, glow, and a way onwards rather than a dead end. */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: calc(var(--space) * 7) calc(var(--space) * 4);
}

.empty-state__title {
  font-size: clamp(1.375rem, 3vw, 1.875rem);
  margin: 0 0 calc(var(--space) * 2);
}

.empty-state__body {
  max-width: 54ch;
  margin: 0 0 calc(var(--space) * 4);
  color: var(--text-secondary);
}

.empty-state__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: calc(var(--space) * 1.5);
  margin: calc(var(--space) * 4) 0 0;
}

.empty-state .category-chips + .empty-state__actions {
  margin-top: calc(var(--space) * 4);
}

/* ---------------------------------------------------------------------- */
/* Search page */

.search__form {
  display: flex;
  gap: calc(var(--space) * 1.5);
  margin-bottom: calc(var(--space) * 3);
}

.search__input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.8em 1.1em;
  font: 1.0625rem var(--font-ui);
  color: var(--text-primary);
  background: var(--recess-fill);
  border: var(--border) solid var(--panel-border);
  border-radius: var(--radius-md);
  box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.4);
  transition: border-color var(--motion-hover) var(--ease-standard);
}

.search__input::placeholder {
  color: var(--text-secondary);
}

.search__input:hover,
.search__input:focus {
  border-color: var(--panel-border-bright);
}

.search__count {
  margin: 0 0 calc(var(--space) * 3);
  font: 0.9375rem var(--font-ui);
  color: var(--text-secondary);
}

.search__empty,
.search__noscript {
  margin: 0 0 calc(var(--space) * 3);
  color: var(--text-secondary);
}

mark {
  background: color-mix(in srgb, var(--accent) 30%, transparent);
  color: var(--text-primary);
  border-radius: 3px;
  padding: 0 0.15em;
}

/* ---------------------------------------------------------------------- */
/* Footer — hairline, no fill; the content is what should be visible */

.site-footer {
  width: min(100% - var(--gutter) * 2, var(--wrap));
  margin: 0 auto calc(var(--space) * 6);
  padding-top: calc(var(--space) * 5);
  border-top: var(--border) solid var(--panel-border);
}

.site-footer__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.9fr);
  gap: calc(var(--space) * 6);
}

.site-footer__about .site-footer__group {
  margin-top: calc(var(--space) * 4);
}

.site-footer__title {
  margin: 0 0 0.4em;
  font: bold 1.0625rem var(--font-ui);
}

.site-footer__tagline {
  margin: 0;
  max-width: 34ch;
  font: 0.9375rem/1.55 var(--font-ui);
  color: var(--text-secondary);
}

.site-footer__heading {
  margin: 0 0 calc(var(--space) * 2);
  font-size: 0.875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.site-footer__list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
  gap: 0.7em calc(var(--space) * 3);
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-footer__list--single {
  grid-template-columns: 1fr;
}

.site-footer__list a {
  font: 0.9375rem var(--font-ui);
  color: var(--text-primary);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color var(--motion-hover) var(--ease-standard),
    border-color var(--motion-hover) var(--ease-standard);
}

.site-footer__list a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.site-footer__legal {
  margin: calc(var(--space) * 5) 0 0;
  font: 0.875rem var(--font-ui);
  color: var(--text-secondary);
}

@media (max-width: 900px) {
  .site-footer__inner {
    grid-template-columns: 1fr;
    gap: calc(var(--space) * 4);
  }
}

/* ---------------------------------------------------------------------- */
/* Print — chrome and decoration are dropped in article.css; the layout
   caps come off here so the measure fills the page. */

@media print {
  main > *,
  .site-footer {
    width: auto;
  }

  .site-footer,
  .skip-link {
    display: none;
  }
}
