/*
 * Shared responsive frame
 * 1440 viewport: 1200 content / 120 outer margins
 * 768 viewport: 704 content / 32 gutters
 * 390 viewport: 350 content / 20 gutters
 */
.container {
  width: var(--content-width);
  max-width: var(--container);
  margin-inline: auto;
}

.mobile-menu-tools,
.mobile-menu-heading { display: none; }

@media (max-width: 1199px) {
  .header-site-search { display: none; }
  .all-menu-toggle,
  .all-menu-panel { display: none !important; }
  .logo {
    min-width: 0;
    font-size: 1.5rem;
  }
  .logo::after {
    margin-top: 7px;
    font-size: .7rem;
  }
  .menu-toggle {
    display: inline-grid;
    place-items: center;
  }
  .gnb {
    position: absolute;
    top: 80px;
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    max-height: calc(100dvh - 100px);
    overflow-y: auto;
    padding: 10px;
    border: 1px solid var(--color-line);
    border-radius: var(--radius-md);
    background: var(--color-white);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.1);
  }
  .header-inner {
    display: flex;
    min-height: 80px;
  }
  .gnb-row { display: contents; }
  .gnb-item { display:block; width:100%; padding:0; }
  .gnb-trigger { width:100%; box-sizing:border-box; justify-content:space-between; min-height:48px; padding:12px 14px !important; border:0 !important; border-radius:7px; }
  .gnb-trigger::after { content:'+'; color:var(--color-muted); font-size:1.1rem; font-weight:500; }
  .gnb-item--direct .gnb-trigger::after { display:none; }
  .gnb-trigger::before { display:none; }
  .gnb-item.is-open .gnb-trigger { background:#eef6f6; color:var(--color-primary); }
  .gnb-item.is-open .gnb-trigger::after { content:'−'; }
  .gnb-item--travel-booking {
    margin-top: 8px;
    padding: 8px 0;
    border-top: 1px solid #e2e8e5;
    border-bottom: 1px solid #e2e8e5;
    box-sizing: border-box;
  }
  .gnb-item--travel-booking::before { display: none; }
  .gnb-item--travel-booking .gnb-trigger {
    display: flex;
    min-height: 54px;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    color: #8A7138;
  }
  .gnb-item--travel-booking .travel-booking-icon,
  .gnb-item--travel-booking .travel-booking-icon--main {
    display: block;
    width: 19px;
    height: 19px;
    max-width: 19px;
    max-height: 19px;
    flex: 0 0 19px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    transform: none;
  }
  .gnb-item--travel-booking .gnb-trigger::after { margin-left: auto; }
  .gnb-item--travel-booking .gnb-dropdown a {
    display: flex;
    align-items: center;
    gap: 9px;
    color: #8A7138;
  }
  .gnb-dropdown,
  .gnb-item:hover .gnb-dropdown {
    position:static;
    display:none;
    width:100%;
    min-width:0;
    max-width:none;
    margin:2px 0 8px;
    padding:8px 14px;
    transform:none;
    border:0;
    border-radius:9px;
    background:#f7f9f9;
    box-sizing:border-box;
    box-shadow:none;
    opacity:1;
    visibility:visible;
  }
  .gnb-item.is-open .gnb-dropdown:not(.gnb-dropdown--megamenu) { display:flex; }
  .gnb-dropdown--megamenu { display:none !important; }
  .gnb-dropdown__label { padding:7px 12px 4px; }
  .gnb-dropdown a { width:100%;min-height:42px;padding:10px 12px !important;border:0 !important;box-sizing:border-box; }
  .gnb.is-open {
    display: flex;
  }
  .gnb a {
    padding: 12px 24px;
    font-size: 1rem;
    border-bottom: 1px solid var(--color-surface);
  }
  .gnb a:last-child {
    border-bottom: none;
  }
  .gnb a[aria-current="page"]::after {
    display: none;
  }
  .gnb a[aria-current="page"] {
    background-color: var(--color-surface);
    color: var(--color-primary);
  }
  .header-utils {
    margin-left: auto;
  }
  .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
  }
  .footer-inner {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .footer-main { grid-template-columns: 1fr auto; gap: 32px; }
}

