/* ---------- Tokens ---------- */
:root {
  --bg: #eef2ee;          /* pale mist over the pond */
  --bg-raised: #f7f9f6;
  --ink: #1b2622;
  --ink-soft: #55635d;
  --rule: #cfd8d2;
  --goose: #4a6275;       /* Toulouse / Canada goose slate */
  --duck: #2c6a4f;        /* mallard-head green */
  --bill: #ea8a2a;        /* the orange bill both share */
  --error: #a63d2f;
  --focus: var(--bill);

  --font-display: "Young Serif", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-text: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;

  --measure: 44rem;
  --radius: 4px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111b18;
    --bg-raised: #182421;
    --ink: #e6ece8;
    --ink-soft: #9fb0a8;
    --rule: #2c3a35;
    --goose: #8ea6ba;
    --duck: #5fae8c;
    --bill: #f29b45;
    --error: #e07b6c;
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: 1.0625rem;
  line-height: 1.55;
  font-feature-settings: "tnum";
}

img { max-width: 100%; display: block; }

[hidden] { display: none !important; }

a { color: inherit; text-decoration-color: var(--rule); text-underline-offset: 0.16em; }
a:hover { text-decoration-color: currentColor; }

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

button { font: inherit; color: inherit; }

h1, h2, .verdict { font-family: var(--font-display); font-weight: 400; margin: 0; }

/* ---------- Layout ---------- */
.masthead, main, .colophon {
  width: min(var(--measure), 100% - 2.5rem);
  margin-inline: auto;
}

.masthead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 1.5rem 0 0;
}
.wordmark { font-family: var(--font-display); font-size: 1.25rem; text-decoration: none; }

.hero { padding: 4rem 0 2rem; }
h1 { font-size: clamp(2.75rem, 8vw, 4.5rem); line-height: 1; letter-spacing: -0.01em; }
.lede { max-width: 34em; margin: 1.25rem 0 0; color: var(--ink-soft); font-size: 1.125rem; }

/* ---------- Drop zone ---------- */
.dropzone {
  position: relative;
  padding: 3rem 2rem 2.75rem;
  border: 1.5px dashed var(--goose);
  border-radius: var(--radius);
  background: var(--bg-raised);
  text-align: center;
  cursor: pointer;
  transition: border-color 150ms, background-color 150ms;
}
.dropzone:hover, .dropzone:focus-visible { border-color: var(--duck); }
.dropzone.is-over {
  border-style: solid;
  border-color: var(--bill);
  background: color-mix(in srgb, var(--bill) 8%, var(--bg-raised));
}
.dropzone-mark { width: 56px; height: 56px; margin: 0 auto 0.75rem; color: var(--goose); }
.dropzone.is-over .dropzone-mark { color: var(--bill); }
.dropzone-title { margin: 0; font-family: var(--font-display); font-size: 1.5rem; }
.dropzone-sub { margin: 0.5rem auto 0; max-width: 30em; color: var(--ink-soft); font-size: 0.95rem; }

.link-button {
  background: none; border: 0; padding: 0;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-underline-offset: 0.16em;
  cursor: pointer;
}
.link-button:hover { text-decoration-color: currentColor; }

/* ---------- Working ---------- */
.working {
  display: grid;
  grid-template-columns: 7rem 1fr;
  gap: 1.5rem;
  align-items: center;
  padding: 1.5rem;
  background: var(--bg-raised);
  border-radius: var(--radius);
}
.working img { width: 7rem; height: 7rem; object-fit: cover; border-radius: var(--radius); }
.working p { margin: 0; color: var(--ink-soft); }
.dots span { animation: blink 1.2s infinite; }
.dots span:nth-child(2) { animation-delay: 0.2s; }
.dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 60%, 100% { opacity: 0.2; } 30% { opacity: 1; } }

/* ---------- Result ---------- */
.result {
  display: grid;
  grid-template-columns: minmax(0, 17rem) 1fr;
  gap: 2rem;
  align-items: start;
  padding: 1.5rem;
  background: var(--bg-raised);
  border-radius: var(--radius);
}
.result-photo { margin: 0; }
.result-photo img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--rule);
}
.result-photo figcaption { margin-top: 0.5rem; font-size: 0.85rem; color: var(--ink-soft); overflow-wrap: anywhere; }

.verdict {
  font-size: clamp(3rem, 9vw, 5rem);
  line-height: 0.95;
  letter-spacing: -0.015em;
}
.verdict[data-verdict="goose"] { color: var(--goose); }
.verdict[data-verdict="duck"] { color: var(--duck); }
.confidence { margin: 0.75rem 0 0; max-width: 28em; }

.scores { margin: 1.5rem 0 0; }
.score { display: grid; grid-template-columns: 4.5rem 1fr; align-items: center; gap: 0.75rem; }
.score + .score { margin-top: 0.6rem; }
.score dt { font-family: var(--font-display); font-size: 1.05rem; }
.score dd { margin: 0; display: grid; grid-template-columns: 1fr 3.25rem; align-items: center; gap: 0.75rem; }
.bar { display: block; height: 0.6rem; background: var(--rule); border-radius: 999px; overflow: hidden; }
.bar-fill {
  display: block; height: 100%; width: 0;
  border-radius: inherit;
  transition: width 600ms cubic-bezier(0.2, 0.7, 0.2, 1);
}
.score-goose .bar-fill { background: var(--goose); }
.score-duck .bar-fill { background: var(--duck); }
.pct { text-align: right; font-variant-numeric: tabular-nums; }

.result-meta { margin: 1.25rem 0 0; font-size: 0.85rem; color: var(--ink-soft); }

.button {
  margin-top: 1.25rem;
  padding: 0.6rem 1.1rem;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
}
.button:hover { background: var(--ink); color: var(--bg); }

.error {
  margin: 1rem 0 0;
  padding: 0.75rem 1rem;
  border-left: 3px solid var(--error);
  color: var(--error);
  background: var(--bg-raised);
}

/* ---------- Examples ---------- */
.examples { margin-top: 2.5rem; }
.examples-title { margin: 0 0 0.75rem; color: var(--ink-soft); }
.example-list {
  list-style: none; margin: 0; padding: 0;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.75rem;
}
.example-list button {
  width: 100%; padding: 0; border: 0; background: none; cursor: pointer;
  text-align: left; font-size: 0.8rem; color: var(--ink-soft); line-height: 1.3;
}
.example-list img {
  width: 100%; aspect-ratio: 1; object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: 0.4rem;
  transition: transform 150ms;
}
.example-list button:hover img { transform: translateY(-2px); }
.example-list button:focus-visible { outline: none; }
.example-list button:focus-visible img { outline: 2px solid var(--focus); outline-offset: 3px; }

/* ---------- About ---------- */
.about { margin-top: 5rem; padding-top: 2.5rem; border-top: 1px solid var(--rule); }
.about h2 { font-size: 2rem; margin-bottom: 1rem; }
.about p { max-width: 36em; margin: 0 0 1rem; }

/* ---------- Footer ---------- */
.colophon { margin: 4rem auto 3rem; font-size: 0.875rem; color: var(--ink-soft); }
.colophon p { margin: 0; max-width: 40em; }

/* ---------- Responsive ---------- */
@media (max-width: 40rem) {
  .hero { padding-top: 2.5rem; }
  .result { grid-template-columns: 1fr; }
  .result-photo img { aspect-ratio: 4 / 3; }
  .example-list { grid-template-columns: repeat(3, 1fr); }
  .working { grid-template-columns: 5rem 1fr; }
  .working img { width: 5rem; height: 5rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .dots span { opacity: 1; }
}
