/* ── Reset & základy ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --clr-primary:   #1a5276;
  --clr-accent:    #2e86c1;
  --clr-bg:        #f4f6f8;
  --clr-surface:   #ffffff;
  --clr-border:    #d5d8dc;
  --clr-text:      #1c2833;
  --clr-muted:     #5d6d7e;
  --radius:        8px;
  --shadow:        0 2px 8px rgba(0,0,0,.10);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--clr-text);
  background: var(--clr-bg);
}

/* ── Header ── */
header {
  background: var(--clr-primary);
  color: #fff;
  padding: 2rem 1.5rem 1.5rem;
  text-align: center;
}

header h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: .5px;
}

.subtitle {
  margin-top: .4rem;
  font-size: .95rem;
  opacity: .8;
}

nav {
  margin-top: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .6rem;
}

nav a {
  color: #fff;
  text-decoration: none;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 20px;
  padding: .35rem 1rem;
  font-size: .9rem;
  transition: background .2s;
}

nav a:hover {
  background: rgba(255,255,255,.28);
}

/* ── Main layout ── */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

/* ── Sekce ── */
section {
  background: var(--clr-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--clr-accent);
  color: #fff;
  padding: 1rem 1.5rem;
}

.section-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  background: rgba(255,255,255,.25);
  font-size: 1.1rem;
  font-weight: 700;
  flex-shrink: 0;
}

.section-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
}

.section-body {
  padding: 1.75rem 1.5rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: start;
}

/* ── Popis ── */
.description p {
  margin-bottom: .9rem;
  color: var(--clr-text);
}

.description h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 1.1rem 0 .5rem;
  color: var(--clr-primary);
}

.description ul {
  padding-left: 1.3rem;
}

.description ul li {
  margin-bottom: .35rem;
  color: var(--clr-muted);
}

/* ── Média ── */
.media-block {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

figure {
  text-align: center;
}

.schema-img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--clr-border);
  border-radius: var(--radius);
  display: block;
  margin: 0 auto;
}

.video-figure video {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--clr-border);
  display: block;
}

figcaption {
  margin-top: .5rem;
  font-size: .82rem;
  color: var(--clr-muted);
  font-style: italic;
}

/* ── Footer ── */
footer {
  text-align: center;
  padding: 1.25rem;
  font-size: .85rem;
  color: var(--clr-muted);
  border-top: 1px solid var(--clr-border);
}

/* ── Sekce značky ── */
.header-znacky {
  background: #1a6b4a;
}

.symbols-body {
  display: block !important;
  padding: 1.75rem 1.5rem;
}

.symbols-intro {
  margin-bottom: 1.5rem;
  color: var(--clr-text);
}

.symbols-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.symbol-card {
  border: 1px solid var(--clr-border);
  border-radius: var(--radius);
  padding: 1rem .75rem .75rem;
  text-align: center;
  background: var(--clr-bg);
  transition: box-shadow .15s;
}

.symbol-card:hover {
  box-shadow: 0 3px 10px rgba(0,0,0,.12);
}

.sym-svg {
  width: 100%;
  max-width: 120px;
  height: auto;
  display: block;
  margin: 0 auto .75rem;
  color: var(--clr-primary);
}

img.sym-svg {
  object-fit: contain;
  max-height: 80px;
}

.sym-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .2rem;
}

.sym-code {
  font-weight: 700;
  font-size: 1rem;
  color: var(--clr-accent);
  font-family: 'Courier New', monospace;
}

.sym-name {
  font-size: .8rem;
  color: var(--clr-muted);
  line-height: 1.3;
}

.table-heading {
  font-size: 1rem;
  font-weight: 600;
  color: var(--clr-primary);
  margin-bottom: .75rem;
}

.letter-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}

.letter-table th {
  background: var(--clr-bg);
  padding: .5rem .75rem;
  text-align: left;
  border-bottom: 2px solid var(--clr-border);
  color: var(--clr-primary);
  font-weight: 600;
}

.letter-table td {
  padding: .45rem .75rem;
  border-bottom: 1px solid var(--clr-border);
}