@media (max-width: 639px) {
  .footer-inner { padding-bottom: 22px; }
  .footer-toplinks { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:0; padding-block:12px; }
  .footer-toplinks a { min-height:36px; display:flex; align-items:center; font-size:12px; }
  .footer-main { grid-template-columns:1fr; gap:22px; padding-block:24px 20px; }
  .footer-company h2 { font-size:17px; }
  .footer-company .footer-company__summary { margin:6px 0 15px; font-size:12px; }
  .footer-business { display:grid; grid-template-columns:1fr 1fr; gap:9px 16px; }
  .footer-business div { display:block; min-width:0; }
  .footer-business dt { margin-bottom:2px; font-size:12px; }
  .footer-business dd { overflow:hidden; font-size:12px; text-overflow:ellipsis; white-space:nowrap; }
  .footer-info { padding:18px 0 0; border-top:1px solid rgba(255,255,255,.1); border-left:0; }
  .footer-info strong { margin-top:6px; font-size:16px; }
  .footer-info a { margin-top:11px; }
  .footer-notice { padding-block:13px; }
  .footer-bottom { padding-top:5px; line-height:1.55; }
  .site-notice {
    height: 48px;
    min-height: 48px;
    padding: 0;
    font-size: 12px;
  }
  .site-notice.site-certification-bar { height: 46px; min-height: 46px; }
  .site-notice__group { gap: 7px; padding-inline: 12px; }
  .site-notice__icon { width: 22px; height: 22px; font-size: 10px; }
  .site-notice__label,
  .site-notice__divider { display: none; }
  .site-notice__group strong { font-size: 12px; }
  .site-notice__schedule { gap: 6px; }
  .site-notice__days { gap:0; padding:1px; }
  .site-notice__days > span { width:auto; height:auto; border-radius:0; font-size:12px; }
  .site-notice__days > span + span::before { margin:0 5px; }
  .site-notice__more { display: none; }
  .site-notice a:not(.site-notice__ticker) {
    font-size: 0;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0;
  }
  .site-notice a:not(.site-notice__ticker)::after {
    content: '보기 →';
    font-size: 12px;
    color: #ffffff;
    text-decoration: underline;
  }
  .header-inner {
    min-height: 70px;
  }
  .logo {
    padding-block: 9px;
    font-size: 1.32rem;
  }
  .site-header .logo { min-width: 0; }
  .site-header .logo { transform: translateY(3px); }
  .site-header .logo img { width: 170px; height: auto; }
  .site-header .logo::after { margin-top: 5px; font-size: 12px; }
  .logo::after {
    margin-top: 6px;
    font-size: 12px;
  }
  .gnb {
    top: 70px;
  }
  .card-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .header-utils {
    display: none;
  }
  .menu-toggle {
    position: relative;
    display: inline-grid;
    width: 44px;
    height: 44px;
    margin-left: auto;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: transparent;
    font-size: 0;
    place-items: center;
  }
  .menu-toggle::before,
  .menu-toggle::after {
    position: absolute;
    width: 18px;
    height: 2px;
    border-radius: 2px;
    background: #18312c;
    content: "";
    transition: transform .2s ease, box-shadow .2s ease;
  }
  .menu-toggle::before {
    transform: translateY(-6px);
    box-shadow: 0 6px 0 #18312c;
  }
  .menu-toggle::after { transform: translateY(6px); }
  .menu-toggle[aria-expanded="true"]::before {
    transform: rotate(45deg);
    box-shadow: none;
  }
  .menu-toggle[aria-expanded="true"]::after { transform: rotate(-45deg); }
  .header-course-cta { display:none !important; }
  .header-check-link {
    display: none; /* Hide on small mobile to save space, accessible via GNB */
  }
  
  /* Horizontal scroll for category filters on mobile */
  .filter-scroll-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    gap: 8px;
    padding-bottom: 8px;
    scrollbar-width: none; /* Firefox */
  }
  .filter-scroll-container::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
  }
  .filter-btn {
    white-space: nowrap;
    min-height: 44px; /* Ensure 44x44 touch area */
    padding: 10px 16px;
  }
}

/* Tablet header: keep the toggle in place, but render it as a plain hamburger. */
@media (min-width: 768px) and (max-width: 900px) {
  .menu-toggle {
    position: relative;
    display: inline-grid;
    width: 44px;
    height: 44px;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: transparent;
    font-size: 0;
  }

  .menu-toggle::before,
  .menu-toggle::after {
    position: absolute;
    width: 19px;
    height: 2px;
    border-radius: 2px;
    background: #18312c;
    content: "";
    transition: transform .2s ease, box-shadow .2s ease;
  }

  .menu-toggle::before {
    transform: translateY(-6px);
    box-shadow: 0 6px 0 #18312c;
  }

  .menu-toggle::after { transform: translateY(6px); }

  .menu-toggle[aria-expanded="true"]::before {
    transform: rotate(45deg);
    box-shadow: none;
  }

  .menu-toggle[aria-expanded="true"]::after { transform: rotate(-45deg); }
}

/* Checkout tablet header: hamburger first, then logo. */
@media (min-width: 768px) and (max-width: 900px) {
  .checkout-page .header-inner {
    gap: 10px;
  }

  .checkout-page .menu-toggle {
    position: relative;
    order: -1;
    display: inline-grid;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    margin: 0 0 0 -20px;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: transparent;
    font-size: 0;
  }

  .checkout-page .menu-toggle::before,
  .checkout-page .menu-toggle::after {
    position: absolute;
    left: 0;
    width: 19px;
    height: 2px;
    border-radius: 2px;
    background: #18312c;
    content: "";
    transition: transform .2s ease, box-shadow .2s ease;
  }

  .checkout-page .menu-toggle::before {
    transform: translateY(-6px);
    box-shadow: 0 6px 0 #18312c;
  }

  .checkout-page .menu-toggle::after {
    transform: translateY(6px);
  }

  .checkout-page .menu-toggle[aria-expanded="true"]::before {
    transform: rotate(45deg);
    box-shadow: none;
  }

  .checkout-page .menu-toggle[aria-expanded="true"]::after {
    transform: rotate(-45deg);
  }

  .checkout-page .header-inner .logo {
    order: 0;
  }

  .checkout-page .header-utils {
    margin-left: auto;
  }
}

/* Reduced Motion support */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
  .menu-toggle::before,
  .menu-toggle::after { transition: none !important; }
}

/* Keep two-column workspaces comfortable on compact desktop/tablet widths. */
@media (max-width: 1199px) {
  .builder-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .builder-summary {
    position: static;
    width: 100%;
  }
}

@media (max-width: 639px) {
  h1,
  h2,
  h3,
  .card__title,
  .product-summary h1 {
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: keep-all;
  }
}

@media (max-width: 767px) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
  select,
  textarea {
    min-width: 0;
    max-width: 100%;
    font-size: 16px;
  }
}
