/* ==========================================================================
   OITEKU base — デザイントークンと公開側の共通スタイル（仕様書 第6章）
   公開側はダークテーマ固定。色・余白・角丸・モーションは必ず変数を使う。
   ========================================================================== */

:root {
  --color-bg: #101821;
  --color-bg-deep: #0b1118;
  --color-surface: #17232d;
  --color-surface-hover: #1d2b36;
  --color-border: #34434d;
  --color-text: #e7ecea;
  --color-text-muted: #a7b1b5;
  --color-text-faint: #7f8c92;
  --color-light: #d8b272;
  --color-light-soft: #a98452;
  --color-focus: #d7c49a;
  --color-danger: #d2a0a0;
  --color-primary-bg: #d7dfdc;
  --color-primary-bg-hover: #e2e8e5;
  --color-primary-text: #142029;

  --font-ui: "Zen Kaku Gothic New", "Noto Sans JP", sans-serif;
  --font-quote: "Noto Serif JP", "Yu Mincho", "YuMincho", serif;

  --text-xs: 12px;
  --text-sm: 14px;
  --text-base: 16px;
  --text-md: 18px;
  --text-lg: 22px;
  --text-quote: 21px;
  --text-hero: 28px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --space-9: 96px;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  --motion-fast: 160ms;
  --motion-base: 320ms;
  --motion-slow: 700ms;
  --motion-breathe: 1400ms;
  --motion-release: 4000ms;
  --ease-soft: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-fade: cubic-bezier(0.4, 0, 0.6, 1);

  --content-max: 640px;
  --quote-max: 560px;
  --button-max: 360px;
  --gutter: 24px;

  color-scheme: dark;
}

@media (min-width: 768px) {
  :root {
    --text-lg: 24px;
    --text-quote: 26px;
    --text-hero: 36px;
  }
}

@media (max-width: 359px) {
  :root { --gutter: 20px; }
}

/* ---------- reset ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background-color: var(--color-bg);
  background-image: radial-gradient(ellipse 80% 60% at 50% 40%, rgba(23, 35, 45, 0.9), rgba(16, 24, 33, 0) 70%);
  background-attachment: fixed;
  color: var(--color-text);
  font-family: var(--font-ui);
  font-size: var(--text-base);
  font-weight: 400;
  line-height: 1.8;
  font-feature-settings: "palt" 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, p, ul, ol, dl, dd, figure, blockquote {
  margin: 0;
}

img, svg {
  display: block;
  max-width: 100%;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

a {
  color: var(--color-text);
  text-decoration-color: var(--color-text-faint);
  text-underline-offset: 0.25em;
  transition: color var(--motion-fast) var(--ease-soft), text-decoration-color var(--motion-fast) var(--ease-soft);
}

a:hover {
  text-decoration-color: var(--color-text-muted);
}

/* 日本語の見出し・短文は文節で改行する（対応ブラウザのみ） */
h1, h2,
.home__lead,
.assurance,
.stage__note,
.quote__text,
.words__reflection,
.words__error,
.confirm__title {
  word-break: auto-phrase;
  text-wrap: pretty;
}

/* フォーカスリングは消さない（仕様書 6.15） */
:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

::selection {
  background: rgba(216, 178, 114, 0.28);
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -100px;
  z-index: 100;
  padding: var(--space-2) var(--space-4);
  background: var(--color-surface);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
}

.skip-link:focus {
  top: var(--space-4);
}

/* ---------- ロゴ ---------- */

.logo {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: 0.16em;
  line-height: 1;
  color: var(--color-text-muted);
  text-decoration: none;
  padding: var(--space-3) var(--space-2);
}

a.logo:hover {
  color: var(--color-text);
}

/* ---------- ボタン（仕様書 6.7） ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 50px;
  padding: 0 var(--space-6);
  border: 0;
  border-radius: var(--radius-pill);
  font-size: var(--text-base);
  font-weight: 500;
  line-height: 1.4;
  text-align: center;
  text-decoration: none;
  transition: background-color var(--motion-fast) var(--ease-soft), transform 100ms var(--ease-soft);
  -webkit-tap-highlight-color: transparent;
}

.btn--primary {
  width: 100%;
  max-width: var(--button-max);
  background: var(--color-primary-bg);
  color: var(--color-primary-text);
}

.btn--primary:hover {
  background: var(--color-primary-bg-hover);
}

.btn--primary:active {
  transform: scale(0.985);
}

.btn--primary:focus-visible {
  outline-offset: 3px;
  border-radius: var(--radius-pill);
}

/* Secondary：背景なし・下線はHover/Focus時のみ */
.btn-quiet {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: var(--space-2) var(--space-3);
  border: 0;
  background: none;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  line-height: 1.5;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.btn-quiet:hover,
.btn-quiet:focus-visible {
  color: var(--color-text);
  text-decoration: underline;
  text-decoration-color: var(--color-text-faint);
  text-underline-offset: 0.3em;
}

/* ---------- 安心表示 ---------- */

.assurance {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  line-height: 1.8;
}

/* ---------- 小さな光（仕様書 6.11）：唯一の装飾要素 ---------- */

.light {
  display: block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--color-light);
  box-shadow: 0 0 12px 2px rgba(216, 178, 114, 0.35);
  opacity: 0.85;
}

.light--breathe {
  animation: light-breathe 5s var(--ease-fade) infinite;
}

@keyframes light-breathe {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 0.95; }
}

/* ---------- トップ ---------- */

.page-home {
  justify-content: space-between;
}

