/* RALF RINGER 30 — portal styles. Mobile-first; one rule per concern, no override layers.
   Type scale: body copy 16px, everything else at least 14px. Touch targets at least 44px. */

/* ---------- Tokens ---------- */
:root {
  --bg: #0b1f35; --surface: #122d47; --text: #f0f7fc; --muted: #a6bfd2; --line: #2c4862;
  --accent: #0099ba; --accent-hover: #28afc9; --accent-ink: #062135;
  --card: #163550; --input: #102b43; --soft: #89abc5; --error: #ffa89b;
  --display: 'Manrope', Arial, sans-serif;
  --gutter: clamp(20px, 6vw, 108px);
  --header-h: 74px;
  --page: min(100% - 2 * var(--gutter), 1800px);
  /* layering: globe < pins < story card < active pin < header < toast */
  --z-pin: 1; --z-card: 2; --z-pin-active: 3; --z-header: 4; --z-dropdown: 5; --z-toast: 10; --z-skip: 11;
  color-scheme: dark;
}
:root[data-theme=light] {
  --bg: #eff5fa; --surface: #e1edf6; --text: #0b1f35; --muted: #4d6880; --line: #c0d2e1;
  --accent: #005e7d; --accent-hover: #00475f; --accent-ink: #f3f9fc;
  --card: #f8fbfe; --input: #f8fbfe; --soft: #547a99; --error: #a3321f;
  color-scheme: light;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 24px; scrollbar-color: var(--line) var(--bg); }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--display); font-size: 16px; font-weight: 400; line-height: 1.5; -webkit-font-smoothing: antialiased; }
