/* ============================================================
   47NETWORK — PROFESSIONAL POLISH v1
   Applied on top of main.css / home.css.
   Reduces sci-fi/game-UI aesthetics → clean B2B appearance.
   ============================================================ */

/* ── Remove the sci-fi corner cut decorations from cards ──── */
/* These make every card look like a game HUD, not a B2B product */
.hud-card::before,
.hud-card::after {
  display: none;
}

/* ── Subtler card hover — less purple glow, more elevation ── */
.hud-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255,255,255,0.12);
  box-shadow: 0 12px 32px rgba(0,0,0,0.35), 0 2px 8px rgba(0,0,0,0.2);
}

/* ── Reduce orb sizes and opacity ─────────────────────────── */
.orb-hero-1 {
  width: 480px; height: 480px;
  background: radial-gradient(circle, rgba(92,80,214,.10), transparent 70%);
}
.orb-hero-2 {
  width: 380px; height: 380px;
  background: radial-gradient(circle, rgba(225,89,217,.07), transparent 70%);
}
.orb-hero-3 {
  width: 280px; height: 280px;
  background: radial-gradient(circle, rgba(66,183,250,.06), transparent 70%);
}

/* ── Subtler neon divider ─────────────────────────────────── */
.neon-divider {
  opacity: 0.18;
  background: linear-gradient(90deg, transparent, rgba(92,80,214,.6) 40%, rgba(66,183,250,.5) 60%, transparent);
}

/* ── Cleaner nav — less glass, more solid ─────────────────── */
.nav {
  background: rgba(5,7,24,0.92);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  backdrop-filter: blur(12px);
}
.nav.scrolled {
  box-shadow: 0 1px 0 rgba(255,255,255,0.05);
}

/* ── Stats bar — slightly lighter, cleaner ────────────────── */
.stats-bar {
  background: rgba(10,10,30,0.6);
  border-top: 1px solid rgba(255,255,255,0.05);
  border-bottom: 1px solid rgba(255,255,255,0.05);
  backdrop-filter: none;
}

/* ── Cards: slightly lighter background for contrast ─────── */
.hud-card {
  background: rgba(22,22,48,0.55);
  border-color: rgba(255,255,255,0.07);
}

/* ── Buttons: more polished, less outline-heavy ───────────── */
.btn-primary {
  background: linear-gradient(135deg, #5C50D6, #4a40c0);
  border: 1px solid rgba(92,80,214,0.6);
  box-shadow: 0 2px 12px rgba(92,80,214,0.25);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #6a5fe0, #5548d0);
  box-shadow: 0 4px 20px rgba(92,80,214,0.4);
  transform: translateY(-1px);
}
.btn-ghost {
  border-color: rgba(255,255,255,0.12);
  color: rgba(240,242,255,0.8);
}
.btn-ghost:hover {
  border-color: rgba(255,255,255,0.22);
  background: rgba(255,255,255,0.04);
  color: var(--white);
}

/* ── Section labels — more understated ───────────────────── */
.section-label {
  font-size: .68rem;
  letter-spacing: .12em;
  color: rgba(136,136,170,0.7);
  text-transform: uppercase;
  font-family: var(--font-mono);
}

/* ── Manifesto band — less heavy gradient ────────────────── */
.manifesto-band {
  background: linear-gradient(180deg,
    transparent 0%,
    rgba(92,80,214,.03) 30%,
    rgba(225,89,217,.02) 70%,
    transparent 100%);
}

/* ── Cleaner footer ───────────────────────────────────────── */
.footer {
  border-top: 1px solid rgba(255,255,255,0.06);
  background: rgba(3,4,18,0.95);
}

/* ── Announcement bar — more subtle ──────────────────────── */
#announce-bar {
  background: rgba(5,7,24,0.95);
  border-bottom: 1px solid rgba(92,80,214,0.15);
}

