/*
Theme Name: a.design Immersive
Theme URI: https://a-design.me/
Author: a.design (Akiko Imazato)
Author URI: https://a-design.me/
Description: 3D没入型トレンドの「その先」を見据えたオリジナルテーマ。依存ゼロのWebGLオーロラヒーロー、CSSスクロール駆動アニメーション、View Transitions API、AIOファーストの構造化データを標準装備。軽量・サステナブル・アクセシブル。
Version: 1.0.0
Requires at least: 6.4
Tested up to: 6.8
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: adesign-immersive
Tags: one-column, custom-colors, accessibility-ready
*/

/* ==========================================================
   0. Design Tokens — "知的で、あたたかい" lavender system
   ========================================================== */
:root {
  /* Palette */
  --ink:        #2b2440;  /* 深い紫墨 — 本文 */
  --ink-soft:   #5c5474;  /* サブテキスト */
  --base:       #fbfaff;  /* 生成りがかった白 */
  --mist:       #ede8f8;  /* ラベンダーミスト — 面 */
  --lavender:   #a78bda;  /* ブランドラベンダー */
  --accent:     #6c4ab6;  /* 濃ラベンダー — リンク/CTA */
  --glow:       #d9c9f5;  /* 発光ハイライト */

  /* Type */
  --font-display: "Shippori Mincho B1", "Hiragino Mincho ProN", serif;
  --font-body: "Zen Kaku Gothic New", "Hiragino Kaku Gothic ProN", sans-serif;
  --leading-body: 1.9;

  /* Rhythm */
  --space-1: clamp(1rem, 2vw, 1.5rem);
  --space-2: clamp(2rem, 4vw, 3rem);
  --space-3: clamp(4rem, 8vw, 7rem);
  --measure: 42rem;
  --radius: 1.25rem;

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink:      #eae5f6;
    --ink-soft: #b3aacb;
    --base:     #17131f;
    --mist:     #241d33;
    --glow:     #3d2f5c;
  }
}

/* ==========================================================
   1. View Transitions (MPA) — ページ間が"つながる"体験
   ========================================================== */
@view-transition { navigation: auto; }

::view-transition-old(root) { animation: vt-out .28s ease both; }
::view-transition-new(root) { animation: vt-in  .38s ease both; }

@keyframes vt-out { to { opacity: 0; transform: translateY(-8px); } }
@keyframes vt-in  { from { opacity: 0; transform: translateY(12px); } }

/* 記事タイトルはページをまたいで"モーフィング"する */
.post-card__title, .entry-title { view-transition-class: heading-morph; }

/* ==========================================================
   2. Base
   ========================================================== */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: var(--leading-body);
  color: var(--ink);
  background: var(--base);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: .25em; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 3px solid var(--lavender);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--accent); color: #fff;
  padding: .75em 1.25em; z-index: 100; border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { left: 0; }

.container { max-width: 72rem; margin-inline: auto; padding-inline: var(--space-1); }

/* ==========================================================
   3. Typography
   ========================================================== */
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: .02em;
}
h1 { font-size: clamp(1.9rem, 5vw, 3.4rem); }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); }
h3 { font-size: clamp(1.15rem, 2vw, 1.4rem); }

.eyebrow {
  font-size: .78rem;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
}

/* ==========================================================
   4. Header / Nav
   ========================================================== */
.site-header {
  position: fixed; inset: 0 0 auto; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem var(--space-1);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  background: color-mix(in oklab, var(--base) 62%, transparent);
  border-bottom: 1px solid color-mix(in oklab, var(--lavender) 25%, transparent);
}
.site-branding a {
  font-family: var(--font-display);
  font-size: 1.2rem; color: var(--ink); text-decoration: none;
}
.site-nav ul { display: flex; gap: 1.75rem; margin: 0; padding: 0; list-style: none; }
.site-nav a { color: var(--ink); text-decoration: none; font-size: .92rem; }
.site-nav a:hover { color: var(--accent); }

/* ==========================================================
   5. Immersive Hero — WebGLオーロラ + 変数の余韻
   ========================================================== */
