/* Elpis Docs — reference: grid docs + step cards + code window */

:root {
  --bg: #f3f4f8;
  --bg-elevated: #ffffff;
  --ink: #1a1d26;
  --ink-soft: #5c6370;
  --ink-faint: #8b919e;
  --line: #e4e7ef;
  --line-strong: #d5dae6;
  --accent: #7c5cfc;
  --accent-soft: #efeaff;
  --accent-ring: rgba(124, 92, 252, 0.35);
  --shadow: 0 10px 40px rgba(28, 35, 55, 0.06);
  --radius: 14px;
  --radius-sm: 10px;
  --nav-h: 64px;
  --font-display: "Sora", "Noto Sans SC", system-ui, sans-serif;
  --font-body: "Noto Sans SC", "Sora", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", ui-monospace, monospace;
  --grid-size: 28px;
  --grid-color: rgba(120, 130, 160, 0.14);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--ink);
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid-color) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
  background-size: var(--grid-size) var(--grid-size);
  background-position: -1px -1px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

code,
pre {
  font-family: var(--font-mono);
}

/* ——— Nav ——— */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--nav-h);
  backdrop-filter: blur(12px);
  background: rgba(243, 244, 248, 0.82);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s, background 0.2s;
}

.site-header.is-scrolled {
  border-bottom-color: var(--line);
  background: rgba(255, 255, 255, 0.88);
}

.nav-inner {
  max-width: 1180px;
  margin: 0 auto;
  height: 100%;
  padding: 0 28px;
  display: flex;
  align-items: center;
  gap: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: block;
  flex-shrink: 0;
  box-shadow: 0 4px 12px var(--accent-ring);
  object-fit: cover;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.nav-links a,
.nav-dropdown > summary {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.92rem;
  color: var(--ink-soft);
  transition: color 0.15s, background 0.15s;
  list-style: none;
}

.nav-links a:hover,
.nav-dropdown > summary:hover,
.nav-links a.is-active {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.7);
}

.nav-dropdown {
  position: relative;
}

.nav-dropdown > summary {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-dropdown > summary::-webkit-details-marker {
  display: none;
}

.nav-dropdown[open] > summary {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.7);
}

.nav-dropdown-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 180px;
  padding: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.nav-dropdown-panel a {
  display: block;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.88rem;
  color: var(--ink-soft);
}

.nav-dropdown-panel a:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.icon-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: var(--ink-soft);
  transition: background 0.15s, color 0.15s;
}

.icon-btn:hover {
  background: #fff;
  color: var(--ink);
}

.search-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 168px;
  height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-faint);
  font-size: 0.85rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-trigger:hover {
  border-color: var(--line-strong);
}

.search-trigger kbd {
  margin-left: auto;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--bg);
  border: 1px solid var(--line);
  font-family: var(--font-body);
  font-size: 0.72rem;
  color: var(--ink-faint);
}

.nav-sub {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 28px 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
}

.nav-sub a {
  font-size: 0.82rem;
  color: var(--ink-faint);
  transition: color 0.15s;
}

.nav-sub a:hover,
.nav-sub a.is-active {
  color: var(--accent);
}

/* ——— Layout ——— */
.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 36px 28px 96px;
  position: relative;
}

/* ——— Home landing ——— */
.home-page {
  padding-top: 28px;
}

.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 40px;
  align-items: center;
  margin-bottom: 48px;
  min-height: min(52vh, 480px);
}

.home-hero-copy h1 {
  margin: 0 0 16px;
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 5.5vw, 3.6rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.08;
  color: var(--ink);
}

.home-hero-desc {
  margin: 0 0 28px;
  max-width: 34rem;
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--ink-soft);
}

.home-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 28px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 22px;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s, border-color 0.15s;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 24px var(--accent-ring);
}

.btn-primary:hover {
  background: #6b4af0;
}

.btn-ghost {
  background: #fff;
  border: 1px solid var(--line-strong);
  color: var(--ink);
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.home-tech {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}

.home-tech > span {
  font-size: 0.82rem;
  color: var(--ink-faint);
}

.home-tech ul {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.home-tech li {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.8);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--ink-soft);
}

.home-hero-visual {
  display: flex;
  justify-content: center;
  align-items: center;
}

.home-hero-visual img {
  width: 100%;
  max-width: 520px;
  height: auto;
  border-radius: 20px;
  border: 3px solid var(--accent);
  background: #fff;
  box-shadow: var(--shadow);
  object-fit: contain;
}

.feature-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-bottom: 56px;
}

