/* base.css — typography, layout, cards, prose for nicolatech.blog (Lima ácida).
   Treatment rules (companion v5 §1): titles/links/highlights = --accent (lima);
   body copy = --text (#d8e3dc, "cuerpo neutro"), NEVER lima; monochrome (no second hue).
   Reduced-motion is handled globally by tokens.css. */

/* ---- reset ---- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);                 /* cuerpo neutro — body is #d8e3dc, never lima */
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, video, canvas, iframe { max-width: 100%; }
img { height: auto; }

/* ---- links: lima, monochrome affordance ---- */
a { color: var(--accent); text-decoration: none; }
a:hover, a:focus-visible { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

/* ---- headings: display font, lima ---- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  color: var(--accent);               /* titles = lima */
  line-height: 1.2;
  font-weight: 600;
  margin: 2rem 0 0.75rem;
}
h1 { font-size: clamp(2rem, 5vw, 2.85rem); letter-spacing: -0.02em; }
h2 { font-size: clamp(1.5rem, 3.5vw, 2rem); letter-spacing: -0.01em; }
h3 { font-size: 1.35rem; }
h4 { font-size: 1.15rem; }

/* ---- layout ---- */
.site-header, .site-footer {
  max-width: var(--maxw);
  margin-inline: auto;
  padding: 1.5rem 1.25rem;
}
.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.site-header .brand {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.25rem;
  color: var(--accent);
}
.site-header nav a {
  margin-left: 1.25rem;
  font-size: 0.95rem;
  color: var(--text-dim);
}
.site-header nav a:hover { color: var(--accent); }
.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 4rem;
  color: var(--text-dim);
  font-size: 0.9rem;
}

main { max-width: var(--maxw); margin-inline: auto; padding: 2rem 1.25rem; }

/* ---- prose (article body) ---- */
.prose { font-size: 1.0625rem; }
.prose p { margin: 1.1rem 0; color: var(--text); }   /* body neutral */
.prose ul, .prose ol { margin: 1.1rem 0; padding-left: 1.4rem; }
.prose li { margin: 0.35rem 0; }
.prose blockquote {
  margin: 1.5rem 0;
  padding: 0.5rem 1.1rem;
  border-left: 3px solid var(--accent);
  background: var(--surface);
  color: var(--text-dim);
}
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.5rem 0; }
.prose img { border-radius: 8px; border: 1px solid var(--line); }
.prose a { text-decoration: underline; text-underline-offset: 2px; }

/* inline code */
.prose :not(pre) > code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--surface-2);
  color: var(--ink-green);
  padding: 0.12em 0.4em;
  border-radius: 4px;
  border: 1px solid var(--line);
}

/* ---- code blocks (Shiki) + copy button ---- */
.code-block { position: relative; margin: 1.5rem 0; }
.code-block .copy-btn { top: 0.5rem; right: 0.5rem; }
.code-block pre.shiki,
pre.shiki {
  margin: 0;
  padding: 1rem 1.1rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1.6;
}
pre.shiki code { font-family: inherit; }

/* copy button — shared by code blocks and prompt blocks */
.copy-btn {
  position: absolute;
  z-index: 2;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  color: var(--accent);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.25rem 0.55rem;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.copy-btn:hover { background: var(--accent); color: var(--accent-ink); }
.copy-btn[data-copied="true"] { color: var(--accent); border-color: var(--accent); }

/* ---- prompt destacado block (::: prompt) ---- */
.prompt-block {
  position: relative;
  margin: 1.75rem 0;
  padding: 1.1rem 1.1rem 0.4rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
}
.prompt-block::before {
  content: attr(data-prompt-label);
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  color: var(--ink-green);
  margin-bottom: 0.4rem;
}
.prompt-block .copy-btn { top: 0.75rem; right: 0.75rem; }
.prompt-block .prompt-body { color: var(--text); }
.prompt-block .prompt-body p:first-child { margin-top: 0; }
.prompt-block .prompt-body pre.shiki { margin: 0.5rem 0; }

/* ---- post header ---- */
.post-header { margin-bottom: 2rem; }
.post-header .post-meta {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-top: 0.5rem;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}
.post-header .post-cover {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line);
  margin-top: 1.25rem;
}
.chip {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-green);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
}

/* ---- immersive interactive posts (WF v9): edge-to-edge, no centered column, no card chrome.
   The site header/footer remain; only the article column goes full-bleed. Engine block styles
   (.prompt-block, .selector-tabs, [data-block], …) live in embed.css, linked on these pages. ---- */
body.immersive main { max-width: none; margin: 0; padding: 0; }
.immersive .immersive,            /* the content wrapper post.ts emits */
body.immersive .immersive { width: 100%; }

/* ---- home / category cards ---- */
.post-grid { display: grid; gap: 1.25rem; margin: 2rem 0; }
.post-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.25rem;
  transition: border-color .15s, transform .15s;
}
.post-card:hover { border-color: var(--accent); text-decoration: none; }
.post-card h2 { margin: 0 0 0.4rem; font-size: 1.4rem; }
.post-card .card-excerpt { color: var(--text); margin: 0.4rem 0 0.75rem; }
.post-card .card-meta {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-dim);
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* ---- live-preview card (WF v9 §2.4): interactive posts show a scaled, non-interactive same-origin
   iframe of the post behind a legible overlay; the wrapping <a> owns navigation. ---- */
.post-card-live { position: relative; display: block; overflow: hidden; }
.card-preview-frame { position: absolute; inset: 0; pointer-events: none; }   /* iframe non-interactive */
.card-preview { width: 200%; height: 200%; transform: scale(.5); transform-origin: top left;
                border: 0; pointer-events: none; }                            /* scaled live thumbnail */
.post-card-live .card-overlay { position: relative; z-index: 1;
   background: linear-gradient(to top, var(--bg) 30%, transparent); }         /* legibility over preview */

.page-intro { color: var(--text-dim); margin-bottom: 1.5rem; }
.empty-state { color: var(--text-dim); padding: 3rem 0; text-align: center; }

/* ---- reveal-on-scroll (islands/reveal.js). Scoped under `.js` (shell sets it inline before
   paint) so content is NEVER hidden when JS is unavailable — progressive enhancement. ---- */
.js [data-reveal] { opacity: 0; transform: translateY(12px); }
.js .revealed { opacity: 1; transform: none; transition: opacity .5s ease, transform .5s ease; }

/* ---- animated canvas background (islands/backgrounds.js). Fixed behind content; the body's
   solid --bg shows through the transparent areas the canvas clears -> lima-on-near-black. ---- */
.bg-canvas { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.site-header, main, .site-footer { position: relative; z-index: 1; }

/* ---- static audio player (islands/audio.js) ---- */
.audio-player {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.5rem 0;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.audio-player button {
  font-family: var(--font-mono);
  color: var(--accent);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.35rem 0.6rem;
  cursor: pointer;
}
.audio-player button:hover { background: var(--accent); color: var(--accent-ink); }
.audio-player .audio-seek { flex: 1; accent-color: var(--accent); }
.audio-player .audio-time { font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-dim); min-width: 5.5em; }

/* ---- responsive ---- */
@media (max-width: 480px) {
  body { font-size: 1rem; }
  main { padding: 1.25rem 1rem; }
  .site-header { padding: 1.1rem 1rem; }
  h1 { font-size: 1.9rem; }
}
