/* ============================================================================
   Espacios3D Studio · Layout propio del producto · STUDIO-UI-001
   Estructura de las vistas (bienvenida, proyectos, asistente) y del editor de
   tres paneles. Todo sobre los tokens del DS; aquí no se define ningún color
   nuevo fuera de la escena 3D.
   ============================================================================ */

/* ---------- Shell ---------- */
.app-root { min-height: 100vh; display: flex; flex-direction: column; }
.app-root > main { flex: 1; }
.view-enter { animation: view-in var(--dur-slow) var(--ease-out); }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.appbar .navlinks { display: flex; gap: var(--space-1); margin-left: var(--space-4); }
.appbar .navlinks a { color: var(--text-2); font-size: var(--fs-sm); font-weight: 500; padding: 8px 12px; border-radius: var(--radius-md); }
.appbar .navlinks a:hover { color: var(--text); background: var(--gray-50); text-decoration: none; }
.appbar .navlinks a.active { color: var(--text); background: var(--gray-50); }
.version-chip { font-size: var(--fs-overline); font-weight: 600; letter-spacing: .04em; color: var(--text-2);
  border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 4px 10px; }

/* ---------- Bienvenida ---------- */
.welcome { padding-top: var(--space-20); padding-bottom: var(--space-16); }
.hero { text-align: center; max-width: 760px; margin: 0 auto; }
.hero h1 { font-size: var(--fs-display); line-height: var(--lh-display); letter-spacing: var(--ls-display);
  font-weight: 800; margin: var(--space-4) 0 var(--space-5); }
.hero h1 .grad { background: linear-gradient(92deg, #8fb0ff, var(--accent) 55%, #6d99ff);
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero .lead { font-size: var(--fs-lg); line-height: var(--lh-lg); color: var(--text-2); max-width: 620px; margin: 0 auto var(--space-8); }
.hero .btn-row { justify-content: center; }
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-5); margin-top: var(--space-20); }
.feature { text-align: left; }
.feature .ico { width: 44px; height: 44px; border-radius: var(--radius-md); background: var(--accent-50);
  color: var(--accent-text); display: grid; place-items: center; margin-bottom: var(--space-4); }
.feature .ico svg { width: 22px; height: 22px; }
.feature h3 { font-size: var(--fs-h4); font-weight: 700; margin-bottom: var(--space-2); }
.feature p { color: var(--text-2); font-size: var(--fs-sm); line-height: 1.55; }
.feature .step { display: inline-block; font-size: var(--fs-overline); font-weight: 700; letter-spacing: .08em;
  color: var(--accent-text); margin-bottom: var(--space-2); }

/* ---------- Proyectos ---------- */
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--space-5); }
.proj-card { display: flex; flex-direction: column; gap: var(--space-4); padding: var(--space-5);
  transition: transform var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out), border-color var(--dur) var(--ease); }
.proj-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md), var(--ring-inset); border-color: var(--border-strong); }
.proj-plan { height: 130px; border-radius: var(--radius-md); background: var(--gray-25); border: 1px solid var(--border);
  display: grid; place-items: center; overflow: hidden; }
.proj-plan svg { width: 100%; height: 100%; }
.proj-card h3 { font-size: var(--fs-h4); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-meta { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; color: var(--text-2); font-size: var(--fs-sm); }
.proj-meta .dot::before { content: "·"; margin: 0 2px; color: var(--text-3); }
.proj-actions { display: flex; align-items: center; gap: var(--space-2); margin-top: auto; }
.proj-actions .spacer { flex: 1; }
.menu-wrap { position: relative; }
.menu-wrap .menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; display: none; }
.menu-wrap.open .menu { display: block; animation: pop var(--dur-fast) var(--ease-out); }
.empty-state { text-align: center; padding: var(--space-20) var(--space-6); }
.empty-state .ico { width: 64px; height: 64px; border-radius: var(--radius-lg); background: var(--accent-50);
  color: var(--accent-text); display: grid; place-items: center; margin: 0 auto var(--space-5); }
.empty-state .ico svg { width: 30px; height: 30px; }
.empty-state h2 { font-size: var(--fs-h3); font-weight: 700; margin-bottom: var(--space-2); }
.empty-state p { color: var(--text-2); max-width: 460px; margin: 0 auto var(--space-6); }

/* ---------- Asistente de nueva exposición ---------- */
.wizard { max-width: 880px; margin: 0 auto; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--space-5); margin: var(--space-4) 0 var(--space-8); }
.tpl-card { cursor: pointer; padding: var(--space-4); border: 1.5px solid var(--border); border-radius: var(--radius-lg);
  background: var(--surface); transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease-out); }
