/*
 * Slink: styles.
 *
 * An editorial puzzle page: warm ivory paper, charcoal type, one muted
 * cobalt accent and warm-grey rules. Young Serif carries the questions and
 * headings; Schibsted Grotesk does everything else.
 */

/* ------------------------------------------------------------------ */
/* Fonts (self-hosted, SIL Open Font Licence)                          */
/* ------------------------------------------------------------------ */

@font-face {
  font-family: 'Young Serif';
  src: url('fonts/young-serif-latin-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Schibsted Grotesk';
  src: url('fonts/schibsted-grotesk-latin-wght-normal.woff2') format('woff2');
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Schibsted Grotesk';
  src: url('fonts/schibsted-grotesk-latin-ext-wght-normal.woff2') format('woff2');
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ------------------------------------------------------------------ */
/* Tokens                                                              */
/* ------------------------------------------------------------------ */

:root {
  --paper: #F6F3EC;          /* warm ivory */
  --paper-raised: #FBFAF6;   /* input focus wash */
  --panel: #EDE8DD;          /* the guess panel */
  --ink: #22211F;            /* charcoal */
  --ink-muted: #5F5B54;      /* secondary text */
  --rule: #DCD5C9;           /* warm-grey dividers */
  --rule-strong: #A59E92;    /* input underlines */
  --accent: #33508C;         /* muted cobalt */
  --accent-soft: #C9D1E3;    /* current progress segment track */
  --accepted: #2E6648;
  --missed: #9B3A2A;
  --accepted-tint: #E3ECE4;  /* behind "Link found" */
  --missed-tint: #F1E2DC;    /* behind "Link missed" */
  --on-signal: #FFFFFF;      /* ticks and crosses on green/red */
  --placeholder: #9A9388;
  --input-wash: rgba(255, 255, 255, 0.45);
  --hairline: rgba(34, 33, 31, 0.15);
  --backdrop: rgba(34, 33, 31, 0.5);
  --dialog-shadow: 0 24px 60px rgba(34, 33, 31, 0.28);

  --font-display: 'Young Serif', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
  --font-text: 'Schibsted Grotesk', 'Helvetica Neue', Arial, system-ui, sans-serif;

  --measure: 45rem;          /* 720px column */
  --side: 1.5rem;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* ------------------------------------------------------------------ */
/* Base                                                                */
/* ------------------------------------------------------------------ */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: 1.0625rem;
  line-height: 1.55;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, p, dl, dd, ol, pre {
  margin: 0;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

[tabindex="-1"]:focus {
  outline: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 10;
  padding: 0.6rem 1rem;
  background: var(--ink);
  color: var(--paper);
  border-radius: 3px;
  text-decoration: none;
  font-weight: 600;
}

.skip-link:focus {
  top: 1rem;
}

/* ------------------------------------------------------------------ */
/* Masthead                                                            */
/* ------------------------------------------------------------------ */

.masthead {
  border-bottom: 1px solid var(--rule);
}

.masthead__inner {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 1.4rem var(--side) 1.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
  flex-wrap: wrap;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  color: var(--ink);
}

.wordmark__mark {
  width: 0.8rem;
  height: 1.75rem;
  flex: none;
  overflow: visible;
}

.wordmark__mark line {
  stroke: var(--ink);
  stroke-width: 1.5;
}

.wordmark__node { fill: var(--ink); }
.wordmark__node--end { fill: var(--accent); }

.wordmark__text {
  font-family: var(--font-display);
  font-size: clamp(1.45rem, 4.2vw, 1.8rem);
  line-height: 1;
  letter-spacing: -0.01em;
}

.site-nav {
  display: flex;
  gap: 1.75rem;
}

.site-nav__link {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  color: var(--ink-muted);
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.site-nav__link:hover {
  color: var(--ink);
}

.site-nav__link[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

/* ------------------------------------------------------------------ */
/* Page frame                                                          */
/* ------------------------------------------------------------------ */

.page {
  flex: 1;
  width: 100%;
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 var(--side) 3.5rem;
}

.page:focus {
  outline: none;
}

.page-head {
  padding: 2.75rem 0 2rem;
}

.kicker {
  font-size: 0.875rem;
  color: var(--ink-muted);
  margin-bottom: 0.4rem;
}

.page-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.9rem, 5.2vw, 2.5rem);
  line-height: 1.1;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

/* On the question screens the question is the focus, not the page title. */
.page-title--quiet {
  font-size: 1.375rem;
  line-height: 1.25;
}

/* "The connection" sits above the category as a label. */
.page-title--label {
  font-family: var(--font-text);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--accent);
}

.section-label {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--ink-muted);
  margin: 2.75rem 0 0.25rem;
}

.lede {
  font-size: 1.125rem;
  color: var(--ink-muted);
  margin: -1.1rem 0 1.75rem;
}

.text-link {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

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

.message {
  max-width: 34rem;
  font-size: 1.125rem;
}

.message p + p {
  margin-top: 0.75rem;
}

.message__detail {
  font-size: 0.875rem;
  color: var(--ink-muted);
}

.code {
  margin: 0.75rem 0;
  padding: 0.75rem 1rem;
  background: var(--panel);
  border-radius: 3px;
  font-size: 0.9375rem;
  overflow-x: auto;
}

.notice {
  margin: 0 0 1.75rem;
  padding: 0.85rem 1.1rem;
  border-left: 3px solid var(--accent);
  background: var(--paper-raised);
}

.loading {
  padding: 3rem 0;
  color: var(--ink-muted);
}

/* ------------------------------------------------------------------ */
/* Inputs and buttons                                                  */
/* ------------------------------------------------------------------ */

.answer-input {
  display: block;
  width: 100%;
  min-height: 3rem;
  padding: 0.55rem 0.2rem;
  font: inherit;
  font-size: 1.25rem;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1.5px solid var(--rule-strong);
  border-radius: 0;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.answer-input::placeholder {
  color: var(--placeholder);
  opacity: 1;
}

.answer-input:hover {
  border-bottom-color: var(--ink);
}

.answer-input:focus,
.answer-input:focus-visible {
  outline: none;
  border-bottom-color: var(--accent);
  box-shadow: 0 1.5px 0 var(--accent);
  background: var(--paper-raised);
}

.answer-input[aria-invalid="true"] {
  border-bottom-color: var(--missed);
  box-shadow: 0 1.5px 0 var(--missed);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.75rem;
}

.button {
  min-height: 3rem;
  padding: 0.75rem 1.5rem;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  color: var(--paper);
  background: var(--ink);
  border: 0;
  border-radius: 3px;
  cursor: pointer;
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.button:hover {
  background: var(--accent);
}

.button:active {
  transform: translateY(1px);
}

.button.button--quiet {
  color: var(--ink);
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--rule-strong);
}

.button.button--quiet:hover {
  background: var(--paper-raised);
  box-shadow: inset 0 0 0 1px var(--ink);
}

.form-error {
  margin-top: 0.9rem;
  color: var(--missed);
  font-size: 0.9375rem;
  font-weight: 500;
}

.form-error:empty {
  display: none;
}

/* ------------------------------------------------------------------ */
/* Stage 1: one question at a time                                     */
/* ------------------------------------------------------------------ */

.progress {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
  max-width: 20rem;
  margin-bottom: 2.25rem;
}

.progress__segment {
  height: 3px;
  border-radius: 2px;
  background: var(--rule);
  transition: background-color 0.2s ease;
}

.progress__segment.is-done {
  background: var(--ink);
}

.progress__segment.is-current {
  background: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.question-count {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
  margin-bottom: 0.75rem;
}

.question-text {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(1.55rem, 4.2vw, 2.15rem);
  line-height: 1.28;
  max-width: 38rem;
  min-height: 2.56em; /* two lines, so the field doesn't jump between questions */
  text-wrap: pretty;
}

.question-body .answer-input {
  max-width: 34rem;
  margin-top: 1.75rem;
}

@keyframes step-in-forward {
  from { opacity: 0; transform: translateX(14px); }
  to { opacity: 1; transform: none; }
}

@keyframes step-in-back {
  from { opacity: 0; transform: translateX(-14px); }
  to { opacity: 1; transform: none; }
}

.is-entering--forward { animation: step-in-forward 0.22s var(--ease) both; }
.is-entering--back { animation: step-in-back 0.22s var(--ease) both; }

/* ------------------------------------------------------------------ */
/* Rows: the Guess the link summary and the reveal                     */
/* ------------------------------------------------------------------ */

.rows {
  list-style: none;
  padding: 0;
  border-bottom: 1px solid var(--rule);
}

.review-row,
.reveal-row {
  display: grid;
  grid-template-columns: 2.75rem minmax(0, 1fr) auto;
  column-gap: 0.75rem;
  align-items: start;
  padding: 1rem 0;
  border-top: 1px solid var(--rule);
}

.reveal-row {
  grid-template-columns: 2.75rem minmax(0, 1fr);
  padding: 1.4rem 0;
}

.row-number {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
  line-height: 1.6rem;
}

.row-question {
  font-family: var(--font-display);
  font-size: 1.125rem;
  line-height: 1.42;
  max-width: 34rem;
}

.row-answer {
  margin-top: 0.4rem;
  overflow-wrap: anywhere;
}

.row-answer__label {
  color: var(--ink-muted);
  font-size: 0.875rem;
  margin-right: 0.35rem;
}

.row-answer__value {
  font-weight: 600;
}

.edit-button {
  min-height: 2.75rem;
  min-width: 2.75rem;
  padding: 0 0.25rem;
  margin-top: -0.55rem;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--accent);
  background: none;
  border: 0;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  cursor: pointer;
}

.edit-button:hover {
  text-decoration-thickness: 2px;
}

/* The guess sits apart from the summary: the second half of the puzzle. */
.guess-panel {
  margin-top: 2.25rem;
  padding: 1.75rem 1.75rem 1.6rem;
  background: var(--panel);
  border-top: 2px solid var(--ink);
  border-radius: 0 0 3px 3px;
}

.guess-panel__label {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 4vw, 1.9rem);
  line-height: 1.2;
}

.guess-panel .answer-input {
  margin-top: 1.1rem;
  border-bottom-color: var(--ink-muted);
}

.guess-panel .answer-input:focus {
  background: var(--input-wash);
}

/* ------------------------------------------------------------------ */
/* Stage 3: the reveal                                                 */
/* ------------------------------------------------------------------ */

.reveal .page-head {
  padding-bottom: 0.5rem;
}

.connection-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 6vw, 3rem);
  line-height: 1.08;
  letter-spacing: -0.015em;
  max-width: 38rem;
  text-wrap: balance;
}

/* The result: score, link, marks and sharing. */
.results {
  margin-top: 1.75rem;
  padding: 1.5rem 0 1.25rem;
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--rule);
}

.results__summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1.75rem;
}

