/* ============================================================
   KING AUTOMOTIVE — Mobile Enhancement & Smooth UX Layer
   Loaded after style.css — safe to override
   ============================================================ */

/* ── Smooth scroll & base feel ── */
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Prevent blue flash on tap everywhere */
* {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

/* Allow text selection on readable content */
p, li, span, h1, h2, h3, h4, h5, td, th {
  -webkit-user-select: text;
  user-select: text;
}

/* ── Page entrance animation ── */
@keyframes kingFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.page {
  animation: kingFadeIn .45s ease both;
}

/* ── Scroll-reveal: set by JS ── */
.king-reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity .55s cubic-bezier(.22,1,.36,1), transform .55s cubic-bezier(.22,1,.36,1);
  will-change: opacity, transform;
}

.king-reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.king-reveal-left {
  opacity: 0;
  transform: translateX(-28px);
  transition: opacity .55s cubic-bezier(.22,1,.36,1), transform .55s cubic-bezier(.22,1,.36,1);
}
.king-reveal-left.visible { opacity: 1; transform: translateX(0); }

.king-reveal-right {
  opacity: 0;
  transform: translateX(28px);
  transition: opacity .55s cubic-bezier(.22,1,.36,1), transform .55s cubic-bezier(.22,1,.36,1);
}
.king-reveal-right.visible { opacity: 1; transform: translateX(0); }

/* stagger children */
.king-reveal:nth-child(2) { transition-delay: .08s; }
.king-reveal:nth-child(3) { transition-delay: .16s; }
.king-reveal:nth-child(4) { transition-delay: .24s; }
.king-reveal:nth-child(5) { transition-delay: .32s; }
.king-reveal:nth-child(6) { transition-delay: .40s; }

/* ── Touch-friendly tap targets ── */
a, button, [role="button"],
.btn-primary, .btn-secondary, .btn-connect,
.btn-stake, .hamburger, .faq-question,
.wallet-token-row, .nav-menu a, .knav a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

/* Fix inline anchors that shouldn't stretch */
.footer-col a, .nav-menu a, .knav a {
  min-height: 40px;
}

/* ── Button press feedback ── */
.btn-primary:active,
.btn-secondary:active,
.btn-connect:active,
.btn-stake:active {
  transform: scale(0.96) translateY(0) !important;
  transition: transform .1s ease !important;
}

/* ── Smooth card interactions ── */
.farm-card,
.stake-card,
.nft-card,
.trust-badge,
.faq-item,
.gallery-item {
  transition: transform .35s cubic-bezier(.22,1,.36,1),
              box-shadow .35s cubic-bezier(.22,1,.36,1),
              border-color .35s ease !important;
  will-change: transform;
}

/* ── Better scrollable containers ── */
.nav-menu,
.knav-body,
.wallet-tokens {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* ── Images — always crisp & contained ── */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ── Mobile type scale ── */
@media (max-width: 480px) {
  h1 { font-size: clamp(1.6rem, 7vw, 2.4rem) !important; }
  h2 { font-size: clamp(1.2rem, 5vw, 1.8rem) !important; }
  h3 { font-size: clamp(1rem, 4vw, 1.4rem) !important; }
  p, li { font-size: .98rem; line-height: 1.65; }

  .section { padding: 2rem 0; }
  .container { padding: 0 1rem; }
  .page { padding-top: 70px; }
}

/* ── Card grid — always single column on phones ── */
@media (max-width: 480px) {
  .farms-grid,
  .staking-grid,
  .nft-grid,
  .trust-grid,
  .gallery-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem;
  }

  .tokenomics-legend {
    grid-template-columns: 1fr 1fr;
    min-width: 0;
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
    gap: .75rem;
  }

  .hero-actions .btn-primary,
  .hero-actions .btn-secondary {
    justify-content: center;
    width: 100%;
  }

  .instrument-cluster {
    gap: .6rem;
  }

  .gauge {
    min-width: 80px;
    padding: .6rem .8rem;
  }

  .gauge-value {
    font-size: .9rem;
  }
}

/* ── Footer — stack on mobile ── */
@media (max-width: 600px) {
  .footer-content {
    flex-direction: column;
    gap: 1.5rem;
  }
  .footer-col { width: 100%; }
}

/* ── Better inputs on mobile ── */
input, textarea, select {
  font-size: 16px !important; /* prevents iOS zoom on focus */
  border-radius: 8px;
}

/* ── Smooth scrollbar (desktop) ── */
@media (hover: hover) {
  ::-webkit-scrollbar { width: 5px; }
  ::-webkit-scrollbar-track { background: #0d0d0d; }
  ::-webkit-scrollbar-thumb { background: #c9a84c; border-radius: 3px; }
  ::-webkit-scrollbar-thumb:hover { background: #e8c96a; }
}

/* ── Ripple effect (applied by JS) ── */
.king-ripple-host { position: relative; overflow: hidden; }

@keyframes kingRipple {
  from { transform: scale(0); opacity: .35; }
  to   { transform: scale(3); opacity: 0; }
}

.king-ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(212, 160, 23, 0.45);
  width: 60px; height: 60px;
  margin-top: -30px; margin-left: -30px;
  pointer-events: none;
  animation: kingRipple .55s ease-out forwards;
  z-index: 999;
}

/* ── Bottom nav bar — larger touch targets ── */
#kbnav a, #kbnav button {
  min-height: 52px;
  padding-top: 6px;
  padding-bottom: 6px;
}

/* ── Smooth focus rings ── */
:focus-visible {
  outline: 2px solid #c9a84c;
  outline-offset: 3px;
  border-radius: 6px;
}

/* ── Transition everything interactive ── */
a, button {
  transition: color .2s ease, background .2s ease, opacity .2s ease, transform .2s ease;
}

/* ── Loading shimmer for images ── */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position:  400px 0; }
}

img[loading="lazy"]:not([src]) {
  background: linear-gradient(90deg, #1a1a1a 25%, #2a2a2a 50%, #1a1a1a 75%);
  background-size: 400px 100%;
  animation: shimmer 1.4s infinite linear;
  min-height: 80px;
}

/* ── Tablet tweaks (600–1024px) ── */
@media (min-width: 601px) and (max-width: 1024px) {
  .farms-grid { grid-template-columns: repeat(2, 1fr); }
  .staking-grid { grid-template-columns: repeat(2, 1fr); }
  .container { padding: 0 1.25rem; }
}

/* ── Prevent horizontal overflow anywhere ── */
body, .page, .section, .container {
  max-width: 100vw;
  overflow-x: hidden;
}
