/*
  Project: Web presentation (single-page)
  Topic: Вредата от екранните устройства върху психиката и нервната система
  Style goals: dark, modern, non-flashy (no emojis, no gradients)
*/

:root {
  color-scheme: dark;

  --bg: #0f1115;
  --surface: #151a22;
  --surface-2: #11151c;
  --text: #e7e9ee;
  --text-2: #b7becc;
  --muted: #8a93a6;
  --border: #2a3342;
  --accent: #4aa3ff;
  --accent-2: #4fb6b0;
  --danger: #ff6b6b;
  --ok: #57d58d;

  --shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
  --radius: 16px;
  --radius-sm: 12px;

  --maxw: 1100px;
  --pad: 56px;
  --pad-mobile: 22px;

  --h1: clamp(2.1rem, 4vw, 3.2rem);
  --h2: clamp(1.5rem, 2.7vw, 2.1rem);
  --h3: clamp(1.1rem, 2vw, 1.35rem);
  --p: clamp(1.05rem, 1.3vw, 1.2rem);
}

* { box-sizing: border-box; }

/* Make the `hidden` attribute reliable even when classes set `display` */
[hidden] {
  display: none !important;
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  letter-spacing: 0.2px;
}

a {
  color: var(--accent);
  text-underline-offset: 3px;
}

a:hover { color: #7bbcff; }

a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 3px solid rgba(74, 163, 255, 0.8);
  outline-offset: 3px;
}

button {
  font: inherit;
}

.btn {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(42, 51, 66, 0.9);
  background: rgba(21, 26, 34, 0.92);
  color: var(--text);
  cursor: pointer;
}

.btn:hover {
  border-color: rgba(74, 163, 255, 0.6);
}

.btn--ghost {
  background: rgba(17, 21, 28, 0.6);
  color: var(--text-2);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  z-index: 999;
}

.skip-link:focus {
  left: 12px;
  top: 12px;
}

/* Top bar */
.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 18px;
  background: rgba(15, 17, 21, 0.72);
  border-bottom: 1px solid rgba(42, 51, 66, 0.55);
  backdrop-filter: blur(10px);
  z-index: 50;
}

/* Outline drawer */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 60;
}

.drawer {
  position: fixed;
  top: 56px;
  right: 0;
  height: calc(100vh - 56px);
  width: min(420px, 92vw);
  background: rgba(15, 17, 21, 0.92);
  border-left: 1px solid rgba(42, 51, 66, 0.7);
  backdrop-filter: blur(12px);
  z-index: 70;
  display: grid;
  grid-template-rows: auto 1fr;
}

.drawer__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid rgba(42, 51, 66, 0.65);
}

.drawer__title {
  font-weight: 700;
  letter-spacing: 0.2px;
}

.drawer__subtitle {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.98rem;
}

.drawer__content {
  padding: 14px 16px 18px;
  overflow: auto;
}

.drawer__list {
  margin: 0;
  padding-left: 18px;
}

.drawer__list li {
  margin: 10px 0;
}

.drawer__list a {
  color: var(--text);
  text-decoration: none;
  border: 1px solid rgba(42, 51, 66, 0.75);
  background: rgba(17, 21, 28, 0.55);
  padding: 10px 12px;
  border-radius: 12px;
  display: inline-flex;
  width: 100%;
}

.drawer__list a:hover {
  border-color: rgba(74, 163, 255, 0.55);
}

.drawer__list a[aria-current="true"] {
  border-color: rgba(79, 182, 176, 0.65);
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.brand__title {
  font-weight: 650;
  letter-spacing: 0.4px;
}

.brand__meta {
  color: var(--muted);
  font-size: 0.95rem;
}

.progress {
  width: min(420px, 38vw);
  height: 8px;
  border-radius: 999px;
  border: 1px solid rgba(42, 51, 66, 0.8);
  background: rgba(21, 26, 34, 0.85);
  overflow: hidden;
}

.progress__bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
}

.topbar__right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(42, 51, 66, 0.9);
  background: rgba(21, 26, 34, 0.9);
  color: var(--text-2);
  font-size: 0.95rem;
}

.kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  border: 1px solid rgba(42, 51, 66, 0.95);
  border-bottom-width: 2px;
  background: rgba(17, 21, 28, 0.85);
  padding: 2px 6px;
  border-radius: 8px;
  color: var(--text);
  font-size: 0.9rem;
}

/* Slides */
.deck {
  height: 100vh;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  .deck { scroll-behavior: auto; }
}

.slide {
  min-height: 100vh;
  scroll-snap-align: start;
  padding: calc(var(--pad) + 56px) var(--pad) var(--pad);
  display: flex;
  justify-content: center;
}

