/* Hallmark · shape: a bento of project cards that open into sheets · genre: editorial · theme: custom · job: visit · idea: "each project is a card in its own colours that opens, in one motion, into its own sheet" · vibe: "Apple's App Store Today cards, three projects"
 * paper: oklch(96.9% 0.003 260) · accent: ink, each card in its project's colours (LUCK green and gold, Megasota navy and lake, Sherpa black and gold) · display: Inter Tight · body: Inter · hero: no headline by request; the cards are the first screen · nav: a glass bar, the owner's mark centred, Contact at the right · footer: one line · imagery: the owner's logos and brand art, LUCK's own chart, a real map · signature: a card that grows into its project's sheet, and Megasota's map annexing the country until it flies Minnesota's flag
 * axes: light/grotesk-heavy/neutral · posture: drenched cards on a quiet page · contrast: pass · fold: no headline by the owner's request; the cards fill the first screen · v2.0.0 */
/* Hallmark · pre-emit critique: P4 H5 E4 S4 R4 V5 · weakest: S, a bento can be anyone's; each card shows its project's own thing (LUCK's real figures counting up, Megasota's brand outline, the Sherpa mark) */
/* Hallmark · waive 1 · Inter Tight heads over Inter text, the type of the LUCK site at /luck · the main site and LUCK share one type family, so moving between them reads as one house */
/* Hallmark · waive 7b · --color-mask-on is the white of an SVG mask, never painted; anything less than pure white leaves the written name partly see-through */
/* Hallmark · waive 22 · the same mask white; a mask reads luminance, so it carries no hue */
/* Hallmark · answered F18 · no slots on this page; the owner's art fills every picture */
/* Hallmark · dismissed 29 · the glass bar and the blurred page behind an open sheet are the Apple look the owner asked for; neither is a glow behind text */
/* Hallmark · dismissed 77 · the owner asked for the projects at face value with no intro; the page is the cards, their sheets, and contact */
/* Hallmark · answered F15 · the card grid's gap, the sheet's two columns, and the contact split are three different compositions */
@import url("./tokens.css");
@import url("./base.css");

html { scroll-behavior: smooth; scroll-padding-top: var(--space-3xl); color-scheme: light; background: var(--color-under); scrollbar-color: var(--color-page-muted) var(--color-page); }
body { font-size: var(--text-md); background: var(--color-under); color: var(--color-page-ink); }
/* the page itself: when a sheet opens, it steps back, the way iOS sets one card behind another */
/* the page fills the window, and the footer keeps to its bottom edge however tall the window is */
.page { position: relative; isolation: isolate; min-height: 100dvh; display: flex; flex-direction: column; background: var(--color-page); transform-origin: 50% var(--sy, 0px);
  transition: transform 560ms var(--ease-sheet), border-radius 560ms var(--ease-sheet); }
/* the page dims and softens as it steps back; it does this itself, rather than under a scrim, so the change rides the same
   motion as the card growing into its sheet instead of arriving after it */
html.sheet-open .page { transform: scale(0.94); border-radius: var(--radius-sheet); overflow: clip; }
html.dragging .page { transition: none; }
::selection { color: var(--color-page-ink); }

.skip { position: absolute; left: var(--space-md); top: var(--space-xs); z-index: var(--z-modal); padding: var(--space-xs) var(--space-sm); background: var(--color-page-ink);
  color: var(--color-page); border-radius: var(--radius-pill); transform: translateY(-200%); }
.skip:focus-visible { transform: none; }

/* the bar: glass, the owner's mark at the centre */
.bar { position: sticky; top: 0; z-index: var(--z-sticky-nav); background: var(--color-glass); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); }
.bar-in { position: relative; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); height: 52px; display: flex; align-items: center; justify-content: flex-end; }
.logo { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: block; width: 30px; height: 30px; color: var(--color-page-ink); }
.logo svg { width: 100%; height: 100%; }
.logo:hover { opacity: 0.7; }
.bar-link { font-size: var(--text-sm); color: var(--color-page-ink); text-decoration: none; }
.bar-link:hover { color: var(--color-page-ink-2); }
.bar :focus-visible, .foot :focus-visible { outline-color: var(--color-focus-on-dark); }
.logo:active, .bar-link:active { opacity: 0.6; }

/* the canvas: a faint field of dots in the space around the cards, brighter where the pointer is */
.canvas { position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: radial-gradient(circle, var(--color-dot) 1px, transparent 1.5px); background-size: 24px 24px; background-position: center top;
  -webkit-mask-image: radial-gradient(ellipse 75% 65% at 50% 42%, var(--color-mask) 20%, transparent 80%); mask-image: radial-gradient(ellipse 75% 65% at 50% 42%, var(--color-mask) 20%, transparent 80%); }
.canvas::after { content: ""; position: absolute; inset: 0; opacity: var(--lit, 0); transition: opacity 600ms var(--ease-out);
  background-image: radial-gradient(circle, var(--color-dot-lit) 1.3px, transparent 1.8px); background-size: 24px 24px; background-position: center top;
  -webkit-mask-image: radial-gradient(circle 260px at var(--mx, 50%) var(--my, 40%), var(--color-mask), transparent); mask-image: radial-gradient(circle 260px at var(--mx, 50%) var(--my, 40%), var(--color-mask), transparent); }

/* the cards sit centred in the space between the header and the footer, whatever the window's height */
#main { flex: 1; display: flex; flex-direction: column; justify-content: center; }
/* the cards: four tiles, set in the middle of the page with room around them */
.grid { position: relative; max-width: calc(var(--container-cards) + 2 * var(--gutter)); display: grid; grid-template-columns: repeat(12, minmax(0, 1fr));
  /* sized so the header, both rows of cards, and the footer fit one screen: no scroll bar on a 1280 by 720 window */
  grid-auto-rows: clamp(220px, 31svh, 320px); gap: var(--space-card-gap); padding-block: clamp(16px, 3svh, 40px); }
