/* ══════════════════════════════════════════════════════════
   shared.css — FORMA Design System
   Compartido por: index.html · ui-library.html · audit.html
   Requiere: tokens.css (debe importarse antes)
══════════════════════════════════════════════════════════ */

/* ── Skip navigation ── */
.skip-to-main {
  position: absolute;
  top: -100%;
  left: var(--gap-sm, 8px);
  z-index: 9999;
  padding: 8px 16px;
  background: var(--color-blue-600);
  color: var(--color-white);
  font-family: var(--font-family-mono, monospace);
  font-size: var(--font-size-body-xs);
  letter-spacing: 0.08em;
  text-decoration: none;
  border: 1px solid var(--color-blue-400);
  transition: top 200ms ease;
}
.skip-to-main:focus { top: 8px; }

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: var(--font-size-body-md); scroll-behavior: smooth; overflow-x: hidden; }
body {
  font-family: var(--font-family-body, 'Barlow', sans-serif);
  font-weight: var(--font-weight-regular);
  line-height: var(--line-height-relaxed);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}


/* ── FORMA Header ── */
.forma-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(16px, 4vw, 40px);
  height: 48px;
  background: rgba(9, 13, 16, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-borders-hero);
}
.forma-header__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.forma-header__mark { width: 22px; height: 22px; flex-shrink: 0; }
.forma-header__name {
  font-family: var(--font-family-headings, 'Bebas Neue', sans-serif);
  font-size: var(--font-size-body-xs);
  letter-spacing: 0.12em;
  color: var(--color-neutral-50);
}
.forma-header__nav { display: flex; }
.forma-header__nav a {
  font-family: var(--font-family-mono);
  font-size: var(--font-size-body-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-neutral-600);
  text-decoration: none;
  padding: 0 16px;
  height: 48px;
  display: flex;
  align-items: center;
  border-left: 1px solid var(--color-borders-hero);
  transition: color 200ms ease, background 200ms ease;
}
.forma-header__nav a:hover {
  color: var(--color-neutral-400);
  background: rgba(255, 255, 255, 0.04);
}
.forma-header__nav a[aria-current="page"] {
  color: var(--color-blue-400);
  background: rgba(18, 122, 230, 0.08);
  border-bottom: 1px solid var(--color-blue-500);
}
.forma-header__nav a:focus-visible {
  outline: 2px solid var(--color-blue-400);
  outline-offset: -3px;
  color: var(--color-blue-400);
}
.forma-header__meta {
  font-family: var(--font-family-mono);
  font-size: var(--font-size-body-xs);
  letter-spacing: 0.06em;
  color: var(--color-neutral-600);
}

/* ── FORMA Footer ── */
.forma-footer {
  border-top: 1px solid var(--color-borders-default);
  padding: 40px 0;
  background: var(--surface);
}
.forma-footer .ft-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 clamp(24px, 5vw, 80px);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.ft {
  font-family: var(--font-family-mono);
  font-size: var(--font-size-body-xs);
  color: var(--color-text-ghost);
  letter-spacing: 0.06em;
}

/* ── Burger button ── */
.forma-header__left {
  display: flex;
  align-items: center;
}
.forma-header__burger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  padding: 0;
  margin-right: 2px;
  color: var(--color-neutral-500);
  transition: color 200ms ease;
  flex-shrink: 0;
}
.forma-header__burger:hover { color: var(--color-neutral-200); }
.forma-header__burger:focus-visible {
  outline: 2px solid var(--color-blue-400);
  outline-offset: 2px;
  color: var(--color-neutral-200);
  border-radius: 2px;
}
.forma-header__burger span {
  display: block;
  width: 18px;
  height: 1.5px;
  background: currentColor;
  border-radius: 1px;
}

/* ── Mobile header ── */
@media (max-width: 900px) {
  .forma-header__burger { display: flex; }
  .forma-header__nav,
  .forma-header__meta { display: none; }
}

