/* RYVEN Responsive Styles */
/* impeccable:resp 1 */

/* === Large Desktop (≥1400px) === */
@media (min-width: 1400px) {
  .nav-inner {
    padding: 0 44px;
  }
}

/* === Compact Desktop (1100–1399px) ===
   Tighten the desktop nav progressively; below 1100px the menu no longer
   fits beside the brand and actions, so the drawer takes over. */
@media (max-width: 1399px) {
  .nav-inner {
    padding: 0 28px;
    gap: var(--ryven-space-md);
  }

  .nav-menu {
    gap: 2px;
  }

  .nav-link {
    height: 88px;
    padding: 0 9px;
    font-size: 12.5px;
    letter-spacing: 0.02em;
  }

  .nav-link--parent i:not(.nav-chevron) {
    display: none;
  }

  .btn-nav {
    min-height: 40px;
    padding: var(--ryven-space-sm) var(--ryven-space-md);
    font-size: var(--ryven-text-xs);
  }

  .nav-search-input {
    width: 130px;
  }

  .nav-logo img {
    height: 44px;
    width: auto;
  }

  .nav-logo {
    gap: 10px;
  }

  .nav-logo-text {
    font-size: var(--ryven-text-lg);
  }
}

/* === Drawer threshold (<1100px) ===
   The full desktop nav cannot fit without crowding the brand; switch to
   the accessible mobile drawer before any overlap can occur. */
@media (max-width: 1099px) {
  .nav-menu {
    display: none;
  }

  /* Toggled drawer: drops below the bar as one column. */
  .nav-menu.active {
    display: flex;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    margin: 0;
    padding: var(--ryven-space-sm) var(--ryven-space-md) var(--ryven-space-md);
    background: rgba(16, 18, 20, 0.98);
    border-bottom: 1px solid var(--ryven-border-dim);
    box-shadow: var(--ryven-shadow-lg);
    z-index: var(--ryven-z-dropdown);
  }

  .nav-menu.active > li {
    position: static;
  }

  .nav-menu.active .nav-link {
    height: auto;
    min-height: 44px;
    padding: 10px var(--ryven-space-sm);
  }

  .nav-menu.active .nav-link--parent i:not(.nav-chevron) {
    display: inline;
  }

  .nav-menu.active .nav-dropdown {
    display: none;
    position: static;
    min-width: 0;
    margin: 0 0 0 var(--ryven-space-md);
    padding: 0 0 0 var(--ryven-space-md);
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    opacity: 1;
    transform: none;
  }

  .nav-item--has-dropdown.is-open .nav-dropdown,
  .nav-item--has-dropdown:focus-within .nav-dropdown {
    display: block;
  }

  .nav-toggle {
    display: flex;
  }

  .nav-user {
    display: none;
  }
}