.letter-table td:first-child {
  font-weight: 700;
  font-family: 'Courier New', monospace;
  color: var(--clr-accent);
  white-space: nowrap;
}

.letter-table tr:last-child td {
  border-bottom: none;
}

/* ── Responzivita ── */
@media (max-width: 700px) {
  .section-body {
    grid-template-columns: 1fr;
  }

  header h1 {
    font-size: 1.5rem;
  }
}

/* ── Kalkulačka impedance smyčky ── */
.header-impedance {
  background: #148f77;
}

.formula-box {
  background: var(--clr-bg);
  border: 2px solid var(--clr-accent);
  border-radius: var(--radius);
  padding: .6rem 1.2rem;
  font-size: 1.3rem;
  font-weight: 600;
  text-align: center;
  color: var(--clr-primary);
  margin-bottom: .4rem;
}

.norm-label {
  font-size: .8rem;
  color: var(--clr-muted);
  text-align: center;
  margin-bottom: 1.25rem;
  font-style: italic;
}

.seg {
  display: flex;
  border: 1px solid var(--clr-border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 1.25rem;
}

.seg button {
  flex: 1;
  padding: .5rem;
  background: var(--clr-surface);
  border: none;
  border-right: 1px solid var(--clr-border);
  color: var(--clr-muted);
  font-family: inherit;
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.seg button:last-child { border-right: none; }
.seg button:hover { background: var(--clr-bg); color: var(--clr-primary); }
.seg button.active { background: var(--clr-accent); color: #fff; font-weight: 600; }

.calc-field { margin-bottom: 1.1rem; }

.calc-field-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
  font-size: .9rem;
  color: var(--clr-muted);
}

.calc-val {
  font-weight: 700;
  color: var(--clr-primary);
  font-family: 'Courier New', monospace;
}

input[type=range] {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  background: var(--clr-border);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--clr-accent);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
  cursor: pointer;
  transition: transform .1s;
}

input[type=range]::-webkit-slider-thumb:hover { transform: scale(1.2); }

input[type=range]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--clr-accent);
  border: 2px solid #fff;
  cursor: pointer;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .75rem;
  margin-bottom: 1rem;
}

.metric {
  background: var(--clr-bg);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius);
  padding: .75rem .5rem;
  text-align: center;
}

.m-label { font-size: .75rem; color: var(--clr-muted); margin-bottom: .25rem; }

.m-val {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--clr-primary);
  font-family: 'Courier New', monospace;
}

.m-unit { font-size: .8rem; color: var(--clr-muted); margin-left: 2px; }

.result-panel {
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  border: 2px solid var(--clr-border);
  background: var(--clr-bg);
  margin-bottom: 1rem;
  transition: border-color .3s, background .3s;
}

.result-panel.ok  { border-color: #1e8449; background: #eafaf1; }
.result-panel.fail { border-color: #c0392b; background: #fdedec; }

.result-verdict {
  font-size: .95rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  margin-bottom: .4rem;
}

.ok  .result-verdict { color: #1e8449; }
.fail .result-verdict { color: #c0392b; }

.result-detail {
  font-size: .85rem;
  color: var(--clr-muted);
  line-height: 1.7;
  font-family: 'Courier New', monospace;
  white-space: pre-line;
}

.bar-wrap {
  background: var(--clr-border);
  border-radius: 4px;
  height: 8px;
  overflow: hidden;
  margin: .75rem 0 .35rem;
}

.bar-inner {
  height: 100%;
  border-radius: 4px;
  transition: width .3s ease, background .3s;
  background: #1e8449;
}

.result-panel.fail .bar-inner { background: #c0392b; }

.bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: .75rem;
  color: var(--clr-muted);
  font-family: 'Courier New', monospace;
}

.calc-note {
  font-size: .8rem;
  color: var(--clr-muted);
  line-height: 1.6;
}

.row-active td {
  background: rgba(46, 134, 193, .1);
  color: var(--clr-accent);
  font-weight: 700;
}

.row-active td:first-child::before {
  content: '▶ ';
  font-size: .7rem;
}