.results__score {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0 0.15rem;
}

.results__number {
  font-family: var(--font-display);
  font-size: clamp(3rem, 9vw, 4rem);
  line-height: 0.9;
}

.results__of {
  font-family: var(--font-display);
  font-size: 1.75rem;
  color: var(--ink-muted);
}

.results__caption {
  margin-left: 0.6rem;
  font-size: 0.9375rem;
  color: var(--ink-muted);
}

.results__link {
  font-weight: 600;
  font-size: 1rem;
  padding: 0.3rem 0.7rem;
  border-radius: 3px;
}

.results__link.is-found {
  color: var(--accepted);
  background: var(--accepted-tint);
}

.results__link.is-missed {
  color: var(--missed);
  background: var(--missed-tint);
}

.results__marks {
  display: flex;
  gap: 6px;
  margin-top: 1.1rem;
}

.mark {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 2px;
}

.mark--yes { background: var(--accepted); }
.mark--no { background: var(--missed); }

/* The sixth mark is the link: a ring rather than a square. */
.mark--link {
  margin-left: 0.6rem;
  border-radius: 50%;
}

.countdown {
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.result {
  margin-top: 0.7rem;
  display: grid;
  gap: 0.3rem;
}

.result__line {
  display: grid;
  grid-template-columns: 5.25rem minmax(0, 1fr);
  column-gap: 0.75rem;
  align-items: baseline;
}

.result dt {
  color: var(--ink-muted);
  font-size: 0.875rem;
}

.result dd {
  overflow-wrap: anywhere;
}

.result__answer {
  font-weight: 600;
}

.result--guess {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
}

.result--guess .result__line {
  grid-template-columns: 6rem minmax(0, 1fr);
}

.verdict {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-left: 0.35rem;
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
}

.verdict--yes { color: var(--accepted); }
.verdict--no { color: var(--missed); }

.verdict__icon {
  width: 0.85rem;
  height: 0.85rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.result__note {
  margin-top: 0.55rem;
  font-size: 0.9375rem;
  color: var(--ink-muted);
  max-width: 34rem;
}

.why__text {
  margin-top: 0.5rem;
  font-family: var(--font-display);
  font-size: 1.25rem;
  line-height: 1.45;
  max-width: 36rem;
}

.closing {
  margin-top: 2.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
}

.sign-off {
  font-family: var(--font-display);
  font-size: 1.375rem;
}

.sign-off-note {
  margin-top: 0.4rem;
}

.sign-off-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.75rem;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.is-revealing .connection-title { animation: rise 0.45s var(--ease) both; }
.is-revealing .result--guess { animation: rise 0.45s var(--ease) 0.12s both; }
.is-revealing .rows--reveal,
.is-revealing .why { animation: rise 0.45s var(--ease) 0.22s both; }

/* ------------------------------------------------------------------ */
/* Archive                                                             */
/* ------------------------------------------------------------------ */

.archive-list {
  list-style: none;
  padding: 0;
  border-top: 1px solid var(--rule);
}

.archive-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  min-height: 3.5rem;
  padding: 0.95rem 0.5rem 0.95rem 0;
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
  transition: background-color 0.15s ease, padding 0.2s var(--ease);
}

.archive-row:hover {
  background: var(--paper-raised);
  padding-left: 0.75rem;
}

.archive-row__name {
  font-family: var(--font-display);
  font-size: 1.3125rem;
  line-height: 1.2;
  transition: color 0.15s ease;
}

.archive-row:hover .archive-row__name {
  color: var(--accent);
}

.archive-row__status {
  font-size: 0.875rem;
  color: var(--ink-muted);
  white-space: nowrap;
}

.archive-row.is-progress .archive-row__status { color: var(--accent); }
.archive-row.is-complete .archive-row__status { color: var(--accepted); }

/* ------------------------------------------------------------------ */
/* Footer                                                              */
/* ------------------------------------------------------------------ */

.site-footer {
  width: 100%;
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 var(--side) 2.5rem;
  font-size: 0.875rem;
  color: var(--ink-muted);
}

.site-footer p {
  border-top: 1px solid var(--rule);
  padding-top: 1.25rem;
}

/* ------------------------------------------------------------------ */
/* Small screens                                                       */
/* ------------------------------------------------------------------ */

@media (max-width: 560px) {
  :root {
    --side: 1.15rem;
  }

  body {
    font-size: 1rem;
  }

  .page-head {
    padding: 2rem 0 1.5rem;
  }

  .question-text {
    font-size: 1.5rem;
    min-height: 0;
  }

  .actions .button {
    flex: 1 1 8rem;
  }

  .review-row {
    grid-template-columns: 2.1rem minmax(0, 1fr);
  }

  .reveal-row {
    grid-template-columns: 2.1rem minmax(0, 1fr);
  }

  .edit-button {
    grid-column: 2;
    justify-self: start;
    margin: 0.2rem 0 -0.6rem -0.25rem;
  }

  .guess-panel {
    margin-left: calc(var(--side) * -1);
    margin-right: calc(var(--side) * -1);
    padding: 1.5rem var(--side);
    border-radius: 0;
  }

  .result__line,
  .result--guess .result__line {
    grid-template-columns: 4.75rem minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  .masthead, .site-footer, .actions, .edit-button { display: none; }
  body { background: #fff; }
}

/* The guess line sits directly under the results panel. */
.results + .result--guess {
  margin-top: 1rem;
  padding-top: 0;
  border-top: 0;
}

.is-revealing .results { animation: rise 0.45s var(--ease) 0.08s both; }

@media (max-width: 560px) {
  .share-block__actions .button { flex: 1 1 100%; }
  .mark { width: 1.35rem; height: 1.35rem; }
}

/* ------------------------------------------------------------------ */
/* Sharing                                                             */
/* ------------------------------------------------------------------ */

.share-block__actions {
  margin-top: 1.25rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-decoration: none;
}

.button__icon {
  width: 1.15rem;
  height: 1.15rem;
  flex: none;
}

/* WhatsApp's own green, darkened for white text to pass contrast. */
.button.button--whatsapp {
  background: #1C7A4A;
  color: #fff;
}

.button.button--whatsapp:hover {
  background: #155E39;
}

.share-block__status {
  margin-top: 0.6rem;
  font-size: 0.9375rem;
  color: var(--accepted);
  min-height: 1.4em;
}

.share-block__fallback {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.875rem;
  color: var(--ink-muted);
}

.share-block__fallback[hidden] {
  display: none;
}

.share-block__fallback textarea {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.6rem;
  font: inherit;
  font-size: 0.9375rem;
  color: var(--ink);
  background: var(--paper-raised);
  border: 1px solid var(--rule-strong);
  border-radius: 3px;
  resize: vertical;
}

.results__more {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem 1.5rem;
  font-size: 0.9375rem;
  color: var(--ink-muted);
}

.link-button {
  min-height: 2.75rem;
  padding: 0;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--accent);
  background: none;
  border: 0;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  cursor: pointer;
}

.link-button:hover {
  text-decoration-thickness: 2px;
}

/* ------------------------------------------------------------------ */
/* The summary pop-up                                                  */
/* ------------------------------------------------------------------ */

.summary {
  width: min(27rem, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  padding: 1.75rem 1.6rem 1rem;
  color: var(--ink);
  background: var(--paper);
  border: 0;
  border-top: 4px solid var(--ink);
  border-radius: 6px;
  box-shadow: var(--dialog-shadow);
  overflow-y: auto;
}

.summary::backdrop {
  background: var(--backdrop);
}

.summary[open] {
  animation: summary-in 0.32s var(--ease) both;
}

@keyframes summary-in {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.summary__close-form {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
}

.summary__close {
  width: 2.75rem;
  height: 2.75rem;
  display: grid;
  place-items: center;
  color: var(--ink-muted);
  background: none;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}

.summary__close:hover {
  color: var(--ink);
  background: var(--panel);
}

.summary__close .summary-icon {
  width: 1.1rem;
  height: 1.1rem;
}

.summary__kicker {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink-muted);
}

.summary__title {
  margin-top: 0.2rem;
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1;
}

.summary__score {
  font-size: 4.25rem;
}

.summary__of {
  font-size: 1.75rem;
  color: var(--ink-muted);
}

.summary__verdict {
  margin-top: 0.35rem;
  font-family: var(--font-display);
  font-size: 1.25rem;
}

.summary .results__marks {
  margin-top: 0.9rem;
}

.summary__list {
  list-style: none;
  padding: 0;
  margin-top: 1.1rem;
  border-top: 1px solid var(--rule);
}

.summary-row {
  display: grid;
  grid-template-columns: 1.5rem 2rem minmax(0, 1fr);
  align-items: baseline;
  gap: 0.4rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--rule);
}

.summary-row__icon {
  align-self: center;
  display: grid;
  place-items: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  color: var(--on-signal);
}

.is-yes > .summary-row__icon { background: var(--accepted); }
.is-no > .summary-row__icon { background: var(--missed); }

.summary-icon {
  width: 0.8rem;
  height: 0.8rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.summary-row__q {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink-muted);
}

.summary-row__answer {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.is-no .summary-row__typed {
  color: var(--ink-muted);
  font-weight: 500;
  text-decoration: line-through;
  text-decoration-color: var(--missed);
}

.summary-row__correct {
  display: block;
  color: var(--ink);
  font-weight: 600;
}

.summary-row__correct::before {
  content: "Answer: ";
  font-weight: 400;
  color: var(--ink-muted);
}

.summary__link {
  display: grid;
  grid-template-columns: 1.5rem minmax(0, 1fr);
  gap: 0.4rem;
  align-items: start;
  margin-top: 1rem;
  padding: 0.85rem 0.9rem;
  background: var(--panel);
  border-radius: 4px;
}

.summary__link .summary-row__icon {
  margin-top: 0.1rem;
}

.summary__link-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink-muted);
}

.summary__link-title {
  display: block;
  font-family: var(--font-display);
  font-size: 1.125rem;
  line-height: 1.3;
}

.summary .share-block__actions {
  margin-top: 1.1rem;
}

.summary .share-block__actions .button {
  flex: 1 1 100%;
}

.summary__next {
  font-size: 0.9375rem;
  color: var(--ink-muted);
  text-align: center;
}

.summary__details {
  display: block;
  margin: 0.25rem auto 0;
}

@media (max-width: 560px) {
  .summary {
    padding: 1.5rem 1.15rem 0.75rem;
  }
  .summary__score {
    font-size: 3.5rem;
  }
}

/* ------------------------------------------------------------------ */
/* "Did you mean ...?"                                                 */
/* ------------------------------------------------------------------ */

.suggestion {
  margin-top: 1.25rem;
  padding: 1rem 1.1rem 1.1rem;
  max-width: 34rem;
  background: var(--panel);
  border-left: 3px solid var(--accent);
  border-radius: 0 3px 3px 0;
  animation: rise 0.2s var(--ease) both;
}

.suggestion[hidden] {
  display: none;
}

.suggestion__text {
  font-size: 1.0625rem;
}

.suggestion__text strong {
  font-weight: 700;
}

.suggestion__actions {
  margin-top: 0.75rem;
}

@media (max-width: 560px) {
  .suggestion__actions .button { flex: 1 1 100%; }
}

/* ------------------------------------------------------------------ */
/* Nav: Stats and How to play                                          */
/* ------------------------------------------------------------------ */

.site-nav {
  align-items: center;
}

.site-nav__help {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  margin-right: -0.6rem;
  color: var(--ink-muted);
  background: none;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.site-nav__help:hover {
  color: var(--ink);
  background: var(--panel);
}

.site-nav__help svg {
  width: 1.3rem;
  height: 1.3rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
}

.site-nav__help .dot {
  fill: currentColor;
  stroke: none;
}

@media (max-width: 560px) {
  .site-nav { gap: 1.1rem; }
  .site-nav__link { font-size: 0.875rem; }
  .site-nav__help { margin-left: -0.4rem; }
}

@media (max-width: 400px) {
  .wordmark { gap: 0.45rem; }
  .wordmark__text { font-size: 1.25rem; }
  .site-nav { gap: 0.85rem; }
}

/* ------------------------------------------------------------------ */
/* Two guesses                                                         */
/* ------------------------------------------------------------------ */

.locked-note {
  margin-top: 0.9rem;
  font-size: 0.875rem;
  color: var(--ink-muted);
}

.guess-panel__count {
  align-self: center;
  font-size: 0.875rem;
  color: var(--ink-muted);
}

.first-guess {
  margin-bottom: 1.5rem;
  padding: 0 0 1.25rem;
  border-bottom: 1px solid var(--hairline);
}

.first-guess__line {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.6rem;
  align-items: baseline;
}

.first-guess__label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink-muted);
}

