/* App shell: install button, iOS Add-to-Home-Screen sheet, install strip
   and the mobile-first polish pass. Generated by
   scripts/unify-design-pwa.py; served with the immutable /_astro/ policy. */

/* ---- Installable app: header button (Chrome/Edge/Android) and the iOS
   Add-to-Home-Screen sheet. Both are hidden until the script decides the
   visitor can actually use them. */
.header-inner > .install-btn { margin-left: 10px; flex: 0 0 auto; }
.install-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line-2, #E2E6F0);
  border-radius: var(--r-full, 999px);
  background: var(--paper, #fff);
  color: var(--brand, #16256E);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
}
.header-inner > .install-btn {
  background: var(--brand, #16256E);
  border-color: var(--brand, #16256E);
  color: #fff;
}
.install-btn:hover { border-color: var(--gold-400, #DBB93F); }
.header-inner > .install-btn:hover { background: var(--navy-700, #1E2F73); }
.install-btn[hidden] { display: none; }
.install-hint {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  background: rgba(8, 13, 34, .55);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}
.install-hint[hidden] { display: none; }
.install-hint-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  color: var(--ink, #141A2B);
  border-radius: 18px;
  padding: 22px 20px calc(20px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 18px 50px rgba(8, 13, 34, .3);
}
.install-hint-card h2 { margin: 0 0 8px; font-size: 19px; }
.install-hint-card p { margin: 0 0 10px; font-size: 14.5px; line-height: 1.55; }
.install-steps { margin: 0 0 16px; padding-left: 18px; font-size: 14.5px; line-height: 1.6; }
.install-steps li { margin-bottom: 4px; }
.install-hint-close { width: 100%; min-height: 48px; }
@media (max-width: 900px) {
  /* Phones get the install strip above the footer; the header is already
     carrying the logo, the menu button and the sticky bar. */
  .header-inner > .install-btn { display: none; }
}

/* ---- Mobile polish. Small screens are the majority of this site's traffic,
   so the tap targets, footer type and busy hero get explicit rules instead
   of relying on desktop defaults shrinking gracefully. */
/* A .btn-row is a <p> in the posts, so a desktop grid never applied to it.
   Flex-wrap the pair so it reflows instead of overflowing a 320px screen. */
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }

@media (max-width: 640px) {
  /* iOS zooms the page when a focused field is under 16px. */
  input, select, textarea { font-size: max(16px, 1rem); }
  /* Footer: 11px was below the comfortable reading floor on a phone. */
  .site-footer { font-size: 13px; line-height: 1.6; }
  .site-footer .footer-grid { gap: 22px; }
  .site-footer h2 { font-size: 15px; margin-bottom: 8px; }
  /* Footer links are dense lists; give each one a 44px-tall tap area
     without changing how the list looks. */
  .site-footer ul li { padding: 0; }
  .site-footer ul li a { display: inline-block; padding: 7px 0; }
  /* Full-width buttons read better than a lone right-aligned pill. */
  /* The desktop .btn forbids wrapping, which forces a min-content width wider
     than a phone column and pushes the pill past the screen edge. Let mobile
     buttons wrap inside their column instead. */
  main .btn, main .btn-gold, main .btn-navy, main .btn-outline, main .btn-ghost {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    white-space: normal;
    text-wrap: balance;
    /* A full-width pill that still sits off-centre reads as a bug. */
    margin-left: 0;
    margin-right: 0;
    text-align: center;
  }
  /* Button rows: inherit the page's inline padding instead of keeping a
     desktop grid that pushes a 283px button 4px past a 320px screen. */
  .btn-row, .cta-row {
    display: grid;
    gap: 10px;
    margin-inline: 0;
    padding-inline: 0;
    width: 100%;
  }
  .btn-row > *, .cta-row > * { max-width: 100%; min-width: 0; }
  /* The hero's radial glow is a decorative wash that bleeds past its box on
     purpose; clip it so it cannot widen the page. The hero's own .wrap is a
     block child of a grid container, so it has to be told to shrink. */
  /* The glow and the marquee are absolutely/overflow clipped by their
     containers on desktop; on a phone their clips are what keep the page from
     widening, so set them explicitly. */
  .hx-hero, .hx-aura { max-width: 100vw; }
  .hx-ribbon, .hx-ribbon-track { contain: paint; }
  .hx-icon, .hx-sec { min-width: 0; }
  .hx-hero, .hx-sec { overflow-x: clip; }
  .hx-hero .wrap { min-width: 0; max-width: 100%; }
  .hx-hero-grid > * { min-width: 0; }

  /* Headings: keep the desktop scale from crowding a 320px screen. */
  h1 { font-size: clamp(1.75rem, 8.4vw, 2.5rem); line-height: 1.12; }
  h2 { font-size: clamp(1.35rem, 6vw, 1.85rem); line-height: 1.2; }
  /* The hero marquee is wider than the screen by design. It must be clipped
     by its own box and must not be able to widen the document. */
  .hx-ribbon { overflow: hidden; max-width: 100vw; contain: paint; }
  .hx-ribbon-track { max-width: none; }
  /* Breathing room at the very bottom so the sticky bar never covers text. */
  .site-footer { padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
  body:has(.sticky-cta) main { padding-bottom: 8px; }
}
/* Tables: the only way a data table fits a phone is its own scroll box.
   (The wrapper is added as CSS-friendly overflow on the table's parent where
   the markup already has one; this covers the plain <table> cases.) */
@media (max-width: 760px) {
  main table { display: block; width: 100%; max-width: 100%; overflow-x: auto; }
}

/* Inline links inside paragraphs stay inline visually, but on a touch screen
   they get a taller hit area so they can actually be tapped: padding vertical
   only, nothing horizontal, so the line does not shift. */
@media (max-width: 900px), (pointer: coarse) {
  /* Footer link lists are dense; every row is a tap target on touch. */
  .site-footer ul li a { display: inline-block; padding-block: 6px; }
  main p a:not(.btn):not(.btn-gold):not(.btn-navy):not(.btn-outline):not(.btn-ghost),
  main li a:not(.btn):not(.btn-gold):not(.btn-navy):not(.btn-outline):not(.btn-ghost),
  main .faq-a a, main .faq-a a:not(.btn) {
    display: inline-block;
    padding-block: 3px;
  }
  /* The footer's WhatsApp / email links sit in their own stacked column and
     were 21px tall on a phone. */
  .site-footer p a { display: inline-flex; align-items: center; min-height: 32px; }
  /* Review and "see the source" links are icon-sized chips on desktop. */
  /* Any link inside a caption is a "see the source" chip: give it height
     without changing the caption's look. */
  figcaption a, .cred-row a, .cred-row span { display: inline-flex; align-items: center; min-height: 30px; }
  .review-link, .src-link, .cred-link, a.tsrc { display: inline-flex; align-items: center; min-height: 32px; }
  .yt-open { display: inline-flex; align-items: center; min-height: 32px; padding-block: 6px; }
  .crumbs a, .breadcrumb a, nav[aria-label="Breadcrumb"] a { display: inline-block; padding-block: 6px; }
}

@media (max-width: 360px) {
  /* 320px phones: trim the gutters slightly rather than wrap words. */
  :root { --gutter: 16px; }
  main .btn, main .btn-gold, main .btn-navy { font-size: 14.5px; padding-inline: 12px; }
}

/* ---- Install awareness on touch devices. The header button is desktop
   only, so phones get a dismissible one-line prompt at the bottom of the
   page instead; it disappears once the app is installed or dismissed. */
.install-strip {
  display: none;
}
@media (max-width: 900px) {
  .install-strip:not([hidden]) {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 18px auto 0;
    max-width: 520px;
    padding: 10px 12px;
    border: 1px solid var(--line-2, #E2E6F0);
    border-radius: 14px;
    background: var(--paper-2, #F7F8FC);
    font-size: 13.5px;
    line-height: 1.4;
  }
  .install-strip p { margin: 0; flex: 1 1 auto; }
  .install-strip button {
    flex: 0 0 auto;
    min-height: 38px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid var(--brand, #16256E);
    background: var(--brand, #16256E);
    color: #fff;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
  }
  .install-strip .install-strip-close {
    background: transparent;
    border-color: var(--line-2, #E2E6F0);
    color: var(--ink-soft, #4A5470);
    padding: 0 10px;
  }
}

