/* Přístupná rezervace míst – společné styly.
   Kontrast: běžný text ≥ 7:1 (WCAG AAA) ve světlém i tmavém režimu (ověřeno skriptem). */

:root {
  color-scheme: light;
  --bg: #f5f5f2;
  --surface: #ffffff;
  --surface-2: #eef0f2;
  --text: #17191c;
  --muted: #3c4148;
  --border: #6b7280;
  --accent: #0b4a85;
  --accent-text: #ffffff;
  --focus: #0b4a85;

  --cell-seat-bg: #e3eaf3;      --cell-seat-text: #14233a;
  --cell-free-bg: #d7f0dd;      --cell-free-text: #0b3a17;      --cell-free-border: #2c7a41;
  --cell-occupied-bg: #f5d4d4;  --cell-occupied-text: #5a0b0b;  --cell-occupied-border: #a12a2a;
  --cell-reserved-bg: #fae6bb;  --cell-reserved-text: #452e00;  --cell-reserved-border: #8a5f00;
  --cell-corridor-bg: #f1f1ee;  --cell-corridor-text: #3c4148;
  --cell-door-bg: #e7e0f2;      --cell-door-text: #2b1748;
  --cell-wc-bg: #dcefef;        --cell-wc-text: #0d3435;
  --cell-other-bg: #e9e9e6;     --cell-other-text: #26292d;
  --hatch: rgba(90, 11, 11, .16);
  --outline: #2b1748;           --outline-text: #ffffff;

  --notice-success-bg: #d7f0dd; --notice-success-text: #0b3a17;
  --notice-warning-bg: #fae6bb; --notice-warning-text: #452e00;
  --notice-error-bg: #f5d4d4;   --notice-error-text: #5a0b0b;

  --radius: .5rem;
  --shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 4px 16px rgba(0, 0, 0, .06);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #111316;
    --surface: #1b1e23;
    --surface-2: #252a31;
    --text: #f1f2f4;
    --muted: #c9ced6;
    --border: #8b94a1;
    --accent: #9dccff;
    --accent-text: #0b1a2b;
    --focus: #9dccff;

    --cell-seat-bg: #22303f;      --cell-seat-text: #e6eef8;
    --cell-free-bg: #11391e;      --cell-free-text: #d4f6dd;      --cell-free-border: #5cc27a;
    --cell-occupied-bg: #461619;  --cell-occupied-text: #ffdada;  --cell-occupied-border: #e57373;
    --cell-reserved-bg: #3d2e0a;  --cell-reserved-text: #ffe8b0;  --cell-reserved-border: #dcaa3c;
    --cell-corridor-bg: #1d2024;  --cell-corridor-text: #c9ced6;
    --cell-door-bg: #2f2542;      --cell-door-text: #ece2ff;
    --cell-wc-bg: #153334;        --cell-wc-text: #d2f1f1;
    --cell-other-bg: #2a2d32;     --cell-other-text: #eceef1;
    --hatch: rgba(255, 218, 218, .12);
    --outline: #d9c8ff;           --outline-text: #1b1030;

    --notice-success-bg: #11391e; --notice-success-text: #d4f6dd;
    --notice-warning-bg: #3d2e0a; --notice-warning-text: #ffe8b0;
    --notice-error-bg: #461619;   --notice-error-text: #ffdada;
    --shadow: none;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 1rem/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent); text-underline-offset: .15em; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.container {
  width: min(100% - 2rem, 72rem);
  margin-inline: auto;
}

main { padding-block: 1.5rem 3rem; }
main:focus { outline: none; }

h1, h2, h3 { line-height: 1.25; }
h1 { font-size: clamp(1.6rem, 1.2rem + 1.5vw, 2.2rem); margin: .5rem 0 1rem; }
h2 { font-size: 1.4rem; margin: 2rem 0 .75rem; }
h3 { font-size: 1.15rem; margin: 1.5rem 0 .5rem; }

.lead { font-size: 1.1rem; max-width: 60rem; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap; border: 0;
}

