/* ==========================================================================
   TRITECH COMPUTERS & ENGINEERS — RESPONSIVE LAYER
   Desktop-first overrides. Breakpoints:
     1440  large desktop
     1200  desktop
     1024  laptop / landscape tablet  -> mobile nav takes over
      880  tablet portrait
      640  large phone
      420  small phone
   Plus: landscape phones, hover-less devices, print.
   ========================================================================== */

/* ==========================================================================
   LARGE DESKTOP — 1440px and up: widen the reading measure slightly
   ========================================================================== */
@media (min-width: 1440px) {
  :root {
    --container: 1320px;
  }

  .hero__visual {
    height: 540px;
  }
}

/* ==========================================================================
   DESKTOP — up to 1200px
   ========================================================================== */
@media (max-width: 1200px) {
  :root {
    --header-h: 72px;
  }

  .header__call {
    display: none;
  }

  .nav__link {
    padding: 10px 12px;
  }

  .nav__link::after {
    left: 12px;
    right: 12px;
  }

  .footer__grid {
    grid-template-columns: 1.4fr 1fr 1fr;
  }

  .footer__col--contact {
    grid-column: 1 / -1;
    padding-top: var(--sp-6);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }

  .footer__contact {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--sp-4) var(--sp-6);
  }
}

/* ==========================================================================
   LAPTOP / LANDSCAPE TABLET — up to 1024px
   Mobile navigation drawer engages here.
   ========================================================================== */
@media (max-width: 1024px) {
  :root {
    --section-y: clamp(3.5rem, 8vw, 5.5rem);
  }

  /* --- Navigation becomes a slide-in drawer --- */
  .nav-toggle {
    display: flex;
    order: 3;
  }

  .header__actions .btn {
    display: none;
  }

  .nav {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 999;
    width: min(380px, 86vw);
    margin: 0;
    padding: calc(var(--header-h) + 24px) var(--sp-5) var(--sp-7);
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--card);
    border-left: 1px solid var(--border);
    box-shadow: -20px 0 60px rgba(15, 23, 42, 0.14);
    transform: translateX(100%);
    visibility: hidden;
    transition: transform 0.42s var(--ease-out), visibility 0.42s;
  }

  .nav.is-open {
    transform: translateX(0);
    visibility: visible;
  }

  .nav__list {
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    width: 100%;
  }

  /* Drawer links are always dark, regardless of header state */
  .header:not(.is-scrolled):not(.header--solid) .nav__link,
  .nav__link {
    color: var(--text);
    justify-content: space-between;
    padding: 15px 14px;
    font-size: 1rem;
    font-weight: 500;
    border-radius: var(--r-md);
  }

  .header:not(.is-scrolled):not(.header--solid) .nav__link:hover,
  .nav__link:hover {
    color: var(--accent);
    background: var(--accent-050);
  }

  .header:not(.is-scrolled):not(.header--solid) .nav__link.is-active,
  .nav__link.is-active {
    color: var(--accent);
    background: var(--accent-050);
  }

  /* Underline is replaced by the filled row state */
  .nav__link::after {
    display: none;
  }

  /* Mega menu collapses into an inline accordion panel */
  .mega {
    position: static;
    width: 100%;
    translate: none;
    transform: none;
    padding: 0 0 0 14px;
    margin: 0;
    border: 0;
    border-left: 2px solid var(--border);
    border-radius: 0;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: none;
    opacity: 1;
    visibility: visible;
    display: none;
  }

  .nav__item.is-open > .mega {
    display: block;
    animation: fadeUp 0.35s var(--ease-out) both;
  }

  .mega__grid {
    grid-template-columns: 1fr;
    gap: var(--sp-4);
  }

  .mega__col-title {
    margin-bottom: var(--sp-2);
  }

  .mega__link {
    padding: 8px 10px;
  }

  .mega__link span {
    display: none;
  }

  .mega__promo {
    display: none;
  }

  /* Drawer CTA — re-shown inside the panel */
  .nav__cta {
    display: block;
    margin-top: var(--sp-5);
    padding-top: var(--sp-5);
    border-top: 1px solid var(--border);
  }

  .nav__cta .btn {
    display: inline-flex;
    width: 100%;
  }

  .nav__meta {
    display: block;
    margin-top: var(--sp-5);
    font-size: var(--fs-xs);
    color: var(--text-muted);
    line-height: 1.7;
  }

  .nav__meta a {
    display: block;
    font-weight: 600;
    color: var(--text);
  }

  /* --- Hero stacks --- */
  .hero {
    min-height: auto;
  }

  .hero__inner {
    grid-template-columns: 1fr;
    gap: var(--sp-8);
  }

  .hero__visual {
    height: 420px;
    max-width: 560px;
    width: 100%;
    margin-inline: auto;
  }

  .scroll-cue {
    display: none;
  }

  /* --- Layout collapses --- */
  .split {
    grid-template-columns: 1fr;
  }

  .split--keep {
    grid-template-columns: 1fr 1fr;
  }

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

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

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

  .process {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--sp-7) var(--sp-5);
  }

  .process::before {
    display: none;
  }

  .upcoming {
    grid-template-columns: 1fr;
  }

  .newsletter {
    grid-template-columns: 1fr;
  }

  .newsletter__form {
    min-width: 100%;
  }

  /* Testimonial slider: two per view */
  .slider__slide {
    flex-basis: 50%;
  }

  /* Custom cursor is pointless on touch-first devices */
  .cursor-dot,
  .cursor-ring,
  .mouse-glow {
    display: none;
  }

  /* Sticky filter bar releases — it eats too much height */
  .filter-bar {
    position: static;
  }
}

