/* ==========================================================================
   KROTAR — Design Tokens & Base
   Central source of truth for color, type, spacing and shared utilities.
   Section-specific styles live in assets/css/*.css (linked after this file).
   ========================================================================== */

:root {
    /* Color: surfaces */
    --bg-dark: #020306;
    --color-bg: #020306;
    --color-surface: rgba(6, 8, 16, 0.62);
    --color-surface-heavy: rgba(4, 5, 12, 0.82);
    --color-card: rgba(255, 255, 255, 0.035);
    --color-card-hover: rgba(255, 255, 255, 0.065);

    /* Color: borders */
    --color-border: rgba(255, 255, 255, 0.08);
    --color-border-light: rgba(255, 255, 255, 0.14);
    --color-border-blue: rgba(0, 102, 255, 0.35);

    /* Color: text */
    --color-text: #f8fafc;
    --color-text-body: #cbd5e1;
    --color-text-muted: #64748b;
    --color-text-dim: #475569;

    /* Color: brand accents — electric blue dominant, cyan secondary.
       No violet/magenta/pink anywhere in the palette. */
    --color-blue-violet: #6366f1;
    --color-blue: #3b82f6;
    --color-blue-deep: #0a3dff;
    --color-cyan: #06b6d4;
    --color-cyan-bright: #00d9ff;
    --color-success: #22c55e;
    --color-error: #f87171;

    /* Typography */
    --font-heading: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Spacing scale */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.5rem;
    --space-6: 2rem;
    --space-7: 3rem;
    --space-8: 4rem;
    --space-9: 4.25rem;
    --space-10: 8rem;

    /* Radii */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 24px;
    --radius-pill: 9999px;

    /* Motion */
    --ease-premium: cubic-bezier(0.16, 1, 0.3, 1);
    --duration-fast: 0.2s;
    --duration-base: 0.35s;

    /* Layout */
    --container-max: 1240px;
    --container-padding: 1.5rem;
    --backdrop-blur: blur(24px) saturate(180%);

    /* Z-index scale */
    --z-bg: 0;
    --z-content: 1;
    --z-header: 50;
    --z-mobile-nav: 60;
}

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

html {
    scroll-behavior: smooth;
}

html,
body {
    width: 100%;
    min-height: 100vh;
    background-color: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-body);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    position: relative;
}

img,
svg {
    max-width: 100%;
    display: block;
}

a {
    color: inherit;
}

button {
    font: inherit;
    cursor: pointer;
}

/* ==========================================================================
   Frozen WebGL Background Canvas Container (Z-Index 0, full page)
   ========================================================================== */
.procedural-bg-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: var(--z-bg);
    overflow: hidden;
    background-color: #010204;
}

#bg-canvas {
    display: block;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* ==========================================================================
   Full-Height Application Shell (Z-Index 1)
   ========================================================================== */
.app-shell {
    position: relative;
    z-index: var(--z-content);
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* ==========================================================================
   Shared layout utilities
   ========================================================================== */
.container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--container-padding);
}

.section {
    position: relative;
    /* Top spacing kept deliberately tight across every section (landing,
       blog listing/articles, legal pages all share this class): the fixed
       header already reserves its own room via scroll-margin-top below, so
       padding-top only needs to add a small, consistent breathing gap
       before the eyebrow/title — not repeat the header offset. Bottom
       padding stays generous to keep rhythm between consecutive sections. */
    padding: var(--space-2) 0 var(--space-9) 0;
    /* Continuity wash: every section carries the same faint vertical bloom
       at its seams, so the transition from one section to the next reads
       as one continuous atmosphere rather than a hard cut to flat black. */
    background:
        linear-gradient(180deg, rgba(0, 102, 255, 0.06) 0%, transparent 22%),
        linear-gradient(0deg, rgba(0, 174, 239, 0.05) 0%, transparent 22%),
        var(--color-bg);
    overflow: hidden;
    scroll-margin-top: 4.5rem;
}

/* ==========================================================================
   Ambient section glow
   Same soft blurred radial-gradient technique as the hero's light orbs,
   scoped per section so depth/atmosphere carries through the whole page
   without letting the raw background show through and fight with text.
   Blue/cyan only. Kept clearly visible — this is the "halo principale"
   layer, not a background tint.
   ========================================================================== */
.ambient-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(110px);
    pointer-events: none;
    z-index: 0;
    mix-blend-mode: screen;
}

.ambient-glow-blue {
    background: radial-gradient(circle, rgba(0, 102, 255, 0.4) 0%, rgba(0, 91, 255, 0.16) 45%, transparent 75%);
}

.ambient-glow-cyan {
    background: radial-gradient(circle, rgba(0, 174, 239, 0.38) 0%, rgba(0, 174, 239, 0.14) 45%, transparent 75%);
}

.section-heading {
    max-width: 640px;
    margin: 0 auto var(--space-6) auto;
    text-align: center;
}

.eyebrow {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--color-cyan);
    margin-bottom: var(--space-4);
}

.section-title {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: clamp(1.9rem, 3.6vw, 2.75rem);
    line-height: 1.15;
    letter-spacing: -0.01em;
    color: var(--color-text);
    margin-bottom: var(--space-3);
}

.section-subtitle {
    font-size: clamp(1rem, 1.6vw, 1.125rem);
    line-height: 1.6;
    color: var(--color-text-body);
}

