/* ===== PRODUCT PORTFOLIO CARDS (GLOBAL) ===== */
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.portfolio-card {
    background: var(--glass-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    text-decoration: none !important;
    color: var(--text-1) !important;
    display: flex;
    flex-direction: column;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    /* Ensure content stacks properly with mix-blend modes */
    isolation: isolate; 
}
.portfolio-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--glass-shadow-hover);
    border-color: var(--accent-primary-glow);
    color: var(--text-1) !important;
}
.portfolio-card:visited,
.portfolio-card:active,
.portfolio-card:focus {
    color: var(--text-1) !important;
    text-decoration: none !important;
}
/* Force all child text within portfolio cards to follow theme, not link color */
.portfolio-card .card-title {
    color: var(--text-1) !important;
}
.portfolio-card .card-content p {
    color: var(--text-2) !important;
}
.portfolio-card .card-footer-metrics,
.portfolio-card .card-footer-metrics div,
.portfolio-card .card-footer-metrics i {
    color: var(--text-3) !important;
}

.card-img-wrap {
    height: 220px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.05);
    transition: background 0.4s ease;
}

/* Dark mode bg - matching industry pages' white radial approach */
[data-theme="dark"] .card-img-wrap,
:root:not([data-theme="light"]) .card-img-wrap {
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.95) 0%, rgba(220, 225, 240, 0.8) 100%);
}

/* Neutral light bg for all product images in light mode */
[data-theme="light"] .card-img-wrap {
    background: linear-gradient(145deg, #f0f2f5 0%, #e8eaef 50%, #f0f2f5 100%);
}

.card-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 1rem;
    transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
    position: relative;
    z-index: 1;
}
.portfolio-card:hover .card-img-wrap img {
    transform: scale(1.08);
}

/* On hover - title brightens */
.portfolio-card:hover .card-title {
    color: #ffffff !important;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.15);
}
[data-theme="light"] .portfolio-card:hover .card-title {
    color: #0a0a0a !important;
    text-shadow: none;
}

/* On hover - badge pill gets a subtle glow */
.portfolio-card:hover .card-badge {
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.25);
}
.card-img-wrap::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(180deg, transparent 0%, var(--bg-1) 100%);
    z-index: 2;
    pointer-events: none;
}

.card-badge {
    position: absolute;
    top: 0.8rem;
    left: 0.8rem;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    background: rgba(10, 15, 26, 0.75);
    border: 1px solid rgba(255,255,255,0.15);
    color: #fff;
    font-family: var(--font-mono);
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.3rem 0.65rem;
    border-radius: 16px;
    z-index: 3;
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

/* Light mode: white frosted glass with dark text */
[data-theme="light"] .card-badge {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(0, 0, 0, 0.08);
    color: #1a1a2e;
}

/* Industry accent tint - subtle border-left color */
.card-badge.automotive { border-left: 2px solid rgba(167, 139, 250, 0.8); }
.card-badge.off-highway { border-left: 2px solid rgba(245, 158, 11, 0.8); }
.card-badge.consumer,
.card-badge.consumer-electronics { border-left: 2px solid rgba(250, 204, 21, 0.8); }
.card-badge.appliances,
.card-badge.home-appliances { border-left: 2px solid rgba(236, 72, 153, 0.8); }
.card-badge.medical-devices { border-left: 2px solid rgba(251, 113, 133, 0.8); }
.card-badge.industrial-equipment { border-left: 2px solid rgba(34, 211, 238, 0.8); }

.card-content {
    padding: 1.2rem 1.5rem 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}
.card-title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-1);
    margin-bottom: 0.5rem;
    line-height: 1.3;
    transition: color 0.3s ease, text-shadow 0.3s ease;
}
.card-content p {
    color: var(--text-2);
    font-size: 0.85rem;
    line-height: 1.6;
    flex-grow: 1;
    margin: 0 0 1rem 0;
}
.card-footer-metrics {
    display: flex;
    gap: 1rem;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--text-3);
    text-transform: uppercase;
    flex-wrap: wrap;
}
.card-footer-metrics i { color: var(--text-3); margin-right: 4px; }

