/*
  okitegami LP — スタイル
  ────────────────────────────────────
  役割:
    - ブランドカラー変数の定義
    - 全画面固定マップの上に浮かぶ各シーンのレイアウト
    - サンプルおきてがみカード / 通知バブル / スレッド返信カードなどの
      再利用可能な "分子" 単位
  レイアウト方針:
    - 背景に position: fixed のマップ
    - その上にスクロール可能な .scenes を重ねる
    - 各 .scene は最低1画面高、左右交互にコンテンツを配置
    - 768px 以下では画面下寄せの単一カラム
*/

/* ─── ブランドカラー: docs/okitegami_ブランディング_v1.md 準拠 ─── */
:root {
  --bg: #FAEEDA;              /* 朝の紙 */
  --fg: #3A2812;              /* 夕暮れ前 (少し優しく) */
  --fg-strong: #2A1B08;
  --muted: #85623B;
  --accent: #EF9F27;          /* 陽の光 */
  --accent-hover: #D68A15;
  --accent-red: #D85A30;      /* 茜 */
  --mist: #D3D1C7;            /* 霞 */

  --panel-bg: rgba(250, 238, 218, 0.94);
  --panel-border: rgba(58, 40, 18, 0.08);
  --panel-shadow: 0 20px 60px rgba(31, 21, 8, 0.18);

  /* シーンの暗幕。3D 建物を見せたい hero は薄く、テキスト重視は濃く */
  --tone-dim: rgba(20, 12, 4, 0.32);
  --tone-mid: rgba(20, 12, 4, 0.18);
  --tone-light: rgba(20, 12, 4, 0.08);

  --font-jp: -apple-system, BlinkMacSystemFont, "Hiragino Sans",
             "Yu Gothic Medium", "Yu Gothic", "Noto Sans JP", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  color: var(--fg);
  font-family: var(--font-jp);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.7;
}

body {
  /* スクロールコンテンツが背景の地図と重なる */
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }

/* ─── 全画面固定マップ ─── */
.map-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  background: var(--bg);
}

/* マップ上に必ずかかる暗幕。トーンは JS で --scene-tone を書き換えて制御 */
.map-canvas::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--scene-tone, var(--tone-mid));
  pointer-events: none;
  transition: background 900ms ease;
}

/* Mapbox の attribution / logo は規約で消せないので、視認性だけ整える */
.mapboxgl-ctrl-attrib,
.mapboxgl-ctrl-logo {
  z-index: 5;
}
.mapboxgl-ctrl-bottom-right,
.mapboxgl-ctrl-bottom-left {
  z-index: 5;
}

/* ─── サイトヘッダー ─── */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 28px;
  padding-top: max(18px, env(safe-area-inset-top));
  background: linear-gradient(
    to bottom,
    rgba(20, 12, 4, 0.35) 0%,
    rgba(20, 12, 4, 0) 100%
  );
  pointer-events: none;
}
.site-header > * { pointer-events: auto; }

.site-header__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.site-header__mark {
  width: 22px;
  height: 22px;
  background: var(--accent);
  border-radius: 50% 50% 50% 4px;   /* ピン形状のニュアンス */
  transform: rotate(-8deg);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}
.site-header__name {
  font-size: 15px;
}

