/* ============================================================
   styles.css — Layout y estilos compartidos para páginas internas
   Paleta y tipografías: Roboto / Roboto Condensed / Roboto Mono.
   ============================================================ */

:root {
  --accent: #82ca57;
  --ink: #758085;
  --header-blue: #033961;
  --code-bg: #0c0715;
  --code-tag: var(--accent);
  --code-attr: #7fd1ff;
  --code-str: #ffd479;
  --code-kw: #ff8fa3;
  --code-fn: #c6a8ff;
  --code-punc: #8b9bb4;
  --code-num: #4a5568;
  --code-comment: #6b8f71;
  --gap: clamp(12px, 2vw, 28px);
}

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

body {
  font-family: 'Roboto', sans-serif;
  background-color: #ffffff;
  color: #1a1a1a;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- Header: título grande + subtítulo ---------- */
.page-header {
  background: var(--header-blue);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5em 1.5rem;
  padding: clamp(1.5rem, 4vw, 2.5rem) clamp(1.5rem, 5vw, 3rem);
}

.page-title {
  font-family: 'Roboto Condensed', sans-serif;
  font-weight: 900;
  font-size: clamp(2.6rem, 7vw, 4.5rem);
  line-height: 0.9;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  color: var(--accent);
}

.page-subtitle {
  font-family: 'Roboto', sans-serif;
  font-weight: 400;
  font-size: clamp(1.1rem, 2.2vw, 1.6rem);
  color: #ffffff;
}

/* ---------- Content ---------- */
.page-content {
  flex: 1;
  width: 100%;
  padding: clamp(1.5rem, 4vw, 3rem);
}

.content-wrap {
  max-width: 900px;
  margin: 0 auto;
}

/* ---------- Bloques de código ---------- */
.code {
  background: var(--code-bg);
  color: #ffffff;
  padding: 1.2rem;
  border-radius: 8px;
  font-family: 'Roboto Mono', monospace;
  font-size: clamp(0.78rem, 1vw, 0.95rem);
  overflow-x: auto;
  margin: 1.2rem 0 2rem;
}

.code pre {
  white-space: pre;
  word-break: normal;
}

.code::-webkit-scrollbar { height: 10px; }
.code::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.08); border-radius: 4px; }
.code::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.25); border-radius: 4px; }
.code::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.4); }

.tok-num     { color: var(--code-num); user-select: none; margin-right: 1.2ch; display: inline-block; width: 1.5ch; text-align: right; }
.tok-comment { color: var(--code-comment); }
.tok-tag     { color: var(--code-tag); }
.tok-attr    { color: var(--code-attr); }
.tok-key     { color: var(--code-attr); }
.tok-str     { color: var(--code-str); }
.tok-kw      { color: var(--code-kw); font-weight: 500; }
.tok-fn      { color: var(--code-fn); }

.download-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  background: var(--accent);
  color: #0c0715;
  font-family: 'Roboto Condensed', sans-serif;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  text-decoration: none;
  padding: 0.65em 1.3em;
  border-radius: 8px;
  margin: 0.6rem 0 1.2rem;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.download-btn:hover,
.download-btn:focus-visible {
  transform: translateY(-2px);
  filter: brightness(1.08);
}

.download-btn.secondary {
  background: transparent;
  border: 2px solid var(--accent);
  color: var(--accent);
}

.download-btn.secondary:hover,
.download-btn.secondary:focus-visible {
  background: var(--accent);
  color: #0c0715;
}

.code-note {
  font-size: 0.85rem;
  font-style: italic;
  color: #a05a2c;
  background: #fff3e6;
  border-left: 3px solid #e08a3c;
  padding: 0.5rem 0.8rem;
  margin: -1rem 0 1.5rem;
  border-radius: 0 6px 6px 0;
}

/* ---------- Guía paso a paso (How & Downloads) ---------- */
.steps {
  list-style: none;
  counter-reset: step;
}

.step {
  counter-increment: step;
  margin-bottom: clamp(2rem, 5vw, 3.5rem);
}

.step h2 {
  font-family: 'Roboto Condensed', sans-serif;
  font-weight: 900;
  font-size: clamp(1.3rem, 3vw, 1.8rem);
  color: #1a1a1a;
  display: flex;
  align-items: baseline;
  gap: 0.6em;
  margin-bottom: 0.5em;
}

