:root {
    --bg: #ffffff;
    --ink: #111827;
    --muted: #5b6472;
    --line: #e5e7eb;
    --soft: #f8fafc;
    --green: #16a34a;
    --yellow: #facc15;
    --red: #dc2626;
    --blue: #2563eb;
    --shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
}

* {
    box-sizing: border-box;
}

html {
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

body {
    margin: 0;
    background: var(--bg);
}

a {
    color: inherit;
    text-decoration: none;
}

.site-header,
.site-footer,
.section {
    width: min(1120px, calc(100% - 32px));
    margin-inline: auto;
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 24px 0 18px;
    border-bottom: 1px solid var(--line);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    letter-spacing: 0;
}

.brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: #1856c9;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.brand-mark svg {
    width: 20px;
    height: 18px;
    display: block;
}

.brand-word {
    display: inline-flex;
    align-items: baseline;
    letter-spacing: -0.02em;
}

.brand-tld {
    color: #1856c9;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 2px;
}

.nav-link,
.nav-parent {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 9px 14px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--muted);
    background: none;
    border: 1px solid transparent;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    transition: background 150ms ease, color 150ms ease;
}

.nav-link:hover,
.nav-parent:hover {
    background: var(--soft);
    color: var(--ink);
}

.nav-link.is-active,
.nav-item.is-current > .nav-parent {
    background: var(--ink);
    color: #ffffff;
}

.nav-item {
    position: relative;
}

.nav-caret {
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid currentColor;
    opacity: 0.75;
}

.nav-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 190px;
    flex-direction: column;
    gap: 2px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 6px;
    z-index: 40;
}

.nav-dropdown a {
    padding: 9px 12px;
    border-radius: 9px;
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--ink);
    white-space: nowrap;
    transition: background 150ms ease, color 150ms ease;
}

.nav-dropdown a:hover {
    background: var(--soft);
}

.nav-dropdown a.is-active {
    background: #1856c9;
    color: #ffffff;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 46px;
    height: 40px;
    padding: 0 11px;
    background: none;
    border: 1px solid var(--line);
    border-radius: 10px;
    cursor: pointer;
}

.nav-toggle span {
    display: block;
    height: 2px;
    width: 100%;
    background: var(--ink);
    border-radius: 2px;
}

@media (min-width: 861px) {
    .nav-item:hover > .nav-dropdown,
    .nav-item:focus-within > .nav-dropdown,
    .nav-item.is-open > .nav-dropdown {
        display: flex;
    }
}

@media (max-width: 860px) {
    .site-header {
        position: relative;
    }

    .nav-toggle {
        display: inline-flex;
    }

    .site-header .source {
        display: none;
    }

    .site-nav {
        display: none;
        position: absolute;
        top: calc(100% + 6px);
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
        background: var(--bg);
        border: 1px solid var(--line);
        border-radius: 14px;
        box-shadow: var(--shadow);
        padding: 10px;
        z-index: 50;
    }

    .site-header.nav-open .site-nav {
        display: flex;
    }

    .nav-link,
    .nav-parent {
        width: 100%;
        justify-content: space-between;
        border-radius: 10px;
        font-size: 1rem;
    }

    .nav-item {
        position: static;
    }

    .nav-dropdown {
        display: none;
        position: static;
        min-width: 0;
        border: none;
        box-shadow: none;
        border-radius: 0;
        padding: 2px 0 6px 14px;
    }

    .nav-item.is-open > .nav-dropdown {
        display: flex;
    }
}

.source {
    display: flex;
    align-items: flex-end;
    flex-direction: column;
    gap: 2px;
    color: var(--muted);
    font-size: 0.9rem;
    text-align: right;
}

.hero-compact {
    align-items: start;
}

.metrics.metrics-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 560px) {
    .metrics.metrics-3 {
        grid-template-columns: 1fr;
    }
}

.region-switch-section {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 14px;
    padding-top: 8px;
    padding-bottom: 8px;
}

.region-switch-label {
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 600;
}

.region-switch {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.region-switch a {
    padding: 7px 14px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--ink);
    background: var(--soft);
    border: 1px solid var(--line);
    transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
}

.region-switch a:hover {
    border-color: #1856c9;
    color: #1856c9;
}

.region-switch a.is-active {
    background: #1856c9;
    border-color: #1856c9;
    color: #ffffff;
}

