/**
 * Responsive layout refinements
 * Kept separate from the visual design stylesheet so device-specific
 * adjustments remain easy to maintain.
 */

html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
}

.mobile-quick-actions {
  display: none;
}

/* Prevent long translated text, links, and grid children from forcing overflow. */
main,
section,
.container,
.hero-layout > *,
.about-grid > *,
.contact-layout > *,
.footer-grid > *,
.contact-card-info,
.lightbox-details {
  min-width: 0;
}

.contact-card-info a,
.footer-contact-list a,
.footer-contact-list span {
  overflow-wrap: anywhere;
}

/* Navigation needs its compact layout before it physically runs out of room. */
@media (max-width: 1180px) {
  :root {
    --nav-height: 76px;
  }

  .mobile-toggle {
    display: flex;
  }

  .nav-call-btn {
    display: none;
  }

  .nav-menu {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    width: 100%;
    max-height: calc(100dvh - var(--nav-height));
    overflow-y: auto;
    overscroll-behavior: contain;
    background: rgba(255, 255, 255, 0.98);
    flex-direction: column;
    align-items: stretch;
    padding: 18px clamp(16px, 5vw, 40px) calc(22px + env(safe-area-inset-bottom));
    gap: 6px;
    border: 0;
    border-bottom: 2px solid rgba(226, 99, 80, 0.15);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
    box-shadow: var(--shadow-float);
    display: none;
  }

  .nav-menu::before {
    display: none;
  }

  .nav-menu.mobile-open {
    display: flex;
  }

  .nav-item,
  .nav-item .nav-link {
    width: 100%;
  }

  .nav-item .nav-link {
    display: block;
    min-height: 44px;
    padding: 11px 18px;
    text-align: center;
  }

  .nav-item .nav-link.active,
  .nav-item .nav-link.active:hover {
    color: #FFFFFF;
    background: var(--coral-500);
    box-shadow: 0 3px 12px rgba(226, 99, 80, 0.24);
  }

  .mobile-toggle[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .mobile-toggle[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
  }

  .mobile-toggle[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  body.mobile-nav-open {
    overflow: hidden;
  }
}

@media (max-width: 900px) {
  .container {
    padding-left: clamp(18px, 4vw, 28px);
    padding-right: clamp(18px, 4vw, 28px);
  }

  .py-section {
    padding: 88px 0;
  }

  .hero-section {
    padding: 56px 0 78px;
  }

  .hero-layout {
    gap: 48px;
  }

  .section-subtitle {
    margin-bottom: 36px;
  }

  .about-story-card {
    padding: 38px 34px;
  }

  .facilities-grid,
  .facilities-photo-showcase,
  .gallery-grid {
    gap: 20px;
  }

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

  .feedback-form-card {
    padding: 42px 36px;
  }

  .map-wrapper,
  .map-iframe {
    min-height: 390px;
  }
}

@media (max-width: 700px) {
  :root {
    --nav-height: 68px;
    --radius-xl: 26px;
    --radius-lg: 20px;
  }

  html {
    scroll-padding-top: calc(var(--nav-height) + 10px);
  }

  body,
  .site-header,
  main,
  .site-footer {
    width: 100%;
    max-width: 100%;
  }

  body {
    min-width: 0;
  }

  main,
  .site-footer {
    overflow-x: clip;
  }

  .site-header .container {
    padding-left: 14px;
    padding-right: 14px;
  }

  .brand-link {
    flex: 1 1 auto;
    min-width: 0;
    gap: 9px;
  }

  .brand-text-block {
    min-width: 0;
  }

  .brand-logo-frame {
    width: 44px;
    height: 44px;
  }

  .brand-title {
    font-size: clamp(0.8rem, 2.8vw, 0.98rem);
    line-height: 1.15;
    white-space: normal;
  }

  .brand-tagline {
    font-size: clamp(0.5rem, 1.7vw, 0.61rem);
    line-height: 1.2;
    letter-spacing: 0.25px;
    white-space: normal;
  }

  .navbar-right-group,
  .header-actions {
    gap: 7px;
  }

  .lang-toggle-btn {
    min-height: 42px;
    padding: 7px 11px;
    font-size: 0.78rem;
  }

  .mobile-toggle {
    width: 42px;
    height: 42px;
    padding: 10px;
  }

  .py-section {
    padding: 68px 0;
  }

  .curve-divider svg {
    height: 30px;
  }

  .section-tag {
    font-size: 0.72rem;
    line-height: 1.35;
    letter-spacing: 1px;
    padding: 7px 14px;
  }

  .section-title {
    font-size: clamp(1.85rem, 8vw, 2.4rem);
    letter-spacing: -0.45px;
  }

  .section-subtitle {
    font-size: 1rem;
    line-height: 1.65;
    margin-bottom: 30px;
  }

  .hero-section {
    padding: 42px 0 66px;
  }

  .hero-layout {
    gap: 38px;
  }

  .hero-badge-pill {
    max-width: 100%;
    align-items: flex-start;
    line-height: 1.4;
    padding: 8px 14px;
    margin-bottom: 20px;
  }

  .hero-badge-dot {
    margin-top: 5px;
    flex: 0 0 auto;
  }

  .hero-title {
    font-size: clamp(2.15rem, 10.5vw, 3rem);
    line-height: 1.08;
    letter-spacing: -0.7px;
  }

  .hero-description {
    font-size: 1rem;
    line-height: 1.7;
    margin-bottom: 28px;
  }

  .hero-cta-group {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 34px;
  }

  .hero-cta-group .btn {
    width: 100%;
    min-height: 48px;
  }

  .hero-features-strip {
    padding-top: 24px;
    gap: 12px;
  }

  .hero-visual-wrapper {
    width: calc(100% - 8px);
  }

  .hero-visual-card {
    padding: 10px;
  }

  .hero-image-placeholder {
    aspect-ratio: 3 / 4;
    object-position: center center;
  }

  .hero-visual-backdrop-shape {
    inset: -8px -8px 14px 14px;
  }

  .hero-floating-card {
    position: static;
    width: 100%;
    margin-top: 14px;
    padding: 13px 15px;
  }

  .stats-strip {
    padding: 28px 0;
  }

  .stats-grid {
    gap: 0;
  }

  .stat-box {
    padding: 16px 10px;
  }

  .stat-number {
    font-size: 2.15rem;
  }

  .stat-label {
    font-size: 0.82rem;
    line-height: 1.45;
  }

  .stat-box:nth-child(odd)::after {
    display: block;
  }

  .stat-box:nth-child(even)::after {
    display: none;
  }

  .about-grid {
    gap: 30px;
  }

  .about-story-card {
    padding: 30px 22px;
  }

  .about-story-card::before {
    top: 12px;
    right: 18px;
    font-size: 4.5rem;
  }

  .about-story-text p {
    font-size: 0.98rem;
    line-height: 1.75;
  }

  .school-info-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .info-card {
    padding: 20px 16px;
  }

  .info-card-val {
    font-size: 1.05rem;
  }

  .value-item {
    gap: 14px;
    padding: 18px;
  }

  .facilities-photo-showcase,
  .facilities-grid,
  .gallery-grid {
    grid-template-columns: 1fr;
  }

  .facilities-photo-showcase {
    margin-bottom: 34px;
  }

  .facility-card {
    padding: 26px 22px;
  }

  .gallery-filters {
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
    padding: 2px 0 10px;
    margin-bottom: 28px;
    scroll-snap-type: inline proximity;
  }

  .gallery-filters::-webkit-scrollbar {
    display: none;
  }

  .gallery-filter-btn {
    flex: 0 0 auto;
    min-height: 44px;
    padding: 9px 18px;
    scroll-snap-align: start;
  }

  .gallery-card {
    padding: 8px;
    flex-basis: min(84vw, 330px);
  }

  .gallery-carousel-track .gallery-image-wrapper {
    aspect-ratio: 4 / 3;
    background: #111822;
  }

  .gallery-carousel-track .gallery-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .gallery-carousel-track {
    scrollbar-width: none;
  }

  .gallery-carousel-track::-webkit-scrollbar {
    display: none;
  }

  .gallery-overlay {
    padding: 16px;
  }

  .gallery-card-title {
    font-size: 1.05rem;
  }

  .gallery-card-desc {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
  }

  .gallery-carousel-btn {
    display: none;
  }

  .gallery-carousel-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-top: 14px;
  }

  .gallery-swipe-hint {
    text-align: center;
  }

  .gallery-swipe-hint-desktop {
    display: none;
  }

  .gallery-swipe-hint-mobile {
    display: inline;
  }

  .gallery-view-icon {
    display: none;
  }

  .gallery-view-all-btn {
    width: 100%;
  }

  .gallery-overview-modal {
    align-items: stretch;
    padding: max(10px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom));
  }

  .gallery-overview-panel {
    max-height: calc(var(--app-height, 100dvh) - 20px);
    margin: auto;
    border-radius: 24px;
  }

  .gallery-overview-header {
    padding: 18px 16px 15px;
  }

  .gallery-overview-header h3 {
    font-size: 1.35rem;
  }

  .gallery-overview-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 12px;
  }

  .gallery-overview-item {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    gap: 0;
    width: 100%;
    padding: 7px;
    border-radius: 18px;
    text-align: left;
  }

  .gallery-overview-item::after {
    display: none;
  }

  .gallery-overview-image-wrap {
    flex: 0 0 auto;
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: 14px;
  }

  .gallery-overview-caption {
    width: 100%;
    padding: 11px 8px 6px;
    font-size: 0.88rem;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .lightbox-modal {
    align-items: stretch;
    padding: max(10px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom));
  }

  .lightbox-container {
    display: flex;
    flex-direction: column;
    max-height: calc(var(--app-height, 100dvh) - 20px);
    margin: auto;
  }

  .lightbox-img-wrapper {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
  }

  .lightbox-img-wrapper img {
    width: 100%;
    height: 100%;
    max-height: calc(var(--app-height, 100dvh) - 190px);
    object-fit: contain;
  }

  .lightbox-close-btn {
    top: 10px;
    right: 10px;
  }

  .lightbox-nav-btn {
    width: 44px;
    height: 44px;
  }

  .lightbox-prev-btn {
    left: 8px;
  }

  .lightbox-next-btn {
    right: 8px;
  }

  .lightbox-caption-area {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 16px;
  }

  .lightbox-details {
    min-width: 0;
  }

  .lightbox-details h4 {
    line-height: 1.3;
  }

  .lightbox-details p {
    display: none;
  }

  .lightbox-meta {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
  }

  .lightbox-meta .gallery-badge {
    display: none;
  }

  .lightbox-counter {
    flex: 0 0 auto;
    padding: 6px 10px;
    white-space: nowrap;
  }

  .feedback-form-card {
    padding: 30px 20px;
  }

  .form-grid {
    gap: 18px;
  }

  .form-input,
  .form-textarea,
  .form-select {
    font-size: 16px;
    padding: 13px 15px;
  }

  .form-footer-info {
    align-items: stretch;
    flex-direction: column;
    gap: 16px;
  }

  .form-footer-info .btn {
    width: 100%;
    min-height: 48px;
  }

  .form-security-note {
    justify-content: center;
    text-align: center;
  }

  .contact-layout {
    gap: 30px;
  }

  .contact-card {
    gap: 14px;
    padding: 19px 16px;
  }

  .contact-card-icon {
    width: 44px;
    height: 44px;
  }

  .map-wrapper,
  .map-iframe {
    min-height: 330px;
  }

  .site-footer {
    padding: 58px 0 calc(104px + env(safe-area-inset-bottom));
  }

  .mobile-quick-actions {
    position: fixed;
    z-index: 950;
    left: 10px;
    right: 10px;
    bottom: max(10px, env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: 1fr 1.16fr 1fr;
    align-items: center;
    gap: 5px;
    padding: 7px;
    border: 1px solid rgba(226, 99, 80, 0.16);
    border-radius: 22px;
    background: rgba(255, 253, 249, 0.94);
    box-shadow: 0 14px 36px rgba(25, 35, 45, 0.22);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
  }

  .mobile-quick-action {
    display: flex;
    min-width: 0;
    min-height: 50px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border-radius: 16px;
    color: var(--text-secondary);
    font-size: 0.67rem;
    font-weight: 800;
    line-height: 1.2;
  }

  .mobile-quick-action svg {
    flex: 0 0 auto;
  }

  .mobile-quick-action-primary {
    color: #FFFFFF;
    background: linear-gradient(135deg, var(--coral-500), var(--coral-600));
    box-shadow: 0 7px 18px rgba(204, 78, 60, 0.28);
  }

  body.mobile-nav-open .mobile-quick-actions {
    display: none;
  }

  .footer-grid {
    gap: 38px;
    margin-bottom: 42px;
  }

  .lang-modal-backdrop {
    align-items: flex-start;
    overflow-y: auto;
    padding: max(16px, env(safe-area-inset-top)) 14px max(16px, env(safe-area-inset-bottom));
  }

  .lang-modal-box {
    margin: auto;
    padding: 30px 24px 24px;
  }

  .lang-modal-logo-frame {
    width: 68px;
    height: 68px;
  }

  .lang-modal-box p {
    margin-bottom: 22px;
  }

  .lang-options-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .lang-choice-card {
    min-height: 90px;
    padding: 13px 12px;
  }
}