.card { position: relative; display: flex; flex-direction: column; min-width: 0; overflow: hidden; border-radius: var(--radius-card); padding: var(--space-lg);
  text-decoration: none; color: inherit; isolation: isolate; box-shadow: var(--shadow-rest), inset 0 0 0 1px var(--color-edge);
  transform: perspective(1100px) translateY(var(--lift, 0px)) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) scale(var(--press, 1));
  transition: transform var(--dur-long) var(--ease-out), box-shadow var(--dur-long) var(--ease-out); }
/* a soft light that follows the pointer across the card, as if the card were a pane of glass */
.card::after { content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none; border-radius: inherit; opacity: 0; transition: opacity var(--dur-long) var(--ease-out);
  background: radial-gradient(circle 340px at var(--gx, 50%) var(--gy, 0%), var(--color-glare), transparent 70%); }
.card:hover { --lift: -4px; box-shadow: var(--shadow-lift), inset 0 0 0 1px var(--color-edge); }
.card:hover::after { opacity: 1; }
.card:active { --press: 0.985; }
.card:focus-visible { outline: 3px solid var(--color-focus-on-dark); outline-offset: 4px; }
.card-name { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.035em; line-height: 0.95; overflow-wrap: break-word; min-width: 0; }
.card-line { margin-top: var(--space-xs); font-size: var(--text-md); line-height: 1.35; max-width: 24ch; }

.card-luck { grid-column: 1 / span 5; grid-row: span 2; background: var(--color-luck); color: var(--color-luck-ink); padding: var(--space-xl) var(--space-xl) var(--space-lg); }
.luck-word svg { display: block; height: 0.75em; width: auto; max-width: 100%; margin-bottom: 0.12em; }
.wm-ink { fill: var(--color-luck-cream); }
.wm-dot { fill: var(--color-luck-gold); }
.card-luck .card-name { font-size: clamp(3.5rem, 6.4vw, 6.25rem); }
.card-luck .card-line { color: var(--color-luck-sub); font-size: var(--text-lead); }
.eq { margin-top: auto; padding-bottom: var(--space-2xl); display: flex; flex-wrap: wrap; align-items: flex-start; gap: 0 var(--space-sm); font-variant-numeric: tabular-nums; }
.eq-who { flex-basis: 100%; font-size: var(--text-sm); color: var(--color-luck-sub); margin-bottom: var(--space-xs); }
.eq-c { display: flex; flex-direction: column; align-items: center; }
.eq-n { font-family: var(--font-display); font-weight: 700; font-size: clamp(2rem, 3vw, 2.75rem); line-height: 1; letter-spacing: -0.03em; }
.eq-n.won { color: var(--color-luck-gold); }
.eq-n.luck { color: var(--color-luck-mint); }
.eq-l { margin-top: var(--space-xs); font-size: var(--text-sm); color: var(--color-luck-sub); }
.eq-op { font-family: var(--font-display); font-size: clamp(1.75rem, 2.4vw, 2.25rem); line-height: 1.15; color: var(--color-luck-sub); }

.card-mega { grid-column: 6 / span 7; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); grid-template-rows: auto 1fr; column-gap: var(--space-md);
  background: var(--color-mega-sky); color: var(--color-mega-ink); }
.mega-word { color: var(--color-mega-navy); text-transform: uppercase; letter-spacing: -0.02em; }
.card-mega .card-name { font-size: clamp(1.75rem, 2.6vw, 2.4rem); line-height: 1.02; grid-column: 1; white-space: nowrap; }
.card-mega .card-line { color: var(--color-mega-sub); grid-column: 1; align-self: start; }
.mega-art { grid-column: 2; grid-row: 1 / span 2; align-self: center; width: 108%; max-width: none; margin-left: -2%; filter: drop-shadow(var(--shadow-art));
  animation: drift 7s var(--ease-in-out) infinite alternate; }
@keyframes drift { from { transform: translateY(5px) rotate(-1deg); } to { transform: translateY(-6px) rotate(1deg); } }

.card-sherpa { grid-column: 6 / span 4; background: var(--color-sherpa); color: var(--color-sherpa-sub); }
.sherpa-word { color: var(--color-sherpa-gold); }
.card-sherpa .card-name { font-size: clamp(1.9rem, 2.7vw, 2.5rem); display: block; }
.card-sherpa .card-line { display: block; color: var(--color-sherpa-sub); max-width: 20ch; }
.sherpa-mark { display: block; flex: none; width: clamp(64px, 6.5vw, 88px); aspect-ratio: 1; color: var(--color-sherpa-gold); }
.card-sherpa .sherpa-text { margin-top: auto; }
/* Sherpa Caps is closed: a red badge that settles into the corner when the card is pointed at, and stays put on touch screens */
.closed { display: inline-flex; align-items: center; min-height: 26px; padding: 0 var(--space-sm); border-radius: 8px; background: var(--color-closed); color: var(--color-closed-ink);
  font-size: var(--text-xs); font-weight: 600; box-shadow: var(--shadow-closed); }
.card-sherpa .closed { position: absolute; top: var(--space-lg); right: var(--space-lg); z-index: 1; }
@media (hover: hover) {
  .js .card-sherpa .closed { opacity: 0; transform: translateY(-6px) scale(0.94); filter: blur(4px);
    transition: opacity 240ms var(--ease-out), transform 240ms var(--ease-out), filter 240ms var(--ease-out); }
  .js .card-sherpa:hover .closed { opacity: 1; transform: none; filter: none;
    transition: opacity 420ms var(--ease-sheet) 60ms, transform 520ms var(--ease-sheet) 60ms, filter 420ms var(--ease-sheet) 60ms; }
  .js .card-sherpa:focus-visible .closed { opacity: 1; transform: none; filter: none; transition: none; }
}
.closed-still { align-self: center; }

