/* ==========================================================================
   ETC Labs — Gen 1 · Mobile: a touch-first interface, not a shrunken desktop.
   Everything here is scoped to small viewports or coarse pointers and uses
   transform/opacity only. Desktop rules are untouched.
   ========================================================================== */

/* ---------- Touch feedback everywhere (coarse pointers) ---------- */
@media (pointer: coarse) {
  .btn, .chip, .filter-btn, .tab, .path, .product-item, .project, .tool-card, .ld-item, .feature-grid > *, .why-item, .board-row:not(.head), .tk-item, .chan { -webkit-tap-highlight-color: transparent; }
  .btn:active, .filter-btn:active, .tab:active, .tool-card:active, .path:active, .ld-item:active, .expand-toggle:active { transform: scale(0.97); transition-duration: 80ms; }
  .product-item:active, .project:active, .feature-grid > a:active, .chan:active { transform: scale(0.985); transition: transform 80ms; }
  .link-arrow:active .arrow { transform: translateX(4px); }
  .btn-secondary:active { border-color: rgba(var(--cyan-rgb), 0.6); }
}

/* ---------- Ambient mobile background: slow aurora instead of the desktop canvas ---------- */
@media (max-width: 899px), (pointer: coarse) {
  .world-aurora { inset: -20%; opacity: 0.9; background:
      radial-gradient(38% 30% at 22% 28%, rgba(var(--tone-rgb), 0.22), transparent 70%),
      radial-gradient(34% 28% at 78% 62%, rgba(var(--cyan-rgb), 0.12), transparent 70%),
      radial-gradient(30% 26% at 55% 90%, rgba(var(--magenta-rgb), 0.10), transparent 70%);
    will-change: transform; animation: aurora 18s ease-in-out infinite alternate; transition: background 1.6s var(--ease); }
  .world-grid { background-size: 56px 56px; mask-image: radial-gradient(ellipse 90% 60% at 50% 15%, #000 5%, transparent 70%); -webkit-mask-image: radial-gradient(ellipse 90% 60% at 50% 15%, #000 5%, transparent 70%); }
  .light.a, .light.b { opacity: 0.45; }
}
@keyframes aurora { from { transform: translate3d(-3%, -2%, 0) rotate(-1.5deg); } to { transform: translate3d(3%, 3%, 0) rotate(1.5deg); } }
@media (min-width: 900px) and (pointer: fine) { .world-aurora { display: none; } }
@media (prefers-reduced-motion: reduce) { .world-aurora { animation: none; } }

/* ---------- Sections feel connected: animated divider + index label on phones ---------- */
@media (max-width: 899px) {
  .section { position: relative; padding-top: clamp(56px, 12vw, 80px); }
  .section::before { content: ""; position: absolute; left: var(--gutter, 20px); right: var(--gutter, 20px); top: 0; height: 1px; background: linear-gradient(90deg, rgba(var(--tone-rgb), 0.7), rgba(var(--cyan-rgb), 0.25) 40%, transparent); transform: scaleX(0); transform-origin: left; transition: transform 0.9s var(--ease-out); }
  .section.in-view::before { transform: scaleX(1); }
  .section .kicker::after { content: ""; display: inline-block; width: 22px; height: 1px; margin-left: 10px; background: rgba(var(--tone-rgb), 0.7); vertical-align: middle; transform: scaleX(0); transform-origin: left; transition: transform 0.6s var(--ease-out) 0.2s; }
  .section.in-view .kicker::after { transform: scaleX(1); }
  .head.split-head { gap: 14px; }
  .head .lead { font-size: 1rem; }
  .cta-band, .league-band, .join-band { padding: 26px 22px; }
}
@media (prefers-reduced-motion: reduce) { .section::before, .section .kicker::after { transform: none; transition: none; } }

/* ---------- Hero: intentional mobile typography and rhythm ---------- */
@media (max-width: 899px) {
  .hero { padding-top: calc(var(--nav-h) + 28px); }
  .hero h1, .hero .display { font-size: clamp(2.5rem, 12.5vw, 3.6rem); line-height: 1.02; letter-spacing: -0.03em; }
  .hero .lead { font-size: 1.02rem; max-width: 36ch; }
  .hero-actions { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .hero-actions .btn { width: 100%; min-height: 52px; justify-content: center; }
  .hero-actions .link-arrow { justify-content: center; min-height: 44px; }
  .home-hero .build-list { gap: 8px; margin-top: 18px; }
  .home-hero .build-list li { padding: 7px 11px; border-radius: 999px; border: 1px solid var(--line); font-size: 0.74rem; background: rgba(255, 255, 255, 0.02); }
  .home-hero .build-list li::before { display: none; }
  .hero-line { height: 2px; width: 72px; margin: 18px 0 4px; background: var(--g-energy); transform: scaleX(0); transform-origin: left; animation: hero-line 0.9s var(--ease-out) 0.35s forwards; }
}
@keyframes hero-line { to { transform: scaleX(1); } }
@media (min-width: 900px) { .hero-line { display: none; } }
@media (prefers-reduced-motion: reduce) { .hero-line { transform: none; animation: none; } }

/* ---------- Orbit visualization: tap-to-select with a compact detail panel ---------- */
.eco-wrap { display: grid; gap: 14px; }
.eco-panel { display: none; border-radius: var(--r-lg); border: 1px solid var(--line); background: rgba(255, 255, 255, 0.03); padding: 16px 18px; border-left: 3px solid var(--c, var(--cyan)); transition: border-color var(--t-base); }
.eco-panel.show { display: grid; gap: 6px; animation: fade-up 0.32s var(--ease-out); }
.eco-panel .kicker { margin: 0; color: var(--c, var(--cyan)); }
.eco-panel h3 { font-size: 1.15rem; margin: 0; }
.eco-panel p { color: var(--muted); font-size: 0.94rem; margin: 0; }
.eco-panel .link-arrow { margin-top: 6px; min-height: 40px; color: var(--c, var(--cyan)); }
.eco .node.on circle.bg { stroke-width: 2; }
.eco .node.on text { fill: #fff; }
.eco .node .tap { fill: transparent; r: 52; }
@media (pointer: coarse) {
  .eco { max-width: min(400px, 92vw); margin-top: 8px; touch-action: pan-y; }
  .eco .node circle.bg { transition: stroke var(--t-fast), fill var(--t-fast), r var(--t-fast); }
  .eco .node.on circle.bg { r: 43; }
  .eco .node.on circle.halo { stroke-opacity: 0.22; }
  .eco-caption { position: static; margin-top: 10px; }
}

/* ---------- Routing cards: visual identity + accent on phones ---------- */
@media (max-width: 799px) {
  .paths { border: 0; gap: 12px; }
  .path { padding: 18px 18px 18px 20px; border: 1px solid var(--line); border-radius: var(--r-lg); background: rgba(255, 255, 255, 0.025); overflow: hidden; transition: border-color var(--t-fast), transform 80ms; }
  .path:last-child { border-bottom: 1px solid var(--line); }
  .path::before { left: 0; width: 3px; transform: scaleY(0); transition: transform 0.7s var(--ease-out); }
  .path.in::before { transform: scaleY(1); }
  .path:nth-child(2)::before { background: var(--g-violet-magenta); }
  .path:nth-child(3)::before { background: linear-gradient(180deg, var(--green), var(--cyan)); }
  .path h3 { font-size: 1.15rem; }
  .path p { margin-bottom: 12px; }
  .path .link-arrow { min-height: 40px; }
}

/* ---------- What we build: tappable rows, expand in place, visual follows selection ---------- */
@media (max-width: 899px) {
  .build .row { padding: 16px 0; }
  .build .row p { max-height: 0; opacity: 0; overflow: hidden; margin: 0; transition: max-height var(--t-base), opacity var(--t-base), margin var(--t-base); }
  .build .row[aria-selected="true"] p { max-height: 120px; opacity: 1; margin-top: 6px; }
  .build .row[aria-selected="true"] { background: linear-gradient(90deg, rgba(var(--tone-rgb), 0.12), transparent 70%); border-radius: var(--r-md); padding-left: 12px; margin-left: -12px; }
  .build .row .end { display: inline-flex; min-width: 40px; min-height: 40px; align-items: center; justify-content: center; }
  .build-visual { max-width: none; }
}

/* ---------- Filters: horizontal scroll chips, never overflow ---------- */
@media (max-width: 719px) {
  .filters { display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 8px; padding: 2px 0 8px; margin-inline: calc(-1 * var(--gutter, 20px)); padding-inline: var(--gutter, 20px); scroll-snap-type: x proximity; scrollbar-width: none; -webkit-overflow-scrolling: touch; mask-image: linear-gradient(90deg, #000 88%, transparent); -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent); }
  .filters::-webkit-scrollbar { display: none; }
  .filters .filter-btn { flex: none; scroll-snap-align: start; min-height: 40px; }
}

/* ---------- Projects: number, stronger rhythm ---------- */
@media (max-width: 719px) {
  .project { counter-increment: project; }
  .project .meta::before { content: "0" counter(project); font-family: var(--font-mono); font-size: 0.7rem; color: var(--muted-2); margin-right: 10px; }
  .project-grid { counter-reset: project; gap: 18px; }
  .project .visual { border-radius: var(--r-lg); }
  .project h3 { font-size: 1.15rem; }
}

/* ---------- Community: creators as cards with staggered entrance ---------- */
@media (max-width: 719px) {
  .board { border: 0; background: none; overflow: visible; }
  .board-head { padding: 0 0 12px; border: 0; }
  .board-row:not(.head) { border: 1px solid var(--line); border-radius: var(--r-lg); background: rgba(255, 255, 255, 0.025); margin-bottom: 10px; padding: 14px; grid-template-columns: 36px minmax(0, 1fr) auto; grid-template-areas: "rank creator creator" "stat pts action"; }
  .board-row.top { box-shadow: inset 0 0 0 1px rgba(var(--cyan-rgb), 0.35); }
  .board-row .creator .avatar { width: 48px; height: 48px; }
  .board-row .stat, .board-row .pts { padding-top: 6px; }
  .board-row .action .btn { min-height: 42px; }
  .board-row[data-reveal] { transition-delay: calc(var(--i, 0) * 45ms); }
  .members { gap: 10px; }
  .cg { touch-action: pan-y; }
}

/* ---------- Careers / What we build: list + detail chips are the accordion on phones ---------- */
@media (max-width: 899px) {
  .ld-list .ld-item { min-height: 46px; }
  .ld-item[aria-selected="true"] { box-shadow: inset 0 0 0 1px rgba(var(--cyan-rgb), 0.5); }
  .ld-detail { animation: fade-up 0.32s var(--ease-out); }
  .role-cols { gap: 16px; }
  .apply-panel, .contact-panel { padding: 20px 16px; }
  .form-row { grid-template-columns: minmax(0, 1fr); }
  .input, .select, .textarea { min-height: 48px; font-size: 16px; }
  .form-foot { display: grid; gap: 12px; }
  .form-foot .btn { width: 100%; justify-content: center; min-height: 52px; }
  .form-success.show { animation: fade-up 0.4s var(--ease-out); }
  .radio-chip span { min-height: 42px; display: inline-flex; align-items: center; }
}

/* ---------- Navigation: staggered menu, backdrop transition ---------- */
@media (max-width: 1099px) {
  .nav-mobile { transition: opacity 0.26s var(--ease), transform 0.26s var(--ease), visibility 0s linear 0.26s; }
  .nav-mobile.open { transition: opacity 0.26s var(--ease), transform 0.26s var(--ease); }
  .nav-mobile .nav-group, .nav-mobile .nav-mobile-cta, .nav-mobile .nav-mobile-foot { opacity: 0; transform: translateY(10px); transition: opacity 0.35s var(--ease-out), transform 0.35s var(--ease-out); }
  .nav-mobile.open .nav-group, .nav-mobile.open .nav-mobile-cta, .nav-mobile.open .nav-mobile-foot { opacity: 1; transform: none; }
  .nav-mobile.open .nav-group:nth-child(1) { transition-delay: 40ms; } .nav-mobile.open .nav-group:nth-child(2) { transition-delay: 90ms; } .nav-mobile.open .nav-group:nth-child(3) { transition-delay: 140ms; } .nav-mobile.open .nav-group:nth-child(4) { transition-delay: 190ms; } .nav-mobile.open .nav-group:nth-child(5) { transition-delay: 240ms; } .nav-mobile.open .nav-mobile-cta { transition-delay: 290ms; } .nav-mobile.open .nav-mobile-foot { transition-delay: 340ms; }
  .nav-mobile .nav-link[aria-current="page"] { color: var(--cyan); }
  .nav-mobile .nav-link { position: relative; }
  .nav-mobile .nav-link[aria-current="page"]::before { content: ""; position: absolute; left: -14px; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
  .nav-mobile .nav-link { min-height: 48px; }
}
@media (prefers-reduced-motion: reduce) { .nav-mobile .nav-group, .nav-mobile .nav-mobile-cta, .nav-mobile .nav-mobile-foot { transition: none; transform: none; opacity: 1; } }

/* ---------- Footer ---------- */
@media (max-width: 719px) {
  .footer-brand p { font-size: 0.92rem; }
  .fgroup h4 { min-height: 48px; }
  .footer-links a { min-height: 44px; display: flex; align-items: center; }
  .footer-bottom { flex-direction: column; gap: 10px; align-items: flex-start; }
}

/* ---------- Tools on phones ---------- */
@media (max-width: 719px) {
  .tool-panel { padding: 18px 16px; }
  .share-row { flex-direction: column; }
  .share-row .btn { width: 100%; justify-content: center; }
  .room-head { flex-direction: column; }
  .toolkit-stats { width: 100%; }
  .tabs .tab { flex: 1 1 auto; text-align: center; }
  .tk-add .btn { width: 100%; justify-content: center; }
}
