/* ==========================================================================
   好きな時間を、もっと深く。— 4つの時間が、同じ場所で入れ替わる
   ＋ 聴きたいものと、つながる。（機器とのつながりの図）
   調整の目安：--story-main（大きい写真の幅）／--story-sub（添える写真の幅）
   入れ替わりは story.mjs（動きがオンのとき .story に .is-pinned と高さを付ける）。
   動きがオフ・JavaScriptなしでは、4つの時間を縦に並べる（スマホでも写真は重ねない）。
   ========================================================================== */
.everyday {
  --story-main: min(50vw, 70vh, 660px);
  --story-sub: min(25vw, 36vh, 340px);
  background: var(--paper); padding-block: 36px 48px; overflow: clip;
}
.everyday .section-heading { margin-bottom: 0; display: grid; grid-template-columns: 1fr 1fr; column-gap: 40px; align-items: end; }
.everyday .everyday-intro { max-width: 980px; }
.everyday .section-heading .eyebrow { grid-column: 1 / -1; margin-bottom: 12px; }
.everyday .section-intro { margin-top: 0; font-size: 17px; }
.everyday .display { font-size: clamp(34px, 3.3vw, 46px); }
.everyday .eyebrow { color: var(--accent-strong); }

/* ---- 章：大きな写真と、題と、添えるもう1枚（縦に並ぶ形） ---- */
.story { margin: 0; }
.story-stage { display: grid; gap: 40px; }
.story-scenes { display: grid; gap: clamp(64px, 9vh, 110px); }
.story-chapter { display: flex; align-items: flex-end; justify-content: center; gap: clamp(28px, 5vw, 88px); width: min(1240px, calc(100% - 96px)); margin-inline: auto; }
.story-chapter[data-side="right"] { flex-direction: row-reverse; }
.story-frame { position: relative; overflow: hidden; border-radius: var(--radius-l); background: var(--surface-2); box-shadow: var(--shadow-soft); }
.story-frame img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 5; object-fit: cover; }
.story-frame--main { flex: none; width: var(--story-main); }
.story-aside { flex: none; width: var(--story-sub); display: flex; flex-direction: column; gap: 26px; margin-bottom: clamp(40px, 12vh, 140px); }
.story-title { font-size: clamp(19px, 1.7vw, 24px); font-weight: 600; letter-spacing: 0; line-height: 1.5; color: var(--ink); }
.story-title::before { content: ""; display: block; width: 28px; height: 2px; margin-bottom: 18px; border-radius: 2px; background: var(--grad-progress); }
.story-frame--sub { border-radius: var(--radius-m); }
.story-caption { width: min(1240px, calc(100% - 96px)); margin: 32px auto 0; text-align: center; font-size: clamp(20px, 2vw, 28px); font-weight: 600; letter-spacing: 0; color: var(--ink-soft); }

