/* Paz de Ziganda Xake Txapelketa — palette from the ikastola logo */
:root {
  --ink: #1D1D1B;
  --green: #98BF32;
  --blue: #00B2E8;
  --orange: #F0911F;
  --red: #DF1520;
  --yellow: #FECA14;

  /* Colour roles: the light theme below redefines these */
  --c-open: var(--blue);
  --c-school: var(--green);
  --c-archive: var(--orange);
  --c-chess: var(--red);
  --c-cta: var(--yellow);            /* "register" button, highlights */
  --c-cta-text: var(--ink);
  --c-btn: var(--ink);               /* ordinary buttons */
  --c-btn-text: #fff;
  --c-dark: var(--ink);              /* hero, stats band, footer */
  --c-on-dark: #fff;
  --c-on-dark-muted: #d9d9d2;
  --c-hero-accent: var(--yellow);
  --c-deep: var(--c-dark);           /* stats band, footer, archive tiles */
  --c-on-deep: var(--c-on-dark);
  --c-on-deep-muted: var(--c-on-dark-muted);
  --hero-photo: .45;                 /* opacity of the hero photo */
  --c-ok: #4f8a10;                   /* form states: not part of the palette */
  --c-bad: #c8102e;
  --stripe: linear-gradient(90deg, var(--green) 0 20%, var(--blue) 20% 40%, var(--orange) 40% 60%, var(--red) 60% 80%, var(--yellow) 80%);
  --board-light: #e6f4fa;
  --board-dark: #79bdd6;
  --board-border: #2b6f88;

  --bg: #ffffff;
  --surface: #f5f5f1;
  --surface-2: #ebebe5;
  --text: #1D1D1B;
  --muted: #5c5c57;
  --line: #dcdcd4;
  --link: #0077a3;
  --accent: var(--c-open);
  --radius: 14px;
  --shadow: 0 1px 2px rgb(0 0 0 / .06), 0 8px 24px rgb(0 0 0 / .06);
  --wrap: 1180px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-head: "Avenir Next", "Segoe UI", system-ui, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121211;
    --surface: #1c1c1a;
    --surface-2: #262623;
    --text: #f1f1ec;
    --muted: #a9a9a1;
    --line: #34342f;
    --link: #4fcbf5;
    --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 8px 24px rgb(0 0 0 / .3);
  }
}

