/* ==========================================================================
   CUT LABO — 現在の混雑状況（公開Web画面）

   方針: 白地・余白多め・線は最小限のシンプルな構成。
   色はロゴ（CUT LABO）の赤と青だけを状態表示に使い、それ以外は無彩色に寄せる。
   中身を変えたら index.html の ?v=N と sw.js の CACHE_NAME を上げること。
   ========================================================================== */

:root {
  --bg:      #ffffff;
  --surface: #f4f5f7;  /* セグメンテッドコントロールの地・画像の下地 */
  --ink:     #14181c;  /* 見出し・本文 */
  --sub:     #6b7280;  /* 補助テキスト */
  --faint:   #9ca3af;  /* ラベル・単位 */
  --line:    #e5e7eb;  /* 罫 */

  /* ロゴ画像から実測した色。状態表示にだけ使う */
  --blue: #293d92;  /* 更新中 */
  --red:  #b74031;  /* 更新停止中 */

  --radius: 12px;
  --tick: 10s;      /* 更新サイクル。app.js の TICK と揃えること */
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', 'Noto Sans JP',
               'Meiryo', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --- ヘッダー ------------------------------------------------------------ */

.masthead {
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.masthead-inner {
  max-width: 480px;
  margin: 0 auto;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 64px;
}

.logo {
  height: 40px;
  width: auto;
  display: block;
}

/* ロゴ画像が無いあいだの代替表記 */
.wordmark {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

/* --- 導入 ---------------------------------------------------------------- */

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 20px;
}

.intro {
  padding: 36px 0 24px;
}

.title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.4;
}

.lede {
  margin-top: 6px;
  font-size: 13px;
  color: var(--sub);
}

/* --- 店舗タブ（セグメンテッドコントロール） -------------------------------
 * 店舗が増えたら横に伸び、入りきらなければスクロールする。
 */

.segmented {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface);
  border-radius: 10px;
  overflow-x: auto;
  scrollbar-width: none;
}

.segmented::-webkit-scrollbar { display: none; }

.segment {
  flex: 1 0 auto;
  min-width: 96px;
  padding: 9px 14px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--sub);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.segment:hover { color: var(--ink); }

.segment.is-active {
  background: var(--bg);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(20, 24, 28, 0.10);
}

/* --- 店舗パネル ---------------------------------------------------------- */

.store-panel { padding-top: 24px; }

.frame {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}

.stage {
  position: relative;
  /* カメラ配信画像の比率（640x360 = 16:9）に合わせる。
     ここを配信元と違う比率にすると object-fit 側で画角が削られる。 */
  aspect-ratio: 16 / 9;
}

.layer {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 700ms ease;
}

.layer.is-front { opacity: 1; }

/* contain: 画角を絶対に切らない。比率違いのカメラに替わっても
   切り取らずに上下または左右へ余白（.frame の背景色）が入るだけになる。 */
.layer { display: block; width: 100%; height: 100%; object-fit: contain; }

/* 更新停止中は最後の画像を薄く残す（いつの状態かは分かるように） */
.store-panel.is-stalled .stage { filter: grayscale(1); opacity: 0.3; }

.store-panel.is-closed .stage,
.store-panel.is-paused .stage { display: none; }

/* --- 状態メッセージ ------------------------------------------------------ */

.notice {
  display: none;
  padding: 44px 24px;
  text-align: center;
}

.store-panel.is-closed .notice,
.store-panel.is-paused .notice { display: block; }

.store-panel.is-stalled .notice {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.notice-head {
  font-size: 15px;
  font-weight: 700;
}

.notice-body {
  margin-top: 4px;
  font-size: 13px;
  color: var(--sub);
  max-width: 22em;
  margin-inline: auto;
}

/* --- 更新インジケータ ------------------------------------------------------
 * 次の1枚が届くまでを画像下端の線で示す。
 */

.pulse {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: rgba(20, 24, 28, 0.06);
}

.pulse i {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--blue);
  transform-origin: left center;
  transform: scaleX(0);
  animation: sweep var(--tick) linear infinite;
}

@keyframes sweep {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

.store-panel.is-stalled .pulse,
.store-panel.is-closed .pulse,
.store-panel.is-paused .pulse { display: none; }

/* --- 状態行 -------------------------------------------------------------- */

.status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 2px 0;
}

.status-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 600;
  color: var(--blue);
  white-space: nowrap;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
  animation: breathe var(--tick) ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.3; transform: scale(0.7); }
}

.status-value {
  font-size: 13px;
  color: var(--faint);
}

.clock {
  color: var(--sub);
  font-variant-numeric: tabular-nums;
}

.store-panel.is-stalled .status-label { color: var(--red); }

.store-panel.is-closed .status-label,
.store-panel.is-paused .status-label { color: var(--faint); }

.store-panel.is-stalled .dot,
.store-panel.is-closed .dot,
.store-panel.is-paused .dot { animation: none; }

.store-panel.is-closed .status-value,
.store-panel.is-paused .status-value { display: none; }

/* --- 営業時間（店舗ごと） ------------------------------------------------- */

.hours {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.hours-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--faint);
  margin-bottom: 10px;
}

.hours-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  font-size: 14px;
}

.hours-row + .hours-row { border-top: 1px solid var(--line); }

.hours-day { color: var(--sub); }

.hours-time {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.hours-row.is-closed .hours-time { font-weight: 400; color: var(--sub); }

/* --- 注記 ---------------------------------------------------------------- */

.footnote {
  margin: 36px 0 40px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  line-height: 1.8;
  color: var(--faint);
}

/* --- a11y ---------------------------------------------------------------- */

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .dot { animation: none; }
  .pulse i { animation: none; transform: scaleX(1); opacity: 0.4; }
  .layer { transition: none; }
}

/* --- 読み込み中・エラー ---------------------------------------------------- */

.loading {
  padding: 48px 0;
  text-align: center;
  font-size: 13px;
  color: var(--sub);
}

/* --- 店舗情報（お知らせ・アクセス・予約） ---------------------------------- */

.info-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--faint);
  margin-bottom: 10px;
}

.store-notice {
  margin-top: 28px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.store-notice .info-title { margin-bottom: 6px; }

.store-notice-body {
  font-size: 14px;
  white-space: pre-wrap;
}

.access {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.address {
  font-size: 14px;
  margin-bottom: 12px;
}

.map iframe {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface);
}

.reserve { margin-top: 24px; }

.reserve-btn {
  display: block;
  text-align: center;
  padding: 14px 18px;
  border-radius: var(--radius);
  background: var(--blue);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
}

.reserve-btn:hover { opacity: 0.9; }

/* カメラ非対象の店舗（予約リンク等の情報のみ） */
.store-panel.is-none .access { border-top: none; padding-top: 6px; }
