/* ==========================================================================
   Content Machine — Guía
   Brand tokens from guidelines/branding.md
   ========================================================================== */

:root {
  /* Typography */
  --font-title: "Public Sans", "Inter", system-ui, sans-serif;
  --font-body:  "Hanken Grotesk", "Inter", system-ui, sans-serif;
  --font-mono:  "DM Sans", "JetBrains Mono", ui-monospace, monospace;

  --title-color: #ffffff;
  --body-color: #ffffff;
  --mono-color: #ff4000;

  /* Colors */
  --accent: #ff4d00;
  --accent-2: #ff6d1f;
  --accent-3: #ffffff;
  --success: #34d399;
  --danger: #ff00d0;
  --solid-surface: #050506;
  --base-2: #190a00;

  /* Surfaces */
  --radius: 17px;
  --stroke-opacity: 0.57;
  --texture-opacity: 0.07;
  --card-glow: 0.15;
  --shadow-depth: 0.48;

  /* Surface recipes */
  --glass-bg: rgba(10,12,16,.28);
  --glass-border: rgba(255,255,255,.46);
  --solid-bg: #080808;
  --solid-border: #878787;
  --outline-bg: rgba(0,0,0,0);
  --outline-border: #525252;
  --quote-bg: rgba(8,8,10,.58);
  --quote-border: #d5b2aa;
  --note-bg: rgba(255,160,0,.25);
  --note-border: #ff8800;
  --code-bg: rgba(3,200,255,.18);
  --code-border: #00c8ff;
  --hud-bg: rgba(255,255,255,.07);
  --hud-border: #cfcfcf;

  /* Text effects */
  --glow-color: #ff4d00;
  --highlight-bg: #ff3300;

  /* Motion */
  --easing: cubic-bezier(.16, 1, .3, 1);
  --duration-default: 1600ms;
  --duration-card: 900ms;
  --duration-hero: 900ms;

  /* Layout */
  --pattern-color: #fff4f0;
  --pattern-opacity: 0.06;
  --max-content: 1200px;
  --gutter: 32px;
}

/* ==========================================================================
   Reset
   ========================================================================== */

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--solid-surface);
  color: var(--body-color);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Background grid pattern */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    linear-gradient(180deg, var(--solid-surface) 0%, var(--base-2) 100%),
    repeating-linear-gradient(0deg, transparent 0, transparent 80px, var(--pattern-color) 80px, var(--pattern-color) 81px),
    repeating-linear-gradient(90deg, transparent 0, transparent 80px, var(--pattern-color) 80px, var(--pattern-color) 81px);
  background-blend-mode: normal, overlay, overlay;
  opacity: 1;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse at 20% 10%, rgba(255, 77, 0, .12) 0%, transparent 55%),
    radial-gradient(ellipse at 80% 90%, rgba(255, 109, 31, .08) 0%, transparent 60%);
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); text-decoration: underline; }

img, svg { max-width: 100%; height: auto; display: block; }

button { font-family: inherit; cursor: pointer; }

code, pre {
  font-family: var(--font-mono);
}

/* Inline code outside pre */
:not(pre) > code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  color: var(--mono-color);
  background: rgba(255, 64, 0, 0.08);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid rgba(255, 64, 0, 0.2);
}

/* ==========================================================================
   Layout
   ========================================================================== */

main { position: relative; z-index: 1; }

.container {
  max-width: var(--max-content);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ==========================================================================
   Header
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: rgba(5, 5, 6, 0.78);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px var(--gutter);
  max-width: var(--max-content);
  margin: 0 auto;
  gap: 16px;
}

.site-header__brand {
  font-family: var(--font-title);
  font-weight: 900;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-size: 14px;
  color: var(--title-color);
  display: flex;
  align-items: center;
  gap: 10px;
}

.site-header__brand .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(255, 77, 0, 0.7);
}

.site-header__menu-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--outline-border);
  border-radius: 9px;
  color: var(--title-color);
  padding: 8px 12px;
  font-size: 14px;
}

.site-header__nav {
  display: flex;
  gap: 4px;
}

.site-header__nav a {
  color: var(--body-color);
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-mono);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 9px;
  transition: background var(--duration-card) var(--easing), color var(--duration-card) var(--easing);
}

