/* Ruta Diferenciación — the route seen through the same thermal camera as the
   home launcher. Tokens, the heat field, doors, the calm panel and the shell;
   each page lays itself out in its own stylesheet. Every colour is a
   temperature on one ramp, and white-hot belongs only to the chosen door. */

:root {
  --night: #120909;
  --ink: #f4e9e4;
  --ink-soft: #c4b3ad;
  --cold: #8fb3ae;
  --kitsunebi: #7fd6cb;
  --wine: #4a2230;
  --flame: #ff6a1f;
  --ember: #ff5b1f;
  --amber: #ffb43a;
  --white-hot: #fff3dc;
  --char: #1a0707;
  --frame: rgba(127, 214, 203, 0.34);
  --frame-strong: rgba(127, 214, 203, 0.6);
  --frame-frozen: rgba(143, 179, 174, 0.3);

  /* Same stops as thermal-field.js; lightness only rises along it. */
  --ramp: #120909, #122326 10%, #112a2d 20%, #5a2034 32%, #8a1a2b 44%, #e0401c 58%, #ff6a1f 70%, #ffb43a 81%, #ffe08a 91%, #fff3dc;
  --hot-fill: radial-gradient(circle at var(--x, 50%) var(--y, 70%), #fff3dc 0, #ffe08a 18%, #ffb43a 42%, #ff6a1f 72%, #e0401c 100%);

  --font-display: "Archivo", "Arial Narrow", sans-serif;
  --font-mono: "Martian Mono", ui-monospace, monospace;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --gutter: clamp(1rem, 4vw, 4.5rem);
  --column-gap: clamp(1.5rem, 4vw, 4rem);
  --radius: 0.375rem;
  --curl-size: 3rem;
  --heading: clamp(1.85rem, 3.1vw, 2.9rem);
  --body: clamp(1rem, 1.05vw, 1.125rem);

  /* The notch every door carries in its top-right corner: a shallow scoop that
     rises into a sharp tip, a flame's lick or a tail's flick. */
  --curl: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cpath d='M3 0C8 0 11 3 14 7C17 11 21 13 25 12C28 11 29.5 8 29 1C32 5 35 9 40 11V0Z'/%3E%3C/svg%3E");
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");

  color-scheme: dark;
  scrollbar-color: var(--wine) var(--night);
}

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

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

body {
  margin: 0;
  min-height: 100svh;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1rem;
  line-height: 1.5;
  background-color: var(--night);
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--ember);
  color: var(--char);
}

a {
  color: inherit;
  text-underline-offset: 0.2em;
}

img,
video,
canvas {
  display: block;
  max-width: 100%;
}

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  z-index: 300;
  top: -5rem;
  left: 1rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  background: var(--amber);
  color: var(--char);
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus {
  top: 1rem;
}

/* A layout display never brings back something the page has hidden. */
[hidden] {
  display: none !important;
}

.svg-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- The heat field ---------- */

.thermal {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  filter: blur(2px);
}

.thermal-grain {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: var(--grain);
  opacity: 0.012;
  mix-blend-mode: screen;
}

/* The spot meter: a measuring frame, never a gunsight. A dark underline keeps it
   legible on the coldest night and on a white-hot door alike. */
.spot {
  position: fixed;
  z-index: 50;
  top: 0;
  left: 0;
  width: 2rem;
  height: 2rem;
  margin: -1rem 0 0 -1rem;
  color: var(--ink);
  pointer-events: none;
  transition: transform 0.5s var(--ease-out), opacity 0.6s var(--ease-out);
}

.spot.is-idle {
  opacity: 0;
}

.spot__reticle {
  display: block;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
}

.spot__shade {
  stroke: rgba(18, 9, 9, 0.72);
  stroke-width: 3.5;
}