.card-open-icon {
    position: absolute;
    top: 0.8rem;
    right: 0.8rem;
    width: 28px;
    height: 28px;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(8px);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.5);
    font-size: 0.65rem;
    z-index: 3;
    opacity: 0;
    transform: translateY(4px);
    transition: all 0.3s ease;
}
.portfolio-card:hover .card-open-icon {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 1024px) {
    .portfolio-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
    .portfolio-grid { grid-template-columns: 1fr; }
}


/* Mobile Swipeable Grids */
@media (max-width: 768px) {
    .portfolio-grid#dynamic-product-studies-container,
    .portfolio-grid#dynamic-case-studies-container {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        padding-bottom: 1.5rem;
        gap: 1.2rem;
        -webkit-overflow-scrolling: touch;
    }
    .dynamic-ps-card, .dynamic-cs-card {
        flex: 0 0 85%;
        scroll-snap-align: center;
    }
}


/* Guarantee Case Study Card Image Colors */
.cs-card-img {
    color: #ffffff !important;
}
.cs-card-img * {
    color: #ffffff !important;
}
.cs-card-badges {
    color: #ffffff !important;
}

/* =========================================================================
   MOBILE FOOTER - Dedicated Styles
   ========================================================================= */
.mobile-footer .footer-container {
  padding: 0 1.25rem;
}

.mobile-footer .footer-divider {
  margin-bottom: 2rem;
}

/* ── Brand Section ── */
.mf-brand {
  text-align: center;
  margin-bottom: 1.5rem;
}

.mobile-footer .footer-brand-logo {
  justify-content: center;
  margin-bottom: 1rem;
}

.mobile-footer .footer-brand-logo img {
  height: 36px !important;
}

.mf-tagline {
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--footer-text);
  max-width: 340px;
  margin: 0 auto 1.2rem;
  opacity: 0.8;
}

.mobile-footer .footer-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.6rem;
  border-radius: 100px;
  background: var(--accent-primary);
  color: #000 !important;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.3s ease;
}

.mobile-footer .footer-cta:active {
  transform: scale(0.96);
}

/* ── Contact Bar ── */
.mf-contact-bar {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.mf-contact-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
  background: var(--footer-surface);
  border: 1px solid var(--footer-border);
  font-size: 0.8rem;
  color: var(--footer-text);
  text-decoration: none;
  transition: all 0.2s ease;
}

.mf-contact-item i:first-child {
  font-size: 0.85rem;
  color: var(--accent-primary);
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.mf-contact-item .copy-btn {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--footer-muted);
  padding: 0.3rem;
  cursor: pointer;
  font-size: 0.8rem;
  border-radius: 6px;
  transition: all 0.2s;
}

.mf-contact-item .copy-btn:active {
  color: var(--accent-primary);
  transform: scale(0.9);
}

.mf-linkedin {
  color: var(--footer-text) !important;
}

.mf-follow-tag {
  margin-left: auto;
  font-size: 0.7rem;
  font-weight: 600;
  color: #0A66C2;
  background: rgba(10, 102, 194, 0.1);
  padding: 0.2rem 0.5rem;
  border-radius: 100px;
  letter-spacing: 0.03em;
}

/* ── Links Grid ── */
.mf-links-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.mf-link-group h4 {
  font-family: var(--font-heading, 'Outfit', sans-serif);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--footer-heading);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.6rem;
}

.mf-link-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.mf-link-list a {
  font-size: 0.78rem;
  color: var(--footer-text);
  text-decoration: none;
  padding: 0.15rem 0;
  transition: color 0.2s;
  display: block;
}

.mf-link-list a:active {
  color: var(--accent-primary);
}

/* ── TSCC Strip ── */
.mf-tscc {
  margin-bottom: 1rem;
  padding: 1rem 1rem;
  border-radius: 12px;
  background: rgba(10, 102, 194, 0.04);
  border: 1px solid rgba(10, 102, 194, 0.12);
}

.mf-tscc-top {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}

.mf-tscc-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.15);
}

