/* AI 放課後 / After-Hours Agents — Calm Interface stylesheet
   Design philosophy: cognitive clarity > theatrics, trust-driven UX,
   nocturne (deep blue + warm amber) world view, AI-agnostic feel. */

:root {
  --bg: #0a1628;
  --bg-elev: #16263c;
  --bg-elev-2: #1f3149;
  --border: #2c4564;
  --text: #e8eef4;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;
  --accent: #f4a261;
  --accent-hover: #f6b27c;
  --accent-text: #1a1a1a;
  --success: #2a9d8f;
  --warn: #e76f51;
  --info: #4a9eff;
  --max-width: 1080px;
  --radius: 8px;
  --radius-lg: 14px;
  --shadow: 0 8px 24px rgba(0,0,0,.25);
  --font-jp: 'Noto Sans JP', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-en: 'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-jp);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

.container { max-width: var(--max-width); margin: 0 auto; padding: 0 24px; }
.visually-hidden {
  position: absolute; 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; top: -40px; left: 0; background: var(--accent);
  color: var(--accent-text); padding: 8px 16px; z-index: 100;
  text-decoration: none; font-weight: 600;
}
.skip-link:focus { top: 0; }

a { color: var(--accent); text-decoration: none; transition: color .2s; }
a:hover, a:focus { color: var(--accent-hover); }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
strong { color: var(--text); font-weight: 600; }
small { color: var(--text-muted); }

/* === Header / Nav === */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(10,22,40,.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px;
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); }
.brand-mark { font-size: 28px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-jp { font-size: 16px; font-weight: 700; }
.brand-en { font-size: 12px; color: var(--text-muted); letter-spacing: .04em; }
.site-header nav { display: flex; gap: 24px; }
.site-header nav a { color: var(--text-muted); font-size: 14px; }
.site-header nav a:hover { color: var(--text); }

/* === Hero === */
.hero {
  padding: 100px 0 80px;
  background-image: linear-gradient(180deg, rgba(10,22,40,0.4) 0%, rgba(10,22,40,0.85) 60%, rgba(10,22,40,1) 100%), url('/api/static/img/hero-nocturne.png');
  background-size: cover;
  background-position: center 30%;
  background-repeat: no-repeat;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.hero-eyebrow {
  display: inline-block; margin: 0 0 24px;
  padding: 6px 14px;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px; color: var(--text-muted); letter-spacing: .05em;
}
.hero-title {
  margin: 0 0 24px; font-size: clamp(32px, 5vw, 52px);
  font-weight: 700; line-height: 1.3; letter-spacing: -.01em;
}
.hero-emphasis { color: var(--accent); }
.hero-sub {
  margin: 0 0 32px; font-size: clamp(16px, 2vw, 20px);
  color: var(--text-muted);
}
.hero-poetic {
  margin: 0 0 32px;
  font-size: clamp(15px, 1.6vw, 17px);
  font-style: italic;
  color: var(--accent);
  letter-spacing: .02em;
  border-left: 2px solid var(--accent);
  padding: 4px 0 4px 16px;
  max-width: 560px;
}
.hero-trust {
  margin: 16px 0 32px;
  padding: 12px 16px;
  background: rgba(42, 157, 143, .08);
  border: 1px solid rgba(42, 157, 143, .25);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text);
  max-width: 560px;
  display: flex; align-items: center; gap: 8px;
}
.hero-trust span { font-size: 16px; }
.btn-primary small {
  display: block;
  font-size: 11px;
  font-weight: 400;
  margin-top: 2px;
  opacity: .75;
}
.nav-tertiary { opacity: .6; font-size: 13px; }
.nav-tertiary:hover { opacity: 1; }
.nav-live {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--accent) !important;
}
.nav-live-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--warn);
  animation: pulse 1.6s ease-in-out infinite;
}
.hero-detail {
  margin: 0 0 40px; max-width: 680px; color: var(--text-muted);
  font-size: 16px; line-height: 1.9;
}
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 56px; }

