/* Gromche.fun — mobile-first enhancements (loaded on all pages) */

:root {
  --mobile-nav-width: min(320px, 88vw);
  --touch-min: 44px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}

body.mobile-nav-open {
  overflow: hidden;
  touch-action: none;
}

/* Prevent iOS zoom on focus */
@media (max-width: 768px) {
  input,
  select,
  textarea,
  button {
    font-size: 16px;
  }
}

/* ——— Hamburger button ——— */
.mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--touch-min);
  min-width: var(--touch-min);
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(20, 20, 30, 0.9);
  color: #fff;
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.mobile-menu-btn__bars {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 18px;
}

.mobile-menu-btn__bars span {
  display: block;
  height: 2px;
  border-radius: 2px;
  background: #c084fc;
  transition: transform 0.2s, opacity 0.2s;
}

.mobile-menu-btn[aria-expanded="true"] .mobile-menu-btn__bars span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.mobile-menu-btn[aria-expanded="true"] .mobile-menu-btn__bars span:nth-child(2) {
  opacity: 0;
}
.mobile-menu-btn[aria-expanded="true"] .mobile-menu-btn__bars span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.mobile-nav-overlay {
  position: fixed;
  inset: 0;
  z-index: 998;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
}

.mobile-nav-overlay[hidden] {
  display: none !important;
}

