/* ============================================================
   style.css — 全ページ共通スタイル
   ページ固有のスタイルは各ページの CSS に書く
   ============================================================ */

/* ---------- カスタムプロパティ ---------- */
:root {
  --ink: #080604;
  --paper: #d4c9b0;
  --gold: #c9913a;
  --gold-dim: #8a6020;
  --orange: #c95a1a;
  --red: #9e1a1a;
  --red-light: #cc2e2e;
  --text-dim: #6b5e45;

  --border-gold: rgba(201, 145, 58, 0.28);
  --border-orange: rgba(201, 90, 26, 0.36);
  --border-red: rgba(158, 26, 26, 0.5);

  --font-display: "Cinzel", serif;
  --font-serif: "EB Garamond", serif;
  --font-jp: "Noto Serif JP", serif;
  --font-mono: "JetBrains Mono", monospace;

  --transition: 0.2s ease;
  --transition-modal: 0.35s ease;
}

/* ---------- リセット ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  scroll-behavior: smooth;
}
/* ---------- リンクリセット（ブラウザデフォルトの紫色を防ぐ） ---------- */
a {
  color: inherit;
  text-decoration: none;
}
a:visited {
  color: inherit;
}
a:hover {
  color: inherit;
}

/* ---------- ボタンリセット ---------- */
button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  margin: 0;
}

body {
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-jp);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ノイズテクスチャ */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 999;
  opacity: 0.45;
  mix-blend-mode: overlay;
}

/* 縦ライン装飾 */
body::after {
  content: "";
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 1px;
  height: 100vh;
  background: linear-gradient(
    to bottom,
    transparent,
    rgba(201, 145, 58, 0.15),
    transparent
  );
  pointer-events: none;
  z-index: 0;
}

/* ---------- ページ共通レイアウト ---------- */
.page-wrap {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto;
  padding: 48px 24px 120px;
}

/* ---------- ページヘッダー（タイトルエリア） ---------- */
.page-header {
  margin-bottom: 48px;
  animation: fadeUp 0.5s ease both;
}

.page-eyebrow {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.page-title {
  font-family: var(--font-display);
  font-size: clamp(32px, 6vw, 56px);
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.1;
  margin-bottom: 8px;
}

.page-tagline {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 16px;
}

/* ---------- 共通カード ---------- */
.card {
  border: 1px solid var(--border-gold);
  background: rgba(201, 145, 58, 0.02);
  padding: 24px 28px;
  transition: border-color var(--transition);
}

.card:hover {
  border-color: rgba(201, 145, 58, 0.5);
}

/* ---------- 共通モーダル ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(8, 6, 4, 0.96);
  backdrop-filter: blur(16px);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition-modal);
  overflow-y: auto;
  padding: 48px 24px;
}

.modal.is-open {
  display: flex;
}
.modal.is-visible {
  opacity: 1;
}

.modal__inner {
  width: 100%;
  max-width: 480px;
  text-align: center;
}

.modal__close {
  position: fixed;
  top: 24px;
  right: 24px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(201, 145, 58, 0.28);
  background: rgba(8, 6, 4, 0.8);
  color: rgba(201, 145, 58, 0.55);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}
.modal__close:hover {
  color: var(--gold);
  border-color: var(--gold);
}

.modal__title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.15em;
  margin-bottom: 6px;
}

.modal__access {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: rgba(212, 201, 176, 0.35);
  margin-bottom: 32px;
}

/* ---------- 認証モーダル ---------- */
.auth-icon {
  width: 40px;
  height: 40px;
  stroke: var(--red-light);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  margin: 0 auto 16px;
  display: block;
  filter: drop-shadow(0 0 10px rgba(239, 68, 68, 0.5));
}

.auth-subtitle {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: rgba(220, 38, 38, 0.5);
  margin-bottom: 28px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
  text-align: left;
}

.auth-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(220, 38, 38, 0.7);
  margin-top: 10px;
  display: block;
}

.auth-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(158, 26, 26, 0.5);
  border-radius: 4px;
  padding: 12px 16px;
  color: #ffdada;
  font-family: var(--font-mono);
  letter-spacing: 0.15em;
  font-size: 13px;
  transition: border-color var(--transition);
  outline: none;
}
.auth-input:focus {
  border-color: var(--red-light);
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.2);
}
.auth-input.is-error {
  border-color: var(--red-light);
}

.auth-error {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--red-light);
  background: rgba(158, 26, 26, 0.15);
  border: 1px solid rgba(158, 26, 26, 0.4);
  border-radius: 4px;
  padding: 8px 12px;
  margin-bottom: 16px;
  display: none;
}
.auth-error.is-visible {
  display: block;
}