/* === Buttons === */
.btn-primary, .btn-ghost {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 14px 24px;
  border-radius: var(--radius);
  font-family: inherit; font-size: 15px; font-weight: 600;
  cursor: pointer; transition: all .2s; text-decoration: none;
  border: none;
}
.btn-primary {
  background: var(--accent); color: var(--accent-text);
}
.btn-primary:hover, .btn-primary:focus { background: var(--accent-hover); }
.btn-ghost {
  background: transparent; color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover, .btn-ghost:focus { border-color: var(--accent); color: var(--accent); }
.btn-loading[hidden] { display: none; }

.hero-metrics {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px; margin: 0; padding: 24px;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.hero-metrics > div { text-align: left; }
.hero-metrics dt { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.hero-metrics dd {
  margin: 0; font-size: 24px; font-weight: 700; color: var(--accent);
  font-family: var(--font-en);
}

/* === Sections === */
.section { padding: 80px 0; border-bottom: 1px solid var(--border); }
.section-head { max-width: 720px; margin: 0 auto 48px; text-align: center; }
.section-eyebrow {
  display: inline-block; margin: 0 0 12px;
  font-size: 12px; color: var(--accent); letter-spacing: .15em;
  text-transform: uppercase; font-weight: 600;
}
.section h2 { margin: 0 0 16px; font-size: clamp(24px, 3.5vw, 36px); font-weight: 700; }
.section-lead { color: var(--text-muted); font-size: 16px; line-height: 1.9; }

/* === Demo Form === */
.demo-form {
  max-width: 720px; margin: 0 auto 24px;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px;
}
.demo-form textarea {
  width: 100%; padding: 16px; margin-bottom: 12px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text); font-family: inherit; font-size: 15px; line-height: 1.7;
  resize: vertical;
}
.demo-form textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(244,162,97,.15);
}
.demo-help { margin: 0 0 16px; font-size: 13px; color: var(--text-subtle); }
#demo-submit { width: 100%; justify-content: center; }

/* === Demo Result === */
.demo-result {
  display: block; max-width: 720px; margin: 0 auto;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 32px;
  animation: fadeIn .4s ease;
}
.demo-result[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; } }
.result-header {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 24px; padding-bottom: 16px; border-bottom: 1px solid var(--border);
}
.result-header h3 { margin: 0; font-size: 20px; }
.result-agent { font-size: 13px; color: var(--text-muted); }
.result-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px; margin-bottom: 24px;
}
.result-card {
  background: var(--bg-elev-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.result-label {
  margin: 0 0 12px; font-size: 12px; color: var(--text-muted);
  letter-spacing: .05em; text-transform: uppercase;
}
.result-score {
  margin: 0 0 8px; font-size: 48px; font-weight: 700;
  color: var(--accent); line-height: 1; font-family: var(--font-en);
}
.result-score small { font-size: 18px; color: var(--text-muted); margin-left: 4px; }
.result-severity { margin: 0; font-size: 13px; font-weight: 600; }
.result-severity.high { color: var(--warn); }
.result-severity.mid { color: var(--accent); }
.result-severity.low { color: var(--success); }
.result-card ul, .result-card ol { margin: 0; padding-left: 20px; font-size: 14px; }
.result-card li { margin-bottom: 6px; line-height: 1.6; }
.result-summary {
  padding: 16px; background: var(--bg-elev-2); border-left: 3px solid var(--accent);
  border-radius: 4px; margin: 0 0 16px; font-size: 14px; line-height: 1.8;
}
.result-rationale {
  margin-top: 16px; padding: 12px;
  background: var(--bg-elev-2); border-radius: var(--radius);
  font-size: 13px;
}
.result-rationale summary { cursor: pointer; color: var(--text-muted); }
.result-rationale summary:hover { color: var(--text); }

/* === Shift Table === */
.shift-table {
  display: grid; gap: 12px; max-width: 720px; margin: 0 auto 48px;
}
.shift-row {
  display: grid; grid-template-columns: 140px 1fr; gap: 16px;
  padding: 20px; background: var(--bg-elev);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.shift-day { border-left: 3px solid #fbbf24; }
.shift-night { border-left: 3px solid #6366f1; }
.shift-early { border-left: 3px solid #10b981; }
.shift-label { font-weight: 600; font-size: 15px; }
.shift-label small { display: block; color: var(--text-muted); font-size: 12px; font-weight: 400; }
.shift-members { color: var(--text); align-self: center; font-size: 16px; }

/* === Agent Grid === */
.agent-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.agent-card {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px;
  transition: transform .2s, border-color .2s;
}
.agent-card:hover {
  transform: translateY(-2px); border-color: var(--accent);
}
.agent-card.implemented { border-color: var(--success); }
.agent-card.implemented:hover { border-color: var(--accent); }
.agent-icon { font-size: 40px; margin-bottom: 12px; }
.agent-avatar {
  width: 96px; height: 96px;
  margin: 0 0 12px; border-radius: 12px;
  background: var(--bg-elev-2);
  object-fit: contain;
}
.agent-name { margin: 0 0 4px; font-size: 18px; }
.agent-name small { font-family: var(--font-en); font-size: 13px; color: var(--text-muted); margin-left: 6px; }
.agent-role { margin: 0 0 12px; font-size: 13px; color: var(--accent); font-weight: 600; }
.agent-quote {
  margin: 0 0 16px; padding: 12px; background: var(--bg-elev-2);
  border-left: 2px solid var(--accent); border-radius: 4px;
  font-size: 13px; font-style: italic; line-height: 1.7;
}
.agent-meta { margin: 0 0 12px; font-size: 13px; }
.agent-meta dt { color: var(--text-muted); font-size: 11px; margin-top: 8px; }
.agent-meta dd { margin: 0; color: var(--text); }
.agent-status {
  margin: 12px 0 0; padding-top: 12px; border-top: 1px solid var(--border);
  font-size: 12px; color: var(--success); font-weight: 600;
}
.agent-status.pending { color: var(--text-subtle); }

/* === Nocturne Log === */
.nocturne-log {
  max-width: 720px; margin: 0 auto;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 32px;
}
.nocturne-meta {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
  margin-bottom: 24px; padding-bottom: 16px; border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.nocturne-meta time { color: var(--accent); font-family: var(--font-en); }
.nocturne-tag {
  padding: 4px 10px; background: var(--bg-elev-2);
  border-radius: 999px; color: var(--text-muted); font-size: 12px;
}
.nocturne-attendees { color: var(--text-muted); margin-left: auto; }
.nocturne-conversation { list-style: none; margin: 0; padding: 0; }
.speech {
  margin-bottom: 16px; padding: 12px 16px;
  background: var(--bg-elev-2); border-radius: var(--radius);
}
.speech .speaker {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--accent); margin-bottom: 6px;
}
.speech p { margin: 0; font-size: 14px; line-height: 1.8; }
.speech-toride { border-left: 3px solid #f97316; }
.speech-yomi { border-left: 3px solid #6366f1; }
.speech-mio { border-left: 3px solid #fbbf24; }
.speech-tsunagu { border-left: 3px solid #10b981; }
.nocturne-outcome {
  margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border);
  font-size: 14px; color: var(--text-muted);
}
.nocturne-outcome p { margin: 0; }
.nocturne-note {
  max-width: 720px; margin: 24px auto 0;
  font-size: 13px; color: var(--text-subtle); text-align: center;
}
.nocturne-note code {
  padding: 2px 6px; background: var(--bg-elev);
  border-radius: 4px; font-family: var(--font-en); font-size: 12px;
}

/* === Flow Diagram (Architecture as storybook) === */
.flow-diagram {
  margin: 0; padding: 0;
}
.flow-diagram img {
  display: block; width: 100%; max-width: 1080px;
  margin: 0 auto 32px; border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-elev);
}
.flow-steps {
  list-style: none; padding: 0; margin: 0;
  max-width: 720px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  counter-reset: step;
}
.flow-steps li {
  padding: 16px 20px;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  font-size: 14px; line-height: 1.7;
}
.flow-steps strong {
  display: block; color: var(--accent);
  font-size: 13px; margin-bottom: 4px;
  letter-spacing: .03em;
}
.flow-caption {
  font-size: 14px; color: var(--text);
}

/* === Tech Section === */
.tech-stack, .tech-agent-ready {
  list-style: none; padding: 0; max-width: 720px; margin: 0 auto 32px;
  display: grid; gap: 12px;
}
.tech-stack li, .tech-agent-ready li {
  padding: 16px 20px;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 14px;
}
.tech-stack li small { display: block; margin-top: 4px; color: var(--text-subtle); }
.tech-sub {
  max-width: 720px; margin: 32px auto 16px;
  font-size: 18px; color: var(--accent);
}
.tech-links {
  display: flex; gap: 12px; flex-wrap: wrap; justify-content: center;
  max-width: 720px; margin: 32px auto 0;
}

/* === Footer === */
.site-footer {
  padding: 48px 0 64px; text-align: center;
  border-top: 1px solid var(--border); background: var(--bg-elev);
}
.footer-tagline {
  margin: 0 0 16px; font-size: 14px; font-style: italic;
  color: var(--accent);
}
.footer-meta { margin: 0; font-size: 12px; color: var(--text-subtle); }

/* === Agent Roadmap (#655) === */
.agent-roadmap {
  margin-top: 2.5rem;
  padding: 1.5rem;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(244, 162, 97, 0.3);
  border-radius: 12px;
}
.roadmap-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.roadmap-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}
.roadmap-progress { margin-bottom: 1.25rem; }
.progress-bar {
  background: rgba(255,255,255,0.1);
  border-radius: 9999px;
  height: 8px;
  overflow: hidden;
}
.progress-fill {
  background: var(--accent);
  border-radius: 9999px;
  height: 8px;
  transition: width 0.8s ease;
}
.progress-label {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  color: var(--text-subtle);
}
.roadmap-phases {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.roadmap-phase {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  font-size: 0.875rem;
  line-height: 1.5;
}
.phase-badge { white-space: nowrap; }
.roadmap-phase.completed { opacity: 1; }
.roadmap-phase.planned { opacity: 0.65; }

/* === Responsive === */
@media (max-width: 640px) {
  .site-header nav { display: none; }
  .hero { padding: 60px 0; }
  .section { padding: 56px 0; }
  .result-grid { grid-template-columns: 1fr; }
  .shift-row { grid-template-columns: 1fr; }
  .nocturne-attendees { margin-left: 0; }
}

/* === Hero image mobile optimization (#658) === */
@media (max-width: 450px) {
  /* 450px 以下では 1536px 大画像のネットワーク転送を抑制するため
     background-image を削除し、グラデーションのみで表現する */
  .hero {
    background-image: linear-gradient(
      160deg,
      rgba(10,22,40,0.95) 0%,
      rgba(20,40,70,0.9) 50%,
      rgba(10,22,40,1) 100%
    );
  }
}

/* === Reduced motion === */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
