/* ==========================================================================
   Responsive: phone and tablet (below 1024px)
   1024px and up keeps the desktop design exactly (canvas, absolute blocks).
   Below 1024px every section is normal flow, in page order, fluid and
   fully visible: no absolute positions, no hidden-until-scrolled state,
   no horizontal overflow. Loaded last so it wins over the base rules.
   ========================================================================== */

@media (max-width: 1023.98px) {
  :root {
    --gutter: clamp(20px, 5vw, 48px);
    --canvas-width: 100%;
    --zoom: 1;
  }

  .page {
    zoom: 1;
    max-width: 100%;
  }

  main img,
  .site-footer img {
    max-width: 100%;
  }

  main h2,
  main h3,
  main p,
  main address,
  .site-footer p {
    overflow-wrap: break-word;
  }

  /* Every section grows with its content */
  .hero,
  .about,
  .message,
  .services,
  .brands,
  .locations,
  .contact {
    height: auto;
    min-height: 0;
  }

  .btn {
    height: auto;
    min-height: 44px;
    padding: 8px var(--space-5);
    text-align: center;
    white-space: normal;
  }

  /* Fixed controls: smaller, on a backing so they never fight the text */
  .site-header {
    padding: 10px 12px;
  }

  .nav-toggle {
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    background: var(--black-60);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
  }

  .to-top {
    right: 12px;
    bottom: 12px;
    width: 40px;
    height: 40px;
    background: var(--black-94);
  }

  /* Hero: logo and brand wall in the first screen ------------------------- */

  .hero {
    min-height: 100vh;
    min-height: 100svh;
    padding: clamp(84px, 14vh, 120px) var(--gutter) 40px;
  }

  .hero__link {
    width: clamp(120px, 32vw, 200px);
    margin: 0 auto clamp(24px, 5vh, 48px);
  }

  .hero__logo {
    width: 100%;
    height: auto;
  }

  .brand-wall {
    --wall-scale: 0.95;
    flex-flow: row wrap;
    justify-content: center;
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
  }

  .brand-wall__item {
    width: 33.3333%;
    height: 58px;
  }

  .brand-wall__item--break {
    display: none;
  }

  .brand-wall__logo {
    width: calc(var(--logo-w, 60px) * var(--wall-scale));
    height: calc(var(--logo-h, 30px) * var(--wall-scale));
    max-width: 100%;
  }

  /* About ------------------------------------------------------------------ */

  .about {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding-bottom: 56px;
  }

  .about__title {
    position: static;
    padding: 56px var(--gutter) 28px;
    font-size: clamp(28px, 8vw, 46px);
    line-height: 1.2;
  }

  .stats {
    position: relative;
    top: auto;
    height: auto;
    overflow: hidden;
  }

  .stats__bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    transform: none;
    will-change: auto;
  }

  .stats__inner {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
    width: auto;
    height: auto;
    padding: 56px var(--gutter);
  }

  .stats__item {
    position: static;
    width: 100%;
    text-align: center;
  }

  .stats__value {
    font-size: clamp(34px, 10vw, 56px);
    line-height: 1.1;
  }

  .stats__label {
    margin-top: 6px;
    font-size: clamp(16px, 4.6vw, 22px);
    line-height: 1.25;
  }

  .about-intro,
  .about-vision,
  .about-mission {
    position: static;
    width: auto;
    max-width: 680px;
    margin: 0 auto;
    padding: 48px var(--gutter) 0;
  }

  .about-intro__heading,
  .about-vision__heading,
  .about-mission__heading {
    height: auto;
    margin-bottom: 12px;
    font-size: clamp(24px, 6.6vw, 34px);
    line-height: 1.2;
    text-align: left;
  }

  .about-intro__text,
  .about-vision__text,
  .about-mission__text {
    width: auto;
    margin-left: 0;
    font-size: clamp(15px, 4vw, 17px);
    line-height: 1.65;
  }

  .about__lattice {
    display: none;
  }

  .about__photo {
    position: relative;
    top: auto;
    left: auto;
    width: min(78%, 440px);
    height: auto;
    aspect-ratio: 216 / 150;
  }

  .about__photo--table {
    align-self: flex-end;
    margin: 48px var(--gutter) 0 0;
  }

  .about__photo--server {
    align-self: flex-start;
    margin: -40px 0 0 var(--gutter);
  }

  .about-model__heading {
    position: static;
    padding: 56px var(--gutter) 24px;
    font-size: clamp(22px, 6vw, 34px);
    line-height: 1.2;
  }

  .about-model__list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 28px 16px;
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
    padding: 0 var(--gutter);
  }

  .about-model__item {
    position: static;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: auto;
    min-width: 0;
  }

  .about-model__icon {
    width: clamp(72px, 24vw, 110px);
    height: auto;
    margin: 0 0 10px;
  }

  .about-model__label {
    width: auto;
    margin: 0;
    font-size: 12px;
    letter-spacing: 0.1em;
  }

  /* Message from the CEO --------------------------------------------------- */

  .message {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    max-width: 680px;
    margin: 0 auto;
    padding: 56px var(--gutter) 0;
  }

  .message__script {
    position: static;
    align-self: flex-start;
    width: min(100%, 420px);
    height: auto;
  }

  .message__text {
    position: static;
    width: auto;
    margin-top: 20px;
    font-size: clamp(15px, 4vw, 17px);
    line-height: 1.65;
  }

  .message__name,
  .message__role {
    position: static;
    margin-top: 20px;
  }

  .message__role {
    margin-top: 4px;
  }

  .message__rule {
    position: static;
    display: block;
    margin: 20px 0;
  }

  .message__portrait {
    position: static;
    align-self: center;
    width: min(100%, 400px);
    height: auto;
    aspect-ratio: 2 / 3;
    object-fit: cover;
  }

  /* Services --------------------------------------------------------------- */

  .services {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 44px;
    max-width: 900px;
    margin: 0 auto;
    padding: 64px var(--gutter) 0;
  }

  .services__title {
    position: static;
    padding: 0;
    font-size: clamp(22px, 6.4vw, 36px);
  }

  .services__item {
    position: static;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    width: auto;
    height: auto;
    min-width: 0;
  }

  .services__icon {
    position: static;
    width: clamp(84px, 26vw, 120px);
    height: auto;
  }

  .services__heading {
    position: static;
    font-size: clamp(16px, 4.4vw, 20px);
  }

  .services__text {
    position: static;
    width: auto;
    max-width: 420px;
    font-size: 15px;
    line-height: 1.65;
    text-align: center;
  }

  .services__quote {
    position: static;
    display: flex;
    justify-self: center;
    width: max-content;
    max-width: 100%;
    margin: 8px 0 0;
  }

  /* Brands ----------------------------------------------------------------- */

  .brands {
    padding: 64px 0 0;
  }

  .brands__title {
    position: static;
    padding: 0 var(--gutter) 32px;
    font-size: clamp(26px, 7.4vw, 40px);
  }

  .brand-row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    height: auto;
    padding: 0 0 32px;
  }

  .brand-row__photo,
  .brand-row--photo-first .brand-row__photo {
    order: 1;
    position: relative;
    width: 100%;
    height: clamp(200px, 56vw, 360px);
  }

  .brand-row__layer {
    position: absolute;
    top: 0 !important;
    right: 0;
    bottom: 0 !important;
    left: 0;
    height: 100% !important;
    margin-top: 0 !important;
    transform: none !important;
    animation: none !important;
  }

  .brand-row__info {
    order: 2;
    align-items: center;
    gap: 16px;
    padding: 24px var(--gutter) 8px;
    text-align: center;
  }

  .brand-row__logo {
    max-width: 100%;
  }

  .brand-row__logo-img {
    width: var(--logo-w-sm, 200px);
    max-width: 100%;
    height: var(--logo-h-sm, auto);
    margin: 0 auto;
    object-fit: contain;
  }

  .brand-row__name {
    max-width: 100%;
    font-size: clamp(20px, 6vw, 28px);
    overflow-wrap: anywhere;
  }

  .brand-row__tagline {
    max-width: min(420px, 100%);
    font-size: 14px;
  }

  /* Locations -------------------------------------------------------------- */

  .locations {
    padding: 64px var(--gutter) 56px;
  }

  .locations__title {
    position: static;
    padding: 0 0 28px;
    font-size: clamp(26px, 7.4vw, 40px);
  }

  .locator {
    width: 100%;
    max-width: 1000px;
    min-width: 0;
    margin: 0 auto;
  }

  .locator__bar {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    min-width: 0;
    padding: 0 0 var(--space-5);
  }

  .locator__search,
  .locator__input {
    width: 100%;
    min-width: 0;
  }

  .locator__chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    max-width: 100%;
    min-width: 0;
  }

  .chip {
    max-width: 100%;
    padding: 0 12px;
    letter-spacing: 0.08em;
  }

  .locator__body {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
    min-width: 0;
  }

  .locator__map {
    order: 1;
    width: 100%;
    height: clamp(280px, 70vw, 420px);
  }

  .locator__list {
    order: 2;
    min-width: 0;
    padding: 0;
  }

  .loc-card {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .loc-card__actions {
    flex-wrap: wrap;
  }

  /* Contact ---------------------------------------------------------------- */

  .contact {
    padding: 64px var(--gutter) 56px;
  }

  .contact__title {
    position: static;
    padding: 0 0 28px;
    font-size: clamp(26px, 7.4vw, 40px);
  }

  .contact-card {
    display: flex;
    flex-direction: column;
    gap: 28px;
    width: 100%;
    max-width: 1000px;
    min-width: 0;
    margin: 0 auto;
    padding: 24px clamp(16px, 4vw, 32px);
  }

  .contact-card > *,
  .contact-form,
  .field,
  .contact-form__types {
    min-width: 0;
    max-width: 100%;
  }

  .contact-card__item {
    min-width: 0;
  }

  .contact-card__link,
  .contact-card__address {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .field__control {
    max-width: 100%;
    font-size: 16px; /* 16px stops iOS zooming into the field */
  }

  /* Footer and careers ----------------------------------------------------- */

  .site-footer {
    width: 100%;
    padding: 36px var(--gutter) 72px;
  }

  .careers {
    width: 100%;
    max-width: 660px;
    margin: 0 auto;
    padding: 96px var(--gutter) 40px;
  }

  .careers__title {
    font-size: clamp(24px, 7vw, 34px);
  }
}

/* Tablet and large phones in landscape ------------------------------------- */

@media (min-width: 600px) and (max-width: 1023.98px) {
  .hero__link {
    width: clamp(160px, 24vw, 230px);
  }

  .brand-wall {
    --wall-scale: 1.15;
    max-width: 760px;
  }

  .brand-wall__item {
    width: 150px;
    height: 72px;
  }

  .brand-wall__item--break {
    display: flex;
    width: 100%;
    height: 0;
  }

  .stats__inner {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-around;
    gap: 16px;
    padding: 64px var(--gutter);
  }

  .stats__item {
    flex: 1;
    width: auto;
  }

  .about-model__list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    max-width: 900px;
  }

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

  .services__title,
  .services__quote {
    grid-column: 1 / -1;
  }

  .brand-row__logo-img {
    width: var(--logo-w, 260px);
    height: var(--logo-h, auto);
  }

  .locator__bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
  }

  .locator__chips {
    grid-column: 1 / -1;
  }

  .locator__near {
    align-self: center;
  }

  .site-footer__grid {
    flex-direction: row;
    justify-content: space-between;
  }
}

