/* ═══════════════════════════════════════════════════════
   YapCLI · Terminal-First Agent IDE
   Design: 和風 + デジタル + ギーク (Japanese × Digital × Geek)
   Palette: #FAF8F5 (warm paper), #E63946 (japanese red),
            #1D3557 (ink blue), #F1FAEE (white),
            #A8DADC (ice), #457B9D (steel)
   ═══════════════════════════════════════════════════════ */

:root {
  --paper: #FAF8F5;
  --white: #FFFFFF;
  --ink: #1D3557;
  --ink-soft: #2B4D6E;
  --red: #E63946;
  --red-glow: rgba(230, 57, 70, 0.12);
  --red-soft: rgba(230, 57, 70, 0.06);
  --gold: #D4A843;
  --gold-soft: rgba(212, 168, 67, 0.15);
  --steel: #457B9D;
  --ice: #A8DADC;
  --gray-50: #F8F7F4;
  --gray-100: #F0EDE8;
  --gray-200: #E0DBD3;
  --gray-300: #C5BEB2;
  --gray-400: #9E9488;
  --gray-500: #7A7064;
  --gray-600: #5C544A;
  --gray-700: #3D3730;

  --font-jp: 'Noto Sans JP', 'Noto Sans SC', -apple-system, sans-serif;
  --font-en: 'Inter', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --radius: 10px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --nav-h: 64px;
  --max-w: 1120px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { scroll-behavior: smooth; scroll-padding-top: var(--nav-h); }

body {
  font-family: var(--font-jp);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: var(--red); text-decoration: none; transition: color var(--transition); }
a:hover { color: #b71c1c; }

/* ── Grid Background Pattern (Digital/Geek) ──────── */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image:
    linear-gradient(var(--gray-100) 1px, transparent 1px),
    linear-gradient(90deg, var(--gray-100) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  z-index: 0;
  opacity: 0.5;
}

/* ── Navigation ──────────────────────────────────── */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(16px) saturate(1.5);
  border-bottom: 1px solid var(--gray-200);
  z-index: 1000;
  transition: background var(--transition), box-shadow var(--transition);
}

.nav.scrolled {
  background: rgba(255,255,255,0.96);
  box-shadow: 0 1px 8px rgba(29,53,87,0.06);
}

.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 2px;
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
}
.logo-text { color: var(--ink); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.nav-links a {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--gray-500);
  transition: color var(--transition);
  font-family: var(--font-en);
}
.nav-links a:hover { color: var(--ink); }

.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 5px 12px;
  font-family: var(--font-jp);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--steel);
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition);
}
.lang-toggle:hover {
  border-color: var(--steel);
  background: var(--gray-50);
  color: var(--ink);
}

.nav-gh {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 6px 14px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  font-size: 0.8rem;
  color: var(--gray-600) !important;
  transition: all var(--transition);
}
.nav-gh:hover {
  border-color: var(--gray-300);
  background: var(--white);
  color: var(--ink) !important;
}

/* ── Hero ────────────────────────────────────────── */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: calc(var(--nav-h) + 3rem) 1.5rem 4rem;
  position: relative;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  top: -30%;
  right: -10%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--red-glow) 0%, transparent 65%);
  pointer-events: none;
}

/* Japanese sun disc accent */
.hero::after {
  content: '';
  position: absolute;
  top: 60px;
  right: 80px;
  width: 120px;
  height: 120px;
  border: 2px solid var(--red);
  border-radius: 50%;
  opacity: 0.08;
  pointer-events: none;
}

.hero-grid {
  max-width: var(--max-w);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: center;
  width: 100%;
  position: relative;
  z-index: 1;
}

.hero-content { position: relative; }

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}
.badge-text {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--red);
  background: var(--red-soft);
  border: 1px solid var(--red-glow);
  padding: 4px 14px;
  border-radius: 20px;
  letter-spacing: 0.05em;
}
.badge-ver {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--gray-400);
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  padding: 4px 10px;
  border-radius: 20px;
}

.hero-title {
  margin-bottom: 1.2rem;
}
.title-sub {
  display: block;
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 500;
  color: var(--steel);
  letter-spacing: 0.1em;
  margin-bottom: 0.3rem;
}
.title-main {
  display: block;
  font-family: var(--font-en);
  font-size: 3.6rem;
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--ink);
}
.title-main::after {
  content: '';
}

.hero-desc {
  font-size: 0.95rem;
  color: var(--gray-500);
  line-height: 1.8;
  margin-bottom: 2rem;
  max-width: 480px;
}

.hero-actions {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 11px 22px;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 600;
  font-family: var(--font-jp);
  transition: all var(--transition);
  cursor: pointer;
}
.btn-primary {
  background: var(--red);
  color: #fff;
  border: none;
}
.btn-primary:hover {
  background: #c1121f;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--red-glow);
  color: #fff;
}
.btn-secondary {
  background: var(--white);
  color: var(--ink);
  border: 1px solid var(--gray-200);
}
.btn-secondary:hover {
  border-color: var(--gray-300);
  background: var(--gray-50);
  transform: translateY(-1px);
}
.btn-tertiary {
  background: transparent;
  color: var(--steel);
  border: 1px solid var(--gray-200);
}
.btn-tertiary:hover {
  border-color: var(--steel);
  background: rgba(69,123,157,0.06);
  transform: translateY(-1px);
}

