/* AI Creator Path v3 — 蒼の天象儀 (Planetarium Indigo) */

/* ========== Fonts ========== */
:root {
  --f-serif: "Fraunces", "EB Garamond", Georgia, serif;
  --f-jp-serif: "Zen Old Mincho", "Shippori Mincho", "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", serif;
  --f-jp: "Zen Kaku Gothic New", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  --f-mono: "JetBrains Mono", "SF Mono", Consolas, monospace;
}

/* ========== Palette — Planetarium Indigo ========== */
:root, :root[data-theme="dark"], :root[data-theme="light"] {
  --washi: #101830;
  --washi-2: #16203E;
  --washi-3: #1A2548;
  --ink: #EEF1FF;
  --ink-soft: #CBD3F2;
  --ink-mute: #A8B2D8;
  --ink-fade: #5F6A96;
  --vermilion: #A78BFA;     /* primary accent (violet) */
  --vermilion-2: #8B6BF0;
  --teal: #5EEAD4;
  --iris: #C4B0FF;
  --lavender: #A78BFA;
  --mint: #5EEAD4;
  --apricot: #F9A8D4;
  --gold: #FDE68A;
  --paper-soft: rgba(30,42,80,0.6);
  --glass-bg: rgba(30,42,80,0.52);
  --glass-border: rgba(148,163,255,0.16);
  --shadow-1: 0 1px 2px rgba(0,0,0,0.3), 0 12px 32px -12px rgba(0,0,0,0.5);
  --shadow-2: 0 2px 6px rgba(0,0,0,0.35), 0 32px 80px -24px rgba(0,0,0,0.7);
  --grad-accent: linear-gradient(90deg, #A78BFA, #5EEAD4);
}

/* ========== Base ========== */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scrollbar-gutter: stable; background: #0B1226; }
body {
  margin: 0; background: transparent; color: var(--ink);
  font-family: var(--f-jp); font-size: 15px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  cursor: none;
  min-height: 100vh;
  font-feature-settings: "palt";
}
@media (pointer: coarse) { body { cursor: auto; } }

a { color: inherit; }
img { max-width: 100%; display: block; }
button, input, textarea { font-family: inherit; }

.serif { font-family: var(--f-serif); font-variation-settings: "opsz" 144, "wght" 500; letter-spacing: -0.01em; }
.jp-serif { font-family: var(--f-jp-serif); }
.mono { font-family: var(--f-mono); }
.wrap { max-width: 1280px; margin: 0 auto; padding: 0 32px; }
.desktop-only { display: revert; }
.mobile-only { display: none; }
@media (max-width: 1024px) { .desktop-only { display: none !important; } .mobile-only { display: revert; } }

/* mobile pill nav row — hidden on desktop even with flex layout */
.mobile-navrow { display: none; }
@media (max-width: 1024px) { .mobile-navrow { display: flex; } }

/* ========== Star cursor ========== */
#inkDot {
  position: fixed; left: 0; top: 0; width: 14px; height: 14px; border-radius: 50%;
  background: radial-gradient(circle, rgba(94,234,212,0.9) 0%, rgba(94,234,212,0.25) 55%, transparent 75%);
  pointer-events: none; z-index: 9999;
  transition: transform 0.08s cubic-bezier(.2,.8,.2,1), opacity 0.3s;
  mix-blend-mode: screen;
}
.ink-ripple {
  position: fixed; width: 8px; height: 8px; border-radius: 50%;
  background: rgba(167,139,250,0.9); pointer-events: none; z-index: 9998;
  transform: translate(-50%,-50%);
  animation: ink-ripple 0.8s cubic-bezier(.2,.6,.3,1) forwards;
  mix-blend-mode: screen;
}
@keyframes ink-ripple {
  0% { transform: translate(-50%,-50%) scale(0.2); opacity: 0.9; }
  100% { transform: translate(-50%,-50%) scale(12); opacity: 0; }
}