@media (min-width: 768px) and (max-width: 1023.98px) {
  .contact-card {
    display: grid;
    grid-template-columns: minmax(0, 280px) minmax(0, 1fr);
    gap: 40px;
    padding: 32px;
  }
}

/* Spacing rhythm (Chadi, 4 Nov: "fix the spacing"). One gap between sections, one gap under titles.
   Each section owns its top space, the contact section also owns the space before the footer. */
@media (max-width: 1023.98px) {
  :root {
    --sec-space: clamp(64px, 12vw, 96px);
    --title-space: 32px;
  }

  .about { padding-bottom: 0; }
  .about__title { padding: var(--sec-space) var(--gutter) var(--title-space); }
  .about-model__list { padding-bottom: 0; margin-bottom: 0; }

  .message { padding-top: var(--sec-space); }

  .services { padding-top: var(--sec-space); padding-bottom: 0; row-gap: 48px; }
  .services__quote { margin-top: 0; }

  .brands { padding-top: var(--sec-space); }
  .brands__title { padding-bottom: var(--title-space); }

  .locations { padding-top: var(--sec-space); padding-bottom: 0; }
  .locations__title { padding-bottom: var(--title-space); }

  .contact { padding-top: var(--sec-space); padding-bottom: var(--sec-space); }
  .contact__title { padding-bottom: var(--title-space); }
}

