/* ============================================
   SEDIMENT RADAR — dashboard styles
   Brand portado de sediment-web (charcoal/terra/gold)
   ============================================ */

:root {
    /* Brand */
    --terracotta: #CD5A23;
    --terracotta-light: #E8821A;
    --terracotta-dark: #A84A1B;
    --gold: #F5C31E;

    /* Sand scale */
    --sand: #E8DCC4;
    --sand-dark: #D8CCBA;
    --sand-muted: #A89B82;

    /* Earth scale */
    --earth-400: #7A8090;
    --earth-500: #606675;
    --earth-600: #555B6A;
    --earth-700: #4E5464;
    --earth-800: #454B5A;
    --earth-900: #2E3341;

    /* Backgrounds */
    --bg-primary: #2C2416;
    --bg-secondary: #322A1C;
    --bg-dark: #1F1A0F;

    /* Borders */
    --border: rgba(232, 220, 196, 0.12);
    --border-strong: rgba(232, 220, 196, 0.22);

    /* Severity */
    --sev-info: var(--earth-400);
    --sev-minor: #7A9A9E;
    --sev-major: var(--terracotta-light);
    --sev-critical: #E55934;

    /* Layout */
    --container-max: 1200px;
    --section-padding: 56px;
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--sand-dark);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

code, pre {
    font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.85em;
}

pre {
    white-space: pre-wrap;
    word-break: break-word;
}

.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 24px;
}

.skip-link {
    position: absolute; left: -9999px; top: -9999px;
}
.skip-link:focus {
    left: 16px; top: 16px;
    background: var(--gold); color: #000;
    padding: 8px 16px; border-radius: 6px; z-index: 9999;
}

/* ============================================
   NAV
   ============================================ */
.nav {
    position: fixed; top: 0; left: 0; right: 0;
    z-index: 1000; padding: 0 24px;
    transition: all 0.3s ease;
}

.nav--scrolled {
    background: rgba(46, 51, 65, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}

.nav__inner {
    max-width: var(--container-max);
    margin: 0 auto;
    display: flex; align-items: center; justify-content: space-between;
    height: 72px;
}

.nav__brand {
    display: flex; align-items: center; gap: 12px;
}

.nav__logo-icon { width: 36px; height: 30px; flex-shrink: 0; }

.nav__logo-text {
    display: flex; flex-direction: column; gap: 0; line-height: 1;
}

.nav__logo-name {
    font-family: 'Sora', sans-serif;
    font-weight: 800; font-size: 14px;
    color: var(--sand);
    letter-spacing: 0.14em;
}

.nav__logo-sub {
    font-family: 'Sora', sans-serif;
    font-weight: 600; font-size: 9px;
    color: var(--terracotta);
    letter-spacing: 0.28em;
    margin-left: 1px;
}

.nav__links {
    display: flex; align-items: center; gap: 28px;
    list-style: none;
}

.nav__links a {
    font-size: 14px; font-weight: 500;
    color: var(--sand-dark);
    transition: color 0.2s ease;
}

.nav__links a:hover { color: var(--sand); }

.nav__cta {
    font-family: 'Sora', sans-serif;
    font-size: 13px; font-weight: 600;
    padding: 8px 16px;
    background: var(--gold);
    color: #000 !important;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.nav__cta:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(245, 195, 30, 0.3);
}

/* ============================================
   HERO (compact dashboard variant)
   ============================================ */
.hero--compact {
    min-height: auto;
    padding: 140px 0 64px;
    position: relative;
    overflow: hidden;
    background: var(--bg-dark);
}

.hero__bg {
    position: absolute; inset: 0; z-index: 0;
    pointer-events: none; overflow: hidden;
}

.hero__mountains {
    position: absolute;
    bottom: -10%; left: 50%;
    transform: translateX(-50%);
    width: 120%; max-width: none; height: auto;
    opacity: 0.08;
    user-select: none;
}

.hero__overlay {
    position: absolute; inset: 0;
    background:
        linear-gradient(to right, rgba(31,26,15,0.65) 0%, rgba(31,26,15,0.2) 60%, transparent 100%),
        linear-gradient(to bottom, transparent 0%, transparent 50%, rgba(44,36,22,0.7) 100%);
    z-index: 1;
}

.hero__inner { position: relative; z-index: 2; }

.hero__content { max-width: 760px; }

.hero__badge {
    display: inline-flex; align-items: center; gap: 8px;
    font-family: 'Sora', sans-serif;
    font-size: 12px; font-weight: 500;
    color: var(--terracotta);
    background: rgba(205, 90, 35, 0.1);
    border: 1px solid rgba(205, 90, 35, 0.25);
    padding: 6px 16px; border-radius: 100px;
    margin-bottom: 20px;
    letter-spacing: 0.05em; text-transform: uppercase;
}
.hero__badge::before {
    content: ''; width: 6px; height: 6px;
    background: var(--terracotta); border-radius: 50%;
}

.hero__title {
    font-family: 'Sora', sans-serif;
    font-size: clamp(32px, 4.5vw, 52px);
    font-weight: 700; line-height: 1.1;
    color: var(--sand);
    letter-spacing: -0.03em;
    margin-bottom: 18px;
}

.hero__title .accent {
    background: linear-gradient(135deg, var(--terracotta) 0%, var(--gold) 100%);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero__subtitle {
    font-size: 16px; line-height: 1.6;
    color: var(--sand-dark);
    max-width: 580px;
    margin-bottom: 28px;
    font-weight: 300;
}

.hero__status {
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}

.hero__status-meta {
    color: var(--sand-muted);
    font-size: 14px;
}

.dot-sep { color: var(--earth-500); margin: 0 4px; }

/* ============================================
   STATUS PILL
   ============================================ */
.status-pill {
    display: inline-flex; align-items: center; gap: 8px;
    font-family: 'Sora', sans-serif;
    font-size: 12px; font-weight: 600;
    padding: 6px 14px; border-radius: 100px;
    text-transform: uppercase; letter-spacing: 0.08em;
}

.status-pill--ok {
    color: var(--gold);
    background: rgba(245, 195, 30, 0.1);
    border: 1px solid rgba(245, 195, 30, 0.3);
}

.status-pill__dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--gold);
    box-shadow: 0 0 12px rgba(245, 195, 30, 0.6);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.85); }
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    font-family: 'Sora', sans-serif;
    font-weight: 600; font-size: 14px;
    padding: 12px 24px; border-radius: 8px;
    cursor: pointer;
    transition: all 0.25s var(--ease-out);
    display: inline-flex; align-items: center; gap: 8px;
    border: none; text-decoration: none;
}