/* ---- 同じ場所で入れ替わる形（PC：大きな写真は左、題と添える写真は右。高さと --stage-h は story.mjs） ---- */
.story.is-pinned { height: var(--story-h, auto); --story-main: min(42vw, calc((var(--scene-h, 560px) - 32px) * .8)); --story-sub: calc(var(--story-main) * .5); }
.story.is-pinned .story-stage { position: sticky; top: var(--nav-height); height: var(--stage-h, 100vh); display: flex; flex-direction: column; gap: 24px; padding-block: 24px 36px; }
.story.is-pinned .story-scenes { position: relative; flex: 1; min-height: 0; display: block; }
/* 見えていない時間も文字は読み上げられるよう、隠すのは透明度だけ */
.story.is-pinned .story-chapter, .story.is-pinned .story-chapter[data-side="right"] { position: absolute; inset: 0; margin: auto; flex-direction: row; align-items: center; opacity: 0; }
.story.is-pinned.has-scene .story-chapter { transition: opacity .9s var(--ease-soft); }
.story.is-pinned .story-chapter.is-active { opacity: 1; z-index: 1; }
.story.is-pinned .story-aside { width: max(240px, var(--story-sub)); margin-bottom: 0; translate: none; }
.story.is-pinned .story-frame--sub { width: var(--story-sub); }
.story.is-pinned .story-frame img { transition: transform 1.6s var(--ease); }
.story.is-pinned .story-chapter:not(.is-active) .story-frame img { transform: scale(1.04); }
/* 写真に浮かぶガラスの粒（SOUND / 11）。いま見えている写真の上に重ねる */
.story-orbs { position: absolute; z-index: 2; pointer-events: none; border-radius: var(--radius-l); opacity: 0; transition: opacity .8s var(--ease-soft); }
.story-orbs.is-ready { opacity: 1; }
/* いまどの時間か（4つの点） */
.story-dots { position: absolute; left: 50%; bottom: 24px; z-index: 3; display: flex; gap: 10px; translate: -50% 0; }
.story-dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--line-strong); transition: background .4s ease, scale .4s var(--ease); }
.story-dots span.is-active { background: var(--accent); scale: 1.35; }

.story:not(.is-pinned) :is(.story-dots, .story-orbs) { display: none; }

/* ---- 聴きたいものと、つながる ---- */
.everyday .everyday-bottom { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.3fr); max-width: 1000px; gap: clamp(24px, 3vw, 40px); align-items: center; margin-top: 36px; padding-top: 28px; border-top: 1px solid var(--line); }
.everyday-bottom h3 { font-size: clamp(22px, 1.8vw, 25px); line-height: 1.55; letter-spacing: -.01em; margin-bottom: 16px; }
.everyday-bottom p { font-size: 16px; line-height: var(--leading); color: var(--muted); }
.connection-note { display: block; font-size: 12.5px; line-height: var(--leading-note); color: var(--faint); margin-top: 16px; }

