/* The web dailies' shared look: the iPhone apps' greys and rounded cards, the site's
   type and pressable surfaces (shared/site.css, loaded after this), and a dark mode
   that follows the device.

   Each game's stylesheet sets its colours, after this one:
     --accent        the answer's line on the map, focus rings, chips, the button
     --accent-text   the same hue, readable as text on the card
     --wrong         wrong-guess pills
     --wrong-line    wrong guesses drawn on the map (games that draw them)
     --won / --won-text / --lost   the 7-day strip */

:root {
  color-scheme: light dark;
  --bg: #f2f2f7;                      /* iOS systemGroupedBackground */
  --card: #ffffff;
  --text: #1c1c1e;
  --text-2: #6c6c70;                  /* secondaryLabel */
  --separator: #d1d1d6;
  /* Base map */
  --map-land: #f4f3ee;
  --map-water: #cde8f6;
  --map-park: #dcebcf;
  --map-label: #3a3a3c;

  --radius: 16px;                     /* Theme.CornerRadius.standard */
  --radius-field: 12px;               /* Theme.CornerRadius.field */
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --card: #1c1c1e;
    --text: #f2f2f7;
    --text-2: #98989f;
    --separator: #38383a;
    --map-land: #242426;
    --map-water: #12364d;
    --map-park: #22321f;
    --map-label: #d1d1d6;
  }
}

* { box-sizing: border-box; }
html { background: var(--bg); overflow-x: clip; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 0 16px;
  color: var(--text);
  background: var(--bg);
  font: 400 1.0625rem/1.47 var(--font);
  -webkit-font-smoothing: antialiased;
}

main, footer { width: 100%; max-width: 36rem; margin: 0 auto; }
main { flex: 1; padding-block: 1.25rem 2.5rem; }

a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------------------------------------------------------------- header */

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
/* The app's name is the page's title: iOS large-title size. */
/* The game's name, in the site's display face and the game's colour. */
.wordmark {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.6rem, 7vw, 2.1rem);
  font-weight: 800;
  font-stretch: 125%;
  font-variation-settings: "wdth" 125;
  letter-spacing: -.03em;
  line-height: 1.1;
}
.wordmark a { color: var(--accent-text); text-decoration: none; }

/* Apple's badge artwork, unmodified: at least 40 px tall, clear space around it. */
.badge { display: inline-block; line-height: 0; padding: 10px; margin: -10px; }
.badge picture { display: block; }
.badge img { display: block; height: 40px; width: auto; }
.badge-large img { height: 54px; }

/* Empty while playing; says how it went, or what went wrong. */
.prompt {
  margin: -.5rem 0 1rem;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -.01em;
  line-height: 1.25;
}
.prompt:empty { display: none; }

#blurb { color: var(--text-2); }

/* ---------------------------------------------------------------- map */

.plate { margin: 0 0 1.25rem; }
.neatline {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--card);
}
#map {
  width: 100%;
  min-width: 0;
  height: min(54vh, 26rem);
  background: var(--map-land);
  color: var(--text-2);
  display: grid;
  grid-template-columns: minmax(0, 1fr);   /* never let MapLibre's attribution widen it */
  place-items: center;
  text-align: center;
}
figcaption { margin-top: .5rem; font-size: .9rem; color: var(--text-2); }
.maplibregl-ctrl-attrib { font-family: var(--font); }
@media (prefers-color-scheme: dark) {
  .maplibregl-ctrl-attrib, .maplibregl-ctrl-attrib-inner { background: rgba(28, 28, 30, .85) !important; color: var(--text-2) !important; }
  .maplibregl-ctrl-attrib a { color: var(--text-2) !important; }
  .maplibregl-ctrl-attrib-button { filter: invert(1); }
}

/* ---------------------------------------------------------------- last seven days */

