/* ============================================================
   知循教育 - 移动端响应式样式优化
   Mobile-First Responsive Design
   ============================================================ */

:root {
  /* Touch-friendly minimum sizes */
  --touch-target-min: 44px;
  --touch-spacing: 12px;

  /* Fluid typography scale (clamp: min, preferred, max) */
  --fs-h1: clamp(28px, 5vw, 52px);
  --fs-h2: clamp(22px, 3.5vw, 32px);
  --fs-h3: clamp(17px, 2.5vw, 24px);
  --fs-body: clamp(14px, 1.8vw, 16px);
  --fs-small: clamp(12px, 1.5vw, 14px);

  /* Fluid spacing */
  --space-section: clamp(40px, 8vw, 80px);
  --space-card: clamp(16px, 3vw, 32px);
  --space-gap: clamp(12px, 2.5vw, 24px);
}

/* ==========================================================
   BASE MOBILE RESETS
   ========================================================== */

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

/* Smoother scrolling for touch devices */
@media (hover: none) and (pointer: coarse) {
  html {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
  }
}

/* Remove tap highlight on mobile */
* {
  -webkit-tap-highlight-color: transparent;
}

/* Prevent text size adjustment on orientation change */
html {
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
}

/* ==========================================================
   RESPONSIVE NAVBAR
   ========================================================== */

@media (max-width: 768px) {
  .navbar-inner {
    padding: 0 16px;
    height: 60px;
  }

  .navbar-brand img {
    width: 48px !important;
    max-height: 48px !important;
  }

  .navbar-brand span {
    font-size: 17px;
  }

  /* Mobile hamburger menu */
  .navbar-toggle {
    display: flex !important;
    padding: 10px;
    min-width: var(--touch-target-min);
    min-height: var(--touch-target-min);
    align-items: center;
    justify-content: center;
  }

  .navbar-toggle span {
    transition: transform 0.3s, opacity 0.3s;
  }

  /* Animated hamburger to X */
  .navbar-toggle.active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }
  .navbar-toggle.active span:nth-child(2) {
    opacity: 0;
  }
  .navbar-toggle.active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  /* Slide-down mobile menu */
  .navbar-menu {
    display: none;
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    background: rgba(10, 14, 23, 0.98);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(212, 168, 83, 0.2);
    flex-direction: column;
    padding: 16px 0;
    gap: 0;
    z-index: 999;
    max-height: calc(100vh - 60px);
    overflow-y: auto;
    animation: slideDown 0.3s ease;
  }

  @keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
  }

  .navbar-menu.show {
    display: flex;
  }

  .navbar-menu li {
    width: 100%;
  }

  .navbar-menu li a {
    display: block;
    padding: 14px 24px;
    font-size: 16px;
    min-height: var(--touch-target-min);
    line-height: 1;
    display: flex;
    align-items: center;
  }

  .navbar-menu li a:active {
    background: rgba(212, 168, 83, 0.08);
  }

  /* Hide desktop menu, show toggle */
  .navbar-menu { display: none; }
  .navbar-toggle { display: flex; }

  /* Adjust login button */
  .btn-login {
    padding: 8px 14px;
    font-size: 13px;
  }
}

/* Tablet navbar adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
  .navbar-inner {
    padding: 0 20px;
  }

  .navbar-menu {
    gap: 20px;
  }

  .navbar-menu a {
    font-size: 14px;
  }
}

/* ==========================================================
   RESPONSIVE HERO
   ========================================================== */

@media (max-width: 480px) {
  .hero {
    padding: 120px 16px 60px;
    min-height: auto;
  }

  .hero h1 {
    font-size: 26px;
    line-height: 1.35;
  }

  .hero-subtitle {
    font-size: 15px;
  }

  .hero-geo {
    font-size: 13px;
    letter-spacing: 1px;
  }

  .hero-badge {
    font-size: 12px;
    padding: 6px 16px;
    letter-spacing: 1px;
  }

  .hero-tags {
    gap: 8px;
  }

  .hero-tag {
    padding: 8px 14px;
    font-size: 13px;
  }

  .hero-cta {
    padding: 14px 32px;
    font-size: 16px;
    width: 100%;
    max-width: 300px;
    text-align: center;
  }
}