.home {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-7);
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--space-8) var(--gutter) var(--space-7);
  text-align: center;
}

.home__brand {
  margin: 0;
}

.home__copy {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.home__title {
  font-size: var(--text-hero);
  font-weight: 400;
  line-height: 1.6;
  letter-spacing: 0.02em;
}

.home__lead {
  color: var(--color-text-muted);
  font-size: var(--text-md);
  line-height: 1.8;
}

.home__actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  width: 100%;
}

.home__actions .assurance {
  max-width: 28em;
}

/* ---------- 読み物系の固定ページ ---------- */

.page-header {
  display: flex;
  justify-content: center;
  padding: var(--space-3) var(--gutter) 0;
}

.page {
  flex: 1;
  width: 100%;
  padding: var(--space-7) var(--gutter) var(--space-8);
}

.page--center {
  display: flex;
  align-items: center;
}

.prose {
  max-width: var(--content-max);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.prose--center {
  text-align: center;
  align-items: center;
}

.prose h1 {
  font-size: var(--text-lg);
  font-weight: 500;
  line-height: 1.6;
  margin-bottom: var(--space-3);
}

.prose h2 {
  font-size: var(--text-md);
  font-weight: 500;
  line-height: 1.6;
  margin-bottom: var(--space-3);
}

.prose section {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding-top: var(--space-5);
}

.prose p,
.prose li,
.prose dd {
  color: var(--color-text);
  line-height: 1.9;
}

.prose ul {
  padding-left: 1.4em;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.prose__small,
.prose__date {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.info-list {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: var(--space-2) var(--space-5);
}

.info-list dt {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  line-height: 1.9;
}

/* 読み物一覧 */
.article-list {
  list-style: none;
  padding: 0 !important;
  gap: var(--space-5) !important;
}

.article-list__title {
  font-size: var(--text-md);
}

.article-list__summary {
  color: var(--color-text-muted) !important;
  font-size: var(--text-sm);
}

/* ---------- フッター ---------- */

.site-footer {
  padding: var(--space-6) var(--gutter) var(--space-6);
  text-align: center;
}

.site-footer__links {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0 var(--space-4);
}

.site-footer__links a {
  display: inline-block;
  padding: var(--space-2) var(--space-1);
  color: var(--color-text-faint);
  font-size: var(--text-xs);
  text-decoration: none;
  min-height: 44px;
  line-height: 28px;
}

.site-footer__links a:hover,
.site-footer__links a:focus-visible {
  color: var(--color-text-muted);
  text-decoration: underline;
}

.site-footer__copy {
  color: var(--color-text-faint);
  font-size: var(--text-xs);
  margin-top: var(--space-2);
}

/* ホーム画面に追加の案内（対応する環境でのみ表示される） */
.site-footer__install {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
}

/* 画面下に出るインストールの案内カード */
.install-card {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 30;
  width: min(100% - var(--space-4), 520px);
  margin-bottom: max(var(--space-4), env(safe-area-inset-bottom));
  padding: var(--space-4);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-2) var(--space-4);
  align-items: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: 0 12px 32px rgba(7, 11, 16, 0.5);
  transform: translate(-50%, calc(100% + var(--space-6)));
  opacity: 0;
  transition: transform var(--motion-base) var(--ease-soft), opacity var(--motion-base) var(--ease-fade);
}

.install-card.is-shown {
  transform: translate(-50%, 0);
  opacity: 1;
}

.install-card[hidden] {
  display: none;
}

.install-card__icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
}

.install-card__title {
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1.6;
}

.install-card__text,
.install-card__steps {
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  line-height: 1.7;
}

.install-card__steps[hidden] {
  display: none;
}

.install-card__nowrap {
  white-space: nowrap;
}

.install-card__actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
}

.install-card__add {
  width: auto;
  min-height: 44px;
  padding: 0 var(--space-5);
  font-size: var(--text-sm);
}

.install-card__add[hidden] {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .install-card {
    transform: translate(-50%, 0);
  }
}

.site-footer__install .btn-quiet {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}

/* ---------- モーション軽減 ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- ロゴ（背景付きの画像を、角丸のボタン状の面として扱う） ---------- */

.brand {
  display: inline-block;
  line-height: 0;
  overflow: hidden;
  border: 1px solid rgba(231, 236, 234, 0.12);
  border-radius: var(--radius-md);
  background: #202c3a;
  transition: border-color var(--motion-fast) var(--ease-soft), filter var(--motion-fast) var(--ease-soft), transform 100ms var(--ease-soft);
}

.brand img {
  display: block;
  width: auto;
  height: 100%;
}

/* トップ：大きく中央に。押せる要素は「そっと置いていく」だけにするため、ロゴはリンクにしない */
.brand--hero {
  border-radius: var(--radius-lg);
}

.brand--hero img {
  width: min(300px, 76vw);
  height: auto;
}

/* ページ上部：小さなロゴボタン（トップへ戻る） */
.brand-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  border-radius: var(--radius-md);
  -webkit-tap-highlight-color: transparent;
}

.brand-link .brand img {
  height: 34px;
}

.brand-link:hover .brand {
  border-color: rgba(231, 236, 234, 0.28);
  filter: brightness(1.1);
}

.brand-link:active .brand {
  transform: scale(0.97);
}

.brand-link:focus-visible {
  outline: none;
}

.brand-link:focus-visible .brand {
  outline: 2px solid var(--color-focus);
  outline-offset: 3px;
}

@media (max-width: 399px) {
  .brand-link .brand img {
    height: 30px;
  }
}