/* ==========================================================================
   Shared Glassmorphism Card Utility
   ========================================================================== */
.glass-card {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(ellipse 120% 90% at 15% -10%, rgba(0, 145, 255, 0.14) 0%, transparent 55%),
        linear-gradient(165deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.02) 40%, rgba(255, 255, 255, 0.03) 100%),
        repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.025) 0px, rgba(255, 255, 255, 0.025) 1px, transparent 1px, transparent 26px),
        repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.025) 0px, rgba(255, 255, 255, 0.025) 1px, transparent 1px, transparent 26px);
    border: 1px solid rgba(59, 130, 246, 0.22);
    border-radius: var(--radius-md);
    backdrop-filter: var(--backdrop-blur);
    -webkit-backdrop-filter: var(--backdrop-blur);
    box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.1), 0 14px 34px rgba(0, 0, 0, 0.4), 0 0 22px rgba(0, 102, 255, 0.06);
    transition: border-color var(--duration-fast) ease, background var(--duration-fast) ease, box-shadow var(--duration-base) var(--ease-premium), transform var(--duration-base) var(--ease-premium);
}

.glass-card:hover {
    border-color: rgba(0, 174, 239, 0.5);
    background:
        radial-gradient(ellipse 120% 90% at 15% -10%, rgba(0, 145, 255, 0.22) 0%, transparent 55%),
        linear-gradient(165deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.03) 40%, rgba(255, 255, 255, 0.045) 100%);
    box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.14), 0 18px 42px rgba(0, 0, 0, 0.5), 0 0 38px rgba(0, 174, 239, 0.22);
    transform: translateY(-4px);
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 30px;
    font-family: var(--font-heading);
    font-size: 0.92rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-decoration: none;
    border-radius: var(--radius-pill);
    border: 1px solid transparent;
    transition: all var(--duration-base) var(--ease-premium);
    white-space: nowrap;
}

.btn-primary {
    color: #f8fafc;
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.16), 0 12px 35px rgba(0, 0, 0, 0.5);
}

.btn-primary:hover {
    background: rgba(255, 255, 255, 0.075);
    border-color: rgba(0, 174, 239, 0.4);
    color: #ffffff;
    box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.25), 0 18px 45px rgba(0, 0, 0, 0.65), 0 0 32px rgba(0, 145, 255, 0.16);
    transform: translateY(-2px);
}

.btn-ghost {
    color: var(--color-text-body);
    background: transparent;
    border-color: var(--color-border-light);
}

.btn-ghost:hover {
    color: var(--color-text);
    border-color: rgba(255, 255, 255, 0.36);
    background: rgba(255, 255, 255, 0.04);
}

.btn-arrow {
    transition: transform var(--duration-base) var(--ease-premium);
    color: #94a3b8;
}

.btn:hover .btn-arrow {
    transform: translateX(4px);
    color: #ffffff;
}

/* ==========================================================================
   Provisional content marker
   Every placeholder value (contact data, social links, legal pages, imagery)
   carries this class so it stays identifiable until replaced — kept subtle:
   dimmed text + a small inline tag, not a loud box.
   ========================================================================== */
.provisional {
    opacity: 0.7;
    border-bottom: 1px dashed var(--color-border-light);
    padding-bottom: 1px;
}

.provisional::after {
    content: 'Pendiente';
    margin-left: 0.5em;
    padding: 1px 6px;
    font-family: var(--font-mono);
    font-size: 0.62rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    color: var(--color-text-dim);
    border: 1px solid var(--color-border-light);
    border-radius: 4px;
    white-space: nowrap;
}

/* ==========================================================================
   Keyboard focus visibility
   ========================================================================== */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--color-cyan);
    outline-offset: 3px;
    border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}

/* Responsive fix: .btn forces white-space: nowrap so its text never wraps
   (correct everywhere the label is short). On narrow phones, two buttons
   with longer labels — "Solicitar diagnóstico de tu operación" and
   "Solicitar valoración gratuita" — are wider than their own container at
   this exact width, pushing past its edge. Letting them wrap only below
   420px fixes both without touching how any button looks anywhere else. */
@media (max-width: 420px) {
    .btn {
        white-space: normal;
        text-align: center;
        max-width: 100%;
    }
}

/* ==========================================================================
   Legal pages (Aviso legal / Privacidad / Cookies) — also used by the blog
   article pages generated by scripts/build-blog.js (same "no hero above"
   layout). Their header renders permanently in the compact "is-scrolled"
   state (see renderHeader() in build-blog.js), so — unlike the landing's
   sections, which either sit below the Hero or are protected by
   scroll-margin-top when jumped to — this is the very first element on
   the page and needs its own top padding to actually clear the fixed
   header, not just the shared .section value used mid-page.
   ========================================================================== */
.legal-section {
    padding-top: 6rem;
}

.legal-container {
    max-width: 760px;
}

.legal-notice {
    padding: var(--space-5);
    margin-bottom: var(--space-7);
    background: rgba(250, 204, 21, 0.06);
    border: 1px solid rgba(250, 204, 21, 0.25);
    border-radius: var(--radius-md);
}

.legal-title {
    text-align: left;
    margin-bottom: var(--space-6);
}

.legal-heading {
    text-align: left;
    margin-top: var(--space-6);
    margin-bottom: var(--space-2);
}

.legal-text {
    text-align: left;
}

.legal-footer-bottom {
    border-top: none;
    padding-top: 0;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