@media (min-width: 481px) and (max-width: 768px) {
  .hero {
    padding: 130px 20px 70px;
  }

  .hero h1 {
    font-size: 32px;
  }

  .hero-subtitle {
    font-size: 18px;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .hero h1 {
    font-size: 40px;
  }
}

/* ==========================================================
   RESPONSIVE STATS BAR
   ========================================================== */

@media (max-width: 480px) {
  .stats-bar {
    gap: 20px;
    padding: 32px 16px;
  }

  .stat-item {
    flex: 0 0 calc(50% - 10px);
  }

  .stat-number {
    font-size: 26px;
  }

  .stat-label {
    font-size: 12px;
  }
}

@media (min-width: 481px) and (max-width: 768px) {
  .stats-bar {
    gap: 24px;
    padding: 36px 20px;
  }

  .stat-number {
    font-size: 30px;
  }
}

/* ==========================================================
   RESPONSIVE SECTIONS
   ========================================================== */

@media (max-width: 480px) {
  .section {
    padding: 40px 16px;
  }

  .section-title {
    font-size: 22px;
    margin-bottom: 8px;
  }

  .section-subtitle {
    font-size: 14px;
    margin-bottom: 28px;
  }
}

@media (min-width: 481px) and (max-width: 768px) {
  .section {
    padding: 56px 20px;
  }

  .section-title {
    font-size: 26px;
  }
}

/* ==========================================================
   RESPONSIVE ABOUT GRID (index.html)
   ========================================================== */

@media (max-width: 768px) {
  .about-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .about-text h3 {
    font-size: 20px;
  }

  .about-text p {
    font-size: 15px;
  }

  .about-stat-card {
    padding: 20px;
  }

  .about-stat-card .num {
    font-size: 28px;
  }
}

/* ==========================================================
   RESPONSIVE ADVANTAGES / SERVICES / EXPERTS GRIDS
   ========================================================== */

@media (max-width: 480px) {
  .adv-grid,
  .service-grid,
  .expert-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .adv-card,
  .service-col,
  .expert-card {
    padding: 20px;
  }
}

@media (min-width: 481px) and (max-width: 768px) {
  .adv-grid,
  .expert-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .service-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .adv-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

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

/* ==========================================================
   RESPONSIVE GEO CITIES (index.html & landing.html)
   ========================================================== */

@media (max-width: 480px) {
  .geo-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 24px 12px;
  }

  .geo-card {
    padding: 16px 10px;
  }

  .geo-card .city {
    font-size: 16px;
  }

  .geo-card .desc {
    font-size: 11px;
  }
}

@media (min-width: 481px) and (max-width: 768px) {
  .geo-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    padding: 32px 16px;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .geo-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ==========================================================
   RESPONSIVE NEWS GRID
   ========================================================== */

@media (max-width: 768px) {
  .news-grid {
    grid-template-columns: 1fr;
  }

  .news-card {
    padding: 20px;
  }
}

/* ==========================================================
   RESPONSIVE FAQ
   ========================================================== */

@media (max-width: 480px) {
  .faq-list {
    padding: 0 8px;
  }

  .faq-item {
    padding: 18px 16px;
    margin-bottom: 10px;
  }

  .faq-item h3 {
    font-size: 15px;
  }

  .faq-item p {
    font-size: 13px;
  }
}

/* ==========================================================
   RESPONSIVE FOOTER
   ========================================================== */

@media (max-width: 480px) {
  .footer-main {
    grid-template-columns: 1fr;
    gap: 28px;
    padding: 40px 16px 28px;
  }

  .footer-col h4 {
    font-size: 15px;
    margin-bottom: 12px;
  }

  .footer-contact p {
    font-size: 13px;
  }
}

@media (min-width: 481px) and (max-width: 768px) {
  .footer-main {
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    padding: 48px 20px 36px;
  }
}

/* ==========================================================
   RESPONSIVE PRICING PAGE
   ========================================================== */

@media (max-width: 480px) {
  .pricing-grid {
    grid-template-columns: 1fr;
    gap: 28px;
    max-width: 340px;
    margin: 0 auto;
  }

  .pricing-card {
    padding: 24px 20px;
  }

  .pricing-card.featured {
    transform: none;
    order: -1;
  }

  .pricing-card.featured:hover {
    transform: translateY(-4px);
  }

  .pricing-price {
    font-size: 30px;
  }

  .pricing-name {
    font-size: 18px;
  }

  .pricing-features li {
    font-size: 13px;
    padding: 8px 0;
  }
}

@media (min-width: 481px) and (max-width: 768px) {
  .pricing-grid {
    grid-template-columns: 1fr;
    max-width: 420px;
    margin: 0 auto;
  }

  .pricing-card.featured {
    transform: none;
    order: -1;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .pricing-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .pricing-card.featured {
    transform: none;
  }
}

/* ==========================================================
   RESPONSIVE NEWS LIST PAGE
   ========================================================== */

@media (max-width: 480px) {
  .page-header {
    padding: 60px 16px 40px;
  }

  .page-header h1 {
    font-size: 24px;
  }

  .page-header .subtitle {
    font-size: 14px;
  }

  .news-section {
    padding: 24px 16px 48px;
  }

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

  .news-card h3 {
    font-size: 16px;
  }

  .news-card .summary {
    font-size: 13px;
  }

  .news-meta {
    font-size: 12px;
    gap: 12px;
  }

  /* Modal on mobile */
  .news-modal-overlay {
    padding: 12px;
    align-items: flex-end;
  }

  .news-modal {
    padding: 28px 20px;
    max-height: 90vh;
    border-radius: 16px 16px 0 0;
  }

  .news-modal h2 {
    font-size: 18px;
  }

  .news-modal .modal-body {
    font-size: 14px;
  }

  .news-modal-close {
    top: 12px;
    right: 16px;
    font-size: 24px;
  }
}

/* ==========================================================
   TOUCH-FRIENDLY INTERACTIVE ELEMENTS
   ========================================================== */

/* Enlarge touch targets */
@media (hover: none) and (pointer: coarse) {
  a, button, .btn-login, .hero-cta, .btn-pricing,
  .news-card, .geo-card, .adv-card, .service-col, .expert-card,
  .navbar-menu a, .pricing-card, .faq-item {
    cursor: pointer;
  }

  /* Minimum touch target size */
  .navbar-menu a,
  .btn-login,
  .hero-cta,
  .btn-pricing,
  .footer-links a {
    min-height: var(--touch-target-min);
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Add active state feedback for touch */
  .adv-card:active,
  .service-col:active,
  .expert-card:active,
  .geo-card:active,
  .news-card:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
  }

  .hero-cta:active,
  .btn-login:active,
  .btn-pricing:active {
    transform: scale(0.96);
  }
}

/* ==========================================================
   RESPONSIVE IMAGES
   ========================================================== */

img {
  max-width: 100%;
  height: auto;
}

/* Loading attribute for lazy images */
img[loading="lazy"] {
  opacity: 0;
  transition: opacity 0.3s ease;
}

img[loading="lazy"].loaded {
  opacity: 1;
}

/* ==========================================================
   REDUCED MOTION PREFERENCES
   ========================================================== */

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

/* ==========================================================
   PRINT STYLES
   ========================================================== */

@media print {
  .navbar,
  .navbar-toggle,
  .hero-cta,
  .btn-login,
  .btn-pricing,
  .seo-text {
    display: none !important;
  }

  body {
    background: white;
    color: black;
  }

  .hero {
    background: none !important;
    padding: 20px 0;
  }

  .hero h1 {
    color: black;
    -webkit-text-fill-color: black;
  }
}

/* ==========================================================
   HIGH-DPI SCREEN OPTIMIZATIONS
   ========================================================== */

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .hero {
    background-image: url(/hero-bg.jpg);
    background-size: cover;
    background-position: center;
  }
}

/* ==========================================================
   LANDSCAPE MOBILE OPTIMIZATION
   ========================================================== */

@media (max-width: 900px) and (orientation: landscape) {
  .hero {
    padding: 80px 20px 40px;
    min-height: auto;
  }

  .hero h1 {
    font-size: 24px;
  }

  .hero-tags {
    gap: 6px;
  }

  .hero-tag {
    padding: 6px 10px;
    font-size: 12px;
  }

  .navbar-inner {
    height: 50px;
  }

  .navbar-menu.show {
    max-height: calc(100vh - 50px);
  }
}

/* ==========================================================
   SAFE AREA INSETS (iPhone notch)
   ========================================================== */

@supports (padding: env(safe-area-inset-top)) {
  .navbar {
    padding-top: env(safe-area-inset-top);
  }

  .navbar-inner {
    height: calc(70px + env(safe-area-inset-top));
  }

  .footer {
    padding-bottom: env(safe-area-inset-bottom);
  }

  @media (max-width: 768px) {
    .navbar-inner {
      height: calc(60px + env(safe-area-inset-top));
    }

    .navbar-menu.show {
      top: calc(60px + env(safe-area-inset-top));
    }
  }
}