.feature-card {
  padding: 24px 22px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.feature-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
}

.feature-icon-amber {
  background: #fef3c7;
  color: #d97706;
}

.feature-icon-rose {
  background: #fce7f3;
  color: #db2777;
}

.feature-icon-sky {
  background: #e0f2fe;
  color: #0284c7;
}

.feature-card h3 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
}

.feature-card p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--ink-soft);
}

.diagram-section {
  margin-bottom: 48px;
}

.diagram-head {
  margin-bottom: 18px;
}

.diagram-head h2 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.diagram-head p {
  margin: 0;
  max-width: 40rem;
  font-size: 0.95rem;
  color: var(--ink-soft);
}

.diagram-frame {
  margin: 0;
  padding: 20px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow);
  overflow: auto;
}

.diagram-frame img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
}

.hero {
  position: relative;
  margin-bottom: 40px;
  padding-right: 120px;
}

.hero h1 {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.hero p {
  margin: 0;
  max-width: 36rem;
  font-size: 1.05rem;
  color: var(--ink-soft);
}

.hero-deco {
  position: absolute;
  right: -20px;
  top: -40px;
  width: 280px;
  height: 200px;
  pointer-events: none;
  opacity: 0.55;
}

.hero-deco .capsule {
  position: absolute;
  border: 2px solid #c4b5fd;
  border-radius: 999px;
  transform: rotate(-28deg);
}

.hero-deco .c1 {
  width: 160px;
  height: 64px;
  top: 20px;
  right: 40px;
}

.hero-deco .c2 {
  width: 120px;
  height: 48px;
  top: 70px;
  right: 100px;
  opacity: 0.7;
}

.hero-deco .c3 {
  width: 90px;
  height: 36px;
  top: 110px;
  right: 30px;
  opacity: 0.5;
}

/* ——— Start split ——— */
.start-split {
  display: grid;
  grid-template-columns: minmax(240px, 320px) 1fr;
  gap: 28px;
  align-items: start;
}

.step-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.step-card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  width: 100%;
  text-align: left;
  padding: 16px 18px;
  border-radius: var(--radius);
  border: 1.5px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  transition:
    border-color 0.2s,
    background 0.2s,
    box-shadow 0.2s,
    transform 0.2s;
}

.step-card:hover {
  border-color: var(--line-strong);
  background: #fff;
}

.step-card.is-active {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px var(--accent-ring), var(--shadow);
}

.step-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  color: var(--ink-faint);
  transition: color 0.2s;
}

.step-card.is-active .step-icon {
  color: var(--accent);
}

.step-card h3 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--ink);
  transition: color 0.2s;
}

.step-card.is-active h3 {
  color: var(--accent);
}

.step-card p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--ink-faint);
  line-height: 1.45;
}

/* ——— Code window ——— */
.code-window {
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--bg-elevated);
  box-shadow: var(--shadow);
  overflow: hidden;
  min-height: 360px;
  animation: panel-in 0.35s ease both;
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.code-window-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: #fafbfd;
}

.traffic {
  display: flex;
  gap: 7px;
}

.traffic i {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  display: block;
}

.traffic .r {
  background: #ff5f57;
}
.traffic .y {
  background: #febc2e;
}
.traffic .g {
  background: #28c840;
}

.code-window-title {
  margin-left: 8px;
  font-size: 0.8rem;
  color: var(--ink-faint);
}

.code-window-body {
  padding: 22px 24px 28px;
}

.code-block {
  position: relative;
  margin: 0 0 16px;
  padding: 14px 44px 14px 16px;
  border-radius: 10px;
  background: #f7f8fc;
  border: 1px solid var(--line);
  overflow-x: auto;
}

.code-block:last-child {
  margin-bottom: 0;
}

.code-block pre {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
}

.code-block .tok-cmd {
  color: #6d28d9;
  font-weight: 500;
}

.code-block .tok-pkg {
  color: var(--ink);
}

.copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--ink-faint);
  transition: background 0.15s, color 0.15s;
}

.copy-btn:hover {
  background: #fff;
  color: var(--accent);
}

.copy-btn.is-copied {
  color: #16a34a;
}

.panel-note {
  margin: 0 0 18px;
  font-size: 0.92rem;
  color: var(--ink-soft);
}

.panel-note strong {
  color: var(--ink);
}

/* ——— Article list ——— */
.section-label {
  margin: 56px 0 18px;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.article-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.article-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 22px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.article-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.article-card .tag {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
}

.article-card h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.article-card p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--ink-soft);
  flex: 1;
}