/* Phone: tighter (Chadi, 4 Nov: "still too big on phone") */
@media (max-width: 599.98px) {
  :root {
    --sec-space: 44px;
    --title-space: 20px;
  }
  .hero { height: auto; min-height: 0; padding: 96px var(--gutter) 48px; }
  .about-intro, .about-vision, .about-mission { padding-top: 32px; }
  .about-model__heading { padding-top: 36px; padding-bottom: 16px; }
  .about-model__list { row-gap: 20px; }
  .message__text { margin-top: 16px; }
  .services { row-gap: 32px; }
  .services__item { gap: 12px; }
  .brand-row { padding-bottom: 24px; }
  .locator__bar { padding-bottom: 16px; gap: 10px; }
  .contact-card { padding: 20px 16px; gap: 20px; }
  .site-footer { padding: 28px var(--gutter) 64px; }
}

/* Phone: smaller blocks (Chadi, 4 Nov: "still big on phone") */
@media (max-width: 599.98px) {
  :root { --sec-space: 36px; --title-space: 16px; }
  body { font-size: 14px; }
  .hero { padding: 80px var(--gutter) 36px; }
  .hero__logo { width: 104px; height: auto; }
  .brand-wall { transform: scale(.9); transform-origin: top center; margin-bottom: -16px; }

  .section-title, .about__title, .brands__title, .locations__title, .contact__title { font-size: 24px !important; }
  .services__title { font-size: 20px !important; }

  .stats, .stats__bg, .stats__inner { height: auto !important; min-height: 0 !important; }
  .stats__inner { display: flex !important; flex-direction: row !important; justify-content: space-around; align-items: center; padding: 28px 12px !important; }
  .stats__bg { position: absolute !important; inset: 0; }
  .stats { position: relative; }
  .stats__item { flex: 1 1 0; text-align: center; }
  .stats__value { font-size: 28px !important; line-height: 1.1 !important; padding: 0 !important; }
  .stats__label { font-size: 11px !important; letter-spacing: .08em; padding: 0 !important; }

  .about-intro__text, .about-vision p, .about-mission p, .message__text, .services__text { font-size: 14px !important; line-height: 1.6 !important; }
  .about-vision__heading, .about-mission__heading { font-size: 20px !important; }
  .about-intro, .about-vision, .about-mission { padding-top: 24px; }
  .about-model__heading { padding-top: 28px; padding-bottom: 12px; font-size: 20px; }
  .about-model__list { row-gap: 16px; }

  .message__script { max-height: 96px; width: auto; max-width: 78%; object-fit: contain; }
  .message__portrait { max-width: 260px; margin: 0 auto; }

  .services { row-gap: 24px; }
  .services__item svg, .services__item img { max-height: 48px; width: auto; }
  .services__heading { font-size: 15px !important; }

  .brand-row__photo, .brand-row__layer { height: 170px !important; min-height: 0 !important; }
  .brand-row__logo { max-height: none; height: auto !important; width: auto !important; margin-bottom: 8px; }
  .brand-row__logo img, .brand-row__logo svg { max-height: 56px; width: auto !important; max-width: 160px; height: auto; display: block; margin: 0 auto; }
  .brand-row { padding-bottom: 20px; }

  .locator__map { height: 220px !important; }
  .loc-card { padding: 12px 14px !important; }
  .loc-card__title { font-size: 15px !important; }
  .loc-card__line { font-size: 13px !important; line-height: 1.45 !important; margin: 2px 0 !important; }
  .loc-card__actions { margin-top: 8px !important; }
  .loc-card__actions .btn { min-height: 38px !important; }

  .contact-card { padding: 18px 14px; gap: 16px; }
  .site-footer { padding: 24px var(--gutter) 60px; }
}

/* Phone browser bars (status bar and Safari bottom bar) take the page red, not black (Chadi, 4 Nov) */
@media (max-width: 1023.98px) {
  html { background: #3a0b0b; }
}
