/**
 * mobile-responsive.css — THv2 Comprehensive Mobile-First Responsive System
 * Covers 86 pages. Prefixes: .thv2- .mob-
 * Breakpoints: --mob:480px --tab:768px --lap:1024px --desk:1280px
 * Design tokens: --bg:#06090F --gold:#D4A853 --accent:#4CC2FF --text:#E8EDF5
 */

/* ============================================================
   1. BASE MOBILE RESETS
   ============================================================ */

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  box-sizing: border-box;
}

*,
*::before,
*::after {
  box-sizing: inherit;
}

body {
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img,
video,
canvas,
svg {
  max-width: 100%;
  height: auto;
  display: block;
}

input,
textarea,
select,
button {
  -webkit-appearance: none;
  appearance: none;
  font-family: inherit;
}

/* Prevent zoom on iOS input focus */
@media (max-width: 767px) {
  input,
  textarea,
  select {
    font-size: 16px;
  }
}

/* ============================================================
   2. RESPONSIVE CONTAINERS
   ============================================================ */

.thv2-container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 16px;
}

@media (min-width: 768px) {
  .thv2-container {
    padding: 0 24px;
  }
}

@media (min-width: 1024px) {
  .thv2-container {
    padding: 0 40px;
  }
}

.thv2-container--narrow {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 16px;
}

@media (min-width: 768px) {
  .thv2-container--narrow {
    padding: 0 24px;
  }
}

.thv2-container--wide {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 16px;
}

@media (min-width: 768px) {
  .thv2-container--wide {
    padding: 0 32px;
  }
}

@media (min-width: 1280px) {
  .thv2-container--wide {
    padding: 0 48px;
  }
}

/* ============================================================
   3. RESPONSIVE TYPOGRAPHY
   ============================================================ */

body {
  font-size: clamp(13px, 1.5vw, 15px);
  line-height: 1.6;
  color: #E8EDF5;
}