.site-header__nav a:hover,
.site-header__nav a.is-active {
  background: rgba(255, 77, 0, 0.12);
  color: var(--accent);
  text-decoration: none;
}

/* ==========================================================================
   Hero
   ========================================================================== */

.hero {
  padding: 96px var(--gutter) 64px;
  max-width: var(--max-content);
  margin: 0 auto;
  position: relative;
}

.hero__eyebrow {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  color: var(--mono-color);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 24px;
}

.hero__title {
  font-family: var(--font-title);
  font-weight: 900;
  font-size: clamp(48px, 8vw, 96px);
  line-height: 0.95;
  text-transform: uppercase;
  letter-spacing: -0.02em;
  margin: 0 0 24px;
  color: var(--title-color);
}

.hero__title .accent {
  color: var(--accent);
  text-shadow: 0 0 40px rgba(255, 77, 0, 0.45);
}

.hero__subtitle {
  font-size: 22px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.72);
  max-width: 720px;
  margin: 0 0 32px;
  line-height: 1.4;
}

.hero__intro {
  max-width: 720px;
  font-size: 16px;
  color: rgba(255, 255, 255, 0.6);
  margin: 0 0 48px;
}

.hero__chapters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 48px;
}

.hero__chapter-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 20px;
  text-decoration: none;
  color: inherit;
  transition: transform var(--duration-card) var(--easing), border-color var(--duration-card) var(--easing);
}

.hero__chapter-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  text-decoration: none;
}

.hero__chapter-card .num {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 11px;
  color: var(--mono-color);
  letter-spacing: 0.1em;
}

.hero__chapter-card .title {
  font-family: var(--font-title);
  font-weight: 900;
  font-size: 18px;
  text-transform: uppercase;
  margin: 8px 0 6px;
  color: var(--title-color);
}

.hero__chapter-card .subtitle {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.6);
  margin: 0;
}

/* ==========================================================================
   Chapter divider
   ========================================================================== */

.chapter-divider {
  padding: 64px var(--gutter) 32px;
  max-width: var(--max-content);
  margin: 0 auto;
  position: relative;
}

.chapter-divider__num {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  color: var(--mono-color);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 16px;
}

.chapter-divider__title {
  font-family: var(--font-title);
  font-weight: 900;
  font-size: clamp(32px, 5vw, 56px);
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: -0.02em;
  margin: 0 0 12px;
  color: var(--title-color);
}

.chapter-divider__subtitle {
  font-size: 18px;
  color: rgba(255, 255, 255, 0.6);
  margin: 0;
  max-width: 640px;
}

.chapter-divider__rule {
  margin-top: 32px;
  height: 1px;
  background: linear-gradient(90deg, var(--accent) 0%, transparent 50%);
}

/* ==========================================================================
   Step
   ========================================================================== */

.step {
  padding: 24px var(--gutter);
  max-width: var(--max-content);
  margin: 0 auto;
  scroll-margin-top: 80px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.step:last-child { border-bottom: none; }

.step__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 32px;
  align-items: start;
}

.step__left { min-width: 0; }
.step__right { min-width: 0; }

.step__meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.step__meta .chapter-tag {
  color: rgba(255, 255, 255, 0.5);
}

.step__meta .step-num {
  color: var(--mono-color);
  background: rgba(255, 64, 0, 0.1);
  padding: 4px 10px;
  border-radius: 9px;
  border: 1px solid rgba(255, 64, 0, 0.3);
}

.step__title {
  font-family: var(--font-title);
  font-weight: 900;
  font-size: clamp(22px, 2.4vw, 30px);
  line-height: 1.1;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  margin: 0 0 4px;
  color: var(--title-color);
}

/* Action blocks: Haz / No / Resultado esperado */

.block {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid;
}

.block__label {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  margin-bottom: 8px;
  display: block;
}

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

.block li {
  position: relative;
  padding: 4px 0 4px 22px;
  font-size: 14.5px;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.92);
}

.block p {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.92);
}

/* Haz — accent (orange) */
.block--do {
  background: rgba(255, 77, 0, 0.06);
  border-color: rgba(255, 77, 0, 0.35);
}
.block--do .block__label { color: var(--accent); }
.block--do li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 11px;
  width: 10px;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
}

