/* whatsfish
   Visual direction: the enamelled identification plate you find hanging in a harbour
   office. Deep harbour teal, chalk lettering, one brass accent, hairline double keylines.
   The signature is the tide: a water level that rises across the page as you work
   through a deck. */

/* --- fonts (self-hosted, licences sit next to the files) ---------------------------- */

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/static/fonts/bricolage-grotesque-v9-latin_latin-ext-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/static/fonts/bricolage-grotesque-v9-latin_latin-ext-800.woff2") format("woff2");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("/static/fonts/instrument-sans-v4-latin_latin-ext-regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("/static/fonts/instrument-sans-v4-latin_latin-ext-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("/static/fonts/instrument-sans-v4-latin_latin-ext-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("/static/fonts/newsreader-v26-latin_latin-ext-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

/* --- tokens ------------------------------------------------------------------------ */

:root {
  --abyss: #04212a;
  --abyss-2: #072c37;
  --enamel: #0b3743;
  --enamel-hi: #114a5a;
  --chalk: #edf2f1;
  --chalk-dim: #8fa9b1;
  --brass: #e4a94f;
  --brass-deep: #b9812f;
  --seagrass: #58c0a8;
  --coral: #e4695a;
  --keyline: rgba(237, 242, 241, 0.16);
  --keyline-soft: rgba(237, 242, 241, 0.08);

  --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --body: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --latin: "Newsreader", Georgia, "Times New Roman", serif;

  --radius: 18px;
  --gap: clamp(1.25rem, 3.5vw, 2rem);
  --shell: min(62rem, 100% - 2.5rem);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(120% 80% at 50% -10%, var(--abyss-2), transparent 60%),
    var(--abyss);
  color: var(--chalk);
  font-family: var(--body);
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.075rem);
  line-height: 1.6;
  text-wrap: pretty;
  overflow-x: hidden;
}

::selection {
  background: var(--brass);
  color: var(--abyss);
}

a {
  color: inherit;
}

img {
  max-width: 100%;
  height: auto;
}

:where(a, button, label, input, summary):focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 3px;
  border-radius: 6px;
}

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

/* --- the tide (signature) ----------------------------------------------------------- */

.tide {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.tide__body {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--level, 0%);
  background: linear-gradient(
    180deg,
    rgba(88, 192, 168, 0.16),
    rgba(88, 192, 168, 0.06) 45%,
    rgba(88, 192, 168, 0.02)
  );
  transition: height 0.7s cubic-bezier(0.33, 1, 0.68, 1);
}

.tide__wave {
  position: absolute;
  left: 0;
  bottom: var(--level, 0%);
  width: 220%;
  height: 22px;
  margin-bottom: -1px;
  color: rgba(88, 192, 168, 0.4);
  transition: bottom 0.7s cubic-bezier(0.33, 1, 0.68, 1);
  animation: drift 14s linear infinite;
}

@keyframes drift {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

/* --- shell -------------------------------------------------------------------------- */

.shell {
  position: relative;
  z-index: 1;
  width: var(--shell);
  margin-inline: auto;
  padding-block: clamp(1rem, 3vw, 1.75rem) clamp(3rem, 9vw, 5rem);
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  min-height: 100dvh;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--keyline-soft);
}

.wordmark {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.wordmark svg {
  color: var(--brass);
  flex: none;
}

.step {
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--chalk-dim);
  font-weight: 500;
}

.step-group {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
}

.score-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: rgba(88, 192, 168, 0.15);
  color: var(--seagrass);
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
}

/* --- language chips ----------------------------------------------------------------- */

.picker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 0.9rem;
}

.picker__label {
  font-size: 0.8rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--chalk-dim);
  font-weight: 500;
}

.chips {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(237, 242, 241, 0.05);
  box-shadow: inset 0 0 0 1px var(--keyline-soft);
}