/* Landings de día: aviso de estado + cuenta atrás */
.day-status {
    margin-top: 18px;
    padding: 16px 18px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: var(--soft);
    max-width: 620px;
}

.day-status-pending {
    border-color: #fcd34d;
    background: #fffbeb;
}

.day-status-ready {
    border-color: #86efac;
    background: #f0fdf4;
}

.day-status-headline {
    margin: 0 0 4px;
    font-weight: 800;
    font-size: 1.05rem;
    color: var(--ink);
}

.day-status-text {
    margin: 0;
    color: var(--muted);
    font-size: 0.95rem;
}

.countdown {
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.countdown-label {
    font-size: 0.85rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 700;
}

.countdown-timer {
    font-size: clamp(2rem, 6vw, 2.8rem);
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0.01em;
    color: #b45309;
    font-variant-numeric: tabular-nums;
}

.countdown.is-publishing .countdown-timer {
    font-size: 1.4rem;
    color: var(--green);
}

/* Tabla de histórico por día */
.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 520px;
    font-size: 0.96rem;
}

.history-table thead th {
    text-align: left;
    background: var(--soft);
    color: var(--muted);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
}

.history-table tbody th,
.history-table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

.history-table tbody tr:last-child th,
.history-table tbody tr:last-child td {
    border-bottom: none;
}

.history-table tbody th {
    text-align: left;
    font-weight: 700;
    color: var(--ink);
}

.history-table .cell-strong {
    display: block;
    font-weight: 700;
}

.history-table .cell-sub {
    display: block;
    font-size: 0.82rem;
    color: var(--muted);
}

.is-cheap-text {
    color: var(--green);
}

.is-expensive-text {
    color: var(--red);
}

/* Cuadrícula de precios por hora (celdas del mismo tamaño, color por tramo) */
.hours-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 50px 8px;
    padding-top: 52px;
    margin-top: 4px;
}

.hour-cell {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.hour-cell-box {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: clamp(0.8rem, 1.6vw, 1.05rem);
    line-height: 1;
    transition: transform 120ms ease, box-shadow 120ms ease;
}

.hour-cell.is-cheap .hour-cell-box {
    background: var(--green);
    color: #ffffff;
}

.hour-cell.is-average .hour-cell-box {
    background: var(--yellow);
    color: #3a2f00;
}

.hour-cell.is-expensive .hour-cell-box {
    background: var(--red);
    color: #ffffff;
}

.hour-cell-price::after {
    content: '';
}

.hour-cell-time {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

/* Hora actual: celda resaltada + badge "Ahora" */
.hour-cell.is-now .hour-cell-box {
    transform: scale(1.08);
    box-shadow: 0 0 0 3px var(--bg), 0 0 0 6px #1856c9, 0 10px 24px rgba(24, 86, 201, 0.28);
}

.hour-cell.is-now .hour-cell-time {
    color: #1856c9;
    font-weight: 800;
}

.hour-now-badge {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 9px);
    transform: translateX(-50%);
    z-index: 5;
    background: #1856c9;
    color: #ffffff;
    border-radius: 10px;
    padding: 6px 12px;
    white-space: nowrap;
    text-align: center;
    box-shadow: 0 10px 24px rgba(24, 86, 201, 0.32);
    display: flex;
    flex-direction: column;
    gap: 1px;
    line-height: 1.15;
}

.hour-now-badge::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #1856c9;
}

.hour-now-top {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.hour-now-price {
    font-size: 0.9rem;
    font-weight: 800;
}

@media (max-width: 900px) {
    .hours-grid {
        grid-template-columns: repeat(8, 1fr);
    }
}

@media (max-width: 560px) {
    .hours-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 50px 6px;
    }

    .hour-cell-box {
        border-radius: 10px;
    }
}