.mf-tscc h5 {
  font-family: var(--font-heading, 'Outfit', sans-serif);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--footer-heading);
  margin-bottom: 0.15rem;
}

.mf-tscc p {
  font-size: 0.72rem;
  color: var(--footer-muted);
  line-height: 1.4;
}

.mf-tscc .tscc-join-btn {
  width: 100%;
  justify-content: center;
  padding: 0.55rem 1rem;
  font-size: 0.78rem;
  border-radius: 8px;
}

/* ── Address ── */
.mf-address {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
  background: var(--footer-surface);
  border: 1px solid var(--footer-border);
  text-decoration: none;
  margin-bottom: 1.5rem;
  transition: border-color 0.2s;
}

.mf-address > i:first-child {
  font-size: 0.8rem;
  color: var(--accent-primary);
  margin-top: 0.15rem;
  flex-shrink: 0;
}

.mf-addr-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--footer-text);
  letter-spacing: 0.03em;
}

.mf-addr-text {
  display: block;
  font-size: 0.72rem;
  color: var(--footer-muted);
  line-height: 1.4;
  margin-top: 0.1rem;
}

.mf-addr-arrow {
  margin-left: auto;
  font-size: 0.65rem;
  color: var(--footer-muted);
  margin-top: 0.3rem;
  flex-shrink: 0;
}

/* ── Bottom Bar ── */
.mf-bottom {
  border-top: 1px solid var(--footer-border);
  padding: 1.2rem 0 1.5rem;
  text-align: center;
}

.mf-legal-links {
  display: flex;
  justify-content: center;
  gap: 1.2rem;
  margin-bottom: 0.6rem;
}

.mf-legal-links a {
  font-size: 0.7rem;
  color: var(--footer-muted);
  text-decoration: none;
}

.mf-legal-links a:active {
  color: var(--footer-text);
}

.mf-copyright {
  font-size: 0.68rem;
  color: var(--footer-muted);
  opacity: 0.7;
}

.mf-cin {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.6rem;
  opacity: 0.5;
}

/* Light mode tweaks */
html[data-theme="light"] .mf-tscc {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.06);
}

html[data-theme="light"] .mobile-footer .footer-cta {
  color: #fff !important;
}

/* =========================================================================
   COOKIE CONSENT BANNER
   Compact bottom-right card - doesn't obscure hero content.
   ========================================================================= */
.asi-cookie-banner {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 99999;
  pointer-events: none;
  opacity: 0;
  transform: translateY(20px) scale(0.96);
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.asi-cookie-banner.asi-cookie-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.asi-cookie-banner.asi-cookie-dismissed {
  opacity: 0;
  transform: translateY(12px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.asi-cookie-inner {
  width: 320px;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 1.15rem 1.25rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.1),
              0 2px 6px rgba(0, 0, 0, 0.04),
              inset 0 1px 0 rgba(255, 255, 255, 0.95);
  transition: background 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
}

/* Dark mode - true glassmorphism */
[data-theme="dark"] .asi-cookie-inner,
.asi-cookie-dark .asi-cookie-inner {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4),
              0 2px 6px rgba(0, 0, 0, 0.2),
              inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(32px) saturate(150%);
  -webkit-backdrop-filter: blur(32px) saturate(150%);
}

.asi-cookie-headline {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.asi-cookie-shield {
  flex-shrink: 0;
  color: var(--accent-primary);
  opacity: 0.65;
  transition: color 0.4s ease;
}

[data-theme="dark"] .asi-cookie-shield,
.asi-cookie-dark .asi-cookie-shield {
  color: #38bdf8;
}

.asi-cookie-title {
  font-family: var(--font-headline);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1.3;
  transition: color 0.4s ease;
}

.asi-cookie-dark .asi-cookie-title {
  color: #ffffff;
}

.asi-cookie-desc {
  font-size: 0.72rem;
  line-height: 1.5;
  color: var(--text-muted);
  max-width: none;
  margin: 0;
  transition: color 0.4s ease;
}

.asi-cookie-dark .asi-cookie-desc {
  color: rgba(255, 255, 255, 0.5);
}

.asi-cookie-actions {
  display: flex;
  gap: 0.45rem;
}

.asi-cookie-btn {
  flex: 1;
  font-family: var(--font-sans);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.45rem 0.8rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  white-space: nowrap;
  text-align: center;
  letter-spacing: 0.01em;
}

.asi-cookie-reject {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
}

[data-theme="dark"] .asi-cookie-reject,
.asi-cookie-dark .asi-cookie-reject {
  border-color: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.04);
}

.asi-cookie-reject:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text-body);
  border-color: rgba(0, 0, 0, 0.12);
}