.chip {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding-inline: 0.95rem;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  color: var(--chalk-dim);
  transition: color 0.2s, background 0.2s;
}

.chip:hover {
  color: var(--chalk);
}

.chip[aria-current="true"] {
  background: var(--chalk);
  color: var(--abyss);
}

/* --- plates ------------------------------------------------------------------------- */

.plate {
  background: var(--enamel);
  border-radius: var(--radius);
  box-shadow:
    inset 0 0 0 1px var(--keyline),
    inset 0 0 0 5px var(--enamel),
    inset 0 0 0 6px var(--keyline-soft),
    0 22px 50px -28px rgba(0, 0, 0, 0.85);
}

/* --- hero --------------------------------------------------------------------------- */

.hero {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding-block: clamp(0.5rem, 3vw, 2rem);
}

.eyebrow {
  font-size: 0.8rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brass);
  font-weight: 600;
}

h1 {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2.9rem, 12vw, 6.5rem);
  line-height: 0.88;
  letter-spacing: -0.035em;
  margin: 0;
  text-wrap: balance;
}

.langline {
  margin: 0.35rem 0 0;
  font-family: var(--latin);
  font-style: italic;
  font-size: clamp(1.15rem, 1rem + 0.7vw, 1.5rem);
  color: var(--chalk);
}

.langline span {
  color: var(--brass);
  padding-inline: 0.25rem;
}

.lede {
  margin: 0.4rem 0 0;
  max-width: 34ch;
  color: var(--chalk-dim);
  font-size: clamp(1.05rem, 1rem + 0.4vw, 1.25rem);
}

/* --- setup panel -------------------------------------------------------------------- */

.setup {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  padding: clamp(1.15rem, 3.5vw, 1.9rem);
}

.modes {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
}

.mode {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 1.1rem 1.25rem;
  min-height: 44px;
  border-radius: 14px;
  text-decoration: none;
  background: var(--enamel-hi);
  box-shadow: inset 0 0 0 1px var(--keyline-soft);
  transition: transform 0.2s, background 0.2s;
}

.mode:hover {
  background: #16596c;
  transform: translateY(-2px);
}

.mode--primary {
  background: var(--brass);
  color: var(--abyss);
}

.mode--primary:hover {
  background: #f0b95f;
}

.mode__title {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.4rem;
  letter-spacing: -0.01em;
}

.mode__hint {
  font-size: 0.92rem;
  color: var(--chalk-dim);
}

.mode--primary .mode__hint {
  color: rgba(4, 33, 42, 0.72);
}

/* --- flashcard ------------------------------------------------------------------------ */

.stage {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1.15rem;
  flex: 1;
}

/* A flashcard should read as a card, not as a full-width banner. */
.stage--narrow > * {
  width: min(100%, 34rem);
  margin-inline: auto;
}