/* ── Mobile nav overlay — side drawer ── */
.nav-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  pointer-events: none;
  visibility: hidden;
}
.nav-overlay.is-open {
  pointer-events: auto;
  visibility: visible;
}
.nav-overlay__scrim {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  transition: opacity var(--dur-base) var(--ease-quart);
}
.nav-overlay.is-open .nav-overlay__scrim { opacity: 1; }
.nav-overlay__panel {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  max-width: 85vw;
  background: var(--color-surface-hero);
  border-right: 1px solid var(--color-borders-hero);
  transform: translateX(-100%);
  transition: transform var(--dur-base) var(--ease-expo);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.nav-overlay.is-open .nav-overlay__panel { transform: translateX(0); }
.nav-overlay__close {
  position: absolute;
  top: 6px;
  left: min(280px, 85vw);
  margin-left: 12px;
  background: var(--color-surface-hero);
  border: 1px solid var(--color-borders-hero);
  border-radius: var(--radius-8);
  cursor: pointer;
  color: rgba(255, 255, 255, 0.4);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-body-md);
  line-height: var(--line-height-tight);
  padding: 0;
  opacity: 0;
  transition: opacity var(--dur-fast) ease, color 200ms ease;
}
.nav-overlay.is-open .nav-overlay__close { opacity: 1; }
.nav-overlay__close:hover { color: var(--color-neutral-50); }
.nav-overlay__close:focus-visible {
  outline: 2px solid var(--color-blue-400);
  outline-offset: 2px;
}
.nav-overlay__body {
  flex: 1;
  overflow-y: auto;
  padding: 48px 24px 60px;
  display: flex;
  flex-direction: column;
  gap: var(--gap-xl);
}
.nav-overlay__group-label {
  font-family: var(--font-family-mono);
  font-size: var(--font-size-body-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.25);
  margin-bottom: 8px;
  display: block;
}
.nav-overlay__group a {
  display: block;
  font-family: var(--font-family-body, 'Barlow', sans-serif);
  font-size: var(--font-size-h6);
  font-weight: var(--font-weight-light);
  color: rgba(255, 255, 255, 0.6);
  text-decoration: none;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: color 200ms ease;
}
.nav-overlay__group a:last-child { border-bottom: none; }
.nav-overlay__group a:hover,
.nav-overlay__group a[aria-current="page"] { color: var(--color-blue-400); }

/* ── Heading reset ── */
h1, h2, h3, h4, h5, h6 { font-weight: var(--font-weight-regular); margin: 0; }

/* ── Keyframes ── */
@keyframes slide-up {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── Page layout — compartido por audit.html · ui-library.html ── */
body {
  background: var(--color-surface-page-bg);
  color: var(--color-text-primary);
  padding-top: 48px;
}

body:not(.page-home) .hero,
.forma-main { margin-left: 220px; }

body:not(.page-home) .forma-footer { margin-left: 220px; }

.wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 clamp(var(--gap-lg), 5vw, var(--gap-4xl));
}

.wrap--prose {
  max-width: 72ch;
}

.forma-note {
  margin-top: var(--gap-sm);
  font-family: var(--font-family-mono);
  font-size: var(--font-size-body-xs);
  color: var(--color-text-ghost);
  letter-spacing: 0.04em;
}
.forma-note a {
  color: var(--color-interactive-primary-text);
}

.forma-section {
  max-width: 900px;
  margin: 0 auto;
  padding: clamp(64px, 2vw, 120px) clamp(var(--gap-lg), 5vw, var(--gap-4xl));
}
.forma-section + .forma-section { position: relative; }
.forma-section + .forma-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--color-borders-default);
}

@media (max-width: 900px) {
  body:not(.page-home) .hero,
  .forma-main,
  .forma-footer { margin-left: 0; }
}

/* ── Copy toast ── */
.copy-toast {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 900;
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity var(--dur-fast) ease, transform var(--dur-fast) ease;
  min-width: 180px;
  max-width: 320px;
}
.copy-toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 900px) {
  .copy-toast { left: 16px; bottom: 16px; }
}

/* ── Keyboard shortcuts ── */
.kbd-trigger {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 800;
  width: 32px;
  height: 32px;
  background: var(--surface);
  border: 1px solid var(--color-borders-strong);
  color: var(--color-text-ghost);
  font-family: var(--font-family-mono);
  font-size: var(--font-size-body-xs);
  line-height: var(--line-height-tight);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--dur-fast) ease, border-color var(--dur-fast) ease, background var(--dur-fast) ease;
}
.kbd-trigger:hover {
  color: var(--color-interactive-primary-text);
  border-color: var(--color-interactive-primary-text);
  background: var(--color-interactive-subtle);
}
.kbd-trigger:focus-visible {
  outline: 2px solid var(--color-interactive-primary-text);
  outline-offset: 2px;
}