/* Hlavička a navigace */
.skip-link {
  position: absolute; left: 1rem; top: -4rem;
  padding: .5rem 1rem; background: var(--accent); color: var(--accent-text);
  border-radius: var(--radius); z-index: 10;
}
.skip-link:focus { top: 1rem; }

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.site-header__inner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: .5rem 2rem; padding-block: .75rem;
}
.site-brand { margin: 0; font-weight: 700; font-size: 1.1rem; }
.site-brand a { color: var(--text); text-decoration: none; }
.site-brand__icon { color: var(--accent); }
.site-nav { display: flex; flex-wrap: wrap; gap: .25rem; list-style: none; margin: 0; padding: 0; }
.site-nav a {
  display: block; padding: .4rem .8rem; border-radius: var(--radius);
  color: var(--text); text-decoration: none; border: 2px solid transparent;
}
.site-nav a:hover { border-color: var(--border); }
.site-nav a[aria-current="page"] {
  border-color: var(--accent); font-weight: 700;
  text-decoration: underline; text-decoration-thickness: 2px;
}

.site-footer { border-top: 1px solid var(--border); color: var(--muted); font-size: .9rem; }

/* Panely, formuláře */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem 1.25rem;
  box-shadow: var(--shadow);
  margin-block: 1.5rem;
}
.panel > h2:first-child { margin-top: 0; }

