/* ── Reforma Interactiva Section ── */

.ri-section {
  background: #07111c;
  color: #d0e4f4;
  position: relative;
  height: 100vh;
  overflow: hidden;
}

.ri-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(56,189,248,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(56,189,248,0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  z-index: 0;
}

/* ── Full-viewport scene ── */
.ri-scene {
  position: relative;
  z-index: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 14px 16px 10px;
  gap: 0;
}

/* ── Top bar: title group + phase label + total ── */
.ri-topbar {
  width: min(92vw, 860px);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding-bottom: 8px;
  flex-shrink: 0;
}

.ri-title-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ri-intro-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(56, 189, 248, 0.65);
}

.ri-scene-title {
  font-family: 'Montserrat', sans-serif;
  font-size: clamp(1.15rem, 2.2vw, 1.75rem);
  font-weight: 700;
  color: #c8dff0;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.ri-phase-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 8px;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: rgba(208, 228, 244, 0.5);
  opacity: 0;
  transition: opacity 0.45s;
  min-height: 14px;
  align-self: flex-end;
}

.ri-phase-label.vis { opacity: 1; }

.ri-total-wrap { text-align: right; flex-shrink: 0; }

.ri-total-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 7px;
  letter-spacing: 3px;
  text-transform: uppercase;
  opacity: 0.4;
  display: block;
  margin-bottom: 1px;
}

.ri-total-amount {
  font-family: 'Montserrat', sans-serif;
  font-size: clamp(1.1rem, 2vw, 1.45rem);
  font-weight: 700;
  color: #fcd34d;
  letter-spacing: 0.04em;
  line-height: 1;
}

/* ── Progress bar ── */
.ri-progress {
  width: min(92vw, 860px);
  height: 2px;
  background: rgba(255,255,255,0.06);
  flex-shrink: 0;
  margin-bottom: 8px;
  border-radius: 1px;
  overflow: hidden;
}

.ri-progress-fill {
  height: 100%;
  background: linear-gradient(to right, #38bdf8, #fcd34d, #f87171, #4ade80);
  width: 0%;
  transition: width 0.08s linear;
}

/* ── Plan wrapper: width auto-caps so SVG never overflows viewport height ── */
.ri-plan-wrapper {
  position: relative;
  /* 800/540 ≈ 1.4815  →  largest width that still fits vertically */
  width: min(98vw, calc((100vh - 104px) * 1.4815));
  flex-shrink: 0;
}

#ri-floorplan {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 0 40px rgba(56,189,248,0.06));
}

