/*
  averagejoechess.com: site styles. Load order:
    /assets/site-fonts/site-fonts.css   this site's own faces (Poppins, Zilla Slab)
    /assets/base.css                    shared reset + focus layer (a copy from shared/)
    /assets/site.css                    this file: every token this site uses

  Joe's own dark square. The page lives inside the logo: its exact charcoal,
  its two whites and its two type voices (the heavy geometric sans that says
  CHESS, the sturdy slab that says AVERAGE JOE). No hue anywhere, no radius,
  no shadows. The one loud thing is the index: one giant word per place, with
  Substack the one square already lit.

  The CSP blocks <style> elements and style="" attributes, so every rule for
  this site lives here.
*/

/* ---------- Tokens ---------- */
:root {
  /* Palette: sampled from the owner's logo */
  --coal: #181D1F;      /* page: the logo's most common pixel, so the keyed logo sits flush */
  --pit: #101416;       /* footer: one step darker than the logo's own corners */
  --graphite: #3A4245;  /* 1px seams between index rows; decoration only, never text */
  --ash: #9BA4A8;       /* secondary text: 6.7:1 on coal, 7.3:1 on pit */
  --chalk: #F6F6F6;     /* the logo's type white: all primary text and the lit square */
  /* The logo's king is #FFFFFF. CSS never uses it, so the king stays the brightest thing. */

  /* Role tokens that base.css reads */
  --color-bg: var(--coal);
  --color-text: var(--chalk);
  --color-muted: var(--ash);
  --color-accent: var(--chalk);
  --color-rule: var(--graphite);
  --color-focus: var(--chalk);
  --color-on-accent: var(--coal);

  /* Families: no mono, no condensed face, no grotesk, no old-style serif here */
  --font-display: 'Poppins', 'Arial Black', 'Helvetica Neue', Arial, sans-serif;
  --font-body: 'Zilla Slab', Rockwell, 'Roboto Slab', Georgia, serif;
  --font-mono: var(--font-body);

  --text-xs: 0.9375rem;
  --text-sm: 1rem;
  --text-base: 1.1875rem;
  --text-lg: 1.3125rem;

  --leading-body: 1.55;
  --tracking-display: -0.02em;
  --tracking-label: 0.02em;

  /* The grid every band shares: rank | name (| note from 64em) */
  --frame-max: 84rem;
  --rank: 1.5rem;
  --col-gap: 0.5rem;
  --row-pad: 0.5rem;    /* the lit square bleeds this far into the gutter */
  --cols: var(--rank) minmax(0, 1fr);
}

@media (min-width: 40em) {
  :root {
    --rank: 2.5rem;
    --col-gap: 1rem;
    --row-pad: 1rem;
  }
}

@media (min-width: 64em) {
  :root {
    --rank: 3rem;
    --col-gap: 1.5rem;
    --cols: var(--rank) minmax(0, 1fr) minmax(16rem, 22rem);
  }
}

html {
  color-scheme: dark;
}

body {
  display: flex;
  flex-direction: column;
  background-color: var(--coal);
  color: var(--chalk);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-body);
}

main {
  flex: 1 0 auto;
}

::selection {
  background: var(--chalk);
  color: var(--coal);
}

a:hover {
  color: inherit;
  text-decoration-thickness: 3px;
}

/* Skip link: a chalk chip (base.css paints it in the shared palette) */
.skip-link {
  background: var(--chalk);
  color: var(--coal);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: var(--text-sm);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}

.skip-link:focus,
.skip-link:focus-visible {
  outline: var(--focus-ring) solid var(--chalk);
  outline-offset: 3px;
}

/* One frame for every band, so the columns line up down the page */
.frame {
  width: 100%;
  max-width: var(--frame-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* Slab caps at normal tracking, like the logo's own AVERAGE JOE line */
.label {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: var(--text-xs);
  line-height: 1.2;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--ash);
  font-variant-numeric: lining-nums;
}

/* ---------- Hero: the logo on its own square ---------- */
.hero {
  padding-block: 1.5rem 1.75rem;
}

.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  row-gap: 1rem;
}

