/**
 * MD Teacher: tablet and mobile on the new pages (page-templates/website-*.php). Only adjustments below 1024 px
 * and for touch; the desktop design is unchanged. Cart, checkout, the course page and sign up have theirs in src/scss.
 */

/* ---------- All pages: the theme makes every <section> a flex box. Our sections must be normal blocks,
   otherwise the content becomes as wide as the course row/table and is pushed past the edge on mobile ---------- */
#mdt section,
#mdt-f section,
#mdt-om section,
#mdt-u section,
#mdt-k section,
#mdt-l section {
  display: block;
}

/* ---------- All pages: long Danish words break with a hyphen instead of in the middle of the word ---------- */
#mdt-k .kc h3 {
  -webkit-hyphens: auto;
  hyphens: auto;
  overflow-wrap: break-word;
}
@media (max-width: 480px) {
  #mdt h1,
  #mdt h2,
  #mdt-om h1,
  #mdt-om h2,
  #mdt-f h1,
  #mdt-f h2,
  #mdt-k h1,
  #mdt-k h2,
  #mdt-l h1,
  #mdt-l h2,
  #mdt-u h1,
  #mdt-u h2 {
    -webkit-hyphens: auto;
    hyphens: auto;
    overflow-wrap: break-word;
  }
}

/* ---------- Prices: the whole comparison table fits on an iPad in portrait ---------- */
@media (min-width: 761px) and (max-width: 1023px) {
  #mdt table {
    min-width: 0;
    font-size: 0.84rem;
  }
  #mdt th,
  #mdt td {
    padding: 0.55rem 0.45rem;
  }
  #mdt thead th {
    font-size: 0.8rem;
  }
  #mdt tbody th {
    width: 9rem;
  }
}

/* ---------- Prices: the two badges on Praksisadgang stay inside the card at about 1024 px ---------- */
@media (min-width: 961px) and (max-width: 1099px) {
  #mdt .badges {
    left: 0.5rem;
    right: 0.5rem;
    gap: 0.3rem;
  }
  #mdt .badges .badge {
    font-size: 0.56rem;
    letter-spacing: 0.03em;
    padding: 0.26rem 0.45rem;
  }
}

/* ---------- Learning paths: the numbers (courses, lessons, duration) stay inside the card on narrow mobiles ---------- */
@media (max-width: 480px) {
  #mdt-l .lp dl {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  #mdt-l .lp dl div:nth-child(3) {
    grid-column: 1 / -1;
  }
}

/* ---------- Front page and About us: three points side by side on tablet ---------- */
@media (min-width: 600px) and (max-width: 860px) {
  #mdt-f .seg,
  #mdt-om .seg {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
  }
  #mdt-f .seg b,
  #mdt-om .seg b {
    font-size: 1.12rem;
  }
  #mdt-f .seg p,
  #mdt-om .seg p {
    font-size: 0.9rem;
  }
}

/* ---------- Courses: the duration is not cut off on tablet ---------- */
@media (max-width: 1199px) {
  #mdt-k .kc-meta {
    flex-wrap: wrap;
    row-gap: 0.3rem;
  }
  #mdt-k .kc-meta span {
    white-space: normal;
    overflow: visible;
  }
}

/* ---------- Buttons that are easy to hit with a finger ---------- */
@media (pointer: coarse) {
  #mdt-k .chips button {
    min-height: 40px;
    padding: 0.45rem 0.9rem;
  }
  #mdt-om .copy {
    min-height: 34px;
    padding: 0.35rem 0.85rem;
  }
}

/* ---------- Prices: "Gælder til 31/12 …" is readable in the highlighted column of the comparison (before: same colour as the background) ---------- */
#mdt tr.pris td.hi small.mdt-fra11 {
  color: inherit;
  opacity: 0.85;
}