[data-theme="dark"] .asi-cookie-reject:hover,
.asi-cookie-dark .asi-cookie-reject:hover {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.7);
  border-color: rgba(255, 255, 255, 0.18);
}

.asi-cookie-accept {
  background: #1d6ec0;
  color: #ffffff;
  transition: all 0.3s ease;
}

.asi-cookie-dark .asi-cookie-accept {
  background: #38bdf8;
  color: #000;
}

.asi-cookie-accept:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
  box-shadow: 0 3px 12px var(--accent-primary-glow);
}

.asi-cookie-dark .asi-cookie-accept:hover {
  box-shadow: 0 3px 16px rgba(56, 189, 248, 0.35);
}

/* ── Mobile: Slightly narrower, edge-to-edge at bottom ── */
@media (max-width: 480px) {
  .asi-cookie-banner {
    bottom: 0.75rem;
    right: 0.75rem;
    left: 0.75rem;
  }

  .asi-cookie-inner {
    width: auto;
  }
}

/* =========================================================================
   APPLE / MAC OPTIMIZATION LAYER
   Targeted enhancements for Retina displays, OLED panels, Safari,
   and the Apple ecosystem. All blocks use progressive enhancement -
   they are invisible on non-Apple hardware.
   ========================================================================= */

/* ── Display P3 Wide-Gamut Colors ──
   Apple displays since 2016 support 25% more color range than sRGB.
   These subtle 5-10% enhancements add a "pop" on MacBook Pro, iMac,
   iPad Pro, and iPhone screens. Graceful fallback on sRGB monitors. */
@supports (color: color(display-p3 0 0 1)) {
  :root {
    --accent-blue-p3: color(display-p3 0.24 0.53 0.97);
    --accent-cyan-p3: color(display-p3 0.04 0.73 0.85);
  }

  [data-theme="dark"] {
    --accent-primary: color(display-p3 0.24 0.76 0.98);
    --accent-gradient: linear-gradient(
      135deg,
      color(display-p3 0.24 0.76 0.98) 0%,
      color(display-p3 0.06 0.66 0.93) 100%
    );
    --accent-gradient-vivid: linear-gradient(
      135deg,
      color(display-p3 0.06 0.66 0.93) 0%,
      color(display-p3 0.22 0.84 0.62) 100%
    );
  }

  .gradient-text {
    background: linear-gradient(
      135deg,
      color(display-p3 0.24 0.53 0.97) 0%,
      color(display-p3 0.04 0.73 0.85) 100%
    );
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
  }
}

/* ── OLED True Black (HDR Panels) ──
   On MacBook Pro, iPhone, and iPad Pro OLED/XDR screens, #000000
   pixels are physically turned OFF - infinite contrast and zero
   power draw. Fix leaks where glass-bg-strong was rgba(0,0,0,0.95). */
@media (dynamic-range: high) {
  [data-theme="dark"] {
    --glass-bg-strong: #000000;
  }

  [data-theme="dark"] body {
    background: #000000;
  }
}

/* ── Safe Area Insets (iPhone Notch / Dynamic Island) ──
   With viewport-fit=cover, content extends behind the notch.
   These insets ensure interactive elements stay clear. */
@supports (padding: env(safe-area-inset-top)) {
  .vault-nav .nav-inner {
    padding-left: max(4rem, env(safe-area-inset-left));
    padding-right: max(4rem, env(safe-area-inset-right));
  }

  .site-footer .footer-container {
    padding-bottom: calc(3rem + env(safe-area-inset-bottom, 0px));
  }

  .mobile-nav .m-nav-container {
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }
}