/* ========== Top bar + header ========== */
.topbar {
  background: rgba(11,18,38,0.6);
  border-bottom: 1px solid var(--glass-border); font-size: 12px;
  position: relative; z-index: 10;
  backdrop-filter: blur(8px);
}
header.app {
  position: sticky; top: 0; z-index: 50;
  background: transparent;
  transition: background 0.3s, backdrop-filter 0.3s, border-color 0.3s, box-shadow 0.3s;
  border-bottom: 1px solid transparent;
}
header.app.solid {
  background: rgba(11,18,38,0.78);
  backdrop-filter: blur(20px) saturate(160%);
  border-bottom-color: var(--glass-border);
  box-shadow: var(--shadow-1);
}
.has-dropdown { position: relative; white-space: nowrap; }
header.app nav a { white-space: nowrap; }
.has-dropdown:hover .dropdown { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown {
  position: absolute; top: 100%; left: 0; min-width: 220px; padding: 8px;
  border-radius: 16px; opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: all 0.2s; z-index: 60;
  background: #131C38;
  border: 1px solid rgba(148,163,255,0.25);
  box-shadow: var(--shadow-2);
}
.dropdown a {
  display: block; padding: 9px 12px; border-radius: 10px; font-size: 13.5px;
  color: var(--ink-soft); text-decoration: none; transition: all 0.15s;
  font-family: var(--f-jp);
}
.dropdown a:hover { background: rgba(167,139,250,0.12); color: var(--iris); }

/* ========== Glass ========== */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  box-shadow: var(--shadow-1), inset 0 1px 0 rgba(148,163,255,0.1);
  transition: transform 0.35s cubic-bezier(.2,.8,.2,1), box-shadow 0.35s, border-color 0.3s;
  position: relative;
}
.sheen { position: relative; overflow: hidden; }
.sheen::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(140deg, rgba(148,163,255,0.12) 0%, transparent 35%);
}
.press { cursor: pointer; }
.press:hover { transform: translateY(-3px); box-shadow: var(--shadow-2), 0 0 40px -12px rgba(167,139,250,0.45); border-color: rgba(167,139,250,0.4); }
.press:active { transform: translateY(-1px); transition-duration: 0.1s; }

/* ========== Chips ========== */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: 999px; font-size: 10px;
  font-family: var(--f-mono); letter-spacing: 0.16em; text-transform: uppercase;
  background: rgba(148,163,255,0.08); border: 1px solid rgba(148,163,255,0.18); color: var(--ink-soft);
}
.chip.vermilion {
  background: rgba(167,139,250,0.12); border-color: rgba(167,139,250,0.35); color: var(--iris);
}
.chip.teal {
  background: rgba(94,234,212,0.1); border-color: rgba(94,234,212,0.3); color: var(--teal);
}
.chip.iris {
  background: rgba(196,176,255,0.1); border-color: rgba(196,176,255,0.28); color: var(--iris);
  text-transform: none; letter-spacing: 0.04em; font-family: var(--f-jp);
}

/* ========== Buttons ========== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 0 22px; height: 44px; border-radius: 999px; font-size: 13.5px;
  font-weight: 500; letter-spacing: 0.02em; text-decoration: none; cursor: pointer;
  background: rgba(30,42,80,0.6); border: 1px solid var(--glass-border);
  color: var(--ink); transition: all 0.22s cubic-bezier(.2,.8,.2,1);
  font-family: var(--f-jp);
  position: relative; overflow: hidden;
  white-space: nowrap; flex-shrink: 0; line-height: 1;
}
.btn:hover { border-color: rgba(167,139,250,0.5); transform: translateY(-1px); box-shadow: 0 0 30px -8px rgba(167,139,250,0.5); }
.btn-vermilion {
  background: var(--grad-accent);
  color: #0B1226; border-color: transparent; font-weight: 700;
  box-shadow: 0 12px 36px -10px rgba(167,139,250,0.55);
}
.btn-vermilion:hover { box-shadow: 0 16px 44px -8px rgba(94,234,212,0.5); border-color: transparent; }

/* ========== Hero titles ========== */
.hero-title {
  font-size: clamp(64px, 10.5vw, 164px);
  line-height: 0.98; letter-spacing: -0.035em; font-weight: 500;
  text-wrap: balance;
}
.hero-title .jpn-title {
  font-family: var(--f-jp-serif); font-weight: 600;
  font-size: clamp(40px, 6.5vw, 92px); letter-spacing: -0.02em;
  line-height: 1.08;
}
.hero-jp {
  color: var(--ink);
  text-shadow: 0 0 50px rgba(167,139,250,0.5), 0 2px 20px rgba(0,0,0,0.5);
}

.sec-title {
  font-family: var(--f-jp-serif);
  font-size: clamp(36px, 4.4vw, 54px);
  font-weight: 600; letter-spacing: -0.025em; line-height: 1.15;
  text-wrap: balance;
}
.sec-title em {
  font-family: var(--f-serif); font-style: italic;
  font-variation-settings: "opsz" 144, "wght" 400;
  background: var(--grad-accent);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  padding: 0 2px;
}