/* ── Product cards — cleaner on hover ────────────────────── */
.product-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255,255,255,0.12);
  box-shadow: 0 12px 36px rgba(0,0,0,0.3);
}
.product-card:hover::after {
  display: none; /* remove the radial hover glow */
}

/* ── Hero terminal — cleaner framing ─────────────────────── */
.hero-terminal {
  border: 1px solid rgba(255,255,255,0.09);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 1px 0 rgba(255,255,255,0.04);
}

/* ── Trust grid cards ─────────────────────────────────────── */
.trust-card:hover {
  border-color: rgba(255,255,255,0.12);
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  transform: translateY(-3px);
}

/* ── Manifesto pillars ─────────────────────────────────────── */
.manifesto-pillar:hover {
  border-color: rgba(255,255,255,0.12);
  transform: translateY(-3px);
}
.manifesto-pillar:hover::before {
  opacity: 0.5;
}

/* ── CTA band — less orb-heavy ─────────────────────────────── */
.cta-band-orb,
.cta-band-orb2 {
  opacity: 0.5;
}

/* ============================================================
   RESPONSIVE NAVIGATION OVERHAUL
   Hamburger at 1024px, proper accordion mobile drawer,
   clean tablet layouts, full cross-device coverage.
   ============================================================ */

/* ── 1. Show hamburger at 1024px instead of 768px ─────────── */
@media (max-width: 1024px) {
  .nav-links   { display: none !important; }
  .nav-hamburger { display: flex !important; }
  /* Keep lang toggle visible in bar, hide CTA button */
  .nav-right .btn { display: none; }
}

/* ── 2. Full-screen mobile drawer ─────────────────────────── */
@media (max-width: 1024px) {
  .nav-links.mobile-open {
    display: flex !important;
    flex-direction: column;
    position: fixed;
    top: var(--nav-h);
    left: 0; right: 0; bottom: 0;
    background: rgba(3,4,18,0.98);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-top: 1px solid rgba(92,80,214,.18);
    padding: 0 0 2rem 0;
    gap: 0;
    overflow-y: auto;
    z-index: 998;
    animation: drawerIn .22s cubic-bezier(.16,1,.3,1);
  }

  @keyframes drawerIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  /* Top-level link in mobile drawer */
  .nav-links.mobile-open > a.nav-link {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    font-size: .9375rem;
    font-weight: 500;
    border-bottom: 1px solid rgba(255,255,255,.04);
    border-radius: 0;
    color: rgba(240,242,255,.75);
    transition: color .15s, background .15s;
    width: 100%;
  }
  .nav-links.mobile-open > a.nav-link:hover,
  .nav-links.mobile-open > a.nav-link.active {
    color: var(--white);
    background: rgba(92,80,214,.08);
  }

  /* Dropdown container in drawer */
  .nav-links.mobile-open .nav-dropdown {
    width: 100%;
    border-bottom: 1px solid rgba(255,255,255,.04);
  }

  /* Dropdown toggle button */
  .nav-links.mobile-open .nav-dropdown > button.nav-link {
    width: 100%;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    font-size: .9375rem;
    font-weight: 500;
    border-radius: 0;
    color: rgba(240,242,255,.75);
  }
  .nav-links.mobile-open .nav-dropdown > button.nav-link:hover,
  .nav-links.mobile-open .nav-dropdown.mobile-expanded > button.nav-link {
    color: var(--white);
    background: rgba(92,80,214,.08);
  }

  /* Chevron rotation when expanded */
  .nav-links.mobile-open .nav-dropdown > button.nav-link svg {
    transition: transform .2s;
    flex-shrink: 0;
  }
  .nav-links.mobile-open .nav-dropdown.mobile-expanded > button.nav-link svg {
    transform: rotate(180deg);
  }

  /* Submenu: hidden by default in mobile, shown when .mobile-expanded */
  .nav-links.mobile-open .nav-dropdown-menu {
    position: static !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    transform: none !important;
    background: rgba(92,80,214,.05);
    border: none;
    border-top: 1px solid rgba(92,80,214,.12);
    border-radius: 0;
    padding: .375rem 0 .75rem 0;
    display: none;
    flex-direction: column;
    min-width: unset;
    backdrop-filter: none;
  }
  .nav-links.mobile-open .nav-dropdown.mobile-expanded .nav-dropdown-menu {
    display: flex;
  }
  .nav-links.mobile-open .nav-dropdown-item {
    padding: .75rem 1.5rem .75rem 2.25rem;
    font-size: .875rem;
    border-radius: 0;
    color: rgba(240,242,255,.6);
  }
  .nav-links.mobile-open .nav-dropdown-item:hover {
    background: rgba(92,80,214,.1);
    color: var(--white);
  }

  /* Mobile nav footer (CTA injected by JS) */
  .nav-mobile-cta {
    margin-top: auto;
    padding: 1.5rem;
    border-top: 1px solid rgba(255,255,255,.06);
    display: flex;
    flex-direction: column;
    gap: .75rem;
  }
  .nav-mobile-cta .btn {
    width: 100%;
    justify-content: center;
    padding: .875rem;
    font-size: .9375rem;
    display: flex !important;
  }
  .nav-mobile-cta .nav-mobile-contact {
    font-family: var(--font-mono);
    font-size: .72rem;
    color: var(--muted);
    text-align: center;
    letter-spacing: .04em;
  }
  .nav-mobile-cta .nav-mobile-contact a {
    color: var(--neon-cyan);
  }
}

