/*
 * NDB Board: řádky nabídek.
 *
 * Každá nabídka je jeden vodorovný pás ve dvou patrech. Horní patro nese
 * pořadí, logo, značku s nabídkou, dvě čísla a tlačítko, dolní patro řádek
 * podmínek se štítkem licence a rozbalovací pole. Řádky jdou vždy pod sebe,
 * v každé šířce jedna kolona. Nic se neořezává: co se do pásu nevejde,
 * jde do rozbalovacího pole nebo se zalomí.
 */

.ndb-board {
  --b-ink: var(--ndb-ink, #1c1a17);
  --b-muted: var(--ndb-muted, #4f483e);
  --b-accent: var(--ndb-accent, #a31822);
  --b-accent-dark: #86121b;
  --b-rule: var(--ndb-rule, #d8cfbe);
  --b-card: #fdfaf5;
  --b-ui: var(--ndb-font-ui, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif);
  --b-display: var(--ndb-font-display, Georgia, 'Times New Roman', serif);
  margin: 0;
}

.ndb-board .ndb-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Jediná věta o placeném umístění, nad řádky. */
.ndb-board .ndb-board-lead {
  font-family: var(--b-ui);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--b-muted);
  margin: 0 0 10px;
}

.ndb-board .ndb-board-cols {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
}

.ndb-board .ndb-row p {
  margin: 0;
}

/* ---------- řádek, od 1000 px dvě patra ---------- */

.ndb-board .ndb-row {
  position: relative;
  display: grid;
  grid-template-columns: 22px 152px minmax(0, 1fr) 216px 220px;
  grid-template-areas:
    "rank logo brand figures action"
    "rank terms terms terms more";
  column-gap: 14px;
  row-gap: 4px;
  align-items: center;
  min-width: 0;
  padding: 6px 14px;
  background: var(--b-card);
  border: 1px solid var(--b-rule);
  border-radius: 10px;
  transition: border-color 140ms ease;
}

.ndb-board .ndb-row:hover {
  border-color: #b9ae9a;
}

.ndb-board .ndb-row.is-lead {
  border-color: var(--b-accent);
  box-shadow: 0 0 0 3px rgba(163, 24, 34, 0.12);
}

/* 1. pořadí */
.ndb-board .ndb-rank {
  grid-area: rank;
  align-self: center;
  font-family: var(--b-ui);
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: #5a5242;
}

.ndb-board .ndb-row.is-lead .ndb-rank {
  color: var(--b-accent);
}

/* 2. logo provozovatele na tmavé dlaždici */
.ndb-board .ndb-logo-mark {
  grid-area: logo;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 152px;
  height: 56px;
  padding: 8px 12px;
  border-radius: 8px;
  overflow: hidden;
}

.ndb-board .ndb-logo-img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: contain;
}

.ndb-board .ndb-logo-word {
  font-family: var(--b-display);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
  color: #f4efe6;
  overflow-wrap: anywhere;
}

/* 3. značka a nabídka */
.ndb-board .ndb-brand-text {
  grid-area: brand;
  min-width: 0;
}

.ndb-board .ndb-brand-name {
  font-family: var(--b-display);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--b-ink);
}

.ndb-board .ndb-row.is-lead .ndb-brand-name {
  color: var(--b-accent);
}

.ndb-board .ndb-chip-badge {
  display: inline-block;
  vertical-align: 2px;
  margin-left: 4px;
  padding: 1px 7px;
  font-family: var(--b-ui);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.4;
  color: #3f3a31;
  background: #f1eadd;
  border: 1px solid #d3c9b8;
  border-radius: 999px;
}

.ndb-board .ndb-offer-line {
  margin-top: 3px;
  font-family: var(--b-ui);
  font-size: 13px;
  line-height: 1.3;
  color: var(--b-muted);
  overflow-wrap: break-word;
}

/* 4. dvě velká čísla */
.ndb-board .ndb-figures {
  grid-area: figures;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 12px;
  min-width: 0;
}

.ndb-board .ndb-figure {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.ndb-board .ndb-figure-label {
  font-family: var(--b-ui);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #5a5242;
}

.ndb-board .ndb-figure-value {
  font-family: var(--b-display);
  font-size: 25px;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--b-ink);
}

/* 5. tlačítko a drobné písmo */
.ndb-board .ndb-action {
  grid-area: action;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.ndb-board .ndb-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-width: 160px;
  min-height: 44px;
  padding: 10px 16px;
  font-family: var(--b-ui);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  color: #fffaf3;
  background: var(--b-accent);
  border: 2px solid var(--b-accent);
  border-radius: 8px;
  transition: background-color 140ms ease, border-color 140ms ease;
}

.ndb-board .ndb-cta:hover {
  color: #fffaf3;
  background: var(--b-accent-dark);
  border-color: var(--b-accent-dark);
}

.ndb-board .ndb-cta:focus-visible {
  color: #fffaf3;
  background: var(--b-accent-dark);
  border-color: var(--b-accent-dark);
  outline: 3px solid var(--b-ink);
  outline-offset: 2px;
}

.ndb-board .ndb-cta:active {
  color: #fffaf3;
  background: #6c0d15;
  border-color: #6c0d15;
  transform: translateY(1px);
}

.ndb-board .ndb-cta-note {
  font-family: var(--b-ui);
  font-size: 12px;
  line-height: 1.3;
  color: var(--b-muted);
  white-space: nowrap;
}

/* dolní patro: podmínky se štítkem licence */
.ndb-board .ndb-terms {
  grid-area: terms;
  min-width: 0;
  font-family: var(--b-ui);
  font-size: 12.5px;
  line-height: 1.4;
  color: #3f3a31;
}

.ndb-board .ndb-terms-label {
  margin-right: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #5a5242;
}

.ndb-board .ndb-licence-inline {
  display: inline-block;
  margin-left: 8px;
  padding-left: 10px;
  border-left: 1px solid var(--b-rule);
  color: #3f3a31;
}

/* rozbalovací pole */
.ndb-board .ndb-details {
  grid-area: more;
  min-width: 0;
  font-family: var(--b-ui);
  line-height: 1.4;
}

.ndb-board .ndb-details-summary {
  display: inline-block;
  padding: 1px 0;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--b-ink);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: #9d927f;
  white-space: nowrap;
  cursor: pointer;
  list-style: none;
}

