:root {
  --navy: #0e121a;
  --navy-2: #1b2333;
  --gold: #b9862a;
  --gold-light: #d4a037;
  --cream: #faf5e6;
  --ink: #1f2937;
  --muted: #4b5563;
  --line: #e5e0d2;
  --ok: #166534;
  --ok-bg: #dcfce7;
  --warn: #92400e;
  --warn-bg: #fef3c7;
  --bad: #991b1b;
  --bad-bg: #fee2e2;
  --radius: 12px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: #fff;
}
a { color: #7a5512; }
img { max-width: 100%; height: auto; }
h1, h2, h3 { color: var(--navy); line-height: 1.25; margin: 0 0 0.6em; }
h2 { font-size: 1.7rem; }
h3 { font-size: 1.2rem; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 760px; }

/* top bar */
.topbar { background: var(--navy); color: #fff; }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; flex-wrap: wrap; }
.brand { color: #fff; text-decoration: none; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.brand img { height: 40px; width: auto; border-radius: 6px; }
.brand .gold { color: var(--gold-light); }
.topnav { display: flex; gap: 4px 16px; flex-wrap: wrap; }
.topnav a { color: #e5e7eb; text-decoration: none; font-weight: 600; font-size: 0.95rem; padding: 6px 0; }
.topnav a:hover, .topnav a[aria-current="page"] { color: var(--gold-light); }

/* hero */
.hero { background: linear-gradient(160deg, var(--navy) 0%, var(--navy-2) 100%); color: #fff; padding: 64px 0 56px; text-align: center; }
.hero h1 { color: #fff; font-size: clamp(2rem, 6vw, 3.2rem); margin-bottom: 0.2em; }
.hero h1 .gold { color: var(--gold-light); }
.hero .motto { font-family: 'Dancing Script', cursive; color: var(--gold-light); font-size: clamp(1.5rem, 4.5vw, 2.1rem); margin: 0.2em 0 0.6em; }
.hero p { font-size: 1.15rem; margin: 0.3em auto; max-width: 640px; color: #f3f4f6; }
.hero .when { font-weight: 700; color: var(--gold-light); }
.btn-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 28px; }

/* front page entrance: the world as gold dots (img/hero-map.svg, built by scripts/build-hero-map.mjs) */
.entrance { position: relative; overflow: hidden; color: #fff; text-align: center;
  background: radial-gradient(ellipse at 57% 32%, #1b2436 0%, var(--navy) 72%);
  min-height: min(88vh, 760px); padding: 104px 0 64px; }
/* The map is pinned so the place glows just above the first line of text: in hero-map.svg the place sits at
   56.4% of the width and 30.1% of the height (11.04% of the width), so these numbers follow the build script. */
.entrance .map { --mw: max(150vw, 1800px); position: absolute; left: 50%; top: calc(58px - var(--mw) * .1104);
  width: var(--mw); max-width: none; height: auto; transform: translateX(-56.4%); pointer-events: none; }
.entrance::after { content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(14,18,26,0) 0, rgba(14,18,26,0) 70px, rgba(14,18,26,.6) 150px, rgba(14,18,26,.72) 70%, rgba(14,18,26,.45) 100%); }
.entrance .wrap { position: relative; z-index: 1; width: 100%; }
.entrance .eyebrow { text-shadow: 0 0 8px var(--navy), 0 0 16px var(--navy); color: var(--gold-light); font-weight: 600; letter-spacing: .12em; text-transform: uppercase; font-size: 1rem; margin: 0 auto 14px; max-width: none; text-wrap: balance; }
.entrance h1 { color: #fff; font-size: clamp(2.4rem, 7.5vw, 4.6rem); line-height: 1.08; margin: 0 0 .15em; letter-spacing: -.01em; text-wrap: balance; }
.entrance h1 .gold { color: var(--gold-light); display: block; font-size: .55em; letter-spacing: .08em; margin-bottom: .2em; }
.entrance .motto { font-family: 'Dancing Script', cursive; color: var(--gold-light); font-size: clamp(1.7rem, 5vw, 2.5rem); margin: .1em auto .5em; }
.entrance p { font-size: 1.2rem; margin: .35em auto; max-width: 660px; color: #f3f4f6; text-wrap: balance; }
.entrance .when { font-weight: 700; color: #ffe2a0; max-width: none; }
.entrance .promises { list-style: none; padding: 0; margin: 26px auto 0; max-width: 720px; display: grid; gap: 8px; text-align: left; }
.entrance .promises li { text-wrap: pretty; position: relative; padding-left: 26px; font-size: 1.05rem; color: #e8eaee; }
.entrance .promises li::before { content: ''; position: absolute; left: 4px; top: .55em; width: 9px; height: 9px; border-radius: 50%; background: var(--gold-light); }
.entrance .btn { padding: 14px 26px; font-size: 1.05rem; }
.entrance .btn-gold { box-shadow: 0 0 0 0 rgba(212,160,55,.6); animation: glow 3s ease-in-out infinite; }
.entrance .rise { opacity: 0; transform: translateY(14px); animation: rise .9s ease-out forwards; }
.entrance .rise:nth-child(2) { animation-delay: .15s; } .entrance .rise:nth-child(3) { animation-delay: .3s; }
.entrance .rise:nth-child(4) { animation-delay: .45s; } .entrance .rise:nth-child(5) { animation-delay: .6s; }
.entrance .rise:nth-child(6) { animation-delay: .75s; } .entrance .rise:nth-child(7) { animation-delay: .9s; }
@keyframes rise { to { opacity: 1; transform: none; } }
@keyframes glow { 0%, 100% { box-shadow: 0 0 0 0 rgba(212,160,55,.45); } 50% { box-shadow: 0 0 0 10px rgba(212,160,55,0); } }
@media (prefers-reduced-motion: reduce) {
  .entrance .rise { opacity: 1; transform: none; animation: none; }
  .entrance .btn-gold { animation: none; }
}

/* the island and the three doors */
.place { display: grid; grid-template-columns: minmax(170px, 280px) 1fr; gap: 40px; align-items: center; }
.place figure { margin: 0; }
.place figure img { display: block; width: 100%; max-height: 440px; }
.place figcaption { font-size: inherit; color: var(--ink); margin-top: 10px; }
.place h2 { font-size: clamp(1.7rem, 4vw, 2.2rem); text-wrap: balance; }
.doors { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 8px; }
.door { background: #fff; border: 1px solid var(--line); border-top: 4px solid var(--gold-light); border-radius: var(--radius);
  padding: 22px; display: flex; flex-direction: column; }
.door h3 { margin-bottom: .4em; text-wrap: balance; }
.door p { margin: 0 0 16px; }
.door .btn { margin-top: auto; align-self: flex-start; }
@media (max-width: 760px) {
  .place { grid-template-columns: 1fr; gap: 20px; }
  .place figure { max-width: 170px; margin: 0 auto; order: 2; }
  .doors { grid-template-columns: 1fr; }
  .entrance { min-height: 0; padding: 96px 0 48px; }
}

.btn {
  display: inline-block; border: 0; border-radius: 10px; padding: 12px 22px; font: inherit; font-weight: 700;
  text-decoration: none; cursor: pointer; text-align: center;
}
.btn-gold { background: var(--gold-light); color: #000; }
.btn-gold:hover { background: #e2b04c; }
.btn-outline { background: transparent; color: #fff; border: 2px solid var(--gold-light); }
.btn-dark { background: var(--navy); color: #fff; }
.btn-light { background: #f3f4f6; color: var(--ink); border: 1px solid #d1d5db; }
.btn-small { padding: 6px 12px; font-size: 0.9rem; border-radius: 8px; }
.btn:disabled { opacity: 0.6; cursor: wait; }

section.block { padding: 56px 0; }
section.cream { background: var(--cream); }
.lead { font-size: 1.15rem; color: var(--muted); }
.center { text-align: center; }

.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); counter-reset: step; }
.steps li { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; counter-increment: step; }
.steps li::before { content: counter(step); display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--navy); color: var(--gold-light); font-weight: 700; margin-bottom: 8px; }
.steps strong { display: block; color: var(--navy); }

.dates { border-collapse: collapse; width: 100%; max-width: 640px; margin: 0 auto; background: #fff; }
.dates td { border-bottom: 1px solid var(--line); padding: 12px 8px; vertical-align: top; }
.dates td:first-child { font-weight: 700; color: var(--navy); width: 45%; }

ul.rules li { margin-bottom: 8px; }

details.faq { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 10px; background: #fff; }
details.faq summary { font-weight: 700; cursor: pointer; color: var(--navy); }
details.faq p { margin: 10px 0 0; }

/* forms */
form .group { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin: 0 0 20px; background: #fff; }
form .group > legend { font-weight: 700; color: var(--navy); padding: 0 6px; font-size: 1.1rem; }
label { display: block; font-weight: 600; margin: 14px 0 4px; }
label .opt { font-weight: 400; color: var(--muted); }
.hint { font-size: 0.92rem; color: var(--muted); margin: 2px 0 0; }
input[type=text], input[type=email], input[type=url], input[type=number], input[type=search], select, textarea {
  width: 100%; font: inherit; padding: 10px 12px; border: 1px solid #c8c2b2; border-radius: 8px; background: #fff;
}
textarea { min-height: 120px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(212,160,55,0.45); border-color: var(--gold); }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.check input { margin-top: 5px; width: 20px; height: 20px; flex: none; }
.radio-row { display: flex; gap: 18px; flex-wrap: wrap; }
.radio-row label { display: flex; gap: 6px; align-items: center; font-weight: 400; margin: 6px 0; }
.trap { position: absolute; left: -5000px; width: 1px; height: 1px; overflow: hidden; }
.counter { font-size: 0.9rem; color: var(--muted); text-align: right; }
.counter.over { color: var(--bad); font-weight: 700; }

.notice { border-radius: 10px; padding: 14px 16px; margin: 16px 0; }
.notice.ok { background: var(--ok-bg); color: var(--ok); }
.notice.err { background: var(--bad-bg); color: var(--bad); }
.notice.info { background: var(--cream); color: var(--ink); border-left: 4px solid var(--gold-light); }
[hidden] { display: none !important; }

/* repository */
.toolbar { display: flex; gap: 12px; flex-wrap: wrap; margin: 0 0 24px; }
.toolbar input { flex: 1 1 260px; }
.grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.card { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fff; display: flex; flex-direction: column; }
.card .thumb { aspect-ratio: 4 / 3; background: var(--cream); display: grid; place-items: center; overflow: hidden; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.card .thumb .pdf { font-weight: 800; color: var(--navy); font-size: 1.1rem; padding: 12px; text-align: center; }
.card .body { padding: 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card .title { font-weight: 700; color: var(--navy); font-size: 1.05rem; }
.card .meta { color: var(--muted); font-size: 0.93rem; }
.card .tag { display: inline-block; background: var(--cream); border-radius: 999px; padding: 2px 10px; font-size: 0.85rem; font-weight: 600; color: #6b4a10; }
.card .btn { margin-top: auto; }
.empty { text-align: center; color: var(--muted); padding: 40px 16px; border: 1px dashed var(--line); border-radius: var(--radius); }

dialog { border: 0; border-radius: var(--radius); padding: 0; width: min(860px, calc(100vw - 32px)); max-height: calc(100vh - 32px); }
dialog::backdrop { background: rgba(14,18,26,0.6); }
dialog .dlg-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; padding: 18px 20px; background: var(--navy); color: #fff; position: sticky; top: 0; }
dialog .dlg-head h2 { color: #fff; font-size: 1.25rem; margin: 0; }
dialog .dlg-body { padding: 20px; }
dialog .close { background: transparent; color: #fff; border: 0; font-size: 1.6rem; line-height: 1; cursor: pointer; }
.poster-view img { width: 100%; border: 1px solid var(--line); border-radius: 8px; }

footer.site { background: var(--navy); color: #d1d5db; padding: 32px 0; font-size: 0.95rem; }
footer.site a { color: var(--gold-light); }

/* admin */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 20px 0; }
.tabs button[aria-selected="true"] { background: var(--navy); color: #fff; }
.adm-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; background: #fff; }
.adm-card h3 { margin-bottom: 4px; }
.badge { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: 0.82rem; font-weight: 700; margin-right: 6px; }
.badge.pending { background: var(--warn-bg); color: var(--warn); }
.badge.accepted { background: var(--ok-bg); color: var(--ok); }
.badge.rejected, .badge.withdrawn { background: var(--bad-bg); color: var(--bad); }
.badge.parent-yes { background: var(--ok-bg); color: var(--ok); }
.badge.parent-no { background: var(--warn-bg); color: var(--warn); }
.badge.public { background: var(--navy); color: var(--gold-light); }
.adm-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 2px 12px; font-size: 0.95rem; margin: 8px 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
@media (max-width: 560px) { .kv { grid-template-columns: 1fr; } .kv dt { margin-top: 6px; } }

/* cards: name, title, poster, flag */
.card .name { font-weight: 800; color: var(--navy); font-size: 1.05rem; }
.card .flagline { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.93rem; }
.flag { width: 24px; height: 18px; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0,0,0,0.12); flex: none; }
.card.locked { cursor: default; }
.card.locked .thumb img { filter: blur(6px); }
#hover-preview { position: fixed; z-index: 50; width: min(520px, 45vw); pointer-events: none; border-radius: 10px; box-shadow: 0 20px 50px rgba(0,0,0,0.35); background: #fff; }
#hover-preview img { display: block; width: 100%; border-radius: 10px; }

.banner-invite { background: var(--navy); color: #fff; border-radius: var(--radius); padding: 16px 18px; margin: 0 0 24px; border-left: 6px solid var(--gold-light); animation: pulse 2.4s ease-in-out 3; }
.banner-invite a { color: var(--gold-light); }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(212,160,55,0.35); } }
@media (prefers-reduced-motion: reduce) { .banner-invite { animation: none; } }

/* poster window: wide, with the gallery visible at the sides */
dialog.poster-dialog { width: min(1100px, 92vw); }
.poster-frame { width: 100%; height: 70vh; border: 1px solid var(--line); border-radius: 8px; background: var(--cream); }
.poster-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0; }

/* question threads */
.thread-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 12px; }
.thread-tabs button[aria-selected="true"] { background: var(--navy); color: #fff; }
.thread { display: flex; flex-direction: column; gap: 10px; margin: 8px 0 14px; }
.bubble { max-width: 85%; border-radius: 12px; padding: 10px 14px; }
.bubble .who { font-weight: 700; font-size: 0.9rem; }
.bubble .when { font-weight: 400; color: var(--muted); font-size: 0.82rem; }
.bubble .text { white-space: pre-line; }
.bubble.asker { background: #e8f0fe; align-self: flex-start; }
.bubble.presenter { background: #fdf3dc; align-self: flex-end; }
.bubble.mentor { background: #e6f4ea; align-self: flex-end; }
.bubble.held { opacity: 0.7; border: 1px dashed #9ca3af; }

/* programme */
.session { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; background: #fff; }
.session.mine { border: 2px solid var(--gold-light); }
.session .time { color: var(--muted); }
