html { overflow-x: hidden; }
body { overflow-x: hidden; -webkit-text-size-adjust: 100%; }
:root { --m-pad-x: 16px; --m-pad-y: 36px; --m-radius: 18px; }

/* Hide mobile-only elements on desktop */
.five-gates-mobile { display: none; }

/* ── Canvas / Diagram Toggle ── */
@media (max-width: 768px), (pointer: coarse) and (orientation: landscape) {
  #hero-canvas, #envelo-canvas, #security-canvas, #cat72-canvas, #process-canvas {
    display: none !important; height: 0 !important; overflow: hidden !important;
  }
  .m-diagram { display: block !important; }
}

/* ── Nav Collapse ── */
@media (max-width: 860px) {
  .nav-links { display: none; }
  .nav-toggle { display: block; }
  .nav-drawer { display: block; }
  .drawer-overlay { display: block; }
}

/* ── Grid Collapse Tablet ── */
@media (max-width: 980px) {
  .grid-2 { grid-template-columns: 1fr; }
  .mechanism { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════
   PORTRAIT (≤768px)
   ═══════════════════════════════════ */
@media (max-width: 768px) {
  * { max-width: 100%; }
  img, svg:not(.cert-seal), video, canvas { max-width: 100% !important; height: auto !important; }
  body { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
  main, .section, section { max-width: 100vw !important; overflow-x: hidden !important; }
  section, .section { padding: var(--m-pad-y) var(--m-pad-x) !important; }
  .hud-frame, .m-diagram { border-radius: var(--m-radius) !important; }
  .site-header { height: 56px; padding: 0 12px; }
  :root { --nav-height: 56px; }
  .brand-name { font-size: 10px !important; letter-spacing: 2px !important; }
  .nav-links { display: none !important; }
  .nav-badge { display: none !important; }
  [href="https://innovationfactory.ca"] { display: none !important; }
  h1, .hero-content-bottom h1 { font-size: clamp(24px, 6.5vw, 36px) !important; line-height: 1.15 !important; }
  h2, .section-title { font-size: clamp(22px, 5vw, 28px) !important; line-height: 1.2 !important; }
  h3 { font-size: 18px !important; }
  .section-lead { font-size: 14px !important; line-height: 1.6 !important; }
  .hero { min-height: auto !important; margin-top: var(--nav-height) !important; padding-top: 10px !important; padding-bottom: 18px !important; }
  .hero-content-bottom { padding: 0 14px !important; margin-top: 0 !important; }
  .hero-content-bottom p:not(.hero-disclaimer) { font-size: 13px !important; margin-bottom: 10px !important; }
  .hero-content-bottom .hero-disclaimer { font-size: 7px !important; }
  .hero-content-bottom a.btn, .hero-content-bottom a[style*="padding"] { width: 100% !important; max-width: 520px !important; justify-content: center !important; }
  .scroll-line, .scroll-indicator-desktop { display: none !important; }
  [style*="margin-top:-32px"], [style*="margin-top: -32px"], [style*="margin-top:-16px"], [style*="margin-top: -16px"] { margin-top: 0 !important; }
  .grid-2, .mechanism { grid-template-columns: 1fr !important; }
  [style*="grid-template-columns:1fr 1fr"], [style*="grid-template-columns: 1fr 1fr"] { grid-template-columns: 1fr !important; }
  [style*="grid-template-columns: repeat(3"], [style*="grid-template-columns: repeat(4"], [style*="grid-template-columns: repeat(5"], [style*="grid-template-columns:repeat(3"], [style*="grid-template-columns:repeat(4"], [style*="grid-template-columns:repeat(5"], [style*="grid-template-columns:repeat(auto-fit"] { grid-template-columns: 1fr !important; }
  .fee-grid, .verify-grid { grid-template-columns: 1fr 1fr !important; }
  [style*="grid-template-columns:1fr 120px"] { grid-template-columns: 1fr 100px !important; }

  /* Five Gates */
  .five-gates-grid { display: none !important; }
  .five-gates-mobile { display: grid !important; gap: 12px !important; max-width: 100% !important; }
  .five-gates-mobile .fg-card { border: 1px solid rgba(0,0,0,0.09); background: rgba(0,0,0,0.02); border-radius: 16px; padding: 14px; }
  .five-gates-mobile .fg-k { font-family: var(--mono); font-size: 10px; letter-spacing: 2px; text-transform: uppercase; color: rgba(74,61,117,0.75); margin-bottom: 6px; }
  .five-gates-mobile .fg-t { font-size: 15px; line-height: 1.2; margin-bottom: 6px; color: #111318; font-weight: 500; }
  .five-gates-mobile .fg-d { font-size: 13px; line-height: 1.55; color: rgba(15,18,30,0.75); }
  .five-gates-mobile .fg-card--active { border-color: rgba(22,135,62,0.45); background: rgba(22,135,62,0.04); }
  .five-gates-mobile .fg-card--active .fg-k { color: rgba(22,135,62,0.85); }

  [style*="min-width"]:not(input):not(button):not(canvas) { min-width: 0 !important; }
  [style*="max-width: 700px"], [style*="max-width: 800px"], [style*="max-width: 900px"] { max-width: 100% !important; }
  [style*="padding: 80px"], [style*="padding: 100px"], [style*="padding: 120px"] { padding: 32px 20px !important; }
  [style*="gap: 40px"], [style*="gap: 60px"], [style*="gap: 80px"] { gap: 20px !important; }
  canvas { max-width: 100% !important; touch-action: pan-y !important; }
  .hud-frame { padding: 16px !important; }
  .hud-desc { font-size: 12px !important; line-height: 1.65 !important; }
  .hud-title { font-size: 11px !important; }
  .hud-label { font-size: 9px !important; }
  .timeline-desktop { display: none !important; }
  .timeline-mobile { display: block !important; }
  svg:not([width="14"]):not([width="18"]):not([width="24"]):not([width="12"]) { max-width: 100% !important; height: auto !important; }
  .site-footer, footer { padding: 32px 20px !important; }
  footer [style*="display: grid"] { gap: 16px !important; }
  .nav-drawer a { padding: 14px 20px !important; min-height: 44px; display: flex; align-items: center; }
  .hud-row[style*="cursor:pointer"] { min-height: 44px; }
  [style*="font-size: 48px"], [style*="font-size: 52px"], [style*="font-size: 56px"] { font-size: 30px !important; }
  [style*="font-size: 36px"], [style*="font-size: 40px"] { font-size: 24px !important; }
  .m-diagram { width: 100%; max-width: 420px; margin: 8px auto 0; padding: 14px 10px; box-sizing: border-box; }
  .m-diagram * { max-width: 100%; }
}

/* ── Large Phone ── */
@media (max-width: 600px) {
  .hero-content-bottom h1 { font-size: clamp(22px, 6.5vw, 30px) !important; margin-bottom: 6px !important; }
  .hero-content-bottom p:not(.hero-disclaimer) { font-size: 12px !important; margin-bottom: 8px !important; }
  h1 { font-weight: normal; line-height: 1.0; }
  section, .section { padding: 28px var(--m-pad-x) !important; }
}

/* ── Phone ── */
@media (max-width: 480px) {
  .hero-content-bottom { padding: 0 12px !important; margin-top: 0 !important; }
  .hero-content-bottom h1 { font-size: clamp(20px, 5.5vw, 26px) !important; }
  .hero-content-bottom p:not(.hero-disclaimer) { font-size: 11px !important; }
  .section-title { font-size: 21px !important; }
  .section-lead { font-size: 13px !important; }
  .hud-frame { padding: 14px !important; }
  .hud-desc { font-size: 11px !important; line-height: 1.6 !important; }
  .five-gates-mobile { grid-template-columns: 1fr !important; }
  .fee-grid, .verify-grid { grid-template-columns: 1fr !important; }
  [style*="grid-template-columns:1fr 120px"] { grid-template-columns: 1fr 80px !important; }
}

/* ── Small Phone ── */
@media (max-width: 375px) {
  .hero-content-bottom h1 { font-size: 19px !important; }
  .section-title { font-size: 19px !important; }
  .hud-frame { padding: 12px !important; }
  .hud-desc { font-size: 10px !important; }
  section, .section { padding: 24px 12px !important; }
  .site-header { padding: 0 8px; }
  .brand-name { font-size: 9px !important; }
}

/* ═══════════════════════════════════
   LANDSCAPE (phone, coarse pointer)
   ═══════════════════════════════════ */
@media (pointer: coarse) and (orientation: landscape) {
  .site-header { height: 44px; padding: 0 12px; }
  :root { --nav-height: 44px; }
  .brand-name { font-size: 9px !important; }
  .nav-links { display: none !important; }
  .nav-badge { display: none !important; }
  .hero { min-height: auto !important; margin-top: var(--nav-height) !important; padding: 4px 20px 8px !important; }
  .hero-content-bottom { margin-top: 0 !important; }
  .hero-content-bottom h1 { font-size: clamp(15px, 3.2vw, 22px) !important; line-height: 1.1 !important; }
  .hero-content-bottom p:not(.hero-disclaimer) { font-size: 10px !important; }
  .hero-content-bottom .hero-disclaimer { display: none !important; }
  .scroll-line, .scroll-indicator-desktop { display: none !important; }
  section, .section { padding: 16px 20px !important; }
  .section-title { font-size: 18px !important; }
  .section-lead { font-size: 11px !important; }
  .hud-frame { padding: 8px !important; }
  .hud-desc { font-size: 9px !important; line-height: 1.4 !important; }
  .hud-title { font-size: 9px !important; }
  .hud-label { font-size: 8px !important; }
  [style*="grid-template-columns:1fr 1fr"], [style*="grid-template-columns: 1fr 1fr"] { grid-template-columns: 1fr 1fr !important; }
  [style*="grid-template-columns:repeat(auto-fit"] { grid-template-columns: repeat(2, 1fr) !important; }

  /* Five Gates — 3-col, same card styling as portrait */
  .five-gates-grid { display: none !important; }
  .five-gates-mobile { display: grid !important; grid-template-columns: repeat(3, 1fr) !important; gap: 8px !important; }
  .five-gates-mobile .fg-card { border: 1px solid rgba(0,0,0,0.09); background: rgba(0,0,0,0.02); border-radius: 16px; padding: 10px; }
  .five-gates-mobile .fg-k { font-family: var(--mono); font-size: 10px; letter-spacing: 2px; text-transform: uppercase; color: rgba(74,61,117,0.75); margin-bottom: 4px; }
  .five-gates-mobile .fg-t { font-size: 13px; line-height: 1.2; margin-bottom: 4px; color: #111318; font-weight: 500; }
  .five-gates-mobile .fg-d { font-size: 11px; line-height: 1.5; color: rgba(15,18,30,0.75); }
  .five-gates-mobile .fg-card--active { border-color: rgba(22,135,62,0.45); background: rgba(22,135,62,0.04); }
  .five-gates-mobile .fg-card--active .fg-k { color: rgba(22,135,62,0.85); }

  canvas { max-width: 100% !important; touch-action: pan-y !important; }
  .m-diagram { padding: 8px 16px; max-width: 600px; margin: 0 auto; box-sizing: border-box; }
  .m-diagram * { max-width: 100%; }
  .m-diagram .h-orb { width: 46px !important; height: 46px !important; }
  .m-diagram .h-orb-xl { width: 56px !important; height: 56px !important; }
  .m-diagram .h-conn { width: 24px !important; margin-bottom: 22px !important; }
  .m-diagram .h-v { padding: 5px 10px !important; font-size: 7px !important; }
  .m-diagram .h-name { font-size: 8px !important; }
  .m-diagram .c-wall { width: 170px !important; height: 170px !important; }
  .m-diagram .c-mrc { width: 136px !important; height: 136px !important; }
  .m-diagram .c-warn { width: 102px !important; height: 102px !important; }
  .m-diagram .c-odd { width: 68px !important; height: 68px !important; }
  .m-diagram .p-step { min-height: 40px !important; }
  .m-diagram .p-marker { width: 26px !important; height: 26px !important; font-size: 8px !important; }
  .m-diagram .p-title { font-size: 9px !important; }
  .m-diagram .p-desc { font-size: 7.5px !important; }
  .m-diagram .e-icon svg { width: 18px !important; height: 18px !important; }
  .m-diagram .e-nm { font-size: 8px !important; }
  .m-diagram .e-ds { font-size: 7px !important; }
  .m-diagram .e-body { padding: 6px 10px !important; font-size: 7.5px !important; }
}

/* ── Very Short Landscape ── */
@media (max-height: 400px) and (orientation: landscape) {
  .hero { padding: 2px 16px 4px !important; }
  .hero-content-bottom h1 { font-size: 14px !important; }
  section, .section { padding: 12px 16px !important; }
  .section-title { font-size: 16px !important; }
}

/* ── Touch Devices ── */
@media (hover: none) and (pointer: coarse) {
  .nav-drawer a, .hud-row[style*="cursor"], button, [role="button"] { min-height: 44px; }
  .hud-frame:hover, .hud-row:hover { transform: none !important; }
  canvas { touch-action: pan-y !important; }
}

/* ── Print ── */
@media print {
  canvas { display: none !important; }
  .site-header, .nav-drawer, .drawer-overlay, .grid-overlay { display: none !important; }
  section { page-break-inside: avoid; padding: 20px 0 !important; background: white !important; }
  body { background: white !important; color: black !important; }
}

/* ═══════════════════════════════════════════════════
   MOBILE DIAGRAM COMPONENTS (md-*)
   ═══════════════════════════════════════════════════ */
@media (max-width: 768px), (pointer: coarse) and (orientation: landscape) {

  /* ── Shared tag row ── */
  .md-tag-row { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
  .md-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
  .md-dot-p { background: rgba(74,61,117,1); }
  .md-dot-g { background: rgba(22,135,62,1); }
  .md-tag { font-family: var(--mono); font-size: 9px; letter-spacing: 2px; color: rgba(15,18,30,0.5); text-transform: uppercase; }
  .md-foot { font-family: var(--mono); font-size: 9px; letter-spacing: 1.5px; color: rgba(15,18,30,0.4); text-align: center; margin-top: 16px; padding-top: 12px; border-top: 1px solid rgba(0,0,0,0.06); }

  /* ── ENVELO flow ── */
  .md-flow { display: flex; align-items: center; justify-content: space-between; gap: 4px; margin-bottom: 16px; }
  .md-node { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 1; }
  .md-node-icon { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
  .md-icon-green { background: rgba(22,135,62,0.08); border: 1px solid rgba(22,135,62,0.3); }
  .md-icon-purple { background: rgba(74,61,117,0.12); border: 1px solid rgba(74,61,117,0.4); }
  .md-icon-dim { background: rgba(0,0,0,0.04); border: 1px solid rgba(0,0,0,0.15); }
  .md-node-core .md-node-icon { width: 48px; height: 48px; }
  .md-node-label { font-family: var(--mono); font-size: 9px; letter-spacing: 1.5px; color: rgba(15,18,30,0.8); text-transform: uppercase; }
  .md-node-sub { font-size: 10px; color: rgba(15,18,30,0.5); }
  .md-arrow { font-size: 16px; color: rgba(0,0,0,0.2); flex-shrink: 0; }

  /* ── ENVELO tiers ── */
  .md-tiers { display: flex; flex-direction: column; gap: 6px; }
  .md-tier { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: 10px; }
  .md-tier-g { background: rgba(22,135,62,0.06); }
  .md-tier-a { background: rgba(205,130,15,0.06); }
  .md-tier-r { background: rgba(210,45,45,0.06); }
  .md-tier-bar { width: 3px; border-radius: 2px; flex-shrink: 0; align-self: stretch; min-height: 18px; }
  .md-tier-g .md-tier-bar { background: rgba(22,135,62,0.7); }
  .md-tier-a .md-tier-bar { background: rgba(205,130,15,0.7); }
  .md-tier-r .md-tier-bar { background: rgba(210,45,45,0.7); }
  .md-tier-body { font-size: 12px; color: rgba(15,18,30,0.75); line-height: 1.45; }
  .md-tier-label { font-family: var(--mono); font-size: 9px; letter-spacing: 1.5px; font-weight: 600; margin-right: 6px; }
  .md-tier-g .md-tier-label { color: rgba(22,135,62,1); }
  .md-tier-a .md-tier-label { color: rgba(205,130,15,1); }
  .md-tier-r .md-tier-label { color: rgba(210,45,45,1); }

  /* ── Security flow ── */
  .md-sec-flow { display: flex; align-items: center; justify-content: space-between; gap: 4px; margin-bottom: 16px; }
  .md-sec-node { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: 1; }
  .md-sec-node-center { flex: 1.2; }
  .md-sec-orb { border-radius: 50%; border: 1.5px solid; }
  .md-sec-orb-g { width: 36px; height: 36px; background: rgba(22,135,62,0.1); border-color: rgba(22,135,62,0.5); }
  .md-sec-orb-p { background: rgba(74,61,117,0.12); border-color: rgba(74,61,117,0.6); }
  .md-sec-orb-w { width: 36px; height: 36px; background: rgba(0,0,0,0.04); border-color: rgba(0,0,0,0.2); }
  .md-sec-orb-xl { width: 48px; height: 48px; }
  .md-sec-name { font-family: var(--mono); font-size: 9px; letter-spacing: 1.5px; color: rgba(15,18,30,0.8); }
  .md-sec-sub { font-size: 9px; color: rgba(74,61,117,0.7); font-family: var(--mono); }
  .md-sec-conn { display: flex; flex-direction: column; align-items: center; gap: 2px; }
  .md-sec-badge { font-family: var(--mono); font-size: 7px; letter-spacing: 1px; color: rgba(15,18,30,0.4); }
  .md-sec-arrow { font-size: 14px; color: rgba(0,0,0,0.2); }
  .md-sec-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  .md-sec-item { font-family: var(--mono); font-size: 10px; letter-spacing: 1px; padding: 8px 10px; border-radius: 8px; }
  .md-deny { background: rgba(210,45,45,0.06); color: rgba(180,52,52,0.9); border: 1px solid rgba(210,45,45,0.15); }
  .md-allow { background: rgba(22,135,62,0.06); color: rgba(22,135,62,0.9); border: 1px solid rgba(22,135,62,0.15); }
  .md-sec-divider { height: 1px; background: rgba(0,0,0,0.06); margin: 10px 0; }
}

/* ═══════════════════════════════════════════════════
   POLISH — elevation, unified accent, tap feedback
   ═══════════════════════════════════════════════════ */
@media (max-width: 768px), (pointer: coarse) and (orientation: landscape) {

  /* Breathing room + elevation */
  .m-diagram { margin-top: 16px; box-shadow: 0 4px 20px rgba(0,0,0,0.04); }
  .md-tier { border-radius: 14px; }
  .md-sec-item { border-radius: 10px; }

  /* Five Gates unified accent tint */
  .five-gates-mobile .fg-card {
    background: rgba(74,61,117,0.03);
    border: 1px solid rgba(74,61,117,0.08);
    box-shadow: 0 4px 20px rgba(0,0,0,0.04);
  }
  .five-gates-mobile .fg-card--active {
    background: rgba(22,135,62,0.05);
    border-color: rgba(22,135,62,0.2);
  }

  /* Tap feedback */
  .fg-card:active, .md-tier:active {
    transform: scale(0.995);
    transition: transform 0.08s ease;
  }
}

/* ── CAT-72 diagram ── */
@media (max-width: 768px), (pointer: coarse) and (orientation: landscape) {
  .c72-bar-wrap { margin-bottom: 16px; }
  .c72-bar-label { display: flex; align-items: baseline; gap: 6px; margin-bottom: 8px; }
  .c72-bar-num { font-family: var(--mono); font-size: 28px; font-weight: 600; color: rgba(74,61,117,1); line-height: 1; }
  .c72-bar-unit { font-family: var(--mono); font-size: 9px; letter-spacing: 2px; color: rgba(15,18,30,0.45); }
  .c72-track { display: flex; height: 28px; border-radius: 8px; overflow: hidden; gap: 2px; }
  .c72-fill { display: flex; align-items: center; justify-content: center; border-radius: 6px; transition: width 0.3s ease; }
  .c72-fill-g { background: rgba(22,135,62,0.18); border: 1px solid rgba(22,135,62,0.3); }
  .c72-fill-a { background: rgba(205,130,15,0.15); border: 1px solid rgba(205,130,15,0.3); }
  .c72-fill-p { background: rgba(74,61,117,0.15); border: 1px solid rgba(74,61,117,0.3); }
  .c72-fill-label { font-family: var(--mono); font-size: 7px; letter-spacing: 1px; color: rgba(15,18,30,0.6); white-space: nowrap; overflow: hidden; }
  .c72-track-labels { display: flex; justify-content: space-between; margin-top: 4px; font-family: var(--mono); font-size: 8px; color: rgba(15,18,30,0.35); }
  .c72-phases { display: flex; flex-direction: column; gap: 8px; }
  .c72-phase { display: flex; align-items: flex-start; gap: 10px; }
  .c72-phase-marker { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 10px; font-weight: 600; flex-shrink: 0; }
  .c72-marker-g { background: rgba(22,135,62,0.12); border: 1px solid rgba(22,135,62,0.4); color: rgba(22,135,62,1); }
  .c72-marker-a { background: rgba(205,130,15,0.1); border: 1px solid rgba(205,130,15,0.4); color: rgba(205,130,15,1); }
  .c72-marker-p { background: rgba(74,61,117,0.1); border: 1px solid rgba(74,61,117,0.4); color: rgba(74,61,117,1); }
  .c72-phase-body { padding-top: 4px; }
  .c72-phase-title { font-family: var(--mono); font-size: 9px; letter-spacing: 1.5px; color: rgba(15,18,30,0.8); margin-bottom: 3px; }
  .c72-phase-desc { font-size: 11px; color: rgba(15,18,30,0.6); line-height: 1.45; }
}

/* Hero cert card - responsive on mobile */
@media (max-width: 768px) {
  .cert-card-main { 
    padding: 16px !important; 
    font-size: 10px !important;
    margin-top: 16px !important;
  }
  .hero > div { 
    flex-direction: column !important; 
    padding: 0 16px 32px !important; 
    gap: 24px !important;
  }
}

/* Privacy bar - stack on mobile */
@media (max-width: 600px) {
  #privacy-bar {
    flex-direction: column !important;
    gap: 10px !important;
    padding: 12px 16px !important;
    font-size: 12px !important;
    text-align: center !important;
  }
  #privacy-bar button {
    width: 100% !important;
    padding: 10px 16px !important;
  }
}

/* Hero cert card - scale for mobile portrait */
@media (max-width: 768px) {
  .cert-card-main { 
    padding: 14px !important; 
    margin: 16px 0 0 0 !important;
    max-width: 100% !important;
    transform: scale(0.85) !important;
    transform-origin: top center !important;
  }
  .cert-card-main * {
    font-size: 90% !important;
  }
  .hero > div { 
    flex-direction: column !important; 
    padding: 0 16px 32px !important; 
    gap: 12px !important;
    align-items: center !important;
  }
}
@media (max-width: 480px) {
  .cert-card-main {
    transform: scale(0.75) !important;
    margin-bottom: -40px !important;
  }
}
@media (max-width: 375px) {
  .cert-card-main {
    transform: scale(0.65) !important;
    margin-bottom: -60px !important;
  }
}

/* Privacy bar - iOS safe area + stack */
@media (max-width: 600px) {
  #privacy-bar {
    flex-direction: column !important;
    gap: 10px !important;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom)) !important;
    font-size: 12px !important;
    text-align: center !important;
  }
  #privacy-bar button {
    width: 100% !important;
    padding: 10px 16px !important;
  }
}

/* ── Hero Mobile Layout ── */
@media (max-width: 768px) {
  .hero { padding-bottom: 0 !important; }
  .hero > div {
    flex-direction: column !important;
    padding: 16px 16px 24px !important;
    gap: 20px !important;
    align-items: stretch !important;
  }
  .hero > div > div:first-child {
    max-width: 100% !important;
    padding-top: 8px !important;
  }
  .cert-scene {
    min-width: 0 !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-top: 0 !important;
  }
  .cert-card-main {
    padding: 20px 16px !important;
    max-width: 100% !important;
  }
  .cert-card-main [style*="grid-template-columns:1fr 1fr 1fr"] {
    grid-template-columns: 1fr 1fr 1fr !important;
    gap: 6px !important;
  }
  .cert-card-main [style*="font-size:20px"] { font-size: 16px !important; }
  .cert-card-main [style*="font-size:15px"] { font-size: 12px !important; }
  .cert-card-main [style*="font-size:13px"] { font-size: 11px !important; }
}

/* ── Applicant Portal in hamburger ── */
.nav-drawer a[href="https://app.sentinelauthority.org"] {
  border-top: 1px solid rgba(15,18,30,0.08);
  margin-top: 8px;
  padding-top: 20px !important;
  font-weight: 600;
}

/* ── Privacy bar iOS safe area ── */
#privacy-bar {
  padding-bottom: calc(14px + env(safe-area-inset-bottom)) !important;
}
@media (max-width: 600px) {
  #privacy-bar {
    flex-direction: column !important;
    gap: 10px !important;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom)) !important;
    font-size: 12px !important;
    text-align: center !important;
  }
  #privacy-bar button {
    width: 100% !important;
    padding: 10px 16px !important;
  }
}

