/* Track n Quack: the duck map (map.html, and the little one on the homepage).
   The paper is a picture (assets/map/<paper>.webp, drawn by tools/map/build_map.mjs); everything on top of it
   (pins, ducks, town names) is placed by map.js in percent, the same way the old example trail was.
   Sizes on the paper use cqw (1cqw = 1% of the paper's width), so a flock looks the same on a phone and a desk. */

.mq-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: clamp(26px, 3vw, 44px); margin-top: clamp(26px, 3.4vw, 44px); align-items: start; }
@media (min-width: 980px) { .mq-layout { grid-template-columns: minmax(0, 1.22fr) minmax(0, 1fr); } }
.mq-left { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.mq-paper { padding: clamp(10px, 1.6vw, 18px); transform: rotate(-0.5deg); }
.mq-map { position: relative; width: 100%; container-type: inline-size; border-radius: 12px 16px 11px 17px / 16px 11px 17px 12px; overflow: hidden; background: var(--m-paper); line-height: 0; }
.mq-map > img.mq-art { width: 100%; height: auto; display: block; user-select: none; -webkit-user-drag: none; }

/* a town on the paper that has no ducks yet: a pencil dot and its name */
.mq-town { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 0.3cqw; pointer-events: none; line-height: 1; }
.mq-town i { width: 1.25cqw; height: 1.25cqw; min-width: 5px; min-height: 5px; border-radius: 50%; background: var(--m-pencil-soft); opacity: .7; }
.mq-town span { font-family: var(--hand); font-size: clamp(12px, 2.9cqw, 21px); color: var(--m-pencil-soft); white-space: nowrap; position: absolute; top: 100%; margin-top: 0.4cqw; }
.mq-town.is-hidden { display: none; }

/* a flock: one of Medora's pins stuck in a town, with the real ducks standing around it */
.mq-flock { position: absolute; z-index: 2; -webkit-appearance: none; appearance: none; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; color: inherit; font: inherit;
  transform: translate(-50%, -100%); display: flex; flex-direction: column; align-items: center; line-height: 1; -webkit-tap-highlight-color: transparent; }

.mq-flock .mq-pin { width: clamp(30px, 10cqw, 76px); height: clamp(40px, 13.4cqw, 102px); max-width: none; object-fit: contain; object-position: 50% 100%; display: block; position: relative; z-index: 1; margin: 0 -2.2cqw; transform-origin: 50% 96%; filter: drop-shadow(1px 2px 0 rgba(71,74,85,.22)); }
.mq-duck { width: clamp(26px, 8.6cqw, 66px); height: clamp(26px, 8.6cqw, 66px); max-width: none; object-fit: contain; object-position: 50% 100%; display: block; margin: 0 -1.5cqw; position: relative; z-index: 2;
  /* a white edge and a little shadow: every duck is a sticker stuck on the map */
  filter: drop-shadow(1.4px 0 0 #fff) drop-shadow(-1.4px 0 0 #fff) drop-shadow(0 1.4px 0 #fff) drop-shadow(0 -1.4px 0 #fff) drop-shadow(1.5px 2.5px 0 rgba(71,74,85,.28)); }
.mq-flock__row .mq-duck:nth-child(odd) { transform: rotate(-5deg) translateY(1px); }
.mq-flock__row .mq-duck:nth-child(even) { transform: rotate(4deg); }
.mq-flock__name { margin-top: 0.7cqw; font-family: var(--hand); font-size: clamp(15px, 3.7cqw, 27px); color: var(--m-pencil); white-space: nowrap; background: rgba(255,253,247,.86); padding: 0.2cqw 1.6cqw 0.4cqw; border-radius: 10px 14px 9px 13px / 13px 9px 14px 10px; border: 2px solid transparent; display: flex; align-items: baseline; gap: 1.2cqw; }
.mq-flock__name b { font-weight: 400; font-family: var(--mono); font-size: 0.56em; line-height: 1; color: #fff; background: var(--m-marker); border-radius: 999px; min-width: 1.7em; padding: 0.32em 0.4em 0.3em; text-align: center; align-self: center; }
.mq-flock:hover .mq-flock__name, .mq-flock:focus-visible .mq-flock__name { border-color: var(--m-pencil-soft); }
.mq-flock:focus-visible { outline: none; }
.mq-flock:focus-visible .mq-flock__name { outline: 3px dashed var(--m-wave); outline-offset: 2px; }
.mq-flock.is-on { z-index: 3; }
.mq-flock.is-on .mq-flock__name { background: var(--m-yellow); border-color: var(--m-pencil); border-style: solid; box-shadow: 2px 3px 0 var(--m-shadow); }
@media (prefers-reduced-motion: no-preference) {
  .mq-flock.is-on .mq-pin { animation: mq-wiggle 2.6s ease-in-out infinite; }
  .mq-flock .mq-duck { transition: transform .15s ease; }
  .mq-flock:hover .mq-duck { transform: translateY(-2px) rotate(0deg); }
}
@keyframes mq-wiggle { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }

/* the other papers: bigger maps for when the ducks go further */
.mq-papers { display: flex; flex-wrap: wrap; gap: 10px 12px; justify-content: center; align-items: center; font-family: var(--print); font-size: 17px; color: var(--m-pencil-soft); }
.mq-papers span { flex-basis: 100%; text-align: center; }
@media (min-width: 560px) { .mq-papers span { flex-basis: auto; } }
.mq-papers button { -webkit-appearance: none; appearance: none; font-family: var(--hand); font-size: 19px; line-height: 1.2; color: var(--m-pencil); background: rgba(255,255,255,.6); border: 2px solid var(--m-pencil); border-radius: var(--r2); padding: 4px 14px; cursor: pointer; }
.mq-papers button[aria-pressed="true"] { background: var(--m-yellow); box-shadow: 2px 3px 0 var(--m-shadow); }
.mq-papers button:focus-visible { outline: 3px dashed var(--m-wave); outline-offset: 3px; }

/* the card next to the map: who is in the flock you tapped */
.mq-right { min-width: 0; }
.mq-card { display: flex; flex-direction: column; gap: 6px; transform: rotate(0.4deg); }
.mq-card h2 { font-size: clamp(38px, 4.6vw, 56px); }
.mq-card h3 { font-family: var(--hand); font-size: 26px; color: var(--m-pencil); margin: 14px 0 0; }
.mq-list { list-style: none; margin: 8px 0 0; padding: 0; }
.mq-list li { border-top: 2px dashed rgba(71,74,85,.35); }
.mq-row { display: grid; grid-template-columns: 58px minmax(0, 1fr) auto; gap: 4px 14px; align-items: center; padding: 12px 2px; text-decoration: none; color: var(--m-pencil);
  -webkit-appearance: none; appearance: none; background: none; border: 0; border-radius: 0; margin: 0; width: 100%; text-align: left; font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.mq-row img { grid-row: span 2; width: 58px; height: 58px; object-fit: contain; filter: drop-shadow(1.4px 0 0 #fff) drop-shadow(-1.4px 0 0 #fff) drop-shadow(0 1.4px 0 #fff) drop-shadow(0 -1.4px 0 #fff) drop-shadow(1.5px 2.5px 0 rgba(71,74,85,.28)); }
.mq-row .n { font-family: var(--hand); font-size: 25px; line-height: 1.05; align-self: end; overflow-wrap: anywhere; }
.mq-row .s { font-family: var(--print); font-size: 16.5px; line-height: 1.25; color: var(--m-pencil-soft); align-self: start; grid-column: 2; }
.mq-row .go { grid-row: 1 / span 2; grid-column: 3; color: var(--m-wave); }
.mq-row:hover .n, .mq-row:focus-visible .n { color: var(--m-marker); }
.mq-row:focus-visible { outline: 3px dashed var(--m-wave); outline-offset: 2px; }
.mq-row .far { display: block; }
.mq-hint { font-size: 18px; color: var(--m-pencil-soft); margin: 10px 0 0; }

/* the shelf: ducks with no stops yet */
.mq-shelf { list-style: none; margin: 0 auto; padding: 0; max-width: 1040px; display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 22px 10px; }
.mq-shelf button { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--m-pencil); -webkit-appearance: none; appearance: none; background: none; border: 0; padding: 0; margin: 0; width: 100%; font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.mq-shelf img { width: 70px; height: 70px; object-fit: contain; filter: drop-shadow(1.4px 0 0 #fff) drop-shadow(-1.4px 0 0 #fff) drop-shadow(0 1.4px 0 #fff) drop-shadow(0 -1.4px 0 #fff) drop-shadow(1.5px 2.5px 0 rgba(71,74,85,.28)); transition: transform .15s ease; }
.mq-shelf li:nth-child(odd) img { transform: rotate(-4deg); } .mq-shelf li:nth-child(3n) img { transform: rotate(5deg); }
.mq-shelf button:hover img, .mq-shelf button:focus-visible img { transform: translateY(-4px) rotate(0deg); }
.mq-shelf span { font-family: var(--hand); font-size: 17px; line-height: 1.05; text-align: center; overflow-wrap: break-word; max-width: 100%; }
.mq-shelf button:focus-visible { outline: 3px dashed var(--m-wave); outline-offset: 4px; }
@media (prefers-reduced-motion: reduce) { .mq-shelf img, .mq-flock .mq-duck { transition: none; } }

/* ---------- homepage: today's duck, and the little map ---------- */
.mq-mini { display: block; text-decoration: none; }
.mq-mini .mq-flock { pointer-events: none; }
.mq-fresh { list-style: none; margin: 0; padding: 0; }
.mq-fresh li:first-child { border-top: 0; }

/* the row around the pin: ducks to the left, ducks to the right, pin dead centre so its point is the town */
.mq-flock__row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; }
.mq-flock__l { display: flex; justify-content: flex-end; align-items: flex-end; }
.mq-flock__r { display: flex; justify-content: flex-start; align-items: flex-end; }
.mq-flock__name { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); }

/* one duck's card: its license (number scribbled out), then its trail town by town */
.mq-card--duck { gap: 10px; }
.mq-back { align-self: flex-start; font-size: 19px; margin-bottom: 6px; }
.mq-lic { width: 100%; max-width: 560px; align-self: center; transform: rotate(-1deg); margin: 6px 0 10px; }
.mq-soft { font-size: 17px; color: var(--m-pencil-soft); margin: 0; }
.mq-card--duck .tq-trail { margin: 0; }
.mq-card--duck .tq-trail li:first-child { border-top: 0; }
.mq-holding { margin-top: 12px; }
#lost .mq-shelf, #waiting .mq-shelf { justify-content: center; }