.reveal-toggle {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.card .figure {
  cursor: pointer;
}

/* The answer unrolls under the picture instead of the card turning over: the fish stays
   in view while you read the names, which is the point of looking at both together. */
.solution {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows 0.45s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s;
}

.solution__inner {
  overflow: hidden;
  min-height: 0;
}

.reveal-toggle:checked ~ .card .solution {
  grid-template-rows: 1fr;
  opacity: 1;
}

.reveal-btn {
  align-self: flex-start;
}

.reveal-toggle:focus-visible ~ .card .reveal-btn {
  outline: 2px solid var(--brass);
  outline-offset: 3px;
}

.reveal-btn .chev {
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: 50% 50%;
}

.reveal-toggle:checked ~ .card .reveal-btn .chev {
  transform: rotate(180deg);
}

.reveal-btn .when-shown,
.reveal-toggle:checked ~ .card .reveal-btn .when-hidden {
  display: none;
}

.reveal-toggle:checked ~ .card .reveal-btn .when-shown {
  display: inline;
}

.figure {
  position: relative;
  aspect-ratio: 4 / 3;
  max-height: 48dvh;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(160deg, #0a3441, #061f28);
  box-shadow: inset 0 0 0 1px var(--keyline-soft);
  display: grid;
  place-items: center;
}

.figure img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.figure__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  color: rgba(143, 169, 177, 0.55);
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.latin {
  font-family: var(--latin);
  font-style: italic;
  font-size: clamp(1.35rem, 1.1rem + 1.4vw, 2rem);
  line-height: 1.15;
  margin: 0 0 0.5rem;
  color: var(--chalk);
}

.names {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.names li {
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
  padding-block: 0.7rem;
  border-top: 1px solid var(--keyline-soft);
}

.names li:first-child {
  border-top: 0;
}

.tag {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--brass);
  flex: none;
  width: 2.2rem;
}

.tag--target {
  background: var(--brass);
  color: var(--abyss);
  border-radius: 5px;
  text-align: center;
  padding-block: 0.15rem;
}

.names .name {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.15rem, 1rem + 0.9vw, 1.6rem);
  letter-spacing: -0.01em;
}

.latin-small {
  font-family: var(--latin);
  font-style: italic;
  color: var(--chalk-dim);
}

/* --- quiz --------------------------------------------------------------------------- */

.panel {
  padding: clamp(1rem, 3vw, 1.6rem);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.question {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(1.5rem, 1.15rem + 1.6vw, 2.3rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0;
  text-wrap: balance;
}

.answers {
  display: grid;
  gap: 0.7rem;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
}

.answer {
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.85rem 1.1rem;
  border-radius: 12px;
  text-decoration: none;
  background: var(--enamel-hi);
  box-shadow: inset 0 0 0 1px var(--keyline-soft);
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
  transition: background 0.18s, transform 0.18s;
}

.answer:hover {
  background: #16596c;
  transform: translateY(-1px);
}

.answer--is-right {
  background: rgba(88, 192, 168, 0.2);
  box-shadow: inset 0 0 0 1.5px var(--seagrass);
}

.answer--is-wrong {
  background: rgba(228, 105, 90, 0.16);
  box-shadow: inset 0 0 0 1.5px var(--coral);
}

.answer--muted {
  opacity: 0.45;
}

.answer[aria-disabled="true"] {
  pointer-events: none;
  transform: none;
}

.verdict {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 0.9rem;
  font-weight: 500;
}

.verdict__mark {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
}

.verdict--ok .verdict__mark {
  color: var(--seagrass);
}

.verdict--no .verdict__mark {
  color: var(--coral);
}

.verdict__detail {
  color: var(--chalk-dim);
}

.verdict__detail .dot {
  padding-inline: 0.15rem;
  color: var(--brass);
}

.verdict__detail strong {
  color: var(--chalk);
  font-weight: 600;
}

/* --- buttons and rows ---------------------------------------------------------------- */

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.7rem;
}

.btn {
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding-inline: 1.5rem;
  border: 0;
  border-radius: 999px;
  text-decoration: none;
  cursor: pointer;
  font-family: var(--body);
  font-weight: 600;
  font-size: 1rem;
  background: var(--brass);
  color: var(--abyss);
  transition: background 0.2s, transform 0.2s;
}

.btn:hover {
  background: #f0b95f;
  transform: translateY(-1px);
}

.btn--ghost {
  background: transparent;
  color: var(--chalk-dim);
  box-shadow: inset 0 0 0 1px var(--keyline);
}

.btn--ghost:hover {
  background: rgba(237, 242, 241, 0.06);
  color: var(--chalk);
}

/* --- result --------------------------------------------------------------------------- */

.score {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(3rem, 14vw, 7rem);
  line-height: 0.9;
  letter-spacing: -0.04em;
  margin: 0;
}

.score span {
  color: var(--chalk-dim);
}

.review {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: clamp(1rem, 3vw, 1.6rem);
}

.review h2 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  margin: 0 0 0.6rem;
  color: var(--chalk-dim);
}

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

.review li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem 0.8rem;
  padding-block: 0.65rem;
  border-top: 1px solid var(--keyline-soft);
}