.tpl-card:hover { transform: translateY(-2px); border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.tpl-card.selected { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(76, 130, 255, .22), var(--shadow-md); }
.tpl-card .proj-plan { height: 150px; margin-bottom: var(--space-4); }
.tpl-card h3 { font-size: var(--fs-h4); font-weight: 700; display: flex; align-items: center; gap: 8px; }
.tpl-card h3 .sel { margin-left: auto; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--border-strong);
  display: grid; place-items: center; color: #fff; flex: 0 0 auto; }
.tpl-card.selected h3 .sel { background: var(--accent); border-color: var(--accent); }
.tpl-card h3 .sel svg { width: 13px; height: 13px; opacity: 0; }
.tpl-card.selected h3 .sel svg { opacity: 1; }
.tpl-card p { color: var(--text-2); font-size: var(--fs-sm); margin: 6px 0 10px; }
.tpl-stats { color: var(--text-3); font-size: var(--fs-overline); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }

/* ---------- Editor (tres paneles) ---------- */
.editor { position: fixed; inset: 0; display: grid; grid-template-rows: 58px 1fr;
  grid-template-columns: 300px minmax(0, 1fr) 320px;
  grid-template-areas: "top top top" "left canvas right"; background: var(--bg); }
.ed-top { grid-area: top; display: flex; align-items: center; gap: var(--space-3); padding: 0 var(--space-4);
  background: var(--surface); border-bottom: 1px solid var(--border); }
.ed-top .brand { font-size: var(--fs-sm); }
.ed-top .brand .mark { width: 24px; height: 24px; border-radius: 7px; }
.ed-top .brand .mark svg { width: 14px; height: 14px; }
.ed-sep { width: 1px; height: 24px; background: var(--border); }
.ed-name { font: inherit; font-size: var(--fs-body); font-weight: 600; color: var(--text); background: transparent;
  border: 1px solid transparent; border-radius: var(--radius-sm); padding: 6px 10px; min-width: 120px; max-width: 320px; }
.ed-name:hover { border-color: var(--border); }
.ed-name:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus-ring); background: var(--surface-2); }
.ed-saved { font-size: var(--fs-overline); font-weight: 600; letter-spacing: .03em; color: var(--text-3); white-space: nowrap; }
.ed-saved.saving { color: var(--warning); }
.ed-saved.saved { color: var(--success); }
.ed-top .spacer { flex: 1; }
.ed-actions { display: flex; align-items: center; gap: var(--space-2); }

.ed-left, .ed-right { background: var(--surface); overflow-y: auto; overflow-x: hidden; }
.ed-left { grid-area: left; border-right: 1px solid var(--border); }
.ed-right { grid-area: right; border-left: 1px solid var(--border); }
.ed-panel { padding: var(--space-4); }
.ed-panel-head { font-size: var(--fs-overline); font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--text-2); padding: var(--space-4) var(--space-4) var(--space-2); display: flex; align-items: center; gap: 8px; }
.ed-panel-head .count { margin-left: auto; color: var(--text-3); font-weight: 600; letter-spacing: 0; }

/* Panel de recursos */
.dropzone--slim { padding: var(--space-5) var(--space-4); margin: 0 var(--space-4) var(--space-4); }
.dropzone--slim .ico { width: 38px; height: 38px; margin-bottom: var(--space-2); border-radius: var(--radius-md); }
.dropzone--slim .ico svg { width: 19px; height: 19px; }
.dropzone--slim strong { font-size: var(--fs-sm); }
.dropzone--slim small { font-size: var(--fs-overline); }
.asset-list { display: flex; flex-direction: column; gap: 6px; padding: 0 var(--space-4) var(--space-4); }
.asset-item { display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--border);
  border-radius: var(--radius-md); background: var(--surface-2); cursor: grab; user-select: none;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), transform var(--dur-fast) var(--ease-out); }
.asset-item:hover { border-color: var(--border-strong); background: var(--gray-50); }
.asset-item:active { cursor: grabbing; }
.asset-item.dragging { opacity: .45; }
.asset-item.placed-all { }
.asset-thumb { width: 44px; height: 44px; border-radius: var(--radius-sm); background: var(--gray-25); border: 1px solid var(--border);
  display: grid; place-items: center; color: var(--text-2); overflow: hidden; flex: 0 0 auto; }
