/*
 * The directions chooser. Deliberately neutral: system fonts, greys with no
 * hue (OKLCH chroma 0, so relative luminance is exactly L cubed), and no
 * colour taken from any direction. Motion is transform and opacity only.
 *
 * Contrast, computed (L is the OKLCH lightness):
 *   light  text .25 on card 1 = 16.0:1, on page .975 = 14.9:1
 *          soft .48 on card = 6.5:1, on page = 6.1:1
 *          line .62 (borders, controls, focus is text) on card = 3.6:1, on page = 3.4:1
 *   dark   text .95 on card .235 = 14.4:1, on page .19 = 16.0:1
 *          soft .77 on card = 8.0:1, on page = 8.9:1
 *          line .56 on card = 3.6:1, on page = 4.0:1
 */

:root {
  color-scheme: light dark;
  --page: light-dark(oklch(.975 0 0), oklch(.19 0 0));
  --card: light-dark(oklch(1 0 0), oklch(.235 0 0));
  --text: light-dark(oklch(.25 0 0), oklch(.95 0 0));
  --soft: light-dark(oklch(.48 0 0), oklch(.77 0 0));
  --line: light-dark(oklch(.62 0 0), oklch(.56 0 0));
  --rule: light-dark(oklch(.9 0 0), oklch(.3 0 0));
  --lift: light-dark(oklch(.25 0 0 / .12), oklch(0 0 0 / .5));
  --ease: cubic-bezier(.2, .7, .2, 1);
  --radius: .875rem;
  font-size: clamp(100%, .9rem + .15vw, 120%);
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

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

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

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.55;
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
}

h1, h2, p, ol, ul { margin: 0; }

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

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

.page {
  width: min(100% - 2.5rem, 76rem);
  margin-inline: auto;
  padding-block: 1.25rem 4rem;
}

/* The bar: the name and the theme toggle. */
.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--rule);
}
.bar__name {
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: .01em;
}

.theme {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  min-height: 2.75rem;
  padding: .5rem 1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: .9375rem;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 160ms var(--ease);
}
.theme svg {
  width: 1.125rem;
  height: 1.125rem;
  flex: none;
  transition: transform 240ms var(--ease);
}
.theme[aria-pressed="true"] svg { transform: rotate(180deg); }
.theme:active { transform: scale(.96); }

/* One quiet arrival: the content settles in once and is done. */
@media (prefers-reduced-motion: no-preference) {
  .main { animation: settle 520ms var(--ease) both; }
}
@keyframes settle {
  from { opacity: 0; transform: translate3d(0, .75rem, 0); }
}

.main {
  display: grid;
  gap: clamp(2.5rem, 2rem + 2vw, 4rem);
  padding-top: clamp(2.5rem, 1.5rem + 4vw, 5rem);
}

.title {
  font-size: clamp(2.25rem, 1.6rem + 2.6vw, 3.75rem);
  line-height: 1.05;
  font-weight: 650;
  letter-spacing: -.02em;
  text-wrap: balance;
}

/* What he is judging: three numbered lines, then how to look. */
.judge {
  display: grid;
  gap: 1.5rem;
  max-width: 46rem;
}
.judge__title {
  font-size: .875rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--soft);
}
.judge__list {
  display: grid;
  gap: 1rem;
  padding: 0;
  list-style: none;
  counter-reset: judge;
}
.judge__list li {
  position: relative;
  padding-left: 1.75rem;
  counter-increment: judge;
  text-wrap: pretty;
}
.judge__list li::before {
  content: counter(judge);
  position: absolute;
  left: 0;
  color: var(--soft);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.judge strong { font-weight: 600; }
.how {
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  color: var(--soft);
  text-wrap: pretty;
}
.how strong {
  color: var(--text);
  font-weight: 600;
}

/* Six equal links: one column, then two, then three. */
.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  padding: 0;
  list-style: none;
}
@media (min-width: 36rem) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
}
@media (min-width: 60rem) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.5rem; }
}

.card {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas:
    "letter name"
    "letter line";
  align-items: center;
  column-gap: 1.25rem;
  row-gap: .25rem;
  min-height: 7.5rem;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  transition: transform 180ms var(--ease);
}
@media (min-width: 36rem) {
  .card {
    grid-template-columns: 1fr;
    grid-template-areas: "letter" "name" "line";
    align-items: start;
    align-content: start;
    min-height: 13rem;
    padding: 1.5rem 1.75rem 1.75rem;
  }
}

/* The hover lift is a shadow layer that only fades in. */
.card::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  box-shadow: 0 .75rem 2rem -.75rem var(--lift), 0 0 0 1px var(--text);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms var(--ease);
}

.card__letter {
  grid-area: letter;
  font-size: 3.25rem;
  line-height: 1;
  font-weight: 300;
  letter-spacing: -.02em;
  color: var(--soft);
  min-width: 2.5rem;
  text-align: center;
}
@media (min-width: 36rem) {
  .card__letter { min-width: 0; text-align: start; font-size: clamp(4rem, 3rem + 2vw, 5.5rem); margin-bottom: auto; padding-bottom: 1.5rem; }
}

.card__link {
  grid-area: name;
  align-self: end;
  color: var(--text);
  font-size: 1.1875rem;
  font-weight: 600;
  text-decoration: none;
}
/* The whole card is the link's target. */
.card__link::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: var(--radius);
}
.card__link:focus-visible { outline: none; }
.card__link:focus-visible::after {
  outline: 3px solid var(--text);
  outline-offset: 3px;
}

.card__line {
  grid-area: line;
  align-self: start;
  color: var(--soft);
  font-size: .9375rem;
  text-wrap: pretty;
}

@media (hover: hover) {
  .card:has(.card__link:hover) { transform: translate3d(0, -3px, 0); }
  .card:has(.card__link:hover)::before { opacity: 1; }
}
.card:has(.card__link:focus-visible)::before { opacity: 1; }
.card:has(.card__link:active) { transform: translate3d(0, 0, 0) scale(.985); transition-duration: 80ms; }

.answer {
  font-size: clamp(1.25rem, 1.1rem + .6vw, 1.625rem);
  font-weight: 600;
  letter-spacing: -.01em;
  text-wrap: balance;
}

/* Reduced motion: every state is reached at once. */
@media (prefers-reduced-motion: reduce) {
  .theme, .theme svg, .card, .card::before { transition: none; }
  .card:has(.card__link:active) { transition: none; }
}
