/* Unifrost Machinery — shared layout chrome + responsive retrofit.
   The page content is authored with inline styles (exported from the
   design tool), so the mobile rules below match on those inline values
   rather than on hand-written classes.

   Key idea: on narrow screens the multi-column grids stay GRIDS and are
   collapsed to a single column. Forcing `display: block` instead would
   silently drop their `gap` (gap only applies to flex/grid) and leave
   `fr` rows stretching around short content. */

/* <picture> wraps every photo for the WebP/JPEG swap. `display: contents`
   removes its box so the inner <img> still sizes against the real layout
   parent — several images size themselves with `height: 100%`. */
picture { display: contents; }

/* Hero band. A ratio rather than a fixed height, so the photograph is
   cropped the same amount on every screen instead of being nearly whole
   at one width and a thin letterbox at the next. */
.hero-media { aspect-ratio: 2 / 1; }

/* Spec tables: keep the fixed column layout readable by letting the table
   scroll sideways inside its own box instead of squeezing the columns. */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.table-scroll table {
  border-collapse: collapse;
}

/* ---- Contact form ---- */
.contact-form { display: grid; gap: 18px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.field { display: grid; gap: 8px; }
.field label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  color: #7E8FA0;
}
.field .req { color: #1B7FCB; }
.field input,
.field select,
.field textarea {
  width: 100%;
  background: #0D1C2A;
  border: 1px solid #1B2A3A;
  border-radius: 0;
  color: #EFEAE2;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.5;
  padding: 13px 14px;
  appearance: none;
}
.field textarea { resize: vertical; min-height: 120px; }
.field input::placeholder,
.field textarea::placeholder { color: #5E6E7E; }
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: #1B7FCB;
}
.field select {
  /* Re-add the dropdown arrow lost to `appearance: none`. */
  background-image: linear-gradient(45deg, transparent 50%, #7E8FA0 50%),
                    linear-gradient(135deg, #7E8FA0 50%, transparent 50%);
  background-position: calc(100% - 19px) calc(50% + 2px), calc(100% - 13px) calc(50% + 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 38px;
}
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: stretch;
}
/* WhatsApp brand green. The glyph and label are dark rather than white:
   white on #25D366 only reaches about 2.2:1, well under the 4.5:1 needed
   for body-sized text, while this pairing clears 8:1. */
.btn-whatsapp {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #25D366;
  color: #0A1622;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  padding: 18px 28px;
  border: none;
  cursor: pointer;
  white-space: nowrap;
}
.btn-whatsapp:hover { background: #1FBE5B; }
.btn-whatsapp svg { flex: none; }

.btn-primary {
  justify-self: start;
  background: #1B7FCB;
  color: #FFFFFF;
  border: none;
  border-radius: 0;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  padding: 18px 34px;
  cursor: pointer;
}
.btn-primary:hover { background: #1670b4; }
.form-note {
  margin: 0;
  font-size: 13px;
  line-height: 1.65;
  color: #7E8FA0;
}
.form-note a { color: #93BFDF; text-decoration: underline; }

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  line-height: 0;
}
.nav-toggle span,
.nav-toggle span::before,
.nav-toggle span::after {
  display: block;
  width: 22px;
  height: 2px;
  background: #0A1622;
  position: relative;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-toggle span::before,
.nav-toggle span::after {
  content: "";
  position: absolute;
  left: 0;
}
.nav-toggle span::before { top: -7px; }
.nav-toggle span::after { top: 7px; }
.site-header.nav-open .nav-toggle span { background: transparent; }
.site-header.nav-open .nav-toggle span::before { transform: translateY(7px) rotate(45deg); }
.site-header.nav-open .nav-toggle span::after { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 860px) {
  body { overflow-x: hidden; }

  /* ---------- header / topbar ---------- */
  .site-topbar {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 6px !important;
    padding: 10px 20px !important;
    font-size: 9px !important;
    line-height: 1.5;
  }
  .site-topbar > span[style*="display: flex"] {
    flex-wrap: wrap;
    gap: 14px !important;
  }

  .site-header {
    padding: 14px 20px !important;
    position: relative;
  }
  .nav-toggle { display: block; }

  .site-nav {
    display: none !important;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #FFFFFF;
    border-bottom: 1px solid #E3E6EA;
    box-shadow: 0 12px 24px rgba(10, 22, 34, 0.12);
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0 !important;
    padding: 8px 0;
    z-index: 200;
  }
  .site-header.nav-open .site-nav { display: flex !important; }
  .site-nav a {
    padding: 14px 20px !important;
    border-bottom: 1px solid #F0F2F4;
  }
  .site-nav a[href="#enquire"] {
    margin: 10px 20px;
    text-align: center;
    border-bottom: none;
  }

  /* ---------- grids collapse to one column ---------- */
  [style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }
  /* `1.3fr 1fr` rows stretch to fill leftover space around short content
     once the layout is one column wide — let rows size to content. */
  [style*="grid-template-rows"] {
    grid-template-rows: none !important;
  }
  /* Column rules become row rules when stacked. */
  [style*="grid-template-columns"] > *[style*="border-left"] {
    border-left: none !important;
    border-top: 1px solid #1B2A3A !important;
  }
  [style*="grid-template-columns"] > *[style*="border-right"] {
    border-right: none !important;
  }
  /* Oversized desktop gaps read as dead space on a phone. */
  [style*="gap: 64px"], [style*="gap: 68px"] { gap: 32px !important; }

  /* ---------- horizontal gutter ----------
     72px is the design's page gutter; every element carrying it is an
     outer-edge block and gets the phone gutter instead. */
  [style*="72px"] {
    padding-left: 20px !important;
    padding-right: 20px !important;
  }
  /* Children of a full-bleed grid become outer-edge blocks once stacked. */
  [style*="grid-template-columns"] > * {
    padding-left: 20px !important;
    padding-right: 20px !important;
  }
  /* ...unless the grid itself already carries the gutter (higher
     specificity than the rule above, so it wins). */
  [style*="72px"][style*="grid-template-columns"] > * {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
  /* ...or the grid sits inside an element that carries the gutter. */
  [style*="72px"] [style*="grid-template-columns"] > * {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  /* ---------- vertical rhythm ---------- */
  [style*="padding: 76px"],
  [style*="padding: 84px"] {
    padding-top: 48px !important;
    padding-bottom: 48px !important;
  }
  [style*="padding: 56px 72px 80px"] {
    padding-top: 32px !important;
    padding-bottom: 48px !important;
  }
  [style*="padding: 0 72px 80px"],
  [style*="padding: 0 72px 84px"] {
    padding-bottom: 48px !important;
  }
  footer[style*="72px"] {
    padding-top: 40px !important;
    padding-bottom: 28px !important;
  }

  /* ---------- hero: stop overlaying text on a short image ---------- */
  [style*="position: absolute"][style*="inset: 0"] {
    position: static !important;
    background: #0A1622 !important;
    padding: 32px 20px 40px !important;
  }

  /* ---------- media ---------- */
  /* Below the breakpoint the hero text sits under the photo rather than on
     top of it, so the band can take the photograph's own 3:2 shape and
     show it whole. */
  .hero-media { aspect-ratio: 3 / 2; }
  /* Upright product shots size themselves from their aspect ratio, so the
     blanket fixed-height overrides above must not touch them. */
  [style*="aspect-ratio"] { height: auto !important; }
  [style*="height: 520px"] { height: 220px !important; }
  [style*="height: 460px"] { height: 220px !important; }
  [style*="height: 420px"] { height: 200px !important; }
  /* These wrappers sized themselves from the grid row they sat in; with
     rows now auto, an inner `height: 100%` image would collapse. A fixed
     height here turned them into extreme letterboxes at the wider end of
     this range (a 745x220 strip at 800px), so use a ratio — and leave
     alone any wrapper that already declares one of its own. */
  [style*="overflow: hidden"][style*="min-height: 0"]:not([style*="aspect-ratio"]) {
    height: auto !important;
    aspect-ratio: 3 / 2;
  }

  /* ---------- flex rows that must stack ---------- */
  [style*="justify-content: space-between"][style*="gap: 48px"],
  [style*="justify-content: space-between"][style*="gap: 64px"],
  [style*="justify-content: space-between"][style*="gap: 54px"],
  [style*="justify-content: space-between"][style*="gap: 68px"] {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 24px !important;
  }
  [style*="min-width: 300px"] {
    min-width: 0 !important;
    width: 100% !important;
  }

  .footer-top {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 28px !important;
  }
  .footer-links {
    flex-direction: column !important;
    gap: 24px !important;
    width: 100%;
  }
  .footer-bottom {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 6px !important;
    text-align: left !important;
    line-height: 1.6;
  }

  /* ---------- type scale ---------- */
  [style*="font-size: 82px"] { font-size: 36px !important; }
  [style*="font-size: 68px"] { font-size: 32px !important; }
  [style*="font-size: 62px"] { font-size: 32px !important; }
  [style*="font-size: 48px"] { font-size: 28px !important; }
  [style*="font-size: 44px"] { font-size: 26px !important; }
  [style*="font-size: 40px"] { font-size: 25px !important; }
  [style*="font-size: 34px"] { font-size: 24px !important; }
  [style*="font-size: 32px"] { font-size: 22px !important; }
  [style*="font-size: 30px"] { font-size: 22px !important; }
  [style*="font-size: 24px"] { font-size: 20px !important; }
  [style*="font-size: 22px"] { font-size: 19px !important; }
  [style*="font-size: 18px"] { font-size: 16px !important; }
  [style*="font-size: 17px"] { font-size: 16px !important; }

  /* Paired form fields stack rather than halve on a phone. */
  .field-row { grid-template-columns: 1fr !important; }
  /* Both actions go full width and stack, so neither is a cramped target
     on a phone — which is where most people will reach for WhatsApp. */
  .form-actions { flex-direction: column; }
  .btn-primary,
  .btn-whatsapp { justify-self: stretch; width: 100%; }

  /* A 5-column spec table cannot fit a phone; give it a usable minimum
     and let the wrapper scroll. */
  .table-scroll table {
    min-width: 620px;
    table-layout: auto !important;
  }
  .table-scroll th,
  .table-scroll td {
    padding: 11px 13px !important;
    white-space: normal;
  }

  /* Buttons go full width so the CTA pair reads as a stack. */
  a[href="#enquire"][style*="padding: 17px 30px"],
  a[style*="padding: 17px 30px"],
  a[style*="padding: 19px 32px"] {
    display: block !important;
    text-align: center !important;
    width: 100%;
  }
  [style*="display: flex"][style*="gap: 14px"] {
    flex-direction: column !important;
    gap: 10px !important;
  }
}
