/* =========================================================
   Nulvo — landing page
   トークンはアプリ (src/constants/themes.ts) と同一。逸脱禁止。
   ========================================================= */

:root {
  /* world */
  --bg: #7b76b8;
  --grad-top: #8d87c8;
  --grad-bot: #5f5aa2;

  /* surfaces / ink */
  --surface: #e6e4f4;
  --ink: #3a4168;
  --muted: #8a90ac;
  --accent: #756fb8;
  --warm: #e86f42;
  --on-bg: #ffffff;

  /* Nulvo Plus / 端末ベゼル (ミッドナイト) */
  --midnight-a: #524b94;
  --midnight-b: #3e3969;

  --shadow: 0 3px 6px rgba(58, 44, 120, 0.12), 0 14px 36px rgba(58, 44, 120, 0.12);
  --radius: 30px;
  --radius-sm: 20px;

  --maxw: 1080px;
  --pad: 20px;

  --font: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", -apple-system,
    BlinkMacSystemFont, "Segoe UI", "Yu Gothic", sans-serif;
}

/* ---------- reset (minimal) ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
}
img,
svg {
  display: block;
  max-width: 100%;
}
ul {
  margin: 0;
  padding: 0;
  list-style: none;
}
h1,
h2,
h3,
p {
  margin: 0;
}
a {
  color: inherit;
}

/* ---------- base ---------- */
html {
  color-scheme: light;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  font-family: var(--font);
  font-weight: 400;
  font-size: 17px;
  line-height: 1.95;
  color: var(--on-bg);
  background-color: var(--bg);
  /* clip = body をスクロールコンテナ化しない (hidden は旧ブラウザ用フォールバック) */
  overflow-x: hidden;
  overflow-x: clip;
}

/* 日本語の折り返しを自然に (対応ブラウザのみ) */
html[lang="ja"] body {
  line-break: strict;
  word-break: auto-phrase;
}

/* 世界色は固定レイヤーで敷く (iOS Safari は background-attachment:fixed が不安定) */
.world {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-color: var(--bg);
  background-image: linear-gradient(180deg, var(--grad-top) 0%, var(--grad-bot) 100%);
}

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding-inline: var(--pad);
}
@media (min-width: 760px) {
  :root {
    --pad: 32px;
  }
}

section {
  padding-block: clamp(64px, 11vw, 116px);
}

h1,
h2 {
  font-weight: 700;
  letter-spacing: 0.01em;
  text-wrap: balance;
}

.section-title {
  font-size: clamp(22px, 5.2vw, 31px);
  line-height: 1.65;
  text-align: center;
  margin-bottom: clamp(28px, 5vw, 44px);
}

/* 日本語の見出しを文節で折り返す (Safari 含む全ブラウザで有効な定石) */
.np {
  display: inline-block;
}