.first-guess__text {
  font-weight: 600;
  text-decoration: line-through;
  text-decoration-color: var(--ink-muted);
  overflow-wrap: anywhere;
}

.first-guess__verdict {
  margin-top: 0.4rem;
  font-family: var(--font-display);
  font-size: 1.25rem;
  line-height: 1.3;
}

.first-guess__verdict strong {
  font-weight: 400;
}

.first-guess.is-close .first-guess__verdict strong { color: var(--accent); }
.first-guess.is-off .first-guess__verdict strong { color: var(--missed); }

/* A small shake after a wrong first guess. */
.guess-panel.is-nudged .first-guess {
  animation: nudge 0.42s var(--ease);
}

@keyframes nudge {
  0%, 100% { transform: none; }
  20% { transform: translateX(-6px); }
  45% { transform: translateX(5px); }
  70% { transform: translateX(-3px); }
}

.guess-panel--second {
  border-top-color: var(--accent);
}

/* ------------------------------------------------------------------ */
/* Stats                                                               */
/* ------------------------------------------------------------------ */

.stats--summary {
  margin-top: 1.25rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--rule);
}

.stats__title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink-muted);
}

.stats__numbers {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
  margin-top: 0.6rem;
}

.stats__numbers > div {
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-end;
}

.stats__numbers dd {
  font-family: var(--font-display);
  font-size: 2rem;
  line-height: 1;
  font-variant-numeric: lining-nums tabular-nums;
}