.hero__logo {
  margin: 0;
  font-size: 1rem;
  line-height: 0;
}

.hero__logo img {
  width: min(64vw, 16rem);
  height: auto;
}

.hero__tagline {
  max-width: 22ch;
  font-style: italic;
  font-size: 1.4rem;
  line-height: 1.25;
  text-wrap: balance;
}

@media (min-width: 40em) {
  .hero {
    padding-block: 3rem 3rem;
  }

  .hero__grid {
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: 2.5rem;
    align-items: end;
  }

  .hero__logo img {
    width: 18rem;
  }

  .hero__tagline {
    font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.25rem);
    text-box: trim-end cap alphabetic;
  }
}

@media (min-width: 64em) {
  .hero {
    padding-block: 4rem 3.5rem;
  }

  .hero__grid {
    grid-template-columns: var(--cols);
    column-gap: var(--col-gap);
  }

  /* Across the rank and name columns, flush left */
  .hero__logo {
    grid-column: 1 / 3;
  }

  .hero__logo img {
    width: 22rem;
  }

  /* In the note column, its last baseline on CHESS's */
  .hero__tagline {
    grid-column: 3;
    max-width: none;
    padding-bottom: 0.2rem;
  }
}

/* ---------- The index: where to find Joe ---------- */
.index__label {
  margin-left: calc(var(--rank) + var(--col-gap));
  margin-bottom: 0.75rem;
}

/* .frame.places outranks base.css's ol[role='list'] { padding: 0 } */
.frame.places {
  margin-block: 0;
  padding-inline: var(--gutter);
  counter-reset: rank 9;
}

.place {
  position: relative;
  display: grid;
  grid-template-columns: var(--cols);
  column-gap: var(--col-gap);
  align-items: start;
  margin-inline: calc(-1 * var(--row-pad));
  padding: 1.25rem var(--row-pad) 1.5rem;
  border-top: 1px solid var(--graphite);
  counter-increment: rank -1;
}

.place:last-child {
  border-bottom: 1px solid var(--graphite);
}

/* Rank numerals count down from 8, like the edge of a board seen from White's
   side. Screen readers skip them; deleting a gated row renumbers the rest. */
.place::before {
  content: counter(rank);
  content: counter(rank) / "";
  grid-column: 1;
  grid-row: 1;
  font-weight: 700;
  font-size: var(--text-xs);
  line-height: 1;
  color: var(--ash);
  font-variant-numeric: lining-nums;
}

.place__name {
  grid-column: 2;
  grid-row: 1;
  margin: 0;
  container-type: inline-size;
  font: inherit;
  letter-spacing: normal;
}

.place__name a {
  display: block;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.25rem, 9vw, 6rem);
  font-size: min(13cqi, 6.5rem);
  line-height: 0.9;
  letter-spacing: var(--tracking-display);
  text-transform: uppercase;
  text-wrap: balance;
  text-decoration: none;
  text-box: trim-both cap alphabetic;
}

/* The whole row is the link's hit area; the credit stays outside the link text */
.place__name a::after {
  content: "";
  position: absolute;
  inset: 0;
}

.place__note {
  grid-column: 2;
  max-width: 36rem;
  margin-top: 1.25rem;
}

@media (min-width: 64em) {
  .place {
    padding-block: 1.75rem 2rem;
  }

  .place__note {
    grid-column: 3;
    grid-row: 1;
    margin-top: 0;
  }
}

.place__note > * {
  max-width: none;
}

.place__status {
  font-weight: 700;
  font-size: var(--text-xs);
  line-height: 1.2;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  text-box: trim-start cap alphabetic;
}

.place__status + * {
  margin-top: 0.5rem;
}

.place__tagline {
  font-style: italic;
}

.place__tagline + .place__text {
  margin-top: 0.125rem;
}