.site-header__cta {
  padding: 9px 18px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--fg-strong);
  font-size: 13px;
  font-weight: 700;
  border-radius: 999px;
  letter-spacing: 0.04em;
  transition: transform 0.12s ease, background 0.15s ease;
}
.site-header__cta:hover { background: #fff; transform: translateY(-1px); }

/* ─── シーン共通 ─── */
.scenes {
  position: relative;
  z-index: 10;
  width: 100%;
}

.scene {
  min-height: 100vh;
  min-height: 100svh;   /* iOS のツールバー分を差し引く */
  display: flex;
  padding: 24px;
  padding-top: max(24px, env(safe-area-inset-top));
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  position: relative;
}

.scene--hero { align-items: center; justify-content: center; }
.scene--left  { align-items: center; justify-content: flex-start; }
.scene--right { align-items: center; justify-content: flex-end; }
.scene--center { align-items: center; justify-content: center; }
.scene--final { align-items: center; justify-content: center; }

.scene__inner {
  width: 100%;
  max-width: 460px;
  background: var(--panel-bg);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  border: 1px solid var(--panel-border);
  box-shadow: var(--panel-shadow);
  border-radius: 24px;
  padding: 34px 30px;
}
.scene__inner--center { max-width: 620px; text-align: center; }
.scene__inner--wide { max-width: 560px; text-align: center; }

/* hero / final scene のカードは中身が疎で "余白" が主役なので上下を厚めに */
.scene--hero .scene__inner { padding-top: 60px; padding-bottom: 60px; }

.scene__eyebrow {
  margin: 0 0 14px;
  font-size: 12px;
  letter-spacing: 0.18em;
  color: var(--accent-red);
  text-transform: uppercase;
  font-weight: 700;
}

.scene__title {
  margin: 0 0 16px;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--fg-strong);
  line-height: 1.4;
}
.scene__title--xl  { font-size: 40px; letter-spacing: 0.04em; }
.scene__title--xxl { font-size: 52px; letter-spacing: 0.04em; line-height: 1.25; }

.scene__lead {
  margin: 0 0 26px;
  font-size: 15px;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.scene__body {
  margin: 0 0 20px;
  font-size: 15px;
  color: var(--fg);
}

.scene__cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 8px;
}

.scene__hint {
  margin: 28px 0 0;
  font-size: 12px;
  letter-spacing: 0.24em;
  color: var(--muted);
  text-transform: uppercase;
  animation: hint-bounce 1.8s ease-in-out infinite;
}
.scene__hint--muted { animation: none; opacity: 0.7; }

/* 下向きシェブロン (>) を 90° 回した矢印。currentColor で親色を継承 */
.scene__hint-chevron {
  display: inline-block;
  width: 12px;
  height: 8px;
  margin-left: 8px;
  vertical-align: middle;
  transform: translateY(-1px);
}

@keyframes hint-bounce {
  0%, 100% { transform: translateY(0); opacity: 0.7; }
  50%      { transform: translateY(3px); opacity: 1; }
}

/* ─── CTA ボタン ─── */
.cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 14px 28px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.05em;
  transition: transform 0.12s ease, background 0.15s ease, box-shadow 0.2s ease;
  white-space: nowrap;
}
.cta--primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 20px rgba(239, 159, 39, 0.35);
}
.cta--primary:hover { background: var(--accent-hover); }
.cta--primary:active { transform: scale(0.97); }
.cta--ghost {
  background: transparent;
  color: var(--fg-strong);
  border: 1.5px solid var(--panel-border);
}
.cta--ghost:hover { background: rgba(255,255,255,0.6); }
.cta--lg { padding: 16px 36px; font-size: 16px; }

/* ─── 分子: おきてがみカード ─── */
.letter-card {
  margin-top: 18px;
  padding: 18px 18px 16px;
  background: #fff;
  border-radius: 18px;
  border: 1px solid var(--panel-border);
  box-shadow: 0 6px 18px rgba(58, 40, 18, 0.08);
}

