/* Doffy's picnic. The page IS Doffy's design picture (wide on computers, the tall one on phones).
   Every position below is in that picture's own pixels; --u turns one picture pixel into screen size. */
@font-face { font-family: "Fredoka"; src: url("assets/fonts/fredoka-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
:root {
  --red: #d8261e;
  --red-dk: #a3150f;
  --cream: #fbf4e4;
  --maroon: #6e1820;
  --ink: #2c1714;
  --leaf: #2f8a2c;
  --hand: "Fredoka", "Segoe UI", system-ui, sans-serif;
  --ease-out: cubic-bezier(.22, 1, .36, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: #2f6d22 url("assets/grass.jpg") 0 0 / 420px 420px repeat;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; }

/* Doffy's picture is never cut at the baskets or the girl. It stands full height against the right
   edge; on wider windows the tablecloths and grass carry on to the left (picnic-wide-full.jpg =
   the picture plus 600 px of continuation). Overlays are placed in the original picture's pixels. */
.stage {
  --W: 1672; --H: 941; --EXT: 600;
  --u: max(min(100dvh / 941, 100vw / 1302), 100vw / 2272);
  position: relative; height: 100dvh; overflow: hidden;
}
.scene {
  position: absolute; right: 0; top: min((100dvh - var(--H) * var(--u)) / 2, 100dvh - var(--H) * var(--u)); /* very wide windows trim the top only, never the doll's feet */
  width: calc(var(--W) * var(--u)); height: calc(var(--H) * var(--u));
  container-type: inline-size;
  user-select: none;
}
.bg {
  position: absolute; top: 0; left: calc(var(--EXT) * var(--u) * -1);
  width: calc((var(--W) + var(--EXT)) * var(--u)); max-width: none; height: 100%;
  display: block; pointer-events: none;
}

/* ---------- where things sit in the wide picture (numbers printed by tools/build_art.py) ---------- */
.b1 { --x: 384; --y: 70; --w: 540; --h: 431; --sx: 468; --sy: 136; --sw: 383; --sh: 313; --fw: 268; --fh: 186; --tx: 608; --ty: 410; --r: 20.6deg; --hit: polygon(26.1% 1.2%, 31.9% .5%, 95.6% 29.5%, 99.6% 33.4%, 99.3% 38.5%, 79.8% 95.1%, 77.2% 99.1%, 73% 99.5%, 3.1% 76.8%, .4% 72.9%, 1.1% 60.3%, 22.6% 5.6%); }
.b2 { --x: 851; --y: 288; --w: 550; --h: 437; --sx: 933; --sy: 348; --sw: 393; --sh: 316; --fw: 281; --fh: 179; --tx: 1078; --ty: 619; --r: 21.8deg; --hit: polygon(23.5% 1.6%, 28.9% .5%, 95.3% 29.1%, 99.6% 33%, 99.3% 38.4%, 80.7% 95.4%, 78.4% 98.4%, 73.5% 99.5%, 3.3% 65.9%, .4% 62%, .9% 57.2%, 20% 5%); }
.b3 { --x: 443; --y: 513; --w: 595; --h: 428; --sx: 532; --sy: 578; --sw: 429; --sh: 326; --fw: 321; --fh: 181; --tx: 699; --ty: 858; --r: 19.7deg; --hit: polygon(21.7% 1.9%, 26.9% .5%, 95.3% 35.3%, 99.7% 39.5%, 99.3% 45%, 82% 100%, 71.8% 100%, 3% 68.5%, .3% 64.5%, .8% 59.1%, 18.3% 5.4%); }
.girl { --x: 1527; --y: 706; --w: 128; --h: 233; }
.bubble { --right: 156; --bottom: 22; }
.sign { --size: 430; --min: 232px; }
.owner { --size: 390; --min: 190px; }

/* ---------- phones: the tall picture ---------- */
@media (max-aspect-ratio: 4/5) {
  .stage { --W: 904; --H: 1600; --EXT: 0; --u: min(100vw / 904, 100dvh / 1600); }
  .scene { right: calc((100vw - var(--W) * var(--u)) / 2); }
  .b1 { --x: 119; --y: 198; --w: 655; --h: 543; --sx: 216; --sy: 285; --sw: 466; --sh: 376; --fw: 365; --fh: 203; --tx: 394; --ty: 612; --r: 21.7deg; --hit: polygon(18% 3%, 28% 1%, 98% 33%, 99% 44%, 82% 97%, 72% 99%, 2% 66%, 1% 55%); }
  .b2 { --x: 95; --y: 608; --w: 658; --h: 544; --sx: 193; --sy: 695; --sw: 467; --sh: 376; --fw: 365; --fh: 204; --tx: 372; --ty: 1023; --r: 21.4deg; --hit: polygon(18% 3%, 28% 1%, 98% 33%, 99% 44%, 82% 97%, 72% 99%, 2% 66%, 1% 55%); }
  .b3 { --x: 124; --y: 1033; --w: 655; --h: 543; --sx: 221; --sy: 1120; --sw: 466; --sh: 376; --fw: 365; --fh: 203; --tx: 399; --ty: 1447; --r: 21.7deg; --hit: polygon(18% 3%, 28% 1%, 98% 33%, 99% 44%, 82% 97%, 72% 99%, 2% 66%, 1% 55%); }
  .girl { --x: 728; --y: 1286; --w: 174; --h: 317; }
  .bubble { --right: 24; --bottom: 330; }
  .sign { --size: 480; --min: 210px; }
  .owner { --size: 400; --min: 170px; }
}

/* ---------- squarer windows (tablets, narrow panels): a little grass above and below so the plates clear the baskets ---------- */
@media (min-aspect-ratio: 81/100) and (max-aspect-ratio: 3/2) {
  .stage { --u: min(100dvh / 941, 100vw / 1500); }
  .sign { --size: 270; --min: 150px; }
  .owner { --size: 270; --min: 138px; }
}

/* ---------- baskets stay where they are painted; the website lying inside is what moves ---------- */
.basket {
  position: absolute;
  left: calc(var(--x) * var(--u)); top: calc(var(--y) * var(--u));
  width: calc(var(--w) * var(--u)); height: calc(var(--h) * var(--u));
  padding: 0; border: 0; background: none; cursor: pointer; outline: none; pointer-events: none;
}
.hit { position: absolute; inset: 0; clip-path: var(--hit); pointer-events: auto; } /* only the basket itself is clickable */
.site {
  position: absolute; display: block; pointer-events: none;
  left: calc((var(--sx) - var(--x)) * var(--u)); top: calc((var(--sy) - var(--y)) * var(--u));
  width: calc(var(--sw) * var(--u)); height: calc(var(--sh) * var(--u));
}
.shot, .drop { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.shot { transition: transform .35s var(--ease-out); }
.shot.missing { visibility: hidden; }
.drop { opacity: .45; transform: translateY(calc(var(--u) * 4)); transition: transform .35s var(--ease-out), opacity .35s var(--ease-out); }

/* the name plates: one size, one font, each sewn flat on the same spot of its basket's front rim */
.tag {
  position: absolute;
  left: calc((var(--tx) - var(--x)) * var(--u)); top: calc((var(--ty) - var(--y)) * var(--u));
  transform: translate(-50%, -50%) rotate(var(--r));
  width: max(94px, calc(var(--u) * 204)); height: max(19px, calc(var(--u) * 42));
  display: grid; place-items: center;
  background: #fffaf0; color: #8e1b22;
  font: 700 max(11px, calc(var(--u) * 25)) / 1 var(--hand); letter-spacing: .015em; white-space: nowrap;
  border-radius: 999px;
  box-shadow: 0 max(2px, calc(var(--u) * 4)) max(4px, calc(var(--u) * 8)) rgba(90, 8, 6, .42);
}
.tag::before { content: ""; position: absolute; inset: max(2px, calc(var(--u) * 4)); border: max(1px, calc(var(--u) * 2)) dashed #d98a86; border-radius: 999px; }

.basket:hover, .basket:focus-visible { z-index: 2; }
@media (hover: hover) {
  .basket:hover .shot { transform: translateY(calc(var(--u) * -13)) rotate(2deg) scale(1.045); }
  .basket:hover .drop { opacity: 1; transform: translateY(calc(var(--u) * 10)) scale(1.02); }
}
.basket:focus-visible .shot { transform: translateY(calc(var(--u) * -13)) rotate(2deg) scale(1.045); }
.basket:focus-visible .tag { box-shadow: 0 0 0 max(2px, calc(var(--u) * 5)) #ffe98a; }
.basket:active .shot { transform: scale(.97); transition-duration: .12s; }
.basket.shake { animation: shake .45s ease; }
@keyframes shake { 25% { translate: -8px 0; } 55% { translate: 8px 0; } 80% { translate: -3px 0; } }

@media (max-aspect-ratio: 4/5) {
  .tag { width: max(92px, calc(var(--u) * 262)); height: max(19px, calc(var(--u) * 54)); font-size: max(11px, calc(var(--u) * 32)); }
}

/* ---------- top-left: the berry-basket plate with Doffy's two links ---------- */
.sign {
  position: absolute; left: max(8px, calc(var(--u) * 14)); top: max(8px, calc(var(--u) * 6)); z-index: 3;
  width: max(var(--min), calc(var(--u) * var(--size))); aspect-ratio: 680 / 350;
  container-type: inline-size;
  filter: drop-shadow(0 4px 8px rgba(40, 8, 4, .3));
}
.sign > img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }
.bar {
  position: absolute; display: flex; align-items: center; gap: 1.8cqw;
  height: 19.2%; color: #fff7ec; text-decoration: none;
  font-family: var(--hand); font-weight: 700; font-size: 6.4cqw; line-height: 1;
  border-radius: 999px; transition: transform .2s var(--ease-out), background .2s;
}
.bar svg { width: 7cqw; height: 7cqw; flex: none; fill: none; stroke: currentColor; stroke-width: 2; }
.bar svg .dot, .bar svg .fill { fill: currentColor; stroke: none; }
.bar.ig { left: 37%; right: 6%; top: 36.4%; padding-left: 5cqw; }
.bar.pin { left: 39%; right: 15%; top: 56.2%; padding-left: 6cqw; }
.bar:hover { background: rgba(255, 247, 236, .16); transform: translateX(1.4cqw); }
.bar:focus-visible { outline: 3px solid #ffe98a; outline-offset: 1px; }

/* ---------- bottom-left: the pink strawberry plate ---------- */
.owner {
  position: absolute; left: max(8px, calc(var(--u) * 16)); bottom: max(8px, calc(var(--u) * 14)); z-index: 3;
  width: max(var(--min), calc(var(--u) * var(--size))); aspect-ratio: 726 / 262;
  container-type: inline-size; pointer-events: none;
  filter: drop-shadow(0 4px 8px rgba(40, 8, 4, .3));
}
.owner img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.owner span {
  position: absolute; left: 24%; right: 4%; top: 12%; bottom: 18%;
  display: grid; place-items: center; white-space: nowrap;
  font-family: var(--hand); font-weight: 700; font-size: 8.6cqw; color: #6f1119;
  text-shadow: 0 1px 0 #ffd9d2, 0 0 6px rgba(255, 235, 230, .8);
}

/* ---------- the doll and her note ---------- */
.girl {
  position: absolute; left: calc(var(--x) * var(--u)); top: calc(var(--y) * var(--u));
  width: calc(var(--w) * var(--u)); height: calc(var(--h) * var(--u));
  padding: 0; border: 0; background: none; cursor: pointer; border-radius: calc(var(--u) * 30); z-index: 4;
}
.girl::before { /* her shadow on the grass */
  content: ""; position: absolute; left: 14%; right: 14%; bottom: -1%; height: 8%;
  border-radius: 50%; background: radial-gradient(closest-side, rgba(10, 30, 5, .55), rgba(10, 30, 5, 0));
}
.girl img { position: relative; width: 100%; height: 100%; display: block; transition: transform .3s var(--ease-out); transform-origin: 50% 100%; }
.girl:hover img { transform: translateY(-4%) rotate(0deg) scale(1.04); }
.girl:focus-visible { outline: 3px solid #ffe98a; }
.girl::after { /* a small speech dot while her note is closed */
  content: "?"; position: absolute; left: 4%; top: max(-26px, calc(var(--u) * -34));
  width: max(22px, calc(var(--u) * 40)); aspect-ratio: 1; display: grid; place-items: center;
  font: 700 max(13px, calc(var(--u) * 25)) / 1 var(--hand); color: #a22b2c;
  background: #fff7ec; border-radius: 50% 50% 4px 50%;
  box-shadow: 0 3px 8px rgba(10, 30, 5, .4);
  animation: hop 2.2s var(--ease-out) infinite;
}
.girl[aria-expanded="true"]::after { display: none; }
@keyframes hop { 0%, 65%, 100% { transform: translateY(0); } 35% { transform: translateY(-4px); } }

.bubble {
  position: absolute; right: calc(var(--right) * var(--u)); bottom: calc(var(--bottom) * var(--u)); z-index: 5;
  width: min(360px, 78cqw); max-height: calc(var(--H) * var(--u) * .72); overflow: auto;
  background: #fffaf0; border: 3px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink), inset 0 0 0 3px #fff, inset 0 0 0 5px #f2d6cf;
  padding: 11px 15px;
  font-size: 13.5px; line-height: 1.5;
  transform-origin: 100% 100%;
  transition: opacity .2s ease, transform .25s var(--ease-out), visibility .25s;
}
.bubble.hide { opacity: 0; visibility: hidden; transform: scale(.9) translateX(10px); pointer-events: none; }
.bubble-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 2px; }
.who { font: 700 11px/1 Consolas, ui-monospace, monospace; letter-spacing: .08em; text-transform: uppercase; color: var(--red); }
.bx {
  width: 24px; height: 24px; border: 2px solid var(--ink); background: #fff; cursor: pointer;
  font-size: 16px; line-height: 1; display: grid; place-items: center; box-shadow: 2px 2px 0 var(--ink);
}
.bx:hover { background: #ffe9e4; }
.bx:active { box-shadow: none; transform: translate(2px, 2px); }
.bubble-body h2 { margin: 2px 0 4px; font-size: 15.5px; color: var(--maroon); }
.bubble-body p { margin: 0 0 6px; }
.bubble-body ul { margin: 0 0 6px; padding-left: 1.1em; }
.bubble-body li { margin: 1px 0; }
.bubble-body .need { font: 700 10.5px/1 Consolas, ui-monospace, monospace; letter-spacing: .06em; text-transform: uppercase; color: var(--leaf); margin: 8px 0 3px; }
.bubble-body .warn { color: var(--red-dk); font-weight: 600; }
.bubble-nav { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 6px; }
.bubble-nav button {
  border: 2px solid var(--ink); background: #fff; padding: 3px 9px; cursor: pointer;
  font-size: 12px; font-weight: 600; line-height: 1.25; box-shadow: 2px 2px 0 var(--ink);
}
.bubble-nav button[aria-current="true"] { background: var(--red); color: #fff; }
.bubble-nav button:hover:not([aria-current="true"]) { background: #ffe9e4; }
.bubble-nav button:active { box-shadow: none; transform: translate(2px, 2px); }

/* ---------- an opened basket ---------- */
.open { position: fixed; inset: 0; z-index: 50; }
.open[hidden] { display: none; }
.open-veil { position: absolute; inset: 0; background: rgba(20, 30, 8, .55); backdrop-filter: blur(3px); }
.crate {
  position: absolute; inset: 2.5vh 2.5vw;
  display: flex; flex-direction: column;
  background: var(--red); border-radius: 26px; padding: 0 12px 12px;
  box-shadow: 0 30px 80px rgba(10, 5, 0, .55), inset 0 -6px 0 var(--red-dk);
}
@media (max-width: 700px) { .crate { inset: 6px; border-radius: 18px; padding: 0 7px 7px; } }
.crate-bar { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 18px 4px 10px; color: #fff; }
.crate-bar::before { /* the white slots along a picnic basket's rim */
  content: ""; position: absolute; left: 14px; right: 14px; top: 6px; height: 6px;
  background: repeating-linear-gradient(90deg, rgba(255,255,255,.92) 0 14px, transparent 14px 22px); border-radius: 2px;
}
.crate-tag {
  display: inline-flex; align-items: baseline; gap: 10px; min-width: 0;
  background: var(--cream); color: var(--maroon); padding: 6px 16px 7px; border-radius: 8px;
  transform: rotate(-1.5deg); box-shadow: 0 3px 8px rgba(60, 10, 5, .3);
}
.crate-tag b { font-family: var(--hand); font-size: 19px; line-height: 1.2; white-space: nowrap; }
.crate-tag small { font-size: 12px; color: #8a5a50; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crate-acts { display: flex; gap: 8px; flex: none; }
.crate-btn {
  display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 999px;
  background: rgba(255, 255, 255, .16); color: #fff; border: 1.5px solid rgba(255, 255, 255, .55);
  font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer; transition: background .15s, transform .15s;
}
.crate-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.crate-btn:hover { background: rgba(255, 255, 255, .28); }
.crate-btn:active { transform: scale(.96); }
.crate-btn:focus-visible { outline: 3px solid #ffe98a; outline-offset: 2px; }
.crate-btn.back { background: #fff; color: var(--red-dk); border-color: #fff; }
.crate-btn.back:hover { background: var(--cream); }
@media (max-width: 560px) { .crate-btn span, .crate-tag small { display: none; } .crate-btn { padding: 0 10px; } }
.crate-in {
  position: relative; flex: 1; min-height: 0; border-radius: 14px; overflow: hidden;
  background-color: var(--cream); background-image: radial-gradient(circle, var(--maroon) 1.6px, transparent 2.2px); background-size: 22px 22px;
  box-shadow: inset 0 3px 10px rgba(60, 10, 5, .35);
}
.crate-in iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #fff; }
.crate-in iframe[hidden] { display: none; }
.crate-wait .go { display: inline-block; margin-top: 12px; padding: 8px 18px; border-radius: 999px; background: var(--red); color: #fff; text-decoration: none; font-family: "Segoe UI", system-ui, sans-serif; font-size: 14px; }
.crate-wait[hidden] { display: none; }
.crate-wait {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  background: var(--cream); color: var(--maroon); padding: 14px 22px; border-radius: 10px;
  font-family: var(--hand); font-weight: 700; font-size: 18px; text-align: center; max-width: 86%;
  box-shadow: 0 4px 14px rgba(60, 10, 5, .25);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
}