.btn--primary {
    background: var(--gold);
    color: var(--earth-900);
    box-shadow: 0 4px 20px rgba(245, 195, 30, 0.25);
}
.btn--primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(245, 195, 30, 0.35);
}
.btn--primary:active { transform: translateY(0); }

.btn--secondary {
    background: transparent;
    color: var(--sand);
    border: 1.5px solid var(--earth-500);
}
.btn--secondary:hover {
    border-color: var(--terracotta);
    color: var(--terracotta-light);
    background: rgba(205, 90, 35, 0.08);
}

/* HTMX indicator */
.htmx-indicator { opacity: 0; display: inline-block; transition: opacity 0.2s; }
.htmx-request .htmx-indicator { opacity: 1; }
.htmx-request.htmx-indicator { opacity: 1; }
.htmx-request .btn { pointer-events: none; opacity: 0.85; }

#run-spinner {
    display: inline-block;
    transform-origin: center;
}
.htmx-request #run-spinner {
    animation: spin 0.9s linear infinite;
}
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ============================================
   SECTIONS / GRID
   ============================================ */
.section { padding: var(--section-padding) 0; }

.grid { display: grid; gap: 24px; }
.grid--2 { grid-template-columns: 1.2fr 1fr; }

@media (max-width: 900px) {
    .grid--2 { grid-template-columns: 1fr; }
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: linear-gradient(135deg,
        rgba(139, 111, 71, 0.08) 0%,
        rgba(74, 87, 89, 0.08) 100%);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 32px;
    transition: all 0.3s var(--ease-out);
}

