/* DESIGN B — 방문(榜文): public notices pasted on a village board wall, seen by lantern light.
   A skin over design A's stylesheet (loaded before this one): same markup, same script, same API. Only looks change here.
   Real notices sit in a 3-across grid; decorative fake ones (b.js) peek out behind them, out of focus.
   Direction: soft and atmospheric, not sharp and flat. Depth of field, warm uneven light, grain, mist, a breeze, slow motion. */
@font-face { font-family: "BrushKoB"; src: url(assets/fonts/brush-ko-b.woff2) format("woff2"); font-display: block; }
:root {
  --sheet: #f4e9d2;                      /* aged hanji, not paper-white */
  --ink-b: #2a241e;
  --tape: linear-gradient(rgba(246, 234, 196, .62), rgba(226, 208, 158, .5));
  --tape-shape: polygon(0 0, 100% 0, 97% 25%, 100% 50%, 97% 75%, 100% 100%, 0 100%, 3% 75%, 0 50%, 3% 25%);
  --soft-edge: inset 0 0 0 1px rgba(70, 48, 26, .34), inset 0 0 30px rgba(150, 105, 50, .26), inset 0 -18px 26px -16px rgba(120, 80, 35, .38);
  --lift: drop-shadow(0 22px 26px rgba(0, 0, 0, .34)) drop-shadow(0 4px 6px rgba(0, 0, 0, .26));
  --ease: cubic-bezier(.22, .8, .3, 1);
}

