/* Todo el Día — cabecera PWA (impronta: slate + acento cálido + pin SC) */

/* Cabecera + franja PWA: un solo bloque sticky (evita <style> dentro de <header> en algunos navegadores). */
.pwa-header-root {
    position: sticky;
    top: 0;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    background: var(--h-surface, #ffffff);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.8) inset,
        0 10px 28px -12px rgba(15, 23, 42, 0.12);
}

.pwa-header {
    --h-ink: #0f172a;
    --h-muted: #64748b;
    --h-line: #e2e8f0;
    --h-accent: #f59e0b;
    --h-accent-soft: #fff7ed;
    --h-pin: #dc2626;
    --h-surface: #ffffff;
    position: relative;
    overflow: visible;
    background: var(--h-surface);
    border-bottom: 1px solid var(--h-line);
}

.pwa-header::before {
    content: "";
    display: block;
    height: 5px;
    background: linear-gradient(
        90deg,
        var(--h-pin) 0%,
        #ea580c 22%,
        var(--h-accent) 48%,
        #a855f7 72%,
        #38bdf8 100%
    );
    box-shadow: 0 2px 12px rgba(245, 158, 11, 0.35);
}

.h-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px 8px;
}

.h-top-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Control de tema: un solo “orbe” (tema activo) + panel al pulsar */
.td-theme-dock {
    position: relative;
    flex-shrink: 0;
    z-index: 10020;
    -webkit-tap-highlight-color: transparent;
}

.td-theme-dock__orb {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    padding: 0;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    background: transparent;
    color: inherit;
}

.td-theme-dock__ring {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: conic-gradient(
        from 220deg,
        #38bdf8,
        #6366f1,
        #f59e0b,
        #f43f5e,
        #38bdf8
    );
    opacity: 0.88;
    animation: td-theme-ring-spin 10s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
    .td-theme-dock__ring {
        animation: none;
        opacity: 0.55;
    }

    .td-theme-dock__popover {
        animation: none;
    }
}

@keyframes td-theme-ring-spin {
    to {
        transform: rotate(360deg);
    }
}