.asset-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.asset-thumb svg { width: 20px; height: 20px; }
.asset-info { min-width: 0; flex: 1; }
.asset-info .name { font-size: var(--fs-sm); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-info .meta { font-size: var(--fs-overline); color: var(--text-3); margin-top: 2px; }
.asset-item .icon-btn { width: 30px; height: 30px; border-radius: var(--radius-sm); flex: 0 0 auto; opacity: 0; }
.asset-item:hover .icon-btn { opacity: 1; }
.asset-item .icon-btn svg { width: 15px; height: 15px; }
.panel-hint { font-size: var(--fs-sm); color: var(--text-3); padding: 0 var(--space-4) var(--space-4); line-height: 1.5; }

/* Lienzo central */
.ed-canvas { grid-area: canvas; position: relative; min-width: 0; background: #0a1128; }
.ed-canvas canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; outline: none; }
.ed-canvas.dropping::after { content: ""; position: absolute; inset: 10px; border: 2px dashed rgba(76, 130, 255, .55);
  border-radius: var(--radius-lg); pointer-events: none; }
.hud-hint { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 5;
  background: rgba(7, 13, 31, .78); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border); color: var(--text-2); font-size: var(--fs-sm); font-weight: 500;
  padding: 9px 16px; border-radius: var(--radius-pill); white-space: nowrap; pointer-events: none;
  transition: opacity var(--dur) var(--ease); }
.hud-hint.hidden { opacity: 0; }
.hud-hint b { color: var(--text); font-weight: 600; }
.hud-hint kbd { font-family: var(--font-mono); font-size: .78em; background: var(--gray-50); border: 1px solid var(--border-strong);
  border-radius: 5px; padding: 1px 6px; color: var(--text); }

/* Panel de propiedades */
.props-empty { padding: var(--space-4); }
.props-block { padding: var(--space-2) var(--space-4) var(--space-4); }
.props-block .field label { color: var(--text-2); }
.props-kv { display: flex; justify-content: space-between; gap: var(--space-3); padding: 9px 0; border-bottom: 1px solid var(--border);
  font-size: var(--fs-sm); }
.props-kv:last-child { border-bottom: 0; }
.props-kv .k { color: var(--text-2); }
.props-kv .v { font-weight: 600; text-align: right; }
.slot-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: var(--space-2); }
.type-head { display: flex; align-items: center; gap: 10px; padding: var(--space-4); border-bottom: 1px solid var(--border); }
.type-head .ico { width: 36px; height: 36px; border-radius: var(--radius-md); background: var(--accent-50); color: var(--accent-text);
  display: grid; place-items: center; flex: 0 0 auto; }