/* No — danger (magenta) */
.block--dont {
  background: rgba(255, 0, 208, 0.05);
  border-color: rgba(255, 0, 208, 0.30);
}
.block--dont .block__label { color: var(--danger); }
.block--dont li::before {
  content: "✕";
  position: absolute;
  left: 0;
  top: 4px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12px;
  color: var(--danger);
}

/* Resultado esperado — success (green) */
.block--outcome {
  background: rgba(52, 211, 153, 0.07);
  border-color: rgba(52, 211, 153, 0.35);
  border-left-width: 4px;
}
.block--outcome .block__label { color: var(--success); }
.block--outcome p {
  font-weight: 500;
}

/* Step without widget: stretch the left column to full width */
.step--no-widget .step__grid {
  grid-template-columns: minmax(0, 1fr);
}

/* ==========================================================================
   Widget (right column)
   ========================================================================== */

.widget {
  position: sticky;
  top: 88px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.04), 0 12px 48px rgba(0, 0, 0, 0.4);
}

.widget--code,
.widget--prompt,
.widget--terminal,
.widget--structure {
  background: var(--code-bg);
  border-color: var(--code-border);
}

.widget--diagram { background: var(--solid-bg); border-color: var(--solid-border); }

.widget__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.45);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  gap: 12px;
}

.widget__title {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.85);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.widget__filename {
  font-family: var(--font-mono);
  font-size: 11px;
  color: rgba(255, 255, 255, 0.55);
  white-space: nowrap;
}

.widget__actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.widget__btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.85);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 11px;
  padding: 6px 10px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  transition: all var(--duration-card) var(--easing);
}

.widget__btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #050506;
}

.widget__btn.is-success {
  background: var(--success);
  border-color: var(--success);
  color: #050506;
}

.widget__body { position: relative; }

.widget__body pre {
  margin: 0;
  padding: 18px;
  background: rgba(0, 0, 0, 0.35);
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.92);
  overflow-x: auto;
  max-height: 560px;
  overflow-y: auto;
  white-space: pre;
  tab-size: 2;
}

.widget__body pre::-webkit-scrollbar { width: 10px; height: 10px; }
.widget__body pre::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.3); }
.widget__body pre::-webkit-scrollbar-thumb { background: rgba(255, 77, 0, 0.4); border-radius: 5px; }
.widget__body pre::-webkit-scrollbar-thumb:hover { background: var(--accent); }

.widget__diagram {
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.widget__diagram svg { width: 100%; height: auto; }

.widget--placeholder {
  border: 2px dashed rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.02);
}

.widget--placeholder .widget__body {
  padding: 60px 24px;
  text-align: center;
}

.widget--placeholder .placeholder-icon {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 24px;
  color: rgba(255, 255, 255, 0.3);
  margin-bottom: 12px;
}

.widget--placeholder .placeholder-text {
  font-family: var(--font-mono);
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.widget--placeholder .placeholder-hint {
  margin-top: 8px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.35);
  font-family: var(--font-body);
  text-transform: none;
  letter-spacing: 0;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  margin-top: 80px;
  padding: 48px var(--gutter);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  text-align: center;
  font-family: var(--font-mono);
  font-size: 12px;
  color: rgba(255, 255, 255, 0.45);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.site-footer .accent { color: var(--accent); }

/* ==========================================================================
   Mobile
   ========================================================================== */

@media (max-width: 900px) {
  :root { --gutter: 20px; }

  .step__grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .widget {
    position: static;
    top: auto;
  }

  .site-header__menu-toggle { display: inline-flex; }

  .site-header__nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background: rgba(5, 5, 6, 0.96);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 12px var(--gutter);
    gap: 4px;
  }

  .site-header__nav.is-open { display: flex; }

  .hero { padding: 56px var(--gutter) 32px; }

  .hero__title { font-size: clamp(40px, 12vw, 64px); }
  .hero__subtitle { font-size: 18px; }

  .step { padding: 24px var(--gutter); }
}

@media (max-width: 540px) {
  .hero__chapters { grid-template-columns: 1fr; }
  .step__title { font-size: 24px; }
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0s !important; transition-duration: 0s !important; }
  html { scroll-behavior: auto; }
}
