/**
 * Every breakpoint override, in one file, largest to smallest.
 *
 * The design keeps its responsive rules together rather than scattering them
 * through the sections, and that turns out to be the right call: most
 * breakpoints touch several sections at once (the topbar inverts to navy at the
 * same width the action bar appears), and reading them as one story is how you
 * see that.
 *
 * Loaded last, so it wins on equal specificity. The design source needed
 * `!important` on nearly every line because it was overriding inline styles;
 * with real classes the cascade does the work, and `!important` appears only
 * where a rule must beat a same-specificity selector defined here.
 *
 * Breakpoints, and what each is for:
 *   1320px  the container stops being able to breathe — topbar cells tighten
 *   1150px  the nav becomes a drawer; the desktop layout ends
 *    900px  the action bar appears and the topbar inverts to navy
 *    820px  the e-mail leaves the topbar
 *    700px  the opening hours leave the topbar
 *    560px  single-column everything
 */

/* ══════════════════════════════════ ≥ 1151px — desktop only ═══════════════ */

@media (min-width: 1151px) {
  /* The burger belongs to the drawer, which only exists below this width. */
  .dk-burger {
    display: none !important;
  }

  /* Scrolling condenses the header: the mark shrinks, the tagline folds away. */
  html[data-scrolled='1'] .dk-logo > svg {
    width: 42px;
    height: 42px;
  }

  html[data-scrolled='1'] .dk-logo__word {
    font-size: 22px;
  }

  /**
   * The tagline collapses out of the condensed header.
   *
   * `width: 0` matters as much as `height: 0` here. The wordmark, the rule and
   * the tagline share a flex column, so the column is as wide as its widest
   * child — and "PREMIUM AUTO SERVICE" at 0.26em tracking is considerably wider
   * than "DAKAR". Collapsing only the height leaves the tagline still claiming
   * that width, so the rule stretches to it and reads as an underline to
   * nothing: a blue bar trailing off past the end of the word.
   *
   * (The approved design collapses height alone and has the same artifact.)
   */
  html[data-scrolled='1'] .dk-logo__tag {
    opacity: 0;
    height: 0;
    width: 0;
    overflow: hidden;
  }
}

/* Between 1151 and 1320 the topbar cells have to give up horizontal room. */
@media (min-width: 1151px) and (max-width: 1320px) {
  .dk-topbar__info > a,
  .dk-topbar__info > span {
    padding: 16px 18px;
    font-size: 13px;
  }
}

/* ══════════════════════════════════ ≤ 1150px — the drawer breakpoint ══════ */

@media (max-width: 1150px) {
  /* --- header ---------------------------------------------------------- */

  .dk-header__inner {
    padding: 11px 14px;
    gap: 10px;
    flex-wrap: nowrap;
  }

  .dk-logo {
    gap: 10px;
  }

  .dk-logo > svg,
  .dk-logo img {
    width: 40px;
    height: 40px;
  }

  .dk-logo__word {
    font-size: 21px;
  }

  .dk-logo__tag {
    font-size: 8.5px;
    letter-spacing: 0.2em;
  }

  .dk-burger {
    display: flex !important;
    width: 42px;
    height: 42px;
  }

  /* --- navigation becomes a full-height drawer -------------------------- */

  /**
   * `--dk-nav-top` is measured from the live header bottom by main.js, so the
   * drawer always meets the header exactly however tall it currently is.
   */
  .dk-nav {
    position: fixed;
    left: 0;
    right: 0;
    top: var(--dk-nav-top, 150px);
    bottom: 0;
    z-index: 55;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 4px 18px;
    padding: 8px 0 24px;
    background: var(--dk-white);
    border-top: 1px solid var(--dk-border);
    font-size: 15px;
    overflow-y: auto;
  }

  .dk-nav[data-open='0'] {
    display: none !important;
  }

  .dk-nav > a {
    padding: 16px 22px;
    border-bottom: 1px solid var(--dk-border-nav);
    font-size: 17px;
  }

  /* The underline animation is a pointer affordance; it has no place in a
     stacked touch menu. */
  .dk-nav > a::after {
    content: none;
  }

  .dk-drawer-cta {
    display: flex !important;
    border-bottom: 0;
  }

  /* --- topbar collapses to a single row --------------------------------- */

  .dk-topbar .dk-topbar__inner {
    flex-wrap: nowrap;
    justify-content: space-between;
    padding: 0 12px;
  }

  .dk-topbar__info {
    flex: 1 1 auto;
    min-width: 0;
  }

  .dk-topbar__info > a,
  .dk-topbar__info > span {
    padding: 10px 6px;
    font-size: 14px;
    border: 0;
  }

  /* The social icons drop; the same links live in the footer. */
  .dk-topbar__social > a {
    display: none;
  }

  .dk-topbar__social > .dk-lang-group {
    border: 0;
    padding: 0;
  }

  .dk-topbar__social button {
    padding: 10px 7px;
    font-size: 13px;
  }

  /* --- content ---------------------------------------------------------- */

  .dk-facts__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Facts reflow to two columns: only the right-hand one keeps a left rule,
     and rows after the first gain a top rule instead. */
  .dk-fact:nth-child(odd) {
    border-left: 0;
  }

  .dk-fact:nth-child(n + 3) {
    border-top: 1px solid var(--dk-border-divider);
    padding-top: 22px;
  }

  /* Touch has no hover, so the arrows would be undiscoverable; the dots and a
     horizontal swipe carry the slider instead. */
  .dk-hero__arrow {
    display: none;
  }

  .dk-hero__inner {
    padding: 56px 18px 64px;
  }

  .dk-section__inner,
  .dk-container {
    padding-left: 18px;
    padding-right: 18px;
  }

  .dk-split__media {
    min-height: 300px;
  }
}