.slide__inner {
  width: 100%;
  max-width: var(--maxw);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 26px;
  align-items: start;
}

/* Slide-specific tweaks (small, targeted) */

/* Slide 3: add a tiny bit more scroll room so the interactive panel is easier to read */
#s03 {
  padding-bottom: calc(var(--pad) + 28px);
}

@media (max-width: 920px) {
  #s03 {
    padding-bottom: calc(var(--pad-mobile) + 24px);
  }
}

/* Slide 8: give the table more width compared to the right-side notes */
#s08 .slide__inner {
  /* Slightly wider overall so the right explanation card has more room */
  max-width: 1280px;
  /* Keep table dominant, but give the right column extra space */
  grid-template-columns: 1.12fr 0.88fr;
}

/* Slide 8: make the right "Как да „прочетем“ таблицата" card a touch easier to scan */
#s08 .slide__inner > .card:nth-child(2) p,
#s08 .slide__inner > .card:nth-child(2) li {
  font-size: clamp(1.0rem, 1.18vw, 1.12rem);
}

/* Slides with SVG diagrams: give the figure column a bit more room */
#s02 .slide__inner,
#s04 .slide__inner,
#s05 .slide__inner,
#s06 .slide__inner {
  grid-template-columns: 1fr 1fr;
}

.slide--full .slide__inner {
  grid-template-columns: 1fr;
}

@media (max-width: 920px) {
  .slide {
    padding: calc(var(--pad-mobile) + 56px) var(--pad-mobile) var(--pad-mobile);
  }

  .slide__inner {
    grid-template-columns: 1fr;
    gap: 18px;
  }
}

.card {
  background: var(--surface);
  border: 1px solid rgba(42, 51, 66, 0.85);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

/* Figures: slightly tighter padding so SVGs appear larger */
.card.figure {
  padding: 16px;
}

.card--subtle {
  background: var(--surface-2);
  box-shadow: none;
}

h1 { font-size: var(--h1); line-height: 1.1; margin: 0 0 10px; }

h2 { font-size: var(--h2); line-height: 1.2; margin: 0 0 10px; }

h3 { font-size: var(--h3); margin: 0 0 10px; color: var(--text); }

p, li {
  font-size: var(--p);
  color: var(--text-2);
}

strong { color: var(--text); font-weight: 650; }

.meta {
  margin-top: 12px;
  color: var(--muted);
  font-size: 1rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(42, 51, 66, 0.9);
  background: rgba(17, 21, 28, 0.65);
  color: var(--text);
  font-size: 0.95rem;
}

.badge--accent {
  border-color: rgba(74, 163, 255, 0.6);
  color: #cfe7ff;
}

.list {
  margin: 0;
  padding-left: 18px;
}

.list li { margin: 8px 0; }

.hr {
  height: 1px;
  background: rgba(42, 51, 66, 0.65);
  margin: 16px 0;
}

/* Figure */
.figure {
  display: grid;
  gap: 12px;
}

.figure__img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 14px;
  border: 1px solid rgba(42, 51, 66, 0.75);
  background: rgba(17, 21, 28, 0.55);
}

.figure__caption {
  color: var(--muted);
  font-size: 0.98rem;
}

/* Voting block (Slide 6 chart) */
.vote {
  display: grid;
  gap: 10px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(42, 51, 66, 0.55);
}

.vote__title {
  color: var(--text);
  font-weight: 650;
  letter-spacing: 0.2px;
}

.vote__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.vote__actions .btn {
  padding: 8px 10px;
}

.vote__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.vote__pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(42, 51, 66, 0.9);
  background: rgba(17, 21, 28, 0.65);
  color: var(--text-2);
  font-size: 0.98rem;
}

.vote__pill strong {
  color: var(--text);
}

svg {
  width: 100%;
  height: auto;
}

/* Table */
.table-controls {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(560px, 100%);
}

.search label {
  color: var(--muted);
  font-size: 0.98rem;
  white-space: nowrap;
}

.search input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(42, 51, 66, 0.9);
  background: rgba(17, 21, 28, 0.7);
  color: var(--text);
}

.table-wrap {
  overflow: auto;
  border-radius: var(--radius);
  border: 1px solid rgba(42, 51, 66, 0.85);
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 980px;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(21, 26, 34, 0.98);
  backdrop-filter: blur(6px);
  color: var(--text);
  text-align: left;
  padding: 12px;
  font-weight: 650;
  border-bottom: 1px solid rgba(42, 51, 66, 0.9);
}

tbody td {
  vertical-align: top;
  padding: 12px;
  border-bottom: 1px solid rgba(42, 51, 66, 0.55);
  color: var(--text-2);
}