/* ── the wall, in dusk light ──────────────────────────────────── */
body { position: relative; background: #131313 url(assets/img/wood-grey.webp) 0 0 / 760px 760px; color: var(--paper); overflow-x: clip; }
body::before { content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;           /* soft vignette */
  background: radial-gradient(62% 36% at 50% 20%, rgba(255, 255, 255, .11), transparent 72%),      /* a pool of light on the wall behind the headline (neutral: the wall is monochrome) */
    radial-gradient(ellipse at 50% 34%, rgba(0, 0, 0, 0) 30%, rgba(0, 0, 0, .68) 100%); }
body::after { content: ""; position: fixed; inset: 0; z-index: 9; pointer-events: none;     /* neutral glow in two corners + very fine grain: plain alpha layers (no blend modes: those are what made the page heavy) */
  background:
    radial-gradient(58% 48% at 10% 6%, rgba(255, 255, 255, .13), transparent 72%),
    radial-gradient(52% 44% at 94% 12%, rgba(255, 255, 255, .09), transparent 72%);
  animation: lantern 7s ease-in-out infinite; will-change: opacity; }
body { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .5 0'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='.38'/></svg>"), url(assets/img/wood-grey.webp); background-size: 220px 220px, 760px 760px; }
@keyframes lantern { 0%, 100% { opacity: .88; } 16% { opacity: .72; } 31% { opacity: .96; } 52% { opacity: .78; } 70% { opacity: .93; } 86% { opacity: .8; } }

main { position: relative; z-index: 2; max-width: 1080px; }
.wall { position: absolute; left: 0; top: 0; width: 100%; z-index: 1; overflow: hidden; pointer-events: none; --sy: 0px; --px: 0px; }
/* mist drifting slowly in front of the far wall, behind the real notices */
.wall::before, .wall::after { content: ""; position: absolute; left: 0; width: calc(100% + 1300px); height: 520px; pointer-events: none; z-index: 3; opacity: .17;
  background: url(assets/img/fog-720.webp) 0 0 / 1300px 520px repeat-x; animation: mist 110s linear infinite; will-change: transform; }   /* moves by transform, so the compositor does it: no repainting */
.wall::before { top: 8%; } .wall::after { bottom: 6%; opacity: .12; animation-duration: 160s; animation-direction: reverse; }
@keyframes mist { to { transform: translateX(-1300px); } }

.beam { position: absolute; left: 0; right: 0; height: 40px; opacity: .13; background: linear-gradient(rgba(255, 255, 255, .06), rgba(0, 0, 0, .3)); filter: blur(2px); }   /* barely there: a hint of a timber, not a ledge */

/* fake notices: out of focus, dim, parallax. Only the real notices are sharp. */
.fake { position: absolute; box-sizing: border-box; contain: layout style; pointer-events: none; }                       /* static: rasterised once, never animated */
.fake__in { position: absolute; inset: 0; box-sizing: border-box; padding: 16px 12px 12px; color: #1a1410; overflow: hidden;
  background: #efe3cb url(assets/img/paper-2.webp) 0 0 / 866px 568px; }
.fake__text { margin: 0; height: 100%; writing-mode: vertical-rl; text-orientation: mixed; white-space: pre-wrap; overflow: hidden; direction: ltr;
  font: 400 15px/1.5 "BrushKoB", serif; letter-spacing: 1px; opacity: .46; }                      /* faint hangul in vertical columns, as if seen from across the street */
.fake--wanted .fake__in { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 10px 10px; }
.fake__head, .fake__cap { filter: blur(1.4px); }
.fake__head { margin: 0; font: 400 clamp(17px, 2.4vw, 22px)/1 "BrushKoB", serif; letter-spacing: .12em; opacity: .62; }
.fake__beast { width: 74%; max-height: 58%; object-fit: contain; filter: grayscale(1) contrast(1.15); mix-blend-mode: multiply; opacity: .74; }
.fake__cap { margin: 0; font: 400 12px/1.45 "BrushKoB", serif; text-align: center; opacity: .42; }
.fake__seal { position: absolute; left: 10px; bottom: 12px; width: 24px; height: 24px; display: grid; place-items: center; transform: rotate(-5deg);
  font: 400 16px/1 "BrushKoB", serif; font-style: normal; color: #f3dccd; background: #9c2a22; border-radius: 2px; opacity: .55; mix-blend-mode: multiply; }
.tape { position: absolute; top: 3px; width: 48px; height: 18px; background: var(--tape); clip-path: var(--tape-shape); text-decoration: none; opacity: .75; }
.tape--l { left: 8px; transform: rotate(-24deg); } .tape--r { right: 8px; transform: rotate(22deg); }
@keyframes sway2 { from { rotate: -.35deg; } to { rotate: .4deg; } }

/* dust in the lantern light */
.motes { position: fixed; inset: 0; z-index: 8; pointer-events: none; overflow: hidden; }
.mote { position: absolute; bottom: -12px; left: var(--x); width: var(--s); height: var(--s); border-radius: 50%; opacity: 0;
  background: radial-gradient(circle, rgba(240, 240, 240, .95), rgba(240, 240, 240, 0) 70%); animation: mote var(--t) linear var(--dl) infinite; }
@keyframes mote { 0% { opacity: 0; transform: translate(0, 0); } 12% { opacity: var(--o); } 85% { opacity: var(--o); } 100% { opacity: 0; transform: translate(var(--dx), -108vh); } }

/* ── top beam ─────────────────────────────────────────────────── */
.bar { background: linear-gradient(rgba(46, 46, 46, .92), rgba(18, 18, 18, .94)); backdrop-filter: blur(6px); border-bottom: 1px solid rgba(255, 255, 255, .1); box-shadow: 0 8px 20px rgba(0, 0, 0, .4); color: var(--paper); }
.bar__logo img { filter: invert(1) brightness(1.1); opacity: .92; }
.bar__home { color: var(--paper); border-bottom-color: rgba(236, 229, 214, .35); }
.bar__home:hover { color: #ff9a8d; border-color: #ff9a8d; }
.lang__btn, .score { color: var(--paper); }
.score b { color: #ff8a7c; }

/* ── tape: soft and a little translucent ──────────────────────── */
.card::after, .hero::after, .quiet:not(.card)::after, .prize::after {
  content: ""; position: absolute; left: 50%; top: -10px; right: auto; bottom: auto; width: 76px; height: 22px; margin: 0 0 0 -38px; z-index: 5; pointer-events: none; display: block;
  background: var(--tape); clip-path: var(--tape-shape); transform: rotate(-2.5deg); opacity: .9; animation: none; filter: none;
}
.card:nth-child(3n+2)::after { left: 34%; transform: rotate(3deg); } .card:nth-child(3n)::after { left: 66%; transform: rotate(-4deg); }

/* sheets b.js adds to the headline, the strips and the quiet notices (their paper is on the element itself, which cannot be torn
   without tearing its contents too): the paper moves to a child that carries the torn edge, and the element only casts the shadow */
.sheet { position: absolute; inset: -3px -5px; z-index: -1; pointer-events: none; background: var(--sheet) url(assets/img/paper-1.webp) 0 0 / 866px 568px; box-shadow: var(--soft-edge); filter: url(#torn-b); }
/* the headline and the quiet notices keep their paper on a child sheet (the element itself is just the shadow caster) */
.hero:has(> .sheet), .quiet:not(.card):has(> .sheet) { background: none !important; box-shadow: none !important; filter: var(--lift); }

/* ── headline notice ──────────────────────────────────────────── */
.hero { max-width: 760px; margin: 30px auto 14px; padding: 36px 20px 32px; isolation: isolate; color: var(--ink-b); transform-origin: 50% 0; rotate: 0deg;
  background: var(--sheet) url(assets/img/paper-1.webp) 0 0 / 866px 568px; box-shadow: var(--soft-edge), 0 26px 34px -8px rgba(0, 0, 0, .5); transform: rotate(-.3deg); }
.hero::before { content: "방"; position: absolute; z-index: 2; top: 18px; right: 16px; left: auto; width: 38px; height: 38px; aspect-ratio: auto; display: grid; place-items: center; transform: rotate(5deg); opacity: .82; mix-blend-mode: multiply;
  font: 400 24px/1 "BrushKoB", serif; color: #fff2e6; background: #a8281f; border-radius: 3px; filter: blur(.25px); }
.hero__logo { margin-top: 4px; }

/* ── the notice grid: three across ─────────────────────────────── */
.sec { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 50px 32px; align-items: start; margin-top: 40px; }
.sec > * { min-width: 0; }
.sec > .notify-row, .sec > .login, .sec > .card.quiet, .sec > .quiet, .sec > .win, .sec > .task--main { grid-column: 1 / -1; }
/* headings are no longer separate paper strips (people took them for buttons): they sit inside the sign-in card / the main task card.
   The congratulations line on the results page is plain caption text on the wall. */
.win h2 { color: var(--paper); text-shadow: 0 2px 14px rgba(0, 0, 0, .65); margin: 0 0 4px; }
.win h2::after { display: none; }
.sec > .muted, .win .muted, .bye .link { color: #cfcfcf; }
.bye .link:hover { color: #fff; }

/* ── notices: aged sheets with a feathered edge and a soft shadow; no hard ruled frame ── */
.card, .quiet:not(.card), .modal { color: var(--ink-b); }
.card { margin: 0; padding: 26px 24px 22px; filter: var(--lift); transform-origin: 50% -6px; }
.card::before { inset: -3px -5px; filter: url(#torn-b); background-color: var(--sheet); box-shadow: var(--soft-edge); }
.card { --dy: 0px; --dx: 0px; --rot: 0deg; --pb: 24px; transform: rotate(var(--rot)); translate: var(--dx) var(--dy); }
/* hand-pasted: the same few offsets every time (no flash on re-render), different for neighbours; vertical wobble of up to ~20px, a few px sideways, under a degree of tilt */
.sec > .card:nth-child(3)  { --dy: -12px; --dx: -3px; --rot:  .85deg; --pb: 30px; }
.sec > .card:nth-child(4)  { --dy:  16px; --dx:  4px; --rot: -.6deg;  --pb: 22px; }
.sec > .card:nth-child(5)  { --dy:  -4px; --dx: -2px; --rot:  .4deg;  --pb: 38px; }
.sec > .card:nth-child(6)  { --dy:  12px; --dx:  3px; --rot: -.9deg;  --pb: 26px; }
.sec > .card:nth-child(7)  { --dy: -18px; --dx: -4px; --rot:  .55deg; --pb: 34px; }
.sec > .card:nth-child(8)  { --dy:  20px; --dx:  2px; --rot: -.35deg; --pb: 24px; }
.sec > .card:nth-child(9)  { --dy:  -8px; --dx:  4px; --rot:  .7deg;  --pb: 36px; }
.sec > .card:nth-child(10) { --dy:  18px; --dx: -3px; --rot: -.8deg;  --pb: 28px; }
.sec > .card:nth-child(11) { --dy: -14px; --dx:  2px; --rot:  .3deg;  --pb: 32px; }
.sec > .card:nth-child(n+12) { --dy: 8px; --rot: -.4deg; }
.sec > .card.task--main { --dy: 0px; --dx: 0px; --rot: -.35deg; }
/* (no continuous sway on notices: measured, it cost 23 fps vs 60. They are pasted up once on arrival and then stay put.) */
@keyframes sway { from { rotate: -.32deg; } to { rotate: .38deg; } }
/* forms and anything under the pointer hold still, so nothing you are about to click is moving */
.card.login, .card.notify-row, .modal { animation: none !important; }
.card:hover, .card:focus-within, .prize:hover { animation-play-state: paused !important; }       /* a breeze through the alley: the individual `rotate` property adds to each sheet's own tilt */
.card.task--main::before { box-shadow: inset 0 0 0 1px rgba(168, 40, 31, .6), inset 0 0 0 5px rgba(244, 233, 210, .0), inset 0 0 34px rgba(168, 40, 31, .14), inset 0 0 30px rgba(150, 105, 50, .24), inset 0 -18px 26px -16px rgba(120, 80, 35, .34); }
.card.task.is-pending::before { box-shadow: inset 0 0 0 2px rgba(168, 40, 31, .7), inset 0 0 32px rgba(168, 40, 31, .28); }
.card.task.is-done::before { box-shadow: var(--soft-edge); }

/* a task notice reads top to bottom: seal stamped on the corner, picture, title, text, button */
.task:not(.task--main) { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 42px 22px var(--pb); }
.task:not(.task--main) .task__pts { position: absolute; top: -14px; right: 16px; width: 62px; height: 62px; z-index: 6; background: var(--sheet); }
.task:not(.task--main) .task__body { width: 100%; }
.task:not(.task--main) .task__act { margin-top: auto; padding: 8px 0 0; width: 100%; flex-direction: row; justify-content: flex-start; gap: 12px; flex-wrap: wrap; }
.task:not(.task--main) .task__name { overflow-wrap: anywhere; hyphens: auto; }
.task--main { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 22px; padding: 32px 28px 26px; }
.task--main .task__pts { position: static; }
/* the headline task: 1.5x taller than before (170px -> 255px; phones 265px -> 398px), content centred, and the "Most entries" tag stamped in the top-right corner */
.task--main { min-height: 255px; align-content: center; padding-top: 46px; }
.task--main .tag { position: absolute; top: 16px; right: 24px; margin: 0; z-index: 6; transform: rotate(2.5deg); box-shadow: 0 3px 8px rgba(0, 0, 0, .28); padding: 3px 12px 4px; font-size: .8rem; }
.task--main .task__body > .glink { display: block; margin-bottom: 10px; }
.task--main .task__head { padding-right: 0; margin-bottom: 8px; }
.card__title, .task__title { color: var(--ink-b); }
.task--main .task__head .coin-legend { color: #6a5f50; }
@media (min-width: 721px) { .task--main .task__head { padding-right: 190px; } }   /* clear of the "Most entries" tag in the corner */
/* tighter: a compact card centred on the wall instead of a full-width banner; seal, text and button sit close together */
@media (min-width: 721px) {
  .sec > .task--main { justify-self: center; width: min(100%, 640px); grid-template-columns: auto minmax(0, 1fr) auto; gap: 26px; padding: 46px 34px 30px; }
  .task--main .task__body { max-width: 30ch; }
}

/* the entry count is a square seal pressed into the paper */
.task__pts { border-radius: 5px; border-width: 2.5px; border-color: rgba(42, 30, 22, .78); transform: rotate(-3deg); }
.task--main .task__pts { border-radius: 5px; border-color: rgba(120, 28, 22, .7); background: rgba(168, 40, 31, .92); box-shadow: 0 0 0 2px rgba(58, 11, 9, .28) inset; }

/* quiet states (ended / not started / sorry) sit on a sheet too */
.quiet:not(.card) { position: relative; max-width: 560px; margin: 26px auto; background: var(--sheet) url(assets/img/paper-1.webp) 0 0 / 866px 568px; padding: 34px 14px 26px; transform: rotate(.4deg); transform-origin: 50% 0;
  box-shadow: var(--soft-edge), 0 26px 34px -8px rgba(0, 0, 0, .5); }
.card.quiet { padding: 30px 18px 22px; }
.notice { background: var(--sheet); color: var(--ink-b); box-shadow: 0 10px 20px rgba(0, 0, 0, .4); }
.login, .notify-row { max-width: 760px; width: 100%; justify-self: center; }

/* ── results: each prize is its own notice, side by side ───────── */
.win { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 40px 30px; }
.win > h2, .win > p { grid-column: 1 / -1; }
.prize { color: var(--ink-b); width: auto; margin: 6px 0; padding: 40px 24px 24px; animation: none; transform-origin: 50% 0; }
.win > .prize:nth-of-type(3n+1) { translate: -3px -10px; rotate: .6deg; }
.win > .prize:nth-of-type(3n+2) { translate: 3px 14px; rotate: -.5deg; }
.win > .prize:nth-of-type(3n)   { translate: -2px -4px; rotate: .4deg; }
.prize:not(.is-open) { animation: callBob 3.2s ease-in-out infinite; }
.prize::before { inset: -3px -5px; filter: url(#torn-b); border: 0; background: var(--sheet) url(assets/img/paper-1.webp) 0 0 / 866px 568px; transform: none !important;
  box-shadow: inset 0 0 0 2px rgba(168, 40, 31, .6), inset 0 0 34px rgba(168, 40, 31, .12), inset 0 0 30px rgba(150, 105, 50, .24), 0 26px 30px -10px rgba(0, 0, 0, .5); }
.prize.is-open::before { inset: -3px -5px; }
.prize .phead { padding-right: 0; flex-wrap: wrap; }
.prize .pkind { opacity: .7; }
.prize .hint { border-color: var(--ink-b); color: var(--ink-b); }
.prize:not(.is-open) .hint { animation: hintGlowB 1.8s ease-in-out infinite; }
@keyframes hintGlowB { 0%, 100% { background: transparent; color: var(--ink-b); } 50% { background: var(--ink-b); color: var(--sheet); } }
.prize .stamp { color: #a8281f; border-color: #a8281f; right: 14px; top: -12px; }
.prize code { background: #26201a; color: var(--sheet); }
.prize .after { color: var(--ink-soft); }
.enso { filter: none; }

/* ── arriving: the lights come up, the headline bleeds into focus, notices are pasted up one after another ── */
body.intro .hero__title { animation: inkIn 1.6s var(--ease) both; }
body.intro .hero__tag, body.intro .hero__sub { animation: fadeUp 1.2s var(--ease) .5s both; }
body.intro .card, body.intro .hero, body.intro .quiet:not(.card) { animation: pasteIn 1s var(--ease) backwards; animation-delay: calc(var(--n, 0) * 90ms + .15s); }
body.intro .fake { animation: fakeIn 1.6s ease both; animation-delay: calc(var(--n, 0) * 40ms); }
@keyframes inkIn { from { opacity: 0; filter: blur(10px); letter-spacing: .09em; } to { opacity: 1; filter: blur(0); letter-spacing: inherit; } }
@keyframes fadeUp { from { opacity: 0; translate: 0 10px; } to { opacity: 1; translate: 0 0; } }
@keyframes pasteIn { from { opacity: 0; scale: .955; } to { opacity: 1; scale: 1; } }
@keyframes fakeIn { from { opacity: 0; } to { opacity: 1; } }

/* ── narrower screens: fewer across, never a long single column unless the phone is tiny ── */
@media (max-width: 720px) { .sec { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 42px 22px; } }
@media (max-width: 560px) {
  .sec { gap: 40px 14px; }
  .card { padding: 22px 14px 16px; }
  .task:not(.task--main) { padding: 36px 14px calc(var(--pb) - 10px); gap: 8px; }
  .task:not(.task--main) .task__pts { width: 50px; height: 50px; right: 10px; top: -12px; }
  .task:not(.task--main) .task__pts b { font-size: 1.4rem; }
  .task:not(.task--main) .task__desc, .task:not(.task--main) .thumb { display: none; }
  .task:not(.task--main) .task__name { font-size: 1rem; }
  .task:not(.task--main) .btn { --h: 44px; padding: 0 1.2rem; font-size: 1rem; }
  .task--main { grid-template-columns: auto 1fr; grid-template-areas: "head head" "pts body" "act act"; gap: 14px; padding: 52px 16px 24px; min-height: 398px; }
  .task--main .tag { top: 12px; right: 14px; font-size: .74rem; }
  .hero { padding: 54px 14px 26px; }
  .hero::before { top: 10px; right: 12px; width: 30px; height: 30px; font-size: 19px; }   /* the stamp sits in the top corner, clear of the logo */
  .wall::before, .wall::after { height: 340px; background-size: 900px 360px; }
}
@media (max-width: 360px) { .sec { grid-template-columns: minmax(0, 1fr); } }

/* touch screens have no hover to pause the sway, so there the notices only animate in and then stay put */
@media (hover: none) {
  .card, .hero, .quiet:not(.card), .prize:not(.is-open) { animation: none; }
  body.intro .card, body.intro .hero, body.intro .quiet:not(.card) { animation-name: pasteIn; animation-iteration-count: 1; animation-direction: normal; animation-duration: 1s; animation-delay: calc(var(--n, 0) * 90ms + .15s); }
}

/* anyone who prefers less motion gets the same look, standing still */
@media (prefers-reduced-motion: reduce) {
  body::after, .wall::before, .wall::after, .mote, .card, .hero, .quiet, .fake, .prize { animation: none !important; }
  .motes { display: none; }
}

.sec > .coin-legend { margin: -14px 0 -4px; padding-left: 4px; }
