/* Gradac Circuit — dark gallery theme. No build step: plain CSS. */
:root {
  --bg: #050446;
  --surface: #03032a;
  --surface-2: #03032a;
  --line: #17185f;
  --text: #ece8e1;
  --muted: #9b968d;
  --accent: #d4a24c;
  --accent-ink: #1a1308;
  --ok: #7cc79a;
  --warn: #e0b45a;
  --danger: #e57b6e;
  --radius: 12px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --maxw: 1160px;
  --header-bg: rgba(5,4,70,.88);
  --btn-hover-bg: #0b0c61;
  --btn-hover-line: #25266d;
  --accent-hover: #e2b463;
  --lead: #cfcac1;
  --prose: #d6d1c8;
  --file-line: #22236a;
  --accent-line: rgba(212,162,76,.45);
  color-scheme: dark;
}

/* ---------- Light theme (set by the toggle / system preference via data-theme) ---------- */
:root[data-theme="light"] {
  --bg: #f6f3ee;
  --surface: #ffffff;
  --surface-2: #efebe4;
  --line: #ddd7cc;
  --text: #1c1a17;
  --muted: #6b655b;
  --accent: #8a5a00;
  --accent-ink: #ffffff;
  --ok: #1f7a46;
  --warn: #8f6200;
  --danger: #b3321f;
  --header-bg: rgba(246,243,238,.9);
  --btn-hover-bg: #e6e1d8;
  --btn-hover-line: #c9c2b5;
  --accent-hover: #6f4800;
  --lead: #3d3830;
  --prose: #36322b;
  --file-line: #c9c2b5;
  --accent-line: rgba(138,90,0,.4);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.6 var(--sans); min-height: 100vh; display: flex; flex-direction: column;
}
:root:not([data-theme="light"]) body {
  background: linear-gradient(38deg, rgba(10, 10, 107, 1) 0%, rgba(2, 0, 36, 1) 100%);
  background-attachment: fixed;
  background-size: cover;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(2.2rem, 5vw, 3.8rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--accent-ink); padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
main { flex: 1; }
.section { padding: 64px 0; }
.section + .section { border-top: 1px solid var(--line); }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }
.eyebrow { text-transform: uppercase; letter-spacing: .16em; font-size: .88rem; color: var(--accent); margin-bottom: 14px; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }

