/* Poster demo (pattern B5, navigation as poster).
   Type: Anton for the four nav words and the year, nothing else. Instrument Sans
   for every other line, because it stays quiet next to Anton at body sizes.
   Color: a cobalt field for the first screen and the footer, ink under the fold,
   paper-colored type on both. The current nav word is a pale cobalt, the same
   hue as the field, so it reads as "you are here" without adding a fourth hue.
   Radius policy: none. Shadow policy: none.
   Motion policy: nothing animates; anchor jumps scroll smoothly only when the
   visitor allows motion. */

:root {
  --cobalt: #2340d8;
  --tint: #a3b4ff;   /* 3.77:1 on cobalt (display sizes only), 9.24:1 on ink */
  --paper: #f1ede4;  /* 6.43:1 on cobalt, 15.77:1 on ink */
  --ink: #141414;
  --dim: #b3ad9f;    /* secondary text on ink, 8.24:1 */
  --pad: clamp(16px, 2.5vw, 40px);
  --vh: 1vh;
  --display: "Anton", Impact, "Arial Narrow", sans-serif;
  --text: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
}

@supports (height: 1svh) {
  :root { --vh: 1svh; }
}

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

html {
  background: var(--ink);
  color: var(--paper);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  font-family: var(--text);
  font-size: 1.125rem;
  line-height: 1.5;
}

::selection { background: var(--cobalt); color: var(--paper); }

:focus-visible {
  outline: 3px solid var(--paper);
  outline-offset: 4px;
}