.review li:first-child {
  border-top: 0;
}

.review .name {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.15rem;
}

.review .other {
  color: var(--chalk-dim);
  font-size: 0.95rem;
}

/* --- search --------------------------------------------------------------------------- */

.searchbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.35rem 1.1rem;
}

.searchbar__icon {
  flex: none;
  color: var(--brass);
}

.searchbar__field {
  flex: 1;
  min-width: 0;
  min-height: 56px;
  border: 0;
  background: transparent;
  color: var(--chalk);
  font-family: var(--body);
  font-size: 1.05rem;
  padding: 0;
}

.searchbar__field::placeholder {
  color: var(--chalk-dim);
}

.searchbar__field:focus {
  outline: none;
}

.searchbar:focus-within {
  box-shadow:
    inset 0 0 0 1px var(--brass),
    inset 0 0 0 5px var(--enamel),
    inset 0 0 0 6px var(--keyline-soft),
    0 22px 50px -28px rgba(0, 0, 0, 0.85);
}

/* Safari draws its own clear button on type=search; keep the row tidy. */
.searchbar__field::-webkit-search-decoration,
.searchbar__field::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.found-count,
.found-none {
  margin: 0;
  font-size: 0.82rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--chalk-dim);
  font-weight: 500;
}

.found-none {
  text-transform: none;
  letter-spacing: 0;
  font-size: 1.05rem;
  padding-block: 1rem;
}

.finds {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.85rem;
  grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr));
}

.find {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 0.9rem 0.75rem 0.75rem;
  height: 100%;
  text-decoration: none;
  transition: transform 0.18s, box-shadow 0.18s;
}

.find:hover {
  transform: translateY(-2px);
  box-shadow:
    inset 0 0 0 1px var(--brass),
    inset 0 0 0 5px var(--enamel),
    inset 0 0 0 6px var(--keyline-soft),
    0 22px 50px -28px rgba(0, 0, 0, 0.85);
}

.find__go {
  flex: none;
  margin-left: auto;
  padding-left: 0.5rem;
  color: var(--chalk-dim);
}

.find:hover .find__go {
  color: var(--brass);
}

.show-all {
  margin: 1.25rem 0 0;
}

.photo-credit {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  color: var(--chalk-dim);
}

.photo-credit a {
  color: inherit;
  text-underline-offset: 3px;
}

.figure--still {
  cursor: default;
}

.find__thumb {
  flex: none;
  width: 6.5rem;
  aspect-ratio: 4 / 3;
  border-radius: 10px;
  overflow: hidden;
  background: linear-gradient(160deg, #0a3441, #061f28);
  display: block;
}

.find__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.find__text {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.find__latin {
  font-family: var(--latin);
  font-style: italic;
  font-size: 1.05rem;
  color: var(--chalk-dim);
}

.find__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2rem 0.55rem;
  margin: 0;
}

.grouptag {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px var(--keyline);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--chalk-dim);
}

.find__names {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.find__name {
  /* A grid, not a row: a name that wraps keeps its second line under the first
     instead of sliding back under the language tag. */
  display: grid;
  grid-template-columns: 1.9rem 1fr;
  align-items: baseline;
  gap: 0 0.6rem;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.find__name .tag {
  width: auto;
  font-size: 0.66rem;
}

.footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--keyline-soft);
  font-size: 0.85rem;
  color: var(--chalk-dim);
}

.footer a {
  color: inherit;
  text-decoration-color: var(--keyline);
  text-underline-offset: 3px;
}

.footer a:hover {
  color: var(--chalk);
}

.review .other a {
  color: var(--chalk-dim);
  text-underline-offset: 3px;
}

/* --- motion ---------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