/* ── Momentum Scrolling (iOS / iPadOS) ──
   Enable native-feeling momentum scroll in overflow containers. */
.marquee-container-v1,
.m-menu-overlay,
.mega-dropdown,
.mf-links-grid {
  -webkit-overflow-scrolling: touch;
}

/* ── Safari Pinned Tab Color ──
   When a user pins the site in Safari, the favicon gets this color. */
:root {
  --safari-pinned-tab-color: #0a58ca;
}
[data-theme="dark"] {
  --safari-pinned-tab-color: #38bdf8;
}

/* ── Pointer Precision (MacBook Trackpad / Magic Mouse) ──
   MacBook users have fine-precision pointers. Optimize hover targets
   and transitions for smooth trackpad interaction. */
@media (pointer: fine) {
  .btn, .nav-link, .explore-card, .ind-card, .hp-tech-nav-card,
  .hp-outcome-card, .p3-card, .cs-card, .ps-card {
    transition-timing-function: var(--ease-apple);
  }
}

/* ── High Refresh Rate (ProMotion 120Hz) ──
   MacBook Pro and iPad Pro support 120Hz. Use will-change sparingly
   to hint the compositor about animated elements, ensuring 120fps. */
@media (min-resolution: 2dppx) {
  .reveal {
    will-change: opacity, transform;
  }

  .vault-nav::before {
    will-change: backdrop-filter, background;
  }
}

/* ── Scroll-Snap for Mobile Horizontal Containers ──
   Adds magnetic snapping when swiping through horizontal scroll areas
   on mobile. Works with trackpad two-finger swipe on MacBook too. */
.sub-nav-inner,
.mf-links-grid {
  scroll-snap-type: x mandatory;
}

.sub-nav-link,
.mf-link-card {
  scroll-snap-align: start;
}

/* ── Reduced Transparency (macOS Accessibility) ──
   When a user enables System Preferences → Accessibility → Display →
   Reduce Transparency, disable blur effects and use solid backgrounds.
   Only affects users with this setting enabled. */
@media (prefers-reduced-transparency) {
  .vault-nav::before,
  .vault-nav {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: var(--bg-body) !important;
  }

  .p3-card, .ind-card, .hp-tech-nav-card,
  .hp-outcome-card, .explore-card, .cs-card,
  .ps-card, .glass-card {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: var(--glass-bg-strong) !important;
  }

  .mega-dropdown {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
}

/* ── Reduced Motion (macOS/iOS Accessibility) ──
   When a user enables "Reduce Motion" in accessibility settings,
   disable all scroll-reveal, parallax, and CSS animations.
   Content is shown immediately without any motion. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .reveal {
    opacity: 1 !important;
    transform: none !important;
  }

  .hp-hero-video-bg {
    animation: none !important;
  }

  .footer-orb {
    animation: none !important;
  }

  .marquee-track-v1 {
    animation: none !important;
  }

  .axis-line, .axis-line::before, .axis-line::after,
  .axis-arrow {
    animation: none !important;
  }
}

/* ── High Contrast (macOS Accessibility) ──
   When a user enables "Increase Contrast", boost subtle borders,
   muted text, and glassmorphism opacity for better readability.
   Only affects users with this accessibility setting. */
@media (prefers-contrast: high) {
  :root {
    --glass-border: 1px solid rgba(0, 0, 0, 0.25);
    --glass-border-subtle: 1px solid rgba(0, 0, 0, 0.2);
    --text-muted: #4a5568;
  }

  [data-theme="dark"] {
    --glass-border: 1px solid rgba(255, 255, 255, 0.25);
    --glass-border-subtle: 1px solid rgba(255, 255, 255, 0.15);
    --text-muted: rgba(255, 255, 255, 0.65);
    --glass-bg: rgba(255, 255, 255, 0.06);
  }
}

/* ── XDR Brightness Boost (HDR OLED Displays) ──
   MacBook Pro XDR can hit 1600 nits peak. In dark mode, make key
   accent elements subtly "glow" brighter than standard white -
   a true HDR effect impossible on standard screens. */
@media (dynamic-range: high) {
  [data-theme="dark"] .gradient-text,
  [data-theme="dark"] .text-gradient,
  [data-theme="dark"] .highlight {
    filter: brightness(1.12);
  }

  [data-theme="dark"] .btn-primary {
    filter: brightness(1.08);
  }

  [data-theme="dark"] .accent-glow,
  [data-theme="dark"] .node-title {
    filter: brightness(1.05);
  }
}

/* ── Text Size Adjust (Safari iOS) ──
   Prevents Safari from auto-inflating text in landscape mode,
   which can break layouts. Does NOT block user accessibility settings
   (pinch-to-zoom, Dynamic Type) - only blocks Safari's automatic
   unwanted inflation. */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* ── Accent Color (Native Form Elements) ──
   Makes any native browser form controls (checkboxes, radio buttons,
   range sliders) use the ASI brand color instead of default blue. */
:root {
  accent-color: var(--accent-primary);
}

/* ── Branded Focus Ring (Keyboard Navigation) ──
   Replaces the default ugly blue focus outline with a subtle
   branded glow. Only shows for keyboard nav (focus-visible),
   never on mouse click. */
:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

[data-theme="dark"] :focus-visible {
  outline-color: rgba(56, 189, 248, 0.6);
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.15);
}