/* ---------- scroll reveal (JS 無しでも成立) ---------- */
.js .reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.65s ease, transform 0.65s ease;
}
.js .reveal.in {
  opacity: 1;
  transform: none;
}
@media (prefers-reduced-motion: reduce) {
  .js .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* =========================================================
   1. Hero
   ========================================================= */
.hero {
  position: relative;
  min-height: 92vh;
  min-height: 92svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding-block: clamp(72px, 16vw, 120px) clamp(56px, 10vw, 96px);
  overflow: hidden;
}

.hero > .wrap {
  position: relative;
  z-index: 1;
}

/* ヒーロー最上部は背景が最も明るい (#8D87C8) -> 暗いピルを敷いて 4.5:1 を確保 */
.lang-top {
  position: absolute;
  top: max(18px, env(safe-area-inset-top));
  right: 14px;
  z-index: 2;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(58, 44, 120, 0.34);
  font-size: 13px;
  line-height: 1.6;
  letter-spacing: 0.04em;
  color: #fff;
  text-decoration: none;
}
.lang-top:hover {
  background: rgba(58, 44, 120, 0.48);
}
.lang-top:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.mark {
  width: 72px;
  height: 72px;
  border-radius: 22.37%;
  overflow: hidden;
  margin: 0 auto clamp(26px, 5vw, 34px);
  box-shadow: 0 3px 6px rgba(58, 44, 120, 0.16), 0 12px 28px rgba(58, 44, 120, 0.18);
}

.hero h1 {
  font-size: clamp(27px, 7.4vw, 44px);
  line-height: 1.55;
  margin-bottom: clamp(20px, 4vw, 28px);
}

.lede {
  font-size: 16.5px;
  line-height: 2.05;
  max-width: 31em;
  margin: 0 auto;
  color: #fff;
}
html[lang="en"] .lede {
  max-width: 34em;
  line-height: 1.9;
}

.cta {
  margin-top: clamp(32px, 6vw, 46px);
  display: flex;
  justify-content: center;
}
/* Apple 公式バッジ (周囲のクリアスペースはバッジ高の 1/4 以上) */
.badge {
  display: inline-block;
  padding: 14px;
  margin: -14px;
  border-radius: 12px;
}
.badge img {
  height: 54px;
  width: auto;
}
.badge:focus-visible {
  outline: 2px solid #fff;
  outline-offset: -8px;
}

/* =========================================================
   2. 3 つの価値
   ========================================================= */
.cards {
  display: grid;
  gap: 18px;
}
@media (min-width: 880px) {
  .cards {
    grid-template-columns: repeat(3, 1fr);
    gap: 22px;
  }
}

.card {
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(26px, 5vw, 32px) clamp(24px, 5vw, 30px);
}
.card h2 {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.75;
  margin-bottom: 12px;
}
.card p {
  font-size: 15.5px;
  line-height: 1.95;
}

/* =========================================================
   3. スクリーン紹介
   ========================================================= */
.shots {
  display: flex;
  gap: 18px;
  /* safe = 溢れる幅では start に落ちる (非対応ブラウザは宣言ごと無視 = start) */
  justify-content: safe center;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scroll-padding-inline-start: var(--pad);
  padding-inline: var(--pad);
  padding-block: 4px 6px;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
}
.shots::-webkit-scrollbar {
  display: none;
}
.shots:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
  border-radius: 8px;
}
/* モバイルは 2 枚目が覗く幅にして横スクロールを気づかせる */
.shot {
  flex: 0 0 min(52vw, 210px);
  scroll-snap-align: start;
  text-align: center;
}
/* 226×3 + 34×2 + pad 32×2 = 810px。760px で解禁すると 760〜810px 帯で必ず溢れる
   (iPad ポートレート 768/834 が直撃) -> .cards と同じ 880px に揃える */
@media (min-width: 880px) {
  .shots {
    overflow: visible;
    justify-content: center;
    gap: 34px;
  }
  .shot {
    flex: 0 0 226px;
  }
}

.frame {
  padding: 7px;
  background: linear-gradient(160deg, var(--midnight-a), var(--midnight-b));
  border-radius: 34px;
  box-shadow: var(--shadow);
}
/* 中身は当面プレースホルダ = 世界色の薄面 (実機スクショが入ったら img が覆う) */
.screen {
  position: relative;
  aspect-ratio: 1290 / 2796;
  border-radius: 28px;
  overflow: hidden;
  background-color: var(--bg);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.16)),
    linear-gradient(180deg, var(--grad-top) 0%, var(--grad-bot) 100%);
}
/* Dynamic Island */
.screen::before {
  content: "";
  position: absolute;
  top: 2.4%;
  left: 50%;
  transform: translateX(-50%);
  width: 30%;
  height: 2.5%;
  background: var(--midnight-b);
  border-radius: 999px;
}
.screen img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.shot figcaption {
  margin-top: 14px;
  font-size: 13px;
  letter-spacing: 0.02em;
  color: #fff;
}

/* =========================================================
   4. アーカイブ推し
   ========================================================= */