.settings-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  gap: 1rem 1.5rem;
  align-items: start;
}
.field { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.field--wide { grid-column: 1 / -1; }
.field--check { flex-direction: row; align-items: center; gap: .5rem; }
.field--radios { border: 0; padding: 0; margin: 0; flex-direction: row; flex-wrap: wrap; gap: .25rem 1rem; }
.field--radios legend { padding: 0; margin-bottom: .3rem; font-weight: 600; width: 100%; }
.field > label, .field > span.label { font-weight: 600; }
.hint { color: var(--muted); font-size: .92rem; margin: 0; width: 100%; }

input[type="text"], input[type="number"], select, textarea {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: .35rem;
  padding: .45rem .6rem; min-height: 2.5rem; width: 100%;
}
input[type="checkbox"], input[type="radio"] { width: 1.15rem; height: 1.15rem; accent-color: var(--accent); }

.button {
  font: inherit; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .55rem 1.1rem; min-height: 2.75rem;
  color: var(--accent-text); background: var(--accent);
  border: 2px solid var(--accent); border-radius: var(--radius);
}
.button:hover { filter: brightness(1.1); }
.button--secondary { background: var(--surface); color: var(--accent); }
.button:disabled { cursor: not-allowed; opacity: .6; }

.notice { border-radius: var(--radius); padding: .75rem 1rem; margin-block: 1rem; border-left: .4rem solid currentColor; }
.notice p { margin: 0; }
.notice--success { background: var(--notice-success-bg); color: var(--notice-success-text); }
.notice--warning { background: var(--notice-warning-bg); color: var(--notice-warning-text); }
.notice--error { background: var(--notice-error-bg); color: var(--notice-error-text); }

/* Správa schématu, přihlášení */
.field-error { color: var(--notice-error-text); background: var(--notice-error-bg); font-weight: 600; margin: 0; padding: .2rem .5rem; border-radius: .25rem; }
[aria-invalid="true"] { border: 2px solid var(--notice-error-text); }
.error-summary h2 { margin-top: 0; font-size: 1.15rem; }
.error-summary a { color: inherit; }
.stack { display: flex; flex-direction: column; gap: .9rem; max-width: 40rem; }
.button-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
a.button { text-decoration: none; }
fieldset.field { border: 1px solid var(--border); border-radius: var(--radius); padding: .5rem .9rem .75rem; }
fieldset.field legend { font-weight: 600; padding-inline: .25rem; }
.check-list { list-style: none; padding: 0 0 0 1.5rem; margin: .25rem 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr)); gap: .15rem 1rem; }
.item-list { list-style: none; padding: 0; display: grid; gap: .5rem; }
.item-list li { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1rem; padding: .5rem .75rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.item-list__picto { display: inline-grid; place-items: center; min-width: 2rem; font-weight: 800; font-size: .8rem; }
.item-list__text { flex: 1 1 14rem; }
.site-nav form { margin: 0; }
.site-nav .link-button {
  font: inherit; color: var(--text); background: none; cursor: pointer;
  padding: .4rem .8rem; border: 2px solid transparent; border-radius: var(--radius);
}
.site-nav .link-button:hover { border-color: var(--border); }

/* Legenda */
.legend-box { margin-block: 1rem; }
.legend-box summary { cursor: pointer; font-weight: 700; padding-block: .25rem; }
.legend {
  list-style: none; padding: 0; margin: .5rem 0;
  display: flex; flex-wrap: wrap; gap: .5rem 1.5rem;
}
.legend li { display: flex; align-items: center; gap: .5rem; }
.legend--pictograms { gap: .5rem 1.75rem; }
.legend-picto {
  display: inline-flex; align-items: center; justify-content: center; gap: .15rem;
  min-width: 2.25rem; height: 2.25rem; padding-inline: .25rem;
  border-radius: .35rem; background: var(--cell-seat-bg); color: var(--cell-seat-text);
}
.legend-picto .ico { width: 1.4rem; height: 1.4rem; }
.legend-outline {
  display: inline-grid; place-items: center; width: 1.75rem; height: 1.75rem;
  border: 3px solid var(--outline); border-radius: .2rem;
  font-size: .7rem; font-weight: 800;
}
.legend-swatch {
  display: inline-grid; place-items: center;
  width: 2.25rem; height: 2.25rem; font-weight: 700;
  border-radius: .35rem;
}

/* Plánek */
.plan-form { display: flex; flex-direction: column; align-items: flex-start; gap: 1rem; }

.plan {
  border-collapse: separate;
  border-spacing: 3px;
  table-layout: fixed;
  width: min(100%, calc(var(--plan-columns) * 4.25rem));
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  margin-block: 1rem;
}
.plan caption { text-align: start; font-weight: 700; padding: .25rem 0 .5rem; caption-side: top; }

.cell {
  position: relative;
  height: 3.6rem;
  padding: 0;
  text-align: center;
  vertical-align: middle;
  border-radius: .3rem;
  overflow-wrap: anywhere;
  font-size: .95rem;
  line-height: 1.2;
}
.plan--wide .cell { font-size: clamp(.65rem, .5rem + .5vw, .95rem); }

.cell label { display: block; cursor: pointer; height: 100%; }
.cell > input[type="checkbox"] {
  position: absolute; right: .2rem; bottom: .2rem; margin: 0;
  width: .95rem; height: .95rem;
}

/* vizuální obsah buňky: piktogram + číslo, pod tím řádek ikon vybavení */
.cell-visual {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .15rem; min-height: 3.25rem; padding: .85rem .15rem .3rem;
}
.cell:has(> input) .cell-visual { padding-bottom: 1.2rem; }
.cell-main { display: flex; align-items: center; justify-content: center; gap: .2rem; font-weight: 700; flex-wrap: wrap; }
.cell-icons { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: .1rem .25rem; }
.cell-arrow { position: absolute; top: .05rem; left: .25rem; font-size: .8rem; font-weight: 400; }
.cell-state { position: absolute; top: .1rem; right: .25rem; font-size: .8rem; font-weight: 700; }
.cell-group {
  position: absolute; top: .1rem; left: .2rem;
  font-size: .7rem; font-weight: 800; line-height: 1;
  padding: .05rem .2rem; border-radius: .2rem;
  background: var(--outline); color: var(--outline-text);
}

.ico { display: block; width: 1.2rem; height: 1.2rem; flex: none; }
.ico-seat { width: 1.45rem; height: 1.45rem; }
.ico-seat--none { opacity: .75; }
.ico-type { width: 1.6rem; height: 1.6rem; }
.ico-detail { width: 1rem; height: 1rem; }
.badge {
  display: inline-block; font-size: .68rem; font-weight: 800; line-height: 1.15;
  border: 1.5px solid currentColor; border-radius: .2rem; padding: 0 .15rem;
}
.plan--wide .cell-visual { padding-inline: 0; }
.plan--wide .ico-detail { width: .85rem; height: .85rem; }

/* ohraničení kupé: pruh v mezeře mezi buňkami, jen na stranách, kde kupé končí */
.cell[class*="edge-"] {
  box-shadow: var(--edge-t, 0 0 transparent), var(--edge-r, 0 0 transparent), var(--edge-b, 0 0 transparent), var(--edge-l, 0 0 transparent);
}
.cell.edge-t { --edge-t: 0 -3px 0 0 var(--outline); }
.cell.edge-r { --edge-r: 3px 0 0 0 var(--outline); }
.cell.edge-b { --edge-b: 0 3px 0 0 var(--outline); }
.cell.edge-l { --edge-l: -3px 0 0 0 var(--outline); }

/* úplný popis v buňce je jen pro čtečky; vizuálně ho nabízí textový seznam pod plánkem */
.plan .cell-desc {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

.plan-list { margin-block: 1rem; max-width: 60rem; }
.plan-list summary { cursor: pointer; font-weight: 700; }
.plan-list ul { list-style: none; padding: 0; margin: .5rem 0; display: grid; gap: .35rem; }
.cell-item { display: flex; align-items: flex-start; gap: .6rem; }
.cell-item__icon {
  flex: none; display: inline-grid; place-items: center;
  width: 1.6rem; height: 1.6rem; font-size: .8rem; font-weight: 700; border-radius: .25rem;
}

/* typy buněk */
.cell { background: var(--cell-other-bg); color: var(--cell-other-text); }
.cell.type-seat, .cell.type-foldingseat, .cell.type-wheelchair { background: var(--cell-seat-bg); color: var(--cell-seat-text); border: 2px solid transparent; }
.cell.type-foldingseat { border-style: dashed; border-color: currentColor; }
.cell.type-corridor, .cell.type-empty { background: var(--cell-corridor-bg); color: var(--cell-corridor-text); }
.cell.type-empty { background: transparent; }
.cell[class*="doors"], .cell.type-transition, .cell.type-stairs { background: var(--cell-door-bg); color: var(--cell-door-text); }
.cell.type-wc, .cell.type-wchandicap, .cell.type-trash { background: var(--cell-wc-bg); color: var(--cell-wc-text); }

/* stavy míst: barva + ikona + vzor/rámeček, nikdy jen barva */
.cell.state-free { background: var(--cell-free-bg); color: var(--cell-free-text); border: 2px solid var(--cell-free-border); }
.cell.state-occupied {
  background: repeating-linear-gradient(135deg, var(--hatch) 0 4px, transparent 4px 9px), var(--cell-occupied-bg);
  color: var(--cell-occupied-text);
  border: 2px solid var(--cell-occupied-border);
}
.cell.state-reserved {
  background: var(--cell-reserved-bg); color: var(--cell-reserved-text);
  border: 2px dashed var(--cell-reserved-border);
}
/* mezipatro: tečkovaný vzor (navíc ke štítku ½ a slovnímu popisu); až za typy buněk, aby je přebil */
.cell.level-mezzanine {
  background-image: radial-gradient(currentColor .6px, transparent .9px);
  background-size: 7px 7px;
}

.cell.state-free:has(input:checked) { outline: 3px solid var(--cell-free-text); outline-offset: -6px; }
.cell.state-free:has(input:checked) .cell-label::after { content: " ✓"; }
.cell:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 1px; }
.cell input:focus-visible { outline: none; }

/* Dokumentace */
.prose { max-width: 62rem; }
.prose li + li { margin-top: .3rem; }
.cards { list-style: none; padding: 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); }
.cards > li { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; box-shadow: var(--shadow); }
.cards h3 { margin-top: 0; display: flex; flex-direction: column; }
.cards .card-icon { order: -1; font-size: 1.6rem; line-height: 1; margin-bottom: .4rem; color: var(--accent); }
pre, code { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: .92rem; }
pre {
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem; white-space: pre-wrap; overflow-wrap: anywhere;
}
:not(pre) > code { background: var(--surface-2); padding: .05rem .3rem; border-radius: .25rem; }
.data-table { border-collapse: collapse; width: 100%; margin-block: 1rem; }
.data-table th, .data-table td { border: 1px solid var(--border); padding: .4rem .6rem; text-align: start; vertical-align: top; }
.data-table th { background: var(--surface-2); }

/* plánek naležato se na úzkém displeji nahradí variantou nastojato (hranice i v assets/plan.js) */
.plan-variant--narrow { display: none; }
@media (max-width: 48rem) {
  .plan-variant--wide { display: none; }
  .plan-variant--narrow { display: block; }
}

@media (max-width: 40rem) {
  .data-table thead { display: none; }
  .data-table tr { display: block; border: 1px solid var(--border); margin-bottom: .75rem; }
  .data-table td { display: block; border: 0; }
  .data-table td[data-label]::before { content: attr(data-label) ": "; font-weight: 700; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