@media (max-width: 480px) {
  :root {
    --nav-height: 82px;
  }

  .container {
    padding-left: 16px;
    padding-right: 16px;
  }

  .lang-toggle-btn svg {
    display: none;
  }

  .navbar {
    gap: 8px;
  }

  .brand-link {
    gap: 10px;
  }

  .brand-text-block {
    gap: 2px;
    padding-block: 3px;
  }

  .brand-title {
    max-width: 48vw;
    overflow: visible;
    font-size: clamp(0.73rem, 3.25vw, 0.86rem);
    line-height: 1.2;
    letter-spacing: 0;
    text-overflow: clip;
    white-space: normal;
  }

  .brand-tagline {
    display: block;
    font-size: clamp(0.46rem, 2vw, 0.56rem);
    line-height: 1.25;
    letter-spacing: 0.1px;
    white-space: normal;
  }

  .lang-toggle-btn {
    display: grid;
    place-items: center;
    min-width: 48px;
    height: 42px;
    padding: 0 6px;
    font-size: 0.7rem;
    line-height: 1;
    text-align: center;
  }

  #langToggleText {
    display: block;
    line-height: 1.15;
    text-align: center;
  }

  .hero-features-strip,
  .school-info-grid {
    grid-template-columns: 1fr;
  }

  .info-card {
    display: grid;
    grid-template-columns: 42px 1fr;
    column-gap: 12px;
    align-items: center;
  }

  .info-card-icon {
    grid-row: 1 / span 2;
    width: 42px;
    height: 42px;
    margin-bottom: 0;
  }

  .info-card-title,
  .info-card-val {
    grid-column: 2;
  }

  .value-item {
    align-items: flex-start;
  }

  .gallery-overlay {
    background: linear-gradient(to bottom, rgba(25, 35, 45, 0.16) 0%, transparent 38%);
  }

  .lightbox-details h4 {
    font-size: 1.05rem;
    line-height: 1.3;
  }

  .contact-card-info p,
  .contact-card-info a {
    font-size: 0.9rem;
  }

  .footer-logo-row {
    align-items: flex-start;
  }

  .footer-school-title {
    font-size: 1.12rem;
  }

  .lang-modal-box {
    border-radius: 28px;
    padding: 25px 18px 21px;
  }

  .lang-modal-brand {
    margin-bottom: 14px;
  }

  .lang-modal-location {
    padding: 6px 10px;
    font-size: 0.72rem;
  }

  .lang-modal-box h2 {
    font-size: 1.65rem;
  }

  .lang-options-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .lang-choice-card {
    grid-template-columns: 48px minmax(0, 1fr) 28px;
    min-height: 78px;
    padding: 11px 12px;
  }

  .lang-choice-symbol {
    width: 48px;
    height: 48px;
    border-radius: 15px;
  }

  .lang-modal-note {
    margin-top: 15px;
  }

  .lang-decor-star,
  .lang-decor-pencil,
  .lang-decor-dots {
    display: none;
  }
}