/* ---------- 共通ボタン ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all var(--transition);
}

.btn--auth {
  width: 100%;
  padding: 14px;
  background: rgba(158, 26, 26, 0.09);
  border: 1px solid var(--red);
  color: var(--red-light);
}
.btn--auth:hover {
  background: var(--red);
  color: #fff;
}

.auth-register-link {
  display: block;
  margin-top: 20px;
  font-family: var(--font-serif);
  font-size: 13px;
  font-style: italic;
  color: rgba(201, 145, 58, 0.7);
  text-decoration: none;
  transition: color 0.2s;
}
.auth-register-link:hover {
  color: var(--gold);
}

.btn--ghost {
  padding: 8px 20px;
  border: 1px solid rgba(212, 201, 176, 0.18);
  border-radius: 999px;
  color: rgba(212, 201, 176, 0.5);
  background: transparent;
}
.btn--ghost:hover {
  background: var(--paper);
  color: var(--ink);
}

/* ---------- アクセス拒否ページ ---------- */
.access-denied {
  text-align: center;
  padding: 80px 24px;
  animation: fadeUp 0.5s ease both;
}
.access-denied__icon {
  font-size: 48px;
  margin-bottom: 24px;
  display: block;
}
.access-denied__title {
  font-family: var(--font-display);
  font-size: 28px;
  color: var(--red-light);
  margin-bottom: 12px;
  letter-spacing: 0.1em;
}
.access-denied__text {
  font-size: 13px;
  color: rgba(212, 201, 176, 0.5);
  margin-bottom: 32px;
  line-height: 1.8;
}

/* ---------- フッター ---------- */
.site-footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 64px 24px;
  border-top: 1px solid rgba(212, 201, 176, 0.04);
}

.footer-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 14px;
}

.footer-copy {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.4em;
  line-height: 2;
  color: rgba(212, 201, 176, 0.18);
  text-transform: uppercase;
}

/* ---------- アニメーション ---------- */
@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.25;
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- レスポンシブ ---------- */
@media (max-width: 600px) {
  .page-wrap {
    padding: 32px 16px 80px;
  }
}

/* ---------- 認証モーダル: スマホ対応 ---------- */
@media (max-width: 480px) {
  .modal {
    padding: 24px 16px;
    align-items: flex-start;
    padding-top: max(48px, env(safe-area-inset-top));
  }
  .modal__inner {
    max-width: 100%;
    padding: 0 8px;
  }
  .modal__close {
    top: max(12px, env(safe-area-inset-top));
    right: max(16px, env(safe-area-inset-right));
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    font-size: 20px;
  }
  .modal__title {
    font-size: 18px;
    letter-spacing: 0.12em;
  }
  .auth-subtitle {
    font-size: 8px;
    margin-bottom: 20px;
  }
  .auth-form {
    margin-bottom: 14px;
  }
  .auth-input {
    min-height: 48px;
    padding: 14px 16px;
    font-size: 16px; /* iOS zoom防止 */
  }
  .btn--auth {
    min-height: 48px;
    padding: 16px;
    font-size: 11px;
  }
}

/* フッター legal リンク */
.footer-legal {
  color: rgba(212, 201, 176, 0.2);
  font-size: 10px;
  text-decoration: none;
  margin-left: 12px;
  letter-spacing: 0.04em;
  transition: color 0.2s;
}
.footer-legal:hover {
  color: rgba(212, 201, 176, 0.45);
}

/* ============================================================
   スマホ・タブレット対応（全ページ共通）
   ============================================================ */

/* タップターゲット最小サイズ確保 */
a,
button {
  min-height: 40px;
}
.btn {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* モーダルのスマホ対応強化 */
@media (max-width: 540px) {
  .modal__inner--auth {
    width: 100%;
    max-width: 100%;
    margin: 0;
    border-radius: 12px 12px 0 0;
    padding: 24px 20px 32px;
  }
  .modal.is-open {
    align-items: flex-end;
    padding-bottom: 0;
  }
  .auth-input {
    font-size: 16px; /* iOSズーム防止 */
    height: 48px;
  }
  .auth-form {
    gap: 12px;
  }
}

/* ページ共通 */
@media (max-width: 600px) {
  .page-wrap {
    padding: 28px 14px 80px;
  }
  .page-title {
    font-size: clamp(24px, 8vw, 36px);
  }
  .page-tagline {
    font-size: 11px;
  }
  h1,
  .page-title,
  .member-title,
  .restricted-title {
    font-size: clamp(22px, 7vw, 36px);
  }
}

/* フッター */
@media (max-width: 480px) {
  .site-footer {
    padding: 32px 16px 48px;
  }
  .footer-copy {
    font-size: 11px;
  }
}

/* ====================================================
   ★全体スタイリッシュ強化 + スマホ修正
   ==================================================== */

/* iOS入力ズーム防止（グローバル） */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="search"],
select,
textarea {
  font-size: max(16px, 1em) !important;
  -webkit-text-size-adjust: 100%;
}

/* ヘッダー固定時のページコンテンツ開始位置 */
@media (max-width: 680px) {
  /* ヘッダー高さ分の余白を確保 */
  body > *:not(#header-container):first-of-type {
    margin-top: 0;
  }
  /* 全ページ共通: ヘッダーの後ろにコンテンツが隠れないよう */
  .page-wrap,
  .hero,
  section:first-of-type {
    padding-top: max(24px, env(safe-area-inset-top));
  }
}

/* 全体的なタップターゲット最適化 */
@media (max-width: 680px) {
  .btn, button, a {
    -webkit-tap-highlight-color: rgba(201, 145, 58, 0.15);
    tap-highlight-color: rgba(201, 145, 58, 0.15);
  }
  /* スクロールのスムーズ化 */
  * {
    -webkit-overflow-scrolling: touch;
  }
}

/* スマホでのチャット送信ボタン共通 */
@media (max-width: 640px) {
  .chat-send,
  .shrine-compose__send {
    min-width: 44px;
    min-height: 44px;
  }
}
