/* =============================================================
   Sala de máquinas 3D · estilo caricatura con tinta
   ============================================================= */
:root {
  --ink: #141a22;
  --paper: #fbf3e4;
  --paper-2: #f3e6cf;
  --amber: #ffb547;
  --amber-d: #b86400;
  --mint: #3dd6a3;
  --mint-d: #127a58;
  --red: #ff6b6b;
  --navy: #0f1a24;
  --serif: "Fraunces", Georgia, serif;
  --sans: "Manrope", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --hard: 3px 3px 0 var(--ink);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body.ws {
  font-family: var(--sans); color: var(--ink); line-height: 1.55;
  background: radial-gradient(ellipse at 55% 35%, #29425a 0%, #142230 55%, #0b131b 100%) fixed;
  background-color: var(--navy);
  overflow: hidden; -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; border-radius: 8px; }
.mono { font-family: var(--mono); font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
code { font-family: var(--mono); font-size: .82em; background: var(--ink); color: var(--amber); padding: .12em .4em; border-radius: 6px; word-break: break-word; }

#scene { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; display: block; touch-action: none; cursor: default; }
#scene.is-pointer { cursor: pointer; }

/* ---------- Pills (botones con tinta) ---------- */
.pill {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .5rem .9rem; border-radius: 999px;
  background: var(--paper); border: 2.5px solid var(--ink); box-shadow: var(--hard);
  font-weight: 700; font-size: .88rem; white-space: nowrap;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), background .2s;
}
.pill:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.pill:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.pill-cta { background: var(--amber); }
.show-s { display: none; }

/* ---------- Top bar ---------- */
.ws-top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 14px 18px; pointer-events: none;
}
.ws-top > * { pointer-events: auto; }
.ws-brand {
  display: flex; align-items: center; gap: .65rem;
  padding: .45rem .95rem .45rem .7rem; border-radius: 16px;
  background: var(--paper); border: 2.5px solid var(--ink); box-shadow: var(--hard);
}
.ws-brand strong { display: block; font-family: var(--serif); font-size: 1.05rem; line-height: 1.1; white-space: nowrap; }
.ws-brand small { display: block; color: #5b6573; font-size: .62rem; }
.ws-led { width: 11px; height: 11px; border-radius: 50%; background: var(--mint); border: 2px solid var(--ink); animation: led 2.4s infinite; flex: none; }
@keyframes led { 50% { background: #9ff5d6; } }
.ws-actions { display: flex; gap: .55rem; flex-wrap: wrap; justify-content: flex-end; }
.is-overview .pill-back { display: none; }

/* ---------- Hint + chips ---------- */
.ws-hint {
  position: fixed; left: 50%; bottom: 70px; transform: translateX(-50%); z-index: 20;
  color: #e8eef4; font-size: .8rem; text-align: center;
  background: rgba(11,19,27,.72); padding: .3rem .8rem; border-radius: 999px;
  transition: opacity .4s; pointer-events: none; width: max-content; max-width: 90vw;
}
.chips {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 20;
  display: flex; gap: .45rem; max-width: calc(100vw - 24px); overflow-x: auto;
  padding: 4px 6px 8px; scrollbar-width: none; transition: opacity .35s, transform .45s var(--ease);
}
.chips::-webkit-scrollbar { display: none; }
.chips .pill { font-size: .8rem; padding: .38rem .75rem; }
.chips .chip-day { background: var(--mint); }
.is-focus .ws-hint, .is-tour .ws-hint,
.is-focus .chips, .is-tour .chips { opacity: 0; pointer-events: none; }
.is-focus .chips, .is-tour .chips { transform: translate(-50%, 20px); }

/* ---------- Labels 3D ---------- */
.labels { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
.lbl {
  position: absolute; left: 0; top: 0; pointer-events: auto;
  padding: .28rem .65rem; border-radius: 999px;
  background: var(--paper); border: 2px solid var(--ink); box-shadow: 2px 2px 0 var(--ink);
  font-weight: 800; font-size: .76rem; white-space: nowrap;
  transition: opacity .35s, background .2s; will-change: transform;
}
.lbl::after { content: ""; position: absolute; left: 50%; bottom: -8px; width: 2px; height: 6px; background: var(--ink); transform: translateX(-50%); }
.lbl.is-hover { background: var(--amber); }
.lbl-day { background: var(--mint); }
.lbl.is-hidden, .is-focus .lbl, .is-tour .lbl, .is-loading .lbl { opacity: 0; pointer-events: none; }

/* ---------- Panel de estación ---------- */
.panel {
  position: fixed; z-index: 40; top: 84px; right: 18px; bottom: 18px;
  width: min(450px, calc(100vw - 36px));
  background: var(--paper); border: 3px solid var(--ink); border-radius: 20px; box-shadow: 6px 6px 0 var(--ink);
  overflow-y: auto; overscroll-behavior: contain;
  transform: translateX(calc(100% + 40px)); visibility: hidden;
  transition: transform .6s var(--ease), visibility 0s linear .6s;
}
.panel:focus { outline: none; }
.panel.is-open { transform: none; visibility: visible; transition: transform .6s var(--ease), visibility 0s; }
.panel-close {
  position: sticky; top: 12px; float: right; margin: 12px 12px 0 0; z-index: 2;
  width: 38px; height: 38px; border-radius: 50%; background: var(--paper);
  border: 2.5px solid var(--ink); box-shadow: 2px 2px 0 var(--ink); font-weight: 800;
}
.panel-body { padding: 26px 26px 28px; }
.p-num { color: var(--amber-d); margin-bottom: .45rem; }
.panel h2 { font-family: var(--serif); font-weight: 700; font-size: 1.95rem; line-height: 1.05; letter-spacing: -.02em; margin-bottom: 1rem; padding-right: 40px; }
.p-intro { color: #3c4652; margin-bottom: 1rem; }
.p-rows dt { font-family: var(--mono); font-size: .68rem; letter-spacing: .07em; text-transform: uppercase; color: #6b7480; margin-top: 1rem; }
.p-rows dd { margin-top: .2rem; }
.p-method { list-style: none; padding: 0; display: grid; gap: .55rem; }
.p-method li { background: var(--paper-2); border: 2px solid var(--ink); border-radius: 12px; padding: .7rem .85rem; }
.p-method li b { display: block; font-family: var(--mono); font-size: .68rem; letter-spacing: .07em; text-transform: uppercase; color: var(--amber-d); margin-bottom: .15rem; }
.p-tags { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: 1.1rem; }
.p-tags span { font-family: var(--mono); font-size: .68rem; padding: .22rem .55rem; border: 2px solid var(--ink); border-radius: 999px; background: #fff; }
.p-foot { margin-top: 1.1rem; font-size: .85rem; color: #6b7480; }
.p-block { padding: 1rem 0; border-top: 2px dashed rgba(20,26,34,.25); }
.p-block:first-of-type { border-top: 0; padding-top: 0; }
.p-block h3 { font-size: 1.02rem; margin-bottom: .3rem; line-height: 1.25; }
.p-sub { font-family: var(--serif); font-size: 1.2rem; margin: 1.6rem 0 .7rem; }
.p-tl { list-style: none; padding: 0 0 0 1rem; border-left: 3px solid var(--ink); display: grid; gap: 1rem; }
.p-tl li { position: relative; }
.p-tl li::before { content: ""; position: absolute; left: calc(-1rem - 8px); top: .35rem; width: 13px; height: 13px; border-radius: 50%; background: var(--amber); border: 2.5px solid var(--ink); }
.p-tl .y { font-family: var(--mono); font-size: .7rem; color: var(--amber-d); }
.p-tl h3 { font-size: .98rem; line-height: 1.3; }
.p-tl p { font-size: .9rem; color: #3c4652; }
.is-pending { opacity: .55; font-style: italic; }
.p-creds { list-style: none; padding: 0; display: grid; gap: .45rem; font-size: .92rem; }
.p-creds li { display: grid; grid-template-columns: 4.2rem 1fr; gap: .5rem; }
.p-creds .y { font-family: var(--mono); font-size: .72rem; color: var(--amber-d); padding-top: .15rem; }
.p-stack { display: grid; gap: .6rem; font-size: .9rem; }
.p-stack b { display: block; font-family: var(--mono); font-size: .68rem; text-transform: uppercase; letter-spacing: .07em; }
.p-contact { display: grid; gap: .6rem; margin-top: .4rem; }
.p-contact a { display: grid; gap: .1rem; padding: .85rem 1rem; border: 2.5px solid var(--ink); border-radius: 14px; background: #fff; box-shadow: var(--hard); transition: transform .25s var(--ease); word-break: break-word; }
.p-contact a:hover { transform: translate(-1px,-1px); }
.p-contact a.main { background: var(--amber); }
.p-contact small { font-family: var(--mono); font-size: .66rem; letter-spacing: .07em; text-transform: uppercase; }
.p-nav { display: flex; justify-content: space-between; gap: .5rem; margin-top: 1.8rem; padding-top: 1.1rem; border-top: 2px solid var(--ink); }
.p-nav .pill { font-size: .8rem; }

/* ---------- Tour "Un día" ---------- */
.tour {
  position: fixed; z-index: 35; left: 50%; bottom: 22px;
  width: min(560px, calc(100vw - 24px));
  background: var(--paper); border: 3px solid var(--ink); border-radius: 20px; box-shadow: 6px 6px 0 var(--ink);
  padding: 18px 20px 16px;
  transform: translate(-50%, calc(100% + 60px)); visibility: hidden;
  transition: transform .6s var(--ease), visibility 0s linear .6s;
}
.is-tour .tour { transform: translate(-50%, 0); visibility: visible; transition: transform .6s var(--ease), visibility 0s; }
.tour-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.tour-time { font-family: var(--serif); font-weight: 700; font-size: 2.1rem; line-height: 1; }
.tour-dots { display: flex; gap: 5px; }
.tour-dots i { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--ink); background: #fff; }
.tour-dots i.on { background: var(--amber); }
.tour-what { font-weight: 800; font-size: 1.05rem; margin-top: .45rem; }
.tour-detail { color: #3c4652; margin-top: .2rem; min-height: 3em; }
.tour-actions { display: flex; gap: .5rem; margin-top: .8rem; flex-wrap: wrap; }
.tour-progress { height: 4px; background: var(--ink); border-radius: 2px; margin-top: 12px; transform-origin: left; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; z-index: 50; left: 50%; top: 86px; transform: translate(-50%, -20px);
  background: var(--paper); border: 2.5px solid var(--ink); border-radius: 14px; box-shadow: var(--hard);
  padding: .65rem 1rem; font-weight: 700; max-width: calc(100vw - 32px); text-align: center;
  opacity: 0; pointer-events: none; transition: opacity .3s, transform .4s var(--ease);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Loader / fallback ---------- */
.loader, .fallback {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(ellipse at 50% 40%, #29425a, #0b131b 75%);
  transition: opacity .6s, visibility 0s linear .6s;
}
.fallback[hidden] { display: none; }
.loader.is-done { opacity: 0; visibility: hidden; }
.loader-card {
  background: var(--paper); border: 3px solid var(--ink); border-radius: 20px; box-shadow: 6px 6px 0 var(--ink);
  padding: 22px 24px; width: min(420px, 100%); display: grid; gap: .8rem;
}
.loader-card .mono { color: var(--amber-d); }
.loader-title { font-family: var(--serif); font-weight: 700; font-size: 1.4rem; line-height: 1.15; }
.loader-bar { height: 16px; border: 2.5px solid var(--ink); border-radius: 999px; overflow: hidden; background: #fff; }
.loader-bar span { display: block; height: 100%; width: 6%; background: repeating-linear-gradient(45deg, var(--amber) 0 10px, #ffd38a 10px 20px); transition: width .4s var(--ease); }
.loader-skip { font-size: .85rem; text-decoration: underline; color: #5b6573; }

/* ---------- Móvil ---------- */
@media (max-width: 719px) {
  .ws-top { padding: 10px; gap: .5rem; align-items: flex-start; }
  .ws-brand { padding: .35rem .7rem .35rem .55rem; border-radius: 14px; }
  .ws-brand strong { font-size: .92rem; }
  .ws-brand small { display: none; }
  .hide-s { display: none; }
  .show-s { display: inline; }
  .ws-actions { gap: .35rem; }
  .ws-actions .pill { padding: .38rem .62rem; font-size: .76rem; box-shadow: 2px 2px 0 var(--ink); }
  .ws-hint { display: none; }
  .is-focus .pill-express, .is-tour .pill-express { display: none; }
  .chips { left: 0; right: 0; transform: none; max-width: none; padding: 4px 12px 10px; bottom: 10px; }
  .is-focus .chips, .is-tour .chips { transform: translateY(20px); }
  .lbl { font-size: .66rem; padding: .2rem .5rem; }
  .panel {
    top: auto; left: 10px; right: 10px; bottom: 10px; width: auto; height: 58vh; height: 58dvh;
    border-radius: 20px 20px 18px 18px; transform: translateY(calc(100% + 40px));
  }
  .panel-body { padding: 18px 18px 22px; }
  .panel h2 { font-size: 1.55rem; }
  .tour { bottom: 10px; padding: 14px 16px 12px; }
  .tour-time { font-size: 1.7rem; }
}

@media (prefers-reduced-motion: reduce) {
  .ws-led { animation: none; }
}