/* ——— Public site header (index, releases) ——— */
@media (max-width: 768px) {
  .site-header {
    flex-wrap: nowrap;
    gap: 12px;
    padding: 12px 16px;
    padding-top: calc(12px + var(--safe-top));
  }

  .site-header .mobile-menu-btn {
    display: inline-flex;
    flex-shrink: 0;
    margin-left: auto;
  }

  .site-header .nav-links {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 999;
    width: var(--mobile-nav-width);
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    padding: calc(20px + var(--safe-top)) 20px calc(24px + var(--safe-bottom));
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    background: rgba(14, 14, 22, 0.98);
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: -12px 0 40px rgba(0, 0, 0, 0.45);
    overflow-y: auto;
    transform: translateX(105%);
    transition: transform 0.28s ease;
    visibility: hidden;
  }

  .site-header .nav-links.is-open {
    transform: translateX(0);
    visibility: visible;
  }

  .site-header .nav-links > a {
    display: block;
    padding: 14px 16px;
    border-radius: 12px;
    font-size: 1rem;
    color: #e0e0e0;
  }

  .site-header .nav-links > a:not(.btn):hover,
  .site-header .nav-links > a:not(.btn):active {
    background: rgba(192, 132, 252, 0.12);
    color: #fff;
  }

  .site-header .nav-links .btn {
    width: 100%;
    text-align: center;
    margin-top: 8px;
    min-height: var(--touch-min);
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .site-header .nav-links .btn-outline {
    margin-top: 4px;
  }
}

/* ——— Landing page mobile ——— */
@media (max-width: 768px) {
  .hero {
    padding: 40px 16px 32px;
  }

  .hero h1 {
    font-size: 2rem;
    line-height: 1.2;
  }

  .hero-lead {
    font-size: 1rem;
  }

  .hero-sub {
    font-size: 0.92rem;
  }

  .hero-buttons {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .hero-buttons .btn {
    width: 100%;
  }

  .hero-stats {
    flex-direction: column;
    gap: 12px;
  }

  .section {
    padding-left: 16px;
    padding-right: 16px;
  }

  .section-title {
    font-size: 1.5rem;
  }

  .features-grid,
  .steps-grid,
  .pricing-grid {
    grid-template-columns: 1fr;
  }

  .platform-logos {
    justify-content: center;
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 20px;
  }

  .faq-item summary {
    padding: 14px 0;
    font-size: 0.95rem;
  }
}

@media (max-width: 480px) {
  .hero h1 {
    font-size: 1.75rem;
  }

  .release-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }

  .footer-grid {
    grid-template-columns: 1fr;
  }

  .btn-lg {
    padding: 14px 20px;
    font-size: 1rem;
  }
}

/* Dashboard mobile: see dashboard-mobile.css */

/* ——— Tables → cards on mobile ——— */
@media (max-width: 768px) {
  .table-mobile-cards {
    display: block;
    background: transparent;
    border-radius: 0;
    overflow: visible;
  }

  .table-mobile-cards thead {
    display: none;
  }

  .table-mobile-cards tbody {
    display: block;
  }

  .table-mobile-cards tr {
    display: block;
    background: rgba(20, 20, 30, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 12px;
  }

  .table-mobile-cards td {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border: none;
    text-align: right;
    font-size: 0.92rem;
  }

  .table-mobile-cards td::before {
    content: attr(data-label);
    font-weight: 600;
    color: #c084fc;
    text-align: left;
    flex-shrink: 0;
    max-width: 42%;
    font-size: 0.82rem;
  }

  .table-mobile-cards td:not([data-label])::before,
  .table-mobile-cards td[data-label=""]::before {
    display: none;
  }

  .table-mobile-cards td.actions-cell {
    flex-direction: column;
    align-items: stretch;
    padding-top: 12px;
    margin-top: 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
  }

  .table-mobile-cards td.actions-cell::before {
    margin-bottom: 4px;
  }

  .table-mobile-cards .btn-sm,
  .table-mobile-cards .btn {
    display: block;
    width: 100%;
    text-align: center;
    margin: 4px 0 0;
    min-height: var(--touch-min);
    line-height: 1.2;
    padding: 12px 16px;
  }
}

/* ——— Admin ——— */
body.admin-page {
  font-family: Inter, system-ui, sans-serif;
  padding: 20px;
  padding-top: calc(20px + var(--safe-top));
  padding-bottom: calc(20px + var(--safe-bottom));
}

@media (max-width: 768px) {
  body.admin-page {
    padding: 16px !important;
    padding-top: calc(16px + var(--safe-top)) !important;
    padding-bottom: calc(24px + var(--safe-bottom)) !important;
  }

  body.admin-page .container {
    max-width: none;
  }

  body.admin-page h1 {
    font-size: 1.45rem;
  }

  .admin-nav {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 8px;
    margin-bottom: 16px !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .admin-nav::-webkit-scrollbar {
    display: none;
  }

  .admin-nav a,
  .admin-nav span {
    white-space: nowrap;
    flex-shrink: 0;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
  }

  .admin-nav a.active {
    background: rgba(192, 132, 252, 0.2);
  }

  .filter-bar {
    overflow-x: auto;
    flex-wrap: nowrap !important;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
  }

  .filter-bar a {
    white-space: nowrap;
    flex-shrink: 0;
  }

  .search-bar {
    flex-direction: column;
  }

  .search-bar input,
  .search-bar button {
    width: 100%;
    min-height: var(--touch-min);
  }

  .admin-card {
    padding: 18px 16px;
  }

  .admin-grid {
    grid-template-columns: 1fr !important;
  }

  .actions {
    flex-direction: column;
    align-items: stretch;
  }

  .actions .btn {
    width: 100%;
    min-height: var(--touch-min);
    text-align: center;
  }

  .scan-preview iframe,
  .scan-preview img {
    max-height: 360px;
  }
}

/* ——— Release view ——— */
@media (max-width: 768px) {
  .release-page .container {
    padding: 16px 16px calc(32px + var(--safe-bottom));
  }

  .release-page .header {
    flex-direction: column;
    padding: 18px;
    gap: 16px;
  }

  .release-page .cover-wrap {
    width: 100%;
    max-width: 280px;
    margin: 0 auto;
  }

  .release-page .header-main h1 {
    font-size: 1.45rem;
  }

  .release-page .top-nav {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .release-page .top-nav span {
    display: none;
  }

  .release-page .header-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .release-page .header-actions .btn {
    width: 100%;
    text-align: center;
    min-height: var(--touch-min);
  }

  .release-page .grid-2 {
    grid-template-columns: 1fr;
  }

  .release-page table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .release-page .card {
    padding: 16px;
  }
}

/* ——— Auth pages ——— */
@media (max-width: 480px) {
  body.auth-page {
    padding: 20px 16px calc(24px + var(--safe-bottom));
  }

  .auth-card {
    padding: 22px 18px;
  }

  .auth-card h1 {
    font-size: 1.35rem;
  }

  .steps {
    flex-direction: column;
  }
}

/* Upload wizard: see upload-mobile.css */

/* ——— Multilink ——— */
@media (max-width: 480px) {
  .multilink-page {
    padding: 16px 12px calc(28px + var(--safe-bottom));
  }

  .multilink-page .platform-btn {
    min-height: var(--touch-min);
  }
}