/* ── SVG element styles ── */
.ri-w  { stroke: #8fafc8; stroke-width: 2;   fill: none; stroke-linejoin: round; stroke-linecap: round; }
.ri-wt { stroke: #8fafc8; stroke-width: 3;   fill: none; }
.ri-rf { fill: rgba(100,150,200,0.04); stroke: none; }
.ri-rl { font-size: 10px; fill: rgba(140,175,200,0.2); font-family:'IBM Plex Mono',monospace; text-anchor: middle; letter-spacing: 2px; }

.ri-sp  { stroke: #38bdf8; stroke-width: 2.5; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.ri-se  { stroke: #fcd34d; stroke-width: 2;   fill: none; stroke-linecap: round; stroke-dasharray: 8 4; }
.ri-sw  { stroke: #f87171; stroke-width: 6;   fill: none; stroke-linecap: butt; }
.ri-sd  { stroke: #4ade80; stroke-width: 2.2; fill: none; stroke-linecap: round; }
.ri-sdf { stroke: #4ade80; stroke-width: 2.2; fill: none; stroke-linecap: round; stroke-dasharray: 4 3; opacity: 0.5; }

.ri-fix-p { stroke: #38bdf8; stroke-width: 1.5; fill: rgba(56,189,248,0.08); }
.ri-fix-e { stroke: #fcd34d; stroke-width: 1.5; fill: rgba(252,211,77,0.08); }

.ri-sys-layer { opacity: 0; transition: opacity 0.2s; }

/* ── Price tags ── */
.ri-tag {
  position: absolute;
  background: rgba(7,17,28,0.96);
  border-width: 1px;
  border-style: solid;
  border-radius: 3px;
  padding: 7px 12px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  line-height: 1.55;
  opacity: 0;
  transform: translateY(7px) scale(0.93);
  transition: opacity 0.4s, transform 0.4s;
  pointer-events: none;
  white-space: nowrap;
  z-index: 50;
}

.ri-tag.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.ri-tag .pt-name {
  display: block;
  font-size: 9px;
  letter-spacing: 2px;
  text-transform: uppercase;
  opacity: 0.6;
  margin-bottom: 2px;
}

.ri-tag .pt-amount {
  display: block;
  font-family: 'Montserrat', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1.2;
}

.ri-tag .pt-desc {
  font-size: 10px;
  opacity: 0.55;
}

/* ── Legend bar ── */
.ri-legend {
  width: min(92vw, 860px);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(12px, 3vw, 40px);
  padding-top: 8px;
  flex-shrink: 0;
}

.ri-leg-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #d0e4f4;
  opacity: 0.22;
  transition: opacity 0.5s, transform 0.4s;
  transform: translateY(3px);
}

.ri-leg-item.active {
  opacity: 1;
  transform: translateY(0);
}

.ri-leg-dash {
  width: 26px;
  height: 3px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* ── Scroll hint ── */
.ri-scroll-hint {
  position: absolute;
  bottom: 1.2rem;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 7.5px;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: rgba(208,228,244,0.3);
  pointer-events: none;
  animation: ri-hint 2.6s ease-in-out infinite;
  z-index: 10;
  transition: opacity 0.4s;
}

@keyframes ri-hint {
  0%,100% { opacity: 0.1; transform: translateX(-50%) translateY(0); }
  50%      { opacity: 0.4; transform: translateX(-50%) translateY(5px); }
}

/* ── Summary bar: absolute at section bottom, slides up when complete ── */
.ri-summary {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0;
  background: rgba(7,17,28,0.97);
  border-top: 1px solid rgba(56,189,248,0.12);
  padding: 1rem 5%;
  opacity: 0;
  transform: translateY(100%);
  transition: opacity 0.55s, transform 0.55s cubic-bezier(0.22,1,0.36,1);
  pointer-events: none;
}

.ri-summary.vis {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.ri-sum-item {
  text-align: center;
  padding: 0.45rem 2rem;
  border-right: 1px solid rgba(255,255,255,0.06);
}

.ri-sum-item:last-child { border-right: none; }

.ri-sum-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 7px;
  letter-spacing: 3px;
  text-transform: uppercase;
  opacity: 0.4;
  display: block;
  margin-bottom: 2px;
}

.ri-sum-val {
  font-family: 'Montserrat', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.ri-sum-total {
  font-size: 1.2rem;
  color: #fcd34d !important;
}

/* ── Navbar hide when reforma section is active ── */
.site-header {
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

body.ri-viewing .site-header {
  transform: translateY(-110%);
  pointer-events: none;
}

/* ── Mobile Slider ────────────────────────────────────────────────── */
.ri-mobile-slider-wrap {
  display: none;
  padding: 10px 18px 14px;
  background: linear-gradient(135deg, rgba(176,141,87,0.10) 0%, rgba(176,141,87,0.03) 100%);
  border-bottom: 1px solid rgba(176,141,87,0.25);
  position: relative;
  z-index: 2;
}

.ri-slider-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 10px;
}

.ri-slider-arrow {
  color: #B08D57;
  flex-shrink: 0;
  animation: ri-arrow-bounce 1.4s ease-in-out infinite;
}

.ri-slider-arrow:first-child { animation-direction: reverse; }

@keyframes ri-arrow-bounce {
  0%, 100% { transform: translateX(0);  opacity: 1; }
  50%       { transform: translateX(4px); opacity: 0.55; }
}

.ri-slider-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.13em;
  color: #B08D57;
  text-transform: uppercase;
  text-align: center;
}

/* Track */
.ri-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(176,141,87,0.18);
  outline: none;
  cursor: pointer;
}

/* Thumb — WebKit */
.ri-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #B08D57;
  cursor: grab;
  border: 3px solid #07111c;
  box-shadow: 0 0 0 2px #B08D57, 0 4px 12px rgba(176,141,87,0.45);
  transition: transform 0.1s;
}
.ri-slider:active::-webkit-slider-thumb { cursor: grabbing; transform: scale(1.15); }

/* Thumb — Firefox */
.ri-slider::-moz-range-thumb {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #B08D57;
  cursor: grab;
  border: 3px solid #07111c;
  box-shadow: 0 0 0 2px #B08D57, 0 4px 12px rgba(176,141,87,0.45);
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .ri-mobile-slider-wrap { display: block; }
  /* Sequential tag carousel: suppress normal .show, only .ri-mobile-current is visible */
  .ri-tag.show          { opacity: 0;   transform: translateY(7px) scale(0.93); }
  .ri-tag.ri-mobile-current {
    opacity: 1 !important;
    transform: translateY(0) scale(1) !important;
  }
}

@media (max-width: 600px) {
  .ri-sum-item { padding: 0.4rem 0.8rem; }
}

@media (max-width: 400px) {
  .ri-leg-item { font-size: 6.5px; gap: 5px; }
  .ri-legend { gap: 8px; }
}
