/* ==========================================================================
   CHAPTER 01 | INTRO
   ========================================================================== */

.intro {
  /* ── Adjustable ───────────────────────────────────────────────
     --intro-length : 区間全体の高さ。演出に使えるスクロール量は
                      (--intro-length − 1画面)。 3.4 → 約2.4画面分。
     --media-pos    : 写真の object-position（構図の基準位置）
     --logo-h       : ワードマークの高さ（幅は正式ロゴの比率 8.81:1 で自動）       */
  --intro-length: 2.6;   /* 2026-12-01 段階3：3.4 → 2.6（約1.6画面。旧方式 ?motion=legacy は 3.4） */
  --media-pos: 50% 50%;
  --logo-h: 13px;

  position: relative;
  height: calc(var(--vh-large) * var(--intro-length));
  background: var(--c-black);
}

.intro__stage {
  position: sticky;
  top: 0;
  height: var(--vh-large);          /* fills the screen even when the iOS toolbar collapses */
  overflow: hidden;
  contain: layout paint;
  isolation: isolate;
  background: var(--c-ink);
}

/* ── Media ─────────────────────────────────────────────────── */
.intro__media {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.intro__picture {
  position: absolute;
  inset: 0;
  display: block;
}
.intro__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--media-pos);
  transform-origin: 50% 50%;
  will-change: transform;
  backface-visibility: hidden;
  user-select: none;
  -webkit-user-drag: none;
}

/* ── Atmosphere layers ─────────────────────────────────────── */
.intro__shade {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(to bottom, rgba(0,0,0,.42) 0%, rgba(0,0,0,0) 18%),
    linear-gradient(to top, rgba(0,0,0,.78) 0%, rgba(0,0,0,.46) 26%, rgba(0,0,0,0) 56%),
    radial-gradient(120% 80% at 50% 45%, rgba(0,0,0,0) 55%, rgba(0,0,0,.38) 100%);
}
.intro__grain {
  position: absolute;
  inset: -50%;
  z-index: 3;
  pointer-events: none;
  opacity: .09;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .6 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}
.intro__black {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background: var(--c-black);
  opacity: 0;
}

/* ── UI layer ──────────────────────────────────────────────── */
.intro__ui {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 5;
  height: var(--vh-small);          /* stays above the iOS toolbar on first load */
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding:
    calc(var(--safe-top) + 14px)
    var(--gutter)
    calc(var(--safe-bottom) + 26px);
  pointer-events: none;
}
.intro__ui a,
.intro__ui button { pointer-events: auto; }

.intro__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
}
.brand { display: inline-flex; align-items: center; min-height: 44px; }   /* 44px tap height; logo position unchanged */
.brand__logo {
  height: var(--logo-h);
  width: auto;
}

/* SHOP ↗ — quiet text link to the Shopify store (replaces the old menu icon) */
.shop-link {
  display: inline-flex;
  align-items: center;
  gap: .55em;
  min-height: 44px;                 /* 44px tap height */
  padding: 0 10px 0 16px;
  margin-right: -10px;              /* optical alignment to the gutter, keeps the hit area */
  font: 500 11.5px/1 var(--font-text);
  letter-spacing: .24em;
  color: var(--c-white);
  text-shadow: 0 0 14px rgba(0, 0, 0, .35);   /* stays legible over light parts of the photo */
  -webkit-tap-highlight-color: transparent;
}
.shop-link .arrow-ne { font-size: 12.5px; }
@media (hover: hover) {
  .shop-link .arrow-ne { transition: transform .4s var(--ease-out); }
  .shop-link:hover .arrow-ne { transform: rotate(-45deg) translateX(3px); }
}

/* ── Copy ─────────────────────────────────────────────────── */
.intro__copy { color: var(--c-white); }

.intro__eyebrow,
.intro__cue {
  font-family: var(--font-text);
  font-weight: 500;
  font-size: 11.5px;
  line-height: 10.5px;              /* text 11.5px, line box kept at the approved 10.5px → layout unchanged */
  letter-spacing: .24em;
  text-transform: uppercase;
  will-change: opacity, transform;
}
.intro__eyebrow {
  margin-bottom: 18px;
  color: rgba(255,255,255,.82);
}

.intro__title {
  display: flex;
  flex-direction: column;
  font-family: var(--font-display);
  font-weight: 900;
  /* "STANDARD." (the widest line, ≈5.42em) spans the full content width */
  font-size: calc((100vw - 2 * var(--gutter)) / 5.42);
  line-height: .86;
  letter-spacing: -.045em;
  text-transform: uppercase;
  font-kerning: normal;
}
.intro__line {
  display: block;
  white-space: nowrap;
  will-change: opacity, transform;
}

.intro__cue {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 26px;
  color: rgba(255,255,255,.72);
}
.intro__cue-line {
  position: relative;
  width: 44px;
  height: 1px;
  overflow: hidden;
  background: rgba(255,255,255,.22);
}
.intro__cue-line::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--c-white);
  transform: translateX(-100%);
  animation: intro-cue 2.4s var(--ease-out) infinite;
}
@keyframes intro-cue {
  0%   { transform: translateX(-100%); }
  55%  { transform: translateX(0); }
  100% { transform: translateX(100%); }
}

/* ── Tablet / PC ──────────────────────────────────────────── */
@media (min-width: 768px) {
  .intro { --logo-h: 15px; }
  .intro__ui { padding-top: calc(var(--safe-top) + 24px); padding-bottom: 40px; }
  .intro__title { font-size: calc((100vw - 2 * var(--gutter)) / 6.2); }
  .intro__eyebrow, .intro__cue { font-size: 11px; }
}