.kbd-overlay {
  position: fixed;
  bottom: 64px;
  right: 24px;
  z-index: 800;
  background: var(--color-surface-hero);
  border: 1px solid var(--color-borders-hero);
  padding: 20px 24px;
  min-width: 260px;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity var(--dur-fast) var(--ease-expo), transform var(--dur-fast) var(--ease-expo);
}
.kbd-overlay.is-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.kbd-overlay__title {
  font-family: var(--font-family-mono);
  font-size: var(--font-size-body-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-hero-ghost);
  margin-bottom: 14px;
}
.kbd-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 6px 0;
  border-bottom: 1px solid var(--color-borders-hero);
}
.kbd-row:last-child { border-bottom: none; }
.kbd-lbl {
  font-size: var(--font-size-body-xs);
  color: var(--color-text-hero-dim);
}
.kbd-keys { display: flex; gap: 3px; }
kbd {
  font-family: var(--font-family-mono);
  font-size: var(--font-size-body-xs);
  color: var(--color-text-inverse);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 2px 7px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .kbd-trigger { bottom: 16px; right: 16px; }
  .kbd-overlay { bottom: 56px; right: 16px; min-width: calc(100vw - 32px); }
}

/* ── Section permalink anchors ── */
.section-link {
  display: inline-block;
  margin-left: 14px;
  opacity: 0;
  color: var(--color-borders-strong);
  text-decoration: none;
  font-size: 0.4em;
  vertical-align: middle;
  font-family: var(--font-family-mono);
  letter-spacing: 0;
  transition: opacity var(--dur-fast) ease, color var(--dur-fast) ease;
  cursor: copy;
}
*:hover > .section-link,
.section-link:focus-visible { opacity: 1; }
.section-link:hover { color: var(--color-interactive-primary-text); }
.section-link:focus-visible {
  outline: 2px solid var(--color-interactive-primary-text);
  outline-offset: 2px;
  opacity: 1;
}

/* ── Section head ── */
.forma-section-head {
  margin-bottom: var(--gap-2xl);
}
.forma-section-head .eyebrow {
  font-family: var(--font-family-mono);
  font-size: var(--font-size-body-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-accent-default);
  margin-bottom: var(--gap-sm);
}
.forma-section-head h2 {
  font-family: var(--font-family-headings);
  font-size: var(--font-size-h2);
  line-height: var(--line-height-h2);
  letter-spacing: var(--letter-spacing-h2);
  color: var(--color-text-primary);
  margin: 0 0 var(--gap-xs);
}
.forma-section-head > p {
  font-size: var(--font-size-body-md);
  color: var(--color-neutral-700);
  max-width: 620px;
  line-height: var(--line-height-prose);
  margin: 0 0 var(--gap-sm);
}
.forma-section-head .badge {
  margin-right: var(--gap-xs);
}
.forma-section-lead {
  font-size: var(--font-size-body-md);
  color: var(--color-text-secondary);
  max-width: 720px;
  line-height: var(--line-height-prose);
  margin: 0 0 var(--gap-2xl);
}
.forma-text {
  font-size: var(--font-size-body-md);
  color: var(--color-text-secondary);
  line-height: var(--line-height-prose);
  margin: 0 0 var(--gap-sm);
}

/* ── Demo container ── */
.forma-demo {
  background-color: var(--color-opacity-white-opc-80);
  border: 1px solid var(--color-borders-subtle);
  border-radius: var(--radius-12);
  padding: var(--gap-xl);
  margin-bottom: var(--gap-md);
}
.forma-demo--dark {
  background-color: var(--color-neutral-900);
}
.forma-demo--dark .forma-label {
  color: var(--color-neutral-500);
}
.forma-label {
  font-family: var(--font-family-mono);
  font-size: var(--font-size-body-xs);
  color: var(--color-text-buttons-disabled);
  letter-spacing: 0.06em;
  display: block;
  margin-bottom: var(--gap-sm);
}

/* ── Row ── */
.forma-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--gap-md);
  margin-bottom: var(--gap-lg);
}
.forma-row--col {
  flex-direction: column;
  align-items: flex-start;
}

/* ── Utilities ── */
.forma-alert-stack {
  display: flex;
  flex-direction: column;
  gap: var(--gap-md);
}
.forma-input-stack {
  display: flex;
  flex-direction: column;
  gap: var(--gap-md);
  max-width: 400px;
}
.forma-input-group {
  display: flex;
  flex-direction: column;
  gap: var(--gap-xs);
}
.forma-input-label {
  font-family: var(--font-family-body);
  font-size: var(--font-size-body-xs);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-primary);
}
hr.forma-sep {
  border: none;
  border-top: 1px solid var(--color-borders-subtle);
  margin: var(--gap-section) 0;
}