.hero {
  position: relative;
  min-height: 100svh;
  display: grid; place-items: center;
  isolation: isolate;
  overflow: clip;
}
.hero__canvas {
  position: absolute; inset: 0; z-index: -1;
  width: 100%; height: 100%;
}
/* WebGL非対応・reduced-motion時のフォールバック(静的グラデーション) */
.hero__fallback {
  position: absolute; inset: 0; z-index: -2;
  background:
    radial-gradient(60% 50% at 20% 30%, var(--glow) 0%, transparent 70%),
    radial-gradient(50% 60% at 80% 60%, color-mix(in oklab, var(--lavender) 45%, transparent) 0%, transparent 70%),
    var(--base);
}
.hero__inner { text-align: center; padding: var(--space-2); }
.hero__title {
  margin: .5em 0 .3em;
  background: linear-gradient(120deg, var(--ink) 30%, var(--accent) 70%);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.hero__lead { color: var(--ink-soft); max-width: var(--measure); margin-inline: auto; }

.hero__scrollcue {
  position: absolute; bottom: 2rem; left: 50%; translate: -50% 0;
  width: 1px; height: 3.5rem;
  background: linear-gradient(var(--accent), transparent);
  animation: cue 2.2s ease-in-out infinite;
}
@keyframes cue { 50% { transform: scaleY(.55); transform-origin: top; } }

/* ==========================================================
   6. Scroll-Driven Animations — JSゼロのスクロールテリング
   ========================================================== */
@supports (animation-timeline: view()) {
  .reveal {
    animation: reveal-up both;
    animation-timeline: view();
    animation-range: entry 0% entry 55%;
  }
  @keyframes reveal-up {
    from { opacity: 0; transform: translateY(2.5rem); }
  }

  /* 読了プログレスバー — トレンド7"ゲーミフィケーション"の静かな翻訳 */
  .progress {
    position: fixed; inset: 0 0 auto; height: 3px; z-index: 60;
    background: linear-gradient(90deg, var(--lavender), var(--accent));
    transform-origin: left;
    animation: grow-progress linear both;
    animation-timeline: scroll(root);
  }
  @keyframes grow-progress { from { transform: scaleX(0); } }

  /* ヒーロー文字がスクロールで奥に沈む=3Dの気配 */
  .hero__inner {
    animation: sink both linear;
    animation-timeline: scroll(root);
    animation-range: 0 100svh;
  }
  @keyframes sink {
    to { transform: translateY(18svh) scale(.92); opacity: 0; }
  }
}

/* ==========================================================
   7. Sections / Cards
   ========================================================== */
.section { padding-block: var(--space-3); }
.section--mist { background: var(--mist); }

.post-grid {
  display: grid; gap: var(--space-2);
  grid-template-columns: repeat(auto-fill, minmax(min(20rem, 100%), 1fr));
  margin: var(--space-2) 0 0; padding: 0; list-style: none;
}
.post-card {
  background: var(--base);
  border: 1px solid color-mix(in oklab, var(--lavender) 22%, transparent);
  border-radius: var(--radius);
  padding: var(--space-1);
  transition: translate .35s cubic-bezier(.2,.8,.2,1), box-shadow .35s;
}
.post-card:hover {
  translate: 0 -6px;
  box-shadow: 0 18px 40px -18px color-mix(in oklab, var(--accent) 45%, transparent);
}
.post-card__title { margin: .35em 0; font-size: 1.15rem; }
.post-card__title a { color: var(--ink); text-decoration: none; }
.post-card__meta { font-size: .8rem; color: var(--ink-soft); }

/* ==========================================================
   8. Entry (single/page)
   ========================================================== */
.entry { padding-block: calc(var(--space-3) + 3rem) var(--space-3); }
.entry__content {
  max-width: var(--measure); margin-inline: auto;
}
.entry__content > * + * { margin-top: 1.4em; }
.entry__content h2 {
  margin-top: 2.5em;
  padding-left: .75em;
  border-left: 4px solid var(--lavender);
}
.entry-header { text-align: center; max-width: 52rem; margin-inline: auto; padding-bottom: var(--space-2); }

/* ==========================================================
   9. CTA / Footer
   ========================================================== */
.button {
  display: inline-block;
  background: var(--accent); color: #fff;
  padding: .9em 2.2em; border-radius: 99px;
  text-decoration: none; font-weight: 500;
  transition: filter .25s, translate .25s;
}
.button:hover { filter: brightness(1.12); translate: 0 -2px; }

.site-footer {
  padding: var(--space-2) var(--space-1);
  text-align: center;
  color: var(--ink-soft);
  font-size: .85rem;
  border-top: 1px solid color-mix(in oklab, var(--lavender) 25%, transparent);
}

/* ==========================================================
   10. Reduced motion — 没入とやさしさの両立
   ========================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  html { scroll-behavior: auto; }
  .hero__canvas { display: none; }
}