/* ── Phone landscape only（高さ 500px 以下の横向き・幅 1023px 以下）──────────
   横向きのスマートフォンでは幅基準の大見出しが画面の高さに収まらず STANDARD. が切れるため、
   このときだけ大見出しを画面の高さ基準でも制限する。PC・モバイル縦・タブレットには影響しない。 */
@media (orientation: landscape) and (max-height: 500px) and (max-width: 1023px) {
  .intro__title { font-size: min(calc((100vw - 2 * var(--gutter)) / 6.2), calc(var(--vh-small) * .18)); }
}
@media (min-width: 1024px) {
  /* 縦位置写真（hero-concrete-03）を横長画面で使う間の暫定。頭部が切れない位置。
     PC用の横位置素材を受領したら 50% 50% 付近へ */
  .intro { --logo-h: 17px; --media-pos: 50% 15%; }
  .intro__copy {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "eyebrow eyebrow"
      "title   cue";
    align-items: end;
  }
  .intro__eyebrow { grid-area: eyebrow; margin-bottom: 26px; }
  .intro__title   { grid-area: title; font-size: clamp(3.25rem, 11.6vw, 13.5rem); }
  .intro__cue     { grid-area: cue; margin: 0 0 .6em; }
}

/* ── Landscape PC (≥1024px wide, landscape only) ──────────────────────────
   縦長の写真を縦横比のまま右側に全高で置き、写真の左端（コンクリートの壁）を
   背景の暗いトーンへ溶かす。大見出しは左の余白に置き、写真の壁の部分までにとどめる
   （顔・胸ロゴ・体には重ならない）。スクロールすると写真の枠ごと胸ロゴへ寄り、画面を占めていく。
   タブレット縦・モバイルには影響しない。
     --panel-w     : 写真の幅（画面の高さ × 写真の縦横比 1023:1537）
     --panel-reach : 写真の左端から、文字が重なってよい割合（壁だけの範囲。体は 0.23 から）
     --pc-title-max: 大見出しの最大サイズ                                          */
@media (min-width: 1024px) and (orientation: landscape) {
  .intro {
    --panel-w: calc(var(--vh-large) * 1023 / 1537);
    --panel-reach: .17;
    --pc-title-max: 11rem;
    --media-pos: 50% 50%;
    --copy-w: calc(100vw - var(--panel-w) * (1 - var(--panel-reach)) - var(--gutter));
  }
  .intro__stage {
    background:
      radial-gradient(70% 90% at 72% 40%, rgba(64, 60, 55, .55) 0%, rgba(26, 25, 23, 0) 70%),
      linear-gradient(100deg, #0e0e0d 0%, #171614 55%, #1d1c1a 100%);
  }
  .intro__media {
    left: auto;
    right: 0;
    width: var(--panel-w);
    will-change: transform;           /* the panel itself pushes in toward the chest logo (js/ch01-intro.js) */
    backface-visibility: hidden;
    -webkit-mask-image: linear-gradient(to right, transparent 0%, rgba(0,0,0,.35) 7%, rgba(0,0,0,.8) 15%, #000 24%);
            mask-image: linear-gradient(to right, transparent 0%, rgba(0,0,0,.35) 7%, rgba(0,0,0,.8) 15%, #000 24%);
  }
  /* the panel scales, not the photo → the photo keeps one raster, so scrolling back is pixel-identical */
  .intro__img { will-change: auto; }
  .intro__ui { padding-bottom: calc(var(--safe-bottom) + 56px); }
  .intro__copy {
    display: block;
    width: var(--copy-w);
  }
  .intro__eyebrow,
  .intro__cue { font-size: 12px; line-height: 1; letter-spacing: .26em; }
  .intro__eyebrow { margin-bottom: 30px; color: rgba(255,255,255,.86); }
  .intro__title {
    font-size: min(calc((var(--copy-w) - var(--gutter)) / 5.42), 17.5vh, var(--pc-title-max));
  }
  .intro__cue { margin: 40px 0 0; color: rgba(255,255,255,.74); }
}

/* 旧方式との比較（?motion=legacy）：段階3以前の区間の長さ */
.motion-legacy .intro { --intro-length: 3.4; }

/* ── Static (reduced motion / no JS) ──────────────────────── */
.intro.is-static { height: var(--vh-small); }
.intro.is-static .intro__stage { position: relative; height: var(--vh-small); }
.intro.is-static .intro__img { will-change: auto; }

@media (prefers-reduced-motion: reduce) {
  .intro { height: var(--vh-small); }
  .intro__stage { position: relative; height: var(--vh-small); }
  .intro__cue-line::after { animation: none; transform: none; }
}

/* ── Debug overlay (?debug) ───────────────────────────────── */
.intro-debug {
  position: absolute;
  z-index: 9;
  pointer-events: none;
  font: 500 10px/1.3 var(--font-text);
  letter-spacing: .08em;
  color: #ff5a36;
}
.intro-debug__hud {
  position: fixed;
  top: calc(var(--safe-top) + 64px);
  right: 10px;
  z-index: 10;
  padding: 6px 8px;
  background: rgba(0,0,0,.6);
  font: 500 10px/1.5 ui-monospace, Menlo, monospace;
  color: #fff;
  pointer-events: none;
  white-space: pre;
}
.intro-debug__dot {
  position: absolute;
  width: 14px; height: 14px;
  margin: -7px 0 0 -7px;
  border: 1.5px solid #ff5a36;
  border-radius: 50%;
}
.intro-debug__dot span {
  position: absolute;
  left: 18px; top: 0;
  white-space: nowrap;
}