.vh {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- The first screen ---------- */

.poster {
  min-height: 100vh;
  min-height: calc(100 * var(--vh));
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto 1fr;
  column-gap: calc(var(--pad) * .75);
  padding: var(--pad);
  background: var(--cobalt);
  color: var(--paper);
}

.credit {
  grid-area: 1 / 1;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 .6ch;
  max-width: 34rem;
}

/* The name is set at text size on purpose: the nav words are the display. */
.credit h1,
.credit p {
  margin: 0;
  font-size: 1.125rem;
  line-height: 1.35;
}

.credit h1 { font-weight: 650; }

.poster nav {
  grid-area: 2 / 1;
  align-self: end;
  min-width: 0;
  padding-top: 2rem;
  overflow: clip;
  overflow-clip-margin: 10px;  /* room for the focus ring */
  /* Line length the words are fitted to. The vw value is the fallback for
     browsers without container units. */
  --L: 64vw;
}

.poster ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Each word is sized from its advance width in Anton (measured in em, plus
   1.5 percent slack) so that it runs edge to edge. */
.poster li:nth-child(1) { --w: 2.06; }  /* work  2.030em */
.poster li:nth-child(2) { --w: 2.30; }  /* notes 2.263em */
.poster li:nth-child(3) { --w: 2.32; }  /* about 2.286em */
.poster li:nth-child(4) { --w: 1.76; }  /* mail  1.733em */

.poster li {
  font-family: var(--display);
  font-weight: 400;
  font-size: calc(var(--L) / var(--w));
  /* .95 keeps the tall l and i of "mail" clear of the row above. */
  line-height: .95;
  white-space: nowrap;
}

.poster li a {
  display: block;
  width: max-content;
  color: var(--paper);
  text-decoration: none;
}

.poster li a[aria-current="page"] { color: var(--tint); }

@media (hover: hover) {
  .poster li a:hover {
    text-decoration: underline;
    text-decoration-thickness: .03em;
    text-underline-offset: .01em;
  }
  @supports (-webkit-text-stroke: 1px) {
    .poster li a:hover {
      text-decoration: none;
      color: var(--cobalt);
      -webkit-text-stroke: clamp(2px, .015em, 4px) var(--paper);
    }
    .poster li a[aria-current="page"]:hover { -webkit-text-stroke-color: var(--tint); }
  }
}

.poster li a:focus-visible { outline-width: 4px; outline-offset: 2px; }

@supports (width: 1cqi) {
  .poster nav {
    container-type: inline-size;
    /* Fill the column, unless four stacked rows would run past the fold.
       Four rows at line-height .95 take 1.86 times the line length. */
    --L: min(100cqi, (100 * var(--vh) - 10rem) / 1.86);
  }
}

/* Landscape: two rows of two, one size for all four words. */
@media (min-aspect-ratio: 1/1) {
  .poster ul {
    display: grid;
    grid-template-columns: auto auto;
    justify-content: space-between;
    column-gap: .12em;
    font-family: var(--display);
    font-size: calc(var(--L) / 4.74);  /* about + notes + the .12em gap, plus slack */
  }
  .poster nav { --L: 72vw; }
  @supports (width: 1cqi) {
    .poster nav { --L: min(100cqi, (100 * var(--vh) - 9rem) / 1.9 * 4.74); }
  }
  .poster li { font-size: inherit; }
  .poster li:nth-child(even) { justify-self: end; }
}

/* The year, in outlined numerals stacked down the right margin. */
.year {
  grid-area: 1 / 2 / 3 / 3;
  margin: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-family: var(--display);
  font-size: min((100 * var(--vh) - 2 * var(--pad)) / 3.6, 22vw);
  line-height: .9;
  color: var(--tint);
  user-select: none;
}

.year span[aria-hidden] { display: block; }

@supports (-webkit-text-stroke: 1px) {
  .year {
    color: transparent;
    -webkit-text-stroke: clamp(1px, .14vw, 2px) var(--paper);
  }
}

/* ---------- Under the fold, on ink ---------- */

main {
  padding: clamp(3.5rem, 9vw, 8rem) var(--pad) clamp(4rem, 10vw, 9rem);
  display: grid;
  gap: clamp(4.5rem, 11vw, 10rem);
}

main a { color: var(--tint); text-underline-offset: .15em; }

h2 {
  margin: 0 0 1rem;
  padding-top: .55em;
  border-top: 6px solid var(--cobalt);
  font-size: clamp(1.5rem, 1.15rem + 1.2vw, 2.25rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -.01em;
}

.section-head {
  max-width: 40rem;
  margin-bottom: clamp(2rem, 5vw, 4rem);
}

.section-head p {
  margin: 0;
  color: var(--dim);
  text-wrap: pretty;
}

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

.piece { margin: 0; min-width: 0; }

.piece img {
  display: block;
  width: 100%;
  height: auto;
  background: var(--cobalt);
}

.piece h3 {
  margin: .8rem 0 0;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
}

.piece time {
  margin-left: .45ch;
  color: var(--dim);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.piece p {
  margin: .1rem 0 0;
  max-width: 34em;
  font-size: 1rem;
  line-height: 1.45;
  color: var(--dim);
}

/* Phone: one column, with a few pieces pulled narrower for rhythm. */
@media (max-width: 35.99rem) {
  .p2, .p5 { width: 80%; margin-left: auto; }
  .p3 { width: 72%; }
}

@media (min-width: 36rem) {
  .pieces {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    column-gap: clamp(1rem, 2.5vw, 2.5rem);
    row-gap: clamp(3rem, 6vw, 5.5rem);
    align-items: start;
  }
  .p1 { grid-column: 1 / -1; }
  .p2 { grid-column: 1 / span 3; }
  .p3 { grid-column: 4 / span 3; margin-top: 4rem; }
  .p4 { grid-column: 2 / span 5; }
  .p5 { grid-column: 1 / span 3; }
  .p6 { grid-column: 1 / -1; }
}

@media (min-width: 56rem) {
  .pieces { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .p1 { grid-column: 1 / span 7; }
  .p2 { grid-column: 9 / span 4; align-self: end; }
  .p3 { grid-column: 2 / span 4; margin-top: 0; }
  .p4 { grid-column: 7 / span 6; margin-top: clamp(3rem, 9vw, 9rem); }
  .p5 { grid-column: 1 / span 5; }
  .p6 { grid-column: 6 / span 7; align-self: end; }
}

/* Notes: date and title on one line from tablet up. */
.notes ol {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
  border-bottom: 1px solid var(--cobalt);
}

.notes li {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: .15rem 1.5rem;
  padding: .9rem 0;
  border-top: 1px solid var(--cobalt);
  text-wrap: pretty;
}

.notes time {
  color: var(--dim);
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}

@media (min-width: 40rem) {
  .notes li { grid-template-columns: 8.5rem minmax(0, 1fr); align-items: baseline; }
}

@media (min-width: 56rem) {
  .notes {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: clamp(1rem, 2.5vw, 2.5rem);
  }
  .notes h2 { grid-column: 1 / span 3; align-self: start; }
  .notes ol { grid-column: 4 / span 7; margin-top: 0; }
}

/* About: the one long paragraph, set large. */
.about p {
  margin: 0;
  max-width: 30em;
  font-size: clamp(1.375rem, 1.05rem + 1.3vw, 2.125rem);
  line-height: 1.3;
  letter-spacing: -.01em;
  text-wrap: pretty;
}

/* From desktop up, every section puts its heading in the first three of
   twelve columns and opens its content with a hairline level with the bar. */
@media (min-width: 56rem) {
  .section-head {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: clamp(1rem, 2.5vw, 2.5rem);
    max-width: none;
  }
  .section-head h2 { grid-column: 1 / span 3; margin-bottom: 0; }
  .section-head p,
  .about p {
    border-top: 1px solid var(--cobalt);
    padding-top: .9rem;
  }
  .section-head p { grid-column: 4 / span 6; }
}

@media (min-width: 56rem) {
  .about {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: clamp(1rem, 2.5vw, 2.5rem);
  }
  .about h2 { grid-column: 1 / span 3; align-self: start; }
  .about p { grid-column: 4 / span 9; }
}

/* ---------- Footer, back on the field ---------- */

.mail {
  padding: clamp(3rem, 8vw, 6rem) var(--pad) var(--pad);
  background: var(--cobalt);
  color: var(--paper);
}

.mail h2 { border-top-color: var(--paper); }

.mail a {
  color: inherit;
  text-decoration-thickness: .06em;
  text-underline-offset: .16em;
}

.mail .addr {
  margin: .5rem 0 clamp(3rem, 8vw, 6rem);
  font-size: clamp(1.5rem, 7vw, 5rem);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -.02em;
  overflow-wrap: anywhere;
}

.mail .fine {
  margin: 0;
  font-size: .9375rem;
}