p, h1, h2, h3, ol, ul { margin: 0; }
ol, ul { padding: 0; list-style: none; }
img { display: block; max-width: 100%; object-fit: cover; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { border: 0; background: none; padding: 0; color: inherit; cursor: pointer; transition: background .2s, color .2s, transform .2s, opacity .2s; }
button:disabled { cursor: wait; opacity: .6; }
button:active:not(:disabled) { transform: scale(.98); }
button, a { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
::selection { background: var(--accent); color: var(--accent-ink); }
input, textarea { caret-color: var(--accent); accent-color: var(--accent); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip { position: fixed; top: 10px; left: 10px; z-index: var(--z-skip); padding: 12px 16px; background: var(--text); color: var(--bg); transform: translateY(-150%); }
.skip:focus { transform: none; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ic { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Controls ---------- */
.button { display: inline-flex; align-items: center; justify-content: space-between; gap: 28px; min-height: 52px; padding: 0 26px; border-radius: 50px; font-size: 14px; font-weight: 600; white-space: nowrap; }
.button .ic { font-size: 20px; }
.primary { background: var(--accent); color: var(--accent-ink); }
.primary:hover { background: var(--accent-hover); }
.secondary { border: 1px solid var(--line); color: var(--text); }
.secondary:hover { background: var(--surface); }
.full { width: 100%; }
.icon-button { display: inline-grid; place-items: center; width: 44px; height: 44px; flex: none; border: 1px solid var(--line); border-radius: 50%; font-size: 20px; }
.icon-button:hover:not(:disabled) { background: var(--surface); border-color: var(--muted); }
.icon-button:disabled { cursor: default; opacity: .4; }
.text-button { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 2px; color: var(--muted); font-size: 14px; }
.text-button:hover { color: var(--text); }
.text-link { display: inline-flex; align-items: center; gap: 24px; min-height: 44px; border-bottom: 1px solid var(--line); font-size: 14px; }
.text-link:hover { border-color: var(--muted); }
.inline-link { padding: 0; border-bottom: 1px solid currentColor; color: var(--text); font-size: inherit; }

/* ---------- Header ---------- */
.site-header { position: relative; z-index: var(--z-header); display: flex; align-items: center; gap: 16px; width: min(100% - 9vw, 1800px); height: var(--header-h); margin: 0 auto; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; min-height: 44px; }
.brand img, footer img { width: 115px; height: auto; filter: brightness(0) invert(1); }
:root[data-theme=light] .brand img, :root[data-theme=light] footer img { filter: brightness(0); }
.anniversary { display: none; align-items: center; gap: 8px; padding-left: 24px; border-left: 1px solid var(--line); }
.anniversary strong { font-size: 37px; font-weight: 600; letter-spacing: -3px; line-height: 1; }
.anniversary span { font-size: 14px; line-height: 1.25; letter-spacing: 1px; }
.site-header nav { display: flex; align-items: center; gap: 16px; margin-left: auto; font-size: 14px; }
.site-header nav a { position: relative; display: inline-flex; align-items: center; min-height: 44px; padding: 0 2px; color: var(--muted); }
.site-header nav a:hover, .site-header nav a.active { color: var(--text); }
.site-header nav a.active::after { content: ''; position: absolute; left: 50%; bottom: 6px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--accent); }
.site-header nav a[data-spy=main] { display: none; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.account { display: none; }

/* ---------- Hero ---------- */
.hero {
  --globe-anchor: .5; --globe-shift: 0px;
  position: relative; isolation: isolate;
  display: grid; width: var(--page); margin: 0 auto; padding-bottom: calc(24px + env(safe-area-inset-bottom));
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "copy" "stage" "dock" "featured" "foot";
}
.hero-copy { grid-area: copy; container-type: inline-size; padding: 36px 0 20px; animation: enter .9s both; }
.eyebrow { margin-bottom: 24px; color: var(--muted); font-size: 14px; font-weight: 600; letter-spacing: 2px; text-transform: uppercase; }
.eyebrow span { margin-left: 20px; color: var(--accent); letter-spacing: 1.5px; }
h1 { font-size: clamp(56px, 20cqw, 76px); font-weight: 600; line-height: 1.04; letter-spacing: -.04em; }
h1 span { color: transparent; -webkit-text-stroke: 1px var(--text); }
.hero-description { margin: 22px 0 14px; color: var(--muted); font-size: 16px; line-height: 1.7; }
.hero-introduction { max-width: 44ch; margin-bottom: 26px; color: var(--muted); font-size: 16px; line-height: 1.75; text-wrap: pretty; }

.globe-stage { grid-area: stage; position: relative; width: 100%; max-width: 580px; aspect-ratio: 1; margin: 0 auto; }
#globe { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: pan-y; }
#globe.dragging { cursor: grabbing; touch-action: none; }
#globe:focus-visible { outline-offset: -6px; border-radius: 16px; }
.globe-loading { position: absolute; inset: 45% 0 auto; text-align: center; color: var(--muted); font-size: 14px; }
.globe-loading span { display: block; width: 160px; height: 1px; margin: 20px auto; background: var(--line); }
.globe-loading span::after { content: ''; display: block; width: 35%; height: 1px; background: var(--accent); }
.globe-pins { position: absolute; inset: 0; pointer-events: none; }
.globe-pin { position: absolute; left: 0; top: 0; z-index: var(--z-pin); width: 44px; height: 44px; margin: -22px 0 0 -22px; display: grid; place-items: center; border-radius: 50%; background: transparent; pointer-events: auto; isolation: isolate; transition: none; }
.globe-pin::before { content: ''; width: 12px; height: 12px; border: 3px solid #005e7d; border-radius: 50%; background: #f1fcff; box-shadow: 0 0 0 2px rgb(239 251 255 / .95), 0 2px 8px rgb(3 24 43 / .45); transition: width .18s, height .18s, box-shadow .18s; }
.globe-pin.selected { z-index: var(--z-card); }
.globe-pin.selected::before { width: 17px; height: 17px; border-width: 4px; background: #73e6f3; box-shadow: 0 0 0 2px #f1fcff, 0 0 0 8px rgb(0 153 186 / .24), 0 2px 10px rgb(3 24 43 / .45); }
.globe-pin:hover, .globe-pin:focus-visible { z-index: var(--z-pin-active); }
.globe-pin:hover::before, .globe-pin:focus-visible::before { width: 17px; height: 17px; background: #73e6f3; }
.globe-pin:focus-visible { outline-color: var(--text); }
.globe-pin.behind-card { opacity: 0; pointer-events: none; }
.globe-pin.clustered { display: none; }
.globe-pin.cluster::before { width: 28px; height: 28px; border-width: 3px; background: var(--accent); }
.pin-count { position: absolute; left: calc(50% + 6px); top: 0; min-width: 22px; height: 22px; padding: 0 6px; border: 2px solid #f1fcff; border-radius: 11px; background: var(--accent); color: var(--accent-ink); font-size: 14px; font-weight: 700; line-height: 18px; text-align: center; pointer-events: none; }
.pin-count:empty { display: none; }
.globe-pin.cluster .pin-count { left: 50%; top: 50%; min-width: 0; height: auto; padding: 0; border: 0; background: transparent; line-height: 1; transform: translate(-50%, -50%); }
.pin-label { position: absolute; bottom: calc(50% + 18px); left: 50%; transform: translateX(-50%); max-width: 260px; padding: 8px 12px; border: 1px solid rgb(164 219 249 / .4); border-radius: 10px; background: #08243c; box-shadow: 0 3px 12px rgb(3 20 37 / .2); color: #f1faff; font-size: 14px; font-weight: 600; line-height: 1.4; text-align: left; white-space: nowrap; opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .18s; }
.pin-label small { display: block; margin-top: 2px; color: #c4dcec; font-size: 14px; font-weight: 400; line-height: 1.5; }
.globe-pin.selected .pin-label, .globe-pin:hover .pin-label, .globe-pin:focus-visible .pin-label { opacity: 1; visibility: visible; }
.globe-pin.align-left .pin-label { left: 12px; transform: none; }
.globe-pin.align-right .pin-label { left: auto; right: 12px; transform: none; }

.globe-dock { grid-area: dock; display: flex; flex-direction: column; align-items: center; gap: 10px; padding-top: 4px; text-align: center; }
.globe-controls { display: flex; align-items: center; gap: 8px; }
.globe-hint { display: grid; gap: 8px; max-width: 40ch; color: var(--muted); font-size: 14px; line-height: 1.55; }
.globe-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; }
.globe-legend li { display: inline-flex; align-items: center; gap: 8px; }
.lg-pin { flex: none; width: 14px; height: 14px; border: 3px solid #005e7d; border-radius: 50%; background: #f1fcff; box-shadow: 0 0 0 2px rgb(239 251 255 / .95); }
.lg-selected { background: #73e6f3; box-shadow: 0 0 0 2px #f1fcff, 0 0 0 5px rgb(0 153 186 / .3); }
.lg-cluster { display: inline-grid; flex: none; place-items: center; width: 24px; height: 24px; border: 2px solid #005e7d; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 14px; font-style: normal; font-weight: 700; line-height: 1; }

.featured-story { grid-area: featured; display: flex; align-items: center; gap: 14px; margin-top: 18px; padding: 8px; border-radius: 14px; background: var(--card); box-shadow: 0 14px 45px rgb(0 0 0 / .18); text-align: left; animation: photo-enter 1s .3s both; }
.featured-photo { position: relative; flex: none; width: 96px; aspect-ratio: 1; overflow: hidden; border-radius: 9px; background: var(--surface); }
.featured-photo > img, .story-image > img, .photo-frame > img { width: 100%; height: 100%; object-fit: contain; }
.featured-caption { display: grid; gap: 6px; min-width: 0; padding-right: 6px; }
.featured-caption strong { font-size: 16px; font-weight: 600; line-height: 1.35; }
.featured-caption > span { color: var(--muted); font-size: 14px; }
.story-type { display: block; margin-bottom: 6px; color: var(--muted); font-size: 14px; letter-spacing: .02em; }

.hero-foot { grid-area: foot; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 32px; margin-top: 24px; }
.together { display: flex; align-items: center; gap: 14px; color: var(--muted); }
.together .ic { font-size: 34px; stroke-width: 1.3; }
.together p { font-size: 14px; line-height: 1.6; }
.explore-link { display: inline-flex; align-items: center; gap: 24px; min-height: 44px; font-size: 14px; white-space: nowrap; }
.explore-link .ic { font-size: 22px; }

/* ---------- Stories ---------- */
.stories-section { width: var(--page); margin: 0 auto; padding: 64px 0 48px; border-top: 1px solid var(--line); }
h2 { font-size: clamp(32px, 4vw, 58px); font-weight: 500; line-height: 1.12; letter-spacing: -.04em; }
.stories-eyebrow { margin-bottom: 18px; color: var(--accent); font-size: 14px; letter-spacing: .02em; }
.stories-introduction { max-width: 66ch; margin-top: 24px; color: var(--muted); font-size: 16px; line-height: 1.8; }
.stories-introduction p + p { margin-top: 14px; }
.stories-toolbar { display: flex; flex-direction: column; align-items: stretch; gap: 14px; margin: 36px 0 28px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.view-tabs { display: flex; gap: 8px; }
.view-tabs button { display: inline-flex; flex: 1; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 20px; border: 1px solid var(--line); border-radius: 30px; color: var(--text); font-size: 14px; font-weight: 500; }
.view-tabs button:hover { background: var(--surface); }
.view-tabs button.selected { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.tab-count { min-width: 24px; padding: 0 7px; border-radius: 12px; background: color-mix(in srgb, currentColor 16%, transparent); font-size: 14px; line-height: 24px; text-align: center; }
.tab-count:empty { display: none; }
.search-field { display: grid; gap: 6px; }
.search-box { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 4px 0 16px; border: 1px solid var(--line); border-radius: 30px; color: var(--muted); }
.search-box .ic { font-size: 20px; }
.search-box input { flex: 1; min-width: 0; height: 44px; border: 0; background: transparent; color: var(--text); font-size: 16px; outline: none; }
.search-box input::placeholder { color: var(--muted); }
.search-box input::-webkit-search-cancel-button { display: none; }
.search-box:focus-within { border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: 2px; }
.clear-button { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 50%; color: var(--muted); font-size: 18px; }
.clear-button:hover { background: var(--surface); color: var(--text); }
.search-summary { color: var(--muted); font-size: 14px; }

.stories-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 36px 24px; }
.stories-grid:empty { display: none; }
.story-card { display: flex; flex-direction: column; min-width: 0; text-align: left; }
.story-image { position: relative; aspect-ratio: 4 / 5; overflow: hidden; border-radius: 12px; background: var(--surface); }
.story-info { display: grid; gap: 8px; padding-top: 14px; }
.story-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; color: var(--muted); font-size: 14px; line-height: 1.4; }
.story-card h3 { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; font-size: 18px; font-weight: 500; line-height: 1.4; letter-spacing: -.01em; }
.story-card h3 .ic { margin: 0 0 -3px 6px; font-size: 18px; }
.story-summary { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; color: var(--muted); font-size: 14px; line-height: 1.65; }
.story-placeholder { display: grid; place-content: center; justify-items: center; gap: 10px; width: 100%; height: 100%; padding: 16px; background: var(--surface); color: var(--muted); font-size: 16px; text-align: center; }
.story-placeholder .ic { font-size: 30px; color: var(--accent); stroke-width: 1.4; }
.status-chip { padding: 2px 10px; border: 1px solid var(--line); border-radius: 20px; color: var(--text); font-size: 14px; line-height: 1.6; }
.status-chip[data-status=approved] { border-color: var(--accent); color: var(--accent); }
.status-chip[data-status=rejected] { border-color: var(--error); color: var(--error); }
.story-cta { display: grid; place-content: center; justify-items: center; gap: 8px; min-height: 240px; padding: 24px; border: 1px dashed var(--soft); border-radius: 12px; color: var(--muted); text-align: center; }
.story-cta:hover { background: var(--surface); }
.story-cta .ic { font-size: 32px; color: var(--accent); stroke-width: 1.4; }
.story-cta strong { color: var(--text); font-size: 18px; font-weight: 500; }
.story-cta span { font-size: 14px; }
#stories-more { display: flex; margin: 40px auto 0; }

.empty-state { display: grid; justify-items: center; gap: 14px; margin-top: 36px; padding: 56px 24px; border-radius: 16px; background: var(--surface); text-align: center; }
.empty-state > .ic { font-size: 44px; color: var(--soft); stroke-width: 1.2; }
.empty-state h3 { font-size: 26px; font-weight: 500; letter-spacing: -.02em; }
.empty-state p { max-width: 46ch; color: var(--muted); font-size: 16px; line-height: 1.7; }
.empty-state p:empty { display: none; }
.empty-state .button { margin-top: 10px; }
.collection-note { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 30px; margin-top: 36px; color: var(--muted); font-size: 14px; line-height: 1.7; }

/* ---------- Film and manifesto ---------- */
.anniversary-film { width: var(--page); max-width: 1584px; margin: 20px auto 45px; }
.anniversary-film video { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: contain; border: 1px solid var(--line); border-radius: 10px; background: #061524; }
.anniversary-film-copy { margin-top: 24px; }
.anniversary-film-copy h2 { font-size: clamp(28px, 3vw, 42px); }
.anniversary-film-copy p { max-width: 62ch; margin-top: 16px; color: var(--muted); font-size: 16px; line-height: 1.8; }
.anniversary-video-error { margin-top: 14px; color: var(--muted); font-size: 14px; line-height: 1.8; }
.anniversary-video-error a { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }

.manifesto { display: grid; grid-template-columns: minmax(0, 1fr); align-items: center; gap: 30px; width: var(--page); margin: 0 auto 56px; padding: 36px 26px; border-radius: 16px; background: var(--surface); }
.anniversary-large { display: flex; align-items: flex-end; gap: 15px; color: transparent; font-size: 145px; font-weight: 600; line-height: .85; letter-spacing: -.07em; -webkit-text-stroke: 1px var(--soft); }
.anniversary-large > span { margin-bottom: 10px; color: var(--muted); font-size: 22px; letter-spacing: -1px; -webkit-text-stroke: 0; }
.manifesto h2 { font-size: clamp(30px, 3.5vw, 48px); }
.manifesto p { margin: 22px 0 18px; color: var(--muted); font-size: 16px; line-height: 1.85; }

footer { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 4px 12px; width: var(--page); margin: 0 auto; padding: 24px 0 calc(24px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
footer > span { text-align: right; }
footer > a { display: inline-flex; align-items: center; justify-content: flex-end; gap: 6px; min-height: 44px; color: var(--text); }
footer .text-button { justify-self: start; font-size: 14px; }
.credit { grid-column: 1 / -1; padding-top: 8px; font-size: 14px; line-height: 1.7; }
.credit a { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Dialogs ---------- */
dialog { width: calc(100% - 24px); max-height: 92dvh; padding: 0; border: 1px solid var(--line); border-radius: 16px; background: var(--bg); color: var(--text); overscroll-behavior: contain; }
dialog::backdrop { background: rgb(3 16 30 / .8); backdrop-filter: blur(8px); }
.form-dialog { max-width: 620px; overflow: hidden; }
/* The content scrolls inside the window, not the window itself, so the cross stays in the corner while a long form is scrolled. */
.form-dialog > .dialog-inner { max-height: calc(92dvh - 2px); overflow-y: auto; overscroll-behavior: contain; }
.story-dialog { max-width: 940px; }
.close-button { position: absolute; right: 12px; top: 12px; z-index: var(--z-card); display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); font-size: 20px; }
.close-button:hover { background: var(--line); }
.dialog-inner { padding: 64px 24px 28px; }
.dialog-inner h2 { margin: 0 0 20px; font-size: clamp(32px, 6vw, 41px); }
.dialog-inner .eyebrow { margin: 0 0 20px; }
.dialog-description { margin-bottom: 24px; color: var(--muted); font-size: 16px; line-height: 1.8; }
.dialog-note { margin: 22px 0; padding: 16px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--muted); font-size: 14px; line-height: 1.7; }
.dialog-note strong { display: block; margin-bottom: 4px; color: var(--text); font-weight: 600; }

/* Location field and the place picker (a full-screen map in a dialog) */
.location-box { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 10px 10px 10px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--input); }
.field.has-error .location-box { border-color: var(--error); }
.location-value { flex: 1 1 160px; min-width: 0; margin: 0; color: var(--muted); font-size: 16px; line-height: 1.5; overflow-wrap: anywhere; }
.location-value.chosen { color: var(--text); font-weight: 600; }
.location-box .button { min-height: 44px; gap: 10px; padding: 0 18px; }
.location-box .button .ic { font-size: 18px; }
.picker-dialog { width: 100%; max-width: none; height: 100dvh; max-height: none; margin: 0; border: 0; border-radius: 0; background: var(--bg); }
.picker-shell { display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; height: 100%; gap: 12px; padding: 14px 16px 16px; }
.picker-head { position: relative; padding-right: 56px; }
.picker-head h2 { margin: 0 0 4px; font-size: clamp(24px, 5vw, 32px); }
.picker-intro { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.55; max-width: 70ch; }
.picker-head .close-button { top: 0; right: 0; }
.picker-search .combobox { max-width: 520px; }
.picker-search input { display: block; width: 100%; padding: 12px 14px 12px 42px; border: 1px solid var(--line); border-radius: 10px; background: var(--input); color: var(--text); font-size: 16px; line-height: 1.5; }
.picker-search input:focus-visible { outline-offset: 0; border-color: var(--accent); }
.picker-search-icon { position: absolute; left: 14px; top: 50%; z-index: 1; translate: 0 -50%; color: var(--muted); font-size: 18px; pointer-events: none; }
.picker-stage { position: relative; min-height: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
#picker-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
#picker-canvas.dragging { cursor: grabbing; }
#picker-canvas:focus-visible { outline-offset: -4px; border-radius: 14px; }
.picker-zoom { position: absolute; right: 12px; bottom: 12px; display: grid; gap: 8px; }
.picker-zoom button { display: grid; place-items: center; width: 48px; height: 48px; border: 1px solid var(--line); border-radius: 50%; background: var(--card); color: var(--text); font-size: 22px; box-shadow: 0 4px 14px rgb(3 16 30 / .25); }
.picker-zoom button:hover { background: var(--surface); }
.picker-loading { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; padding: 24px; background: rgb(11 31 53 / .55); color: #f0f7fc; text-align: center; font-size: 16px; }
.picker-foot { display: grid; gap: 12px; }
.picker-name { margin: 0; font-size: 18px; font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
.picker-selected .field-hint { margin-top: 2px; }
.picker-label { margin-top: 10px; }
.picker-label label { margin-bottom: 6px; }
.picker-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.picker-actions .button { flex: 1 1 160px; justify-content: center; }
.picker-actions .button:disabled { opacity: .45; cursor: not-allowed; }

/* Form */
.field { min-width: 0; margin-top: 20px; }
.field label, .field .label { display: block; margin-bottom: 8px; font-size: 14px; font-weight: 500; }
.field label.checkbox-label { display: flex; margin-bottom: 0; font-weight: 400; }
.field label.upload-label { display: grid; margin-bottom: 0; font-weight: 400; }
.req { color: var(--error); }
.optional { color: var(--muted); font-weight: 400; }
.field input:not([type=checkbox], [type=file], [type=hidden]), .field textarea { display: block; width: 100%; padding: 13px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--input); color: var(--text); font-size: 16px; line-height: 1.5; }
.field input:not([type=checkbox], [type=file], [type=hidden]):focus-visible, .field textarea:focus-visible { outline-offset: 0; border-color: var(--accent); }
.field input:disabled { opacity: .55; cursor: not-allowed; }
.field input::placeholder, .field textarea::placeholder { color: var(--muted); }
.field input[aria-invalid=true], .field textarea[aria-invalid=true] { border-color: var(--error); }
textarea { resize: vertical; }
.form-row { display: grid; grid-template-columns: minmax(0, 1fr); }
.field-hint { display: block; margin-top: 6px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.field-hint.near-limit { color: var(--error); }
#description-count { text-align: right; }
.field-error { margin-top: 6px; color: var(--error); font-size: 14px; font-weight: 500; line-height: 1.5; }
.field-error:empty { display: none; }
#place-switch-country { margin-top: 10px; }
.form-error { margin: 0 0 10px; color: var(--error); font-size: 14px; font-weight: 500; line-height: 1.6; }
.form-error:empty { display: none; }
.required-note { margin-bottom: 10px; color: var(--muted); font-size: 14px; }
.upload-label { position: relative; display: grid; place-items: center; min-height: 128px; overflow: hidden; border: 1px dashed var(--soft); border-radius: 12px; text-align: center; cursor: pointer; }
.upload-label:hover { background: var(--surface); }
.upload-label:focus-within { outline: 2px solid var(--accent); outline-offset: 3px; }
.upload-label input { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.upload-label > span { display: grid; justify-items: center; gap: 6px; padding: 20px 16px; }
.upload-label .ic { font-size: 26px; color: var(--soft); stroke-width: 1.4; }
.upload-label strong { font-size: 16px; font-weight: 500; }
.upload-label small { color: var(--muted); font-size: 14px; }
.upload-progress { display: flex; align-items: center; gap: 10px; margin-top: 10px; color: var(--muted); font-size: 14px; }
.spinner { width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; }
.photo-edit { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.photo-frame { aspect-ratio: 4 / 5; overflow: hidden; border-radius: 12px; background: var(--surface); pointer-events: none; }
.photo-actions { display: flex; flex-wrap: wrap; align-self: start; gap: 4px 16px; }
.checkbox-label { display: flex; align-items: center; gap: 12px; min-height: 48px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.checkbox-label input { flex: none; width: 24px; height: 24px; margin-top: 0; }
.form-actions { position: sticky; bottom: 0; margin: 10px -4px 0; padding: 26px 4px calc(4px + env(safe-area-inset-bottom)); background: linear-gradient(to bottom, transparent, var(--bg) 26px); }
.confirm-bar { display: grid; gap: 12px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.confirm-bar p { font-size: 14px; line-height: 1.6; }
.confirm-bar div { display: flex; flex-wrap: wrap; gap: 10px; }
.confirm-bar .button { min-height: 44px; }
#story-form > .confirm-bar { margin: 0 0 20px; }

/* Combobox lists (country, city) */
.combobox { position: relative; }
.options { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: var(--z-dropdown); max-height: 280px; margin: 0; padding: 5px; overflow-y: auto; overscroll-behavior: contain; border: 1px solid var(--line); border-radius: 10px; background: var(--input); box-shadow: 0 10px 30px rgb(3 16 30 / .2); }
.option { min-height: 48px; padding: 10px 12px; border-radius: 6px; font-size: 16px; line-height: 1.5; cursor: pointer; }
.option small { margin-left: 6px; color: var(--muted); font-size: 14px; }
.option:hover, .option[aria-selected=true] { background: var(--surface); }
.option-group { padding: 10px 12px 4px; color: var(--muted); font-size: 14px; font-weight: 600; }
.option-empty { padding: 12px; color: var(--muted); font-size: 14px; line-height: 1.7; }

/* Success */
.success-orbit { position: relative; display: inline-block; margin-bottom: 18px; color: var(--muted); font-size: 96px; }
.success-orbit > .ic { stroke-width: 1; }
.success-orbit > span { position: absolute; right: 0; bottom: 8px; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 20px; }
.success-orbit > span .ic { stroke-width: 2.2; }
#success-title:focus { outline: none; }
.success-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.success-actions .button { flex: 1 1 200px; justify-content: center; }

.about-steps { display: grid; gap: 20px; margin: 28px 0; counter-reset: step; }
.about-steps li { position: relative; padding-left: 48px; counter-increment: step; }
.about-steps li::before { content: counter(step); position: absolute; left: 0; top: 0; display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 50%; color: var(--accent); font-size: 14px; font-weight: 600; }
.about-steps strong { font-size: 16px; font-weight: 600; }
.about-steps p { margin-top: 4px; color: var(--muted); font-size: 16px; line-height: 1.7; }

/* Story detail and photo viewer */
.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr); }
.detail-photo-button { position: relative; display: block; width: 100%; background: var(--surface); cursor: zoom-in; }
.detail-photo { width: 100%; height: 260px; object-fit: contain; background: var(--surface); }
.detail-photo-button .ic { position: absolute; right: 12px; bottom: 12px; display: grid; width: 40px; height: 40px; padding: 10px; border-radius: 50%; background: rgb(8 36 60 / .78); color: #f1faff; }
.detail-photo.story-placeholder { font-size: 18px; }
.detail-copy { display: flex; flex-direction: column; align-items: flex-start; padding: 28px 24px; }
.detail-copy h2 { margin: 12px 0 16px; font-size: 29px; }
.detail-place { color: var(--muted); font-size: 14px; }
.detail-body { margin-bottom: 18px; color: var(--muted); font-size: 16px; line-height: 1.8; overflow-wrap: anywhere; }
.detail-author { margin-top: auto; padding-top: 18px; font-size: 16px; font-weight: 500; }
.detail-note { margin: 4px 0 16px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px; line-height: 1.6; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.detail-actions .button { min-height: 44px; gap: 14px; padding: 0 18px; font-size: 14px; }
.delete-button { min-height: 44px; margin-top: 6px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.delete-button:hover { color: var(--text); }
.story-dialog .close-button { background: var(--bg); }
.photo-dialog { width: auto; max-width: min(96vw, 1400px); border: 0; background: #061524; }
.photo-dialog img { display: block; width: auto; height: auto; max-width: 100%; max-height: 88dvh; margin: 0 auto; object-fit: contain; }
.photo-dialog .close-button { background: rgb(8 36 60 / .85); color: #f1faff; border-color: rgb(164 219 249 / .4); }

.place-stories { display: grid; gap: 12px; margin: 24px 0; }
.place-story { display: grid; grid-template-columns: 76px minmax(0, 1fr); align-items: center; gap: 14px; min-height: 64px; padding: 10px; border-radius: 12px; background: var(--surface); text-align: left; }
.place-story:hover, .place-row:hover { background: var(--card); }
.place-story .story-image { width: 76px; height: 64px; aspect-ratio: auto; border-radius: 8px; }
.place-story strong { display: block; font-size: 16px; font-weight: 500; line-height: 1.4; }
.place-story small { display: block; margin-top: 4px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.place-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; min-height: 56px; padding: 10px 14px; border-radius: 12px; background: var(--surface); text-align: left; }
.place-row .ic { color: var(--accent); font-size: 22px; }
.place-row small { color: var(--muted); font-size: 14px; }

.toast { position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: var(--z-toast); width: max-content; max-width: calc(100% - 32px); padding: 14px 22px; border-radius: 12px; background: var(--text); color: var(--bg); box-shadow: 0 8px 30px rgb(0 0 0 / .2); font-size: 14px; line-height: 1.6; transform: translateX(-50%); }
.noscript { padding: 30px; text-align: center; }

@media (min-width: 761px) {
  .picker-shell { padding: 18px 24px 20px; gap: 14px; }
  .picker-foot { grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 24px; }
  .picker-actions { flex-wrap: nowrap; }
  .picker-actions .button { flex: none; min-width: 190px; }
}

/* ---------- Tablet and up ---------- */
@media (min-width: 641px) {
  :root { --header-h: 80px; }
  .brand img, footer img { width: 130px; }
  .site-header { gap: 24px; }
  .site-header nav { gap: 24px; }
  .site-header nav a[data-spy=main] { display: inline-flex; }
  .account { display: inline-flex; margin-left: 12px; }
  .stories-toolbar { flex-direction: row; align-items: flex-start; justify-content: space-between; }
  .view-tabs button { flex: none; min-width: 150px; }
  .search-field { width: 320px; }
  .stories-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 40px 24px; }
  .manifesto { grid-template-columns: 1fr 1.3fr; gap: 40px; padding: 56px 6%; }
  .anniversary-large { display: block; font-size: 25vw; }
  .anniversary-large > span { display: block; margin: 8px 0 0 17px; font-size: 24px; }
  footer { display: flex; flex-wrap: wrap; gap: 4px 28px; }
  footer > span { margin-right: auto; text-align: left; }
  .dialog-inner { padding: 56px 40px 36px; }
  .form-row { grid-template-columns: 1fr 1fr; gap: 0 16px; }
  .photo-edit { grid-template-columns: minmax(0, 260px) minmax(0, 1fr); align-items: start; }
  .detail-layout { grid-template-columns: 1.1fr 1fr; min-height: 520px; }
  .detail-photo { height: 100%; min-height: 460px; max-height: 660px; }
  .detail-photo-button { height: 100%; }
  .detail-copy { padding: 56px 34px 34px; }
  .detail-copy h2 { font-size: 34px; }
  .place-story { grid-template-columns: 90px minmax(0, 1fr); }
  .place-story .story-image { width: 90px; height: 74px; }
  .toast { bottom: calc(25px + env(safe-area-inset-bottom)); }
}

/* ---------- Two-column hero ---------- */
@media (min-width: 901px) {
  .anniversary { display: flex; }
  .hero {
    --globe-anchor: .45;
    min-height: clamp(680px, calc(100dvh - var(--header-h)), 960px); padding-bottom: 20px;
    grid-template-columns: minmax(0, 4fr) minmax(0, 7fr);
    grid-template-rows: minmax(min-content, 1fr) auto auto;
    grid-template-areas: "copy stage" "foot dock" "featured featured";
    column-gap: clamp(16px, 2vw, 40px);
  }
  .hero-copy { align-self: center; padding: 24px 0; }
  h1 { font-size: clamp(56px, 24cqw, 132px); }
  .hero-description { margin: 28px 0 14px; }
  .globe-stage { max-width: none; aspect-ratio: auto; min-height: 380px; margin: 12px 0 0; }
  .featured-story { justify-self: start; width: min(100%, 440px); }
  .hero-foot { justify-content: flex-start; gap: 0 clamp(24px, 4vw, 64px); margin-top: 0; }
  .globe-dock { flex-direction: row; justify-content: center; gap: 18px; padding-top: 0; transform: translateX(var(--globe-shift)); text-align: left; }
  .globe-legend { justify-content: flex-start; }
  .stories-section { padding: 88px 0 56px; }
  .manifesto { grid-template-columns: 1fr 1fr; gap: 70px; margin-bottom: 80px; padding: 75px 8%; }
  .anniversary-large { font-size: clamp(150px, 22vw, 310px); }
  .anniversary-large > span { font-size: 30px; }
}

/* Wide screens: three story columns and the story card floating over the globe's lower-right limb. */
@media (min-width: 1100px) {
  .stories-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hero { grid-template-rows: minmax(min-content, 1fr) auto; grid-template-areas: "copy stage" "foot dock"; }
  .hero-foot { flex-wrap: nowrap; }
  .featured-story { grid-area: stage; z-index: var(--z-card); display: block; align-self: end; justify-self: end; width: clamp(190px, 16vw, 252px); margin: 0 0 18px; padding: 7px; transform: rotate(4deg); transition: transform .35s; }
  .featured-story:hover { transform: rotate(0) translateY(-6px); }
  .featured-photo { width: auto; aspect-ratio: 3 / 2; }
  .featured-caption { padding: 12px 8px 8px; }
}

@media (min-width: 1700px) {
  .hero-description { font-size: 18px; }
}

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  .globe-loading span::after { animation: load 1.5s infinite; }
  .spinner { animation: spin .8s linear infinite; }
  @keyframes enter { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
  @keyframes photo-enter { from { opacity: 0; translate: 0 24px; } to { opacity: 1; translate: 0; } }
  @keyframes load { 50% { transform: translateX(180%); } }
  @keyframes spin { to { transform: rotate(360deg); } }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Public story pages ---------- */
.story-directory-link { margin-top: 24px; }
.public-stories { width: var(--page); margin: 0 auto; padding: 40px 0 64px; }
.public-story { max-width: 760px; margin: 0 auto; }
.public-story-heading { margin-bottom: 28px; }
.public-story-heading h1 { margin: 10px 0; font-size: clamp(32px, 6vw, 60px); line-height: 1.12; overflow-wrap: anywhere; }
.public-story-heading p { max-width: 64ch; color: var(--muted); }
.public-story-photo { margin: 0 0 28px; border-radius: 12px; background: var(--surface); overflow: hidden; }
.public-story-photo img { width: 100%; height: auto; max-height: 68vh; object-fit: contain; }
.public-story .detail-body { white-space: pre-wrap; }
.public-story-nav { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