.td-theme-dock__orb-face {
    position: relative;
    z-index: 1;
    width: 38px;
    height: 38px;
    border-radius: inherit;
    display: grid;
    place-items: center;
    background: linear-gradient(155deg, #ffffff 0%, #f1f5f9 100%);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.9) inset,
        0 4px 14px rgba(15, 23, 42, 0.12);
}

.td-theme-dock__orb--dark .td-theme-dock__orb-face {
    background: linear-gradient(155deg, #1e293b 0%, #0f172a 100%);
    box-shadow:
        0 0 0 1px rgba(56, 189, 248, 0.25) inset,
        0 0 24px rgba(56, 189, 248, 0.22),
        0 4px 16px rgba(0, 0, 0, 0.35);
}

.td-theme-dock__orb-icon {
    font-size: 1.15rem;
    line-height: 1;
    color: #ea580c;
    filter: drop-shadow(0 1px 2px rgba(234, 88, 12, 0.35));
}

.td-theme-dock__orb--dark .td-theme-dock__orb-icon {
    color: #7dd3fc;
    filter: drop-shadow(0 0 8px rgba(125, 211, 252, 0.45));
}

.td-theme-dock__badge {
    position: absolute;
    z-index: 2;
    top: -2px;
    right: -2px;
    min-width: 1.35rem;
    padding: 1px 5px;
    border-radius: 999px;
    font-size: 8px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #0c4a6e;
    background: linear-gradient(135deg, #bae6fd 0%, #e0f2fe 100%);
    border: 1px solid rgba(14, 165, 233, 0.45);
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.25);
    pointer-events: none;
    line-height: 1.2;
}

.td-theme-dock__orb-chev {
    position: absolute;
    z-index: 2;
    bottom: -2px;
    right: -1px;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    font-size: 10px;
    color: #475569;
    background: #fff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
    pointer-events: none;
    transition: transform 0.22s ease;
}

.td-theme-dock--open .td-theme-dock__ring {
    animation-duration: 4.5s;
    opacity: 1;
}

.td-theme-dock--open .td-theme-dock__orb-chev {
    transform: rotate(-180deg);
}

.td-theme-dock__orb:focus-visible {
    outline: none;
}

.td-theme-dock__orb:focus-visible .td-theme-dock__orb-face {
    outline: 3px solid var(--h-accent);
    outline-offset: 3px;
}

/* Panel fijo y centrado en el ancho seguro del viewport (no se sale por los costados) */
.td-theme-dock__popover {
    position: fixed;
    z-index: 100000;
    left: 12px;
    right: 12px;
    width: auto;
    max-width: min(340px, calc(100vw - 24px));
    margin: 0 auto;
    padding: 16px 16px 14px;
    border-radius: 20px;
    box-sizing: border-box;
    top: 72px;
    max-height: min(420px, calc(100vh - 24px));
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(148, 163, 184, 0.4);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.65) inset,
        0 24px 60px -16px rgba(15, 23, 42, 0.32),
        0 12px 36px rgba(59, 130, 246, 0.14);
    backdrop-filter: blur(16px) saturate(1.2);
    -webkit-backdrop-filter: blur(16px) saturate(1.2);
    animation: td-theme-pop-in 0.26s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes td-theme-pop-in {
    from {
        opacity: 0;
        transform: translateY(-6px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.td-theme-dock__popover-head {
    position: relative;
    z-index: 1;
    margin-bottom: 12px;
    text-align: center;
    padding: 0 2px;
}

.td-theme-dock__popover-kicker {
    display: block;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    text-wrap: balance;
    background: linear-gradient(90deg, #2563eb, #7c3aed, #db2777);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.td-theme-dock__popover-hint {
    margin: 10px 0 0;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.5;
    color: #64748b;
    text-align: center;
    text-wrap: balance;
    max-width: 42em;
    margin-left: auto;
    margin-right: auto;
}

.td-theme-dock__popover-hint strong {
    color: #334155;
    font-weight: 800;
}

.td-theme-dock__options {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.td-theme-dock__opt {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 11px 10px 11px 9px;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    background: rgba(248, 250, 252, 0.92);
    cursor: pointer;
    text-align: left;
    font: inherit;
    color: inherit;
    transition:
        border-color 0.18s ease,
        background 0.18s ease,
        transform 0.15s ease,
        box-shadow 0.2s ease;
}

.td-theme-dock__opt:hover {
    border-color: #93c5fd;
    background: #fff;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.1);
}

.td-theme-dock__opt:active {
    transform: scale(0.99);
}

.td-theme-dock__opt:focus-visible {
    outline: 3px solid var(--h-accent);
    outline-offset: 2px;
}

.td-theme-dock__opt-ico {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-size: 1.1rem;
    background: linear-gradient(145deg, #e0f2fe 0%, #f8fafc 100%);
    color: #0369a1;
    border: 1px solid #bae6fd;
}

.td-theme-dock__opt[data-td-theme="dark"] .td-theme-dock__opt-ico {
    background: linear-gradient(145deg, #1e293b 0%, #312e81 100%);
    color: #c4b5fd;
    border-color: rgba(99, 102, 241, 0.45);
}

.td-theme-dock__opt[data-td-theme="auto"] .td-theme-dock__opt-ico {
    background: linear-gradient(145deg, #fef3c7 0%, #fde68a 100%);
    color: #b45309;
    border-color: #fcd34d;
}

.td-theme-dock__opt-txt {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
    overflow: hidden;
}

.td-theme-dock__opt-name {
    font-size: 14px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #0f172a;
    line-height: 1.2;
}

.td-theme-dock__opt-desc {
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    line-height: 1.35;
    text-wrap: balance;
}

.td-theme-dock__opt-check {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    font-size: 14px;
    color: #0ea5e9;
    opacity: 0;
    transform: scale(0.5);
    transition:
        opacity 0.2s ease,
        transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.td-theme-dock__opt--active {
    border-color: #38bdf8;
    background: linear-gradient(135deg, #f0f9ff 0%, #eff6ff 100%);
    box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.25) inset;
}

.td-theme-dock__opt--active .td-theme-dock__opt-check {
    opacity: 1;
    transform: scale(1);
}

.h-logo-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
    min-width: 0;
    border-radius: 12px;
    margin: -4px -6px;
    padding: 4px 6px;
    transition: background 0.18s ease;
}

.h-logo-wrapper:hover {
    background: rgba(241, 245, 249, 0.85);
}

.h-logo-wrapper:focus-visible {
    outline: 3px solid var(--h-accent);
    outline-offset: 3px;
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.18);
}

.h-logo-mark {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: linear-gradient(145deg, #0f172a 0%, #1e293b 40%, #334155 100%);
    color: #fff;
    box-shadow:
        0 0 0 2px rgba(56, 189, 248, 0.35),
        0 0 20px rgba(56, 189, 248, 0.2),
        0 4px 14px rgba(15, 23, 42, 0.35),
        0 0 0 1px rgba(255, 255, 255, 0.12) inset;
}

.h-logo-mark .bi {
    font-size: 1.15rem;
    opacity: 0.95;
}

.h-logo {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1.05;
    color: var(--h-ink);
}

.h-logo span {
    color: var(--h-muted);
    font-weight: 700;
}

.h-logo-block {
    min-width: 0;
}

.weather-link {
    text-decoration: none;
    color: inherit;
    flex-shrink: 0;
}

.weather-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px 6px 8px;
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 800;
    color: var(--h-ink);
    background: linear-gradient(180deg, #fffbeb 0%, var(--h-accent-soft) 100%);
    border: 1px solid rgba(245, 158, 11, 0.35);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.weather-link:hover .weather-pill {
    border-color: rgba(245, 158, 11, 0.55);
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.18);
}

.weather-link:active .weather-pill {
    transform: scale(0.98);
}

.weather-pill__icon {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.75);
    color: #d97706;
    font-size: 0.95rem;
}

.weather-pill__chev {
    font-size: 0.65rem;
    opacity: 0.45;
    margin-left: 1px;
}

.h-meta {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0 16px 10px;
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--h-muted);
    letter-spacing: 0.02em;
}

.h-meta__primer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    min-width: 0;
    flex: 1;
}

.h-meta--fe-especial {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding-bottom: 8px;
}

.h-meta--fe-especial .h-meta__primer {
    flex: 0 0 auto;
    width: 100%;
}

/* Tramo centrado algo más largo que el bloque texto (huecos por padding del .h-meta). */
.h-meta__dots-rule {
    flex-shrink: 0;
    align-self: center;
    box-sizing: border-box;
    width: calc(100% + 44px);
    max-width: min(100% + 44px, calc(100vw - 28px));
    margin: 11px -22px 5px -22px;
    height: 0;
    border: none;
    border-top: 1px dashed var(--h-muted);
    opacity: 0.52;
}

.h-meta__loc,
.h-meta__when {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.h-meta__loc span {
    color: var(--h-ink);
    font-weight: 800;
    letter-spacing: 0.06em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.h-meta__pin {
    color: var(--h-pin);
    font-size: 0.75rem;
    flex-shrink: 0;
}

.h-meta__when {
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.h-meta__sep {
    margin: 0 0.35em;
    opacity: 0.55;
    font-weight: 800;
}

#h-clock {
    color: var(--h-ink);
    font-weight: 800;
    letter-spacing: 0.02em;
}

/* --- Modo oscuro (html[data-theme="dark"]) --- */
html[data-theme="dark"] .pwa-header {
    --h-ink: #f1f5f9;
    --h-muted: #94a3b8;
    --h-line: #334155;
    --h-accent: #fbbf24;
    --h-accent-soft: rgba(251, 191, 36, 0.12);
    --h-pin: #f87171;
    --h-surface: #1e293b;
}

html[data-theme="dark"] .pwa-header-root {
    background: var(--h-surface);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.04) inset,
        0 10px 28px -12px rgba(0, 0, 0, 0.45);
}

html[data-theme="dark"] .h-logo-wrapper:hover {
    background: rgba(51, 65, 85, 0.55);
}

html[data-theme="dark"] .weather-pill {
    color: var(--h-ink);
    background: linear-gradient(180deg, #334155 0%, #1e293b 100%);
    border-color: rgba(251, 191, 36, 0.35);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

html[data-theme="dark"] .weather-pill__icon {
    background: rgba(15, 23, 42, 0.5);
    color: #fbbf24;
}

html[data-theme="dark"] .td-theme-dock__badge {
    color: #e0f2fe;
    background: linear-gradient(135deg, #0369a1 0%, #1d4ed8 100%);
    border-color: rgba(125, 211, 252, 0.4);
}

html[data-theme="dark"] .td-theme-dock__orb-chev {
    color: #94a3b8;
    background: #0f172a;
    border-color: #334155;
}

html[data-theme="dark"] .td-theme-dock__popover {
    background: rgba(30, 41, 59, 0.94);
    border-color: rgba(71, 85, 105, 0.65);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.06) inset,
        0 24px 56px -12px rgba(0, 0, 0, 0.55),
        0 0 40px rgba(56, 189, 248, 0.08);
}

html[data-theme="dark"] .td-theme-dock__popover-hint {
    color: #94a3b8;
}

html[data-theme="dark"] .td-theme-dock__popover-hint strong {
    color: #e2e8f0;
}

html[data-theme="dark"] .td-theme-dock__opt {
    border-color: #334155;
    background: rgba(15, 23, 42, 0.55);
}

html[data-theme="dark"] .td-theme-dock__opt:hover {
    border-color: #64748b;
    background: rgba(51, 65, 85, 0.65);
}

html[data-theme="dark"] .td-theme-dock__opt-name {
    color: #f1f5f9;
}

html[data-theme="dark"] .td-theme-dock__opt-desc {
    color: #94a3b8;
}

html[data-theme="dark"] .td-theme-dock__opt--active {
    border-color: #38bdf8;
    background: linear-gradient(135deg, rgba(14, 116, 144, 0.35) 0%, rgba(30, 41, 59, 0.95) 100%);
    box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.2) inset;
}

html[data-theme="dark"] .td-theme-dock__opt-check {
    color: #38bdf8;
}

@media (min-width: 900px) {
    .h-top {
        max-width: min(960px, calc(100% - 32px));
        margin-left: auto;
        margin-right: auto;
        padding-left: 20px;
        padding-right: 20px;
    }

    .h-meta {
        max-width: min(960px, calc(100% - 32px));
        margin-left: auto;
        margin-right: auto;
        padding-left: 20px;
        padding-right: 20px;
    }
}