.letter-card__head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.letter-card__meta {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
  flex: 1;
}
.letter-card__meta strong {
  font-size: 14px;
  color: var(--fg-strong);
}
.letter-card__place {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.letter-card__badge {
  font-size: 10px;
  padding: 3px 8px;
  color: #fff;
  background: var(--accent-red);
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.letter-card__body {
  margin: 0 0 12px;
  font-size: 15px;
  color: var(--fg);
  line-height: 1.7;
}

.letter-card__foot {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.letter-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.chip {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  background: rgba(133, 98, 59, 0.08);
  color: var(--muted);
  font-weight: 600;
}
.chip--accent {
  background: rgba(216, 90, 48, 0.12);
  color: var(--accent-red);
}
.chip--filled {
  background: var(--accent);
  color: #fff;
  margin-left: auto;
}

/* ─── 距離演出: JS が --glow (0..1) を書き換える ─── */
[data-glow] {
  --glow: 0;
  transition: filter 400ms ease;
}
[data-glow] [data-glow-text] {
  filter: blur(calc((1 - var(--glow)) * 6px));
  opacity: calc(0.35 + var(--glow) * 0.65);
  transition: filter 400ms ease, opacity 400ms ease;
}

/* ─── 分子: アバター ─── */
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
  background: var(--muted);
}
.avatar--haru { background: linear-gradient(135deg, #EF9F27, #D68A15); }
.avatar--mio  { background: linear-gradient(135deg, #D85A30, #B33F1E); }
.avatar--you  { background: linear-gradient(135deg, #854F0B, #5A3406); }

/* ─── 分子: iOS 風 通知バブル ─── */
.notif-bubble {
  margin-top: 20px;
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 18px;
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 6px 20px rgba(58, 40, 18, 0.14);
  animation: notif-slide 700ms cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes notif-slide {
  from { transform: translateY(-12px); opacity: 0; }
  to   { transform: translateY(0);      opacity: 1; }
}

.notif-bubble__icon {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 9px;
  background: var(--accent);
  position: relative;
}
.notif-bubble__icon::after {
  content: "";
  position: absolute;
  inset: 8px;
  background: #fff;
  border-radius: 50% 50% 50% 3px;
  transform: rotate(-8deg);
}
.notif-bubble__icon--accent { background: var(--accent-red); }

.notif-bubble__body {
  flex: 1;
  min-width: 0;
}
.notif-bubble__row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}
.notif-bubble__row strong {
  color: var(--fg-strong);
  font-weight: 700;
}
.notif-bubble__title {
  margin: 0 0 2px;
  font-size: 14px;
  font-weight: 700;
  color: var(--fg-strong);
}
.notif-bubble__text {
  margin: 0;
  font-size: 13px;
  color: var(--fg);
  line-height: 1.5;
}

/* ─── 分子: スレッド返信カード ─── */
.thread-card {
  margin-top: 20px;
  padding: 16px 18px;
  background: #fff;
  border-radius: 18px;
  border: 1px solid var(--panel-border);
  box-shadow: 0 6px 18px rgba(58, 40, 18, 0.08);
}
.thread-card__row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 8px 0;
}
.thread-card__row p {
  margin: 0;
  font-size: 14px;
  color: var(--fg);
  padding: 8px 12px;
  background: rgba(133, 98, 59, 0.06);
  border-radius: 12px;
  flex: 1;
}
.thread-card__row--reply p {
  background: rgba(239, 159, 39, 0.12);
}
.thread-card__hint {
  margin: 12px 0 0;
  padding-top: 12px;
  border-top: 1px dashed var(--panel-border);
  font-size: 12px;
  color: var(--muted);
}

/* ─── フッター ─── */
.site-footer {
  position: relative;
  z-index: 10;
  padding: 24px;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  background: var(--bg);
  border-top: 1px solid var(--panel-border);
}
.site-footer a { text-decoration: underline; text-underline-offset: 3px; }

/* ─── モバイル ─── */
@media (max-width: 768px) {
  .scene {
    padding: 20px;
    align-items: flex-end;
  }
  .scene--hero { align-items: center; }

  .scene__inner {
    max-width: 100%;
    padding: 26px 22px;
    border-radius: 22px;
  }
  .scene--hero .scene__inner { padding-top: 44px; padding-bottom: 44px; }
  .scene__title      { font-size: 26px; }
  .scene__title--xl  { font-size: 32px; }
  .scene__title--xxl { font-size: 38px; line-height: 1.28; }
  .scene__lead       { font-size: 14px; }
  .scene__body       { font-size: 14px; }

  .site-header { padding: 14px 18px; }
  .site-header__name { display: none; }

  .cta { padding: 13px 22px; font-size: 14px; }
  .cta--lg { padding: 15px 28px; font-size: 15px; }
}

/* ─── モーション控えめ設定 ─── */
@media (prefers-reduced-motion: reduce) {
  .scene__hint,
  .notif-bubble,
  [data-glow] [data-glow-text],
  .map-canvas::after {
    animation: none !important;
    transition: none !important;
  }
}