/* Hide desktop Applicant Portal button on mobile */
@media (max-width: 860px) {
  .nav-signin { display: none !important; }
}

/* Landscape hero + cert card */
@media (pointer: coarse) and (orientation: landscape) {
  .cert-scene {
    min-width: 0 !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-top: 0 !important;
  }
  .hero > div {
    gap: 20px !important;
    padding: 8px 20px 16px !important;
  }
  .cert-card-main {
    padding: 14px !important;
  }
}

/* Fix hero cert card on portrait */
@media (max-width: 768px) {
  /* Prevent cert card SVGs from blowing up */
  .cert-card-main svg {
    max-width: none !important;
    width: 28px !important;
    height: 28px !important;
  }
  /* Keep 3-col grid for dates */
  .cert-card-main [style*="grid-template-columns:1fr 1fr 1fr"] {
    grid-template-columns: 1fr 1fr 1fr !important;
  }
  /* Kill whitespace under card */
  .cert-scene {
    padding-top: 0 !important;
    margin-bottom: -20px !important;
  }
  .hero .reveal,
  .hero .reveal + div {
    display: none !important;
  }
}

/* ── Hero cert card fixes ── */
@media (max-width: 768px) {
  /* SA seal SVG - override global svg rule */
  svg.cert-seal {
    max-width: 28px !important;
    width: 28px !important;
    height: 28px !important;
    flex-shrink: 0 !important;
  }
  /* Force 3-col grid to stay */
  .cert-card-main > div[style*="grid-template-columns"] {
    display: grid !important;
    grid-template-columns: 1fr 1fr 1fr !important;
    gap: 6px !important;
  }
  /* Kill all the whitespace below hero */
  .hero {
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
  }
  .hero > div {
    padding-bottom: 16px !important;
  }
  .hero > .reveal {
    display: none !important;
    padding: 0 !important;
    margin: 0 !important;
    height: 0 !important;
  }
  /* Title above the card */
  .hero h1 {
    margin-bottom: 16px !important;
  }
  .hero [style*="width:72px"] {
    margin-bottom: 16px !important;
  }
}

/* Landscape nav fix */
@media (pointer: coarse) and (orientation: landscape) {
  .site-header {
    height: 52px !important;
    padding: 0 16px !important;
  }
  .site-header .nav-inner {
    height: 52px !important;
  }
  .brand svg {
    height: 42px !important;
  }
  .nav-toggle {
    padding: 6px !important;
  }
}/* Portrait nav logo */
@media (max-width: 768px) and (orientation: portrait) {
  .brand svg {
    height: 32px !important;
  }
}

/* Brand logo sizing */
.brand-logo {
  height: 48px;
  width: auto;
}
@media (max-width: 768px) and (orientation: portrait) {
  .brand-logo {
    height: 32px !important;
    width: auto !important;
  }
}

/* Portrait logo - nuclear override */
@media (max-width: 768px) and (orientation: portrait) {
  .site-header .nav-inner .brand svg,
  .site-header .nav-inner a.brand svg,
  a.brand svg[viewBox] {
    width: 160px !important;
    height: 32px !important;
  }
}