/* ==========================================================================
   TABLET PORTRAIT — up to 880px
   ========================================================================== */
@media (max-width: 880px) {
  .float-card {
    right: 0;
    bottom: -16px;
    padding: var(--sp-4);
    min-width: 160px;
  }

  .float-card strong {
    font-size: 1.625rem;
  }

  /* Timeline switches from alternating to a single left rail */
  .timeline::before {
    left: 7px;
    translate: none;
  }

  .tl-item,
  .tl-item:nth-child(even) {
    width: 100%;
    margin-left: 0;
    padding-left: var(--sp-7);
    padding-right: 0;
  }

  .tl-item__dot,
  .tl-item:nth-child(even) .tl-item__dot {
    left: 0;
    right: auto;
  }

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

  .form-grid {
    grid-template-columns: 1fr;
  }

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

  .footer__col--about {
    grid-column: 1 / -1;
  }

  .cta-banner {
    padding: var(--sp-7) var(--sp-5);
  }
}

/* ==========================================================================
   LARGE PHONE — up to 640px
   ========================================================================== */
@media (max-width: 640px) {
  :root {
    --header-h: 66px;
    --section-y: 3.25rem;
    --r-lg: 16px;
    --r-xl: 20px;
  }

  body {
    font-size: 0.9375rem;
  }

  .brand__sub {
    display: none;
  }

  .brand__mark {
    width: 34px;
    height: 34px;
  }

  /* --- Single-column everything --- */
  .grid-2,
  .grid-3,
  .grid-4,
  .split--keep,
  .why-grid,
  .stats {
    grid-template-columns: 1fr;
  }

  .process {
    grid-template-columns: 1fr;
    gap: var(--sp-6);
  }

  .grid {
    gap: var(--sp-4);
  }

  .why-item {
    padding: var(--sp-6) var(--sp-5);
    border-right: 0;
  }

  .card {
    padding: var(--sp-5);
  }

  /* --- Hero --- */
  .hero {
    padding-top: calc(var(--header-h) + 2.5rem);
  }

  .hero__visual {
    height: 360px;
  }

  .hero-panel--main {
    inset: 34px 0 34px 14px;
    padding: var(--sp-4);
  }

  .hero-panel--stat {
    width: 168px;
    top: 0;
  }

  .hero-panel--alert {
    left: 0;
    width: 210px;
  }

  .hero__actions .btn {
    width: 100%;
  }

  .hero__trust {
    gap: var(--sp-5);
  }

  .hero__trust-item strong {
    font-size: 1.5rem;
  }

  /* --- Components --- */
  .slider__slide {
    flex-basis: 100%;
    padding-inline: 0;
  }

  .acc-trigger {
    padding: var(--sp-4);
    font-size: 0.9375rem;
  }

  .acc-panel p {
    padding: 0 var(--sp-4) var(--sp-4);
  }

  .plan--featured {
    transform: none;
  }

  .filter-bar {
    padding: var(--sp-3);
  }

  .search-field {
    max-width: 100%;
    order: -1;
  }

  .filter-chips {
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .filter-chips::-webkit-scrollbar {
    display: none;
  }

  .chip {
    flex: none;
  }

  .newsletter__form {
    flex-direction: column;
  }

  .newsletter__form .btn {
    width: 100%;
  }

  .saving-dial {
    width: 180px;
    height: 180px;
  }

  .saving-dial strong {
    font-size: 2.75rem;
  }

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

  .logo-tile {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: var(--sp-4);
  }

  .btn-group .btn {
    width: 100%;
  }

  /* --- Footer --- */
  .footer__grid {
    grid-template-columns: 1fr;
    gap: var(--sp-6);
  }

  .footer__col--contact {
    padding-top: var(--sp-5);
  }

  .footer__contact {
    grid-template-columns: 1fr;
  }

  .footer__bar {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
  }

  .footer__bar nav {
    gap: var(--sp-4);
  }

  /* --- Floating UI shrinks and tucks in --- */
  .to-top {
    right: 16px;
    bottom: 16px;
    width: 44px;
    height: 44px;
  }

  .fab {
    left: 16px;
    bottom: 16px;
  }

  .fab__toggle {
    width: 50px;
    height: 50px;
  }

  .fab__menu {
    bottom: 60px;
  }
}

/* ==========================================================================
   SMALL PHONE — up to 420px
   ========================================================================== */
@media (max-width: 420px) {
  :root {
    --fs-display: 2.125rem;
  }

  .container {
    padding-inline: 1.125rem;
  }

  .hero__visual {
    height: 320px;
  }

  .hero-panel--stat {
    width: 148px;
    padding: var(--sp-3) var(--sp-4);
  }

  .hero-panel--alert {
    width: 190px;
    padding: var(--sp-3);
  }

  .logo-grid {
    grid-template-columns: 1fr;
  }

  .icon-box {
    width: 46px;
    height: 46px;
  }

  .icon-box svg {
    width: 22px;
    height: 22px;
  }

  .plan {
    padding: var(--sp-6) var(--sp-5);
  }
}

/* ==========================================================================
   LANDSCAPE PHONES — short viewports
   Hero must not demand a full screen when there is no vertical room.
   ========================================================================== */
@media (max-height: 560px) and (orientation: landscape) {
  .hero {
    min-height: auto;
    padding-top: calc(var(--header-h) + 2rem);
    padding-bottom: 3rem;
  }

  .hero__visual {
    height: 300px;
  }

  .scroll-cue {
    display: none;
  }

  /* Drawer needs to scroll rather than clip */
  .nav {
    padding-top: calc(var(--header-h) + 12px);
    padding-bottom: var(--sp-5);
  }

  .loader__mark {
    width: 48px;
    height: 48px;
  }
}

/* Landscape tablets keep the two-up hero */
@media (min-width: 700px) and (max-width: 1024px) and (orientation: landscape) {
  .hero__inner {
    grid-template-columns: 1.1fr 0.9fr;
    align-items: center;
  }

  .hero__visual {
    height: 380px;
    margin-inline: 0;
  }
}

/* ==========================================================================
   HOVER-LESS / COARSE POINTERS
   Remove hover-only affordances and enlarge tap targets.
   ========================================================================== */
@media (hover: none) {
  .hover-lift:hover,
  .card:hover,
  .cat-tile:hover,
  .contact-card:hover,
  .offer-item:hover,
  .stat:hover,
  .logo-tile:hover {
    transform: none;
  }

  .marquee__track {
    animation-duration: 30s;
  }

  .nav__link,
  .footer__links a,
  .chip {
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  .footer__links a:hover {
    padding-left: 0;
  }
}

/* ==========================================================================
   HIGH CONTRAST / FORCED COLORS
   ========================================================================== */
@media (forced-colors: active) {
  .btn,
  .card,
  .chip {
    border: 1px solid CanvasText;
  }

  .icon-box svg,
  .btn svg {
    forced-color-adjust: auto;
  }
}

/* ==========================================================================
   PRINT
   Strip chrome, keep the content readable on paper.
   ========================================================================== */
@media print {
  .header,
  .nav,
  .nav-toggle,
  .to-top,
  .fab,
  .loader,
  .page-fx,
  .cursor-dot,
  .cursor-ring,
  .mouse-glow,
  .scroll-cue,
  .marquee,
  .newsletter,
  .cta-banner,
  .slider__nav {
    display: none !important;
  }

  body {
    background: #fff;
    color: #000;
    font-size: 11pt;
  }

  .section,
  .page-head {
    padding-block: 1rem;
    background: #fff !important;
    color: #000 !important;
  }

  .page-head h1,
  .section--dark h2,
  .section--dark h3 {
    color: #000 !important;
  }

  .card,
  .table-wrap {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ccc;
  }

  [data-reveal] {
    opacity: 1 !important;
    animation: none !important;
  }

  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 9pt;
    color: #555;
  }
}