/* ============================================
   Crystal Laforet — Mobile / iPhone optimization
   Applied on top of styles.css
   ============================================ */

/* iPhone safe areas + viewport fixes */
@supports (padding: max(0px)) {
  html {
    /* iOS Safari: prevent double tap zoom delays */
    touch-action: manipulation;
  }

  .header {
    padding-left: max(var(--pad-x), env(safe-area-inset-left));
    padding-right: max(var(--pad-x), env(safe-area-inset-right));
    padding-top: max(14px, env(safe-area-inset-top));
  }

  .float-cta {
    right: max(16px, env(safe-area-inset-right));
    bottom: max(16px, env(safe-area-inset-bottom));
  }

  .footer {
    padding-left: max(var(--pad-x), env(safe-area-inset-left));
    padding-right: max(var(--pad-x), env(safe-area-inset-right));
    padding-bottom: max(40px, env(safe-area-inset-bottom));
  }

  .mobile-menu {
    width: min(80vw, 320px);
    padding-left: env(safe-area-inset-left);
    padding-top: env(safe-area-inset-top);
  }
}

/* Tap highlight off (iOS) */
* { -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }

/* General mobile (≤ 760px) */
@media (max-width: 760px) {
  :root {
    --pad-x: 20px;
  }

  /* Word break & text overflow fix */
  * {
    word-break: break-word;
    overflow-wrap: break-word;
  }

  body {
    font-size: 14px;
    overflow-x: hidden;
  }

  /* Prevent horizontal scroll */
  html, body { max-width: 100vw; overflow-x: hidden; }

  /* Text elements with explicit word-break */
  h1, h2, h3, h4, h5, h6 {
    word-break: break-word;
    hyphens: auto;
    overflow-wrap: break-word;
  }

  p, .body, .body-sm, span, a, button {
    word-break: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
  }

  /* Long URLs & code */
  a, code {
    word-break: break-all;
  }

  .h-display, .h-display-en { font-size: clamp(36px, 11vw, 56px) !important; line-height: 1.1; letter-spacing: 0.04em; word-break: break-word; }
  .h-1 { font-size: clamp(28px, 8vw, 40px) !important; word-break: break-word; }
  .h-2 { font-size: clamp(22px, 6vw, 30px) !important; word-break: break-word; }
  .body { font-size: 14px; line-height: 1.85; }
  .body-sm { font-size: 12px; }
  .eyebrow { font-size: 10px; letter-spacing: 0.32em; }

  .section { padding: 64px var(--pad-x); }

  /* Header & Mobile Menu */
  .header {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .header .nav {
    display: none !important;
  }

  .mobile-menu-toggle {
    display: flex;
  }

  .brand-mark { width: 22px; height: 22px; }
  .brand-name .ja { font-size: 10px; letter-spacing: 0.14em; }
  .brand-name .en { display: none; }

  /* Buttons — Touch target minimum 44×44 */
  .btn {
    padding: 16px 20px;
    font-size: 11px;
    letter-spacing: 0.22em;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .btn:hover { letter-spacing: 0.22em; } /* less aggressive on tap */
  .btn-sm {
    padding: 12px 16px;
    font-size: 10px;
    letter-spacing: 0.18em;
    min-height: 44px;
  }

  /* Links & interactive elements min 44×44 */
  a, button {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  /* Input fields 48px minimum height */
  input, select, textarea {
    min-height: 48px;
    padding: 12px 16px;
  }

  /* Hero */
  .hero { min-height: 100svh; padding: 0 var(--pad-x) 80px; }
  .hero-content { gap: 24px; }
  .hero-headline { font-size: clamp(40px, 11vw, 64px); letter-spacing: 0.04em; max-width: 14ch; line-height: 1.08; }
  .hero-sub { font-size: 16px; }
  .hero-eyebrow { font-size: 9px; letter-spacing: 0.36em; }
  .hero-meta { flex-direction: column; align-items: flex-start; gap: 24px; margin-top: 8px; }
  .hero-coords { text-align: left; flex-direction: row; gap: 12px; flex-wrap: wrap; font-size: 9px; }
  .hero-actions { width: 100%; flex-direction: column; align-items: stretch; gap: 12px; }
  .hero-actions .btn { width: 100%; }
  .hero-play { width: 64px; height: 64px; top: 38%; }
  .hero-play:hover { width: 70px; height: 70px; }
  .vertical-title { display: none; }
  .scroll-cue { font-size: 9px; letter-spacing: 0.28em; }
  .scroll-cue::after { height: 40px; }

  /* Marquee */
  .marquee-track .eyebrow { font-size: 10px !important; }

  /* Concept */
  .concept { gap: 32px; }
  .concept-kanji {
    writing-mode: horizontal-tb;
    font-size: clamp(64px, 22vw, 120px);
    letter-spacing: 0.05em;
    border-left: none;
    padding-left: 0;
  }
  .concept-kanji::before { display: none; }

  /* Layers */
  .layer { padding: 40px 24px; border-right: none; border-bottom: 1px solid var(--line-soft); }
  .layer:last-child { border-bottom: none; }
  .layer h3 { font-size: 22px; }
  .layer-depth { top: 40px; right: 24px; font-size: 8px; }

  /* Stats */
  .stat { padding: 28px 16px; }
  .stat .v { font-size: clamp(36px, 12vw, 56px); }
  .stat .l { font-size: 9px; letter-spacing: 0.24em; }
  .stat .sub { font-size: 11px; }

  /* Rooms grid */
  .rooms-grid { gap: 16px; }
  .room-card { background: var(--ink-1); }
  .room-body { padding: 24px; gap: 14px; }
  .room-title { font-size: 22px; }
  .room-en { font-size: 11px; letter-spacing: 0.18em; }
  .room-meta-row { gap: 14px; font-size: 9px; }
  .room-meta-row span strong { font-size: 13px; }
  .room-price .num { font-size: 26px; }
  .room-foot { gap: 12px; flex-wrap: wrap; }

  /* Rooms detail page */
  .room-card + * { margin-top: 0; }
  .room-detail-row { grid-template-columns: 1fr !important; gap: 0 !important; }
  .room-detail-row > div { padding: 24px !important; }

  /* Story / Experience */
  .story-rail { grid-template-columns: 1fr; gap: 24px; }
  .story-rail .timeline { position: static; flex-direction: row; overflow-x: auto; padding-bottom: 8px; gap: 8px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .story-rail .timeline::-webkit-scrollbar { display: none; }
  .timeline-item { flex-direction: column; gap: 4px; padding: 12px 14px; border-left: none; border-top: 1px solid var(--line-soft); min-width: 110px; flex-shrink: 0; }
  .timeline-item.active { border-top-color: var(--gold); background: linear-gradient(180deg, oklch(0.62 0.10 75 / 0.08), transparent); }
  .timeline-item .time { font-size: 10px; min-width: auto; }
  .timeline-item h4 { font-size: 13px; }
  .timeline-item p { font-size: 10px; }
  .story-stage { gap: 64px; }
  .story-num .n { font-size: 40px; }
  .story-text h2 { font-size: clamp(24px, 7vw, 32px); }
  .story-text .en { font-size: 14px; }
  .story-text p { font-size: 14px; line-height: 1.8; }

  /* Sauna */
  .sauna-hero { padding: 130px var(--pad-x) 64px; min-height: auto; }
  .sauna-content { grid-template-columns: 1fr; gap: 32px; }
  .sauna-card { padding: 24px; }
  .sauna-card .price-big { font-size: 44px; }

  /* Inbound */
  .why-block { grid-template-columns: 1fr; gap: 24px; padding: 48px 0; direction: ltr; }
  .why-block.flip { grid-template-columns: 1fr; direction: ltr; }
  .why-block h2 { font-size: clamp(32px, 9vw, 48px); }
  .why-block .lead { font-size: 18px; }

  /* Booking */
  .booking-shell { grid-template-columns: 1fr; gap: 32px; padding: 100px 16px 120px; }
  .booking-summary {
    position: static;
    order: -1;
    padding: 20px;
    gap: 12px;
  }
  .booking-summary h3 { font-size: 18px; }
  .summary-row { font-size: 12px; }
  .summary-row .lbl { font-size: 9px; letter-spacing: 0.16em; }
  .summary-row .val { font-size: 14px; }
  .summary-total .val { font-size: 24px; }

  .booking-steps { gap: 8px; margin-bottom: 28px; flex-wrap: wrap; }
  .booking-step { font-size: 10px; letter-spacing: 0.08em; }
  .booking-step .n { width: 22px; height: 22px; font-size: 9px; }
  .booking-step + .booking-step::before { width: 16px; }

  .cal { padding: 18px; }
  .cal-head h3 { font-size: 16px; }
  .cal-nav button { width: 32px; height: 32px; }
  .cal-day { font-size: 13px; }
  .cal-dow { font-size: 8px; padding: 6px 0; }

  .room-select { grid-template-columns: 100px 1fr; gap: 14px; padding: 14px; }
  .room-select > div:last-child { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; padding-top: 10px; border-top: 1px solid var(--line-soft); }
  .room-select > div:last-child > div:last-child { margin: 0 !important; } /* radio ball */
  .room-select h4 { font-size: 17px !important; }

  .pay-grid { grid-template-columns: 1fr; gap: 12px; }
  .field.span2 { grid-column: span 1; }
  .field input {
    font-size: 16px; /* iOS: 16px prevents zoom on focus */
    padding: 14px;
    /* Prevent zoom scroll on input focus */
    position: relative;
  }

  /* Prevent scroll-on-focus in iOS Safari */
  input:focus, select:focus, textarea:focus {
    font-size: 16px;
  }

  .confirm { padding: 60px 8px; gap: 24px; }
}
/* ============================================
   FROM THE JOURNAL — モバイル
   ============================================ */
@media (max-width: 900px) {
  .journal-head { flex-direction: column; align-items: flex-start; gap: 24px; margin-bottom: 40px; }
  .journal-grid {
    grid-template-columns: 1fr;
    gap: 48px;
  }
  .journal-card-feature .journal-card-img,
  .journal-card-img { aspect-ratio: 4/3; }
  .journal-card-title,
  .journal-card-feature .journal-card-title { font-size: 21px; -webkit-line-clamp: 3; }
  .journal-card-excerpt { -webkit-line-clamp: 3; }
  .journal-foot { margin-top: 40px; }

  .blog-hero { padding: 80px 20px 56px; padding-top: max(80px, env(safe-area-inset-top)); }
  .blog-hero-title { font-size: clamp(32px, 8vw, 56px); }
  .blog-grid-section { padding: 56px 20px 96px; }
  .blog-grid { grid-template-columns: 1fr; gap: 48px; }
  .blog-card-title { font-size: 19px; }
  .blog-modal { padding: 16px; }
  .blog-modal-inner { max-width: 100%; }
  .blog-modal-img { aspect-ratio: 4/3; }
  .blog-modal-body { padding: 24px 20px 40px; }
  .blog-modal-title { font-size: clamp(22px, 5.5vw, 32px); }
  .blog-modal-lead { font-size: 15px; }
  .blog-modal-para { font-size: 14px; line-height: 1.95; }
  .blog-modal-close {
    top: max(12px, env(safe-area-inset-top));
    right: max(12px, env(safe-area-inset-right));
    width: 44px; height: 44px;
  }
}

/* iOS safe-area for journal */
@supports (padding: max(0px)) {
  .journal-section { padding-left: max(var(--pad-x), env(safe-area-inset-left)); padding-right: max(var(--pad-x), env(safe-area-inset-right)); }
}

/* Prevent horizontal scroll for journal grid on small phones */
@media (max-width: 420px) {
  .journal-card-img { max-width: 100%; }
  .journal-card-title { font-size: 19px; }
  .journal-card-excerpt { font-size: 13px; }
  .journal-foot button { width: 100%; }
}