.type-head .ico svg { width: 18px; height: 18px; }
.type-head .t { min-width: 0; }
.type-head .t b { display: block; font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.type-head .t span { font-size: var(--fs-overline); color: var(--text-3); }

/* Modo pasear */
.walk-hint { position: absolute; left: 50%; top: 20px; transform: translateX(-50%); z-index: 6;
  background: rgba(7, 13, 31, .82); border: 1px solid var(--border); color: var(--text);
  font-size: var(--fs-sm); padding: 10px 18px; border-radius: var(--radius-pill); pointer-events: none; }
.walk-hint kbd { font-family: var(--font-mono); font-size: .78em; background: var(--gray-50); border: 1px solid var(--border-strong);
  border-radius: 5px; padding: 1px 6px; }
.crosshair { position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px; z-index: 6;
  border-radius: 50%; background: #fff; pointer-events: none;
  box-shadow: 0 0 0 2px rgba(7, 13, 31, .55), 0 0 14px rgba(76, 130, 255, .9); }

/* ---------- Asistente de publicación en Platform ---------- */
.pub-modal { max-width: 480px; }
.pub-body { min-height: 120px; }
.pub-lead { font-size: var(--fs-sm); color: var(--text-2); margin-bottom: var(--space-4); line-height: 1.55; }
.pub-lead b { color: var(--text); }
.pub-progress { padding: var(--space-4) 0 var(--space-2); }
.pub-progress .pub-lead { margin-bottom: var(--space-2); }
.pub-exito { text-align: center; padding-top: var(--space-2); }
.pub-check { width: 56px; height: 56px; margin: 0 auto var(--space-4); border-radius: 50%;
  background: var(--success-tint); color: var(--success); display: grid; place-items: center;
  border: 1px solid rgba(46, 196, 110, .35); }
.pub-exito h4 { font-size: var(--fs-h4); font-weight: 700; margin-bottom: var(--space-2); }
.pub-exito .small { margin-bottom: var(--space-4); }
.pub-url { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 10px 14px; margin-bottom: var(--space-5); overflow-wrap: anywhere; }
.pub-url code { background: none; border: 0; padding: 0; color: var(--accent-text); font-size: var(--fs-sm); }

/* ---------- Recorrido del visitante (paquete web exportado) ---------- */
.tour { position: fixed; inset: 0; background: #0a1128; }
.tour canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; outline: none; }
.portada { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: var(--space-6);
  background: rgba(5, 10, 26, .78); backdrop-filter: blur(9px); -webkit-backdrop-filter: blur(9px);
  animation: modal-in var(--dur-slow) var(--ease-out); }
.portada-card { text-align: center; max-width: 560px; }
.portada-card .brand { justify-content: center; margin-bottom: var(--space-8); }
.portada-card h1 { font-size: var(--fs-h1); line-height: var(--lh-h1); letter-spacing: var(--ls-h1);
  font-weight: 800; margin: var(--space-3) 0 var(--space-2); }
.portada-card .meta { color: var(--text-2); font-size: var(--fs-body); }
.portada-card .instr { color: var(--text-2); font-size: var(--fs-sm); line-height: 1.7;
  max-width: 440px; margin: var(--space-5) auto var(--space-6); }
.portada-card kbd { font-family: var(--font-mono); font-size: .8em; background: var(--gray-50);
  border: 1px solid var(--border-strong); border-radius: 5px; padding: 1px 6px; }
.portada-foot { margin-top: var(--space-8); font-size: var(--fs-overline); font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }

/* ---------- Ficha de obra (visor de detalle) ---------- */
.detail-back { position: fixed; inset: 0; z-index: 70; display: grid; grid-template-rows: minmax(0, 1fr) auto;
  background: rgba(3, 7, 18, .88); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  animation: modal-in var(--dur) var(--ease-out); }
.detail-close { position: absolute; top: 18px; right: 18px; z-index: 3; width: 42px; height: 42px; }
.detail-stage { position: relative; overflow: hidden; display: grid; place-items: center; padding: 48px 48px 8px; min-height: 0; }
.detail-img { max-width: 100%; max-height: 100%; box-shadow: var(--shadow-lg);
  transition: transform 90ms linear; user-select: none; touch-action: none; }
.detail-img.zoomed { cursor: grab; }
.detail-img.zoomed:active { cursor: grabbing; }
.detail-video { max-width: min(1100px, 92vw); max-height: 100%; box-shadow: var(--shadow-lg); background: #000; }
.detail-doc { width: min(960px, 94vw); height: 100%; border: 0; border-radius: var(--radius-md);
  background: #fff; box-shadow: var(--shadow-lg); }
.detail-audio { text-align: center; display: grid; gap: var(--space-5); justify-items: center; }
.detail-audio .big-ico { width: 96px; height: 96px; border-radius: var(--radius-xl); background: var(--accent-50);
  color: var(--accent-text); display: grid; place-items: center; }
.detail-audio audio { width: min(480px, 80vw); }
.detail-zoom { position: absolute; right: 20px; bottom: 16px; display: flex; gap: 6px; z-index: 3; }
.detail-zoom .icon-btn { background: rgba(13, 23, 49, .85); font-weight: 700; font-size: var(--fs-sm); color: var(--text); }
.detail-info { text-align: center; padding: var(--space-4) var(--space-6) var(--space-8); }
.detail-info .sub { font-size: var(--fs-overline); font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--accent-text); margin-bottom: 6px; }
.detail-info h2 { font-size: var(--fs-h3); font-weight: 700; letter-spacing: -.014em; }
.detail-info p { color: var(--text-2); max-width: 640px; margin: var(--space-2) auto 0; font-size: var(--fs-sm); line-height: 1.6; }

/* Responsive mínimo del editor (pensado para escritorio) */
@media (max-width: 1080px) {
  .editor { grid-template-columns: 260px minmax(0, 1fr) 280px; }
}
@media (max-width: 900px) {
  .features { grid-template-columns: 1fr; }
  .editor { grid-template-columns: 230px minmax(0, 1fr) 250px; }
}

/* Enlace de vuelta a la web corporativa (barra superior) */
.appbar .site-link { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-size: var(--fs-sm); font-weight: 500; padding: 7px 12px; border: 1px solid var(--border); border-radius: var(--radius-md); }
.appbar .site-link:hover { color: var(--text); background: var(--gray-50); text-decoration: none; }
.appbar .site-link svg { width: 15px; height: 15px; }
@media (max-width: 640px) { .appbar .site-link span { display: none; } .appbar .site-link { padding: 7px 9px; } }