tbody tr:hover td {
  background: rgba(17, 21, 28, 0.35);
}

.tag {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(42, 51, 66, 0.95);
  background: rgba(17, 21, 28, 0.6);
  color: var(--text);
  font-size: 0.95rem;
}

.tag--need-high { border-color: rgba(255, 107, 107, 0.6); color: #ffd1d1; }
.tag--need-med  { border-color: rgba(74, 163, 255, 0.6); color: #cfe7ff; }
.tag--need-low  { border-color: rgba(87, 213, 141, 0.6); color: #ccffe0; }

/* Footer nav */
.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.nav a {
  display: inline-flex;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(42, 51, 66, 0.85);
  background: rgba(17, 21, 28, 0.65);
  color: var(--text);
  text-decoration: none;
}

.nav a:hover {
  border-color: rgba(74, 163, 255, 0.6);
}

.small {
  font-size: 0.98rem;
  color: var(--muted);
}

.note {
  border-left: 4px solid rgba(79, 182, 176, 0.7);
  padding-left: 14px;
  color: var(--text-2);
}

/* Mini “Myth vs Fact” block */
.mythfact {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 820px) {
  .mythfact {
    grid-template-columns: 1fr;
  }
}

.mythfact__item {
  border: 1px solid rgba(42, 51, 66, 0.85);
  border-radius: 14px;
  background: rgba(17, 21, 28, 0.55);
  padding: 12px;
}

.mythfact__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.mythfact__text {
  margin: 0 0 6px;
  color: var(--text-2);
}

/* Expandable definitions */
.details-group {
  display: grid;
  gap: 10px;
}

.details {
  border: 1px solid rgba(42, 51, 66, 0.85);
  border-radius: 14px;
  background: rgba(17, 21, 28, 0.55);
  padding: 10px 12px;
}

.details summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 650;
}

.details p {
  margin: 10px 0 0;
}

/* Quiz */
.quiz {
  display: grid;
  gap: 14px;
}

.quiz__q {
  border: 1px solid rgba(42, 51, 66, 0.75);
  background: rgba(17, 21, 28, 0.55);
  border-radius: 14px;
  padding: 12px;
}

.quiz__q legend {
  padding: 0 6px;
  color: var(--text);
}

.quiz__opt {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 10px 0;
  color: var(--text-2);
}

.quiz__opt input {
  margin-top: 3px;
}

.quiz__q.is-correct {
  border-color: rgba(87, 213, 141, 0.55);
}

.quiz__q.is-wrong {
  border-color: rgba(255, 107, 107, 0.55);
}

.quiz__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

/* Planner */
.planner {
  display: grid;
  gap: 12px;
}

.planner__row {
  display: grid;
  gap: 8px;
}

.planner__control {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.planner input[type="range"] {
  width: 100%;
}

.planner__out {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  color: var(--text);
  border: 1px solid rgba(42, 51, 66, 0.9);
  background: rgba(17, 21, 28, 0.65);
  padding: 6px 10px;
  border-radius: 10px;
  min-width: 88px;
  text-align: right;
}

.planner__result {
  display: grid;
  gap: 8px;
  padding-top: 6px;
}

/* Explorer */
.explorer {
  display: grid;
  gap: 12px;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  border: 1px solid rgba(42, 51, 66, 0.85);
  background: rgba(17, 21, 28, 0.6);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 999px;
  cursor: pointer;
}

.chip[aria-selected="true"] {
  border-color: rgba(74, 163, 255, 0.6);
  background: rgba(74, 163, 255, 0.12);
}

.chip:hover {
  border-color: rgba(79, 182, 176, 0.55);
}

.explorer__panel {
  border: 1px solid rgba(42, 51, 66, 0.75);
  background: rgba(17, 21, 28, 0.55);
  border-radius: 14px;
  padding: 12px;
}

/* If the explorer text becomes longer (small screens / zoom), keep it readable with inner scroll */
.explorer__panel {
  max-height: 220px;
  overflow: auto;
  overscroll-behavior: contain;
}

/* Slide 8: slightly widen the right-most columns so they read better */
#s08 table {
  min-width: 1120px;
}

#s08 thead th:nth-child(n + 5),
#s08 tbody td:nth-child(n + 5) {
  min-width: 140px;
}

#s08 thead th:nth-child(7),
#s08 tbody td:nth-child(7) {
  min-width: 170px;
}

.explorer__title {
  margin: 0 0 8px;
  color: var(--text);
  font-weight: 700;
}

.explorer__bullets {
  margin: 0;
  padding-left: 18px;
}

.explorer__bullets li {
  margin: 6px 0;
}