.card:hover {
    border-color: var(--border-strong);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.card__header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.card__label {
    font-family: 'Sora', sans-serif;
    font-size: 11px; font-weight: 600;
    color: var(--terracotta);
    letter-spacing: 0.1em; text-transform: uppercase;
    display: block; margin-bottom: 6px;
}

.card__title {
    font-family: 'Sora', sans-serif;
    font-size: 20px; font-weight: 600;
    color: var(--sand);
    letter-spacing: -0.01em;
}

.card__cta {
    display: inline-block;
    margin-top: 20px;
    color: var(--gold);
    font-family: 'Sora', sans-serif;
    font-size: 13px; font-weight: 600;
    transition: opacity 0.2s ease;
}
.card__cta:hover { opacity: 0.8; }

.card--digest pre {
    color: var(--sand-dark);
    font-size: 13px;
    line-height: 1.6;
    max-height: 200px;
    overflow-y: auto;
}

/* ============================================
   KPI tiles
   ============================================ */
.kpi-row {
    display: flex; gap: 16px;
    margin-bottom: 24px;
}

.kpi {
    flex: 1;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
}

.kpi__value {
    font-family: 'Sora', sans-serif;
    font-size: 36px; font-weight: 700;
    color: var(--sand);
    line-height: 1;
    margin-bottom: 6px;
}

.kpi__label {
    font-family: 'Sora', sans-serif;
    font-size: 11px; font-weight: 600;
    color: var(--sand-muted);
    letter-spacing: 0.1em; text-transform: uppercase;
}

.kpi--critical .kpi__value { color: var(--sev-critical); }
.kpi--critical { border-color: rgba(229, 89, 52, 0.3); }

.digest-preview {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    overflow: hidden;
}

/* ============================================
   RUNS TABLE
   ============================================ */
.runs-table {
    display: flex; flex-direction: column; gap: 8px;
}

.run-row {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    transition: border-color 0.2s ease;
}

.run-row:hover { border-color: var(--border-strong); }

.run-row__time { display: flex; flex-direction: column; gap: 2px; }
.run-row__when { font-size: 14px; color: var(--sand); font-weight: 500; }
.run-row__abs { font-size: 11px; color: var(--sand-muted); font-family: 'IBM Plex Mono', monospace; }

.run-row__trigger {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px; color: var(--sand-muted);
}

.run-row__err { color: var(--sev-critical); font-size: 16px; cursor: help; }

/* ============================================
   CHIPS (severity + status)
   ============================================ */
.chip {
    display: inline-flex; align-items: center;
    font-family: 'Sora', sans-serif;
    font-size: 11px; font-weight: 600;
    padding: 4px 12px;
    border-radius: 100px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border: 1px solid transparent;
}

.chip--success {
    color: var(--gold);
    background: rgba(245, 195, 30, 0.1);
    border-color: rgba(245, 195, 30, 0.25);
}
.chip--running {
    color: var(--terracotta-light);
    background: rgba(232, 130, 26, 0.1);
    border-color: rgba(232, 130, 26, 0.25);
}
.chip--error {
    color: var(--sev-critical);
    background: rgba(229, 89, 52, 0.1);
    border-color: rgba(229, 89, 52, 0.3);
}
.chip--unknown {
    color: var(--sand-muted);
    background: rgba(168, 155, 130, 0.1);
    border-color: rgba(168, 155, 130, 0.2);
}

/* Severity */
.chip--info { color: var(--sev-info); background: rgba(122, 128, 144, 0.12); border-color: rgba(122, 128, 144, 0.25); }
.chip--minor { color: var(--sev-minor); background: rgba(122, 154, 158, 0.12); border-color: rgba(122, 154, 158, 0.25); }
.chip--major { color: var(--sev-major); background: rgba(232, 130, 26, 0.12); border-color: rgba(232, 130, 26, 0.3); }
.chip--critical { color: var(--sev-critical); background: rgba(229, 89, 52, 0.12); border-color: rgba(229, 89, 52, 0.35); }

.severity-legend {
    display: flex; align-items: center; gap: 10px;
    margin-top: 32px; padding-top: 24px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

.severity-legend__label {
    font-family: 'Sora', sans-serif;
    font-size: 11px; font-weight: 600;
    color: var(--sand-muted);
    letter-spacing: 0.1em; text-transform: uppercase;
    margin-right: 8px;
}

/* ============================================
   EMPTY STATES
   ============================================ */
.empty {
    padding: 24px 8px;
    text-align: center;
    color: var(--sand-muted);
}
.empty p { margin-bottom: 4px; }
.muted { color: var(--earth-400); font-size: 13px; }

/* ============================================
   TOAST
   ============================================ */
#toast-host {
    position: fixed;
    bottom: 24px; right: 24px;
    z-index: 9000;
}

.toast {
    display: flex; align-items: center; gap: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-strong);
    border-left: 3px solid var(--gold);
    border-radius: 12px;
    padding: 14px 18px;
    min-width: 280px; max-width: 380px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    animation: toastIn 0.4s var(--ease-out);
}

.toast--ok { border-left-color: var(--gold); }

.toast__icon {
    font-size: 16px;
    color: var(--gold);
}

.toast__body { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.toast__body strong { color: var(--sand); font-family: 'Sora', sans-serif; font-size: 14px; }
.toast__sub { color: var(--sand-muted); font-size: 12px; }

.toast__close {
    background: none; border: none;
    color: var(--sand-muted); cursor: pointer;
    font-size: 14px; padding: 4px;
    transition: color 0.2s ease;
}
.toast__close:hover { color: var(--sand); }

.toast--leaving {
    animation: toastOut 0.5s var(--ease-out) forwards;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes toastOut {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(20px); }
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
    border-top: 1px solid var(--border);
    background: var(--bg-dark);
    padding: 32px 0;
    margin-top: 64px;
}

.footer__inner {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; flex-wrap: wrap;
}

.footer__brand {
    font-family: 'Sora', sans-serif;
    font-weight: 800; font-size: 13px;
    color: var(--sand);
    letter-spacing: 0.14em;
}

.footer__brand-sub {
    color: var(--terracotta);
    font-weight: 600;
    letter-spacing: 0.28em;
    font-size: 9px;
    margin-left: 2px;
}

.footer__meta {
    color: var(--sand-muted);
    font-size: 13px;
}

.footer__meta code {
    background: var(--bg-secondary);
    padding: 2px 8px; border-radius: 4px;
    color: var(--sand-dark);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 720px) {
    .nav__links { gap: 18px; }
    .nav__links li:nth-child(2),
    .nav__links li:nth-child(3) { display: none; }

    .hero--compact { padding: 120px 0 48px; }
    .hero__title { font-size: clamp(28px, 8vw, 36px); }

    .hero__status { flex-direction: column; align-items: flex-start; gap: 12px; }

    .card { padding: 24px; }
    .run-row {
        grid-template-columns: 1fr auto;
        gap: 8px;
    }
    .run-row__trigger, .run-row__err { grid-column: 2; }

    #toast-host { left: 16px; right: 16px; }
    .toast { min-width: 0; max-width: none; }
}