.step h2::before {
  content: counter(step, decimal-leading-zero);
  color: var(--accent);
}

.step p {
  line-height: 1.6;
  color: #333333;
  max-width: 65ch;
}

.step p + p {
  margin-top: 0.6em;
}

/* ---------- Docs ---------- */
.docs-toc {
  background: #f4f6f5;
  border: 1px solid #e2e6e4;
  border-radius: 10px;
  padding: 1rem 1.4rem;
  margin-bottom: clamp(2rem, 5vw, 3rem);
}

.docs-toc p {
  font-family: 'Roboto Condensed', sans-serif;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.85rem;
  color: #667;
  margin-bottom: 0.6em;
}

.docs-toc ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4em 1.4em;
}

.docs-toc a {
  color: #1a1a1a;
  text-decoration: none;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.docs-toc a:hover,
.docs-toc a:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
}

.doc-section {
  margin-bottom: clamp(3rem, 7vw, 4.5rem);
  scroll-margin-top: 1.5rem;
}

.doc-section h2 {
  font-family: 'Roboto Condensed', sans-serif;
  font-weight: 900;
  font-size: clamp(1.5rem, 3.5vw, 2.1rem);
  color: #1a1a1a;
  border-bottom: 3px solid var(--accent);
  display: inline-block;
  padding-bottom: 0.15em;
  margin-bottom: 0.8em;
}

.doc-section h3 {
  font-family: 'Roboto Condensed', sans-serif;
  font-weight: 700;
  font-size: clamp(1.05rem, 2.2vw, 1.3rem);
  color: #1a1a1a;
  margin: 1.8em 0 0.5em;
}

.doc-section h3 .tag {
  font-family: 'Roboto Mono', monospace;
  font-weight: 400;
  font-size: 0.8em;
  color: var(--accent);
  margin-left: 0.5em;
}

.doc-section h4 {
  font-family: 'Roboto Condensed', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  color: #1a1a1a;
  margin: 1.5em 0 0.4em;
}

.doc-section h4 .tag {
  font-family: 'Roboto Mono', monospace;
  font-weight: 400;
  font-size: 0.75em;
  color: #778;
  margin-left: 0.5em;
}

.doc-section p,
.doc-section li {
  line-height: 1.65;
  color: #333333;
  max-width: 72ch;
}

.doc-section ul,
.doc-section ol {
  margin: 0.6em 0 1em 1.3em;
}

.doc-section li + li {
  margin-top: 0.35em;
}

.doc-section table {
  border-collapse: collapse;
  width: 100%;
  max-width: 640px;
  margin: 1rem 0 1.5rem;
  font-size: 0.92rem;
}

.doc-section th,
.doc-section td {
  text-align: left;
  padding: 0.5em 0.8em;
  border-bottom: 1px solid #e2e6e4;
}

.doc-section th {
  font-family: 'Roboto Condensed', sans-serif;
  font-weight: 700;
  color: #1a1a1a;
}

.doc-section td code,
.doc-section p code,
.doc-section li code {
  font-family: 'Roboto Mono', monospace;
  font-size: 0.9em;
  background: #f0f1ee;
  padding: 0.1em 0.4em;
  border-radius: 4px;
}

.action-catalog {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em;
  margin: 0.8em 0 1.4em;
}

.action-catalog code {
  font-family: 'Roboto Mono', monospace;
  font-size: 0.85rem;
  background: #0c0715;
  color: var(--code-str);
  padding: 0.3em 0.6em;
  border-radius: 6px;
}

.action-catalog code.plugin-action {
  color: var(--code-fn);
}

.note-box {
  background: #f0f1ee;
  border-left: 3px solid var(--accent);
  padding: 0.8rem 1.1rem;
  margin: 1rem 0 1.5rem;
  border-radius: 0 8px 8px 0;
  font-size: 0.95rem;
}

.note-box p { margin: 0; }
.note-box p + p { margin-top: 0.5em; }