.sherpa-mark svg { width: 100%; height: 100%; overflow: visible; }

.card-contact { grid-column: 10 / span 3; background: var(--color-page-2); color: var(--color-page-ink); }
.card-contact .card-name { font-size: clamp(1.9rem, 2.7vw, 2.5rem); margin-top: auto; }
.card-contact .card-line { color: var(--color-page-ink-2); }
.contact-mark { display: block; width: 36px; height: 36px; color: var(--color-page-ink); }
.contact-mark svg { width: 100%; height: 100%; }


/* cards rise in, one after another */
.js .grid .card:not(.in) { opacity: 0; --lift: 28px; }
.js .grid .card { transition: transform 900ms var(--ease-out), opacity 700ms var(--ease-out), box-shadow var(--dur-long) var(--ease-out); transition-delay: calc(var(--i, 0) * 90ms); }
.js .grid .card.in:hover { transition-delay: 0ms; }

/* the sheets */
dialog.sheet { --sheet-bg: var(--color-paper-2); color-scheme: light; width: min(1180px, 100% - 2 * var(--space-lg)); max-width: none; height: calc(100dvh - var(--space-2xl)); max-height: none; margin: var(--space-2xl) auto 0; padding: 0; border: 0;
  border-radius: var(--radius-sheet) var(--radius-sheet) 0 0; background: var(--color-paper-2); color: var(--color-ink); overflow-y: auto; overscroll-behavior: contain; }
/* the sheet's scrollbar: a thin pill that sits inside the sheet, clear of its rounded top, and shows on any colour */
@supports selector(::-webkit-scrollbar) { dialog.sheet { scrollbar-color: auto; scrollbar-width: auto; } }
/* the gutter takes the colour beside it: the header's while the header is in view, then the page's */
dialog.sheet::-webkit-scrollbar { width: 14px;
  background: linear-gradient(transparent 0 var(--radius-sheet), var(--head-bg, var(--sheet-bg)) var(--radius-sheet) max(var(--radius-sheet), var(--head-vis, 0px)), var(--sheet-bg) 0); }
/* the scrollbar is not rounded with the sheet, so its top stays clear and the sheet's own corner shows through */
dialog.sheet { background: linear-gradient(var(--head-bg, var(--sheet-bg)) 0 min(var(--radius-sheet), var(--head-vis, 0px)), var(--sheet-bg) 0); }
dialog.sheet .sheet-body { background: var(--sheet-bg); }
dialog.sheet::-webkit-scrollbar-track { background: transparent; margin-block: var(--radius-sheet) var(--space-xs); }
dialog.sheet::-webkit-scrollbar-thumb { min-height: 56px; border: 4px solid transparent; border-radius: var(--radius-pill); background-clip: padding-box; background-color: var(--color-thumb);
  box-shadow: inset 0 0 0 1px var(--color-thumb-ring); }
dialog.sheet::-webkit-scrollbar-thumb:hover { background-color: var(--color-thumb-hover); }
dialog.sheet::-webkit-scrollbar-thumb:active { background-color: var(--color-thumb-active); }
dialog.sheet::-webkit-scrollbar-corner { background: transparent; }
@supports not selector(::-webkit-scrollbar) { dialog.sheet { scrollbar-width: thin; scrollbar-color: var(--color-thumb) transparent; } }
dialog.sheet:focus, dialog.sheet:focus-visible { outline: none; }
.sheet-luck { --head-bg: var(--color-luck); }
.sheet-mega { --head-bg: var(--color-mega-sky); }
.sheet-sherpa { --head-bg: var(--color-sherpa); }
/* behind an open sheet, a dark veil that also softens the page; it fades in on its own animation, which runs live
   while the card grows (a GPU-composited fade of one layer, never a redraw of the page itself) */
