/* ==========================================================================
   TYRONEX: responsive layer (phones and tablets)

   >= 1024px : the original 1440px desktop design, scaled to the window by
               fit() in assets/js/site.js. NOTHING in this file applies there
               (except hiding the mobile-only elements below).
   <  1024px : the page reflows. All rules live inside the media queries.

   The breakpoint "(max-width: 1023.98px), (max-width: 1279.98px) and (pointer: coarse)" (every window
   under 1024px, plus touch screens up to 1279px: iPads in landscape) is mirrored in assets/js/site.js
   (var mobileMQ: fit() and the menu) and in the tx-fit script in the <head> of every page. Keep them in sync.

   The markup uses inline styles, so overrides need !important.
   Hook classes are prefixed m-. Page-specific rules live in a
   <style> block inside the page itself.
   ========================================================================== */

/* Mobile-only elements: hidden on desktop */
.m-burger, .m-menu { display: none; }

/* In-place navigation (assets/js/site.js): a reload of an entry that showed another page keeps this page
   hidden until site.js has brought that page back (the class is set by the inline script in <head>) */
html.tx-restoring #page, html.tx-restoring #m-menu { visibility: hidden; }

/* --------------------------------------------------------------------------
   Tablet + phone (< 1024px)
   -------------------------------------------------------------------------- */
