/* imokg.org — design "Ala-Too Civic". Mobile first; light and dark themes. Fonts are self-hosted (no third-party requests). */

@font-face { font-family: 'Golos Text'; font-style: normal; font-weight: 400 600; font-display: swap; src: url(/fonts/golos-text-cyrillic-ext.woff2) format('woff2'); unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: 'Golos Text'; font-style: normal; font-weight: 400 600; font-display: swap; src: url(/fonts/golos-text-cyrillic.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Golos Text'; font-style: normal; font-weight: 400 600; font-display: swap; src: url(/fonts/golos-text-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Montserrat'; font-style: normal; font-weight: 600 700; font-display: swap; src: url(/fonts/montserrat-cyrillic-ext.woff2) format('woff2'); unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: 'Montserrat'; font-style: normal; font-weight: 600 700; font-display: swap; src: url(/fonts/montserrat-cyrillic.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Montserrat'; font-style: normal; font-weight: 600 700; font-display: swap; src: url(/fonts/montserrat-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  color-scheme: light;
  --bg: #FBF8F3; --card: #FFFFFF; --ink: #26221F; --muted: #5C554E; --line: #E6DED3; --line-strong: #BDB2A4;
  --top-bg: #26221F; --top-ink: #F1ECE6; --top-muted: #D2C9BF;
  --accent: #B3121F; --on-accent: #FFFFFF; --link: #9E1B24; --orn: #D99A00; --date-bg: #26221F;
  --tag-open-bg: #FFF1C7; --tag-open-ink: #5E4500; --tag-done-bg: #E3EFE3; --tag-done-ink: #22552B;
  --tag-neutral-bg: #EDE8E1; --tag-neutral-ink: #4D463F; --tag-run-bg: #E2EAF6; --tag-run-ink: #1D3A6E;
  --focus: #1D4ED8;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #1C1916; --card: #26221E; --ink: #F1ECE6; --muted: #BBB2A8; --line: #3B352F; --line-strong: #5A5249;
    --top-bg: #110F0D; --top-ink: #F1ECE6; --top-muted: #D2C9BF;
    --accent: #C8323C; --on-accent: #FFFFFF; --link: #F2A0A5; --orn: #E0A100; --date-bg: #110F0D;
    --tag-open-bg: #4A3B12; --tag-open-ink: #F5D98A; --tag-done-bg: #1F3A24; --tag-done-ink: #AEDCB5;
    --tag-neutral-bg: #36302A; --tag-neutral-ink: #DDD5CB; --tag-run-bg: #1F2E4C; --tag-run-ink: #C7D7F8;
    --focus: #8DB2FF;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1C1916; --card: #26221E; --ink: #F1ECE6; --muted: #BBB2A8; --line: #3B352F; --line-strong: #5A5249;
  --top-bg: #110F0D; --top-ink: #F1ECE6; --top-muted: #D2C9BF;
  --accent: #C8323C; --on-accent: #FFFFFF; --link: #F2A0A5; --orn: #E0A100; --date-bg: #110F0D;
  --tag-open-bg: #4A3B12; --tag-open-ink: #F5D98A; --tag-done-bg: #1F3A24; --tag-done-ink: #AEDCB5;
  --tag-neutral-bg: #36302A; --tag-neutral-ink: #DDD5CB; --tag-run-bg: #1F2E4C; --tag-run-ink: #C7D7F8;
  --focus: #8DB2FF;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: 'Golos Text', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; font-size: 17px; line-height: 1.5;
  overflow-wrap: anywhere; -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { font-family: 'Montserrat', 'Golos Text', system-ui, sans-serif; font-weight: 700; line-height: 1.2; margin: 0; }
p { margin: 0; }
img { max-width: 100%; height: auto; }

.wrap { max-width: 1200px; margin: 0 auto; padding-inline: 16px; }
@media (min-width: 720px) { .wrap { padding-inline: 40px; } }
.muted { color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 8px; }
.skip { position: absolute; left: -9999px; top: 0; background: var(--card); color: var(--ink); padding: 12px 16px; z-index: 10; }
.skip:focus { left: 8px; top: 8px; }

/* top bar: languages + theme */
.topbar { background: var(--top-bg); color: var(--top-ink); }
.topbar .wrap { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; }
@media (min-width: 720px) { .topbar .wrap { justify-content: flex-end; } }
.langs { display: flex; gap: 2px; flex-wrap: wrap; }
.langs a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; color: var(--top-muted); text-decoration: none; font-size: 15px; }
.langs a[aria-current="true"] { color: #FFFFFF; font-weight: 600; text-decoration: underline; text-decoration-color: var(--orn); text-decoration-thickness: 3px; text-underline-offset: 6px; }
.theme-btn { min-width: 44px; min-height: 44px; border: 0; background: transparent; color: var(--top-muted); cursor: pointer; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; }
.theme-btn:hover { color: #FFFFFF; }

/* header */
.header .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 32px; padding-block: 18px; }
.brand { display: flex; gap: 12px; align-items: center; color: var(--ink); text-decoration: none; }
.brand svg { flex: none; }
.tunduk-a { stroke: var(--accent); }
.tunduk-o { stroke: var(--orn); }
.brand-name { display: block; font-family: 'Montserrat', sans-serif; font-weight: 700; font-size: 20px; }
.brand-sub { display: block; font-size: 13px; color: var(--muted); }
.nav { display: flex; flex-wrap: wrap; gap: 0 24px; font-weight: 600; font-size: 16px; }
.nav a { color: var(--ink); text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
.nav a[aria-current="page"] { text-decoration: underline; text-decoration-color: var(--orn); text-decoration-thickness: 3px; text-underline-offset: 8px; }
.ornament { display: block; width: 100%; height: 14px; color: var(--orn); }

/* main */
main { padding-block: 24px 56px; display: flex; flex-direction: column; gap: 36px; }
@media (min-width: 720px) { main { padding-block: 40px 64px; gap: 52px; } }
.intro { max-width: 760px; }
.intro h1 { font-size: 27px; }
.intro p { font-size: 18px; color: var(--muted); }
@media (min-width: 720px) { .intro h1 { font-size: 42px; } }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.section-head h2, .page-title { font-size: 23px; }
@media (min-width: 720px) { .section-head h2, .page-title { font-size: 28px; } }
.section-head a { font-weight: 600; }

/* olympiad cards */
.cards { display: flex; flex-wrap: wrap; gap: 20px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 18px; }
@media (min-width: 720px) { .card { padding: 28px; } }
.card--main { flex: 2 1 560px; display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.card--side { flex: 1 1 300px; display: flex; flex-direction: column; gap: 10px; }
.card-body { flex: 1 1 260px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.card h2 { font-size: 23px; }
.card--side h2 { font-size: 21px; }
@media (min-width: 720px) { .card h2 { font-size: 28px; } .card--side h2 { font-size: 21px; } }
.datebox { flex: none; width: 92px; border-radius: 14px; background: var(--date-bg); color: #FFFFFF; text-align: center; padding: 12px 0; display: flex; flex-direction: column; }
.datebox b { font-family: 'Montserrat', sans-serif; font-weight: 700; font-size: 36px; line-height: 1; }
.datebox span { font-size: 14px; color: var(--orn); margin-top: 4px; }
.datebox small { font-size: 13px; color: #D9D1C7; }
.meta { font-weight: 600; }
.tag { align-self: flex-start; display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: 14px; font-weight: 600; }
.tag--RegistrationOpen { background: var(--tag-open-bg); color: var(--tag-open-ink); }
.tag--Running { background: var(--tag-run-bg); color: var(--tag-run-ink); }
.tag--ResultsPublished { background: var(--tag-done-bg); color: var(--tag-done-ink); }
.tag--Upcoming, .tag--Marking { background: var(--tag-neutral-bg); color: var(--tag-neutral-ink); }
.btn { display: flex; align-items: center; justify-content: center; min-height: 52px; padding: 0 28px; border-radius: 12px; background: var(--accent); color: var(--on-accent); text-decoration: none; font-weight: 600; font-size: 17px; border: 2px solid var(--accent); cursor: pointer; font-family: inherit; }
.btn { transition: transform 0.1s cubic-bezier(0.23, 1, 0.32, 1), background-color 0.15s cubic-bezier(0.2, 0, 0, 1), border-color 0.15s cubic-bezier(0.2, 0, 0, 1), filter 0.15s; }
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(0.97); }
/* Motion is functional feedback only (press 100 ms, colour 150 ms); respect the system setting. */
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; } }
.btn--outline { background: transparent; color: var(--ink); border-color: var(--ink); min-height: 48px; }
.btn--fit { align-self: stretch; }
@media (min-width: 720px) { .btn--fit { align-self: flex-start; } }
.card--side .btn { margin-top: auto; }
.empty { background: var(--card); border: 1px dashed var(--line-strong); border-radius: 20px; padding: 24px; color: var(--muted); }

/* news */
.news-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
@media (min-width: 720px) { .news-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.news-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 20px; display: flex; flex-direction: column; gap: 8px; }
.news-card time { font-size: 14px; color: var(--muted); }
.news-card h3 { font-family: 'Golos Text', sans-serif; font-size: 19px; font-weight: 600; line-height: 1.35; }
.news-card h3 a { color: var(--ink); text-decoration: none; }
.news-card h3 a:hover { text-decoration: underline; }
.news-card p { font-size: 16px; color: var(--muted); }
.news-list { display: flex; flex-direction: column; }
.news-row { padding: 18px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; max-width: 72ch; }

/* past olympiads */
.past-row { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; padding: 16px 0; border-top: 1px solid var(--line); }
.past-year { flex: 0 0 76px; font-family: 'Montserrat', sans-serif; font-weight: 700; font-size: 20px; }
.past-name { flex: 1 1 200px; font-weight: 600; color: var(--ink); }
.past-status { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.past-status .tag { font-size: 13px; padding: 2px 10px; }

/* articles and pages (admin HTML is constrained to these elements) */
.article { max-width: 68ch; display: flex; flex-direction: column; gap: 16px; }
.article h1 { font-size: 27px; }
@media (min-width: 720px) { .article h1 { font-size: 38px; } }
.prose { font-size: 18px; line-height: 1.6; }
.prose > * + * { margin-top: 1em; }
.prose h2 { font-size: 24px; margin-top: 1.4em; }
.prose h3 { font-size: 20px; margin-top: 1.2em; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose blockquote { margin: 0; padding: 8px 16px; border-inline-start: 4px solid var(--line-strong); color: var(--muted); }
.prose img { border-radius: 12px; }
.prose figure { margin: 0; }
.prose figcaption { font-size: 15px; color: var(--muted); margin-top: 6px; }
.prose pre { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.prose table { border-collapse: collapse; display: block; overflow-x: auto; max-width: 100%; }
.prose th, .prose td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; }
.notice { background: var(--tag-open-bg); color: var(--tag-open-ink); border-radius: 12px; padding: 10px 14px; font-size: 15px; }
.crumbs { font-size: 15px; }

/* results table */
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 16px; }
.table-wrap table { border-collapse: collapse; width: 100%; font-size: 16px; min-width: 480px; }
.table-wrap th, .table-wrap td { padding: 10px 14px; text-align: left; border-top: 1px solid var(--line); white-space: nowrap; }
.table-wrap thead th { border-top: 0; color: var(--muted); font-size: 14px; font-weight: 600; }

/* footer */
.footer { background: var(--top-bg); color: var(--top-ink); }
.footer .wrap { display: flex; flex-wrap: wrap; gap: 14px 32px; align-items: center; justify-content: space-between; padding-block: 24px; font-size: 15px; }
.footer a { color: var(--top-ink); }
.footer .links { display: flex; flex-wrap: wrap; gap: 4px 24px; }
.footer .links a { min-height: 44px; display: inline-flex; align-items: center; }
.footer .updated { color: var(--top-muted); }

/* consent banner (only when analytics is switched on): top of page, in normal flow, equal buttons */
.consent { background: var(--card); border-bottom: 1px solid var(--line); }
.consent .wrap { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; padding-block: 18px; }
.consent p { flex: 1 1 420px; font-size: 15px; color: var(--muted); }
.consent form { display: flex; gap: 10px; flex: 1 1 260px; flex-wrap: wrap; margin: 0; }
.consent button { flex: 1 1 120px; min-height: 48px; padding: 0 18px; border-radius: 12px; border: 2px solid var(--ink); background: transparent; color: var(--ink); font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; }

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
.h-row { font-family: 'Golos Text', sans-serif; font-size: 20px; font-weight: 600; line-height: 1.35; }
.h-row a { color: var(--ink); text-decoration: none; }
.h-row a:hover { text-decoration: underline; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; }