@media (max-width: 340px) {
    .hours-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Reloj radial de 24 horas */
.clock-section {
    align-items: center;
}

.hero-clock {
    display: flex;
    justify-content: center;
    align-items: center;
}

.price-clock {
    width: min(380px, 100%);
    margin: 0 auto;
}

.price-clock-svg {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
}

.clock-seg {
    cursor: pointer;
    transition: opacity 150ms ease;
}

.clock-seg.is-now {
    stroke: var(--ink);
    stroke-width: 3;
    paint-order: stroke;
}

.clock-seg.is-active {
    stroke: #1856c9;
    stroke-width: 3;
    paint-order: stroke;
}

.clock-tick {
    fill: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-anchor: middle;
    dominant-baseline: middle;
}

.clock-hand {
    stroke: var(--ink);
    stroke-width: 4;
    stroke-linecap: round;
}

.clock-hub {
    fill: var(--bg);
    stroke: var(--line);
    stroke-width: 1.5;
}

.clock-pin {
    fill: var(--ink);
}

.clock-c-label {
    fill: #1856c9;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-anchor: middle;
}

.clock-c-range {
    fill: var(--ink);
    font-size: 15px;
    font-weight: 800;
    text-anchor: middle;
}

.clock-c-price {
    fill: var(--ink);
    font-size: 30px;
    font-weight: 800;
    text-anchor: middle;
}

.clock-c-unit {
    fill: var(--muted);
    font-size: 13px;
    font-weight: 700;
    text-anchor: middle;
}

.empty-note {
    border: 1px dashed var(--line);
    border-radius: 8px;
    padding: 32px;
    text-align: center;
    color: var(--muted);
}

.source span {
    color: var(--ink);
    font-weight: 700;
}

.live-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--green) !important;
    font-weight: 800;
    font-size: 0.82rem;
}

.live-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--green);
    box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.6);
    animation: live-pulse 1.6s ease-out infinite;
}

@keyframes live-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.55);
    }
    70% {
        box-shadow: 0 0 0 8px rgba(22, 163, 74, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(22, 163, 74, 0);
    }
}

.section {
    padding: 48px 0;
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 0.95fr) minmax(420px, 1.05fr);
    gap: 42px;
    align-items: center;
}

.hero-copy {
    max-width: 640px;
}

.eyebrow {
    margin: 0 0 10px;
    color: var(--blue);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    overflow-wrap: anywhere;
}

h1 {
    margin: 0;
    max-width: 760px;
    font-size: 5rem;
    line-height: 0.96;
    letter-spacing: 0;
}

h2 {
    margin: 0;
    font-size: 2.25rem;
    line-height: 1.08;
    letter-spacing: 0;
}

.lead {
    margin: 22px 0 0;
    max-width: 640px;
    color: var(--muted);
    font-size: 1.12rem;
}

.metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.metric-card,
.gauge-card,
details {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
}

.metric-card {
    min-height: 150px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: var(--shadow);
}

.metric-card-main {
    background: var(--ink);
    color: #ffffff;
}

.metric-card span {
    color: inherit;
    font-size: 0.88rem;
    font-weight: 800;
    text-transform: uppercase;
}

.metric-card strong {
    display: block;
    margin: 12px 0 8px;
    font-size: 2.2rem;
    line-height: 1;
}

.metric-card small {
    color: var(--muted);
    font-size: 0.92rem;
}

.metric-card-main small {
    color: rgba(255, 255, 255, 0.72);
}

.section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 22px;
}

.legend {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 12px;
    color: var(--muted);
    font-size: 0.9rem;
}

.legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    display: inline-block;
}

.is-cheap {
    background: var(--green);
}

.is-average {
    background: var(--yellow);
}

.is-expensive {
    background: var(--red);
}