.days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: .4rem;
  margin: 0 0 1.5rem;
}
.day {
  --fill: var(--card);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .1rem;
  min-height: 52px;
  padding: .4rem 0 .45rem;
  border-radius: var(--radius-field);
  background: var(--fill);
  color: var(--text);
  text-decoration: none;
}
.day:hover { text-decoration: none; }
.day .weekday { font-size: .72rem; color: var(--text-2); }
.day .date { font-size: 1.05rem; font-weight: 600; font-variant-numeric: tabular-nums; }
/* State: solved, missed, unplayed plain. */
.day.is-won { --fill: color-mix(in srgb, var(--won) 18%, var(--card)); }
.day.is-won .date { color: var(--won-text); }
.day.is-lost { --fill: color-mix(in srgb, var(--lost) 14%, var(--card)); }
.day.is-lost .date { color: var(--lost); }
/* The day on screen: ringed in the game's colour, clear of its edge. */
.day[aria-current="page"] { outline: 2.5px solid var(--accent); outline-offset: 2px; }

/* ---------------------------------------------------------------- guessing */

#play { margin: 0; }
#guess {
  width: 100%;
  font: 400 1.125rem/1.3 var(--font);
  color: var(--text);
  min-height: 54px;
  padding: .8rem 1rem;
  border: 2px solid var(--separator);
  border-radius: 14px;
  background: var(--card);
  font-weight: 600;
}
#guess::placeholder { color: var(--text-2); font-weight: 500; }
#guess:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }

.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .6rem; min-height: 2.75rem; }
.chips { gap: .6rem; }
.chip {
  --fill: color-mix(in srgb, var(--accent) 14%, var(--card));
  font: 700 1rem/1 var(--font);
  color: var(--accent-text);
  background: var(--fill);
  border-radius: 999px;
  padding: .7rem 1.05rem;
  min-height: 44px;
  cursor: pointer;
}
.chip:hover { --fill: color-mix(in srgb, var(--accent) 22%, var(--card)); }

#status { margin: .5rem 0 .25rem; color: var(--text-2); font-size: .95rem; }

.wrong { list-style: none; padding: 0; margin: 0 0 1rem; display: flex; flex-wrap: wrap; gap: .5rem; }
.wrong li {
  font-size: .95rem;
  font-weight: 600;
  color: var(--wrong);
  background: color-mix(in srgb, var(--wrong) 12%, transparent);
  border-radius: 999px;
  padding: .35rem .8rem;
  text-decoration: line-through;
}

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

#result { margin-top: .25rem; }
.answer {
  margin: 0 0 .15rem;
  font-size: clamp(1.9rem, 8vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -.025em;
  line-height: 1.1;
  color: var(--accent-text);
  animation: answer-in 500ms cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes answer-in {
  from { opacity: 0; transform: translateY(6px) scale(.98); }
  to { opacity: 1; transform: none; }
}
.mouth { margin: .2rem 0 0; color: var(--text-2); }
.mouth:empty { display: none; }

/* The app offer, right under the answer. */
/* The gap above lives here, so it holds whether or not "Flows into" is shown. */
.cartouche {
  margin: 1.5rem 0 1.25rem;
  padding: 1.1rem 1.15rem 1.2rem;
  border-radius: var(--radius);
  background: var(--card);
}
.cartouche h2 { margin: 0 0 .3rem; font-size: 1.2rem; font-weight: 700; letter-spacing: -.01em; }
.cartouche p { margin: 0 0 .9rem; color: var(--text-2); }

/* Share, countdown and streak on one row; they wrap on a narrow phone. */
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin: 0 0 1rem; }
.btn {
  --fill: var(--accent-text);
  font: 700 1.0625rem/1 var(--font);
  color: #fff;
  background: var(--fill);
  border-radius: 14px;
  padding: .9rem 1.35rem;
  min-height: 52px;
  cursor: pointer;
}
@media (prefers-color-scheme: dark) { .btn { color: #000; } }
.btn:hover { filter: brightness(1.06); }
#streak { margin: 0; font-weight: 600; }
#streak:empty { display: none; }
#next { margin: 0; color: var(--text-2); font-size: .95rem; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- footer */

footer {
  padding-block: 1.25rem 2rem;
  border-top: .5px solid var(--separator);
  font-size: .8rem;
  line-height: 1.5;
  color: var(--text-2);
}
footer p { margin: 0 0 .35rem; }
footer a { color: var(--text-2); text-decoration: underline; }

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

@media (prefers-reduced-motion: reduce) {
  .answer { animation: none; }
}