/* Terminal Window */
.term-window {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(29,53,87,0.08), 0 1px 3px rgba(29,53,87,0.04);
  transition: transform var(--transition), box-shadow var(--transition);
}
.term-window:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 50px rgba(29,53,87,0.12);
}

.term-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
}
.term-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.term-dot.red { background: var(--red); }
.term-dot.yellow { background: #f4c542; }
.term-dot.green { background: #5cb85c; }

.term-title {
  margin-left: 6px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--gray-400);
}

.term-body {
  padding: 20px 22px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 2;
  background: linear-gradient(135deg, var(--white), var(--gray-50));
}

.term-line { color: var(--gray-500); }
.t-prompt { color: var(--steel); font-weight: 600; }
.t-green { color: #2d8a4e; }
.t-dim { color: var(--gray-400); }
.t-label { color: var(--ink); font-weight: 700; }
.t-ver { color: var(--gray-400); font-size: 0.7rem; }
.t-user { color: var(--steel); font-weight: 600; }
.t-assistant { color: var(--red); font-weight: 600; }
.t-typing { display: inline-block; }
.t-cursor {
  display: inline-block;
  color: var(--red);
  animation: blink 1s step-end infinite;
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ── Stats Strip ─────────────────────────────────── */
.stats-strip {
  display: flex;
  justify-content: center;
  gap: 3rem;
  padding: 2.5rem 1.5rem;
  background: var(--white);
  border-top: 1px solid var(--gray-100);
  border-bottom: 1px solid var(--gray-100);
  flex-wrap: wrap;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.stat-num {
  font-family: var(--font-mono);
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--red);
  line-height: 1.2;
}
.stat-lbl {
  font-size: 0.75rem;
  color: var(--gray-400);
  font-weight: 500;
  letter-spacing: 0.05em;
}

/* ── Section ─────────────────────────────────────── */
.section {
  padding: 6rem 1.5rem;
  position: relative;
}

.container {
  max-width: var(--max-w);
  margin: 0 auto;
}

.section-label-wrap { text-align: center; margin-bottom: 0.5rem; }

.sec-label {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--red);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  background: var(--red-soft);
  padding: 3px 14px;
  border-radius: 20px;
}

.sec-title {
  text-align: center;
  font-family: var(--font-en);
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.02em;
  margin-bottom: 0.6rem;
}

.sec-desc {
  text-align: center;
  font-size: 0.95rem;
  color: var(--gray-400);
  margin-bottom: 3.5rem;
}

/* ── Features Grid ───────────────────────────────── */
.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.2rem;
}

.f-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 1.8rem;
  transition: all var(--transition);
  position: relative;
}

.f-card:hover {
  border-color: var(--red);
  box-shadow: 0 6px 24px var(--red-glow);
  transform: translateY(-2px);
}

.f-icon { margin-bottom: 1rem; }

.f-num {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--white);
  background: var(--red);
  padding: 2px 10px;
  border-radius: 6px;
}

.f-card h3 {
  font-family: var(--font-en);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 0.6rem;
}

.f-card p {
  font-size: 0.85rem;
  color: var(--gray-500);
  line-height: 1.7;
  margin-bottom: 1rem;
}

.f-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.f-tags span {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--steel);
  background: rgba(69,123,157,0.08);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid rgba(69,123,157,0.15);
}

/* ── Architecture ────────────────────────────────── */
.section-arch {
  background: var(--gray-50);
  border-top: 1px solid var(--gray-100);
  border-bottom: 1px solid var(--gray-100);
}

.arch-map {
  max-width: 750px;
  margin: 0 auto 2.5rem;
}

.arch-layer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.arch-row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 0.8rem;
}

.arch-node {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 8px;
  transition: all var(--transition);
  cursor: default;
}
.arch-node:hover { transform: translateY(-1px); }

.arch-arr { color: var(--red); font-size: 1.1rem; font-weight: 700; }