.spot__reading {
  position: absolute;
  top: calc(100% - 0.35rem);
  left: calc(100% + 0.3rem);
  padding: 0.22rem 0.4rem;
  border: 1px solid var(--frame);
  border-radius: 0.2rem;
  background: var(--night);
  color: var(--ink);
  font: 400 0.6875rem/1 var(--font-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.spot.is-flipped .spot__reading {
  right: calc(100% + 0.3rem);
  left: auto;
}

/* Locked on a door, frame and reading turn to char type on its heat:
   a door never holds a box inside it. */
.spot.is-locked {
  color: var(--char);
}

.spot.is-locked .spot__shade {
  stroke: none;
}

.spot.is-locked .spot__reading {
  top: 50%;
  right: calc(100% + 0.3rem);
  left: auto;
  padding: 0;
  border: 0;
  background: none;
  color: var(--char);
  translate: 0 -50%;
}

/* ---------- Shell ---------- */

.site-shell {
  position: relative;
  z-index: 1;
  min-height: 100svh;
  padding: 0 var(--gutter);
}

.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem 2rem;
  padding-top: clamp(1.1rem, 3vh, 1.75rem);
}

.brand {
  color: var(--ink);
  font-size: 1rem;
  font-weight: 700;
  font-stretch: 118%;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.primary-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.6rem;
  font-size: 0.8125rem;
  font-weight: 550;
  font-stretch: 112%;
}

.primary-nav a {
  color: var(--ink-soft);
  text-decoration: none;
  transition: color 0.25s var(--ease-out);
}

.primary-nav a:hover,
.primary-nav a[aria-current="page"] {
  color: var(--ink);
}

.primary-nav a[aria-current="page"] {
  text-decoration: underline;
  text-decoration-color: var(--kitsunebi);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.45em;
}

.spot-readout {
  display: none;
  margin: 0;
  color: var(--kitsunebi);
  font: 400 0.75rem/1 var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.spot-readout__unit {
  margin-left: 0.2em;
  color: var(--cold);
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  padding: clamp(2.5rem, 6vh, 4rem) 0 1.1rem;
  color: rgba(196, 179, 173, 0.72);
  font-size: 0.75rem;
  font-stretch: 112%;
  letter-spacing: 0.04em;
}

.site-footer a {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--ink-soft);
  text-decoration: none;
}

.site-footer a svg {
  flex: none;
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.site-footer a:hover {
  color: var(--ink);
}

/* ---------- Type ---------- */

/* The herd reads cold and narrow; standing out takes weight and width. */
.display {
  margin: 0;
  font-size: clamp(2.2rem, min(4.3vw, 7.8vh), 4.4rem);
  font-weight: 800;
  font-stretch: 116%;
  line-height: 0.96;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.display__cold,
.display__warm,
.split-title__cold,
.split-title__warm {
  display: block;
}

.display__cold,
.split-title__cold {
  color: var(--cold);
  font-weight: 400;
  font-stretch: 100%;
}

.display__warm,
.split-title__warm {
  color: var(--ink);
}

/* A section heading is one thermal reading: a cold line, then the warm one. */
.split-title {
  margin: 0;
  font-size: var(--heading);
  font-weight: 750;
  font-stretch: 116%;
  line-height: 1.02;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.split-title__cold {
  margin-bottom: 0.08em;
}

/* Heat on type is rendered by the #heat-map gradient maps, never a CSS text gradient. */
.heat {
  display: inline-block;
  color: #fff;
  font-weight: 900;
  font-style: normal;
  filter: url(#heat-map);
}

.split-title em {
  color: #fff;
  font-style: normal;
  font-weight: 800;
  filter: url(#heat-map-sm);
}

.prose {
  color: var(--ink-soft);
  font-size: var(--body);
  line-height: 1.55;
}

.prose p {
  max-width: 60ch;
  margin: 0 0 0.85em;
}

.prose p:last-child {
  margin-bottom: 0;
}

.prose strong {
  color: var(--ink);
  font-weight: 600;
}

.label {
  margin: 0;
  color: var(--kitsunebi);
  font-size: 0.8125rem;
  font-weight: 550;
  font-stretch: 112%;
  line-height: 1.2;
}

/* ---------- Doors ---------- */

.door {
  --x: 50%;
  --y: 70%;
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.5rem;
  width: 100%;
  min-height: 100%;
  padding: clamp(1rem, 1.5vw, 1.4rem) clamp(1rem, 1.6vw, 1.5rem) clamp(0.95rem, 1.3vw, 1.2rem);
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  -webkit-mask: linear-gradient(#000 0 0), var(--curl) top right / var(--curl-size) var(--curl-size) no-repeat;
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0), var(--curl) top right / var(--curl-size) var(--curl-size) no-repeat;
  mask-composite: exclude;
  transition: color 0.3s var(--ease-out);
}

/* The cold state is drawn, not dimmed: an isotherm hairline around a body at rest. */
.door::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  border: 1px solid var(--frame);
  border-radius: var(--radius);
  transition: border-color 0.3s var(--ease-out), inset 0.3s var(--ease-out);
}

.door::after {
  content: "";
  position: absolute;
  z-index: -2;
  inset: 0;
  border-radius: var(--radius);
  background: var(--hot-fill);
  opacity: 0;
  transition: opacity 0.45s var(--ease-out);
}

.door:hover::before {
  border-color: var(--frame-strong);
}

/* The carved corner keeps its contour, so the notch reads as a flame, not a gap. */
.door__curl {
  position: absolute;
  z-index: -1;
  top: 0;
  right: 0;
  width: var(--curl-size);
  height: var(--curl-size);
  fill: none;
  stroke: var(--frame);
  stroke-width: 2;
  transition: stroke 0.3s var(--ease-out);
}

.door__curl path {
  vector-effect: non-scaling-stroke;
}

.door:hover .door__curl {
  stroke: var(--frame-strong);
}

.door.is-hot {
  color: var(--char);
}

.door.is-hot::after {
  opacity: 1;
}

.door.is-hot::before {
  border-color: transparent;
}

.door.is-hot .door__curl {
  stroke: rgba(26, 7, 7, 0.55);
}

.door:focus-visible {
  outline: none;
}

.door:focus-visible::before {
  inset: 0.35rem;
  border: 2px solid currentColor;
  border-radius: 0.2rem;
}

.door__answer {
  max-width: 24ch;
  padding-right: 1.25rem;
  font-size: clamp(1.1rem, 1.5vw, 1.55rem);
  font-weight: 650;
  font-stretch: 108%;
  line-height: 1.12;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.door__line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  color: var(--kitsunebi);
  font-size: 0.8125rem;
  font-weight: 550;
  font-stretch: 112%;
  line-height: 1;
  transition: color 0.3s var(--ease-out);
}

.door.is-hot .door__line {
  color: var(--char);
}

.door__arrow {
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.4s var(--ease-out);
}

.door.is-hot .door__arrow {
  transform: translateX(3px);
}

/* The invitation: while nothing is chosen, a heat front runs once round one
   door's hairline and through its notch, then hands over to the next door.
   Choosing any door answers it, and every glint stops. */
@property --glint {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

.door__glint {
  position: absolute;
  z-index: -1;
  inset: 0;
  padding: 2px;
  border-radius: var(--radius);
  background: conic-gradient(from var(--glint), transparent 0deg 292deg, rgba(224, 64, 28, 0.35) 318deg, #ff6a1f 338deg, #ffb43a 350deg, #fff3dc 356deg, transparent 360deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  opacity: 0;
  pointer-events: none;
  animation: door-glint 7.5s linear 1.2s infinite;
}

.has-hot-door .door__glint {
  animation: none;
}

/* One door alone runs every 7.5s; a set of six hands the front round every 15s. */
@keyframes door-glint {
  0% {
    --glint: 0deg;
    opacity: 0;
  }

  3%,
  26% {
    opacity: 1;
  }

  32%,
  100% {
    --glint: 360deg;
    opacity: 0;
  }
}

@keyframes door-glint-six {
  0% {
    --glint: 0deg;
    opacity: 0;
  }

  1.5%,
  13% {
    opacity: 1;
  }

  16%,
  100% {
    --glint: 360deg;
    opacity: 0;
  }
}

/* A route that is not open yet: colder than the ground, its isotherm broken. */
.door--frozen {
  cursor: default;
}

.door--frozen::before,
.door--frozen:hover::before {
  border: 1px dashed var(--frame-frozen);
}

.door--frozen .door__curl,
.door--frozen:hover .door__curl {
  stroke: var(--frame-frozen);
  stroke-dasharray: 4 3;
}

.door--frozen .door__line {
  color: var(--cold);
}

.door__lock {
  flex: none;
  width: 1.1rem;
  height: 1.1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- The calm panel and actions ---------- */

.panel {
  padding: clamp(1.25rem, 2vw, 1.6rem);
  border: 1px solid var(--frame);
  border-radius: var(--radius);
  background: rgba(18, 9, 9, 0.94);
  box-shadow: 0 1.5rem 3rem -1rem rgba(0, 0, 0, 0.65);
}

.cta {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.8rem 2.1rem 0.8rem 1.1rem;
  border: 0;
  border-radius: var(--radius);
  background: var(--amber);
  color: var(--char);
  font: inherit;
  font-weight: 650;
  font-stretch: 108%;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.25s var(--ease-out);
}

.cta:hover {
  background: #ff8a2a;
}

.cta svg,
.control svg {
  flex: none;
  width: 1.1rem;
  height: 1.1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* The quiet action: a hairline, never a second fill competing with amber. */
.control {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.7rem 1rem;
  border: 1px solid var(--frame-strong);
  border-radius: var(--radius);
  background: rgba(18, 9, 9, 0.82);
  color: var(--ink);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  font-stretch: 110%;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.25s var(--ease-out), background-color 0.25s var(--ease-out);
}

.control:hover {
  border-color: var(--kitsunebi);
  background: rgba(18, 35, 38, 0.92);
}

/* ---------- Instrument scale ---------- */

.thermal-scale {
  position: fixed;
  z-index: 2;
  top: clamp(5.5rem, 16vh, 9rem);
  right: clamp(0.9rem, 1.5vw, 1.5rem);
  display: none;
  grid-template-rows: auto 1fr auto;
  justify-items: center;
  gap: 0.6rem;
  height: 38vh;
  color: var(--ink-soft);
  font: 400 0.625rem/1 var(--font-mono);
}

.thermal-scale__bar {
  position: relative;
  width: 0.375rem;
  border-radius: 1rem;
  background: linear-gradient(to top, var(--ramp));
}

.thermal-scale__bar::before {
  content: "";
  position: absolute;
  inset: -2px;
  border: 1px solid rgba(127, 214, 203, 0.22);
  border-radius: 1rem;
}

.thermal-scale__route {
  position: absolute;
  right: calc(100% + 0.85rem);
  bottom: var(--at);
  color: var(--ink);
  white-space: nowrap;
  translate: 0 50%;
}

.thermal-scale__route::after {
  content: "";
  position: absolute;
  top: 50%;
  left: calc(100% + 0.2rem);
  width: 0.45rem;
  height: 1px;
  background: currentColor;
}

.thermal-scale__marker {
  position: absolute;
  bottom: var(--level, 0%);
  left: 50%;
  width: 1.1rem;
  height: 2px;
  border-radius: 1px;
  background: var(--ink);
  translate: -50% 50%;
  transition: bottom 0.4s var(--ease-out);
}

@media (min-width: 821px) {
  .thermal-scale {
    display: grid;
  }

  .site-shell {
    padding-right: calc(var(--gutter) + 2.75rem);
  }
}

/* ---------- Narrow screens ---------- */

@media (max-width: 820px) {
  .spot,
  .primary-nav {
    display: none;
  }

  .spot-readout {
    display: block;
  }

  .door {
    gap: 1rem;
    padding: 1.05rem 1.15rem 1rem;
  }

  .door__answer {
    max-width: 28ch;
  }

  /* The shared dock, rebuilt for this route as one strip of the ramp. At rest it
     stays in the cold band; only the route you are on burns white-hot. */
  .route-dock {
    gap: 0;
    padding: 0.25rem;
    border: 0;
    border-radius: 0.5rem;
    background: linear-gradient(90deg, #112a2d, #3c2431 50%, #621f33);
    box-shadow: 0 1rem 2rem -0.5rem rgba(0, 0, 0, 0.7);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .route-dock__item {
    width: auto;
    min-width: 5.5rem;
    padding: 0.85rem 1rem 0.8rem;
    border-radius: 0.3rem;
    transition: background-color 0.3s var(--ease-out);
  }

  .route-dock__item + .route-dock__item {
    border-left: 1px solid rgba(18, 9, 9, 0.4);
  }

  .route-dock__label,
  .route-dock__item[aria-current="page"] .route-dock__label {
    color: var(--ink);
    font: 600 0.8125rem/1 var(--font-display);
    font-stretch: 112%;
    letter-spacing: 0;
    text-transform: none;
  }

  .route-dock__item[aria-current="page"] {
    background: var(--hot-fill);
  }

  .route-dock__item[aria-current="page"] .route-dock__label {
    color: var(--char);
  }

  .route-dock__item:focus-visible {
    outline: 2px solid var(--amber);
    outline-offset: 2px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .door,
  .door::before,
  .door::after,
  .door__line,
  .door__arrow,
  .door__curl,
  .cta,
  .control,
  .primary-nav a,
  .thermal-scale__marker,
  .route-dock__item,
  .spot {
    transition: none;
  }

  .door__glint {
    animation: none;
  }
}