.stats__unit {
  font-size: 0.55em;
  color: var(--ink-muted);
}

.stats__numbers dt {
  margin-top: 0.3rem;
  font-size: 0.8125rem;
  line-height: 1.25;
  color: var(--ink-muted);
}

.stats__label {
  margin-top: 1.1rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink-muted);
}

.bars {
  list-style: none;
  padding: 0;
  margin-top: 0.45rem;
  display: grid;
  gap: 0.3rem;
}

.bars__row {
  display: grid;
  grid-template-columns: 2.1rem minmax(0, 1fr);
  align-items: center;
  gap: 0.5rem;
}

.bars__score {
  font-size: 0.875rem;
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.bars__track {
  display: flex;
  align-items: center;
  min-height: 1.35rem;
}

.bars__fill {
  height: 1.35rem;
  background: var(--rule-strong);
  border-radius: 2px;
}

.bars__row.is-today .bars__fill {
  background: var(--accent);
}

.bars__count {
  padding-left: 0.4rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

.bars__row.is-today .bars__count {
  color: var(--accent);
}

.stats--page .stats__numbers dd {
  font-size: clamp(2.4rem, 8vw, 3.25rem);
}

.stats--page .stats__numbers dt {
  font-size: 0.875rem;
}

.stats--page .stats__label {
  margin-top: 2.25rem;
}

.stats--page .bars__fill,
.stats--page .bars__track {
  min-height: 1.7rem;
  height: 1.7rem;
}

.stats-note {
  margin-top: 2.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  font-size: 0.9375rem;
  color: var(--ink-muted);
}

/* ------------------------------------------------------------------ */
/* Archive: earlier daily puzzles                                      */
/* ------------------------------------------------------------------ */

.section-label--first {
  margin-top: 0;
}

.section-note {
  margin: 0.2rem 0 1rem;
  font-size: 0.9375rem;
  color: var(--ink-muted);
}

.archive-list--dailies + .section-label {
  margin-bottom: 1rem;
}

.archive-row__date {
  display: block;
  margin-top: 0.2rem;
  font-family: var(--font-text);
  font-size: 0.875rem;
  color: var(--ink-muted);
}

/* ------------------------------------------------------------------ */
/* How to play                                                         */
/* ------------------------------------------------------------------ */

.howto {
  width: min(30rem, calc(100vw - 2rem));
  border-top-color: var(--accent);
}

.howto__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 2rem;
  line-height: 1.1;
}

.howto__steps {
  margin-top: 1.1rem;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.howto__steps li {
  position: relative;
  padding: 0.7rem 0 0.7rem 2.4rem;
  border-top: 1px solid var(--rule);
  counter-increment: step;
}

.howto__steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.7rem;
  width: 1.6rem;
  height: 1.6rem;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--paper);
  background: var(--ink);
  border-radius: 50%;
}

