/* ==========================================================
   Responsive overrides — mobile/tablet adjustments
   ========================================================== */

/* Global overflow protection (always on) */
html, body { overflow-x: hidden; max-width: 100%; }
section, .section, .container, .hero, .footer { max-width: 100%; overflow-x: clip; }
img, video, iframe { max-width: 100%; height: auto; }
* { min-width: 0; }
table { max-width: 100%; }

/* Debug mode — append ?debug to URL to highlight overflowing elements */
html.debug-overflow * { outline: 1px solid rgba(255, 0, 0, .25) !important; }
html.debug-overflow *:where(:has(*)):not(html, body) { box-shadow: inset 0 0 0 1px rgba(0, 200, 0, .3); }

@media (max-width: 960px) {
  .container { padding: 0 20px; }

  /* Word break for long text */
  h1, h2, h3, h4, .hero-title, blockquote { word-break: break-word; overflow-wrap: break-word; }

  /* Hide decorative absolute-positioned hero accessories on mobile */
  .hero-meta, .hero-scroll { display: none !important; }

  /* Subhero (tourism-list) — same mobile treatment */
  .subhero { height: 56vh !important; min-height: 380px !important; }
  .subhero h1 { font-size: 32px !important; line-height: 1.35 !important; }
  .subhero p { font-size: 14px !important; line-height: 1.85 !important; }
  .subhero-inner {
    padding: 64px 20px 40px !important;
    max-width: 100% !important;
  }

  /* Negative-positioned num badges — keep inside */
  .v-image .num-badge,
  .svc-image .num-badge,
  .feat-main .num-badge {
    top: -12px !important;
    left: -12px !important;
  }

  /* Hero adjustments — covers .hero h1, .subhero h1, .hero-title (top page) */
  .hero {
    height: inherit;
    min-height: inherit;
    padding: 74px 20px 50px !important;
  }
  .hero h1,
  .subhero h1,
  .hero-title {
    font-size: 30px !important;
    line-height: 1.35 !important;
    max-width: 100% !important;
    word-break: break-word !important;
  }
  .hero p.lead,
  .hero-sub,
  .subhero p {
    font-size: 14px !important;
    line-height: 1.85 !important;
    max-width: 100% !important;
  }
  /* スマホでは管理画面で入れた手動改行 (br) を無視して自然な折返しに */
  .hero p.lead br { display: none !important; }
  .hero-tag,
  .subhero-tag,
  .hero-cat {
    font-size: 10px !important;
    padding: 6px 12px !important;
    letter-spacing: .25em !important;
  }
  .hero-actions { flex-direction: column !important; gap: 12px !important; align-items: stretch !important; }
  .hero-actions .btn { width: 100% !important; max-width: 100% !important; text-align: center; }

  /* Section padding */
  .section { padding: 56px 0; }

  /* Sticky sub-nav becomes scrollable */
  .sub-nav-inner,
  .filter-inner,
  .svc-nav-inner {
    padding: 12px 16px;
    gap: 12px;
  }
  .sub-nav-tab,
  .filter-tab,
  .svc-nav-tab {
    padding: 8px 14px;
    font-size: 12px;
  }

  /* Buttons full width by default in stacked CTAs */
  .bottom-cta .actions .btn,
  .cta-banner .actions .btn {
    width: 100%;
    max-width: 320px;
  }

  /* Footer collapse */
  .footer { padding: 56px 0 32px; }
  .footer-top { gap: 32px; padding-bottom: 32px; }

  /* Forms */
  .form { padding: 24px !important; }
  .form-row { grid-template-columns: 1fr !important; }

  /* Common CTA banner */
  .cta-banner h2,
  .bottom-cta h2 { font-size: 24px; }

  /* Quick bar (top page) */
  .quick-inner { flex-direction: column !important; gap: 16px !important; padding: 20px 16px !important; }
  .quick-items { flex-direction: column; gap: 12px !important; border: none !important; padding: 0 !important; }
  .quick-tel { font-size: 22px !important; }

  /* Tourism list — featured grid */
  .featured-grid,
  .tourism-grid { grid-template-columns: 1fr !important; gap: 16px; min-height: 0; }
  .feat-main, .feat-side-card { min-height: 280px; }
  .feat-side { gap: 16px; }
  .feat-main h3 { font-size: 26px !important; }
  .feat-side-card h3 { font-size: 20px !important; }

  /* Plans grid */
  .plans-grid { grid-template-columns: 1fr !important; gap: 20px; }
  .plans-head { flex-direction: column; align-items: flex-start !important; gap: 16px; }

  /* Vehicle/business blocks */
  .v-block, .v-block.reverse,
  .svc-block, .svc-block.reverse {
    grid-template-columns: 1fr !important;
    gap: 32px !important;
  }
  .v-block.reverse .v-image,
  .svc-block.reverse .svc-image { order: 0 !important; }
  .v-image, .svc-image { height: 220px !important; }
  .v-image .num-badge,
  .svc-image .num-badge {
    width: 60px !important; height: 60px !important;
    font-size: 24px !important;
    top: -16px !important; left: -16px !important;
  }
  .v-content h2, .svc-content h2 { font-size: 26px !important; }
  .specs { grid-template-columns: repeat(2, 1fr) !important; gap: 8px !important; padding: 16px !important; }
  .v-features-list, .svc-features { grid-template-columns: 1fr !important; }

  /* Compare table — horizontal scroll */
  .compare-table { overflow-x: auto; }
  .compare-table table { min-width: 560px; }

  /* Booking channels */
  .channels-grid { grid-template-columns: 1fr !important; gap: 16px !important; }
  .channel { padding: 28px 24px !important; }

  /* Booking form layout */
  .form-wrap { grid-template-columns: 1fr !important; gap: 24px !important; }
  .stepper { position: static !important; display: flex; flex-wrap: wrap; gap: 6px !important; }
  .stepper-list { display: flex; flex-direction: row; gap: 6px; flex-wrap: wrap; }
  .step-item { padding: 10px 12px !important; }
  .step-item .step-text .ttl { font-size: 12px !important; }
  .vehicle-select { grid-template-columns: 1fr !important; }
  .options-row { grid-template-columns: 1fr !important; }
  .form-actions { flex-direction: column; gap: 16px; align-items: stretch !important; }
  .form-actions .btn { width: 100%; }

  /* Contact — categories */
  .cat-grid { grid-template-columns: 1fr !important; }
  .contact-wrap { grid-template-columns: 1fr !important; gap: 24px !important; }
  .info-card { position: static !important; }
  .purpose-pills { grid-template-columns: 1fr 1fr !important; }
  .office-wrap { grid-template-columns: 1fr !important; gap: 24px !important; }

  /* Reasons — 4 reasons */
  .reasons-grid { grid-template-columns: 1fr !important; gap: 16px; }
  .reason { padding: 32px 24px !important; }
  .reason .num { font-size: 56px !important; }

  /* Safety + training */
  .safety-grid { grid-template-columns: 1fr !important; gap: 16px; }
  .training-wrap { grid-template-columns: 1fr !important; gap: 24px !important; }
  .training-image { height: 200px !important; }
  .training-points { grid-template-columns: 1fr !important; }

  /* Voices grid */
  .voices-grid { grid-template-columns: 1fr !important; }
  .voices,
  .b2b-grid,
  .reasons-grid,
  .news-grid { grid-template-columns: 1fr !important; }

  /* Awards */
  .awards-grid { grid-template-columns: 1fr !important; }

  /* Top page sections */
  .fleet-grid { grid-template-columns: 1fr !important; }
  .fleet-card .img { height: 140px !important; font-size: 48px !important; }
  .b2b-grid { gap: 16px !important; }
  .reasons-grid { gap: 16px !important; }
  .access-wrap, .staff-wrap { grid-template-columns: 1fr !important; gap: 32px !important; }

  /* Recruit */
  .why-grid { grid-template-columns: 1fr !important; gap: 16px; }
  .why-card { padding: 28px !important; }
  .jobs-list .job { grid-template-columns: 1fr !important; gap: 20px !important; }
  .job-action { text-align: left !important; }
  .benefits-grid { grid-template-columns: 1fr 1fr !important; }

  /* Company */
  .message-wrap { grid-template-columns: 1fr !important; gap: 32px !important; }
  .message-photo { min-height: 280px !important; }
  .message-text blockquote { font-size: 20px !important; }
  .mission-grid { grid-template-columns: 1fr !important; gap: 16px !important; }
  .info-wrap { grid-template-columns: 1fr !important; gap: 32px !important; }
  .info-table { padding: 24px !important; }
  .info-table dl { grid-template-columns: 1fr !important; gap: 8px !important; }
  .info-table dt { padding-top: 0 !important; }
  .map { min-height: 280px !important; }

  /* Staff */
  .staff-grid { grid-template-columns: 1fr 1fr !important; gap: 12px !important; }
  .staff-card .body { padding: 16px !important; }
  .staff-card h3 { font-size: 16px !important; }
  .interview-wrap { grid-template-columns: 1fr !important; gap: 32px !important; }
  .interview-photo { min-height: 320px !important; }

  /* News */
  .news-wrap { grid-template-columns: 1fr !important; gap: 32px !important; }
  .news-item { grid-template-columns: 1fr !important; gap: 12px !important; padding: 20px 0 !important; }
  .news-item .ph { aspect-ratio: 16 / 9; }
  .pagination .page-btn:not(.active):not(.arrow) { display: none; }

  /* Tourism detail */
  .summary-inner { flex-direction: column; align-items: stretch !important; gap: 16px !important; padding: 16px 20px !important; }
  .summary-stats { flex-direction: column; gap: 12px !important; }
  .summary-actions { display: flex; gap: 8px; }
  .summary-actions .btn { flex: 1; }
  .layout { grid-template-columns: 1fr !important; gap: 32px !important; }
  .sidebar { position: static !important; padding: 24px !important; }
  .gallery {
    grid-template-columns: 1fr 1fr !important;
    grid-template-rows: auto !important;
    height: auto !important;
  }
  .gallery .ph { aspect-ratio: 4 / 3; }
  .gallery .ph:nth-child(1) { grid-row: auto !important; grid-column: span 2; }
  .timeline .tl-item,
  .tl-item { grid-template-columns: 40px 64px 1fr !important; gap: 8px !important; }
  .tl-time { font-size: 12px !important; }
  .tl-time small { font-size: 9px !important; }
  .related-grid { grid-template-columns: 1fr !important; }

  /* Vehicles - vehicle-select etc */
  .vehicle-select { grid-template-columns: 1fr !important; }
  .v-pricing { flex-direction: column; gap: 8px; align-items: flex-start !important; }
  .v-actions { flex-direction: column; }
  .v-actions .btn { width: 100%; justify-content: center; }

  /* Tourism plan-card — wider tap target and no overflow */
  .plan-card .body { padding: 18px !important; }
  .plan-card .meta { flex-wrap: wrap; gap: 8px !important; }
  .plan-card .price { flex-wrap: wrap; gap: 8px; }

  /* Stats / numbers — keep within container */
  .stat .num,
  .stat .val,
  .reason .num,
  .stats .num,
  .why-card .num { max-width: 100%; word-break: keep-all; }
  .stats-grid .stat { border-right: none !important; padding: 16px 0 !important; }
  .stats-grid { padding: 32px 16px !important; }

  /* Quick bar tel — prevent shrink overflow */
  .quick-tel { font-size: 20px !important; word-break: break-all; }

  /* Long Unsplash badges — keep inside */
  .badge { white-space: normal !important; }

  /* Footer brand max width */
  .footer-brand p { max-width: 100% !important; }

  /* News badge / cat — fit width */
  .news-item .meta { flex-wrap: wrap; gap: 8px !important; }

  /* Hero badge POPULAR (detail page) — hide on mobile */
  .hero-popular { display: none !important; }

  /* Booking 3-channel CTA — stacked on mobile */
  .channel .btn-lg { width: 100%; }

  /* Featured tag pill (tour cards) */
  .feat-tag, .hero-cat, .hero-tag {
    letter-spacing: .15em !important;
    font-size: 10px !important;
  }

  /* Compare table guard */
  .compare-table { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .compare-table table { min-width: 540px; }

  /* Form full-width */
  .vehicle-select .v-opt { width: 100%; }
  .form-checkboxes { grid-template-columns: 1fr !important; }

  /* Recruit banner — stack on mobile */
  .recruit-inner { flex-direction: column !important; gap: 24px !important; align-items: stretch !important; padding: 0 20px !important; }
  .recruit h2 { font-size: 26px !important; }

  /* Quick bar bottom-cta-actions */
  .bottom-cta-actions { flex-direction: column; align-items: center; }
  .bottom-cta-actions .btn { width: 100%; max-width: 320px; }

  /* Custom (oder-made) — stack on mobile */
  .custom-inner { grid-template-columns: 1fr !important; gap: 32px !important; }
  .custom h2 { font-size: 26px !important; }

  /* Section heads with right-side button — stack */
  .section-head[style*="space-between"],
  .plans-head { flex-direction: column !important; align-items: flex-start !important; gap: 16px !important; }

  /* Filter bar long lists — allow horizontal scroll */
  .filter-tabs, .sub-nav-tabs, .svc-nav-tabs {
    -webkit-overflow-scrolling: touch;
  }

  /* Catchall — ensure no inline section h2 stays too large */
  .v-content h2,
  .svc-content h2,
  .training-text h2,
  .custom h2,
  .recruit h2,
  .message-text blockquote,
  .interview-text .q,
  .voice blockquote { font-size: 22px !important; line-height: 1.5 !important; }

  /* Tour card big h3 */
  .feat-main h3 { font-size: 22px !important; }
  .feat-side-card h3 { font-size: 18px !important; }
  .tour-card h3 { font-size: 22px !important; }
  .feat-main { padding: 24px !important; }
  .tour-card .body { padding: 24px !important; }
  .feat-main .body, .feat-side-card .body { padding: 24px !important; }

  /* Long captions / descriptions — keep within container */
  .feat-meta, .feat-stat, .stat { flex-wrap: wrap !important; }

  /* General overflow guard for any remaining wide elements */
  .section > *, section > * { max-width: 100%; }

  /* Last resort: ensure all flex containers can wrap, all grids stay 1fr-friendly */
  [class*="-grid"]:not(.purpose-pills):not(.staff-grid):not(.footer-top):not(.benefits-grid) {
    grid-template-columns: 1fr !important;
  }
  [class*="-row"], [class*="-actions"], [class*="-list"] { flex-wrap: wrap; }

  /* Hide horizontal connecting lines that look broken in vertical layouts */
  .flow-steps::before,
  .sched-timeline::before { display: none !important; }

  /* Tour card grid-row span doesn't apply in 1fr columns */
  .tour-card.feat,
  .feat-main { grid-row: auto !important; grid-column: auto !important; }

  /* Tabs: wrap to multiple lines on mobile (no horizontal squish) */
  .filter-inner, .sub-nav-inner, .svc-nav-inner {
    flex-wrap: wrap !important;
    overflow: visible !important;
    align-items: flex-start !important;
    padding: 14px 16px !important;
    gap: 8px 12px !important;
  }
  .filter-tabs, .sub-nav-tabs, .svc-nav-tabs {
    flex-wrap: wrap !important;
    flex: 1 1 100%;
  }
  .filter-tab, .sub-nav-tab, .svc-nav-tab {
    flex-shrink: 0;
    padding: 7px 14px !important;
    font-size: 12px !important;
  }
  .filter-label, .sub-nav-label, .svc-nav-label {
    flex: 1 1 100%;
    margin-bottom: 4px;
  }
}

@media (max-width: 540px) {
  .h-title { font-size: 24px; }
  .hero h1 { font-size: 28px; }
  .staff-grid { grid-template-columns: 1fr !important; }
  .benefits-grid { grid-template-columns: 1fr !important; }
  .gallery { grid-template-columns: 1fr !important; }
  .gallery .ph:nth-child(1) { grid-column: auto; }
  .stat .num,
  .stat .val { font-size: 36px !important; }
  .summary-stats { gap: 8px !important; }
  .summary-stat { padding: 6px 0; border-bottom: 1px solid var(--c-line); }
  .summary-stat:last-child { border: none; }
}