.archive-card {
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  /* 下 0 だと住人が床に張り付いて「切り落とされた」ように読める -> 少し浮かせる */
  padding: clamp(34px, 6vw, 52px) clamp(24px, 5vw, 48px) clamp(20px, 4vw, 28px);
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
  overflow: hidden;
}
.archive-card h2 {
  font-size: clamp(21px, 5vw, 29px);
  line-height: 1.65;
  margin-bottom: 18px;
}
.archive-card p {
  font-size: 15.5px;
  line-height: 2;
  max-width: 27em;
  margin: 0 auto;
}
html[lang="en"] .archive-card p {
  max-width: 32em;
}

.crowd {
  position: relative;
  width: 100%;
  max-width: 300px;
  height: 84px;
  margin: clamp(18px, 3.5vw, 26px) auto 0;
}
.crowd i {
  position: absolute;
  bottom: var(--y);
  left: var(--x);
  width: var(--s);
  height: var(--s);
  transform: translateX(-50%);
  border-radius: 22.37%;
  background-image: url("assets/nulvo.svg");
  background-size: cover;
}

/* =========================================================
   5. Nulvo Plus
   ========================================================= */
.plus-card {
  max-width: 520px;
  margin: 0 auto;
  background: linear-gradient(135deg, var(--midnight-a) 0%, var(--midnight-b) 100%);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(30px, 5.5vw, 40px) clamp(26px, 5vw, 38px);
  text-align: center;
}
.plus-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 20px;
}
.plus-list li {
  font-size: 16px;
  line-height: 2.1;
  color: rgba(255, 255, 255, 0.92);
}
.plus-price {
  margin-top: 18px;
  font-size: 13.5px;
  line-height: 1.9;
  color: rgba(255, 255, 255, 0.68);
}

/* =========================================================
   6. FAQ
   ========================================================= */
.faq {
  max-width: 720px;
  margin: 0 auto;
  display: grid;
  gap: 12px;
}
.faq-item {
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.faq-item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 19px clamp(20px, 4vw, 26px);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.7;
  cursor: pointer;
  list-style: none;
}
.faq-item summary::-webkit-details-marker {
  display: none;
}
.faq-item summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -3px;
}
.chev {
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  margin-right: 4px;
  border-right: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  transform: translateY(-3px) rotate(45deg);
  transition: transform 0.25s ease;
}
.faq-item[open] .chev {
  transform: translateY(1px) rotate(225deg);
}
@media (prefers-reduced-motion: reduce) {
  .chev {
    transition: none;
  }
}
.faq-a {
  padding: 0 clamp(20px, 4vw, 26px) 22px;
  font-size: 15.5px;
  line-height: 2;
}
.faq-a a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  word-break: break-word;
}
.faq-a a:hover {
  text-decoration-color: var(--ink);
}
/* URL を「途中でしか折れない 2 塊」にして、閉じ括弧だけが行頭に落ちるのを防ぐ */
.faq-a .nb {
  white-space: nowrap;
}

/* =========================================================
   7. Footer
   ========================================================= */
.footer {
  padding-block: clamp(40px, 8vw, 64px) clamp(48px, 9vw, 72px);
  text-align: center;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 26px;
  font-size: 14.5px;
}
.footer-links a {
  color: #fff;
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.45);
  text-underline-offset: 4px;
}
.footer-links a:hover {
  text-decoration-color: #fff;
}
.footer-meta {
  margin-top: 22px;
  font-size: 13px;
  color: #fff;
}

/* =========================================================
   アニメ層 (Fable 手書き 2026-07-26)
   法則: 1動作ずつ / 間 / ゆっくり / 明快。アプリの大技 (雨・初共感バースト・群れ物理) は
   本編用に温存し、ここは Web オリジナル (夜が深まる / 気配 / 置かれる / 横断 / 灯る) +
   小技の移植 (ぷに単発 — 実カーブは anim.js、アプリと同式) のみ
   ========================================================= */

