/* =====================================================
   EVOGLYPH - Self-hosted fonts (#97)
   Mirrors the @font-face block in /styles.css so docs
   pages render Inter / JetBrains Mono / Quicksand from
   /fonts/* even if the docs CSS loads first or styles.css
   has not yet been parsed. Paths are absolute from the
   site root so they resolve from any /docs/* URL.
   ===================================================== */
@font-face {
  font-family: 'Inter';
  src: url('/fonts/InterVariable.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'JetBrains Mono';
  src: url('/fonts/JetBrainsMono.woff2') format('woff2-variations');
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Quicksand';
  src: url('/fonts/Quicksand-700.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* =====================================================
   EVOGLYPH DOCS - Shared docs-only styles

   Imported AFTER /styles.css so it inherits all design
   tokens (--bg-primary, --text-primary, etc.) and fonts.
   Only contains rules that are specific to the docs
   surface (article typography, TOC, breadcrumb, etc.).
   ===================================================== */

/* -----------------------------------------------------
   DOCS LAYOUT
   ----------------------------------------------------- */

.docs-page {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
}

.docs-container {
  max-width: 48rem; /* ~768px — comfortable reading width */
  margin: 0 auto;
  padding: 8rem 1.5rem 4rem;
}

/* -----------------------------------------------------
   BREADCRUMB
   ----------------------------------------------------- */

.docs-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-tertiary);
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.docs-breadcrumb a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.docs-breadcrumb a:hover {
  color: var(--text-primary);
}

.docs-breadcrumb .sep {
  color: var(--text-tertiary);
  opacity: 0.5;
}

.docs-breadcrumb .current {
  color: var(--text-primary);
}

/* -----------------------------------------------------
   ARTICLE TYPOGRAPHY
   ----------------------------------------------------- */

.docs-title {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.1;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.docs-meta {
  font-size: 0.875rem;
  color: var(--text-tertiary);
  margin-bottom: 2.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.docs-meta .dot {
  opacity: 0.5;
}

.docs-lead {
  font-size: 1.125rem;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.docs-body {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--text-primary);
}

.docs-body h2 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-top: 3rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
  scroll-margin-top: 6rem;
}

.docs-body h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
  scroll-margin-top: 6rem;
}

.docs-body p {
  margin-bottom: 1.25rem;
  color: var(--text-secondary);
}

.docs-body a {
  color: var(--text-primary);
  text-decoration: underline;
  text-decoration-color: var(--border-primary);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.2s ease;
}

.docs-body a:hover {
  text-decoration-color: var(--text-primary);
}

.docs-body ul,
.docs-body ol {
  padding-left: 1.5rem;
  margin-bottom: 1.25rem;
  color: var(--text-secondary);
}

.docs-body ul li,
.docs-body ol li {
  margin-bottom: 0.5rem;
}

.docs-body code {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.875em;
  padding: 0.15em 0.4em;
  border-radius: 4px;
  background: var(--accent-muted);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.docs-body pre {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
  line-height: 1.6;
}

.docs-body pre code {
  background: transparent;
  border: none;
  padding: 0;
  font-size: inherit;
}

.docs-body blockquote {
  border-left: 3px solid var(--border-primary);
  padding-left: 1.25rem;
  margin: 1.5rem 0;
  color: var(--text-secondary);
  font-style: italic;
}

.docs-body img {
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  margin: 1.5rem 0;
}

/* -----------------------------------------------------
   TABLE OF CONTENTS (optional slot)
   ----------------------------------------------------- */

.docs-toc {
  border: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin-bottom: 2rem;
}

.docs-toc-title {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 0.75rem;
}

.docs-toc ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.docs-toc li {
  margin-bottom: 0.5rem;
}

.docs-toc a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s ease;
}

.docs-toc a:hover {
  color: var(--text-primary);
}

/* -----------------------------------------------------
   WAS THIS HELPFUL
   ----------------------------------------------------- */

.docs-feedback {
  margin-top: 4rem;
  padding: 1.5rem;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.docs-feedback-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.docs-feedback-actions {
  display: flex;
  gap: 0.5rem;
}

.docs-feedback-btn {
  padding: 0.45rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border-primary);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  min-height: 40px;
  min-width: 56px;
  /* Enumerated transition properties: never `all`. Interruptible. */
  transition-property: color, border-color, background-color, transform;
  transition-duration: 0.2s;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}

.docs-feedback-btn:hover {
  color: var(--text-primary);
  border-color: var(--text-tertiary);
  background: var(--bg-card-hover);
}

.docs-feedback-btn:active {
  transform: scale(0.96);
}

/* -----------------------------------------------------
   PREV / NEXT NAV
   ----------------------------------------------------- */

.docs-prevnext {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-subtle);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.docs-prevnext a {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1rem 1.25rem;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-primary);
  text-decoration: none;
  min-height: 40px;
  box-shadow: var(--shadow-sm);
  /* Enumerated transition properties: never `all`. Interruptible. */
  transition-property: color, border-color, background-color, box-shadow, transform;
  transition-duration: 0.2s;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}

.docs-prevnext a:hover {
  border-color: var(--text-tertiary);
  background: var(--bg-card-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.docs-prevnext a:active {
  transform: scale(0.98);
}

.docs-prevnext .label {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.docs-prevnext .title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.docs-prevnext .next {
  text-align: right;
}

@media (max-width: 600px) {
  .docs-prevnext {
    grid-template-columns: 1fr;
  }
  .docs-prevnext .next {
    text-align: left;
  }
}

/* -----------------------------------------------------
   RELATED ARTICLES
   ----------------------------------------------------- */

.docs-related {
  margin-top: 3rem;
  padding: 1.5rem;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: var(--bg-secondary);
}

.docs-related-title {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 0.75rem;
}

.docs-related ul {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.docs-related li {
  margin-bottom: 0.85rem;
}

.docs-related li:last-child {
  margin-bottom: 0;
}

.docs-related a {
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: color 0.2s ease;
}

.docs-related a:hover {
  color: var(--text-secondary);
}

.docs-related .summary {
  display: block;
  font-size: 0.85rem;
  color: var(--text-tertiary);
  margin-top: 0.15rem;
}

/* -----------------------------------------------------
   INDEX PAGE — article cards
   ----------------------------------------------------- */

.docs-intro {
  margin-bottom: 3rem;
}

.docs-intro h1 {
  font-size: clamp(2.25rem, 4vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.1;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.docs-intro p {
  font-size: 1.125rem;
  line-height: 1.6;
  color: var(--text-secondary);
  max-width: 42rem;
}

.docs-section {
  margin-bottom: 3rem;
}

.docs-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 1rem;
}

.docs-article-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

.docs-article-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: var(--bg-card);
  color: var(--text-primary);
  text-decoration: none;
  min-height: 40px;
  box-shadow: var(--shadow-sm);
  /* Enumerated transition properties: never `all`. Interruptible. */
  transition-property: color, border-color, background-color, box-shadow, transform;
  transition-duration: 0.2s;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}

.docs-article-card:hover {
  border-color: var(--text-tertiary);
  background: var(--bg-card-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.docs-article-card:hover .card-arrow {
  transform: translate(2px, 0.5px);
  color: var(--text-secondary);
}

.docs-article-card:active {
  transform: scale(0.98);
}

.docs-article-card .card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
}

.docs-article-card .card-desc {
  font-size: 0.875rem;
  color: var(--text-tertiary);
}

.docs-article-card .card-arrow {
  color: var(--text-tertiary);
  flex-shrink: 0;
  /* Optical alignment: nudge down a hair so arrow centers with text baseline. */
  transform: translateY(0.5px);
  transition-property: transform, color;
  transition-duration: 0.2s;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}

/* -----------------------------------------------------
   ARTICLE BODY — TABLES
   ----------------------------------------------------- */

.docs-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.9rem;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  overflow: hidden;
}

.docs-body thead {
  background: var(--bg-secondary);
}

.docs-body th {
  text-align: left;
  font-weight: 600;
  color: var(--text-primary);
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.85rem;
}

.docs-body td {
  padding: 0.65rem 0.85rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: top;
}

.docs-body tbody tr:last-child td {
  border-bottom: none;
}

.docs-body td code,
.docs-body th code {
  font-size: 0.8rem;
  white-space: nowrap;
}

/* -----------------------------------------------------
   CALLOUTS (note / warn / tip)
   ----------------------------------------------------- */

.docs-callout {
  border: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  border-left-width: 3px;
  border-left-color: var(--text-tertiary);
}

.docs-callout-title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 0.4rem;
}

.docs-callout p:last-child {
  margin-bottom: 0;
}

.docs-callout.warn {
  border-left-color: var(--text-secondary);
}

/* -----------------------------------------------------
   BENCHMARK PAGE - source footnote links
   ----------------------------------------------------- */

.docs-body sup a {
  text-decoration: none;
  font-weight: 600;
  padding: 0 0.15em;
  color: var(--accent-text);
  background: var(--accent-muted);
  border-radius: 3px;
  font-size: 0.7em;
  margin-left: 0.1em;
  transition: background-color 0.15s ease;
}

.docs-body sup a:hover {
  background: var(--accent-light);
  text-decoration: none;
}

.benchmark-sources {
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

.benchmark-sources li {
  margin-bottom: 0.85rem;
  scroll-margin-top: 6rem;
  padding-left: 0.25rem;
}

.benchmark-sources li:target {
  background: var(--accent-muted);
  border-radius: 4px;
  padding: 0.5rem;
  margin-left: -0.5rem;
  margin-right: -0.5rem;
}

/* -----------------------------------------------------
   VISUAL POLISH (#148)

   Additive rules — purely cosmetic improvements:
   text wrapping, tabular numerals, image outlines,
   subtle shadows, enumerated transitions, hit areas,
   and stagger-in animations for lists. None of these
   change layout flow or interactive contracts.
   ----------------------------------------------------- */

/* Confirm font smoothing on the docs surface (mirrors body). */
.docs-page {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Text wrapping: balance for headings, pretty for prose.
   Both are progressive — browsers without support get
   the default. Universally additive. */
.docs-title,
.docs-intro h1,
.docs-body h1,
.docs-body h2,
.docs-body h3 {
  text-wrap: balance;
}

.docs-body p,
.docs-body li,
.docs-body blockquote,
.docs-lead,
.docs-intro p {
  text-wrap: pretty;
}

/* Tabular numerals for any numeric content in tables, code,
   <kbd>, version refs, and benchmark sources. Keeps aligned
   columns of numbers and shortcuts from drifting. */
.docs-body td,
.docs-body th,
.docs-body code,
.docs-body kbd,
.docs-body pre,
.benchmark-sources {
  font-variant-numeric: tabular-nums;
}

/* <kbd> styling: not previously declared. Use the same
   surface as inline code with a slightly stronger weight. */
.docs-body kbd {
  font-family: 'JetBrains Mono', 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.85em;
  font-weight: 500;
  padding: 0.1em 0.4em;
  border-radius: 4px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  box-shadow: 0 1px 0 var(--border-subtle);
}

/* Image outlines: 1px hairline in pure black/white at low
   alpha. Sits on top of the existing border so dark
   screenshots get a faint edge in light mode and vice-versa
   in dark mode. Pure black/white only, per the rubric. */
.docs-body img {
  outline: 1px solid rgba(0, 0, 0, 0.1);
  outline-offset: -1px;
}

@media (prefers-color-scheme: dark) {
  .docs-body img {
    outline-color: rgba(255, 255, 255, 0.1);
  }
}

html.dark .docs-body img {
  outline-color: rgba(255, 255, 255, 0.1);
}

html.light .docs-body img {
  outline-color: rgba(0, 0, 0, 0.1);
}

/* Subtle shadow on callouts so they lift off the page
   slightly instead of relying purely on the hairline
   border. Additive: the border stays. */
.docs-callout {
  box-shadow: var(--shadow-sm);
}

/* Code blocks pick up a subtle shadow too (concentric with
   their parent: callouts use 10px radius, <pre> uses 8px,
   inline <code> uses 4px). */
.docs-body pre {
  box-shadow: var(--shadow-sm);
}

/* Concentric radius: <pre>/<code> already smaller than parent
   callout, but make it explicit if nested. */
.docs-callout pre {
  border-radius: 6px;
}

.docs-callout code {
  border-radius: 3px;
}

/* TOC: optical alignment, hit area, scale on press. */
.docs-toc a {
  display: inline-block;
  min-height: 40px;
  padding: 0.5rem 0;
  line-height: 1.5;
  position: relative;
  /* Enumerated transition: never `all`. Interruptible. */
  transition-property: color, transform;
  transition-duration: 0.2s;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}

.docs-toc a:active {
  transform: scale(0.98);
}

/* Stagger TOC entries on first paint. The container has
   `@starting-style` semantics: each <li> picks up a delay
   based on its position. Skipped under prefers-reduced-motion
   (see block at end of file). */
.docs-toc li {
  opacity: 1;
  animation: docs-fade-in 0.4s cubic-bezier(0.2, 0, 0, 1) backwards;
}

.docs-toc li:nth-child(1) {
  animation-delay: 0ms;
}
.docs-toc li:nth-child(2) {
  animation-delay: 60ms;
}
.docs-toc li:nth-child(3) {
  animation-delay: 120ms;
}
.docs-toc li:nth-child(4) {
  animation-delay: 180ms;
}
.docs-toc li:nth-child(5) {
  animation-delay: 240ms;
}
.docs-toc li:nth-child(6) {
  animation-delay: 300ms;
}
.docs-toc li:nth-child(7) {
  animation-delay: 360ms;
}
.docs-toc li:nth-child(8) {
  animation-delay: 420ms;
}

/* Stagger article cards on the docs index. Same pattern. */
.docs-article-card {
  animation: docs-rise-in 0.4s cubic-bezier(0.2, 0, 0, 1) backwards;
}

.docs-article-list .docs-article-card:nth-child(1) {
  animation-delay: 0ms;
}
.docs-article-list .docs-article-card:nth-child(2) {
  animation-delay: 80ms;
}
.docs-article-list .docs-article-card:nth-child(3) {
  animation-delay: 160ms;
}
.docs-article-list .docs-article-card:nth-child(4) {
  animation-delay: 240ms;
}

@keyframes docs-fade-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes docs-rise-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Breadcrumb: ensure links are reachable with a 40x40 hit
   area without changing visual size. Uses ::after as a
   transparent extender. */
.docs-breadcrumb a {
  position: relative;
}

.docs-breadcrumb a::after {
  content: '';
  position: absolute;
  inset: -10px -4px;
  /* Transparent — only extends the hit target. */
}

/* Anchor links inside headings, if added later, also get a
   comfortable hit area. */
.docs-body h2 > a,
.docs-body h3 > a,
.docs-body h2 a.anchor,
.docs-body h3 a.anchor {
  position: relative;
  display: inline-block;
  min-width: 40px;
  min-height: 40px;
  line-height: 1.5;
}

/* Hint to the compositor that transforms/opacity are the only
   things changing on these interactive elements. Used sparingly
   per the rubric (only transform / opacity / filter). */
.docs-article-card,
.docs-prevnext a,
.docs-feedback-btn,
.docs-toc a {
  will-change: transform;
}

/* Honor user's motion preferences. No enter animations on
   load when reduced motion is requested. */
@media (prefers-reduced-motion: reduce) {
  .docs-toc li,
  .docs-article-card {
    animation: none !important;
  }
  .docs-article-card:hover,
  .docs-prevnext a:hover,
  .docs-feedback-btn:hover,
  .docs-article-card:hover .card-arrow {
    transform: none !important;
  }
  .docs-article-card:active,
  .docs-prevnext a:active,
  .docs-feedback-btn:active,
  .docs-toc a:active {
    transform: none !important;
  }
}
