/* ============================================
   7 Klucha Varna - Responsive Styles
   Mobile-first breakpoints
   ============================================ */

/* --- Small (480px+) --- */
@media (min-width: 480px) {
  .grid-2 {
    grid-template-columns: repeat(2, 1fr);
  }

  .hero__title {
    font-size: var(--text-5xl);
  }
}

/* --- Tablet (768px+) --- */
@media (min-width: 768px) {
  :root {
    --header-height: 90px;
  }

  h1 { font-size: var(--text-6xl); }
  h2 { font-size: var(--text-5xl); }
  h3 { font-size: var(--text-4xl); }

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

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

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

  .hero {
    min-height: 75vh;
  }

  .hero__title {
    font-size: var(--text-6xl);
  }

  .hero__subtitle {
    font-size: var(--text-xl);
  }

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

  .event-card__date {
    min-width: 100px;
  }

  .section {
    padding: 4rem 0;
  }

  .pricing-table th,
  .pricing-table td {
    padding: var(--space-md) var(--space-xl);
  }
}

/* --- Desktop (1024px+) --- */
@media (min-width: 1024px) {
  /* Show desktop nav, hide hamburger */
  .primary-nav {
    display: block;
  }

  .menu-toggle {
    display: none;
  }

  .mobile-nav-overlay {
    display: none;
  }

  .submenu-toggle {
    display: none;
  }

  .mobile-nav-header {
    display: none;
  }

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

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

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

  .top-bar__phone {
    font-size: var(--text-sm);
  }
}

/* --- Large (1200px+) --- */
@media (min-width: 1200px) {
  .grid-4 {
    grid-template-columns: repeat(4, 1fr);
  }

  /* When a grid-4 has 5 items (e.g. 5 courses), center the last row */
  .grid-4 > :last-child:nth-child(4n + 1) {
    grid-column: 2 / 3;
  }

  .container {
    padding-left: var(--space-xl);
    padding-right: var(--space-xl);
  }
}