.sota-display {
  font-size: clamp(1.5rem, 6vw, 3.5rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.sota-headline {
  font-size: clamp(1.125rem, 3.5vw, 1.75rem);
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.sota-title {
  font-size: clamp(1rem, 2.5vw, 1.375rem);
  line-height: 1.3;
}

.sota-subtitle {
  font-size: clamp(0.875rem, 1.8vw, 1.0625rem);
  line-height: 1.45;
}

.sota-body {
  font-size: clamp(0.8125rem, 1.5vw, 0.9375rem);
  line-height: 1.6;
}

.sota-caption {
  font-size: clamp(0.6875rem, 1.2vw, 0.8125rem);
  line-height: 1.5;
}

.sota-label {
  font-size: clamp(0.625rem, 1vw, 0.75rem);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.thv2-text-xl {
  font-size: clamp(1.25rem, 4vw, 2.25rem);
}

.thv2-text-lg {
  font-size: clamp(1rem, 2.8vw, 1.5rem);
}

.thv2-text-md {
  font-size: clamp(0.875rem, 1.8vw, 1.0625rem);
}

.thv2-text-sm {
  font-size: clamp(0.75rem, 1.4vw, 0.875rem);
}

.thv2-text-xs {
  font-size: clamp(0.625rem, 1.1vw, 0.75rem);
}

/* ============================================================
   4. CARDS ON MOBILE
   ============================================================ */

@media (max-width: 767px) {
  .card,
  .panel,
  .tile,
  .glass-card,
  .sota-glass-card,
  .thv2-card,
  .mob-card {
    border-radius: 8px;
    padding: 12px;
  }

  .sota-grid-2,
  .sota-grid-3,
  .sota-grid-4,
  .thv2-grid-2,
  .thv2-grid-3,
  .thv2-grid-4 {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .sota-grid-auto,
  .thv2-grid-auto {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  /* Two-column grid at 480px+ for compact cards */
  @media (min-width: 480px) {
    .sota-grid-2,
    .thv2-grid-2 {
      grid-template-columns: repeat(2, 1fr);
    }
  }

  .card--featured,
  .sota-glass-card--featured {
    padding: 16px;
    border-radius: 10px;
  }

  .card__title {
    font-size: 0.9375rem;
    margin-bottom: 6px;
  }

  .card__meta {
    font-size: 0.75rem;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .sota-grid-3,
  .thv2-grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }

  .sota-grid-4,
  .thv2-grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .sota-grid-2,
  .thv2-grid-2 {
    grid-template-columns: repeat(2, 1fr);
  }

  .sota-grid-3,
  .thv2-grid-3 {
    grid-template-columns: repeat(3, 1fr);
  }

  .sota-grid-4,
  .thv2-grid-4 {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ============================================================
   5. TABLES ON MOBILE
   ============================================================ */

.data-table-wrap {
  width: 100%;
}

@media (max-width: 767px) {
  .data-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
    /* Scroll hint gradient */
    background:
      linear-gradient(to right, rgba(6, 9, 15, 1) 0%, transparent 5%),
      linear-gradient(to left, rgba(6, 9, 15, 1) 0%, transparent 5%);
    background-attachment: local, local;
  }

  .data-table {
    min-width: 600px;
    font-size: 12px;
  }

  .data-table th,
  .data-table td {
    padding: 8px 10px;
    white-space: nowrap;
  }

  .data-table th {
    font-size: 10px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  /* Pinned first column on mobile */
  .data-table--pinned th:first-child,
  .data-table--pinned td:first-child {
    position: sticky;
    left: 0;
    background: #0D1117;
    z-index: 1;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.4);
  }

  /* Stack table pattern for simple tables */
  .data-table--stack {
    min-width: unset;
  }

  .data-table--stack thead {
    display: none;
  }

  .data-table--stack tr {
    display: block;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    margin-bottom: 8px;
    padding: 10px;
  }

  .data-table--stack td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    white-space: normal;
    font-size: 12px;
    border: none;
  }

  .data-table--stack td::before {
    content: attr(data-label);
    font-size: 10px;
    color: #8B95A8;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex-shrink: 0;
    margin-right: 12px;
  }
}

/* ============================================================
   6. NAV ON MOBILE
   ============================================================ */

@media (max-width: 767px) {
  .thv2-nav,
  .nav-bar,
  .elite-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    height: 60px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    background: rgba(6, 9, 15, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0 8px;
    z-index: 900;
  }

  .thv2-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    font-size: 10px;
    padding: 6px 12px;
    color: #8B95A8;
    cursor: pointer;
    border-radius: 8px;
    transition: color 150ms ease;
    text-decoration: none;
    min-height: 44px;
    min-width: 44px;
    justify-content: center;
  }

  .thv2-nav-item.active,
  .thv2-nav-item:hover {
    color: #D4A853;
  }

  .thv2-nav-item.active .thv2-nav-icon,
  .thv2-nav-item:hover .thv2-nav-icon {
    color: #D4A853;
  }

  .thv2-nav-icon {
    font-size: 18px;
    line-height: 1;
    color: inherit;
  }

  .thv2-nav-label {
    font-size: 10px;
    line-height: 1;
    color: inherit;
  }

  /* Hide desktop top nav links on mobile */
  .thv2-top-nav,
  .elite-nav-desktop,
  .nav-desktop-links {
    display: none;
  }

  /* Mobile top header bar */
  .thv2-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 52px;
    background: rgba(6, 9, 15, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 850;
  }
}

@media (min-width: 768px) {
  .thv2-nav,
  .nav-bar,
  .elite-nav {
    position: sticky;
    top: 0;
    height: auto;
    border-top: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(6, 9, 15, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 0 24px;
    z-index: 900;
    justify-content: flex-start;
    gap: 4px;
  }

  .thv2-nav-item {
    flex-direction: row;
    font-size: 13px;
    padding: 10px 14px;
    gap: 6px;
  }

  .mob-nav-only {
    display: none;
  }
}

/* ============================================================
   7. PAGE PADDING ON MOBILE
   ============================================================ */

@media (max-width: 767px) {
  main,
  .page-content,
  .sd-page,
  .thv2-page,
  .mob-page {
    padding-bottom: 80px !important;
    padding-top: 12px;
  }

  body {
    padding-bottom: 60px;
  }

  /* Account for fixed header */
  .thv2-has-header main,
  .thv2-has-header .page-content {
    padding-top: 64px !important;
  }

  /* Section spacing reduction */
  .sota-section,
  .thv2-section {
    margin-bottom: 24px;
  }

  .sota-section + .sota-section,
  .thv2-section + .thv2-section {
    margin-top: 0;
  }

  /* Hero sections on mobile */
  .sota-hero,
  .thv2-hero {
    padding: 24px 0 20px;
    min-height: auto;
  }

  /* Reduce inner spacing */
  .sota-inner,
  .thv2-inner {
    padding: 16px;
  }

  /* Page title adjustments */
  .page-title,
  .thv2-page-title {
    font-size: clamp(1.125rem, 5vw, 1.5rem);
    margin-bottom: 4px;
  }

  .page-subtitle,
  .thv2-page-subtitle {
    font-size: 0.8125rem;
    color: #8B95A8;
  }
}

/* ============================================================
   8. FLOATING ACTION BUTTON
   ============================================================ */

.thv2-fab {
  position: fixed;
  bottom: 80px;
  right: 16px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #D4A853, #B8902A);
  color: #0a0d12;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 4px 16px rgba(212, 168, 83, 0.4);
  z-index: 890;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease;
  border: none;
  text-decoration: none;
}

.thv2-fab:active {
  transform: scale(0.93);
  box-shadow: 0 2px 8px rgba(212, 168, 83, 0.3);
}

.thv2-fab:hover {
  box-shadow: 0 6px 24px rgba(212, 168, 83, 0.5);
  transform: translateY(-1px);
}

.thv2-fab--accent {
  background: linear-gradient(135deg, #4CC2FF, #2A9FE0);
  box-shadow: 0 4px 16px rgba(76, 194, 255, 0.4);
}

.thv2-fab--accent:hover {
  box-shadow: 0 6px 24px rgba(76, 194, 255, 0.5);
}

/* Hide FAB on desktop unless explicitly shown */
@media (min-width: 768px) {
  .thv2-fab {
    bottom: 24px;
    right: 24px;
  }

  .thv2-fab--mob-only {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .thv2-fab {
    transition: none;
  }

  .thv2-fab:active {
    transform: none;
  }

  .thv2-fab:hover {
    transform: none;
  }
}

/* ============================================================
   9. TOUCH TARGETS
   ============================================================ */

@media (max-width: 767px) {
  button,
  a,
  [role="button"],
  [role="link"],
  label[for],
  .thv2-btn,
  .mob-btn {
    min-height: 44px;
    min-width: 44px;
  }

  .sota-btn,
  .thv2-btn {
    padding: 12px 20px;
    font-size: 0.9375rem;
    border-radius: 8px;
  }

  .sota-btn--sm,
  .thv2-btn--sm {
    padding: 10px 16px;
    font-size: 0.875rem;
    min-height: 40px;
  }

  .sota-btn--lg,
  .thv2-btn--lg {
    padding: 14px 24px;
    font-size: 1rem;
  }

  /* Icon-only buttons */
  .thv2-btn--icon {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Form controls */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="search"],
  input[type="tel"],
  input[type="url"],
  select,
  textarea {
    min-height: 44px;
    padding: 10px 12px;
    border-radius: 8px;
    width: 100%;
  }

  /* Checkbox and radio */
  input[type="checkbox"],
  input[type="radio"] {
    width: 20px;
    height: 20px;
    min-width: 20px;
    min-height: 20px;
    cursor: pointer;
  }

  /* Inline link tap targets */
  a:not(.thv2-btn):not(.sota-btn):not(.thv2-nav-item) {
    padding: 2px 0;
  }
}

/* ============================================================
   10. SCROLLBAR (DESKTOP ONLY)
   ============================================================ */

@media (min-width: 768px) {
  ::-webkit-scrollbar {
    width: 6px;
    height: 6px;
  }

  ::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
  }

  ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 3px;
  }

  ::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
  }

  ::-webkit-scrollbar-corner {
    background: transparent;
  }
}

/* ============================================================
   11. LAYOUT UTILITIES
   ============================================================ */

/* Flex helpers */
.thv2-flex {
  display: flex;
}

.thv2-flex-col {
  display: flex;
  flex-direction: column;
}

@media (max-width: 767px) {
  .mob-flex-col {
    flex-direction: column !important;
  }

  .mob-flex-row {
    flex-direction: row !important;
  }

  .mob-hidden {
    display: none !important;
  }

  .mob-block {
    display: block !important;
  }

  .mob-full-width {
    width: 100% !important;
  }

  .mob-text-center {
    text-align: center !important;
  }

  .mob-gap-sm {
    gap: 8px !important;
  }

  .mob-gap-md {
    gap: 12px !important;
  }

  .mob-p-sm {
    padding: 8px !important;
  }

  .mob-p-md {
    padding: 12px !important;
  }

  .mob-mt-0 {
    margin-top: 0 !important;
  }

  .mob-mb-sm {
    margin-bottom: 8px !important;
  }
}

@media (min-width: 768px) {
  .desk-hidden {
    display: none !important;
  }

  .tab-flex-row {
    flex-direction: row !important;
  }
}

/* ============================================================
   12. CHART AND DATA VIZ ON MOBILE
   ============================================================ */

@media (max-width: 767px) {
  .chart-wrap,
  .thv2-chart-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .chart-container,
  .thv2-chart-container {
    min-width: 320px;
    height: 200px;
  }

  .chart-container--tall {
    height: 260px;
  }

  .chart-container--short {
    height: 160px;
  }

  /* Legend below chart on mobile */
  .chart-legend,
  .thv2-chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    font-size: 11px;
  }

  .chart-legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
  }

  /* Stat callouts */
  .stat-grid,
  .thv2-stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .stat-item,
  .thv2-stat-item {
    padding: 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
  }

  .stat-value,
  .thv2-stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.2;
  }

  .stat-label,
  .thv2-stat-label {
    font-size: 10px;
    color: #8B95A8;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 2px;
  }
}

/* ============================================================
   13. MODAL / DRAWER ON MOBILE
   ============================================================ */

@media (max-width: 767px) {
  .thv2-modal,
  .sota-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .thv2-modal-inner,
  .sota-modal-inner {
    min-height: 100vh;
    padding: 16px 16px 80px;
    display: flex;
    flex-direction: column;
  }

  /* Bottom sheet pattern */
  .thv2-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: #0D1117;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px 16px 0 0;
    padding: 16px 16px 32px;
    max-height: 90vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transform: translateY(0);
    transition: transform 300ms cubic-bezier(0.32, 0.72, 0, 1);
  }

  .thv2-sheet--closed {
    transform: translateY(100%);
  }

  .thv2-sheet-handle {
    width: 36px;
    height: 4px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
    margin: 0 auto 16px;
  }

  @media (prefers-reduced-motion: reduce) {
    .thv2-sheet {
      transition: none;
    }
  }
}

/* ============================================================
   14. FILTER / SORT BAR ON MOBILE
   ============================================================ */

@media (max-width: 767px) {
  .thv2-filter-bar,
  .sota-filter-bar {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 16px;
    margin: 0 -16px;
    scrollbar-width: none;
  }

  .thv2-filter-bar::-webkit-scrollbar {
    display: none;
  }

  .thv2-filter-chip,
  .sota-filter-chip {
    flex-shrink: 0;
    padding: 7px 14px;
    border-radius: 20px;
    font-size: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #8B95A8;
    cursor: pointer;
    white-space: nowrap;
    min-height: 34px;
    display: flex;
    align-items: center;
    transition: background 150ms, color 150ms, border-color 150ms;
  }

  .thv2-filter-chip.active,
  .sota-filter-chip.active {
    background: rgba(212, 168, 83, 0.12);
    border-color: rgba(212, 168, 83, 0.4);
    color: #D4A853;
  }

  @media (prefers-reduced-motion: reduce) {
    .thv2-filter-chip,
    .sota-filter-chip {
      transition: none;
    }
  }
}

/* ============================================================
   15. DASHBOARD METRICS ON MOBILE
   ============================================================ */

@media (max-width: 767px) {
  /* Horizontal scroll metric row */
  .thv2-metric-row {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 16px;
    margin: 0 -16px;
    scrollbar-width: none;
  }

  .thv2-metric-row::-webkit-scrollbar {
    display: none;
  }

  .thv2-metric-card {
    flex-shrink: 0;
    min-width: 120px;
    padding: 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
  }

  /* Compact ticker tape */
  .thv2-ticker,
  .sota-ticker {
    font-size: 11px;
    padding: 6px 0;
    white-space: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .thv2-ticker::-webkit-scrollbar {
    display: none;
  }
}

/* ============================================================
   16. PRINT / ACCESSIBILITY OVERRIDES
   ============================================================ */

@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;
  }
}

@media (forced-colors: active) {
  .thv2-fab,
  .sota-btn,
  .thv2-btn {
    border: 2px solid ButtonText;
  }
}

/* High-contrast mode */
@media (prefers-contrast: high) {
  .thv2-nav-item {
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
  }

  .thv2-filter-chip,
  .sota-filter-chip {
    border-width: 2px;
  }
}

/* MODULE_READY=true */