.howto__steps strong {
  display: block;
  font-weight: 600;
}

.howto__example {
  margin-top: 0.6rem;
  padding: 0.95rem 1rem 1rem;
  background: var(--panel);
  border-radius: 4px;
}

.howto__example-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink-muted);
}

.howto__qa {
  list-style: none;
  padding: 0;
  margin-top: 0.4rem;
}

.howto__qa li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--rule);
  font-size: 0.9375rem;
}

.howto__qa span {
  color: var(--ink-muted);
}

.howto__qa strong {
  flex: none;
  font-weight: 600;
}

.howto__link {
  margin-top: 0.6rem;
  font-size: 0.9375rem;
}

.howto__link strong {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.125rem;
  color: var(--accent);
}

.howto__play {
  width: 100%;
  margin: 1.1rem 0 0.6rem;
}

.stats-note {
  max-width: none;
}

.stats-note p {
  max-width: 36rem;
}

@media (max-width: 560px) {
  .stats__numbers { gap: 0.75rem; }
  .stats__numbers dd,
  .stats--page .stats__numbers dd { font-size: 1.6rem; }
  .stats__numbers dt { font-size: 0.75rem; }
}

.howto__lede {
  margin-top: 0.6rem;
  font-family: var(--font-display);
  font-size: 1.1875rem;
  line-height: 1.35;
}

