/**
 * WeAD Homepage — mobile-only layout (≤768px)
 * Scoped to body.page-home — desktop unchanged.
 */
@media (max-width: 768px) {
  body.page-home {
    background: #09090b;
    -webkit-tap-highlight-color: transparent;
  }


  /* Anti-FOUC: hide card grid until JS layout runs (mobile homepage only) */
  body.page-home:not(.mobile-home-ready):not(.mobile-home-timeout) #servicesGrid {
    opacity: 0;
    pointer-events: none;
  }

  body.page-home.mobile-home-ready #servicesGrid,
  body.page-home.mobile-home-timeout #servicesGrid {
    opacity: 1;
    pointer-events: auto;
    transition: opacity 0.12s ease;
  }

  body.page-home .main-content {
    padding-top: 0.35rem !important;
    padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
    overflow-x: hidden;
  }

  body.page-home .page-container {
    zoom: 1 !important;
    padding: 0 0.75rem;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
  }

  /* Hero */
  body.page-home .page-header {
    margin-bottom: 0.5rem !important;
    margin-top: 0 !important;
    text-align: center !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
  }

  body.page-home .page-header h1,
  body.page-home #homepage-title {
    margin-top: 0 !important;
    margin-bottom: 0.25rem !important;
  }
  body.page-home #homepage-title {
    font-size: 1.55rem !important;
    line-height: 1.15 !important;
    text-align: center !important;
    width: 100%;
  }

  body.page-home .page-header p {
    font-size: 0.76rem !important;
    letter-spacing: 0.02em !important;
    text-transform: none !important;
    line-height: 1.4 !important;
    margin-top: 0.35rem;
    color: rgba(255, 255, 255, 0.55) !important;
    text-align: center !important;
  }

  /*
   * CRITICAL: base.html turns every inline grid into a horizontal carousel.
   * Override that ONLY on the homepage services grid.
   */
  body.page-home #servicesGrid,
  body.page-home #servicesGrid[style*="display: grid"],
  body.page-home #servicesGrid[style*="display:grid"] {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    flex-direction: unset !important;
    overflow-x: visible !important;
    overflow-y: visible !important;
    scroll-snap-type: none !important;
    -webkit-overflow-scrolling: auto !important;
    gap: 0.6rem !important;
    margin: 0 0 1.25rem !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  body.page-home #servicesGrid > a,
  body.page-home #servicesGrid > .home-mobile-quick-actions,
  body.page-home #servicesGrid > .home-mobile-section-title {
    flex: unset !important;
    min-width: 0 !important;
    max-width: none !important;
    width: auto !important;
    scroll-snap-align: unset !important;
  }

  /* Override index.html built-in mobile carousel (flex / 90vw / 550px cards) */
  body.page-home #servicesGrid > a > div,
  body.page-home #servicesGrid > a > .glass {
    min-height: unset !important;
    height: auto !important;
    width: 100% !important;
  }

  /* Quick actions — full width row */
  body.page-home .home-mobile-quick-actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.45rem;
    margin: 0 0 0.25rem;
    width: 100% !important;
  }

  body.page-home .home-quick-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    min-height: 68px;
    padding: 0.5rem 0.25rem;
    border-radius: 12px;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 600;
  }

  body.page-home .home-quick-btn i { font-size: 1.1rem; }
  body.page-home .home-quick-btn:nth-child(1) i { color: #10b981; }
  body.page-home .home-quick-btn:nth-child(2) i { color: #DC143C; }
  body.page-home .home-quick-btn:nth-child(3) i { color: #a78bfa; }

  /* Section titles */
  body.page-home .home-mobile-section-title {
    grid-column: 1 / -1;
    margin: 0.75rem 0 0.35rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.42);
  }

  body.page-home .home-mobile-section-title--soon {
    margin-top: 1rem;
  }

  /* Shared card reset */
  body.page-home #servicesGrid > a {
    display: block !important;
    min-height: unset !important;
    text-decoration: none;
  }

  body.page-home #servicesGrid > a > .glass {
    border-radius: 12px !important;
    overflow: hidden !important;
    transform: none !important;
    text-align: left !important;
    border-width: 1px !important;
    height: 100%;
    box-sizing: border-box;
  }

  body.page-home #servicesGrid > a > .glass:hover {
    transform: none !important;
  }

  body.page-home #servicesGrid .card-badge {
    position: absolute !important;
    top: 6px !important;
    left: 6px !important;
    right: auto !important;
    z-index: 2;
    margin: 0 !important;
    padding: 0.12rem 0.35rem !important;
    font-size: 0.42rem !important;
    letter-spacing: 0.03em !important;
    border-radius: 4px !important;
    max-width: calc(100% - 12px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    backdrop-filter: blur(8px);
    background: rgba(0, 0, 0, 0.55) !important;
  }

  /* Show cover images on all live tiles (class applied by mobile-home.js) */
  body.page-home #servicesGrid > a.home-card--live > .glass > div[style*="aspect-ratio"],
  body.page-home #servicesGrid > a.home-card--soon > .glass > div[style*="aspect-ratio"] {
    display: block !important;
  }

  /* ── LIVE tiles: image on top + title ── */
  body.page-home #servicesGrid > a.home-card--live > .glass {
    display: flex !important;
    flex-direction: column !important;
    padding: 0 !important;
    min-height: unset !important;
    position: relative;
    text-align: center !important;
  }

  /* Image block */
  body.page-home #servicesGrid > a.home-card--live > .glass > div[style*="aspect-ratio"] {
    display: block !important;
    width: 100% !important;
    aspect-ratio: 4 / 3 !important;
    max-height: none !important;
    min-height: 0 !important;
    flex-shrink: 0;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.4);
  }

  body.page-home #servicesGrid > a.home-card--live > .glass > div[style*="aspect-ratio"] img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
  }

  body.page-home #servicesGrid > a.home-card--live > .glass > div[style*="padding: 2rem"] {
    padding: 0.45rem 0.5rem 0.55rem !important;
    flex: 1;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center;
    text-align: center !important;
    min-height: 2.6rem;
  }

  /* Hide icon, description, CTA on live tiles */
  body.page-home #servicesGrid > a.home-card--live > .glass > div[style*="padding: 2rem"] > div:first-child,
  body.page-home #servicesGrid > a.home-card--live > .glass p,
  body.page-home #servicesGrid > a.home-card--live > .glass > div[style*="padding: 2rem"] > div:last-child {
    display: none !important;
  }

  body.page-home #servicesGrid > a.home-card--live > .glass h2,
  body.page-home #servicesGrid > a.home-card--live > .glass h2[style] {
    font-size: 0.62rem !important;
    line-height: 1.25 !important;
    margin: 0 !important;
    font-weight: 700 !important;
    color: rgba(255, 255, 255, 0.95) !important;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-align: center !important;
    width: 100%;
    max-width: 100%;
    display: block !important;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
  }

  /* ── COMING SOON: list row — title then thumb ── */
  body.page-home #servicesGrid > a.home-card--soon {
    grid-column: 1 / -1;
  }

  body.page-home #servicesGrid > a.home-card--live + a.home-card--soon {
    margin-top: 0.85rem;
  }

  body.page-home #servicesGrid > a.home-card--soon > .glass {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 0.55rem !important;
    padding: 0.45rem 0.55rem 0.45rem 0.65rem !important;
    min-height: 58px !important;
  }

  body.page-home #servicesGrid > a.home-card--soon .card-badge {
    display: none !important;
  }

  body.page-home #servicesGrid > a.home-card--soon > .glass > div[style*="padding: 2rem"] {
    order: 1;
    padding: 0 !important;
    flex: 1 !important;
    min-width: 0;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center;
    align-items: flex-start !important;
    text-align: left !important;
    gap: 0.15rem !important;
  }

  body.page-home #servicesGrid > a.home-card--soon > .glass > div[style*="aspect-ratio"] {
    order: 2;
    display: block !important;
    width: 46px !important;
    height: 46px !important;
    min-width: 46px !important;
    aspect-ratio: 1 !important;
    flex-shrink: 0;
    border-radius: 10px;
    overflow: hidden;
  }

  body.page-home #servicesGrid > a.home-card--soon > .glass > div[style*="aspect-ratio"] img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
  }

  body.page-home #servicesGrid > a.home-card--soon > .glass > div[style*="padding: 2rem"] > div:first-child,
  body.page-home #servicesGrid > a.home-card--soon > .glass p,
  body.page-home #servicesGrid > a.home-card--soon > .glass > div[style*="padding: 2rem"] > div:last-child {
    display: none !important;
  }

  body.page-home #servicesGrid > a.home-card--soon h2 {
    font-size: 0.72rem !important;
    line-height: 1.2 !important;
    margin: 0 !important;
    font-weight: 600 !important;
    text-transform: none !important;
  }

  body.page-home #servicesGrid > a.home-card--soon > .glass::after {
    order: 3;
    content: '›';
    color: rgba(255, 255, 255, 0.35);
    font-size: 1.15rem;
    flex-shrink: 0;
    padding-right: 0.15rem;
  }

  /* Video */
  body.page-home .section.glass[style*="margin-top: 5rem"] {
    margin-top: 1rem !important;
    padding: 0.85rem !important;
    border-radius: 12px !important;
  }

  body.page-home #weadVideo {
    max-height: 38vh;
    object-fit: cover;
  }

  /* Stats chips */
  body.page-home .stats-grid {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    gap: 0.45rem !important;
    margin-top: 1rem !important;
    scrollbar-width: none;
  }

  body.page-home .stats-grid::-webkit-scrollbar { display: none; }

  body.page-home .stat-card {
    flex: 0 0 42% !important;
    min-width: 118px;
    max-width: 148px;
    padding: 0.45rem 0.5rem !important;
    gap: 0.45rem !important;
  }

  body.page-home .stat-card .stat-icon {
    width: 30px !important;
    height: 30px !important;
    min-width: 30px !important;
    border-radius: 8px !important;
  }

  body.page-home .stat-card .stat-icon i {
    font-size: 0.75rem !important;
  }

  body.page-home .stat-card .stat-content {
    min-width: 0;
    flex: 1;
  }

  body.page-home .stat-card .stat-value {
    font-size: 0.95rem !important;
    line-height: 1.1 !important;
    white-space: nowrap !important;
  }

  body.page-home .stat-card .stat-label {
    font-size: 0.48rem !important;
    letter-spacing: 0.04em !important;
    line-height: 1.15 !important;
    white-space: normal !important;
    word-break: break-word;
  }

  /* How it works — compact stacked steps (override base.html carousel) */
  body.page-home section.section.glass[style*="margin-top: 3rem"] {
    margin-top: 0.85rem !important;
    padding: 0.65rem 0.75rem !important;
    border-radius: 12px !important;
  }

  body.page-home section.section.glass[style*="margin-top: 3rem"] .section-title {
    font-size: 0.95rem !important;
    margin-bottom: 0.2rem !important;
    letter-spacing: 0.04em !important;
  }

  body.page-home section.section.glass[style*="margin-top: 3rem"] .section-subtitle {
    font-size: 0.65rem !important;
    margin-bottom: 0 !important;
    letter-spacing: 0.02em !important;
    line-height: 1.35 !important;
  }

  body.page-home section.section.glass[style*="margin-top: 3rem"] > div[style*="display: grid"],
  body.page-home section.section.glass[style*="margin-top: 3rem"] > div[style*="display:grid"] {
    display: grid !important;
    grid-template-columns: 1fr !important;
    flex-direction: unset !important;
    overflow-x: visible !important;
    overflow-y: visible !important;
    scroll-snap-type: none !important;
    gap: 0.45rem !important;
    margin-top: 0.65rem !important;
    padding: 0 !important;
  }

  body.page-home section.section.glass[style*="margin-top: 3rem"] > div[style*="grid"] > div {
    flex: unset !important;
    min-width: 0 !important;
    max-width: none !important;
    width: auto !important;
    scroll-snap-align: unset !important;
    display: grid !important;
    grid-template-columns: 34px 1fr !important;
    grid-template-rows: auto auto !important;
    gap: 0.1rem 0.55rem !important;
    padding: 0.45rem 0.5rem !important;
    text-align: left !important;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
  }

  body.page-home section.section.glass[style*="margin-top: 3rem"] > div[style*="grid"] > div > div:first-child {
    grid-row: 1 / 3;
    grid-column: 1;
    align-self: center;
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    margin: 0 !important;
    font-size: 0.85rem !important;
    border-radius: 9px !important;
  }

  body.page-home section.section.glass[style*="margin-top: 3rem"] > div[style*="grid"] > div > h3 {
    grid-column: 2;
    grid-row: 1;
    font-size: 0.68rem !important;
    margin: 0 !important;
    text-align: left !important;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }

  body.page-home section.section.glass[style*="margin-top: 3rem"] > div[style*="grid"] > div > p {
    grid-column: 2;
    grid-row: 2;
    font-size: 0.6rem !important;
    line-height: 1.35 !important;
    text-align: left !important;
    margin: 0 !important;
  }

  /* Partners — one row */
  body.page-home .logo-scroll-container:has(#logoLayer2),
  body.page-home .logo-scroll-container:has(#logoLayer3) {
    display: none !important;
  }

  body.page-home .logo-box {
    width: 90px !important;
    height: 58px !important;
  }

  /* Footer — collapsible sections on mobile (homepage only) */
  body.page-home .footer {
    margin-top: 0.75rem !important;
  }

  body.page-home .footer-container {
    padding: 0.65rem 0.75rem 0.5rem !important;
  }

  body.page-home .footer-content {
    grid-template-columns: 1fr !important;
    gap: 0 !important;
    margin-bottom: 0.5rem !important;
  }

  body.page-home .footer.footer-mobile-compact .footer-section {
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  }

  body.page-home .footer.footer-mobile-compact .footer-section h3 {
    margin: 0 !important;
    padding: 0.55rem 0 !important;
    font-size: 0.62rem !important;
    letter-spacing: 0.1em !important;
    text-transform: uppercase;
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
  }

  body.page-home .footer.footer-mobile-compact .footer-section h3::after {
    content: '+';
    font-size: 0.9rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.35);
    line-height: 1;
  }

  body.page-home .footer.footer-mobile-compact .footer-section--open h3::after {
    content: '−';
  }

  body.page-home .footer.footer-mobile-compact .footer-section--collapsed ul {
    display: none !important;
  }

  body.page-home .footer.footer-mobile-compact .footer-section--open ul {
    display: block !important;
    padding: 0.15rem 0 0.45rem !important;
  }

  body.page-home .footer.footer-mobile-compact .footer-section ul li {
    margin-bottom: 0.12rem !important;
  }

  body.page-home .footer.footer-mobile-compact .footer-section ul li a {
    font-size: 0.68rem !important;
    line-height: 1.35 !important;
  }

  body.page-home .footer.footer-mobile-compact .footer-bottom {
    padding-top: 0.5rem !important;
  }

  body.page-home .footer.footer-mobile-compact .footer-bottom p {
    font-size: 0.58rem !important;
    gap: 0.35rem !important;
    flex-direction: column !important;
  }

  body.page-home .footer.footer-mobile-compact .footer-bottom img {
    height: 32px !important;
  }

  /* Soulbound airdrop popup — ensure visible on mobile (iOS fixed + overflow fixes) */
  body.page-home #airdrop-entry-modal {
    z-index: 2147483647 !important;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
  }

  body.page-home #airdrop-entry-modal > div {
    max-width: min(340px, calc(100vw - 2rem)) !important;
    padding: 1.25rem 1.1rem !important;
  }

  body.page-home #airdrop-entry-modal img {
    width: 110px !important;
    height: 110px !important;
  }

  body.page-home #airdrop-entry-modal h2 {
    font-size: 1.05rem !important;
  }

  body.page-home #airdrop-entry-modal p {
    font-size: 0.78rem !important;
    margin-bottom: 0.85rem !important;
  }

  body.page-home.airdrop-modal-open {
    overflow: hidden;
  }

  /* Hide Jarvis while airdrop modal is open */
  body.page-home.airdrop-modal-open #jarvisBtn,
  body.page-home.airdrop-modal-open #jarvisPanel {
    visibility: hidden !important;
    pointer-events: none !important;
  }

  /* JS-off fallback: span coming cards full-width before mobile-home.js runs */
  body.page-home #servicesGrid:not([data-mobile-layout="1"]) > a:has([class*="badge-coming"]) {
    grid-column: 1 / -1;
  }

  body.page-home #servicesGrid:not([data-mobile-layout="1"]) > a:has([class*="badge-coming"]) > .glass > div[style*="padding: 2rem"] > div:first-child,
  body.page-home #servicesGrid:not([data-mobile-layout="1"]) > a:has([class*="badge-coming"]) > .glass p {
    display: none !important;
  }

  /* Jarvis */
  body.page-home #jarvisBtn {
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    left: 10px;
  }

  body.page-home #jarvisPanel {
    left: 10px;
    right: 10px;
    width: auto;
    bottom: calc(68px + env(safe-area-inset-bottom, 0px));
    height: min(480px, 58vh);
  }
}

@media (min-width: 769px) {
  body.page-home .home-mobile-quick-actions,
  body.page-home .home-mobile-section-title {
    display: none !important;
  }
}
