/* EVE section — additive styles layered on top of ../styles.css.
   Scoped to .eve-doc / .eve-landing so nothing here touches the rest of the site. */

:root {
  --eve-warning: #e08a3c;
  --eve-warning-bg: rgba(224, 138, 60, 0.12);
  --eve-note: #4ad9b5;
  --eve-note-bg: rgba(22, 160, 133, 0.1);
  --eve-important-bg: rgba(45, 108, 223, 0.1);
  --eve-code-bg: rgba(127, 127, 127, 0.08);
}

html[data-theme="dark"] {
  --eve-warning: #f0a35f;
  --eve-warning-bg: rgba(240, 163, 95, 0.14);
  --eve-note-bg: rgba(74, 217, 181, 0.12);
  --eve-important-bg: rgba(122, 162, 255, 0.14);
  --eve-code-bg: rgba(255, 255, 255, 0.06);
}

/* ---------- Landing page ---------- */

.eve-pillars {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-top: 32px;
}

.eve-pillar {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-soft);
}

.eve-pillar h3 {
  margin: 0 0 8px;
  font-size: 1.02rem;
}

.eve-pillar p {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.eve-quote {
  border-left: 3px solid var(--accent);
  padding: 4px 0 4px 20px;
  margin: 0;
  font-size: 1.1rem;
  color: var(--text);
}

.eve-quote cite {
  display: block;
  margin-top: 10px;
  font-style: normal;
  font-size: 0.85rem;
  color: var(--muted);
}

.eve-final-definition {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px clamp(20px, 4vw, 36px);
  box-shadow: var(--shadow-soft);
  position: relative;
  overflow: hidden;
}

.eve-final-definition::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--eve-important-bg), transparent 60%);
  pointer-events: none;
}

.eve-final-definition p {
  position: relative;
  margin: 0;
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  line-height: 1.6;
}

.eve-qualities {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.eve-quality-tag {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--muted);
}

.eve-flow {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  margin: 32px auto 0;
  max-width: 420px;
}

.eve-flow-step {
  width: 100%;
  text-align: center;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 14px 18px;
  font-weight: 600;
  font-size: 0.95rem;
}

.eve-flow-step.is-accent {
  border-color: rgba(45, 108, 223, 0.4);
  background: var(--eve-important-bg);
  color: var(--accent);
}

.eve-flow-arrow {
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  padding: 6px 0;
}

.eve-flow-branch {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  width: 100%;
}

.eve-flow-branch .eve-flow-step {
  flex: 1 1 140px;
  font-weight: 500;
  font-size: 0.88rem;
}

.eve-flow-env {
  margin-top: 10px;
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
}

/* ---------- Doc page shell ---------- */

.container-wide {
  width: min(1440px, 100%);
}

.eve-doc-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

@media (min-width: 980px) {
  .eve-doc-layout {
    grid-template-columns: 230px minmax(0, 1fr);
    gap: 36px;
  }
}

.eve-toc {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elev);
  box-shadow: var(--shadow-soft);
  padding: 14px 18px;
}

@media (min-width: 980px) {
  .eve-toc {
    position: sticky;
    top: 96px;
    max-height: calc(100vh - 130px);
    overflow-y: auto;
    padding: 18px 18px;
  }
}

.eve-toc-details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
  padding: 2px 0;
}

.eve-toc-details summary::-webkit-details-marker {
  display: none;
}

.eve-toc-details summary::after {
  content: "";
  flex: none;
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.2s ease;
}

.eve-toc-details[open] summary::after {
  transform: rotate(-135deg);
}

.eve-toc-details #eve-toc-list {
  margin-top: 14px;
}

@media (min-width: 980px) {
  .eve-toc-details summary {
    cursor: default;
    pointer-events: none;
  }

  .eve-toc-details summary::after {
    display: none;
  }
}

.eve-toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2px;
  counter-reset: eve-toc;
}

.eve-toc a {
  display: block;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.4;
}

.eve-toc a:hover,
.eve-toc a:focus-visible {
  background: var(--eve-important-bg);
  color: var(--text);
}

.eve-toc a.is-active {
  background: var(--eve-important-bg);
  color: var(--accent);
  font-weight: 600;
}

.eve-doc-status {
  color: var(--muted);
  font-size: 0.95rem;
}

/* ---------- Rendered markdown content ---------- */