@media (max-width: 1023.98px), (max-width: 1279.98px) and (pointer: coarse) {
  /* gutters never smaller than the iPhone notch / home-indicator insets (viewport-fit=cover) */
  /* with a side inset (notched iPhone on its side) the gutter clears it by the frame's bracket arm (16/10px),
     so the frame sits in the visible area */
  :root { --m-gutter: max(40px, calc(env(safe-area-inset-left, 0px) + 16px), calc(env(safe-area-inset-right, 0px) + 16px)); --m-nav-top: calc(30px + env(safe-area-inset-top, 0px)); --m-sec-y: 88px; }
  /* shared look tokens, used by the page blocks:
     --m-cut / --m-rad : angled bottom-right cut and corner radius of framed images, cards and boxes
                          (inner layers use calc(var(--m-rad) - 1px))
     --m-btn-h          : height of CTA buttons and e-mail fields on phones
     --m-copy-lh        : line-height of secondary 14px copy (card descriptions etc.) */
  :root { --m-cut: 36px; --m-rad: 20px; --m-btn-h: 48px; --m-copy-lh: 1.7; }

  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  #page { width: auto !important; zoom: 1 !important; }
  .m-root { width: auto !important; overflow-x: clip; }

  /* ---- utilities ---------------------------------------------------- */
  .m-hide { display: none !important; }
  .m-wrap { white-space: normal !important; }
  .m-full { width: 100% !important; max-width: 100% !important; }
  .m-stack { display: flex !important; flex-direction: column !important; align-items: stretch !important; }
  .m-cols1 { grid-template-columns: minmax(0, 1fr) !important; }
  .m-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .m-left { text-align: left !important; align-items: flex-start !important; }

  /* ---- type scale --------------------------------------------------- */
  /* small mono labels: "01 · WHY TYRONEX", "PRODUCTS" ... */
  .m-eyebrow { white-space: normal !important; font-size: 12px !important; line-height: 1.6 !important; }
  /* page titles (56px on desktop); the 9.4vw cap keeps one long word (SHIFTLIGHTS) inside 320px */
  .m-h1 { font-size: min(clamp(32px, 7.4vw, 56px), 9.4vw) !important; }
  /* section titles (40-44px on desktop) */
  .m-h2 { font-size: clamp(26px, 5.6vw, 40px) !important; }
  /* big statement titles (64px on desktop) */
  .m-display { font-size: clamp(30px, 8vw, 64px) !important; }
  /* paragraphs */
  .m-lead { font-size: 15px !important; line-height: 1.75 !important; }
  /* no lonely last word in titles and leads (progressive enhancement) */
  .m-h1, .m-h2, .m-display { text-wrap: balance; }
  .m-lead { text-wrap: pretty; }

  /* ---- nav ---------------------------------------------------------- */
  .m-nav { left: var(--m-gutter) !important; right: var(--m-gutter) !important; top: var(--m-nav-top) !important; z-index: 20 !important; }
  .m-navlinks { display: none !important; }
  /* invisible vertical padding: 45px tap area, no layout change */
  .m-logo { font-size: 19px !important; padding-top: 13px; padding-bottom: 13px; margin-top: -13px; margin-bottom: -13px; }

  .m-burger {
    display: inline-flex; flex-direction: column; justify-content: center; align-items: flex-end; gap: 7px;
    width: 48px; height: 48px; margin: -12px -12px -12px 0; padding: 0 12px; box-sizing: border-box;
    background: none; border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent;
  }
  .m-burger span { display: block; width: 24px; height: 1.5px; background: #E6E9ED; border-radius: 1px; }
  .m-burger span:last-child { width: 15px; background: #7FD1FF; box-shadow: 0 0 8px rgba(127, 209, 255, 0.45); }
  .m-burger:focus-visible, .m-menu-close:focus-visible, .m-menu a:focus-visible { outline: 1.5px solid #7FD1FF; outline-offset: 2px; }

  /* ---- mobile menu (direct child of <body>) -------------------------- */
  .m-menu {
    display: flex; flex-direction: column; position: fixed; inset: 0; z-index: 1000;
    padding: var(--m-nav-top) var(--m-gutter) calc(28px + env(safe-area-inset-bottom));
    box-sizing: border-box; overflow-y: auto; overscroll-behavior: contain;
    background:
      radial-gradient(ellipse at 85% 0%, rgba(127, 209, 255, 0.10) 0%, rgba(127, 209, 255, 0) 55%),
      repeating-linear-gradient(135deg, rgba(17, 20, 24, 0.5) 0 14px, rgba(14, 17, 20, 0.5) 14px 28px),
      #08090B;
    color: #E6E9ED; font-family: 'Michroma', sans-serif;
    opacity: 0; transform: translateY(-8px); transition: opacity .25s ease, transform .25s ease;
  }
  .m-menu[hidden] { display: none; }
  .m-menu.is-open { opacity: 1; transform: none; }
  .m-menu:not(.is-open) { pointer-events: none; } /* while it fades out, taps reach the page */
  html.m-lock, html.m-lock body { overflow: hidden; }

  .m-menu-head { display: flex; justify-content: space-between; align-items: center; min-height: 24px; }
  .m-menu-logo { font-family: SyneTRNX; font-size: 19px; letter-spacing: 0.375em; margin-right: -0.375em; color: #FFFFFF; line-height: 1; white-space: nowrap; }
  .m-menu-close {
    position: relative; width: 48px; height: 48px; margin: -12px -12px -12px 0;
    background: none; border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent;
  }
  .m-menu-close span { position: absolute; left: 12px; top: 23px; width: 24px; height: 1.5px; background: #E6E9ED; }
  .m-menu-close span:first-child { transform: rotate(45deg); }
  .m-menu-close span:last-child { transform: rotate(-45deg); }

  /* the list is capped so tablet rows don't stretch 688px with the arrow far away */
  .m-menu-nav { display: flex; flex-direction: column; width: 100%; max-width: 520px; margin-top: 44px; border-bottom: 1px solid #1E2228; }
  /* top-level rows (Home, Products, Studio): the desktop nav look, Michroma in #C9CED5 */
  .m-menu-link {
    position: relative; display: flex; align-items: center;
    min-height: 60px; padding: 12px 36px 12px 0; box-sizing: border-box; border-top: 1px solid #1E2228;
    font-size: 18px; letter-spacing: 0.02em; color: #C9CED5; -webkit-tap-highlight-color: transparent;
  }
  /* the arrow is out of the flow, so the current-page underline stays under the word */
  .m-menu-link i { position: absolute; right: 0; top: 50%; transform: translateY(-50%); font-style: normal; color: #7FD1FF; opacity: 0.55; }
  /* current page, the desktop way: white word with a 1.5px blue underline, full-strength arrow
     (on product and category pages the current item is a product row, and Products is marked too) */
  .m-menu-link[aria-current="page"]:not(.m-menu-sub),
  .m-menu-nav:has(.m-menu-sub[aria-current="page"]) .m-menu-products,
  .m-menu-sub[aria-current="page"] > span {
    color: #FFFFFF; text-decoration: underline 1.5px #7FD1FF; text-underline-offset: 9px; text-decoration-skip-ink: none;
  }
  .m-menu-sub[aria-current="page"] > span { text-underline-offset: 5px; } /* closer, so it stays clear of the subtitle */
  .m-menu-link[aria-current="page"] i, .m-menu-nav:has(.m-menu-sub[aria-current="page"]) .m-menu-products i { opacity: 1; }

  /* Products' sub-list: the desktop dropdown panel stitched from its four rows
     (#2A2E35 frame, 6px corners, cut bottom-right corner, items: Michroma name + mono subtitle) */
  .m-menu-sub {
    min-height: 0; padding: 12px 44px 12px 18px; border: solid #2A2E35; border-width: 0 1px;
    background: rgba(14, 17, 20, 0.96); font-size: 15px; color: #F2F4F6;
  }
  .m-menu-sub i { right: 18px; }
  .m-menu-products + .m-menu-sub { border-top-width: 1px; border-radius: 6px 6px 0 0; padding-top: 18px; }
  .m-menu-sub:not(:has(+ .m-menu-sub)) {
    border-bottom-width: 1px; border-radius: 0 0 0 6px; padding-bottom: 18px; margin-bottom: 14px;
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - 22px), calc(100% - 22px) 100%, 0 100%);
    background: linear-gradient(to top left, transparent calc(50% - 0.75px), #2A2E35 calc(50% - 0.75px), #2A2E35 calc(50% + 0.75px), transparent calc(50% + 0.75px)) right bottom / 22px 22px no-repeat border-box, rgba(14, 17, 20, 0.96);
  }
  /* focus ring above the neighbouring rows; inside the panel rows (the last one's clip-path would cut an outer ring) */
  .m-menu-link:focus-visible { z-index: 1; }
  .m-menu .m-menu-sub:focus-visible { outline-offset: -3px; }
  /* subtitle under the name; a float so the current-page underline doesn't run under it */
  .m-menu-link small {
    float: left; width: 100%; margin-top: 8px; font-family: 'Martian Mono', monospace; font-size: 10.5px;
    letter-spacing: 0.2em; text-transform: uppercase; color: #7C838D;
  }
  .m-menu-foot {
    margin-top: auto; padding-top: 32px; font-family: 'Martian Mono', monospace; font-size: 11px;
    letter-spacing: 0.16em; text-transform: uppercase; color: #7C838D;
  }

  /* ---- section frame: corner brackets + left tick ruler + right marker --------------------
     The frame is the block's content box grown by the bracket arm, as on desktop: each bracket's
     arms end on the content's edge lines (gutter / top / bottom), so the content sits inside the
     frame and every corner hugs the content corner. Blocks set --fr-t / --fr-b from their own
     padding (index.html); --fr-x follows the gutter. The ruler and the marker sit centred in the
     strip outside the frame, mirrored left/right, level with the frame's middle. */
  .m-corners {
    --fr-arm: 16px; --fr-rule-w: 8px; --fr-mark-w: 3px; --fr-mark-h: 48px;
    --fr-x: calc(var(--m-gutter) - var(--fr-arm)); --fr-t: var(--fr-x); --fr-b: var(--fr-x);
  }
  .m-corners > .m-br { width: var(--fr-arm) !important; height: var(--fr-arm) !important; }
  .m-corners > .m-br--tl, .m-corners > .m-br--bl { left: var(--fr-x) !important; }
  .m-corners > .m-br--tr, .m-corners > .m-br--br { right: var(--fr-x) !important; }
  .m-corners > .m-br--tl, .m-corners > .m-br--tr { top: var(--fr-t) !important; }
  .m-corners > .m-br--bl, .m-corners > .m-br--br { bottom: var(--fr-b) !important; }
  .m-corners > .m-ruler {
    left: calc((var(--fr-x) - var(--fr-rule-w)) / 2) !important;
    /* no ruler and no marker when the screen has a side inset: their strip would be under the notch /
       Dynamic Island (1px of inset x100 takes the width to 0) */
    width: max(0px, calc(var(--fr-rule-w) - max(env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px)) * 100)) !important;
    top: calc(var(--fr-t) + var(--fr-arm) + 8px) !important; bottom: calc(var(--fr-b) + var(--fr-arm) + 8px) !important;
  }
  .m-corners > .hm-rind {
    right: calc((var(--fr-x) - var(--fr-mark-w)) / 2) !important; height: var(--fr-mark-h) !important;
    width: max(0px, calc(var(--fr-mark-w) - max(env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px)) * 100)) !important;
    top: calc(50% + (var(--fr-t) - var(--fr-b)) / 2 - var(--fr-mark-h) / 2) !important;
  }

  /* ---- sub-page hero ------------------------------------------------- */
  .m-hero { height: auto !important; }
  /* home: full-screen hero (all its children are absolutely positioned) */
  .m-hero--home { height: 100vh !important; height: 100svh !important; min-height: 600px; max-height: 1100px; }
  .m-subhero {
    position: relative !important; left: auto !important; right: auto !important; top: auto !important; bottom: auto !important;
    padding: 136px var(--m-gutter) 64px; grid-template-columns: minmax(0, 1fr) !important;
  }
  .m-subhero .m-lead { max-width: 560px; }
  /* paragraphs in sections: at most ~70 characters a line in wide windows (844-1023); narrower screens are not affected */
  .m-sec .m-lead { max-width: 46em; }

  /* ---- content sections -------------------------------------------- */
  .m-sec {
    padding-left: var(--m-gutter) !important; padding-right: var(--m-gutter) !important;
    padding-top: var(--m-sec-y) !important; padding-bottom: var(--m-sec-y) !important;
  }
  .m-sec.m-pt0 { padding-top: 0 !important; }

  /* ---- footer -------------------------------------------------------- */
  /* the desktop layout, tighter: logo left + Products/Studio right on one row, a rule, the three labels in a row.
     One spacing value (desktop 40, tablet 32, phone 28) above and below each row: top rule, logo row, rule, labels, page end */
  .m-footer { padding: 32px var(--m-gutter) calc(32px + env(safe-area-inset-bottom)) !important; }
  .m-footer-top { flex-wrap: nowrap !important; gap: 24px !important; }
  .m-footer-top [data-href] { padding: 13px 0; margin: -13px 0; font-size: 14px !important; } /* 44px tap area, no layout change; 14px like the body copy */
  .m-footer-bottom { flex-wrap: wrap !important; justify-content: space-between !important; gap: 14px 24px !important; margin-top: 32px !important; padding-top: 32px !important; }

  /* ---- e-mail sign-up rows ----------------------------------------- */
  .tx-input { font-size: 16px !important; } /* < 16px makes iOS Safari zoom the page on focus */
  [data-notify-row] { max-width: 100% !important; }
  [data-notify-row] > * { box-sizing: border-box; }
}

/* --------------------------------------------------------------------------
   Phone (< 600px)
   -------------------------------------------------------------------------- */
@media (max-width: 599.98px) {
  :root { --m-gutter: max(20px, calc(env(safe-area-inset-left, 0px) + 10px), calc(env(safe-area-inset-right, 0px) + 10px)); --m-nav-top: calc(22px + env(safe-area-inset-top, 0px)); --m-sec-y: 64px; --m-cut: 28px; --m-rad: 14px; }
  .m-grid { grid-template-columns: minmax(0, 1fr) !important; }
  .m-phone-hide { display: none !important; }
  .m-corners { --fr-arm: 10px; --fr-rule-w: 6px; --fr-mark-w: 2px; --fr-mark-h: 40px; }
  .m-lead { font-size: 14px !important; }
  .m-subhero { padding-top: 112px; padding-bottom: 52px; }
  /* footer: same rows as on tablets; the labels don't fit one row, so "MADE IN THE UAE" left +
     "© 2026 TYRONEX" right, and "COOLED BY TRNX" centred under them */
  .m-footer { padding-top: 28px !important; padding-bottom: calc(28px + env(safe-area-inset-bottom)) !important; }
  .m-footer-top { gap: 16px !important; } /* the minimum; space-between spreads the rest */
  .m-footer-top > :first-child > div { font-size: 15px !important; }
  .m-footer-top > :last-child { gap: 24px !important; }
  .m-footer-bottom { margin-top: 28px !important; padding-top: 28px !important; column-gap: 12px !important; }
  .m-footer-bottom > :nth-child(2) { order: 1; flex: 0 0 100%; justify-content: center; }
  [data-notify-row] { flex-direction: column !important; }
  [data-notify-row] > * { width: 100% !important; flex: none !important; }
  [data-notify-row] [data-notify] { flex: 1 1 auto; justify-content: center; }
  .m-menu-nav { margin-top: 36px; }
}

/* --------------------------------------------------------------------------
   Narrow phones (< 360px): the footer rows need smaller pieces to stay on one line
   -------------------------------------------------------------------------- */
@media (max-width: 359.98px) {
  .m-footer-top > :first-child > div { font-size: 12px !important; }
  .m-footer-top > :last-child { gap: 16px !important; }
  .m-footer-bottom > :first-child, .m-footer-bottom > :last-child, .m-footer-bottom > :nth-child(2) > :first-child { letter-spacing: 0.1em !important; }
  /* menu: 4px shorter top rows keep it on a 640px-tall screen; the foot line on one line */
  .m-menu-link:not(.m-menu-sub) { min-height: 56px; }
  .m-menu-foot { letter-spacing: 0.08em; text-wrap: balance; }
}

/* --------------------------------------------------------------------------
   Short landscape screens (phones on their side): keep the hero compact
   -------------------------------------------------------------------------- */
@media (max-width: 1023.98px) and (max-height: 500px), (max-width: 1279.98px) and (pointer: coarse) and (max-height: 500px) {
  :root { --m-sec-y: 56px; }
  .m-subhero { padding-top: 88px; padding-bottom: 32px; }
  .m-subhero > div { gap: 14px !important; }
  .m-h1 { font-size: clamp(30px, 10vh, 40px) !important; }
}

/* Touch screens: no sticky hover lifts/zooms after a tap */
@media (hover: none) and (max-width: 1023.98px), (hover: none) and (max-width: 1279.98px) and (pointer: coarse) {
  .pcard:hover { transform: none; }
  .pcard:hover .pimg { transform: none; }
  .pcard:hover .parrow { transform: none; }
}

/* --------------------------------------------------------------------------
   Wide touch tablets (iPad Pro 12.9/13 portrait, iPad Air / Pro 11 landscape: 1024-1279px)
   -------------------------------------------------------------------------- */
@media (min-width: 1024px) and (max-width: 1279.98px) and (pointer: coarse) {
  .m-cat .m-cat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; } /* the desktop's three product columns */
}
