/* Spoločný základ: farby, písmo, tlačidlá, formuláre. Farby značky sa menia tu. */

:root {
  --bg: #FBFAF7;
  --surface: #FFFFFF;
  --ink: #1D1D1F;
  --muted: #66625B;
  --line: #E7E3DA;
  --soft: #F3F0E9;
  --accent: #B5533C;
  --accent-dark: #97422E;
  --accent-soft: #F8E9E4;
  --ok: #2F7D4F;
  --warn: #9A6A12;
  --bad: #C5221F;
  --radius: 12px;
  --shadow: 0 6px 24px rgba(40, 30, 20, 0.10);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "FK Playfair", Georgia, "Times New Roman", serif;
}

*, *::before, *::after { box-sizing: border-box; }

/* atribút hidden musí skryť prvok aj tam, kde má trieda vlastné display */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5em; }
p { margin: 0 0 1em; }
a { color: var(--accent-dark); }
img { max-width: 100%; display: block; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

.muted, .hint { color: var(--muted); }
.hint { font-size: 13px; line-height: 1.45; margin: 8px 0; }

/* --- tlačidlá ------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 9px 18px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--ink);
  font: 600 15px/1.2 var(--font); text-decoration: none; cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
.btn:hover { border-color: #cfc9bc; background: #fdfcf9; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-danger:hover { background: #a31b19; border-color: #a31b19; }
.btn-block { display: flex; width: 100%; margin: 0 0 10px; }
.btn-large { min-height: 54px; padding: 14px 30px; font-size: 17px; }
.btn-small { min-height: 34px; padding: 6px 14px; font-size: 14px; }

.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; padding: 0;
  border: 0; border-radius: 10px; background: transparent; color: var(--ink); cursor: pointer;
  font: 600 20px/1 var(--font);
}
.btn-icon:hover { background: var(--soft); }
.btn-icon[disabled] { opacity: 0.35; cursor: default; }
.btn-icon.on { background: var(--accent-soft); color: var(--accent-dark); }
.btn-icon.small { width: 28px; height: 28px; border-radius: 7px; }
.btn-icon.light { color: #fff; }
.btn-icon.light:hover { background: rgba(255, 255, 255, 0.15); }

.link { background: none; border: 0; padding: 0; color: var(--accent-dark); font: inherit; text-decoration: underline; cursor: pointer; }
.ico { display: inline-flex; }

/* --- formuláre -------------------------------------------------------------- */

.field { display: block; margin: 0 0 12px; }
.field > span { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 0 0 5px; }
input[type="text"], input[type="email"], input[type="tel"], input[type="number"], input[type="password"], input[type="date"], select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1px solid #cfc9bc; border-radius: 10px; background: #fff; color: var(--ink);
  font: 16px/1.4 var(--font);
}
textarea { resize: vertical; min-height: 96px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.field-warn { color: var(--bad); font-size: 13px; margin: -4px 0 12px; }
.row { display: flex; gap: 10px; align-items: flex-start; }
.row .grow { flex: 1; min-width: 0; }
.checkline { display: flex; gap: 10px; align-items: flex-start; margin: 12px 0; cursor: pointer; }
.checkline input { width: 22px; height: 22px; margin: 1px 0 0; flex: none; accent-color: var(--accent); }

/* --- modálne okno, oznamy ----------------------------------------------------- */

.overlay {
  position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center;
  padding: 16px; background: rgba(20, 16, 12, 0.5);
}
.modal {
  width: 100%; max-width: 460px; max-height: calc(100dvh - 32px); display: flex; flex-direction: column;
  background: var(--surface); border-radius: 16px; box-shadow: var(--shadow);
}
.modal-wide { max-width: 640px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 12px 8px 22px; }
.modal-head h2 { font-size: 19px; margin: 0; }
.modal-body { padding: 4px 22px 8px; overflow: auto; }
.modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding: 12px 22px 20px; }

#toasts { position: fixed; left: 50%; bottom: 84px; z-index: 1100; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; width: min(92vw, 440px); pointer-events: none; }
.toast { padding: 12px 16px; border-radius: 12px; background: #2a2622; color: #fff; font-size: 14px; box-shadow: var(--shadow); transition: opacity 0.35s; }
.toast-ok { background: var(--ok); }
.toast-error { background: var(--bad); }
.toast.out { opacity: 0; }

.spinner { width: 36px; height: 36px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* Nadpisy: Playfair Display z lokálneho súboru (ten istý font je aj v editore a v PDF). */
@font-face {
  font-family: "FK Playfair";
  src: url("/assets/fonts/PlayfairDisplay-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* --- listovací náhľad knihy (editor aj ukážky na úvodnej stránke) ---------------------------------------------------- */

.pv-overlay { position: fixed; inset: 0; z-index: 900; display: grid; grid-template-rows: auto 1fr auto; background: #2b2723; color: #fff; }
.pv-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 10px 8px 18px; padding-top: max(8px, env(safe-area-inset-top)); }
.pv-actions { display: flex; align-items: center; gap: 8px; }
.pv-stage { position: relative; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.pv-book { position: relative; }
.pv-flip { margin: 0 auto; }
.pv-page { background: #fff; overflow: hidden; }
.pv-canvas { display: block; width: 100%; height: 100%; }
.pv-status { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: #2b2723; }
.pv-nav { flex: none; width: 52px; height: 52px; margin: 0 8px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.12); color: #fff; cursor: pointer; display: none; align-items: center; justify-content: center; }
.pv-nav:hover { background: rgba(255, 255, 255, 0.22); }
.pv-nav[disabled] { opacity: 0.25; cursor: default; }
.pv-bottom { padding: 10px 16px; padding-bottom: max(12px, env(safe-area-inset-bottom)); text-align: center; font-size: 14px; color: #d8d2c8; min-height: 44px; }
body.pv-open { overflow: hidden; }
@media (min-width: 760px) { .pv-nav { display: flex; } }

/* Logo: značka pred názvom všade, kde je .brand */
.brand { display: inline-flex; align-items: center; gap: 9px; white-space: nowrap; }
.brand::before { content: ""; flex: none; width: 30px; height: 30px; background: url("/assets/img/logo-mark.svg") center / contain no-repeat; }
.site-head .brand { font-size: 19px; }
.topbar .brand::before { display: none; }
@media (min-width: 900px) { .topbar .brand::before { display: block; width: 26px; height: 26px; } .site-head .brand { font-size: 22px; } }