.eve-doc {
  min-width: 0;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: clamp(24px, 4vw, 52px);
}

.eve-doc > *:first-child {
  margin-top: 0;
}

.eve-doc h1 {
  font-size: clamp(1.8rem, 3.6vw, 2.6rem);
  margin: 0 0 6px;
}

.eve-doc h3 {
  font-size: clamp(1.15rem, 2.4vw, 1.5rem);
  margin: 40px 0 8px;
}

.eve-doc h2 {
  font-size: clamp(1.35rem, 2.8vw, 1.85rem);
  margin: 48px 0 14px;
  padding-top: 8px;
  scroll-margin-top: 96px;
  border-top: 1px solid var(--border);
}

.eve-doc h2:first-of-type {
  border-top: none;
  padding-top: 0;
}

.eve-doc h3,
.eve-doc h4 {
  scroll-margin-top: 96px;
}

.eve-doc h4 {
  font-size: 1.02rem;
  margin: 28px 0 6px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}

.eve-doc p,
.eve-doc li {
  color: var(--text);
  line-height: 1.7;
}

.eve-doc p {
  margin: 0 0 16px;
}

.eve-doc > p:has(em):only-child,
.eve-doc em:first-child:last-child {
  color: var(--muted);
}

.eve-doc ul,
.eve-doc ol {
  margin: 0 0 16px;
  padding-left: 22px;
  display: grid;
  gap: 6px;
}

.eve-doc blockquote {
  margin: 0 0 20px;
  padding: 2px 20px;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}

.eve-doc blockquote > *:last-child {
  margin-bottom: 0;
}

.eve-doc hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 40px 0;
}

.eve-doc a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-underline-offset: 3px;
}

.eve-doc a:hover {
  text-decoration-color: currentColor;
}

.eve-doc strong {
  font-weight: 700;
}

.eve-doc code {
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.86em;
  background: var(--eve-code-bg);
  padding: 0.15em 0.4em;
  border-radius: 6px;
}

.eve-doc pre {
  background: var(--eve-code-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  overflow-x: auto;
  margin: 0 0 20px;
}

.eve-doc pre code {
  background: none;
  padding: 0;
  font-size: 0.86rem;
  line-height: 1.6;
  white-space: pre;
}

/* ---------- Tables ---------- */

.eve-doc .eve-table-wrap {
  overflow-x: auto;
  margin: 0 0 20px;
  border: 1px solid var(--border);
  border-radius: 14px;
}

.eve-doc table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.92rem;
}

.eve-doc th,
.eve-doc td {
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.eve-doc thead th {
  background: var(--eve-code-bg);
  font-weight: 700;
  white-space: nowrap;
}

.eve-doc tbody tr:last-child td {
  border-bottom: none;
}

/* ---------- Callouts ---------- */

.eve-callout {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
  border-radius: 14px;
  padding: 16px 18px;
  margin: 0 0 20px;
  border: 1px solid var(--border);
}

.eve-callout-icon {
  font-size: 1rem;
  line-height: 1.6;
}

.eve-callout-body > *:last-child {
  margin-bottom: 0;
}

.eve-callout-title {
  display: block;
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

.eve-callout.important {
  background: var(--eve-important-bg);
  border-color: rgba(45, 108, 223, 0.35);
}

.eve-callout.important .eve-callout-title {
  color: var(--accent);
}

.eve-callout.warning {
  background: var(--eve-warning-bg);
  border-color: rgba(224, 138, 60, 0.4);
}

.eve-callout.warning .eve-callout-title {
  color: var(--eve-warning);
}

.eve-callout.note {
  background: var(--eve-note-bg);
  border-color: rgba(22, 160, 133, 0.35);
}

.eve-callout.note .eve-callout-title {
  color: var(--accent-2);
}

/* ---------- Mermaid diagrams ---------- */

.eve-doc .mermaid {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  margin: 0 0 20px;
  display: flex;
  justify-content: center;
  overflow-x: auto;
}

.eve-doc .mermaid svg {
  max-width: 100%;
}

.eve-doc-error {
  border: 1px dashed var(--eve-warning);
  border-radius: 14px;
  padding: 20px;
  color: var(--muted);
}

@media (max-width: 620px) {
  .eve-doc {
    padding: 20px;
    border-radius: 14px;
  }
}