/* ── Subsection ── */
.forma-subsection {
  margin-bottom: var(--gap-2xl);
}
.forma-subsection-head {
  font-family: var(--font-family-body);
  font-size: var(--font-size-body-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--gap-md);
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
}
.forma-subsection-head::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-borders-default);
}
.article-body {
  max-width: 68ch;
  font-family: var(--font-family-body);
  font-size: clamp(15px, 1.4vw, 17px);
  font-weight: var(--font-weight-light);
  line-height: var(--line-height-prose);
  color: var(--color-neutral-700);
}
.article-body p + p {
  margin-top: 20px;
}
.article-body a {
  color: var(--color-blue-600);
  text-decoration-color: oklch(0.38 0.16 255 / 0.35);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: text-decoration-color 150ms ease, color 150ms ease;
}
.article-body a:hover {
  color: var(--color-blue-500);
  text-decoration-color: var(--color-blue-500);
}
.article-body del {
  color: var(--color-neutral-400);
}

.link-inherit {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ── Scroll-triggered reveals ── */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  will-change: transform, opacity;
  transition: opacity var(--dur-base) var(--ease-expo),
    transform var(--dur-base) var(--ease-expo);
}
.reveal.in { opacity: 1; transform: none; will-change: auto; }
.reveal:nth-child(1) { transition-delay:   0ms; }
.reveal:nth-child(2) { transition-delay:  80ms; }
.reveal:nth-child(3) { transition-delay: 160ms; }
.reveal:nth-child(4) { transition-delay: 240ms; }
.reveal:nth-child(5) { transition-delay: 320ms; }
.reveal:nth-child(6) { transition-delay: 400ms; }
.reveal:nth-child(7) { transition-delay: 480ms; }
.reveal:nth-child(8) { transition-delay: 560ms; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; }
}

/* ── Section / display title — H2 hero de sección ── */
.sec-title {
  font-family:    var(--font-family-headings);
  font-size:      var(--font-size-display);
  line-height:    var(--line-height-display);
  letter-spacing: var(--letter-spacing-display);
}


/* ── Code block ── */
.ok-code {
  position: relative;
  margin: 28px 0;
  background: var(--color-neutral-900);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius-12);
  overflow: hidden;
}

.ok-code--padded {
  padding: var(--gap-xl);
  font-family: var(--font-family-mono);
  font-size: var(--font-size-body-xs);
  line-height: var(--line-height-code);
  color: var(--color-neutral-300);
  overflow-x: auto;
}

.ok-code__label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.ok-code__lang {
  font-family: var(--font-family-mono);
  font-size: var(--font-size-body-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-neutral-500);
}

.ok-code__copy {
  font-family: var(--font-family-mono);
  font-size: var(--font-size-body-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-neutral-500);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  transition: color 150ms ease;
}
.ok-code__copy:hover { color: var(--color-neutral-200); }
.ok-code__copy.copied { color: var(--color-blue-400); }

.ok-code pre {
  padding: 24px 20px;
  overflow-x: auto;
  margin: 0;
  white-space: pre;
}

.ok-code code {
  font-family: var(--font-family-mono);
  font-size: var(--font-size-body-xs);
  line-height: var(--line-height-code);
  color: var(--color-neutral-200);
  background: none;
  border: none;
  padding: 0;
}

.ok-copy-btn {
  position: absolute;
  top: var(--gap-md);
  right: var(--gap-md);
  font-family: var(--font-family-mono);
  font-size: var(--font-size-body-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-neutral-500);
  background: transparent;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-4);
  padding: 4px 8px;
  cursor: pointer;
  transition: color var(--dur-fast) ease, border-color var(--dur-fast) ease;
}
.ok-copy-btn:hover { color: var(--color-neutral-200); border-color: rgba(255,255,255,0.25); }

/* syntax tokens */
.ck-prop { color: var(--color-blue-300); }
.ck-val  { color: var(--color-green-300); }
.ck-fn   { color: var(--color-purple-300); }
.ck-num  { color: var(--color-orange-200); }
.ck-cmt  { color: var(--color-neutral-600); font-style: italic; }
.tok-prop    { color: #82c0ff; }
.tok-val     { color: #a5d6a7; }
.tok-unit    { color: #ffcc80; }
.tok-sel     { color: #ce93d8; }
.tok-comment { color: #546e7a; font-style: italic; }
.tok-colon   { color: #78909c; }
.tok-semi    { color: #78909c; }