.article-card .meta {
  font-size: 0.78rem;
  color: var(--ink-faint);
}

/* ——— Article page ——— */
.article-layout {
  display: grid;
  grid-template-columns: 200px minmax(0, 720px);
  gap: 40px;
  align-items: start;
}

.toc {
  position: sticky;
  top: calc(var(--nav-h) + 24px);
  padding: 4px 0;
}

.toc h4 {
  margin: 0 0 12px;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.toc a {
  display: block;
  padding: 6px 0;
  font-size: 0.88rem;
  color: var(--ink-soft);
  border-left: 2px solid transparent;
  padding-left: 12px;
  margin-left: -2px;
  transition: color 0.15s, border-color 0.15s;
}

.toc a:hover,
.toc a.is-active {
  color: var(--accent);
  border-left-color: var(--accent);
}

.prose {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 36px 40px;
  box-shadow: var(--shadow);
}

.prose > :first-child {
  margin-top: 0;
}

.prose h1 {
  font-family: var(--font-display);
  font-size: 2rem;
  letter-spacing: -0.03em;
  margin: 0 0 12px;
}

.prose .lead {
  font-size: 1.05rem;
  color: var(--ink-soft);
  margin: 0 0 28px;
}

.prose h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  margin: 36px 0 12px;
  letter-spacing: -0.02em;
  scroll-margin-top: calc(var(--nav-h) + 20px);
}

.prose h3 {
  font-size: 1.05rem;
  margin: 24px 0 8px;
}

.prose p,
.prose li {
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.prose ul {
  padding-left: 1.2em;
}

.prose code {
  font-size: 0.86em;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--accent-soft);
  color: #5b21b6;
}

.prose pre {
  margin: 16px 0;
  padding: 16px 18px;
  border-radius: 12px;
  background: #1e2230;
  color: #e8eaf0;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.55;
}

.prose pre code {
  padding: 0;
  background: none;
  color: inherit;
}

.prose .callout {
  margin: 20px 0;
  padding: 14px 16px;
  border-radius: 12px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  color: var(--ink-soft);
  font-size: 0.9rem;
}

/* ——— Search modal ——— */
.search-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 20px 20px;
  background: rgba(20, 24, 36, 0.35);
  backdrop-filter: blur(4px);
}

.search-modal.is-open {
  display: flex;
}

.search-dialog {
  width: min(560px, 100%);
  background: #fff;
  border-radius: 16px;
  border: 1px solid var(--line);
  box-shadow: 0 24px 80px rgba(20, 24, 36, 0.2);
  overflow: hidden;
  animation: panel-in 0.2s ease both;
}

.search-dialog input {
  width: 100%;
  border: none;
  outline: none;
  padding: 18px 20px;
  font: inherit;
  font-size: 1rem;
  border-bottom: 1px solid var(--line);
}

.search-results {
  max-height: 320px;
  overflow: auto;
  padding: 8px;
}

.search-results a {
  display: block;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 0.92rem;
}

.search-results a:hover,
.search-results a.is-active {
  background: var(--accent-soft);
  color: var(--accent);
}

.search-results .hint {
  padding: 16px;
  text-align: center;
  color: var(--ink-faint);
  font-size: 0.88rem;
}

/* ——— Footer ——— */
.site-footer {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 28px 40px;
  font-size: 0.82rem;
  color: var(--ink-faint);
}

/* ——— Motion ——— */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ——— Responsive ——— */
@media (max-width: 900px) {
  .home-hero {
    grid-template-columns: 1fr;
    gap: 28px;
    min-height: 0;
  }

  .home-hero-visual {
    order: -1;
  }

  .home-hero-visual img {
    max-width: 360px;
    border-width: 2px;
  }

  .feature-row {
    grid-template-columns: 1fr;
  }

  .start-split {
    grid-template-columns: 1fr;
  }

  .article-grid {
    grid-template-columns: 1fr;
  }

  .article-layout {
    grid-template-columns: 1fr;
  }

  .toc {
    position: static;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
    margin-bottom: 8px;
  }

  .toc h4 {
    width: 100%;
  }

  .toc a {
    border: none;
    padding-left: 0;
  }

  .nav-links {
    display: none;
  }

  .search-trigger span {
    display: none;
  }

  .search-trigger {
    min-width: 0;
    width: 36px;
    justify-content: center;
    padding: 0;
    border-radius: 10px;
  }

  .search-trigger kbd {
    display: none;
  }

  .hero {
    padding-right: 0;
  }

  .hero-deco {
    display: none;
  }

  .prose {
    padding: 24px 20px;
  }
}