/* ══════════════════════════════ ≤ 900px — action bar and navy topbar ══════ */

@media (max-width: 900px) {
  /**
   * The topbar inverts to navy so the phone number reads as a primary action on
   * a phone-sized screen rather than as fine print.
   */
  .dk-topbar {
    background: var(--dk-navy);
    border-bottom: 0;
  }

  .dk-topbar__info > a,
  .dk-topbar__info > span {
    color: var(--dk-on-dark);
    font-weight: 600;
  }

  /**
   * The resting hover rule is `a.dk-topbar__cell:hover` (0,2,1), which would
   * otherwise out-specify the white above and repaint the cell brand blue on
   * navy — 2.96:1, and the wrong colour besides. Matched here at (0,3,1).
   */
  .dk-topbar__info > a.dk-topbar__cell:hover {
    color: var(--dk-on-dark);
  }

  .dk-topbar__info i {
    color: var(--dk-blue-pale);
  }

  .dk-lang[aria-pressed='true'] {
    color: var(--dk-on-dark);
    box-shadow: inset 0 -2px 0 var(--dk-blue);
  }

  .dk-lang[aria-pressed='false'] {
    color: rgba(255, 255, 255, 0.66);
  }

  /* --- the fixed two-up action bar -------------------------------------- */

  .dk-actionbar {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 65;
    background: var(--dk-border-strong);
    box-shadow: var(--dk-shadow-actionbar);
    /* Clears the home indicator on notched phones. */
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .dk-actionbar > a {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 56px;
  }

  /* Reserve the bar's height so it never covers the end of the footer. */
  body {
    padding-bottom: 56px;
  }

  .dk-fab {
    bottom: 72px;
  }

  /* --- content ---------------------------------------------------------- */

  .dk-section__inner {
    padding-top: 56px;
    padding-bottom: 60px;
  }

  .dk-hero {
    min-height: 0;
  }

  .dk-hero__inner {
    padding: 48px 18px 56px;
  }

  /* The reserved slide height exists to stop desktop layout jump; on a phone it
     only adds dead space. */
  .dk-hero__slide {
    min-height: 0;
  }

  .dk-hero__badge {
    margin-bottom: 24px;
  }

  .dk-hero__badge .dk-hero__ring {
    width: 104px;
    height: 104px;
  }

  .dk-hero__badge .dk-hero__mark {
    width: 82px;
    height: 82px;
  }

  .dk-hero__badge i {
    font-size: 27px;
  }

  .dk-card__photo {
    height: 200px;
  }

  /* The quote moves above its arrows so it is not squeezed between them. */
  .dk-quote-row {
    flex-wrap: wrap;
    gap: 18px;
  }

  .dk-quote-row .dk-quote__quote {
    order: -1;
    /* The flex child is the blockquote, whose own max-width would still cap it
       at 760px once it has a full-width row of its own — so release that too. */
    flex: 1 0 100%;
    max-width: none;
  }

  .dk-quote-row .dk-quote__text {
    font-size: 18px;
  }
}

/* ══════════════════════════════════ ≤ 820px / ≤ 700px — topbar trims ══════ */

/**
 * The topbar sheds content rather than reflowing it. That is acceptable under
 * WCAG 1.4.10 because nothing here is unique: the e-mail, the hours and both
 * phone numbers all appear again in the Find-us section and the footer.
 */
@media (max-width: 820px) {
  .dk-topbar__mail {
    display: none;
  }
}

@media (max-width: 700px) {
  .dk-topbar__hours {
    display: none;
  }
}

/* ══════════════════════════════════ ≤ 560px — single column ═══════════════ */

@media (max-width: 560px) {
  .dk-facts__grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .dk-fact {
    border-left: 0;
  }

  .dk-fact:nth-child(n + 2) {
    border-top: 1px solid var(--dk-border-divider);
    padding-top: 20px;
  }

  .dk-topbar__info > a:nth-child(2) {
    display: none;
  }

  .dk-fab {
    right: 14px;
    bottom: 14px;
  }

  .dk-section__inner {
    padding: 44px 16px 48px;
  }

  .dk-hero__inner {
    padding: 40px 16px 48px;
  }

  /* Full-width, stacked CTAs — the two side by side would each be too narrow
     to read at this width. */
  .dk-hero .dk-btn {
    width: 100%;
    justify-content: center;
  }

  .dk-card__photo {
    height: 170px;
  }

  /* The reveal animation reads as jitter on a short, fast-scrolling screen. */
  [data-anim] {
    animation: none !important;
  }
}