.ndb-board .ndb-details-summary::-webkit-details-marker {
  display: none;
}

.ndb-board .ndb-details-summary::after {
  content: "\25BE";
  text-decoration: none;
  display: inline-block;
  margin-left: 5px;
}

.ndb-board .ndb-details[open] > .ndb-details-summary::after {
  content: "\25B4";
}

.ndb-board .ndb-details-summary:hover {
  color: var(--b-accent);
  text-decoration-color: currentColor;
}

.ndb-board .ndb-details-summary:focus-visible {
  outline: 2px solid var(--b-ink);
  outline-offset: 2px;
  border-radius: 2px;
}

.ndb-board .ndb-details-body {
  margin-top: 6px;
  font-size: 12.5px;
  line-height: 1.5;
  color: #3f3a31;
}

.ndb-board .ndb-details-body p + p {
  margin-top: 4px;
}

.ndb-board .ndb-details-label {
  margin-right: 4px;
  font-weight: 700;
  color: var(--b-ink);
}

/* otevřené pole teče pod řádek přes celou šířku za pořadím */
.ndb-board .ndb-row:has(.ndb-details[open]) .ndb-details {
  grid-area: 3 / 2 / 4 / -1;
}

.ndb-board-placeholder {
  padding: 16px 20px;
  font-family: var(--ndb-font-ui, 'Segoe UI', Arial, sans-serif);
  font-size: 15px;
  color: var(--ndb-muted, #4f483e);
  border: 1px solid var(--ndb-rule, #d8cfbe);
  border-radius: 10px;
}

@media (prefers-reduced-motion: reduce) {
  .ndb-board .ndb-row,
  .ndb-board .ndb-cta {
    transition: none;
  }

  .ndb-board .ndb-cta:active {
    transform: none;
  }
}

/* ---------- tablet, do 999 px tři patra ---------- */

@media (max-width: 999px) {
  .ndb-board .ndb-row {
    grid-template-columns: 22px 148px minmax(0, 1fr) minmax(184px, 216px);
    grid-template-areas:
      "rank logo    brand action"
      "rank figures figures more"
      "rank terms   terms  terms";
    align-items: start;
  }

  .ndb-board .ndb-rank {
    align-self: start;
    padding-top: 4px;
  }

  .ndb-board .ndb-logo-mark {
    width: 148px;
  }

  .ndb-board .ndb-cta-note {
    white-space: normal;
  }

  .ndb-board .ndb-row:has(.ndb-details[open]) .ndb-details {
    grid-area: 4 / 2 / 5 / -1;
  }
}

/* ---------- telefon, do 700 px kompaktní karta ---------- */

@media (max-width: 700px) {
  .ndb-board .ndb-row {
    grid-template-columns: 18px 100px minmax(0, 1fr) 160px;
    grid-template-areas:
      "rank    logo    brand   brand"
      "offer   offer   offer   offer"
      "figures figures figures figures"
      "cta     cta     cta     cta"
      "note    note    note    note"
      "terms   terms   terms   more";
    column-gap: 10px;
    row-gap: 4px;
    align-items: center;
    padding: 6px 12px;
  }

  .ndb-board .ndb-rank {
    align-self: center;
    padding-top: 0;
  }

  .ndb-board .ndb-logo-mark {
    width: 100px;
    height: 42px;
    padding: 6px 8px;
  }

  .ndb-board .ndb-logo-word {
    font-size: 14px;
  }

  .ndb-board .ndb-brand-text,
  .ndb-board .ndb-action {
    display: contents;
  }

  .ndb-board .ndb-brand-name {
    grid-area: brand;
    font-size: 17px;
  }

  .ndb-board .ndb-offer-line {
    grid-area: offer;
    margin-top: 0;
    font-size: 12.5px;
  }

  .ndb-board .ndb-figures {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: flex-start;
    gap: 2px 20px;
  }

  .ndb-board .ndb-figure {
    flex-direction: row;
    align-items: baseline;
    gap: 6px;
  }

  .ndb-board .ndb-figure-value {
    order: 1;
    font-size: 20px;
  }

  .ndb-board .ndb-figure-label {
    order: 2;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
  }

  .ndb-board .ndb-cta {
    grid-area: cta;
    width: 100%;
  }

  .ndb-board .ndb-cta-note {
    grid-area: note;
    font-size: 12px;
  }

  .ndb-board .ndb-terms {
    align-self: start;
  }

  .ndb-board .ndb-terms-label,
  .ndb-board .ndb-terms-body {
    display: none;
  }

  .ndb-board .ndb-licence-inline {
    margin: 0;
    padding: 0;
    border: 0;
  }

  .ndb-board .ndb-details {
    align-self: start;
    justify-self: end;
  }

  .ndb-board .ndb-row:has(.ndb-details[open]) .ndb-details {
    grid-area: 6 / 1 / 7 / -1;
    justify-self: stretch;
  }
}