/* Light theme ("Argia"), chosen with the header button (data-theme="light"): white and clear blue, light hero */
[data-theme="light"] { color-scheme: light; --shadow: 0 1px 2px rgb(0 0 0 / .05), 0 8px 24px rgb(0 0 0 / .05); }
[data-theme="light"] {
  --bg: #ffffff; --surface: #f5f8fc; --surface-2: #eaf0f7; --line: #dfe6ef;
  --text: #13233a; --muted: #55657a; --link: #1f5fbf;
  --c-dark: #eaf2fb; --c-on-dark: #13233a; --c-on-dark-muted: #4d5d72; --c-hero-accent: #1f5fbf;
  --c-deep: #13233a; --c-on-deep: #ffffff; --c-on-deep-muted: #b9c6d8;
  --c-btn: #13233a; --c-btn-text: #fff; --c-cta: #1f5fbf; --c-cta-text: #fff;
  --c-open: #1f5fbf; --c-school: #1c8f6a; --c-archive: #c9772e; --c-chess: #c8454f;
  --stripe: linear-gradient(90deg, #1f5fbf 0 100%);
  --board-light: #eef3fa; --board-dark: #a5bcd9; --board-border: #1f5fbf;
  --hero-photo: .14;
}
[data-theme="light"] .hero-bg { filter: grayscale(1) contrast(1.05); }
[data-theme="light"] .btn-ghost { background: transparent; border-color: currentColor; color: var(--c-on-dark); backdrop-filter: none; }
[data-theme="light"] .countdown div,
[data-theme="light"] .hero-note { background: rgb(255 255 255 / .7); border-color: var(--line); }
[data-theme="light"] .hero { border-bottom: 1px solid var(--line); }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 17px/1.6 var(--font);
  display: flex; flex-direction: column; min-height: 100vh;
}
main { flex: 1; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--link); text-underline-offset: .15em; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { font-family: var(--font-head); line-height: 1.15; letter-spacing: -.01em; }
h1 { font-size: clamp(2rem, 5vw, 3.4rem); margin: .2em 0; }
h2 { font-size: clamp(1.35rem, 2.6vw, 1.8rem); margin: 1.8em 0 .6em; }
h3 { font-size: 1.1rem; margin: 0 0 .5em; }
.wrap { width: min(100% - 32px, var(--wrap)); margin-inline: auto; }
.section { padding-block: 32px; }
.lead { font-size: 1.2rem; color: var(--text); max-width: 60ch; }
.intro .lead { max-width: none; }   /* home page welcome: one sentence, use the full width */
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--c-cta); color: var(--c-cta-text); padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--c-open); outline-offset: 2px; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .8rem; font-weight: 700; margin: 0; color: var(--muted); }
mark.todo { background: #fff3b0; color: #6b4e00; border-radius: 4px; padding: 0 4px; font-size: .85em; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: .4em; padding: .55em 1.1em; border-radius: 999px;
  background: var(--c-btn); color: var(--c-btn-text); text-decoration: none; font: inherit; font-weight: 600; border: 2px solid var(--c-btn); cursor: pointer;
  transition: transform .15s ease, background .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-cta { background: var(--c-cta); border-color: var(--c-cta); color: var(--c-cta-text); }
.btn-quiet { background: transparent; color: var(--text); border-color: var(--line); }
.btn-ghost { background: rgb(255 255 255 / .1); border-color: rgb(255 255 255 / .6); color: #fff; backdrop-filter: blur(4px); }
.btn-lg { font-size: 1.05rem; padding: .7em 1.4em; }
@media (prefers-color-scheme: dark) { :root:not([data-theme]) .btn { background: #f1f1ec; color: var(--ink); border-color: #f1f1ec; } :root:not([data-theme]) .btn-cta { background: var(--c-cta); border-color: var(--c-cta); } :root:not([data-theme]) .btn-quiet { background: transparent; color: var(--text); border-color: var(--line); } }

/* Header */
.site-header { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px); }
.header-inner { display: flex; align-items: center; gap: 16px; min-height: 68px; width: min(100% - 32px, 1280px); }
@media (max-width: 1400px) { .brand-text { display: none; } }  /* the full menu needs the room */
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; }
.brand .logo { height: 34px; width: auto; }
.brand-text { font-weight: 700; font-size: .95rem; padding-left: 12px; border-left: 2px solid var(--line); white-space: nowrap; }
.site-nav { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.site-nav .btn-cta { white-space: nowrap; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 2px; }
.site-nav ul a { display: block; white-space: nowrap; padding: 8px 9px; border-radius: 8px; color: var(--text); text-decoration: none; font-weight: 500; }
.site-nav ul a:hover { background: var(--surface); }
.site-nav ul a[aria-current="page"] { box-shadow: inset 0 -3px 0 var(--accent); border-radius: 8px 8px 0 0; }
.langs { gap: 0 !important; border: 1px solid var(--line); border-radius: 999px; padding: 2px !important; }
.langs a { padding: 4px 9px !important; font-size: .8rem; font-weight: 700 !important; border-radius: 999px !important; box-shadow: none !important; }
.langs a[aria-current="true"] { background: var(--c-btn); color: var(--c-btn-text) !important; }
.theme-toggle { display: grid; place-items: center; flex: none; width: 34px; height: 34px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: none; color: var(--text); cursor: pointer; }
.theme-toggle:hover { background: var(--surface); }
.theme-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
[data-theme="light"] .theme-toggle .i-sun, :root:not([data-theme]) .theme-toggle .i-moon { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme]) .langs a[aria-current="true"] { background: #f1f1ec; color: var(--ink) !important; } }
.nav-toggle { display: none; margin-left: auto; background: none; border: 0; padding: 10px; cursor: pointer; color: var(--text); }
.nav-toggle .bars, .nav-toggle .bars::before, .nav-toggle .bars::after { display: block; width: 24px; height: 2px; background: currentColor; position: relative; transition: transform .2s; }
.nav-toggle .bars::before, .nav-toggle .bars::after { content: ""; position: absolute; }
.nav-toggle .bars::before { top: -7px; } .nav-toggle .bars::after { top: 7px; }
.nav-toggle[aria-expanded="true"] .bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .bars::before { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .bars::after { transform: translateY(-7px) rotate(-45deg); }

/* The five logo squares as a strip under the header */
.tiles { display: grid; grid-template-columns: repeat(5, 1fr); height: 4px; background: var(--stripe); }
.tiles i { display: none; }

@media (max-width: 1260px) {
  .nav-toggle { display: block; }
  .site-nav { display: none; position: absolute; inset: 72px 0 auto 0; background: var(--bg); flex-direction: column; align-items: stretch; padding: 16px; gap: 14px; border-bottom: 1px solid var(--line); box-shadow: var(--shadow); }
  .site-nav.open { display: flex; }
  .site-nav ul { flex-direction: column; }
  .site-nav ul a { padding: 12px; font-size: 1.05rem; }
  .langs { flex-direction: row !important; align-self: flex-start; }
  .brand-text { display: none; }
  .theme-toggle { margin-left: auto; }
  .nav-toggle { order: 1; margin-left: 4px; }
}

/* Hero */
.hero { position: relative; color: var(--c-on-dark); background: var(--c-dark); overflow: hidden; }
.hero-bg { position: absolute; inset: 0; background-size: cover; background-position: center 40%; opacity: var(--hero-photo); filter: grayscale(1) contrast(1.1); }
.hero::after { content: ""; position: absolute; inset: 0; background:
  linear-gradient(100deg, color-mix(in srgb, var(--c-dark) 92%, transparent) 30%, color-mix(in srgb, var(--c-dark) 30%, transparent)),
  repeating-conic-gradient(rgb(255 255 255 / .03) 0 25%, transparent 0 50%) 0 0 / 64px 64px; }
.hero-inner { position: relative; z-index: 1; padding-block: clamp(56px, 10vw, 120px); }
.hero .eyebrow { color: var(--c-hero-accent); }
.hero h1 { max-width: 16ch; }
.hero-date { font-size: clamp(1.1rem, 2.4vw, 1.45rem); margin: .4em 0 1.4em; }
.hero-date .sep { color: var(--c-hero-accent); margin-inline: .3em; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-note { margin-top: 28px; max-width: 52ch; padding: 14px 18px; border-left: 4px solid var(--c-hero-accent); background: rgb(255 255 255 / .08); border-radius: 0 10px 10px 0; }
.countdown { display: flex; gap: 10px; margin-top: 32px; }
.hero-champions { display: flex; flex-wrap: wrap; gap: 14px 40px; margin: 28px 0 0; }
.hero-champions dt { font-size: .8rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--c-hero-accent); }
.hero-champions dd { margin: 2px 0 0; font-size: clamp(1.4rem, 3vw, 2rem); font-weight: 700; font-family: var(--font-head); }
.hero-champions + .hero-actions { margin-top: 24px; }
.countdown div { background: rgb(255 255 255 / .1); border: 1px solid rgb(255 255 255 / .25); border-radius: 12px; padding: 10px 16px; text-align: center; min-width: 84px; }
.countdown span { display: block; font-size: 1.9rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.countdown small { text-transform: uppercase; letter-spacing: .1em; font-size: .7rem; opacity: .8; }

/* Cards */
.cards-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; }
.card { background: var(--surface); border-radius: var(--radius); padding: 24px 26px; border-top: 6px solid var(--accent); box-shadow: var(--shadow); }
.card h2 { margin-top: 0; }
.card h2 a { color: var(--text); text-decoration: none; }
.card-open { --accent: var(--c-open); }
.card-school { --accent: var(--c-school); }
.card-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0 0; }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 16px 0; }
.facts div { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.facts dt { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.facts dd { margin: 2px 0 0; font-weight: 600; }

/* Stats band */
.band { background: var(--c-deep); color: var(--c-on-deep); margin-block: 24px; }
.band-inner { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0; }
.stat { padding: 26px 18px; border-left: 4px solid var(--c, var(--c-cta)); }
.stat:nth-child(1) { --c: var(--c-school); } .stat:nth-child(2) { --c: var(--c-open); } .stat:nth-child(3) { --c: var(--c-archive); } .stat:nth-child(4) { --c: var(--c-chess); }
.stat strong { display: block; font-size: 2rem; font-family: var(--font-head); }
.stat span { opacity: .8; font-size: .9rem; }

.section-title { margin-top: 0; }

/* Archive tiles */
.year-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; margin-top: 16px; }
.year-strip-big { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.year-tile { position: relative; aspect-ratio: 4 / 3; border-radius: var(--radius); overflow: hidden; background: var(--c-deep); color: #fff; text-decoration: none; display: flex; align-items: flex-end; }
.year-tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .7; transition: transform .4s ease, opacity .3s; }
.year-tile:hover img { transform: scale(1.05); opacity: .55; }
.year-tile span { position: relative; padding: 12px 14px; font-weight: 800; font-size: 1.35rem; line-height: 1.2; text-shadow: 0 1px 8px rgb(0 0 0 / .6); }
.year-tile small { display: block; font-size: .8rem; font-weight: 500; opacity: .9; }
.year-strip:not(.year-strip-big) .year-tile span { font-size: 1.05rem; }
.year-tile-more { background: repeating-conic-gradient(var(--c-archive) 0 25%, color-mix(in srgb, var(--c-archive) 75%, #fff) 0 50%) 0 0 / 40px 40px; }
.year-tile-more span { font-size: 1.1rem; }

/* Sponsors */
.sponsors { background: var(--surface); }
.sponsor-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.sponsor-grid li { background: #fff; border-radius: 12px; display: grid; place-items: center; padding: 16px; aspect-ratio: 3 / 2; }
.sponsor-grid img { max-height: 70px; width: auto; object-fit: contain; }

/* Inner pages */
.page-head { background: var(--surface); border-bottom: 6px solid var(--accent); padding-block: 28px 22px; }
.page-head h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
.page-sub { color: var(--muted); margin: 0; font-size: 1.1rem; }
.crumb { margin: 0 0 4px; font-size: .9rem; }
.crumb a { color: var(--muted); text-decoration: none; }
.accent-open { --accent: var(--c-open); } .accent-school { --accent: var(--c-school); }
.accent-archive { --accent: var(--c-archive); } .accent-live { --accent: var(--c-chess); }
.accent-chess { --accent: var(--c-chess); }
.accent-register { --accent: var(--c-cta); } .accent-none { --accent: var(--c-btn); }
.page-open, .page-year { --accent: var(--c-open); }
.page-school { --accent: var(--c-school); }
.page-archive, .page-tournament, .page-year { --accent: var(--c-archive); }

.layout-2 { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 40px; align-items: start; }
.layout-2 > div > h2:first-child, .layout-2 .prose > h2:first-child { margin-top: 0; }
@media (max-width: 900px) { .layout-2 { grid-template-columns: 1fr; } }
.side { display: grid; gap: 18px; position: sticky; top: 90px; }
@media (max-width: 900px) { .side { position: static; } }
.side-box { background: var(--surface); border-radius: var(--radius); padding: 18px 20px; }
.side-box h2 { margin: 0 0 .5em; font-size: 1.2rem; }
.link-list { list-style: none; padding: 0; margin: 0; }
.link-list li { padding: 7px 0; border-bottom: 1px solid var(--line); }
.link-list li:last-child { border: 0; }
.link-list a { text-decoration: none; font-weight: 600; }

.prose { max-width: 75ch; }
.prose ol, .prose ul { padding-left: 1.4em; }
.prose li { margin: .35em 0; }
.prose table { border-collapse: collapse; }

.timeline { list-style: none; padding: 0; margin: 10px 0 16px; }
.timeline li { display: flex; gap: 14px; align-items: baseline; padding: 6px 0 6px 18px; border-left: 3px solid var(--accent); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 13px; width: 11px; height: 11px; background: var(--bg); border: 3px solid var(--accent); border-radius: 3px; }
.timeline time { font-weight: 800; font-variant-numeric: tabular-nums; min-width: 3.2em; }
.timeline-end time { color: var(--c-chess); }

.prize-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.prize-group { background: var(--surface); border-radius: 12px; padding: 14px 16px; border-top: 4px solid var(--c); }
.prize-main { --c: var(--c-cta); } .prize-women { --c: var(--c-chess); } .prize-special { --c: var(--c-school); }
.prize-group ol { list-style: none; margin: 0; padding: 0; }
.prize-group li { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-bottom: 1px dashed var(--line); }
.prize-group li:last-child { border: 0; }
.prize-main li:first-child strong { font-size: 1.25rem; }
.note { color: var(--muted); }

.venue { display: grid; grid-template-columns: minmax(0, 1.4fr) 1fr; gap: 18px; align-items: start; }
.venue iframe { width: 100%; aspect-ratio: 4 / 3; border: 0; border-radius: 12px; background: var(--surface); }
@media (max-width: 640px) { .venue { grid-template-columns: 1fr; } }

.status { display: inline-block; font-weight: 700; padding: 6px 14px; border-radius: 999px; }
.status-open { background: color-mix(in srgb, var(--c-ok) 22%, transparent); }
.status-closed { background: color-mix(in srgb, var(--c-bad) 18%, transparent); }
.notice { background: var(--surface); border-left: 4px solid var(--c-cta); padding: 14px 18px; border-radius: 0 10px 10px 0; }
.edition-notice { margin: 16px 0; }
.fee-list { list-style: none; padding: 0; margin: 0; }
.fee-list li { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--line); }

/* Registration forms */
.reg + .reg { margin-top: 40px; padding-top: 8px; border-top: 1px solid var(--line); }
.reg-form { display: grid; gap: 14px; max-width: 640px; margin-top: 18px; }
.reg-form fieldset { border: 0; margin: 0; padding: 16px 18px; background: var(--surface); border-radius: var(--radius); display: grid; gap: 10px; }
.reg-form legend { float: left; font-weight: 800; letter-spacing: .08em; font-size: .8rem; color: var(--muted); padding: 0; }
.field { display: grid; gap: 4px; align-content: start; }
.field label, .field .label { font-weight: 650; }
.field .opt { font-weight: 400; color: var(--muted); font-size: .9em; }
.field input:not([type=checkbox]), .field select, .field textarea, .fide-search input {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg);
  color: var(--text); font: inherit; min-height: 44px;
}
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .fide-search input:focus { outline: 3px solid color-mix(in srgb, var(--c-open) 45%, transparent); border-color: var(--c-open); }
.field.invalid input, .field.invalid select { border-color: var(--c-bad); }
.field-error { color: var(--c-bad); font-size: .88rem; margin: 0; min-height: 0; }
.field-error:empty { display: none; }
.hint { color: var(--muted); font-size: .88rem; margin: 0; }
.field.check { grid-template-columns: auto 1fr; align-items: start; column-gap: 10px; }
.field.check input { width: 20px; height: 20px; margin: 3px 0 0; accent-color: var(--c-btn); }
.field.check label { font-weight: 400; }
.field.check .field-error { grid-column: 2; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .grid-2 { grid-template-columns: 1fr; } }
.inline { display: flex; gap: 8px; }
.inline input { flex: 1; min-width: 0; }
.inline .btn { flex: none; }
.fide-card { background: var(--bg); border-radius: 10px; padding: 10px 14px; border-left: 4px solid var(--c-open); }
.fide-card p { margin: 0 0 2px; }
.fide-card .notice { margin: 0; }
.fide-name { font-weight: 800; font-size: 1.1rem; }
.fide-search summary { cursor: pointer; color: var(--link); font-size: .95rem; }
.fide-search[open] summary { margin-bottom: 8px; }
.fide-search .hint { margin-top: 6px; }
.fide-results { list-style: none; padding: 0; margin: 6px 0 0; max-height: 340px; overflow: auto; }
.fide-results li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.fide-results li div { display: grid; }
.fide-results .muted { font-size: .85rem; }
.fide-results .btn { padding: .35em .9em; font-size: .9rem; }
.linklike { background: none; border: 0; padding: 0; color: var(--link); font: inherit; text-decoration: underline; cursor: pointer; }
.fee-preview { font-weight: 700; margin: 0; }
.form-error { color: var(--c-bad); font-weight: 650; margin: 0; }
.form-error:empty { display: none; }
.reg-form .btn[disabled] { opacity: .6; cursor: progress; transform: none; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.category { font-weight: 800; font-size: 1.15rem; margin: 6px 0 0; }
.reg-done { margin-top: 18px; padding: 18px 20px; border-radius: var(--radius); background: color-mix(in srgb, var(--c-ok) 15%, var(--bg)); border-left: 5px solid var(--c-ok); max-width: 640px; }
.reg-done:focus { outline: none; }
.reg-done h3 { font-size: 1.35rem; margin-bottom: .3em; }
.reg-ref { font-size: 1.1rem; font-weight: 800; font-variant-numeric: tabular-nums; }
dl.pay { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0; }
dl.pay dt { color: var(--muted); }
dl.pay dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }

/* Players list */
.table-scroll { overflow-x: auto; }
table.players-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.players-table th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 6px 8px; border-bottom: 2px solid var(--line); }
.players-table td { padding: 7px 8px; border-bottom: 1px solid var(--line); }
.players-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.players-table td:nth-child(2) { font-weight: 650; }
.players-table tbody tr:nth-child(-n+3) td:first-child { color: var(--c-open); font-weight: 800; }

table.champions { width: 100%; border-collapse: collapse; font-size: .88rem; }
.champions th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 4px 6px; }
.champions td { padding: 5px 6px; border-top: 1px solid var(--line); vertical-align: top; }
.champions td:first-child { font-weight: 800; font-variant-numeric: tabular-nums; }
.champions .not-held td { color: var(--muted); font-style: italic; }

.results-list { list-style: none; padding: 0; columns: 2 220px; }
.results-list li { padding: 4px 0; break-inside: avoid; }
.results-list strong { display: inline-block; min-width: 3.2em; }
.links-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }

/* Galleries */
.gallery { margin: 0 0 28px; }
.gallery figcaption { font-weight: 700; margin: 0 0 10px; }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.gallery-grid a { display: block; aspect-ratio: 1; overflow: hidden; border-radius: 8px; background: var(--surface); }
.gallery-grid img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
.gallery-grid a:hover img { transform: scale(1.06); }
.gallery-grid a { position: relative; }
.gallery-cap { position: absolute; inset: auto 0 0 0; padding: 18px 8px 6px; font-size: .78rem; line-height: 1.25; color: #fff;
  background: linear-gradient(transparent, rgba(0,0,0,.72)); }
/* posters and press pages: whole page, no square crop */
.gallery-posters .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.gallery-posters .gallery-grid a { aspect-ratio: 3 / 4; }
.gallery-posters .gallery-grid img { object-fit: contain; padding: 6px 6px 34px; }
.gallery-posters .gallery-grid a:hover img { transform: scale(1.03); }
.gallery-posters .gallery-cap { background: none; color: var(--text); padding: 6px 8px; font-weight: 600; }

.videos { display: flex; flex-wrap: wrap; gap: 16px; margin: 0 0 28px; }
.video { margin: 0; flex: 0 1 auto; max-width: 100%; }
.video video { display: block; max-width: 100%; max-height: 70vh; border-radius: 8px; background: #000; }
.video figcaption { font-size: .9rem; color: var(--muted); margin-top: 6px; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.photo-grid figure { margin: 0; }
.photo-grid a { display: block; border-radius: 10px; overflow: hidden; aspect-ratio: 4 / 3; background: var(--surface); }
.photo-grid img { width: 100%; height: 100%; object-fit: cover; }
.photo-grid figcaption { font-size: .85rem; color: var(--muted); margin-top: 6px; }

/* Game viewer */
.viewer { display: grid; grid-template-columns: minmax(0, 520px) minmax(0, 1fr); gap: 24px; align-items: start; background: var(--surface); border-radius: var(--radius); padding: 18px; }
@media (max-width: 860px) { .viewer { grid-template-columns: 1fr; } }
.viewer-board { aspect-ratio: 1; width: 100%; }
.viewer-controls { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.viewer-controls button { flex: 1; min-width: 44px; padding: 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font-size: 1.05rem; cursor: pointer; }
.viewer-controls button:hover { border-color: var(--accent); }
.viewer-side { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.viewer-side select, .viewer-side input { width: 100%; padding: 9px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; }
.viewer-players { font-weight: 700; display: flex; justify-content: space-between; gap: 10px; }
.viewer-moves { background: var(--bg); border-radius: 10px; padding: 10px; max-height: 360px; overflow: auto; font-variant-numeric: tabular-nums; line-height: 1.9; border: 1px solid var(--line); }
.viewer-moves .n { color: var(--muted); margin-right: 3px; }
.viewer-moves button { border: 0; background: none; color: var(--text); padding: 1px 4px; border-radius: 4px; cursor: pointer; font: inherit; }
.viewer-moves button.on { background: var(--c-cta); color: var(--c-cta-text); }
.viewer-moves .result { font-weight: 800; margin-left: 6px; }
.viewer-meta { font-size: .85rem; color: var(--muted); }

/* Chess corner: puzzle, play, analysis */
.chess { display: grid; grid-template-columns: minmax(0, 520px) minmax(0, 1fr); gap: 24px; align-items: start; background: var(--surface); border-radius: var(--radius); padding: 18px; margin-bottom: 28px; }
@media (max-width: 860px) { .chess { grid-template-columns: 1fr; } }
/* home page: today's puzzle and the game of the week side by side, each board above its controls */
.home-chess { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 8px 40px; align-items: start; }
.home-chess .chess, .home-chess .viewer { grid-template-columns: 1fr; gap: 14px; margin-bottom: 0; }
.home-chess .viewer-moves { max-height: 150px; }
.home-chess .section-title + p { min-height: 3.2em; }
.chess-board { aspect-ratio: 1; width: 100%; }
.chess-side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.chess-side select, .chess-side textarea { width: 100%; padding: 9px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; }
.chess-side textarea { font-family: ui-monospace, monospace; font-size: .85rem; margin: 8px 0; }
.chess-row { display: flex; gap: 8px; }
.chess-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.chess-actions .btn { padding: 8px 14px; }
.chess-tabs { display: flex; gap: 6px; }
.chess-tabs button { flex: 1; padding: 9px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; font-weight: 700; cursor: pointer; }
.chess-tabs button[aria-selected="true"] { background: var(--c-chess); border-color: var(--c-chess); color: #fff; }
.chess-status { font-size: 1.1rem; font-weight: 700; margin: 0; padding: 10px 14px; border-radius: 10px; background: var(--bg); border-left: 4px solid var(--line); }
.chess-status.good { border-left-color: var(--c-ok); }
.chess-status.bad { border-left-color: var(--c-bad); }
.chess-info { margin: 0; color: var(--muted); }
.chess-moves { max-height: 240px; }
.chess-toggle { font-weight: 700; display: flex; align-items: center; gap: 6px; }
.chess-cards { margin-top: 8px; }
.small { font-size: .85rem; }
.analysis-main { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; align-items: stretch; }
.eval-bar { position: relative; background: #3a3a37; border: 1px solid #3a3a37; border-radius: 6px; overflow: hidden; }
.eval-fill { position: absolute; left: 0; right: 0; bottom: 0; height: 50%; background: #fff; transition: height .3s; }
.eval-text { position: absolute; left: 0; right: 0; top: 4px; text-align: center; font-size: .6rem; font-weight: 800; color: #f4f4ef; mix-blend-mode: difference; writing-mode: vertical-rl; transform: rotate(180deg); }
.engine-lines { margin: 0; padding-left: 1.4em; font-size: .9rem; min-height: 4.5em; }
.engine-lines li { margin-bottom: 4px; }
.engine-lines b { display: inline-block; min-width: 3.4em; }
.viewer-links { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 0; }
.viewer-analyse { padding: 6px 14px; }

/* Board theme "pdz" (cm-chessboard cssClass): ikastola blue tones */
.cm-chessboard.pdz .board .square.white { fill: var(--board-light); }
.cm-chessboard.pdz .board .square.black { fill: var(--board-dark); }
.cm-chessboard.pdz.border-type-thin .board .border { fill: var(--board-border); stroke: var(--board-border); }
.cm-chessboard.pdz .coordinates { pointer-events: none; user-select: none; }
.cm-chessboard.pdz .coordinates .coordinate { font-size: 7px; font-weight: 600; }
.cm-chessboard.pdz .coordinates .coordinate.black { fill: var(--board-light); }
.cm-chessboard.pdz .coordinates .coordinate.white { fill: var(--board-border); }

/* Footer */
.site-footer { background: var(--c-deep); color: var(--c-on-deep-muted); margin-top: 48px; }
.site-footer a { color: var(--c-on-deep); }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 24px; padding-block: 36px 18px; font-size: .95rem; }
.footer-title { color: var(--c-on-deep); font-weight: 800; margin-top: 0; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { padding: 3px 0; }
.footer-bottom { border-top: 1px solid #34342f; padding-block: 14px 22px; font-size: .85rem; color: #a9a9a1; }

.embed iframe { width: 100%; aspect-ratio: 16 / 10; border: 0; border-radius: 12px; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; } }
.chess-cards .card { --accent: var(--c-chess); }