/* ---------- Header ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: var(--header-bg); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.nav { display: flex; align-items: center; gap: 24px; height: 68px; }
.brand { font-family: var(--serif); font-size: 1.25rem; color: var(--text); display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand img { width: auto; height: 40px; }
.nav-links { display: flex; gap: 4px; margin-left: auto; align-items: center; }
.nav-links a, .nav-links button.linklike { color: var(--muted); padding: 8px 12px; border-radius: 8px; font-size: .95rem; }
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav-toggle { display: none; margin-left: auto; background: none; border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 8px 12px; font: inherit; cursor: pointer; }
button.linklike { background: none; border: 0; font: inherit; cursor: pointer; }

/* ---------- Theme toggle ---------- */
.theme-toggle { display: inline-flex; align-items: center; gap: 8px; background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: .85rem; cursor: pointer; }
.theme-toggle:hover { color: var(--text); border-color: var(--btn-hover-line); }
.theme-toggle svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun, :root:not([data-theme]) .theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .i-moon, :root:not([data-theme]) .theme-toggle .i-moon { display: none; }
:root[data-theme="light"] .theme-toggle .i-moon { display: block; }
:root[data-theme="light"] .theme-toggle .i-sun { display: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text); font: 600 .95rem var(--sans); cursor: pointer;
  transition: background .15s, border-color .15s, transform .15s;
}
.btn:hover { text-decoration: none; border-color: var(--btn-hover-line); background: var(--btn-hover-bg); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); }
.btn.sm { padding: 6px 14px; font-size: .85rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

/* ---------- Hero ---------- */
.hero { padding: 88px 0 72px; background:
  radial-gradient(900px 420px at 85% -10%, rgba(212,162,76,.16), transparent 60%),
  radial-gradient(700px 380px at -10% 110%, rgba(212,162,76,.07), transparent 60%); }
.hero-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 48px; align-items: center; }
.hero p.lead { font-size: 1.15rem; color: var(--lead); max-width: 56ch; }
.hero .badges { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.recognition-badge { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 76px; text-align: center; }
.recognition-circle { width: 72px; height: 72px; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--accent-line); border-radius: 50%; background: #fff; }
.recognition-circle img { width: 100%; height: 100%; object-fit: contain; padding: 0px; }
.recognition-name { font-size: .58rem; color: var(--accent); letter-spacing: .04em; font-weight: 900; }
.recognition-fields { display: grid; gap: 12px; margin-bottom: 12px; }
.recognition-row { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(240px, 1.4fr) auto; gap: 12px; align-items: end; padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
.recognition-preview { width: auto; height: 36px; max-width: 120px; object-fit: contain; margin-top: 8px; }
.hero-countries { display: flex; flex-wrap: wrap; gap: 0 16px; margin: -4px 0 18px; padding: 0; color: var(--muted); list-style: none; }
.hero-countries li { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: large; }
.country-flag { display: inline-flex; align-items: center; }
.country-flag img { display: block; width: 20px; height: auto; }
.country-fields { display: grid; gap: 8px; }
.country-row { display: flex; align-items: center; gap: 8px; }
.country-row input { flex: 1; }
.countdown { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 28px; text-align: center; }
.countdown .num { font: 600 5rem/1 var(--serif); color: var(--accent); }
.countdown .label { text-transform: uppercase; letter-spacing: .14em; font-size: .75rem; color: var(--muted); }
.countdown .date { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); font-family: var(--serif); font-size: 1.1rem; }

.tag { display: inline-block; padding: 3px 12px; border: 1px solid var(--line); border-radius: 999px; font-size: .78rem; color: var(--muted); letter-spacing: .04em; }
.tag.accent { color: var(--accent); border-color: var(--accent-line); }
.tag.ok { color: var(--ok); border-color: rgba(124,199,154,.4); }
.tag.warn { color: var(--warn); border-color: rgba(224,180,90,.4); }
.tag.danger { color: var(--danger); border-color: rgba(229,123,110,.4); }
.tag.warn.award { color: var(--warn); border-color: rgba(224,180,90,.4); background: rgba(224,180,90,.08); font-weight: 600; font-size: larger;   }
/* ---------- Timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.timeline li { padding: 22px; border-right: 1px solid var(--line); }
.timeline li:last-child { border-right: 0; }
.timeline .when { font: 600 1.35rem var(--serif); display: block; }
.timeline .what { color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .1em; }
.timeline li.now { background: linear-gradient(180deg, rgba(212,162,76,.12), transparent); }

/* ---------- Cards / grids ---------- */
.grid { display: grid; gap: 20px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.card.flat { background: transparent; }
.sec-card .code { font: 600 3.4rem/1 var(--serif); color: var(--accent); opacity: .9; display: block; margin-bottom: 12px; }
.step .n { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--accent); color: var(--accent); font-weight: 600; margin-bottom: 14px; }
.stat .v { font: 600 2.4rem/1 var(--serif); }
.stat .k { color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .1em; margin-top: 6px; }

.fees { width: 100%; border-collapse: collapse; }
.fees th, .fees td { padding: 12px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.fees th { color: var(--muted); font-weight: 500; font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; }
.fees td.num { font: 600 1.2rem var(--serif); }

/* ---------- Photos ---------- */
.photo-wall { columns: 4 220px; column-gap: 16px; }
.photo { break-inside: avoid; margin: 0 0 16px; position: relative; border-radius: 10px; overflow: hidden; background: var(--surface); cursor: zoom-in; border: 0; padding: 0; width: 100%; display: block; text-align: left; color: inherit; font: inherit; }
.photo img { width: 100%; height: auto; transition: transform .35s ease; }
.photo:hover img { transform: scale(1.03); }
.photo figcaption, .photo .cap { position: absolute; inset: auto 0 0 0; padding: 36px 14px 12px; background: linear-gradient(transparent, rgba(0,0,0,.85)); opacity: 0; transition: opacity .2s; font-size: .85rem; color: #fff; }
.photo:hover .cap, .photo:focus-visible .cap { opacity: 1; }
.photo .cap strong { display: block; font-family: var(--serif); font-size: 1rem; }
.photo .award { position: absolute; top: 10px; left: 10px; background: rgba(0,0,0,.65); color: #f0c878; border-color: rgba(240,200,120,.5); }
.photo-ph { aspect-ratio: 4/3; background: var(--surface-2); border: 1px dashed var(--line); border-radius: 10px; display: grid; place-items: center; color: var(--muted); font-size: .85rem; }

.lightbox { position: fixed; inset: 0; background: rgba(5,4,70,.95); z-index: 200; display: none; align-items: center; justify-content: center; flex-direction: column; padding: 24px; color: #ece8e1; }
.lightbox.open { display: flex; }
.lightbox img { max-height: 82vh; max-width: 96vw; object-fit: contain; border-radius: 4px; }
.lightbox .lb-cap { margin-top: 14px; text-align: center; }
.lightbox .lb-close { position: absolute; top: 16px; right: 20px; background: none; border: 1px solid var(--line); color: #ece8e1; width: 42px; height: 42px; border-radius: 50%; font-size: 1.3rem; cursor: pointer; }
.lightbox .lb-nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(5,5,92,.5); border: 1px solid var(--line); color: #ece8e1; width: 46px; height: 46px; border-radius: 50%; font-size: 1.3rem; cursor: pointer; }
.lb-prev { left: 16px; } .lb-next { right: 16px; }

/* ---------- Forms ---------- */
.form { display: grid; gap: 16px; }
.field label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 6px; }
.field .field-label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 6px; }
.field .hint { font-size: .8rem; color: var(--muted); margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], select, textarea {
  width: 100%; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; color: var(--text); padding: 11px 14px; font: inherit;
}
input[type=file] { width: 100%; background: var(--surface-2); border: 1px dashed var(--file-line); border-radius: 10px; padding: 12px; color: var(--muted); font: inherit; }
textarea { min-height: 120px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.error { color: var(--danger); font-size: .85rem; margin-top: 4px; }
.check { display: flex; align-items: center; gap: 10px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.hp { position: absolute; left: -9999px; height: 0; overflow: hidden; }

.auth-card { max-width: 520px; margin: 56px auto; }

/* ---------- Alerts ---------- */
.alert { padding: 12px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); margin: 20px 0; }
.alert.ok { border-color: rgba(124,199,154,.5); color: var(--ok); }
.alert.err { border-color: rgba(229,123,110,.5); color: var(--danger); }
.alert.info { border-color: var(--accent-line); color: var(--accent); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table.t { width: 100%; border-collapse: collapse; background: var(--surface); }
.t th, .t td { padding: 12px 16px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.t th { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 500; background: var(--surface-2); }
.t tr:last-child td { border-bottom: 0; }
.inline-form { display: inline-flex; gap: 8px; align-items: center; }
.inline-form select, .inline-form input[type=text] { width: auto; padding: 6px 10px; }

/* ---------- Entry dashboard ---------- */
.entry-layout { display: grid; grid-template-columns: 1fr 320px; gap: 28px; align-items: start; }
.sticky { position: sticky; top: 90px; }
.upload-slot { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; margin: 16px 0; }
.thumb { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.thumb img { width: 100%; aspect-ratio: 4/3; object-fit: cover; cursor: zoom-in; }
.thumb .meta { padding: 10px; font-size: .85rem; }
.thumb .meta form { margin-top: 6px; }
.kv { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); }
.kv:last-child { border-bottom: 0; }

/* ---------- Judging ---------- */
.judge-top { position: sticky; top: 68px; z-index: 40; background: var(--bg); border-bottom: 1px solid var(--line); padding: 12px 0; }
.progress { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.progress > i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .3s; }
.judge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; padding: 24px 0 64px; }
.judge-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.judge-card.scored { border-color: var(--accent); }
.judge-card img { width: 100%; aspect-ratio: 4/3; object-fit: cover; cursor: zoom-in; }
.judge-card .body { padding: 12px 14px 14px; }
.score-btns { display: flex; gap: 6px; margin-top: 10px; }
.score-btns button { flex: 1; padding: 9px 0; background: var(--surface-2); border: 1px solid var(--line); color: var(--text); border-radius: 8px; font: 600 1rem var(--sans); cursor: pointer; }
.score-btns button:hover { border-color: var(--accent); }
.score-btns button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* ---------- Admin ---------- */
.admin-nav { display: flex; gap: 6px; flex-wrap: wrap; padding: 14px 0; border-bottom: 1px solid var(--line); margin-bottom: 28px; }
.admin-nav a { padding: 7px 14px; border-radius: 999px; color: var(--muted); font-size: .9rem; }
.admin-nav a:hover { text-decoration: none; color: var(--text); background: var(--surface-2); }
.admin-nav a.active { background: var(--accent); color: var(--accent-ink); }
.pagination { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 18px; }
.pagination a, .pagination span { padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: .9rem; }
.pagination .active span { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 40px 0; margin-top: 40px; color: var(--muted); font-size: .9rem; }
.footer-grid { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.footer-grid a { color: var(--muted); }
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; }

.prose { max-width: 70ch; }
.prose p { color: var(--prose); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero-grid, .entry-layout { grid-template-columns: 1fr; }
  .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .sticky { position: static; }
  .timeline li { border-right: 0; border-bottom: 1px solid var(--line); }
  .timeline li:last-child { border-bottom: 0; }
}
@media (max-width: 760px) {
  .nav-toggle { display: block; }
  .nav-links { display: none; position: absolute; top: 68px; left: 0; right: 0; flex-direction: column; align-items: stretch; background: var(--bg); border-bottom: 1px solid var(--line); padding: 12px 20px 20px; margin: 0; }
  .nav-links.open { display: flex; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .hero { padding: 48px 0; }
  .section { padding: 44px 0; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }


/* ---------- 3D hero (Three.js) ---------- */
.hero { position: relative; overflow: hidden; isolation: isolate; }
.hero-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; display: block; pointer-events: none; opacity: 0; transition: opacity .9s ease; }
.hero.is-3d .hero-canvas { opacity: 1; }
/* keep the headline side clean: frames fade out towards the left on wide screens */
@media (min-width: 761px) {
  .hero-canvas { -webkit-mask-image: linear-gradient(to right, transparent 0%, transparent 34%, #000 62%); mask-image: linear-gradient(to right, transparent 0%, transparent 34%, #000 62%); }
}
@media (max-width: 760px) { .hero.is-3d .hero-canvas { opacity: .22; } }
@media (max-width: 760px) { .recognition-row { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .hero-canvas { transition: none; } }