/* === Tablet (768–1199px) === */
@media (max-width: 1199px) {
  .hero-title {
    font-size: clamp(2.25rem, 5vw, 3rem);
  }

  .hero-subtitle {
    font-size: var(--ryven-text-lg);
  }

  .character-header {
    flex-direction: column;
    text-align: center;
  }

  .character-stats {
    justify-content: center;
  }

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

  .footer-inner {
    grid-template-columns: repeat(2, 1fr);
  }

  .account-layout {
    grid-template-columns: 1fr;
  }

  .account-info-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* === Mobile (<768px) === */
@media (max-width: 767px) {
  :root {
    --ryven-space-lg: 16px;
    --ryven-space-xl: 24px;
    --ryven-space-2xl: 32px;
    --ryven-space-3xl: 48px;
  }

  body {
    padding-bottom: var(--ryven-mobile-bottom);
  }

  /* Navigation */
  .nav-inner {
    display: flex;
    flex-wrap: wrap;
    height: auto;
    min-height: 64px;
    padding: var(--ryven-space-sm) var(--ryven-space-md);
  }

  .nav-logo img {
    height: 40px;
    width: auto;
  }

  .nav-logo-text {
    display: none;
  }

  .nav-menu {
    display: none;
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--ryven-space-xs);
    padding: var(--ryven-space-sm) 0;
    border-top: 1px solid var(--ryven-border-dim);
    margin-top: var(--ryven-space-sm);
  }

  .nav-menu.active {
    display: flex;
  }

  .nav-menu > li {
    position: relative;
  }

  .nav-actions {
    display: none;
  }

  .nav-search {
    display: none;
  }

  .nav-toggle {
    display: flex;
  }

  /* Mobile dropdowns: expand inline */
  .nav-dropdown {
    display: none;
    position: static;
    min-width: 0;
    margin: 0;
    padding: 0 0 0 var(--ryven-space-md);
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    opacity: 1;
    transform: none;
  }

  .nav-item--has-dropdown.is-open .nav-dropdown {
    display: block;
  }

  .nav-dropdown-item {
    font-size: 12px;
    padding: 8px 12px;
  }

  .nav-dropdown-item i {
    font-size: 12px;
  }

  /* Hero */
  .hero {
    min-height: 420px;
    text-align: center;
  }

  .hero-banner {
    max-width: 75%;
    margin: 0 auto var(--ryven-space-lg);
  }

  .hero-content {
    max-width: 100%;
  }

  .hero-title {
    font-size: clamp(1.75rem, 8vw, 2.5rem);
    letter-spacing: 0.04em;
  }

  .hero-subtitle {
    font-size: var(--ryven-text-sm);
    max-width: 100%;
    line-height: 1.65;
  }

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

  .hero-actions .btn {
    width: 100%;
  }

  /* Status Strip */
  .status-strip {
    grid-template-columns: 1fr 1fr;
  }

  /* Grid */
  .grid-12 {
    grid-template-columns: 1fr;
  }

  .col-span-4,
  .col-span-8,
  .col-span-12 {
    grid-column: span 1;
  }

  /* Character */
  .character-header {
    padding: var(--ryven-space-md);
  }

  .character-avatar {
    width: 80px;
    height: 80px;
  }

  .character-info h1 {
    font-size: var(--ryven-text-2xl);
  }

  .character-stats {
    gap: var(--ryven-space-md);
  }

  /* Tables */
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Widget */
  .widget-body {
    padding: var(--ryven-space-md);
  }

  /* Highscores */
  .highscores-grid,
  .server-info-grid,
  .account-info-grid,
  .download-options,
  .rules-grid {
    grid-template-columns: 1fr;
  }

  /* Guild */
  .guild-card {
    flex-direction: column;
    text-align: center;
  }

  /* Section */
  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }

  /* Modal */
  .modal-footer {
    flex-direction: column;
  }

  .modal-footer .btn {
    width: 100%;
  }

  /* Footer */
  .footer {
    padding: var(--ryven-space-xl) 0 calc(var(--ryven-space-xl) + var(--ryven-mobile-bottom));
  }

  .footer-inner {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .footer-logo {
    margin: 0 auto;
  }

  .footer-about {
    margin: 0 auto;
  }

  .footer-social {
    justify-content: center;
  }

  .footer-bar {
    flex-direction: column;
    text-align: center;
  }

  /* Mobile bottom nav */
  .mobile-nav {
    display: block;
  }
}

/* === Small Mobile (<480px) === */
@media (max-width: 479px) {
  .status-strip {
    grid-template-columns: 1fr;
  }

  .status-item {
    justify-content: center;
  }

  .hero-title {
    font-size: 1.75rem;
  }

  .btn-lg {
    min-height: 48px;
    padding: var(--ryven-space-md) var(--ryven-space-lg);
  }

  .highscores-grid {
    grid-template-columns: 1fr;
  }

  .news-grid {
    grid-template-columns: 1fr;
  }

  .social-proof-grid {
    gap: var(--ryven-space-md);
  }

  .ornament {
    padding: var(--ryven-space-md) 0;
  }

  .countdown-segment span {
    font-size: var(--ryven-text-lg);
  }
}

/* === Touch Target Optimization === */
@media (pointer: coarse) {
  .nav-link,
  .nav-toggle,
  .nav-dropdown-item,
  .btn,
  .pagination a,
  .modal-close,
  .mobile-nav-item {
    min-height: 44px;
    min-width: 44px;
  }
}

/* === Print Styles === */
@media print {
  .nav,
  .hero,
  aside,
  .footer,
  .community-cta,
  .mobile-nav {
    display: none;
  }

  body {
    background: white;
    color: black;
    font-size: 12pt;
    line-height: 1.5;
  }

  .panel {
    border: 1px solid #ccc;
    box-shadow: none;
    break-inside: avoid;
  }

  a {
    color: black;
    text-decoration: underline;
  }

  h1, h2, h3 {
    break-after: avoid;
  }
}