/* 夜が深まる: スクロール進行で第二の世界レイヤー (グラデ下端 → Dusk #35315A) が満ちる */
.world-night {
  background-image: linear-gradient(180deg, var(--grad-bot) 0%, #35315a 100%);
  opacity: 0;
}

/* ヒーローの登場 = 「置かれる」: mark → h1 (沈み込んで静止) → lede → cta の単調カスケード */
.js .hero .mark {
  animation: rise-in 0.9s ease-out 0.05s both;
}
.js .hero h1 {
  animation: settle 0.95s cubic-bezier(0.22, 0.61, 0.36, 1) 0.2s both;
}
.js .hero .lede {
  animation: rise-in 0.85s ease-out 0.5s both;
}
.js .hero .cta {
  animation: rise-in 0.85s ease-out 0.72s both;
}
@keyframes settle {
  0% {
    opacity: 0;
    transform: translateY(-14px);
  }
  62% {
    opacity: 1;
    transform: translateY(2px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* 気配: まばたき (6.4s 周期) + ふっと横に流れる視線 (17s 周期 — 位相が重ならないよう互いに素) */
.mark svg {
  width: 100%;
  height: 100%;
  display: block;
}
.eye {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 0.16s ease-out;
}
.eyes {
  transform-box: fill-box;
  transform-origin: center;
}
.js .eye {
  animation: blink 6.4s ease-in-out infinite;
}
.js .eyes {
  animation: gaze 17s ease-in-out infinite;
}
@keyframes blink {
  0%,
  94.5%,
  98.5%,
  100% {
    transform: scaleY(1);
  }
  96.5% {
    transform: scaleY(0.08);
  }
}
@keyframes gaze {
  0%,
  74%,
  90%,
  100% {
    transform: translateX(0);
  }
  78%,
  86% {
    transform: translateX(26px);
  }
}
/* 触れると目を閉じて、間をおいて開く (跳ねない — 「起きてるよ」とだけ返す) */
.mark {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.mark.closed .eye {
  animation: none;
  transform: scaleY(0.06);
}
.mark.closed .eyes {
  animation-play-state: paused;
}

/* 灯る ♥: 一拍おいて warm が満ち、一度だけゆっくり脈打つ (バーストは本編用) */
.heart {
  color: var(--muted);
  display: inline-block;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.65s ease;
}
.heart.lit {
  color: var(--warm);
  animation: heart-pulse 0.8s ease-out 1;
}
.heart:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}
@keyframes heart-pulse {
  0% {
    transform: scale(1);
  }
  35% {
    transform: scale(1.14);
  }
  100% {
    transform: scale(1);
  }
}

/* 住人: 触るとぷにっと潰れる (足元軸)。土台の translateX と scale を合成 */
.crowd i {
  transform: translateX(-50%) scale(var(--sx, 1), var(--sy, 1));
  transform-origin: 50% 100%;
  cursor: pointer;
}

/* とことこ横断: ごく稀に 1 匹が画面下端を歩いて横切る (足元軸の揺れ、Reauth の歩行法則) */
.walker {
  position: fixed;
  bottom: 6px;
  left: 0;
  z-index: 5;
  width: 22px;
  height: 22px;
  opacity: 0.55;
  pointer-events: none;
}
.walker img {
  width: 100%;
  height: 100%;
  border-radius: 22.37%;
  transform-origin: 50% 100%;
  animation: toko 0.72s ease-in-out infinite alternate;
}
.walker.ltr {
  animation: cross-l var(--wd, 16s) linear both;
}
.walker.rtl {
  animation: cross-r var(--wd, 16s) linear both;
}
@keyframes cross-l {
  from {
    transform: translateX(-30px);
  }
  to {
    transform: translateX(calc(100vw + 30px));
  }
}
@keyframes cross-r {
  from {
    transform: translateX(calc(100vw + 30px)) scaleX(-1);
  }
  to {
    transform: translateX(-30px) scaleX(-1);
  }
}
@keyframes toko {
  from {
    transform: rotate(-5deg);
  }
  to {
    transform: rotate(5deg) translateY(-1.5px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .js .hero .mark,
  .js .hero h1,
  .js .hero .lede,
  .js .hero .cta,
  .js .eye,
  .js .eyes,
  .heart.lit {
    animation: none;
  }
  .heart {
    transition: none;
  }
  .walker {
    display: none;
  }
}
