/*
 * Hotfix 2026-04-22
 * Scope: mobile/tablet layout fixes for floating actions,
 * important notice visibility, and YouTube card sizing.
 * Footer rules merged to layout/_saikazo-footer.css (AS6.3).
 * Hero important/schedule tablet rules merged to _saikazo-home.css (AS6.3).
 */

@media (max-width: 1279px) {
  /* ② Avoid overlap with bottom fixed nav by hiding duplicate floating CTAs. */
  .c-fab-ai,
  .c-floating-cta,
  .footer-pagetop,
  .sp-fab {
    display: none !important;
  }

  /* ③ Header notice strip: prevent clipping behind surrounding UI. */
  .c-emergency-banner {
    padding-block: 0.5rem;
    padding-inline: clamp(0.625rem, 2.8vw, 0.9rem);
  }

  .c-emergency-banner__inner {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 0.375rem;
  }

  .c-emergency-banner__title,
  .c-emergency-banner__text {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    word-break: break-word;
  }

  /* ③④ hero important + schedule: merged to _saikazo-home.css */

  /* ④ YouTube cards: smaller side-by-side cards on phone/tablet. */
  .sz-youtube__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(0.625rem, 2.8vw, 0.9rem);
    overflow: visible;
    padding-block-end: 0;
    scroll-snap-type: none;
  }

  .sz-youtube__item {
    flex: initial;
    min-width: 0;
    border-radius: 0.875rem;
  }

  .sz-youtube__caption {
    padding: 0.5rem 0.625rem 0.625rem;
    font-size: clamp(0.75rem, 2.6vw, 0.875rem);
    line-height: 1.4;
  }

  .sz-youtube-modal__dialog {
    width: min(100%, 960px);
    max-height: min(82vh, 700px);
  }
}

@media (max-width: 359px) {
  /* Keep side-by-side intent even on narrow devices by shrinking text. */
  .footer-reservation-banner__link {
    font-size: 0.75rem;
    letter-spacing: -0.01em;
  }

  .sz-youtube__caption {
    font-size: 0.75rem;
  }
}

/* ============================================================
 * Extended fixes (phase 2) — 2026-04-22
 * ============================================================ */

/* A) SP header: keep hospital name on a single line with ellipsis so
 *    the notice / hero stack below never gets compressed. */
@media (max-width: 767px) {
  .sz-header__mobile-inner {
    column-gap: clamp(0.25rem, 1.5vw, 0.5rem);
  }

  .sz-header__mobile-logo {
    min-width: 0;
    flex: 1 1 auto;
  }

  .sz-header__mobile-logo-img {
    flex-shrink: 0;
  }

  .sz-header__mobile-logo-name {
    min-width: 0;
    flex: 1 1 auto;
    font-size: clamp(0.7rem, 3vw, 0.95rem);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .sz-header__mobile-tel,
  .sz-header__hamburger {
    flex-shrink: 0;
  }
}

/* B) Tablet hero schedule: merged to _saikazo-home.css (AS6.3) */

/* C) PWA install banner: guarantee clearance above the bottom nav bar
 *    even on devices with large safe-area insets. */
@media (max-width: 1023px) {
  .c-pwa-banner:not(.c-pwa-banner--update) {
    bottom: calc(env(safe-area-inset-bottom, 0px) + 3.75rem);
  }
}

/* D) YouTube modal: larger touch target for the close button and
 *    prevent iOS rubber-band from scrolling the page behind. */
.sz-youtube-modal {
  overscroll-behavior: contain;
}

.sz-youtube-modal__close {
  min-inline-size: 44px;
  min-block-size: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sz-youtube__thumb {
  min-block-size: 44px;
}

/* E) Body bottom padding: zero-out on desktop where the mobile bottom
 *    bar is hidden, and keep safe-area inclusive spacing on mobile. */
@media (max-width: 1023px) {
  body {
    padding-block-end: calc(3.5rem + env(safe-area-inset-bottom, 0px));
  }
}

@media (min-width: 1024px) {
  body {
    padding-block-end: 0;
  }
}

/* F) Header logo image: ensure non-square custom logos are not stretched. */
.sz-header__mobile-logo-img,
.sz-header__logo-img {
  object-fit: contain;
  object-position: center;
}

/* G) Stacking: merged to _bottom-bar.css + _pwa.css (AS6.3 CSS-02) */

/* H) Emergency banner margin: merged to _emergency-banner.css (AS6.3 CSS-02) */

/* I) Page anchor nav: merged to _saikazo-subpage.css (AS6.3 CSS-02) */

/* K) FAB文言はみ出し修正（デスクトップ表示時） */
@media (min-width: 1280px) {
  .c-fab-ai {
    width: 64px;
    height: 64px;
    gap: 1px;
  }

  .c-fab-ai__icon {
    font-size: 1.4rem;
  }

  .c-fab-ai__label {
    font-size: 0.55rem;
    line-height: 1.05;
    letter-spacing: -0.02em;
    max-inline-size: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* L) 表組み左寄せ: merged to _saikazo-subpage-detail.css (AS6.3 CSS-02) */

/* M) 全体トーン微調整（木古内町サイト準拠の落ち着いた質感） */
:root {
  --kiko-calm-border: #d8d6d1;
  --kiko-calm-shadow: 0 2px 10px rgba(26, 43, 63, 0.06);
  --kiko-calm-shadow-hover: 0 6px 18px rgba(26, 43, 63, 0.1);
  --kiko-calm-tint: #f3f6fa;
}

#main-content .sakura-content-box,
#main-content .sakura-contact-box,
#main-content .sakura-info-box,
#main-content .sakura-intro-box,
#main-content .sakura-note-box,
#main-content .sakura-related-card,
#main-content .c-card,
#main-content .dept-table-modern,
#main-content .sakura-table-wrapper,
#main-content .access-map-section,
#main-content .sakura-section {
  border-color: var(--kiko-calm-border);
}

#main-content .sakura-content-box,
#main-content .sakura-contact-box,
#main-content .sakura-related-card,
#main-content .c-card,
#main-content .dept-table-modern,
#main-content .sakura-table-wrapper {
  box-shadow: var(--kiko-calm-shadow);
}

#main-content .sakura-related-card,
#main-content .c-card,
#main-content .sakura-table-wrapper {
  background: var(--color-surface);
}

#main-content .c-button,
#main-content .sakura-btn {
  border-radius: 10px;
  letter-spacing: 0.01em;
  box-shadow: 0 1px 3px rgba(26, 43, 63, 0.08);
}

#main-content .c-button:hover,
#main-content .sakura-btn:hover {
  box-shadow: var(--kiko-calm-shadow-hover);
}

#main-content .c-button--secondary,
#main-content .sakura-btn--white,
#main-content .sakura-btn--ghost {
  background: var(--kiko-calm-tint);
}