/* ========== Vertical text ========== */
.vertical {
  writing-mode: vertical-rl; text-orientation: upright;
  font-family: var(--f-jp-serif); font-size: 12px; letter-spacing: 0.4em;
  color: var(--ink-fade);
}

/* ========== Brush divider → constellation line ========== */
.brush { width: 100%; height: 26px; display: block; margin: 28px 0 40px; }

/* ========== Seal → celestial badge ========== */
.seal {
  display: inline-grid; place-items: center;
  background: linear-gradient(135deg, #A78BFA, #5EEAD4);
  color: #0B1226; border-radius: 50%;
  font-family: var(--f-jp-serif); font-weight: 700;
  box-shadow: 0 0 24px -4px rgba(167,139,250,0.6), inset 0 0 0 1px rgba(255,255,255,0.25);
  position: relative;
}
.seal::before {
  content: ""; position: absolute; inset: -5px; border-radius: 50%;
  border: 1px dashed rgba(148,163,255,0.35);
}
.seal { animation: seal-pulse 4s ease-in-out infinite; }
@keyframes seal-pulse {
  0%, 100% { transform: rotate(var(--seal-rot, -6deg)) scale(1); filter: brightness(1); }
  50%      { transform: rotate(var(--seal-rot, -6deg)) scale(1.015); filter: brightness(1.08); }
}
@media (prefers-reduced-motion: reduce) { .seal { animation: none; } }

/* ========== Input ========== */
.input {
  width: 100%; padding: 10px 0; background: transparent; border: none; outline: none;
  color: var(--ink); font-size: 15px; font-family: var(--f-jp);
}
.input::placeholder { color: var(--ink-fade); }

/* ========== Pulse ========== */
.pulse {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--teal); position: relative;
  animation: pulse-v 2s cubic-bezier(.2,.8,.2,1) infinite;
}
@keyframes pulse-v {
  0%   { box-shadow: 0 0 0 0 rgba(94,234,212,0.5); }
  70%  { box-shadow: 0 0 0 10px rgba(94,234,212,0); }
  100% { box-shadow: 0 0 0 0 rgba(94,234,212,0); }
}
.spin { animation: spin 0.8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.caret::after {
  content: "▊"; display: inline-block; margin-left: 2px; color: var(--teal);
  animation: blink 1s infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ========== KPI floats ========== */
.kpi {
  position: absolute; padding: 14px 18px;
  background: rgba(22,32,62,0.75); backdrop-filter: blur(12px);
  border: 1px solid rgba(148,163,255,0.18); border-radius: 18px;
  box-shadow: var(--shadow-1);
  min-width: 140px;
  z-index: 3;
}
@keyframes float-a { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes float-b { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }
@keyframes float-c { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

/* ========== Dashboard ========== */
@media (max-width: 1100px) {
  .dash-grid { grid-template-columns: 1fr !important; }
}

/* ========== Tab ========== */
.tabrow { position: relative; display: inline-flex; gap: 0; margin-bottom: 22px; flex-wrap: wrap; }
.tab {
  background: transparent; border: none; padding: 12px 22px;
  font-size: 14px; color: var(--ink-fade); cursor: pointer;
  transition: color 0.22s; font-family: var(--f-jp); font-weight: 500;
}
.tab.active { color: var(--ink); font-weight: 700; }
.tab-underline {
  position: absolute; bottom: 0; height: 2px;
  background: var(--grad-accent) !important;
  transition: left 0.45s cubic-bezier(.2,.8,.2,1), width 0.45s cubic-bezier(.2,.8,.2,1);
}

/* ========== News list ========== */
.news-list { display: flex; flex-direction: column; }
.news-list[data-hover="true"] .news-item { opacity: 0.45; }
.news-list[data-hover="true"] .news-item:hover { opacity: 1; background: rgba(167,139,250,0.06); }
.news-item { transition: opacity 0.3s, background 0.2s, transform 0.2s; border-bottom: 1px solid rgba(148,163,255,0.08); }
.news-item:last-child { border-bottom: none; }
.news-item:hover { transform: translateX(4px); }

/* ========== Quiz ========== */
.quiz-opt {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 22px; border-radius: 16px;
  background: rgba(30,42,80,0.5); border: 1px solid rgba(148,163,255,0.12);
  transition: all 0.22s; cursor: pointer;
}
.quiz-opt:hover { border-color: var(--vermilion); transform: translateX(4px); background: rgba(167,139,250,0.08); }
.quiz-opt.correct { background: rgba(94,234,212,0.1); border-color: var(--teal); }
.quiz-opt.wrong { background: rgba(249,168,212,0.08); border-color: var(--apricot); }
.quiz-letter {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(148,163,255,0.1); color: var(--ink); font-weight: 700;
  font-family: var(--f-serif); font-size: 14px;
  flex-shrink: 0;
}
.quiz-opt.correct .quiz-letter { background: var(--teal); color: #0B1226; }
.quiz-opt.wrong .quiz-letter { background: var(--apricot); color: #0B1226; }

.gold-particle {
  position: fixed; width: 6px; height: 6px; border-radius: 50%;
  background: var(--gold); box-shadow: 0 0 12px rgba(253,230,138,0.8);
  pointer-events: none; z-index: 40; opacity: 1;
}

/* ========== Reveal ========== */
.reveal > * { opacity: 0; transform: translateY(24px); transition: opacity 0.8s, transform 0.8s cubic-bezier(.2,.8,.2,1); }
.reveal.in > * { opacity: 1; transform: translateY(0); }
.reveal.in > *:nth-child(2) { transition-delay: 0.08s; }
.reveal.in > *:nth-child(3) { transition-delay: 0.16s; }

/* ========== Origami footer ========== */
.origami {
  transform-origin: top center;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
  transition: clip-path 1.1s cubic-bezier(.2,.8,.2,1);
}
.origami:not(.in) { clip-path: polygon(0 0, 100% 0, 100% 30%, 0 30%); }

/* ========== FAB ========== */
.fab-wrap {
  position: fixed; right: 22px; bottom: 22px; z-index: 50;
  display: flex; flex-direction: column; gap: 12px; align-items: flex-end;
}
@media (max-width: 500px) { .fab-wrap { right: 14px; bottom: 14px; } }

/* ========== Cmdk ========== */
.cmdk-mask {
  position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-start; justify-content: center;
  padding-top: 12vh; background: rgba(5,9,20,0.6); backdrop-filter: blur(8px);
  animation: fade-in 0.2s;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.cmdk {
  width: min(620px, calc(100vw - 32px));
  background: #131C38; border: 1px solid rgba(148,163,255,0.22); border-radius: 20px;
  box-shadow: var(--shadow-2); overflow: hidden;
  animation: pop-in 0.24s cubic-bezier(.2,.8,.2,1);
}
@keyframes pop-in { from { transform: scale(0.96) translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }
.cmdk-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 18px; cursor: pointer;
  transition: background 0.15s;
}
.cmdk-row.active { background: rgba(167,139,250,0.12); }

/* ========== Glyphs / math layers ========== */
.whisper-glyph { position: absolute; font-family: var(--f-mono); color: var(--iris);
  opacity: 0; animation: whisper 3s ease-in-out forwards;
  text-shadow: 0 0 12px currentColor;
  pointer-events: none;
}
@keyframes whisper {
  0%   { opacity: 0; transform: translateY(6px); letter-spacing: 0; }
  20%  { opacity: 0.12; }
  60%  { opacity: 0.09; letter-spacing: 0.15em; }
  100% { opacity: 0; transform: translateY(-14px); letter-spacing: 0.3em; }
}
.math-float {
  position: absolute;
  font-family: "Times New Roman", "Noto Serif JP", serif;
  font-style: italic;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  letter-spacing: 0.01em;
  text-shadow: 0 0 14px rgba(148,163,255,0.3);
  will-change: transform, opacity;
  animation-name: math-drift;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
  animation-iteration-count: 1;
}
@keyframes math-drift {
  0%   { transform: translate(0, 24px) scale(0.985); }
  100% { transform: translate(var(--driftX, 0), -130px) scale(1.02); }
}
@media (prefers-reduced-motion: reduce) { .math-float { display: none; } }

/* ========== Responsive ========== */
@media (max-width: 1024px) {
  .wrap { padding: 0 20px; }
  .hero-title { font-size: clamp(52px, 13vw, 92px); }
  .hero-title .jpn-title { font-size: clamp(32px, 7.5vw, 58px); }
  .sec-title { font-size: clamp(28px, 6vw, 40px); }
  section { padding: 60px 0 !important; }
  .kpi { display: none !important; }
}
@media (max-width: 680px) {
  #featured .glass { grid-template-columns: 1fr !important; }
  #featured .glass > div:first-child { min-height: 240px !important; }
}