/* Remove focus ring on mouse click - only keyboard */
:focus:not(:focus-visible) {
  outline: none;
}

/* ── Touch-Action Manipulation (iOS Tap Speed) ──
   Removes the 300ms tap delay on mobile Safari and disables
   double-tap-to-zoom. Site responds to taps instantly. */
a, button, [role="button"], .btn, .nav-link, .explore-card,
.ind-card, .hp-tech-nav-card, .hp-outcome-card, .p3-card,
.cs-card, .ps-card, .theme-toggle-wrapper, .accordion-header,
.menu-toggle {
  touch-action: manipulation;
}

/* ── Overscroll Behavior ──
   Prevents scroll chaining (when you scroll past the bottom of a
   modal, the page behind it scrolls). Also ensures the rubber-band
   bounce on Safari shows the correct background color. */
html {
  overscroll-behavior-y: none;
}

.m-menu-overlay,
.mega-dropdown {
  overscroll-behavior: contain;
}

/* ── Scrollbar Gutter (Layout Stability) ──
   Reserves space for the scrollbar so content doesn't shift when
   navigating between short and long pages. On macOS with overlay
   scrollbars this has no visual effect - but fixes Windows. */
html {
  scrollbar-gutter: stable;
}

/* ── Retina Image Rendering ──
   Forces the browser to use high-quality image scaling on Retina
   displays. Prevents soft/blurry downscaled images. */
@media (min-resolution: 2dppx) {
  img {
    image-rendering: high-quality;
  }

  .brand-logo {
    image-rendering: -webkit-optimize-contrast;
  }
}

/* ── Backface Visibility (Flicker-Free Transforms) ──
   Prevents GPU rendering artifacts during CSS 3D transforms.
   Eliminates the brief "flicker" on card hover animations. */