.arch-cli { background: #EBF0F9; border: 1px solid #B0C4DE; color: var(--steel); }
.arch-agent { background: #FCECEC; border: 1px solid #F0B8B8; color: var(--red); }
.arch-plan { background: #E6F4E6; border: 1px solid #A8D8A8; color: #2d6a2d; }
.arch-tool { background: #F0E6F6; border: 1px solid #D0B0E0; color: #7b3fa0; }
.arch-mem { background: #E0F0F4; border: 1px solid #A0C8D8; color: var(--steel); }
.arch-rag { background: #F4F0E0; border: 1px solid #D0C8A0; color: #8a7a3a; }
.arch-skill { background: #EDE6F6; border: 1px solid #C8B0E0; color: #7b3fa0; }
.arch-hitl { background: #FCE8E8; border: 1px solid #E0B0B0; color: #b33a3a; }
.arch-mcp { background: #E6ECF6; border: 1px solid #B0C8E0; color: #2a5a8a; }
.arch-web { background: #E6F4EA; border: 1px solid #A8D8B8; color: #2d6a3d; }
.arch-llm { background: #F4E6EC; border: 1px solid #D8B0C8; color: #8a3a5a; }
.arch-ctx { background: #F2F0E0; border: 1px solid #D0C8A0; color: #8a7a3a; }
.arch-pol { background: #F4EAE6; border: 1px solid #D0B8B0; color: #8a5a3a; }
.arch-brw { background: #E6E6F6; border: 1px solid #B0B0E0; color: #3a3a8a; }

.tech-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
}
.tech-strip span {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--gray-500);
  background: var(--white);
  border: 1px solid var(--gray-200);
  padding: 5px 14px;
  border-radius: 6px;
  transition: all var(--transition);
}
.tech-strip span:hover {
  border-color: var(--red);
  color: var(--red);
}

/* ── Install ─────────────────────────────────────── */
.install-cards {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  max-width: 680px;
  margin: 0 auto;
}

.i-card {
  display: flex;
  gap: 1.2rem;
  align-items: flex-start;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: border-color var(--transition);
}
.i-card:hover { border-color: var(--gray-300); }

.i-num {
  width: 40px;
  height: 40px;
  min-width: 40px;
  background: var(--red);
  color: #fff;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1rem;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.i-body { flex: 1; }
.i-body h4 {
  font-family: var(--font-en);
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 0.8rem;
}

.code-snip {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
}
.code-head {
  display: flex;
  align-items: center;
  padding: 6px 14px;
  background: var(--gray-100);
  border-bottom: 1px solid var(--gray-200);
}
.code-head span {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--gray-400);
}
.code-snip pre {
  padding: 14px 16px;
  overflow-x: auto;
}
.code-snip code {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 2;
  color: var(--ink);
  background: none;
}
.cm { color: var(--gray-400); font-style: italic; }
.ck { color: var(--steel); }

/* ── Commands ────────────────────────────────────── */
.cmd-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.7rem;
  max-width: 750px;
  margin: 0 auto;
}

.cmd-item {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  transition: all var(--transition);
  cursor: default;
}
.cmd-item:hover {
  border-color: var(--red);
  background: var(--red-soft);
}
.cmd-item code {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  background: none;
  padding: 0;
  color: var(--ink);
}
.cmd-item span {
  font-size: 0.7rem;
  color: var(--gray-400);
  font-weight: 500;
}

/* ── Footer ──────────────────────────────────────── */
.footer {
  background: var(--white);
  border-top: 1px solid var(--gray-200);
  padding: 3.5rem 1.5rem 2rem;
}

.footer-main {
  max-width: var(--max-w);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2.5rem;
  margin-bottom: 2.5rem;
}

.fb-logo {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 0.6rem;
}

.footer-brand p {
  font-size: 0.82rem;
  color: var(--gray-400);
  line-height: 1.7;
}
.footer-links h5 {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.8rem;
  font-family: var(--font-en);
}
.footer-links a,
.footer-links span {
  display: block;
  font-size: 0.82rem;
  color: var(--gray-500);
  margin-bottom: 0.4rem;
  transition: color var(--transition);
}
.footer-links a:hover { color: var(--ink); }

.footer-bottom {
  max-width: var(--max-w);
  margin: 0 auto;
  padding-top: 1.5rem;
  border-top: 1px solid var(--gray-100);
  text-align: center;
}
.footer-bottom p {
  font-size: 0.75rem;
  color: var(--gray-400);
}

/* ── Scroll Reveal ───────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── Responsive ──────────────────────────────────── */
@media (max-width: 1024px) {
  .hero-grid { grid-template-columns: 1fr; gap: 3rem; }
  .hero-terminal { max-width: 520px; }
  .title-main { font-size: 2.8rem; }
  .features-grid { grid-template-columns: repeat(2, 1fr); }
  .cmd-grid { grid-template-columns: repeat(3, 1fr); }
  .footer-main { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .title-main { font-size: 2.2rem; }
  .hero::after { display: none; }
  .hero { min-height: auto; padding: calc(var(--nav-h) + 2rem) 1rem 3rem; }

  .stats-strip { gap: 1.5rem; padding: 1.5rem 1rem; }
  .stat-num { font-size: 1.4rem; }

  .features-grid { grid-template-columns: 1fr; }
  .cmd-grid { grid-template-columns: repeat(2, 1fr); }
  .section { padding: 4rem 1rem; }
  .sec-title { font-size: 1.8rem; }

  .install-cards { max-width: 100%; }
  .i-card { flex-direction: column; align-items: stretch; }

  .footer-main { grid-template-columns: 1fr; gap: 1.5rem; }
  .nav-links a:not(.nav-gh) { display: none; }
  .lang-toggle { display: none; }
}

@media (max-width: 480px) {
  .hero-actions { flex-direction: column; }
  .cmd-grid { grid-template-columns: 1fr 1fr; }
  .term-body { font-size: 0.68rem; padding: 14px; }
  .lang-toggle { display: none; }
}