/* ── 3. Nav right on narrow desktop (1025-1200px) ─────────── */
@media (min-width: 1025px) and (max-width: 1200px) {
  .nav-inner { gap: 1rem; }
  .nav-links  { margin-left: .75rem; gap: 0; }
  .nav-link   { padding: .5rem .6rem; font-size: .8125rem; }
  .nav-right  { gap: .5rem; }
  .lang-toggle { display: none; } /* hide lang toggle at tight widths; it's in mobile menu via JS below */
}

/* ── 4. Products grid — better intermediate breakpoints ────── */
@media (max-width: 900px) {
  .products-grid { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 500px) {
  .products-grid { grid-template-columns: 1fr; }
}

/* ── 5. Hero — better intermediate breakpoint ──────────────── */
@media (max-width: 860px) {
  .hero-terminal { display: none; }
  .hero-content  { max-width: 100%; }
}

/* ── 6. Stats bar — wrap nicer on mid screens ──────────────── */
@media (max-width: 900px) and (min-width: 601px) {
  .stats-grid { flex-wrap: wrap; gap: .75rem 0; }
  .stat-item  { flex: 0 0 33.333%; padding: .5rem; }
  .stat-sep   { display: none; }
}

/* ── 7. Case studies row — 1 col on mobile ─────────────────── */
@media (max-width: 640px) {
  .cases-row { grid-template-columns: 1fr; }
}

/* ── 8. Trust grid — 2 col down to 500px, then 1 ──────────── */
@media (max-width: 500px) {
  .trust-grid { grid-template-columns: 1fr; }
}

/* ── 9. Footer grid better breakdown ──────────────────────── */
@media (max-width: 860px) {
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 2rem; }
}
@media (max-width: 500px) {
  .footer-grid { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; text-align: center; gap: .75rem; }
}

