:root {
  color-scheme: light;
  --paper: #e8e8e3;
  --ink: #24281e;
  --muted: #505747;
  --line: #a6ad99;
  --accent: #c5e634;
  --slate: #32352c;
  --mono: Consolas, 'Courier New', monospace;
  --gutter: clamp(1rem, 4.6vw, 5rem);
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 1rem/1.55 system-ui, sans-serif; }
[hidden] { display: none !important; }
a { color: inherit; text-underline-offset: .23em; }
a, button, input, select, textarea { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #1a6c88; outline-offset: 4px; }
.process :focus-visible, .foot :focus-visible { outline-color: var(--accent); }
.skip { position: fixed; z-index: 3; top: .5rem; left: .5rem; padding: .7rem 1rem; color: var(--ink); background: var(--accent); transform: translateY(-180%); }
.skip:focus { transform: none; }
.wrap { width: min(100%, 93rem); margin-inline: auto; padding-inline: var(--gutter); }
section[id] { scroll-margin-top: 5.25rem; }
.top { position: sticky; z-index: 2; top: 0; background: var(--paper); border-bottom: 1px solid var(--line); }
.mast, nav, .logo { display: flex; align-items: center; }
.mast { min-height: 4.25rem; justify-content: space-between; gap: .75rem; }
nav { gap: clamp(.75rem, 2.5vw, 2.5rem); }
nav a { min-height: 44px; display: inline-flex; align-items: center; gap: .5rem; font-weight: 650; }
.nav-contact, .nav-route { text-decoration: none; padding: .35rem .8rem; border: 1px solid var(--line); }
.nav-route.primary { background: var(--accent); border-color: transparent; }
nav a, .nav-motion { white-space: nowrap; }
@media (max-width: 64rem) { .nav-process { display: none; } }
.dock { display: none; }
.logo { gap: .65rem; text-decoration: none; flex-shrink: 0; }
.logo b { font-size: 1.45rem; letter-spacing: -.105em; line-height: 1; }
.logo span { padding-inline-start: .65rem; border-inline-start: 1px solid var(--line); font: 700 .62rem/1.2 var(--mono); letter-spacing: .06em; }
.eyebrow, .index { font: 700 .75rem/1.4 var(--mono); letter-spacing: .08em; }
.eyebrow { margin: 0 0 1.1rem; }
.dot { display: inline-block; width: .5rem; height: .5rem; margin-inline-end: .2em; background: #708b16; border-radius: 50%; }
h1, h2, h3, p { margin-top: 0; }
h1, h2 { font-weight: 720; line-height: .96; letter-spacing: -.085em; margin-bottom: 1.25rem; }
h1 { font-size: clamp(3.7rem, 9.3vw, 9rem); }
h2 { font-size: clamp(2.65rem, 6.1vw, 5.8rem); }
em { font-family: Georgia, serif; font-weight: 400; letter-spacing: -.08em; }
.intro { max-width: 36ch; font-size: clamp(1.06rem, 1.75vw, 1.32rem); color: var(--muted); }
.hero-copy { min-width: 0; align-self: center; }
.routes { display: grid; gap: .55rem; max-width: 34rem; }
.route { position: relative; display: grid; gap: .2rem; padding: .78rem 2.85rem .78rem .95rem; border: 1px solid var(--line); text-decoration: none; }
.route.primary { background: var(--accent); border-color: transparent; }
.route strong { font-size: clamp(1rem, 1.65vw, 1.22rem); line-height: 1.26; }
.route .arrow { position: absolute; right: 1rem; top: 50%; translate: 0 -50%; font-size: 1.15rem; }
.route:hover, .nav-contact:hover, .nav-route:hover { box-shadow: inset 0 0 0 1px currentColor; }
.process, .foot { background: var(--slate); color: var(--paper); }
.process { padding-block: clamp(2.75rem, 7vw, 7.5rem); }
.process .dot { background: var(--accent); }
.process em, .process .index { color: var(--accent); }
.process-head { display: grid; grid-template-columns: 1.03fr 1fr; align-items: end; gap: clamp(1rem, 4vw, 4rem); }
.process-head > p { max-width: 36ch; color: #e2e3d9; font-size: clamp(1.05rem, 1.75vw, 1.25rem); }
.process-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(1rem, 4vw, 4rem); margin-top: 1.5rem; }
.process-grid article { border-top: 1px solid #90958b; padding-top: 1.25rem; }
.process-grid h3 { font-size: clamp(1.4rem, 2.5vw, 2rem); line-height: 1.1; letter-spacing: -.04em; margin-bottom: .65rem; }
.process-grid article > p:not(.index) { max-width: 48ch; }
.process-grid a { display: inline-flex; align-items: center; min-height: 44px; gap: .55rem; font-weight: 650; }
.consult { display: grid; grid-template-columns: 1fr 1fr; align-items: start; gap: clamp(1.4rem, 5vw, 5rem); padding-block: clamp(2.75rem, 7vw, 7.5rem); }
.steps { max-width: 46ch; margin: 0 0 1.2rem; padding: 0; list-style: none; counter-reset: paso; }
.steps li { counter-increment: paso; position: relative; padding: .55rem 0 .55rem 2.4rem; border-top: 1px solid var(--line); color: var(--muted); }
.steps li::before { content: '0' counter(paso); position: absolute; left: 0; font: 700 .75rem/1.9 var(--mono); letter-spacing: .08em; color: var(--ink); }
.steps li > b { color: var(--ink); font-weight: 650; }
#sent-note { margin: 1rem 0 0; }
.note { max-width: 46ch; padding-left: .85rem; border-left: 3px solid #708b16; color: var(--muted); }
form { min-width: 0; padding: clamp(.95rem, 3vw, 2rem); border: 1px solid var(--line); background: #fcfaf3; }
fieldset { padding: 0; margin: 0; border: 0; min-width: 0; }
legend, form label { font-weight: 650; }
legend { padding: 0; margin-bottom: .45rem; }
.choices { display: grid; gap: .35rem; }
.choices label { display: flex; align-items: center; gap: .55rem; padding: .4rem .55rem; min-height: 44px; border: 1px solid var(--line); cursor: pointer; }
.choices label:has(:checked) { background: #e6edbf; border-color: #7c8c41; }
input[type=radio] { accent-color: #3b514b; width: 1.1rem; height: 1.1rem; flex: none; margin: 0; }
.fine { font-size: .9rem; color: var(--muted); margin: .55rem 0 .9rem; }
select, input[type=number], textarea { min-height: 44px; display: block; width: 100%; margin: .25rem 0 .9rem; background: white; color: var(--ink); border: 1px solid #83877f; border-radius: 0; padding: .42rem .56rem; font: inherit; }
textarea { resize: vertical; }
.form-row { display: grid; gap: .8rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pill { border: 1px solid var(--ink); min-height: 44px; padding: .48rem .85rem; display: inline-flex; gap: .6rem; align-items: center; justify-content: center; color: var(--ink); background: transparent; text-decoration: none; font: inherit; font-weight: 650; cursor: pointer; }
.pill.solid { background: var(--ink); color: white; }
.pill:hover { box-shadow: inset 0 0 0 1px currentColor; }
#message-result { border-top: 1px solid var(--line); padding-top: 1rem; margin-top: 1.25rem; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; }
#copy-status:empty { margin: 0; }
.foot .mast { padding-block: .8rem; flex-wrap: wrap; }
.foot p { margin: 0; color: #e2e3d9; font-size: .92rem; }
.credits { padding-block: 2rem; } .credits h1 { font-size: clamp(2.65rem, 6vw, 5rem); margin-top: 1rem; } .credits h2 { font-size: 1.5rem; letter-spacing: -.035em; }
@media (max-width: 45rem) {
  .process-head, .process-grid, .consult { grid-template-columns: minmax(0, 1fr); }
  .nav-process { display: none; }
}
@media (max-width: 24rem) {
  .form-row { grid-template-columns: minmax(0, 1fr); gap: 0; }
}
@media (prefers-reduced-motion: no-preference) {
  .route, .nav-contact, .nav-route, .pill { transition: background-color .22s, box-shadow .22s; }
  .dock { transition: transform .32s cubic-bezier(.2, .7, .2, 1); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* Lienzo común de la portada y los capítulos. La pieza comparte el fondo del texto. */
.journey {
  display: grid;
  grid-template-areas: 'journey';
  isolation: isolate;
  position: relative;
  background: var(--paper);
}
.scene-layer {
  --scene-x: 73%;
  --scene-y: 48%;
  --scene-glow: #dfe3d2;
  grid-area: journey;
  position: sticky;
  top: 0;
  align-self: start;
  height: 100svh;
  z-index: -1;
  pointer-events: none;
  overflow: clip;
  background:
    radial-gradient(ellipse at var(--scene-x) var(--scene-y), var(--scene-glow), transparent 63%),
    linear-gradient(var(--paper), #e5e7dc);
}
.stage { position: absolute; inset: 0; }
.stage canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.piece-still {
  position: absolute;
  left: 73%;
  top: 49%;
  transform: translate(-50%, -50%);
  width: min(42%, 40rem);
  height: auto;
  max-height: 70%;
  filter: drop-shadow(0 1.75rem 1.4rem #554a3420);
}
.scene-layer[data-scene="webgl"] .piece-still { visibility: hidden; }
.scene-layer[data-scene="fallback"] { position: relative; }
.chapters { grid-area: journey; min-width: 0; }
.chapter {
  display: grid;
  align-items: center;
  min-height: clamp(31rem, 86svh, 60rem);
  padding-block: clamp(2rem, 6vw, 5rem);
}
.chapter.hero { min-height: calc(100svh - 4.25rem); }
/* Terminación ocupa una pantalla entera: la escena queda fija mientras se lee. */
.chapter:last-child { min-height: 100svh; }
.chapter > div { width: min(43%, 37rem); min-width: 0; }
.journey h1 { font-size: clamp(3.25rem, 8.5vw, 8.5rem); }
.chapter-link { display: inline-flex; align-items: center; min-height: 44px; gap: .55rem; font-weight: 650; }
.spec { color: var(--muted); font: 700 .75rem/1.45 var(--mono); letter-spacing: .06em; }
.scene-note { margin-top: .85rem; margin-bottom: .1rem; }
.scene-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 0 1rem; }
.scene-actions a { font-size: .88rem; }
.nav-motion { min-height: 44px; background: none; border: 0; color: var(--ink); font: 650 .86rem/1 system-ui, sans-serif; padding-inline: .2rem; cursor: pointer; }
.nav-motion[aria-pressed="true"] { text-decoration: underline; text-underline-offset: .25rem; }
.example { font-size: .92rem; color: #d4e5a1; }
@media (max-width: 45rem) {
  /* Franja de la pieza: va por encima del texto y se desvanece hacia abajo,
     así el texto entra por debajo de la franja y la pieza nunca lo tapa ni se apaga. */
  .scene-layer {
    --scene-x: 50%; --scene-y: 22%; --scene-offset: 4.25rem;
    z-index: 1;
    -webkit-mask-image: linear-gradient(#000 calc(31svh - var(--scene-offset)), transparent calc(37svh - var(--scene-offset)));
    mask-image: linear-gradient(#000 calc(31svh - var(--scene-offset)), transparent calc(37svh - var(--scene-offset)));
  }
  .piece-still { left: 50%; top: 22%; width: min(52%, 14rem); max-height: 22%; }
  .chapter, .chapter.hero {
    align-content: start;
    min-height: clamp(30rem, 86svh, 48rem);
    padding-block: calc(37svh - 4.25rem + 1rem) 2rem;
  }
  .chapter.hero { min-height: calc(100svh - 4.25rem); }
  .nav-route { display: none; }
  .dock {
    position: fixed; z-index: 2; inset: auto 0 0;
    display: grid; grid-template-columns: 1fr 1fr; gap: .45rem;
    padding: .45rem .5rem calc(.45rem + env(safe-area-inset-bottom));
    background: var(--paper); border-top: 1px solid var(--line);
  }
  .dock a {
    display: grid; align-content: center; min-height: 48px; padding: .3rem .6rem;
    border: 1px solid var(--line); text-decoration: none; font-weight: 650; font-size: .9rem; line-height: 1.2;
  }
  .dock a.primary { background: var(--accent); border-color: transparent; }
  .dock small { font: 700 .62rem/1.3 var(--mono); letter-spacing: .06em; }
  .dock[data-away] { transform: translateY(110%); }
  body { padding-bottom: calc(4.3rem + env(safe-area-inset-bottom)); }
  .chapter > div { width: 100%; }
  .journey h1 { font-size: clamp(3rem, 11.3vw, 5.5rem); }
  .scene-note { font-size: .67rem; }
  nav { gap: .5rem; }
}
@media (prefers-reduced-motion: reduce) {
  .scene-layer { position: relative; }
}

/* La escena recibe entradas en la zona de la pieza. La lectura conserva sus eventos. */
.chapters, .chapter { pointer-events: none; }
.chapter > div { pointer-events: auto; }
.piece-input {
  position: absolute;
  left: 50%;
  right: 0;
  top: 5rem;
  bottom: 0;
  pointer-events: auto;
  touch-action: pan-y pinch-zoom;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}
.piece-input.is-dragging { cursor: grabbing; }
.piece-input:focus-visible { outline: none; box-shadow: inset 0 -3px 0 #728b19; }
.nav-reset {
  min-width: 44px;
  min-height: 44px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: 1.5rem/1 system-ui, sans-serif;
  cursor: pointer;
}
.piece-help { margin: .55rem 0; max-width: 36ch; color: var(--muted); font-size: .88rem; }
.route small { font-size: .87rem; line-height: 1.4; font-weight: 400; }
.service-scope { margin-block: 1.3rem; }
.service-scope > div { padding-block: .8rem; border-top: 1px solid #707868; }
.service-scope dt { color: var(--accent); font: 650 .78rem/1.4 var(--mono); margin-bottom: .3rem; }
.service-scope dd { margin: 0; max-width: 46ch; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
@media (max-width: 60rem) {
  .top .logo span { display: none; }
}
@media (max-width: 45rem) {
  .piece-input { left: 0; top: calc(4.25rem - var(--scene-offset)); bottom: auto; height: calc(37svh - 4.25rem); }
}
.faq { display: grid; grid-template-columns: 1fr 1fr; align-items: start; gap: clamp(1.4rem, 5vw, 5rem); padding-block: clamp(2.75rem, 7vw, 7.5rem) 0; }
.faq-list { border-bottom: 1px solid var(--line); }
.faq details { border-top: 1px solid var(--line); }
.faq summary { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 56px; padding-block: .6rem; font-weight: 650; font-size: 1.05rem; line-height: 1.3; cursor: pointer; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; flex: none; font: 400 1.5rem/1 var(--mono); }
.faq details[open] summary::after { content: '–'; }
.faq details p { max-width: 52ch; margin: 0 0 1.1rem; color: var(--muted); }
@media (max-width: 45rem) { .faq { grid-template-columns: minmax(0, 1fr); } }