.place__credit {
  margin-top: 0.75rem;
  font-size: var(--text-sm);
  line-height: 1.45;
  color: var(--ash);
}

.place__handle {
  margin-top: 0.75rem;
  font-size: var(--text-sm);
  line-height: 1.4;
  color: var(--ash);
  overflow-wrap: anywhere;
}

.place__note > .place__handle:first-child {
  margin-top: 0;
  text-box: trim-start cap alphabetic;
}

/* The lit square: Substack at rest, any other row when pointed at or focused.
   An instant flip, no easing, like a square highlighting on a board. */
.place--lit,
.place:hover,
.place:focus-within {
  background-color: var(--chalk);
  color: var(--coal);
  border-top-color: var(--chalk);
}

.place--lit::before,
.place:hover::before,
.place:focus-within::before,
.place--lit .place__credit,
.place:hover .place__credit,
.place:focus-within .place__credit,
.place--lit .place__handle,
.place:hover .place__handle,
.place:focus-within .place__handle {
  color: var(--coal);
}

.place:focus-within {
  z-index: 1;
}

.place__name a:focus-visible {
  outline: none;
}

/* Chalk ring 4px outside the row. The coal band fills that 4px gap, so the
   ring's edge still reads where it crosses the lit Substack square. */
.place__name a:focus-visible::after {
  outline: var(--focus-ring) solid var(--chalk);
  outline-offset: 4px;
  box-shadow: 0 0 0 4px var(--coal);
}

/* ---------- About ---------- */
.about {
  padding-top: 3.5rem;
}

.about__grid > * {
  margin-left: calc(var(--rank) + var(--col-gap));
}

.about__text {
  margin-top: 0.75rem;
  max-width: 36ch;
  font-style: italic;
  font-size: var(--text-lg);
  line-height: 1.45;
}

@media (min-width: 64em) {
  .about {
    padding-top: 5rem;
  }

  .about__text {
    font-size: 1.5rem;
  }
}

/* ---------- Footer ---------- */
.colophon {
  margin-top: 4rem;
  background-color: var(--pit);
  padding-block: 1.75rem 2.25rem;
}

.colophon__grid > * {
  margin-left: calc(var(--rank) + var(--col-gap));
}

.disclosure {
  font-size: var(--text-sm);
  color: var(--ash);
}

.disclosure a {
  color: var(--chalk);
  text-decoration-thickness: 1px;
}

.disclosure a:hover {
  text-decoration-thickness: 2px;
}

@media (min-width: 64em) {
  .colophon {
    margin-top: 6rem;
  }
}

/* ---------- 404 page ---------- */
.lost-head {
  padding-block: 1.25rem 0;
}

.home-mark {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding-block: 0.25rem;
  font-weight: 700;
  font-size: var(--text-xs);
  line-height: 1.2;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  text-decoration: none;
}

.home-mark img {
  width: auto;
  height: 3rem;
}

.home-mark:hover span {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}

.lost {
  padding-top: 3rem;
}

.lost__body > * {
  margin-left: calc(var(--rank) + var(--col-gap));
}

.lost__code {
  color: var(--ash);
}

.lost__title {
  margin-top: 1rem;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.5rem, 1.2rem + 6.5vw, 6.5rem);
  line-height: 0.9;
  letter-spacing: var(--tracking-display);
  text-transform: uppercase;
  text-wrap: balance;
}

.lost__text {
  margin-top: 1.25rem;
  font-style: italic;
  font-size: var(--text-lg);
}

.lost__rows {
  margin-top: 2.5rem;
}

/* The 404's one row: the index's lit square, one size down */
.place.place--solo {
  grid-template-columns: var(--rank) minmax(0, 1fr);
  border-bottom: 0;
}

.place--solo::before {
  content: none;
}

.place--solo .place__name a {
  font-size: clamp(1.5rem, 6vw, 3.5rem);
  font-size: min(8cqi, 3.5rem);
}

@media (min-width: 64em) {
  .lost {
    padding-top: 5rem;
  }
}