.howto__lede + .howto__steps {
  margin-top: 1rem;
}

/* ------------------------------------------------------------------ */
/* Settings and colour-blind mode                                      */
/* ------------------------------------------------------------------ */


.site-nav__help--settings svg {
  stroke-width: 1.7;
  stroke-linejoin: round;
}

.site-nav__help--settings {
  margin-right: -0.9rem;
}

.settings {
  width: min(26rem, calc(100vw - 2rem));
}

.settings__list {
  margin: 1.1rem 0 0.4rem;
  border-bottom: 1px solid var(--rule);
}

.setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 0;
  border-top: 1px solid var(--rule);
}

.setting__name {
  font-weight: 600;
}

.switch {
  position: relative;
  flex: none;
  width: 3rem;
  height: 1.75rem;
  padding: 0;
  background: var(--rule-strong);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.switch[aria-checked="true"] {
  background: var(--accent);
}

.switch__knob {
  position: absolute;
  top: 0.2rem;
  left: 0.2rem;
  width: 1.35rem;
  height: 1.35rem;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.15s ease;
}

.switch[aria-checked="true"] .switch__knob {
  transform: translateX(1.25rem);
}

.site-footer__link {
  margin-left: 0.35rem;
  color: var(--ink-muted);
  text-underline-offset: 0.2em;
}

.site-footer__link:hover {
  color: var(--ink);
}

@media (max-width: 560px) {
  .site-nav { gap: 0.9rem; }
  .site-nav__help--settings { margin-right: -0.75rem; }
}

@media (max-width: 400px) {
  .site-nav { gap: 0.65rem; }
  .site-nav__help { width: 2.5rem; }
}

/* ------------------------------------------------------------------ */
/* Themes: dark mode and high contrast (Settings)                      */
/* ------------------------------------------------------------------ */

/* High contrast: blue and orange for right and wrong. They differ in
   lightness as well as hue, so they stay distinct for colour-blind players. */
html[data-contrast="high"] {
  --accepted: #1E4F99;
  --missed: #A9530C;
  --accepted-tint: #E1E7F1;
  --missed-tint: #F8EFE6;
}

/* Dark mode: the same warm palette at night. Charcoal paper, ivory ink,
   a lighter cobalt. */
html[data-theme="dark"] {
  color-scheme: dark;
  --paper: #1A1917;
  --paper-raised: #211F1C;
  --panel: #26231F;
  --ink: #ECE7DC;
  --ink-muted: #A8A196;
  --rule: #35322D;
  --rule-strong: #6E685F;
  --accent: #95AADB;
  --accent-soft: #2E3852;
  --accepted: #79B892;
  --missed: #E8907A;
  --accepted-tint: #1E2B23;
  --missed-tint: #33221D;
  --on-signal: #1A1917;
  --placeholder: #7D776D;
  --input-wash: rgba(255, 255, 255, 0.04);
  --hairline: rgba(236, 231, 220, 0.15);
  --backdrop: rgba(0, 0, 0, 0.6);
  --dialog-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

html[data-theme="dark"][data-contrast="high"] {
  --accepted: #B3CCF7;
  --missed: #D9822F;
  --accepted-tint: #1D2738;
  --missed-tint: #33271B;
}

html[data-theme="dark"] .switch__knob {
  background: var(--ink);
}

html[data-theme="dark"] .switch[aria-checked="true"] .switch__knob {
  background: var(--paper);
}

/* ------------------------------------------------------------------ */
/* Everyone's results (pop-up)                                         */
/* ------------------------------------------------------------------ */

.crowd {
  margin-top: 1.25rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--rule);
}

.crowd[hidden] {
  display: none;
}

.crowd__numbers {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.crowd__wait {
  margin-top: 0.5rem;
  font-size: 0.9375rem;
  color: var(--ink-muted);
}