/* ── 10. Inner page docs layout ────────────────────────────── */
@media (max-width: 860px) {
  .docs-layout {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  .docs-sidebar { position: static; }
}

/* ── 11. Blog post layout ──────────────────────────────────── */
@media (max-width: 860px) {
  .post-layout {
    grid-template-columns: 1fr;
    gap: 2rem;
    padding: 2rem 0 4rem;
  }
  .post-sidebar { position: static; }
}

/* ── 12. Announcement bar on mobile ───────────────────────── */
@media (max-width: 640px) {
  #announce-bar { font-size: .72rem; gap: .5rem; padding: .5rem 3rem .5rem 1rem; }
  #announce-bar .announce-text { justify-content: center; flex: 1; }
}

/* ── 13. Container padding on small screens ────────────────── */
@media (max-width: 480px) {
  .container { padding: 0 1rem; }
}

/* ── 14. Manifesto pillars on tablet ───────────────────────── */
@media (max-width: 860px) {
  .manifesto-pillars { grid-template-columns: 1fr; gap: 1rem; }
}

/* ── 15. Service blocks (studio.html) ─────────────────────── */
@media (max-width: 768px) {
  .service-block,
  .service-block.flip {
    grid-template-columns: 1fr;
    direction: ltr;
    gap: 2rem;
    padding: 2.5rem 0;
  }
  .service-block.flip > * { direction: ltr; }
}

/* ── Hero: reduce display-xl so "Infrastructura" doesn't overflow ─ */
.display-xl {
  font-size: clamp(2.25rem, 5.5vw, 5rem) !important;
  line-height: 1.08 !important;
}

/* ── Hero: two-column grid so terminal doesn't overlap text ─────── */
@media (min-width: 1025px) {
  .hero-content {
    display: grid !important;
    grid-template-columns: 1fr 360px !important;
    align-items: center !important;
    gap: 3rem !important;
    max-width: 1280px !important;
  }
  /* Stack everything except terminal in the left column */
  .hero-content > *:not(.hero-terminal) {
    grid-column: 1 !important;
  }
  .hero-terminal {
    grid-column: 2 !important;
    grid-row: 1 / 5 !important;
    position: relative !important;
    right: auto !important;
    top: auto !important;
    transform: none !important;
    margin: 0 !important;
    width: 100% !important;
  }
}

/* ── On tablets/mobile, hide terminal to prevent overlap ────────── */
@media (max-width: 1024px) {
  .hero-terminal {
    display: none !important;
  }
  .hero-content {
    display: block !important;
    max-width: 100% !important;
    padding: 0 1.25rem !important;
  }
  .display-xl {
    font-size: clamp(2rem, 7vw, 3.5rem) !important;
  }
}

/* ── Products grid responsive ───────────────────────────────────── */
@media (max-width: 900px) {
  .products-grid {
    grid-template-columns: 1fr 1fr !important;
  }
}
@media (max-width: 600px) {
  .products-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ── Stats bar wraps on narrow screens ──────────────────────────── */
@media (max-width: 768px) {
  .stats-grid {
    flex-wrap: wrap !important;
    gap: 1.25rem 0 !important;
    justify-content: center !important;
  }
  .stats-grid .stat-sep {
    display: none !important;
  }
  .stats-grid .stat-item {
    min-width: 120px !important;
    text-align: center !important;
  }
}

/* ── Mobile CTA area at bottom of nav drawer ────────────────────── */
.nav-mobile-cta {
  display: none;
}
@media (max-width: 1024px) {
  .nav-links.mobile-open .nav-mobile-cta {
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    margin-top: auto;
    padding: 1.5rem 1.25rem 2rem;
    border-top: 1px solid rgba(255,255,255,0.07);
  }
  .nav-mobile-contact {
    text-align: center;
    font-size: 0.8rem;
    color: rgba(136,136,170,0.6);
  }
  .nav-mobile-contact a {
    color: var(--neon-cyan);
    text-decoration: none;
  }
}

/* ── Footer columns stack on mobile ────────────────────────────── */
@media (max-width: 640px) {
  .footer-grid,
  .footer-cols {
    grid-template-columns: 1fr !important;
    gap: 2rem !important;
  }
  .footer-bottom {
    flex-direction: column !important;
    gap: 0.75rem !important;
    text-align: center !important;
  }
}

/* ── Blog grid single column on mobile ──────────────────────────── */
@media (max-width: 640px) {
  .blog-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ── Section padding on small screens ──────────────────────────── */
@media (max-width: 640px) {
  .section {
    padding: 3rem 1rem !important;
  }
  .container {
    padding: 0 1rem !important;
  }
}

/* ── Drawer animation ───────────────────────────────────────────── */
@keyframes drawerIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Tighten home hero — 100vh creates unnecessary blank space ── */
.hero {
  min-height: auto !important;
  padding-top: calc(var(--nav-h) + 3.5rem) !important;
  padding-bottom: 4rem !important;
}

/* ── Tighten page heroes on inner pages ─────────────────────── */
.page-hero {
  padding-top: calc(var(--nav-h) + 2.5rem) !important;
  padding-bottom: 3rem !important;
}

/* ── Product detail hero — reduce top padding ────────────── */
.product-hero-split {
  padding-top: calc(var(--nav-h) + 2.5rem) !important;
  padding-bottom: 3.5rem !important;
}

/* ── Tighten global section padding — was clamp(5rem,10vw,9rem) ── */
section {
  padding: clamp(3rem, 5vw, 5rem) 0 !important;
}

/* Keep stats/marquee/cta bands at their own compact padding */
.stats-bar,
.marquee-bar,
.announce-bar {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

/* ── Reveal animation: smoother easing curve ────────────────────────── */
/* Override the default ease-out with a natural spring-like curve */
.reveal {
  transition: opacity 0.55s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.55s cubic-bezier(0.22, 1, 0.36, 1) !important;
  will-change: opacity, transform;
}

/* Tighten reveal delays — 0.1s steps are fine, cap at 5 */
.reveal-delay-1 { transition-delay: 0.08s !important; }
.reveal-delay-2 { transition-delay: 0.16s !important; }
.reveal-delay-3 { transition-delay: 0.24s !important; }
.reveal-delay-4 { transition-delay: 0.32s !important; }
.reveal-delay-5 { transition-delay: 0.40s !important; }

/* ── prefers-reduced-motion: respect user OS setting ────────────────── */
@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;
    transition: none !important;
    will-change: auto !important;
  }
}

/* ── Improve card hover transition — add smooth transition property ── */
.hud-card {
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1),
              border-color 0.22s ease,
              box-shadow 0.22s ease !important;
}

/* ── Button press feedback ──────────────────────────────────────────── */
.btn:active {
  transform: translateY(1px) scale(0.98);
  transition-duration: 0.08s !important;
}

/* ── Improve image rendering ────────────────────────────────────────── */
img {
  image-rendering: auto;
}

/* ── Improve scrollbar styling for Webkit ───────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-deep, #08080f);
}
::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.12);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.22);
}

/* ── Improve nav link hover transition ──────────────────────────────── */
.nav-link {
  transition: color 0.18s ease, opacity 0.18s ease !important;
}

/* ── Form input focus ring — more visible ───────────────────────────── */
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: 2px solid rgba(92, 80, 214, 0.6) !important;
  outline-offset: 0 !important;
  box-shadow: 0 0 0 4px rgba(92, 80, 214, 0.15) !important;
}

/* ── Prevent orphan words on headings ───────────────────────────────── */
.display-xl,
.display-lg,
.display-md,
.display-sm {
  text-wrap: balance;
}

/* ── Improve paragraph readability ──────────────────────────────────── */
p, .body-md, .body-sm {
  text-wrap: pretty;
}

/* ── Smooth page-level scroll ───────────────────────────────────────── */
html {
  scroll-behavior: smooth;
}

/* ── Skip-to-content link for keyboard users ────────────────────────── */
.skip-to-content {
  position: absolute;
  top: -40px;
  left: 1rem;
  background: var(--neon-cyan, #42b7fa);
  color: #000;
  padding: .5rem 1rem;
  border-radius: 0 0 6px 6px;
  font-weight: 700;
  font-size: .875rem;
  z-index: 9999;
  transition: top 0.2s ease;
}
.skip-to-content:focus {
  top: 0;
}