@media (max-width: 380px) {
  :root {
    --nav-height: 84px;
  }

  .site-header .container {
    padding-left: 10px;
    padding-right: 10px;
  }

  .brand-logo-frame {
    width: 38px;
    height: 38px;
  }

  .brand-text-block {
    display: flex;
    min-width: 0;
  }

  .brand-title {
    max-width: 47vw;
    font-size: 0.8rem;
    line-height: 1.18;
  }

  .brand-tagline {
    font-size: 0.49rem;
    line-height: 1.22;
  }

  .header-actions,
  .navbar-right-group {
    gap: 5px;
  }

  .lang-toggle-btn {
    width: 42px;
    min-width: 42px;
    min-height: 38px;
    height: 38px;
    padding: 0 4px;
    font-size: 0.66rem;
  }

  .mobile-toggle {
    width: 38px;
    height: 38px;
    padding: 9px;
  }

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

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

  .stat-box::after {
    display: none !important;
  }

  .stat-box:not(:last-child) {
    border-bottom: 1px solid rgba(226, 99, 80, 0.12);
  }

  .lang-choice-card {
    grid-template-columns: 44px minmax(0, 1fr) 26px;
  }

  .lang-choice-symbol {
    width: 44px;
    height: 44px;
  }
}

@media (min-width: 1440px) {
  :root {
    --max-width: 1320px;
  }

  .hero-section {
    padding-top: 88px;
  }
}

@media (hover: none) and (pointer: coarse) {
  .btn:hover,
  .facility-card:hover,
  .facilities-photo-card:hover,
  .gallery-card:hover,
  .contact-card:hover,
  .info-card:hover,
  .value-item:hover {
    transform: none;
  }

  .gallery-view-icon {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.9);
  }

  .gallery-card:hover .gallery-img {
    transform: translateZ(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .motion-ready,
  .motion-ready.motion-visible {
    opacity: 1;
    translate: none;
  }
}