.download-list {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.download-note {
  font-size: 0.85rem;
  color: #667;
  margin-top: 0.8rem;
}

/* ---------- Examples: grid hidratado ---------- */
.examples-note {
  background: #f0f1ee;
  border-left: 3px solid var(--accent);
  padding: 0.9rem 1.2rem;
  border-radius: 0 8px 8px 0;
  font-size: 0.95rem;
  line-height: 1.55;
  color: #333;
  margin-bottom: clamp(1.5rem, 4vw, 2.5rem);
}

.examples-note strong { color: #1a1a1a; }

.examples-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(0.8rem, 2vw, 1.4rem);
}

.example-card {
  display: flex;
  flex-direction: column;
  border: 1px solid #e2e6e4;
  border-radius: 12px;
  overflow: hidden;
  background: #fafbfa;
  color: inherit;
  cursor: pointer;
  position: relative;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.example-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.example-card__visual {
  aspect-ratio: 4 / 3;
  position: relative;
  overflow: hidden;
  background: #f1f5f9;
  border-bottom: 1px solid #e2e8f0;
}

.example-card__ph {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Roboto Mono', monospace;
  font-weight: 700;
  font-size: 1.2rem;
  color: #cbd5e1;
}

.example-stage {
  position: absolute;
  top: 0;
  left: 0;
  width: 400%;
  height: 400%;
  transform: scale(0.25);
  transform-origin: 0 0;
  pointer-events: none;
  background: #ffffff;
  overflow: hidden;
}

.example-stage:empty { display: none; }

.example-close { display: none; }

.example-card.is-open,
.example-card.is-open:hover {
  transform: none;
  box-shadow: none;
  cursor: default;
}

.example-card.is-open .example-stage {
  position: fixed;
  inset: 0;
  width: auto;
  height: auto;
  transform: none;
  pointer-events: auto;
  overflow: auto;
  z-index: 2000;
}

.example-card.is-open .example-close {
  display: inline-flex;
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 2001;
  align-items: center;
  background: var(--accent);
  color: #0c0715;
  font-family: 'Roboto Condensed', sans-serif;
  font-weight: 900;
  font-size: 0.95rem;
  text-transform: uppercase;
  padding: 0.5rem 1.2rem;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s ease, filter 0.15s ease;
}

.example-card.is-open .example-close:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

.example-card__body {
  padding: 0.7rem 0.9rem 0.9rem;
  background: #ffffff;
}

.example-card__index {
  font-family: 'Roboto Mono', monospace;
  font-size: 0.72em;
  color: var(--accent);
  display: block;
  margin-bottom: 0.15em;
  font-weight: 700;
}

.example-card__title {
  font-family: 'Roboto Condensed', sans-serif;
  font-weight: 700;
  font-size: 0.95em;
  color: #1a1a1a;
  line-height: 1.25;
  display: block;
}

.example-card__tag {
  font-size: 0.75em;
  color: #64748b;
  display: block;
  margin-top: 0.25em;
}

/* ---------- Footer ---------- */
.page-footer {
  position: sticky;
  bottom: 0;
  z-index: 10;
  background: var(--header-blue);
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem 2.5rem;
  padding: clamp(1rem, 2.5vw, 1.5rem) clamp(1.5rem, 5vw, 3rem);
}

.footer-links {
  display: flex;
  align-items: center;
  gap: clamp(0.4rem, 1.5vw, 0.9rem);
}

.footer-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: clamp(2.2rem, 5vw, 2.8rem);
  height: clamp(2.2rem, 5vw, 2.8rem);
  border-radius: 6%;
  opacity: 0.75;
  transition: opacity 0.15s ease, background-color 0.15s ease;
}

.footer-link img {
  width: 60%;
  height: 60%;
  object-fit: contain;
}

.footer-link:hover,
.footer-link:focus-visible {
  opacity: 1;
  background-color: rgba(130, 202, 87, 0.25);
}

.footer-nav {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 3vw, 2rem);
}

.footer-nav-link {
  font-family: 'Roboto', sans-serif;
  font-weight: 500;
  font-size: clamp(0.85rem, 1.6vw, 1.05rem);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #ffffff;
  text-decoration: none;
  opacity: 0.85;
  transition: color 0.15s ease, opacity 0.15s ease;
}

.footer-nav-link:hover,
.footer-nav-link:focus-visible {
  color: var(--accent);
  opacity: 1;
}

.footer-logo-link {
  display: flex;
  align-items: center;
}

.footer-logo {
  height: clamp(28px, 5vw, 44px);
  width: auto;
  object-fit: contain;
}

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .examples-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4em;
  }

  .page-footer {
    justify-content: flex-start;
  }
}

@media (max-width: 480px) {
  .examples-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .example-wheel-preview { animation: none; }
}