/* --- Mobile-only styles (below 1024px) --- */
@media (max-width: 1023px) {
  /* === Mobile Slide-in Navigation === */
  .primary-nav {
    display: block;
    position: fixed;
    top: 0;
    right: -320px;
    width: 300px;
    max-width: 85vw;
    height: 100vh;
    height: 100dvh;
    background-color: var(--color-white);
    box-shadow: -4px 0 24px rgba(0,0,0,0.15);
    z-index: 1001;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .menu-open .primary-nav {
    right: 0;
  }

  /* Mobile nav header with close button */
  .mobile-nav-header {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: var(--space-md) var(--space-md);
    min-height: 56px;
    position: sticky;
    top: 0;
    background: var(--color-white);
    z-index: 1;
    border-bottom: 1px solid #f0ebe0;
  }

  .mobile-nav-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: #f0ebe0;
    border: 1px solid #d5cfc3;
    cursor: pointer;
    color: var(--color-charcoal, #333);
    transition: background 0.15s ease, color 0.15s ease;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-nav-close:hover,
  .mobile-nav-close:focus-visible {
    background: var(--color-gold-bg);
    color: var(--color-gold-dark, #b8943f);
    border-color: var(--color-gold);
  }

  /* Remove the old ::before spacer since we have a real header now */
  .primary-nav::before {
    display: none;
  }

  /* Offset for WP admin bar when logged in */
  .admin-bar .primary-nav {
    top: 32px;
    height: calc(100vh - 32px);
    height: calc(100dvh - 32px);
  }

  .admin-bar .mobile-nav-overlay {
    top: 32px;
  }

  .primary-nav__list {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0 var(--space-md);
  }

  .primary-nav__item,
  .primary-nav__list > li {
    width: 100%;
    border-bottom: 1px solid #f0ebe0;
  }

  .primary-nav__list > li:last-child {
    border-bottom: none;
  }

  /* Parent menu links */
  .primary-nav__link,
  .primary-nav__list > li > a {
    display: flex;
    align-items: center;
    padding: 14px 12px;
    font-size: 1rem;
    font-weight: 500;
    border: none !important;
    border-radius: 8px !important;
    color: var(--color-charcoal) !important;
    background: transparent !important;
    text-transform: none;
    letter-spacing: 0;
    transition: background 0.15s ease, color 0.15s ease;
    margin: 2px 0;
  }

  /* Parent with children: link takes remaining space */
  .primary-nav__list > li.menu-item-has-children > a {
    flex: 1;
    min-width: 0;
  }

  .primary-nav__list > li > a:hover,
  .primary-nav__list > li > a:active {
    color: var(--color-gold-dark, #b8943f) !important;
    background: #faf6ed !important;
  }

  /* Current page highlight */
  .primary-nav__list > li.current-menu-item > a,
  .primary-nav__list > li.current_page_item > a,
  .primary-nav__list > li.current-menu-ancestor > a {
    color: var(--color-gold-dark, #b8943f) !important;
    background: #faf6ed !important;
    font-weight: 600;
  }

  /* Remove desktop underline pseudo-element */
  .primary-nav__link::after,
  .primary-nav__list > li > a::after {
    display: none !important;
  }

  /* Parent with children: wrap link + toggle in row */
  .primary-nav__list > li.menu-item-has-children {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
  }

  /* Sub-menu toggle button — visible chevron with background */
  .submenu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    background: var(--color-cream, #FAFAF5);
    border: 1px solid #e8e3d8;
    border-radius: var(--radius-full);
    cursor: pointer;
    color: var(--color-gold-dark, #b8943f);
    transition: transform 0.25s ease, background 0.2s ease, border-color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    margin-right: 4px;
  }

  .submenu-toggle:hover,
  .submenu-toggle:focus-visible {
    background: var(--color-gold-bg);
    border-color: var(--color-gold);
  }

  .submenu-toggle[aria-expanded="true"] {
    transform: rotate(180deg);
    background: var(--color-gold-bg);
    border-color: var(--color-gold);
  }

  /* Sub-menu (children) — collapsed by default */
  .primary-nav__item .sub-menu,
  .primary-nav__list > li .sub-menu {
    position: static;
    box-shadow: none;
    transform: none;
    padding: 0;
    margin: 0;
    min-width: 0;
    background: transparent;
    border-radius: 0;
    list-style: none;
    width: 100%;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transition: max-height 0.3s ease, opacity 0.25s ease, visibility 0.25s ease, padding 0.25s ease;
  }

  /* Sub-menu expanded state */
  .primary-nav__list > li .sub-menu.sub-menu--open {
    max-height: 500px;
    opacity: 1;
    visibility: visible;
    padding: 0 0 8px 0;
  }

  .sub-menu li {
    margin: 0;
    padding: 0;
  }

  .sub-menu li a {
    display: block;
    padding: 10px 12px 10px 28px;
    font-size: 0.9rem;
    font-weight: 400;
    color: #666 !important;
    border-radius: 6px;
    transition: background 0.15s ease, color 0.15s ease;
    border: none !important;
    text-transform: none;
    letter-spacing: 0;
  }

  .sub-menu li a::before {
    content: '\203A';
    margin-right: 8px;
    color: var(--color-gold);
    font-weight: 700;
  }

  .sub-menu li a:hover,
  .sub-menu li a:active {
    background: #faf6ed !important;
    color: var(--color-gold-dark, #b8943f) !important;
  }

  /* Mobile nav bottom: CTA button */
  .primary-nav__list::after {
    content: '';
    display: block;
    padding: var(--space-lg) 0;
  }

  /* Hide hamburger when menu is open (close button is inside the panel) */
  .menu-toggle {
    position: relative;
    z-index: 1002;
  }

  .menu-open .menu-toggle {
    visibility: hidden;
    pointer-events: none;
  }

  .top-bar {
    height: auto;
    padding: var(--space-xs) 0;
  }

  .site-header {
    position: relative;
  }

  .top-bar .container {
    flex-wrap: nowrap;
    justify-content: space-between;
    gap: var(--space-xs);
  }

  .top-bar__actions {
    display: flex;
    gap: var(--space-xs);
    flex-shrink: 0;
  }

  .top-bar__phone {
    font-size: var(--text-xs);
  }

  .top-bar__btn {
    font-size: 0.65rem;
    padding: 0.2rem var(--space-sm);
  }

  /* Scroll lock when menu open */
  body.menu-open {
    overflow: hidden;
  }
}

/* --- Small mobile (below 480px) --- */
@media (max-width: 479px) {
  .top-bar .container {
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
  }

  .top-bar__phone {
    width: 100%;
    justify-content: center;
    font-size: 0.75rem;
  }

  .top-bar__btn {
    font-size: 0.6rem;
    padding: 2px 6px;
  }

  .site-header .container {
    padding: 0 var(--space-sm);
  }

  .site-logo img {
    height: 40px;
  }

  .hero {
    min-height: 60vh;
  }

  .hero__title {
    font-size: var(--text-3xl);
  }

  .hero__subtitle {
    font-size: var(--text-base);
  }

  .hero__cta {
    flex-direction: column;
    align-items: center;
  }

  .btn-lg {
    padding: 0.75rem 2rem;
    font-size: var(--text-base);
  }

  .section {
    padding: 3.5rem 0;
  }

  .section-header {
    margin-bottom: var(--space-2xl);
  }

  .benefit-card {
    padding: var(--space-lg);
  }

  .process-features {
    grid-template-columns: 1fr;
  }

  .pricing-table {
    font-size: var(--text-sm);
  }

  .pricing-table th,
  .pricing-table td {
    padding: var(--space-sm) var(--space-md);
  }

  .team-card__photo {
    width: 140px;
    height: 140px;
  }

  .event-card {
    flex-direction: column;
  }

  .event-card__date {
    flex-direction: row;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
  }
}

/* --- Print --- */
@media print {
  .top-bar,
  .site-header,
  .site-footer,
  .menu-toggle,
  .mobile-nav-overlay,
  .btn {
    display: none;
  }

  body {
    color: #000;
    background: #fff;
    font-size: 12pt;
  }

  .container {
    max-width: 100%;
    padding: 0;
  }

  a[href]::after {
    content: ' (' attr(href) ')';
    font-size: 0.8em;
    color: #666;
  }
}