.explore-card, .ind-card, .hp-tech-nav-card,
.hp-outcome-card, .p3-card, .cs-card, .ps-card,
.glass-card, .btn {
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

/* ═══════════════════════════════════════════════════════════════
   WINDOWS-SPECIFIC OPTIMIZATIONS
   ═══════════════════════════════════════════════════════════════ */

/* ── Windows High Contrast Mode (forced-colors) ──
   When a Windows user enables High Contrast in Accessibility settings,
   all colors are overridden to system-level colors. This ensures our
   glassmorphism and subtle borders degrade gracefully so nothing
   becomes invisible. Only activates for users with this setting. */
@media (forced-colors: active) {
  /* Ensure all glass cards have a visible border */
  .p3-card, .ind-card, .hp-tech-nav-card,
  .hp-outcome-card, .explore-card, .cs-card,
  .ps-card, .glass-card {
    border: 2px solid ButtonText !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  /* Ensure buttons remain visible and clickable */
  .btn, .btn-primary, .btn-ghost {
    border: 2px solid ButtonText !important;
    forced-color-adjust: none;
  }

  /* Ensure nav is visible */
  .vault-nav {
    border-bottom: 1px solid ButtonText !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  /* Preserve gradient text as regular text */
  .gradient-text, .text-gradient {
    background: none !important;
    -webkit-background-clip: unset !important;
    -webkit-text-fill-color: unset !important;
    color: LinkText !important;
  }

  /* Ensure links are visible */
  a {
    color: LinkText !important;
  }

  /* Ensure focus rings are visible */
  :focus-visible {
    outline: 3px solid Highlight !important;
    outline-offset: 2px;
  }
}

/* ── Windows ClearType Font Rendering ──
   On Windows, text renders with ClearType subpixel antialiasing.
   font-smooth and text-rendering hints help the browser produce
   the crispest possible glyphs on LCD panels. */
@supports (-ms-accelerator: true) or (-ms-ime-align: auto) {
  body {
    font-smooth: always;
  }
}

/* Optimized letter-spacing for Windows - text can appear slightly
   tighter on Windows than macOS at the same font-size. This subtle
   adjustment maintains visual consistency across platforms. */
@media not all and (min-resolution: 2dppx) {
  h1, h2, h3, .hp-hero-title, .section-heading {
    letter-spacing: -0.01em;
  }

  body {
    letter-spacing: 0.005em;
  }
}

/* ── PWA Window Controls Overlay (Windows 11 / Edge) ──
   When the site is installed as a PWA, the nav bar extends
   into the title bar area. CSS env() variables mark the safe zone
   around the system window controls (minimize/maximize/close). */
@media (display-mode: window-controls-overlay) {
  .vault-nav {
    padding-top: env(titlebar-area-y, 0);
    padding-left: env(titlebar-area-x, 0);
    height: calc(var(--nav-height, 64px) + env(titlebar-area-height, 0px));
  }

  /* Make the nav bar a drag handle for the window */
  .vault-nav-inner {
    -webkit-app-region: drag;
    app-region: drag;
  }

  /* Buttons/links inside nav should NOT be drag handles */
  .vault-nav a,
  .vault-nav button,
  .vault-nav .theme-toggle-wrapper,
  .vault-nav .menu-toggle {
    -webkit-app-region: no-drag;
    app-region: no-drag;
  }
}

/* ═══════════════════════════════════════════════════════════════
   SMOOTH PAGE TRANSITIONS (View Transition API)
   When clicking an internal link, the old page crossfades into
   the new one. GPU-accelerated, no JavaScript animation needed.
   Only applies in browsers that support ::view-transition.
   ═══════════════════════════════════════════════════════════════ */

/* Cross-document navigation transitions (Chrome 126+) */
@view-transition {
  navigation: auto;
}

/* The departing page - fades out */
::view-transition-old(root) {
  animation: asi-page-fade-out 0.25s cubic-bezier(0.4, 0, 0.2, 1) both;
}

/* The arriving page - fades in */
::view-transition-new(root) {
  animation: asi-page-fade-in 0.25s cubic-bezier(0.4, 0, 0.2, 1) both;
}

@keyframes asi-page-fade-out {
  from { opacity: 1; transform: scale(1); }
  to   { opacity: 0; transform: scale(0.98); }
}

@keyframes asi-page-fade-in {
  from { opacity: 0; transform: scale(1.02); }
  to   { opacity: 1; transform: scale(1); }
}

/* Respect reduced motion - instant switch, no animation */
@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation: none !important;
  }
}

/* ═══ Responsive Visibility Utilities ═══ */
/* Desktop: hide mobile-only elements */
.mobile-only {
  display: none !important;
}
/* Desktop: show desktop-only elements (default visible) */
.desktop-only {
  display: block;
}
/* Mobile: hide desktop-only, show mobile-only */
@media (max-width: 900px) {
  .desktop-only {
    display: none !important;
  }
}