.connect-map { position: relative; width: 100%; min-width: 0; max-width: 560px; min-height: 280px; aspect-ratio: 1000 / 500; justify-self: center; }
.connect-lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.connect-lines--compact { display: none; }
.connect-line { fill: none; stroke: var(--accent); stroke-width: 1.4; stroke-linecap: round; opacity: .55; }
.connect-hub { position: absolute; left: 50%; top: 50%; width: 33%; margin: 0; transform: translate(-50%, -52%); }
/* スタジオの背景だけを紙の色へ溶かす（製品と影は不透明のまま） */
.connect-hub img { display: block; width: 100%; height: auto; -webkit-mask-image: radial-gradient(ellipse 46% 50% at 50% 46%, #000 70%, transparent 100%); mask-image: radial-gradient(ellipse 46% 50% at 50% 46%, #000 70%, transparent 100%); }
.connect-hub-name { position: absolute; left: 0; right: 0; bottom: -2%; text-align: center; font-size: 12px; font-weight: 600; letter-spacing: .04em; color: var(--ink-soft); }
.connect-core { position: absolute; left: 70.2%; top: 29.1%; transform: translate(-50%, -50%); padding: 4px 11px; border-radius: 99px; background: var(--paper); border: 1px solid var(--accent-soft); font-size: 11px; font-weight: 600; letter-spacing: .03em; color: var(--accent-strong); white-space: nowrap; box-shadow: var(--shadow-chip); }
.connect-devices { list-style: none; margin: 0; padding: 0; }
.connect-device { position: absolute; width: 17%; display: flex; flex-direction: column; align-items: center; gap: 3px; text-align: center; transform: translate(-50%, -50%); }
.connect-device[data-device="phone"] { left: 9%; top: 14.5%; }
.connect-device[data-device="tablet"] { left: 9%; top: 49%; }
.connect-device[data-device="pc"] { left: 9%; top: 83.5%; }
.connect-device[data-device="tv"] { left: 91%; top: 24.5%; }
.connect-device[data-device="record"] { left: 91%; top: 75.5%; }
.connect-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--paper); box-shadow: var(--shadow-chip), inset 0 0 0 1px var(--line); }
.connect-icon svg { width: 27px; height: 27px; fill: none; stroke: var(--ink-soft); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.connect-name { font-size: 12px; font-weight: 600; letter-spacing: .02em; color: var(--ink); margin-top: 3px; }
.connect-via { font-size: 11px; line-height: 1.5; color: var(--accent-strong); }

@media (max-width: 1000px) {
  .everyday .everyday-bottom { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 700px) {
  .everyday { --story-main: calc(100vw - 40px); --story-sub: 56vw; padding-block: 16px 40px; }
  .everyday .section-heading { display: block; margin-bottom: 0; }
  .everyday .section-intro { font-size: 15px; line-height: 1.7; margin-top: 12px; }
  .everyday .eyebrow { font-size: 12px; }
  .everyday .display { font-size: clamp(28px, 7.7vw, 34px); }
  /* 縦に並ぶ形：大きな写真、題、添える写真の順。どちらも画面の幅いっぱいで、重ねない */
  .story-stage { gap: 28px; }
  .story-scenes { gap: 64px; }
  .story.is-pinned .story-stage { gap: 16px; padding-block: 20px 32px; }
  .story-chapter, .story-chapter[data-side="right"] { width: 100%; flex-direction: column; align-items: stretch; gap: 0; padding-inline: 20px; }
  .story-aside { width: 100%; margin: 18px 0 0; gap: 14px; }
  .story-title { font-size: 18px; }
  .story-title::before { margin: 0 0 12px; }
  .story-frame, .story-frame--sub { border-radius: var(--radius-m); }
  .story-caption { width: auto; margin-top: 24px; padding-inline: 20px; font-size: 18px; }
  /* 同じ場所で入れ替わる形：題の下にひとつの枠。大きな写真 → 添える写真 → 次の時間、の順に同じ枠で替わる */
  .story.is-pinned { --frame-w: min(100vw - 40px, (var(--scene-h, 520px) - 108px) * .8); }
  .story.is-pinned .story-chapter, .story.is-pinned .story-chapter[data-side="right"] { display: grid; grid-template-areas: "title" "photo"; align-content: center; justify-content: center; row-gap: 12px; width: 100%; padding: 0 0 32px; justify-items: center; }
  .story.is-pinned .story-aside { display: contents; }
  .story.is-pinned .story-title { grid-area: title; width: min(100vw - 40px, 400px); font-size: 17px; }
  .story.is-pinned .story-title::before { display: none; }
  .story.is-pinned .story-frame--main, .story.is-pinned .story-frame--sub { grid-area: photo; width: var(--frame-w); transition: opacity .8s var(--ease-soft); }
  .story.is-pinned .story-chapter:not([data-beat="1"]) .story-frame--sub { opacity: 0; }
  .story.is-pinned .story-chapter[data-beat="1"] .story-frame--main { opacity: 0; }
  .story-orbs { border-radius: var(--radius-m); }
  .story-dots { bottom: 12px; }
  .everyday .everyday-bottom { margin-top: 24px; padding-top: 24px; gap: 20px; }
  .everyday-bottom h3 { font-size: clamp(20px, 5.7vw, 22px); margin-bottom: 12px; }
  .everyday-bottom p { font-size: 15px; }
  /* 小さな画面：機器を上下の段に分け、中心の製品へ線でつなぐ（線は .connect-lines--compact） */
  .connect-map { max-width: 360px; min-height: 300px; aspect-ratio: 360 / 340; }
  .connect-lines--wide { display: none; }
  .connect-lines--compact { display: block; }
  .connect-hub { top: 49.2%; width: 46%; transform: translate(-50%, -50%); }
  .connect-hub-name { bottom: 5%; font-size: 11.5px; }
  .connect-core { left: 27.3%; top: 67.8%; font-size: 10.5px; padding: 3px 10px; }
  .connect-device { width: 33.4%; }
  .connect-device[data-device="phone"] { left: 16.7%; top: 19.2%; }
  .connect-device[data-device="tablet"] { left: 50%; top: 19.2%; }
  .connect-device[data-device="pc"] { left: 83.3%; top: 19.2%; }
  .connect-device[data-device="tv"] { left: 25%; top: 79.2%; width: 48%; }
  .connect-device[data-device="record"] { left: 75%; top: 79.2%; width: 48%; }
  /* 上の段は名前を上に、アイコンを線の側に置く（位置の基準はアイコンの中心） */
  .connect-device:is([data-device="phone"], [data-device="tablet"], [data-device="pc"]) { transform: translate(-50%, calc(-100% + 22px)); }
  .connect-device:is([data-device="phone"], [data-device="tablet"], [data-device="pc"]) .connect-icon { order: 2; margin-top: 6px; }
  .connect-device:is([data-device="phone"], [data-device="tablet"], [data-device="pc"]) .connect-name { margin-top: 0; }
  .connect-device:is([data-device="tv"], [data-device="record"]) { transform: translate(-50%, -22px); }
  .connect-icon { width: 44px; height: 44px; }
  .connect-icon svg { width: 27px; height: 27px; }
  .connect-name { font-size: 12.5px; margin-top: 4px; }
  .connect-via { font-size: 10.5px; }
}

/* ---------- 動き ---------- */
/* 縦に並ぶ形（入れ替わる形を使えないとき）：画面に入ると写真がマスクで開く */
html[data-motion="on"] .story:not(.is-pinned) .story-frame img { transition: transform 1.8s var(--ease), opacity 1.2s var(--ease-soft); }
html[data-motion="on"] .story:not(.is-pinned) .story-chapter:not(.is-in) .story-frame img { transform: scale(1.1); opacity: 0; }
html[data-motion="on"] .story:not(.is-pinned) .story-frame { transition: clip-path 1.6s var(--ease); clip-path: inset(0 round var(--radius-l)); }
html[data-motion="on"] .story:not(.is-pinned) .story-chapter:not(.is-in) .story-frame--main { clip-path: inset(12% 6% 0 6% round var(--radius-l)); }
html[data-motion="on"] .story:not(.is-pinned) .story-chapter:not(.is-in) .story-frame--sub { clip-path: inset(18% 10% 0 10% round var(--radius-m)); }
html[data-motion="on"] .story:not(.is-pinned) .story-frame--sub, html[data-motion="on"] .story:not(.is-pinned) .story-frame--sub img { transition-delay: .18s; }
/* 題は、時間が替わるたびに下からふわりと */
html[data-motion="on"] .story-title { transition: opacity 1s var(--ease-soft) .3s, transform 1.2s var(--ease) .3s; }
html[data-motion="on"] .story:not(.is-pinned) .story-chapter:not(.is-in) .story-title,
html[data-motion="on"] .story.is-pinned .story-chapter:not(.is-active) .story-title { opacity: 0; transform: translate3d(0, 16px, 0); }
html[data-motion="on"] .connect-line { stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 1.6s var(--ease-soft); }
html[data-motion="on"] .connect-map.is-in .connect-line { stroke-dashoffset: 0; transition-delay: calc(var(--n, 0) * .12s); }
.connect-pulse { fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linecap: round; opacity: 0; }
html[data-motion="on"] .connect-map.is-flowing .connect-pulse { opacity: .9; stroke-dasharray: .05 .95; animation: connect-flow 3.6s linear infinite; }
@keyframes connect-flow { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }

/* アンカーから開いても、固定される最初の画面に揃える。 */
#everyday { scroll-margin-top: -60px; }
@media (max-width: 700px) { #everyday { scroll-margin-top: -40px; } }