.chart-wrap {
    position: relative;
    width: 100%;
    height: 430px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: linear-gradient(180deg, #ffffff, var(--soft));
    padding: 18px;
}

.chart-wrap-mobile {
    display: none;
    height: 620px;
}

.price-chart {
    width: 100%;
    height: 100%;
    display: block;
}

.chart-note,
.content-section p,
.faq-section p {
    color: var(--muted);
    font-size: 1.02rem;
}

.chart-note {
    max-width: 900px;
    margin: 18px 0 0;
}

.gauges {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.gauge-card {
    min-height: 280px;
    padding: 24px;
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) 210px;
    align-items: center;
    gap: 20px;
    overflow: hidden;
}

.gauge-copy strong {
    display: block;
    margin-top: 12px;
    font-size: 1.65rem;
}

.gauge-meter {
    position: relative;
    width: 210px;
    height: 112px;
    align-self: end;
    background:
        radial-gradient(circle at 50% 100%, #ffffff 0 44%, transparent 45%),
        conic-gradient(from 270deg at 50% 100%, var(--green) 0 54deg, var(--yellow) 54deg 126deg, var(--red) 126deg 180deg, transparent 180deg);
    border-radius: 210px 210px 0 0;
}

.gauge-meter::after {
    content: "";
    position: absolute;
    inset: 15px 15px 0;
    border-radius: 180px 180px 0 0;
    border: 1px solid rgba(17, 24, 39, 0.12);
    border-bottom: 0;
}

.gauge-needle {
    position: absolute;
    left: 50%;
    bottom: 0;
    width: 4px;
    height: 92px;
    border-radius: 999px;
    background: var(--ink);
    transform: translateX(-50%) rotate(-90deg);
    transform-origin: 50% 100%;
    transition: transform 400ms ease;
    z-index: 2;
}

.gauge-center {
    position: absolute;
    left: 50%;
    bottom: -6px;
    width: 20px;
    height: 20px;
    transform: translateX(-50%);
    border-radius: 999px;
    background: var(--ink);
    z-index: 3;
}

.content-section {
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.content-section h2,
.faq-section h2 {
    margin-bottom: 18px;
}

.content-section p {
    max-width: 880px;
}

.faq-list {
    display: grid;
    gap: 12px;
}

details {
    padding: 18px 20px;
}

summary {
    cursor: pointer;
    font-weight: 800;
}

details p {
    margin: 12px 0 0;
}

.site-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 28px 0 36px;
    color: var(--muted);
    border-top: 1px solid var(--line);
    font-size: 0.92rem;
}

.footer-links {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px 16px;
    font-weight: 700;
}

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

.footer-links a:hover {
    color: var(--blue);
}

.legal-hero {
    max-width: 900px;
}

.legal-hero h1 {
    font-size: 4rem;
}

.legal-article {
    max-width: 920px;
    padding-top: 8px;
}

.legal-section {
    padding: 30px 0;
    border-top: 1px solid var(--line);
}

.legal-section h2 {
    margin-bottom: 14px;
    font-size: 1.65rem;
}

.legal-section p,
.legal-section li,
.legal-data dd {
    color: var(--muted);
    font-size: 1.02rem;
}

.legal-section p {
    max-width: 860px;
}

.legal-section a {
    color: var(--blue);
    font-weight: 700;
}

.legal-data {
    display: grid;
    gap: 0;
    margin: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

.legal-data div {
    display: grid;
    grid-template-columns: minmax(140px, 0.32fr) minmax(0, 1fr);
    gap: 18px;
    padding: 16px 18px;
    background: #ffffff;
}

.legal-data div + div {
    border-top: 1px solid var(--line);
}

.legal-data dt {
    color: var(--ink);
    font-weight: 800;
}

.legal-data dd {
    margin: 0;
}

.legal-list {
    margin: 0;
    padding-left: 22px;
}

.legal-list li + li {
    margin-top: 8px;
}

@media (max-width: 768px) {
    .chart-wrap-desktop {
        display: none;
    }

    .chart-wrap-mobile {
        display: block;
    }
}

@media (max-width: 900px) {
    h1 {
        font-size: 4rem;
    }

    h2 {
        font-size: 2rem;
    }

    .hero {
        grid-template-columns: 1fr;
    }

    .section-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .legend {
        justify-content: flex-start;
    }

    .gauges {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 680px) {
    h1 {
        font-size: 3rem;
    }

    h2 {
        font-size: 1.65rem;
    }

    .site-header,
    .site-footer,
    .section {
        width: min(100% - 24px, 1120px);
    }

    .site-footer {
        align-items: flex-start;
        flex-direction: column;
    }

    .footer-links {
        justify-content: flex-start;
    }

    .source {
        align-items: flex-start;
        text-align: left;
    }

    .section {
        padding: 34px 0;
    }

    .metrics {
        grid-template-columns: 1fr;
    }

    .metric-card {
        min-height: 128px;
    }

    .metric-card strong {
        font-size: 1.65rem;
    }

    .legal-hero h1 {
        font-size: 2.75rem;
    }

    .legal-data div {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .gauge-card {
        min-height: 250px;
        grid-template-columns: 1fr 150px;
        padding: 18px;
    }

    .gauge-meter {
        width: 150px;
        height: 80px;
    }

    .gauge-needle {
        height: 66px;
    }
}

@media (max-width: 430px) {
    h1 {
        font-size: 2.45rem;
    }

    .gauge-card {
        grid-template-columns: 1fr;
    }

    .gauge-meter {
        justify-self: center;
    }
}