dialog.sheet::backdrop { background: var(--color-scrim); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
dialog.sheet[open]::backdrop { animation: veil 640ms var(--ease-in-out) both; }
dialog.sheet.closing { pointer-events: none; }
@property --veil { syntax: '<number>'; inherits: true; initial-value: 0; }
@keyframes veil { from { opacity: 0; } }
/* pulled down, the veil lifts with the pull */
dialog.sheet::backdrop { opacity: calc(1 - var(--veil, 0)); }
html:not(.js) dialog.sheet { display: block; position: static; height: auto; margin: var(--space-2xl) auto 0; border-radius: var(--radius-sheet); }
.sheet-head { position: relative; padding: var(--space-3xl) var(--space-2xl) var(--space-2xl); }
.sheet-head h2 { font-size: clamp(3.5rem, 8vw, 7.5rem); line-height: 0.95; letter-spacing: -0.035em; font-weight: 700; }
.sheet-lede { margin-top: var(--space-md); font-size: var(--text-lead); line-height: 1.35; max-width: 36ch; }
.sheet-body { padding: var(--space-2xl); }
/* closing: a plain word in a frosted pill that stays put as the sheet scrolls, or a pull down on the grabber */
.close { position: sticky; float: right; top: var(--space-md); z-index: var(--z-raised); margin: calc(-1 * var(--space-2xl) - var(--space-xs)) calc(-1 * var(--space-lg)) 0 0; min-height: 36px;
  padding: 0 var(--space-md); border: 0; border-radius: var(--radius-pill); cursor: pointer; font: inherit; font-size: var(--text-sm); font-weight: 600;
  background: var(--close-bg); color: var(--close-ink); -webkit-backdrop-filter: blur(14px) saturate(160%); backdrop-filter: blur(14px) saturate(160%);
  transition: background-color var(--dur-short) var(--ease-out), transform var(--dur-short) var(--ease-out); }
.close:hover { background: var(--close-bg-hover); }
.close:active { transform: scale(0.96); }
.grab { position: absolute; top: 0; left: 50%; z-index: var(--z-raised); width: 160px; height: 30px; transform: translateX(-50%); cursor: grab; touch-action: none; }
.grab::before { content: ""; position: absolute; left: 50%; top: 11px; width: 40px; height: 5px; border-radius: var(--radius-pill); transform: translateX(-50%); background: var(--close-ink); opacity: 0.35;
  transition: opacity var(--dur-short) var(--ease-out); }
.grab:hover::before { opacity: 0.6; }
dialog.sheet.at-top { touch-action: pan-x pan-down; }
dialog.sheet.dragging { transition: none; user-select: none; }
dialog.sheet.dragging .grab { cursor: grabbing; }
dialog.sheet.settle { transition: transform 500ms var(--ease-sheet); }
html:not(.js) .grab { display: none; }
html:not(.js) .close { display: none; }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-lg); margin-top: var(--space-xl); }
.btn { display: inline-flex; align-items: center; min-height: 48px; padding-inline: var(--space-lg); border: 0; border-radius: var(--radius-pill); font: inherit; font-weight: 600; text-decoration: none;
  white-space: nowrap; cursor: pointer; background: var(--btn-bg); color: var(--btn-ink); transition: transform var(--dur-short) var(--ease-out), opacity var(--dur-short) var(--ease-out); }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: none; opacity: 0.8; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.link { font-weight: 600; text-decoration: underline; text-underline-offset: 0.2em; white-space: nowrap; }
.link:active { opacity: 0.7; }

.sheet-luck { --close-bg: var(--color-frost); --close-bg-hover: var(--color-frost-hover); --close-ink: var(--color-luck-ink); }
.sheet-luck .sheet-head { background: var(--color-luck); color: var(--color-luck-ink); --btn-bg: var(--color-luck-gold); --btn-ink: var(--color-luck-gold-ink); }
.sheet-luck .sheet-lede { color: var(--color-luck-sub); }
.sheet-luck .link { color: var(--color-luck-ink); }
.sheet-luck :focus-visible { outline-color: var(--color-luck-gold); }
/* LUCK's chart, drawn as LUCK draws it */
.chart { margin: 0; padding: var(--space-lg) var(--space-lg) var(--space-md); border-radius: var(--radius-shot); background: var(--color-paper-2); box-shadow: var(--shadow-panel); }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; font-family: var(--font-body); }
.chart-narrow { display: none !important; }
.chart text { fill: var(--color-ink-2); font-size: 12px; }
.chart .gl { stroke: var(--color-rule); stroke-width: 1; }
.chart .fair { stroke: var(--color-ink); stroke-width: 1; stroke-dasharray: 3 5; }
.chart .dot { fill: var(--color-muted); }
.chart .dot.up { fill: var(--color-luck-dot); }
.chart .lead { stroke: var(--color-muted); stroke-width: 1; }
.chart .lab { font-weight: 500; fill: var(--color-ink); }
.chart .lab-h { font-weight: 500; fill: none; stroke: var(--color-paper-2); stroke-width: 4px; stroke-linejoin: round; }
.chart .labl:hover .lab, .chart .labl:focus-visible .lab { text-decoration: underline; text-underline-offset: 3px; }
.chart .labl:focus-visible { outline: none; }
.chart .labl:active .lab { fill: var(--color-ink-2); }
.chart figcaption { margin-top: var(--space-md); font-size: var(--text-sm); color: var(--color-ink-2); max-width: 60ch; }
/* when the sheet opens, the dots land one after another and the names follow */
.js .chart .dot { transform: scale(0); transform-box: fill-box; transform-origin: center; transition: transform 700ms var(--ease-spring) calc(var(--i, 0) * 55ms + 250ms); }
.js .chart :is(.lab, .lab-h, .lead, .fairt) { opacity: 0; transition: opacity 500ms var(--ease-out) calc(var(--i, 0) * 55ms + 650ms); }
.js .chart .fair { stroke-dashoffset: 400; opacity: 0; transition: opacity 900ms var(--ease-out) 150ms; }
.js .chart.in .dot { transform: none; }
.js .chart.in :is(.lab, .lab-h, .lead, .fairt, .fair) { opacity: 1; }

.sheet-mega { --close-bg: var(--color-navy-frost); --close-bg-hover: var(--color-navy-frost-hover); --close-ink: var(--color-mega-navy); --btn-bg: var(--color-mega-navy); --btn-ink: var(--color-mega-sky); }
.sheet-mega .sheet-head { background: var(--color-mega-sky); color: var(--color-mega-ink); }
.sheet-mega .sheet-lede { color: var(--color-mega-sub); }
.mega-body { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: var(--space-xl); align-items: center; }
.mega-actions { grid-column: 1; margin-top: 0; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2xs); grid-row: 1; }
.steps button { width: 100%; min-height: 48px; display: flex; align-items: baseline; gap: var(--space-sm); padding: var(--space-xs) var(--space-md); border: 0; border-radius: var(--space-sm);
  background: none; color: var(--color-mega-sub); font-size: var(--text-lg); text-align: left; cursor: pointer; transition: opacity var(--dur-short) var(--ease-out); }
.steps .step-n { font-size: var(--text-sm); min-width: 4.5em; }
.steps button { position: relative; overflow: hidden; }
/* while the steps play by themselves, a thin line fills under the current one */
.steps.auto button[aria-pressed="true"]::after { content: ""; position: absolute; left: var(--space-md); right: var(--space-md); bottom: 7px; height: 2px; border-radius: 1px;
  background: var(--color-mega-navy); opacity: 0.45; transform-origin: left center; animation: fillbar var(--auto, 6000ms) linear both; }
