/*
  Container-query responsive layer.
  This keeps scaling in CSS instead of running a resize loop in JavaScript.
*/

@supports (container-type: inline-size) {
  #top,
  #work,
  #about,
  #contact {
    container-type: inline-size;
  }

  #top [data-appbar] {
    height: clamp(28px, 2.4cqw, 34px) !important;
    padding-inline: clamp(10px, 1.6cqw, 24px) !important;
    font-size: clamp(7px, 0.72cqw, 10px) !important;
    letter-spacing: clamp(0.08em, 0.018cqw, 0.18em) !important;
  }

  #top [data-appbar] > div:last-child {
    gap: clamp(10px, 1.5cqw, 22px) !important;
  }

  #top [data-hero-grid] {
    grid-template-columns: minmax(0, 1fr) minmax(220px, clamp(240px, 23cqw, 320px)) !important;
    gap: clamp(8px, 0.9cqw, 12px) !important;
    padding: clamp(8px, 1cqw, 14px) !important;
    min-height: 0 !important;
    align-items: start !important;
  }

  #top [data-hero-workbench] {
    width: 100%;
    transform-origin: top left;
  }

  #top [data-viewer] {
    container-type: inline-size;
  }

  #top [data-viewer-surface] {
    padding-block: clamp(8px, 1.2cqw, 12px) !important;
    padding-inline: 0 !important;
  }

  #top [data-hero-title] {
    font-size: clamp(58px, 14cqw, 172px) !important;
    letter-spacing: clamp(0.04em, 0.018cqw, 0.14em) !important;
  }

  #top [data-hero-subline] {
    font-size: clamp(12px, 1.8cqw, 24px) !important;
    letter-spacing: clamp(0.12em, 0.03cqw, 0.28em) !important;
  }

  #top [data-role-chip] {
    margin-top: clamp(24px, 4.5cqw, 44px) !important;
    padding: clamp(10px, 1.5cqw, 14px) clamp(16px, 2.8cqw, 26px) !important;
    gap: clamp(10px, 1.6cqw, 18px) !important;
  }

  #top [data-inspector] {
    container-type: inline-size;
    gap: clamp(8px, 1cqw, 12px) !important;
  }

  #top [data-inspector-card] {
    padding: clamp(10px, 4cqw, 14px) !important;
  }

  #top [data-timeline] {
    padding: clamp(8px, 0.9cqw, 14px) !important;
    font-size: clamp(7px, 0.62cqw, 9px) !important;
  }

  #work,
  #about,
  #contact {
    padding-inline: clamp(20px, 3.2cqw, 40px) !important;
  }

  #work h2,
  #about h2,
  #contact h2 {
    font-size: clamp(40px, 5.6cqw, 72px) !important;
  }

  #about [data-capability-grid] {
    gap: clamp(14px, 1.6cqw, 20px) !important;
  }

  #about [data-capability-grid] > div {
    padding: clamp(22px, 2.4cqw, 30px) !important;
    min-height: clamp(180px, 16cqw, 210px) !important;
  }

  #contact [data-contact-email] {
    font-size: clamp(24px, 3.2cqw, 52px) !important;
    max-width: 100%;
    white-space: nowrap;
    overflow-wrap: normal;
    word-break: normal;
  }

  #contact [data-contact-card] a[href^="mailto:"] {
    display: block !important;
    font-size: inherit !important;
    max-width: none;
    white-space: normal;
    overflow-wrap: normal;
  }

  @container (max-width: 980px) {
    #top [data-hero-workbench] {
      width: 980px !important;
      zoom: 0.9;
    }

    #top [data-hero-grid] {
      grid-template-columns: minmax(0, 1fr) 320px !important;
    }

    #top [data-inspector] {
      display: flex !important;
      flex-direction: column !important;
    }
  }

  @container (max-width: 900px) {
    #top [data-hero-workbench] {
      zoom: 0.84;
    }
  }

  @container (max-width: 820px) {
    #top [data-hero-workbench] {
      zoom: 0.78;
    }
  }

  @container (max-width: 720px) {
    #top [data-hero-workbench] {
      zoom: 0.68;
    }

    #top [data-appbar] > div:last-child {
      display: none !important;
    }

    #top [data-inspector] {
      display: flex !important;
      flex-direction: column !important;
    }

    #contact > div:nth-of-type(2) {
      grid-template-columns: 1fr !important;
      gap: 36px !important;
    }
  }

  @container (max-width: 620px) {
    #top [data-hero-workbench] {
      zoom: 0.58;
    }
  }

  @container (max-width: 520px) {
    #top [data-hero-workbench] {
      zoom: 0.48;
    }
  }

  @container (max-width: 430px) {
    #top [data-hero-workbench] {
      zoom: 0.39;
    }
  }
}

nav {
  padding-inline: clamp(12px, 2.4vw, 32px) !important;
  gap: clamp(12px, 2.5vw, 32px) !important;
}

nav a {
  white-space: nowrap;
}

nav > div:first-of-type {
  gap: clamp(14px, 3vw, 28px) !important;
  margin-left: clamp(8px, 2vw, 28px) !important;
  flex-shrink: 0;
}

nav > div:last-of-type {
  gap: clamp(12px, 2vw, 24px) !important;
}

@media (max-width: 720px) {
  nav {
    width: 100vw !important;
    max-width: 100vw !important;
    overflow: hidden !important;
  }

  nav > a > span:nth-child(3),
  nav > div:last-of-type > div:first-child {
    display: none !important;
  }

  nav > div:last-of-type {
    position: absolute !important;
    left: 276px !important;
    right: auto !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
  }
}

@media (max-width: 430px) {
  nav {
    padding-inline: 8px !important;
    gap: 8px !important;
    width: 100vw !important;
    max-width: 100vw !important;
    overflow: hidden !important;
  }

  nav > div:first-of-type {
    gap: 10px !important;
    margin-left: 4px !important;
  }

  nav > div:first-of-type a,
  nav button {
    font-size: 10px !important;
    letter-spacing: 0.06em !important;
  }

  nav > div:last-of-type {
    position: absolute !important;
    left: 276px !important;
    right: auto !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
  }

  nav button {
    padding-inline: 7px !important;
  }
}
