/* =========================================================
   extras.css — proposed core additions for mode.css
   ---------------------------------------------------------
   These are the gaps hit while building a real docs site on
   top of mode.css. Everything here is THEME-NEUTRAL and
   token-driven: it works with the default light theme and
   re-skins automatically when a theme overrides the tokens.
   Nothing here hard-codes a color.

   Load order:  mode.css  →  extras.css  →  your-theme.css

   Candidate for folding into dist/mode.css. Grouped to slot
   in after FASE 5 (modular layout) of the base file.
   ========================================================= */

/* ---------------------------------------------------------
   FASE 7: TOKENS THE BASE IS MISSING
   --------------------------------------------------------- */
:root {
  /* Monospace stack — the base only defines --font-main */
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  /* Raised neutral surfaces (cards, code headers, pills) */
  --color-surface:   #f6f7f9;
  --color-surface-2: #eef0f3;

  /* Code blocks read as a terminal in any theme */
  --color-code-bg:   #0d1117;
  --color-code-text: #e6edf3;

  /* Semantic status colors (for [µ-badge]) */
  --color-ok:   #1a7f37;
  --color-info: #0b57d0;
  --color-warn: #9a6700;
  --color-exp:  #6f42c1;
}

/* ---------------------------------------------------------
   FASE 8: NATIVE ELEMENTS THE BASE DOESN'T COVER YET
   --------------------------------------------------------- */

/* Code — block + inline */
code, kbd, samp { font-family: var(--font-mono); font-size: 0.9em; }

pre {
  font-family: var(--font-mono);
  font-size: 0.86rem;
  line-height: 1.7;
  background-color: var(--color-code-bg);
  color: var(--color-code-text);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  overflow-x: auto;
  margin-bottom: var(--spacing);
}
pre code { background: none; border: 0; padding: 0; color: inherit; font-size: inherit; }

:not(pre) > code {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 5px;
  padding: 0.1rem 0.4rem;
  color: var(--color-accent);
}

kbd {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 0.05rem 0.4rem;
}

/* Blockquote */
blockquote {
  margin-bottom: var(--spacing);
  padding: 1rem 1.3rem;
  border-left: 3px solid var(--color-accent);
  background-color: color-mix(in srgb, var(--color-accent) 8%, transparent);
  border-radius: 0 var(--radius) var(--radius) 0;
}
blockquote > :last-child { margin-bottom: 0; }

/* Horizontal rule — soft fade using the system border color */
hr {
  border: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--color-border), transparent);
  margin-block: calc(var(--spacing) * 1.5);
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  margin-bottom: var(--spacing);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
}
caption { text-align: left; color: var(--color-muted); font-size: var(--size-small); margin-bottom: 0.5rem; }
th, td { text-align: left; padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--color-border); }
th { color: var(--color-accent); font-weight: 600; background-color: var(--color-surface); }
td { color: var(--color-text); }
tr:last-child td { border-bottom: 0; }

/* Figure */
figure { margin-bottom: var(--spacing); }
figcaption { font-size: var(--size-small); color: var(--color-muted); margin-top: 0.5rem; }

/* Details / summary — a classless disclosure widget */
details {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: var(--spacing);
  background-color: var(--color-bg);
}
summary { cursor: pointer; font-weight: 600; color: var(--color-accent); }
details[open] summary { margin-bottom: 0.75rem; }

/* mark */
mark { background-color: color-mix(in srgb, var(--color-accent) 22%, transparent); color: inherit; border-radius: 3px; padding: 0 0.2rem; }

/* ---------------------------------------------------------
   FASE 9: ACCESSIBILITY DEFAULTS
   --------------------------------------------------------- */
:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; border-radius: 4px; }
::selection { background-color: var(--color-accent); color: var(--color-accent-text); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}

/* ---------------------------------------------------------
   FASE 10: SMALL [µ-*] COMPONENTS (layout, not theme)
   --------------------------------------------------------- */

/* Card overlay link — makes a whole [µ-grid] > article clickable */
[µ-grid] > article { position: relative; }
[µ-cover] { color: inherit; }
[µ-cover]::before { content: ""; position: absolute; inset: 0; z-index: 1; }

/* Eyebrow — small mono kicker above a heading */
[µ-eyebrow] {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin-bottom: 0.6rem;
}

/* Lead — oversized intro paragraph */
[µ-lead] { font-size: 1.12rem; color: var(--color-muted); max-width: 62ch; }

/* Subtitle */
[µ-subtitle] { font-size: clamp(1.15rem, 2.5vw, 1.5rem); font-weight: 500; margin-bottom: 1rem; }

/* Numbered marker (principle lists, steps) */
[µ-num] {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--color-accent);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 0.1rem 0.45rem;
  margin-bottom: 0.6rem;
}

/* Tag row */
[µ-tags] { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; margin-bottom: var(--spacing); }

/* Status badge / pill */
[µ-badge] {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  color: var(--color-muted);
}
[µ-badge]::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
[µ-badge="stable"] { color: var(--color-ok);   border-color: color-mix(in srgb, var(--color-ok) 35%, transparent); }
[µ-badge="beta"]   { color: var(--color-warn); border-color: color-mix(in srgb, var(--color-warn) 35%, transparent); }
[µ-badge="dev"]    { color: var(--color-info); border-color: color-mix(in srgb, var(--color-info) 35%, transparent); }
[µ-badge="exp"]    { color: var(--color-exp);  border-color: color-mix(in srgb, var(--color-exp) 35%, transparent); }

/* Icon chip */
[µ-icon] {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  margin-bottom: 0.8rem;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.15rem;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-accent);
}

/* Button row — layout for groups of buttons / button-like links */
[µ-buttons] { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-bottom: var(--spacing); }
[µ-buttons~="centered"] { justify-content: center; }
[µ-buttons] > a {
  /* make anchors match native <button> from the base */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background-color: var(--color-surface);
  color: var(--color-text);
  width: fit-content;
}
[µ-buttons] > button { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; }
[µ-buttons] svg { width: 18px; height: 18px; fill: currentColor; flex-shrink: 0; }

/* Feature item grid — small icon + text blocks */
[µ-items] { display: grid; gap: 1rem; margin-bottom: var(--spacing); grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
[µ-items] > * {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  padding: 0.9rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background-color: var(--color-bg);
}
[µ-items] svg, [µ-items] img { width: 20px; height: 20px; flex-shrink: 0; margin-top: 0.15rem; }
[µ-items] svg { fill: var(--color-accent); }

/* Code header bar — filename + traffic-light dots above a <pre> */
[µ-codehead] {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--color-muted);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 0.5rem 0.8rem;
  margin-bottom: 0;
}
[µ-codehead] + pre { border-radius: 0 0 var(--radius) var(--radius); margin-top: 0; }
[µ-codehead] b { width: 10px; height: 10px; border-radius: 50%; background: var(--color-border); font-size: 0; }
[µ-codehead] b:nth-of-type(1) { background: #ff5f56; }
[µ-codehead] b:nth-of-type(2) { background: #ffbd2e; }
[µ-codehead] b:nth-of-type(3) { background: #27c93f; }

/* Readable prose column */
[µ-prose] { max-width: 70ch; }
[µ-prose] ul, [µ-prose] ol { padding-left: 1.2rem; }
[µ-prose] li { margin-bottom: 0.4rem; }