@keyframes fillbar { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.map.instant, .map.instant * { transition: none !important; animation: none !important; }
.steps button:hover { color: var(--color-mega-navy); }
.steps button[aria-pressed="true"] { background: var(--color-mega-sky); color: var(--color-mega-navy); font-weight: 600; }
.steps button:active { opacity: 0.75; }
.steps button:disabled { opacity: 0.4; cursor: not-allowed; }
.steps :focus-visible { outline-color: var(--color-mega-navy); }

/* the map: Megasota's outline, then the Midwest, then everything, then the whole country under Minnesota's flag */
.map { margin: 0; grid-column: 2; grid-row: 1 / span 2; }
.map svg { width: 100%; height: auto; overflow: hidden; }
.map .world { transform-origin: 0 0; transform: translate(var(--tx1), var(--ty1)) scale(var(--k1)); transition: transform var(--dur-map) var(--ease-in-out) var(--hold, 0ms); }
.map[data-step="2"] .world { transform: translate(var(--tx2), var(--ty2)) scale(var(--k2)); }
.map[data-step="3"] .world, .map[data-step="4"] .world { transform: none; }
.map .outline { fill: none; stroke: var(--color-mega-line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.map .borders { transition: opacity 400ms var(--ease-out) var(--hold, 0ms); }
/* step 4: the borders stay over the flag as it takes over, then dissolve into grains (app.js runs the filter) while
   the flag's edge straightens beneath them */
.map[data-step="4"] .borders { filter: url(#mg-dissolve); }
.map .take { fill: var(--color-mega-lake); stroke: var(--color-mega-line); stroke-width: 0.6; vector-effect: non-scaling-stroke; opacity: 0; transform-box: fill-box; transform-origin: center;
  transition: opacity 500ms var(--ease-out) calc(var(--d, 0) * 1ms), fill 300ms var(--ease-out); }
.map[data-step="1"] .s1, .map[data-step="2"] :is(.s1, .s2), .map[data-step="3"] .take, .map[data-step="4"] .take { opacity: 1; }
/* going back a step: everything leaves together and quickly, so nothing trails behind the zoom. Leaving step 4, the
   navy first drains back toward Minnesota, the flood in reverse, and only then does the map zoom or fade */
.map[data-dir="back"] .take { transition: opacity 700ms var(--ease-in-out) var(--hold, 0ms), fill 320ms var(--ease-in-out) calc(var(--b, 0) * 1ms); }
.map[data-dir="back"][data-from="4"] { --hold: 520ms; }
/* Minnesota is navy at every step */
.map #mg-27 { fill: var(--color-mega-navy); }
.map .navy-fill { fill: var(--color-mega-navy); }
.map .lake-fill { fill: var(--color-mega-lake); }
.map .star { fill: var(--color-paper-2); }
.map .brand { transition: opacity 500ms var(--ease-out) var(--hold, 0ms); }
/* step 4: the flag spreads state by state, each piece lifting into place. The states turn whole, so the colours meet
   along state borders; then every piece reaching across the chevron folds flat into it, leaving the exact flag, the
   star turns in, and the name is written on */
.map[data-step="4"] .brand { opacity: 0; }
.map[data-step="4"] .take { transition: opacity 300ms var(--ease-out), fill 260ms var(--ease-out) calc(var(--f) * 1ms); animation: piece 620ms var(--ease-out) calc(var(--f) * 1ms) both; }
.map[data-step="4"] .take.navy { fill: var(--color-mega-navy); }
@keyframes piece { 0% { transform: none; } 35% { transform: translateY(-3%) scale(1.07); } 100% { transform: none; } }
.map .f-half { opacity: 0; transition: opacity 160ms var(--ease-out); }
/* the flag takes over from the states in the same frame, and starts exactly as they are: the navy's edge is the
   states' own edge. app.js then straightens that edge into the chevron, overhangs first; the star and the name
   follow once it is straight */
.map[data-step="4"] .f-half { opacity: 1; transition: opacity 0s linear calc(var(--settle) * 1ms); }
html:not(.js) .map .flag { display: none; }
.js .map .f-star { opacity: 0; transform: scale(0.2) rotate(-135deg); transform-box: fill-box; transform-origin: center; transition: opacity 200ms var(--ease-out), transform 300ms var(--ease-out); }
.js .map[data-step="4"] .f-star { opacity: 1; transform: none; transition: opacity 300ms var(--ease-out) calc(var(--settle) * 1ms + 1850ms), transform 1100ms var(--ease-spring) calc(var(--settle) * 1ms + 1850ms); }
.map .f-word { opacity: 0; transition: opacity 260ms var(--ease-out); }
.map[data-step="4"] .f-word { opacity: 1; transition: none; }
.map .w-word { fill: var(--color-paper-2); }
.map .w-done { fill: var(--color-mask-on); opacity: 0; transition: opacity 0s linear 280ms; }
.map :is(.w-pen, .w-ink) path { fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1 1; stroke-dashoffset: 1; opacity: 0; }
.map .w-pen path { stroke: var(--color-mega-lake); stroke-width: 26; }
.map .w-ink path { stroke: var(--color-mask-on); stroke-width: 175; }
/* the pen goes first along each letter, the letter inks in a moment behind it, then it settles to the exact outline */
.map[data-step="4"] .w-pen path { animation: pen calc(var(--wt) * 1ms) var(--ease-in-out) calc(var(--settle) * 1ms + 2400ms + var(--wd) * 1ms) both; }
.map[data-step="4"] .w-ink path { animation: pen calc(var(--wt) * 1ms) var(--ease-in-out) calc(var(--settle) * 1ms + 2560ms + var(--wd) * 1ms) both; }
.map[data-step="4"] .w-done { opacity: 1; transition: opacity 300ms var(--ease-out) calc(var(--settle) * 1ms + 2600ms + var(--wend) * 1ms); }
@keyframes pen { 0% { stroke-dashoffset: 1; opacity: 0; } 0.5% { opacity: 1; } 100% { stroke-dashoffset: 0; opacity: 1; } }

dialog.sheet-sherpa { --sheet-bg: var(--color-sherpa); color-scheme: dark; color: var(--color-sherpa-sub); --close-bg: var(--color-frost); --close-bg-hover: var(--color-frost-hover); --close-ink: var(--color-sherpa-gold); }
.sheet-sherpa :focus-visible { outline-color: var(--color-sherpa-gold); }
.sheet-sherpa .sheet-head { background: var(--color-sherpa); color: var(--color-sherpa-sub); }
.sheet-sherpa .sheet-body { padding-top: 0; }
.sherpa-body { border-top: 1px solid var(--color-sherpa-2); padding-top: var(--space-xl); }
.sherpa-row { display: flex; align-items: center; gap: var(--space-xl); }
.sheet-sherpa h2 { color: var(--color-sherpa-gold); }
.sheet-mark { width: clamp(96px, 12vw, 160px); }
.sherpa-body p { font-size: var(--text-lead); line-height: 1.5; max-width: 60ch; }
.sherpa-body p + p { margin-top: var(--space-md); }

/* contact: a small sheet of its own */
dialog.sheet-contact { width: min(620px, 100% - 2 * var(--space-lg)); height: fit-content; max-height: calc(100dvh - 2 * var(--space-xl)); margin: auto; border-radius: var(--radius-sheet);
  --sheet-bg: var(--color-page-2); color-scheme: light; color: var(--color-page-ink); --btn-bg: var(--color-page-ink); --btn-ink: var(--color-page);
  --close-bg: var(--color-ink-frost); --close-bg-hover: var(--color-ink-frost-hover); --close-ink: var(--color-page-ink); box-shadow: inset 0 0 0 1px var(--color-edge); }
.sheet-contact :focus-visible { outline-color: var(--color-focus-on-dark); }
.sheet-contact .field label { color: var(--color-page-ink-2); }
.sheet-contact .field input, .sheet-contact .field textarea { background: var(--color-paper-2); color: var(--color-page-ink); border-color: var(--color-page-muted); }
.sheet-contact .field input:hover, .sheet-contact .field textarea:hover { border-color: var(--color-page-ink-2); }
.sheet-contact .form-state { color: var(--color-page-ink-2); }
.sheet-contact .sheet-head { padding: var(--space-xl) var(--space-xl) 0; }
.sheet-contact .sheet-head h2 { font-size: var(--text-display-s); }
.sheet-contact .sheet-lede { font-size: var(--text-md); color: var(--color-page-ink-2); }
.sheet-contact .close { margin: calc(-1 * var(--space-md)) calc(-1 * var(--space-md)) 0 0; }
.sheet-contact .sheet-body { padding: var(--space-lg) var(--space-xl) var(--space-xl); }
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-md) var(--space-md); }
.field { display: grid; gap: var(--space-xs); }
.field-wide { grid-column: 1 / -1; }
.field label { font-size: var(--text-sm); color: var(--color-ink-2); }
.field input, .field textarea { width: 100%; min-height: 48px; padding: var(--space-sm) var(--space-md); border: var(--rule-hair) solid var(--color-muted); border-radius: var(--space-sm);
  background: var(--color-paper-2); color: var(--color-ink); font: inherit; }
.field textarea { resize: vertical; min-height: 9rem; }
.field input:hover, .field textarea:hover { border-color: var(--color-ink-2); }
.field input:focus-visible, .field textarea:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 1px; }
.field input[aria-invalid="true"], .field textarea[aria-invalid="true"] { border-color: var(--color-error); }
.field input:disabled, .field textarea:disabled { opacity: 0.5; cursor: not-allowed; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.form-foot { grid-column: 1 / -1; display: flex; align-items: center; gap: var(--space-lg); }
.form-state { font-size: var(--text-sm); color: var(--color-ink-2); min-height: 1lh; }
.form-state.bad { color: var(--color-error); }
.form-state.good { color: var(--color-success); }
.btn-ink:focus-visible { outline-offset: 3px; }

.foot { margin-top: auto; padding-block: var(--space-md) var(--space-lg); font-size: var(--text-sm); color: var(--color-page-ink-2); }


@media (max-width: 60rem) {
  .grid { grid-auto-rows: auto; }
  .card-luck, .card-mega { grid-column: 1 / -1; grid-row: auto; }
  .card-luck { min-height: 460px; }
  .card-mega { min-height: 300px; }
  .card-sherpa { grid-column: 1 / span 7; min-height: 260px; }
  .card-contact { grid-column: 8 / span 5; min-height: 260px; }
  .mega-body { grid-template-columns: minmax(0, 1fr); }
  .map { grid-column: 1; grid-row: auto; }
  .steps { grid-row: auto; }
  .mega-actions { grid-column: 1; }
}
@media (max-width: 40rem) {
  .grid { padding-top: var(--space-lg); }
  .card { padding: var(--space-lg); }
  .card-luck { padding: var(--space-lg); min-height: 420px; }
  .card-sherpa, .card-contact { grid-column: 1 / -1; min-height: 220px; }
  .card-mega { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto 1fr; }
  .mega-art { grid-column: 1; grid-row: 3; width: 100%; margin: var(--space-md) 0 var(--space-xl); }
  .form { grid-template-columns: minmax(0, 1fr); }
  .sheet-head { padding: var(--space-2xl) var(--space-lg) var(--space-xl); }
  .sheet-body { padding: var(--space-lg); }
  dialog.sheet { width: 100%; margin-top: var(--space-lg); height: calc(100dvh - var(--space-lg)); }
  dialog.sheet-contact { width: calc(100% - 2 * var(--space-sm)); height: fit-content; margin: auto; }
  .sheet-contact .sheet-head { padding: var(--space-lg) var(--space-lg) 0; }
  .sheet-contact .sheet-body { padding: var(--space-md) var(--space-lg) var(--space-lg); }
  .sherpa-row { flex-direction: column; align-items: flex-start; }
  .closed-still { align-self: flex-start; }
  /* on a phone the sheets are set a size smaller, so a sheet's coloured head is a band, not a screenful */
  .sheet-head h2 { font-size: clamp(2.25rem, 11vw, 3rem); }
  .sheet-head { padding: calc(var(--space-xl) + var(--space-md)) var(--space-lg) var(--space-lg); }
  .sheet-lede { font-size: var(--text-md); margin-top: var(--space-sm); }
  .actions { margin-top: var(--space-lg); gap: var(--space-md); }
  .btn { min-height: 44px; }
  .close { margin-right: 0; }
  .steps button { font-size: var(--text-md); min-height: 44px; }
  .steps .step-n { font-size: var(--text-xs); }
  .sheet-mark { width: 64px; }
  .sherpa-body { padding-top: var(--space-lg); }
  .sherpa-body p { font-size: var(--text-md); }
  .chart { padding: var(--space-md); }
  .chart-wide { display: none !important; }
  .chart-narrow { display: block !important; }
}
/* plain pages: privacy (a document card, set like a legal page) and not-found */
.doc { max-width: 880px; margin-inline: auto; padding: clamp(48px, 10svh, 112px) var(--space-lg) var(--space-3xl); min-height: calc(100svh - 52px - 120px); }
.doc h1 { font-family: var(--font-display); font-size: var(--text-display-s); line-height: 1; letter-spacing: -0.035em; font-weight: 700; color: var(--color-page-ink); }
.doc p { margin-top: var(--space-md); font-size: var(--text-lg); line-height: 1.5; color: var(--color-page-ink-2); max-width: 58ch; }
.doc a { color: var(--color-page-ink); text-decoration: underline; text-underline-offset: 0.2em; }
.doc a:hover { text-decoration-thickness: 2px; }
.doc a:active { opacity: 0.7; }
.doc a:focus-visible { outline: 2px solid var(--color-focus-on-dark); outline-offset: 3px; }
.doc-card { border-radius: var(--radius-card); background: var(--color-page-2); box-shadow: var(--shadow-rest), inset 0 0 0 1px var(--color-edge);
  padding: clamp(28px, 5vw, 56px); }
.doc-head { padding-bottom: var(--space-xl); border-bottom: 1px solid var(--color-page-rule); }
.doc .doc-lede { font-size: var(--text-lead); line-height: 1.35; color: var(--color-page-ink); max-width: 34ch; }
.doc .doc-date { margin-top: var(--space-sm); font-size: var(--text-sm); }
.doc-sec { display: grid; grid-template-columns: minmax(0, 13rem) minmax(0, 1fr); column-gap: var(--space-xl); padding-block: var(--space-lg);
  border-bottom: 1px solid var(--color-page-rule); }
.doc-sec:last-child { border-bottom: 0; padding-bottom: 0; }
.doc-sec h2 { font-size: var(--text-md); font-weight: 600; line-height: 1.5; color: var(--color-page-ink); }
.doc-sec p { margin-top: 0; font-size: var(--text-md); }
@media (max-width: 40rem) { .doc-sec { grid-template-columns: minmax(0, 1fr); } .doc-sec p { margin-top: var(--space-xs); } }
.sheet-lede a { color: inherit; text-decoration: underline; text-underline-offset: 0.2em; }
.sheet-lede a:active { opacity: 0.7; }

/* phones and small tablets: the cards become widgets, two wide and two square, all on one screen with no scrolling */
@media (max-width: 60rem) {
  .grid { --g: 14px; --pad: 16px; --w: min(100vw - 2 * var(--pad), 560px);
    --row: min((var(--w) - var(--g)) / 2, (100svh - 52px - 2 * var(--g) - 2 * var(--space-xl)) / 3);
    max-width: calc(var(--w) + 2 * var(--pad)); padding: var(--space-md) var(--pad); min-height: calc(100svh - 52px); align-content: center;
    grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: var(--row); gap: var(--g); }
  .card { min-height: 0 !important; padding: clamp(14px, 4.4vw, 22px); border-radius: clamp(20px, 6vw, 28px); }
  .card-line { font-size: clamp(0.75rem, 3.3vw, 0.9375rem); line-height: 1.3; margin-top: var(--space-2xs); }
  .card-luck, .card-mega { grid-column: 1 / -1; grid-row: auto; }
  .card-sherpa { grid-column: 1; }
  .card-contact { grid-column: 2; }
  /* LUCK, a wide widget: name and line at the top, Jordan's figures along the bottom */
  .card-luck .card-name { font-size: clamp(2rem, 10vw, 3.25rem); }
  .card-luck .card-line { font-size: clamp(0.75rem, 3.3vw, 0.9375rem); max-width: none; }
  .eq { padding-bottom: 0; gap: 0 var(--space-xs); }
  .eq-who { font-size: 0.6875rem; margin-bottom: 0; }
  .eq-n { font-size: clamp(1.35rem, 6vw, 2rem); }
  .eq-op { font-size: clamp(1.15rem, 5vw, 1.6rem); }
  .eq-l { font-size: 0.6875rem; margin-top: var(--space-3xs); }
  /* Megasota, a wide widget: words at the left, the outline at the right */
  .card-mega { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); grid-template-rows: auto 1fr; }
  .card-mega .card-name { font-size: clamp(1.25rem, 6vw, 2rem); }
  .mega-art { grid-column: 2; grid-row: 1 / span 2; justify-self: center; width: 96%; margin: 0; }
  /* Sherpa Caps and Contact, small square widgets: the mark at the top, the name at the bottom */
  .sherpa-mark { width: clamp(36px, 11vw, 56px); }
  .card-sherpa .card-name, .card-contact .card-name { font-size: clamp(1.2rem, 5.6vw, 1.75rem); }
  .card-sherpa .card-line, .card-contact .card-line { display: none; }
  .card-sherpa .closed { top: clamp(12px, 3.8vw, 18px); right: clamp(12px, 3.8vw, 18px); min-height: 22px; padding: 0 var(--space-xs); }
  .contact-mark { width: clamp(24px, 7vw, 32px); height: clamp(24px, 7vw, 32px); }
  .foot { display: none; }
}
/* wide screens: each project's sheet is a panel sized to the window, so it is seen whole without scrolling */
@media (min-width: 60.0625rem) {
  html.js dialog.sheet:where(:not(.sheet-contact)) { height: fit-content; max-height: calc(100dvh - 2 * var(--space-xl)); margin: auto; border-radius: var(--radius-sheet);
    background: var(--sheet-bg); width: min(1100px, 100% - 2 * var(--space-2xl)); }
  html.js dialog.sheet:where(:not(.sheet-contact)) .sheet-head { position: static; padding: var(--space-xl); }
  html.js dialog.sheet:where(:not(.sheet-contact)) .close { position: absolute; float: none; top: var(--space-md); right: var(--space-md); margin: 0; }
  html.js dialog.sheet:where(:not(.sheet-contact)) .sheet-lede { font-size: var(--text-lg); }
  /* LUCK: the green panel at the left, the chart beside it */
  html.js dialog.sheet-luck { --close-bg: var(--color-ink-frost); --close-bg-hover: var(--color-ink-frost-hover); --close-ink: var(--color-ink); }
  html.js dialog.sheet-luck[open] { display: grid; grid-template-columns: minmax(0, 19rem) minmax(0, 1fr); }
  html.js dialog.sheet-luck .sheet-head { display: flex; flex-direction: column; }
  html.js dialog.sheet-luck .sheet-head h2 { font-size: 4.5rem; }
  html.js dialog.sheet-luck .actions { margin-top: auto; padding-top: var(--space-xl); }
  html.js dialog.sheet-luck .sheet-body { align-self: center; padding: var(--space-2xl) var(--space-xl) var(--space-xl); }
  /* Megasota: the name and the pitch in one band, the plan and the map below */
  html.js dialog.sheet-mega .sheet-head { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: end; column-gap: var(--space-xl); padding-bottom: var(--space-lg); }
  html.js dialog.sheet-mega .sheet-head h2 { font-size: 4.25rem; }
  html.js dialog.sheet-mega .sheet-lede { margin: 0; max-width: 40ch; }
  html.js dialog.sheet-mega .sheet-body { padding: var(--space-lg) var(--space-xl) var(--space-xl); }
  /* Sherpa Caps: a short note, so a narrow panel */
  html.js dialog.sheet-sherpa { width: min(720px, 100% - 2 * var(--space-2xl)); }
  html.js dialog.sheet-sherpa .sheet-head { padding-bottom: var(--space-lg); }
  html.js dialog.sheet-sherpa .sherpa-row { gap: var(--space-lg); }
  html.js dialog.sheet-sherpa .sheet-mark { width: 72px; }
  html.js dialog.sheet-sherpa .sheet-head h2 { font-size: 3.25rem; }
  html.js dialog.sheet-sherpa .sherpa-body { padding: var(--space-lg) var(--space-xl) var(--space-xl); }
  html.js dialog.sheet-sherpa .sherpa-body p { font-size: var(--text-lg); }
}

/* opening: the sheet grows out of the card (app.js), and its words and figures rise into place as it does */
@media (prefers-reduced-motion: no-preference) {
  dialog.sheet[open] :is(.sheet-lede, .actions, .sheet-body > :not(.steps), .steps li) { animation: rise 640ms var(--ease-out) both; animation-delay: 140ms; }
  dialog.sheet[open] .sheet-body > :nth-child(2), dialog.sheet[open] .steps li:nth-child(2), dialog.sheet[open] .sherpa-body > p:nth-child(2) { animation-delay: 200ms; }
  dialog.sheet[open] .sheet-body > :nth-child(3), dialog.sheet[open] .steps li:nth-child(3), dialog.sheet[open] .sherpa-body > p:nth-child(3) { animation-delay: 260ms; }
  dialog.sheet[open] .steps li:nth-child(4) { animation-delay: 320ms; }
  dialog.sheet[open] .actions { animation-delay: 200ms; }
  dialog.sheet[open] .sheet-body > .chart, dialog.sheet[open] .sheet-body > .map { animation-delay: 120ms; }
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@media (prefers-reduced-motion: reduce) {
  .mega-art { animation: none; }
  .card, .js .grid .card, .btn, .closed, .page, .map *, .js .chart *, .canvas::after, dialog.sheet { transition: none !important; animation: none !important; }
  .card { --rx: 0deg !important; --ry: 0deg !important; }
  /* without motion the page still dims gradually, a plain fade */
  dialog.sheet[open]::backdrop { animation: veil 300ms linear both !important; }
  .map[data-step="4"] .w-done { opacity: 1; }
  .card:hover { transform: none; }
}
