/* =========================================================================
   Editorial Dark Claude — Félix Lezama portfolio
   Palette inspired by Anthropic dark mode (warm dark + cream + terracotta)
   ========================================================================= */

:root {
    /* Surfaces */
    --bg: #1A1916;
    --bg-elevated: #22211D;

    /* Text */
    --text: #FAF9F5;
    --text-soft: #B0AEA5;
    --text-faint: #6F6D66;

    /* Accent (single, terracotta) */
    --accent: #D97757;
    --accent-soft: rgba(217, 119, 87, 0.16);

    /* Lines */
    --line: rgba(176, 174, 165, 0.18);
    --line-strong: rgba(176, 174, 165, 0.32);

    /* Type */
    --display: 'Space Grotesk', system-ui, sans-serif;
    --serif: 'Newsreader', 'Source Serif 4', Georgia, serif;
    --mono: 'JetBrains Mono', ui-monospace, monospace;
}

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

html { scroll-behavior: smooth; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--serif);
    font-size: 1.0625rem;
    line-height: 1.65;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

::selection { background: var(--accent-soft); color: var(--text); }

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

/* =========================================================================
   Layout — vertical rail + editorial column (single grid)
   ========================================================================= */
.layout {
    max-width: 1480px;
    margin: 0 auto;
    padding: 0 40px;
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 88px;
    align-items: start;
}

.container {
    max-width: 1040px;
    margin: 0;
    padding: 0;
    min-width: 0;        /* prevent overflow inside grid */
}

@media (max-width: 980px) {
    .layout {
        grid-template-columns: 1fr;
        gap: 0;
        padding: 0 22px;
    }
    .container {
        margin: 0 auto;
    }
}

/* =========================================================================
   Hero
   ========================================================================= */
.hero {
    padding: 128px 0 88px;
}

.hero-eyebrow {
    font-family: var(--display);
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-soft);
    margin-bottom: 28px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.hero-eyebrow::before {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--accent);
    border-radius: 50%;
    display: inline-block;
}

.hero-title {
    font-family: var(--display);
    font-size: clamp(2.75rem, 7vw, 5.25rem);
    font-weight: 600;
    line-height: 1.02;
    letter-spacing: -0.025em;
    color: var(--text);
    margin-bottom: 20px;
}

.hero-role {
    font-family: var(--display);
    font-size: clamp(1.15rem, 2.1vw, 1.35rem);
    font-weight: 500;
    letter-spacing: 0.01em;
    color: var(--text);
    margin-bottom: 28px;
}

.hero-role .sep {
    color: var(--accent);
    margin: 0 0.5em;
    font-weight: 400;
}

.hero-subtitle {
    font-family: var(--serif);
    font-size: 1.2rem;
    font-weight: 400;
    line-height: 1.55;
    color: var(--text-soft);
    max-width: 900px;
    margin-bottom: 48px;
}

.hero-subtitle b {
    color: var(--text);
    font-weight: 500;
}

/* =========================================================================
   Hero CTAs — single primary + ghost links
   ========================================================================= */
.hero-cta {
    display: flex;
    align-items: center;
    gap: 28px;
    flex-wrap: wrap;
    font-family: var(--display);
    font-size: 0.95rem;
    font-weight: 500;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.btn-primary {
    background: var(--accent);
    color: var(--bg);
    padding: 12px 22px;
    border-radius: 4px;
    font-weight: 600;
}

.btn-primary:hover {
    background: #C6694C;
    color: var(--bg);
}

.btn-ghost {
    color: var(--text-soft);
    padding: 12px 0;
    border-bottom: 1px solid transparent;
}

.btn-ghost:hover {
    color: var(--text);
    border-bottom-color: var(--text);
}

.btn svg {
    width: 16px;
    height: 16px;
    stroke-width: 1.75;
    flex-shrink: 0;
}

/* =========================================================================
   Section structure
   ========================================================================= */
.section {
    padding: 80px 0;
    position: relative;
}

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

.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 32px;
}

.section-eyebrow {
    font-family: var(--display);
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-soft);
}

.section-eyebrow .num {
    color: var(--accent);
    margin-right: 0.5em;
}

.section-meta {
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--text-faint);
    letter-spacing: 0.02em;
}

.section-title {
    font-family: var(--display);
    font-size: clamp(1.65rem, 3vw, 2.1rem);
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.015em;
    color: var(--text);
    margin-bottom: 24px;
    max-width: 820px;
}

.section-lede {
    font-family: var(--serif);
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--text-soft);
    margin-bottom: 48px;
    max-width: 820px;
}

.section-lede em {
    font-style: italic;
    color: var(--text);
}

/* =========================================================================
   Metrics grid — anchors of credibility (sec. 1)
   ========================================================================= */
.metrics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 32px;
    margin: 8px 0 8px;
}

.metric {
    border-top: 1px solid var(--line);
    padding-top: 16px;
}

.metric-num {
    font-family: var(--display);
    font-size: clamp(2rem, 4vw, 2.6rem);
    font-weight: 600;
    line-height: 1;
    letter-spacing: -0.02em;
    color: var(--text);
    margin-bottom: 8px;
    display: block;
}

.metric-label {
    font-family: var(--display);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-soft);
    line-height: 1.35;
}

/* =========================================================================
   Pipeline diagram (sec. 2) — typographic, not boxed
   ========================================================================= */
.pipeline {
    margin: 8px 0 40px;
    padding: 28px 0 32px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.pipeline-flow {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
    position: relative;
}

.pipe-step {
    text-align: center;
    position: relative;
}

.pipe-step .name {
    font-family: var(--display);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text);
    display: block;
    margin-bottom: 6px;
}

.pipe-step .detail {
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--text-soft);
    letter-spacing: 0.02em;
    line-height: 1.5;
    display: block;
}

.pipe-step:not(:last-child)::after {
    content: '→';
    position: absolute;
    top: 0;
    right: -10px;
    color: var(--accent);
    font-family: var(--display);
    font-size: 1.1rem;
    line-height: 1;
}

.pipeline-summary {
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--text-soft);
    letter-spacing: 0.02em;
    text-align: center;
    padding-top: 8px;
}

.pipeline-summary .strong {
    color: var(--text);
}

.pipeline-summary .dot {
    color: var(--text-faint);
    margin: 0 0.6em;
}

/* =========================================================================
   Facet list (sec. 2 sub-blocks: 4 facets of the pipeline)
   ========================================================================= */
.facets {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
}

.facet {
    padding: 28px 0;
    border-top: 1px solid var(--line);
    display: grid;
    grid-template-columns: 1fr 3fr;
    gap: 32px;
    align-items: baseline;
}

.facet:last-child {
    border-bottom: 1px solid var(--line);
}

.facet-title {
    font-family: var(--display);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.005em;
}

.facet-body {
    font-family: var(--serif);
    font-size: 1.0rem;
    line-height: 1.6;
    color: var(--text-soft);
}

/* =========================================================================
   Sec. 3 — The Bridge (typewriter, no terminal chrome)
   ========================================================================= */
.bridge-body {
    font-family: var(--serif);
    font-style: italic;
    font-size: clamp(1.3rem, 2.4vw, 1.6rem);
    line-height: 1.5;
    color: var(--text);
    max-width: 640px;
    min-height: 8.5em;
}

.bridge-body .cursor {
    display: inline-block;
    width: 2px;
    height: 1.05em;
    background: var(--accent);
    vertical-align: text-bottom;
    margin-left: 2px;
    animation: blink 1.05s steps(2, start) infinite;
}

@keyframes blink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

.hidden-text { display: none; }

/* =========================================================================
   Footer
   ========================================================================= */
.site-footer {
    padding: 64px 0 96px;
    border-top: 1px solid var(--line);
    margin-top: 48px;
    font-family: var(--display);
    font-size: 0.82rem;
    color: var(--text-faint);
    letter-spacing: 0.02em;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.site-footer a {
    color: var(--text-soft);
    border-bottom: 1px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}
.site-footer a:hover {
    color: var(--text);
    border-bottom-color: var(--text);
}

/* =========================================================================
   Language toggle — top-right, Claude pill style
   ========================================================================= */
#lang-toggle {
    position: fixed;
    top: 22px;
    right: 24px;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--bg-elevated);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 6px 4px;
    font-family: var(--display);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    cursor: pointer;
    user-select: none;
    transition: border-color 0.2s;
}

#lang-toggle:hover { border-color: var(--line-strong); }

#lang-toggle svg { display: none; }

.lang-opt {
    color: var(--text-faint);
    padding: 4px 10px;
    border-radius: 999px;
    transition: color 0.2s, background 0.2s;
}

.lang-opt.active {
    color: var(--bg);
    background: var(--text);
}

.lang-divider { display: none; }

/* =========================================================================
   Responsive
   ========================================================================= */
@media (max-width: 720px) {
    .container { padding: 0 22px; }
    .hero { padding: 96px 0 64px; }
    .section { padding: 64px 0; }

    .metrics { grid-template-columns: repeat(2, 1fr); gap: 24px; }
    .pipeline-flow { grid-template-columns: 1fr 1fr; gap: 24px 12px; }
    .pipe-step:nth-child(2)::after { display: none; }
    .pipe-step:nth-child(3)::after { display: none; }

    .facet { grid-template-columns: 1fr; gap: 8px; }
    .facet-title { font-size: 1rem; }

    .hero-cta { gap: 20px; row-gap: 16px; }
    .btn-ghost { padding: 8px 0; }

    .section-head { gap: 8px; }
    #lang-toggle { top: 14px; right: 14px; }
}

@media (max-width: 440px) {
    .pipeline-flow { grid-template-columns: 1fr; gap: 16px; }
    .pipe-step:not(:last-child)::after { display: none; }
}

/* =========================================================================
   Easter egg — Industrial mode portal
   ========================================================================= */

/* Hero name: tap target + sibling feedback positioned absolutely */
.hero-name-wrap {
    position: relative;
    display: block;
    margin-bottom: 20px;
}

.hero-title {
    margin-bottom: 0; /* el wrapper se encarga del espacio inferior */
    touch-action: manipulation; /* mobile: sin delay 300ms, sin zoom por doble-tap */
}

.tap-feedback {
    position: absolute;
    top: 0.45em;
    left: calc(100% + 22px);
    font-family: var(--display);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--accent);
    letter-spacing: 0.04em;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    white-space: nowrap;
    pointer-events: none;
}

.tap-feedback.visible {
    opacity: 0.85;
    transform: translateY(0);
}

/* Footer: dot portal */
.footer-right {
    display: inline-flex;
    align-items: center;
    gap: 14px;
}

.industrial-dot {
    /* Visual: 8px terracotta dot */
    width: 8px;
    height: 8px;
    background: var(--accent);
    border: 0;
    border-radius: 50%;
    padding: 0;
    cursor: pointer;
    opacity: 0.55;
    position: relative;
    /* Tap target: 44px hit area via box-shadow trick (not used) — use ::before */
    transition: opacity 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}

.industrial-dot::before {
    /* Invisible 44x44px tap area for accessibility (WCAG 2.1 Touch Target Size) */
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 44px;
    height: 44px;
    transform: translate(-50%, -50%);
}

.industrial-dot::after {
    /* Tooltip — desktop only on hover */
    content: attr(data-tooltip-en);
    position: absolute;
    bottom: calc(100% + 10px);
    right: 50%;
    transform: translateX(50%);
    background: var(--bg-elevated);
    color: var(--text-soft);
    font-family: var(--display);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: lowercase;
    padding: 6px 10px;
    border-radius: 4px;
    border: 1px solid var(--line);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease;
}

html[lang="es"] .industrial-dot::after {
    content: attr(data-tooltip-es);
}

.industrial-dot:hover,
.industrial-dot:focus-visible {
    opacity: 1;
    transform: scale(1.25);
    box-shadow: 0 0 0 6px rgba(217, 119, 87, 0.12);
    outline: none;
}

.industrial-dot:hover::after,
.industrial-dot:focus-visible::after {
    opacity: 1;
    transform: translateX(50%) translateY(-2px);
}

.industrial-dot.armed {
    /* Visual pulse for keyboard activation */
    animation: dot-pulse 1.5s ease-in-out infinite;
}

@keyframes dot-pulse {
    0%, 100% { opacity: 0.55; transform: scale(1); }
    50%      { opacity: 1;    transform: scale(1.3); }
}

/* Industrial overlay (transition) */
#industrial-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.32s ease, visibility 0.32s;
}

#industrial-overlay.active {
    opacity: 1;
    visibility: visible;
}

.overlay-text {
    font-family: var(--serif);
    font-style: italic;
    font-size: clamp(1.5rem, 4vw, 2.1rem);
    color: var(--text);
    text-align: center;
    padding: 0 24px;
    letter-spacing: -0.01em;
    transform: translateY(8px);
    opacity: 0;
    transition: opacity 0.5s ease 0.1s, transform 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.1s;
}

#industrial-overlay.active .overlay-text {
    opacity: 1;
    transform: translateY(0);
}

/* Mobile: tap feedback se reposiciona debajo del nombre */
@media (max-width: 720px) {
    .tap-feedback {
        top: auto;
        left: 0;
        bottom: -1.4em;
        font-size: 0.78rem;
    }
    .footer-right { gap: 16px; }
    .industrial-dot { width: 9px; height: 9px; opacity: 0.6; }
    .industrial-dot::after {
        font-size: 0.68rem;
        padding: 5px 9px;
    }
}

@media (hover: none) {
    /* Touch devices: hide hover tooltip, JS toggles a .show class on tap */
    .industrial-dot::after { transition: opacity 0.22s ease; }
    .industrial-dot.show-tip::after { opacity: 1; }
}

/* =========================================================================
   Motion — scroll reveal + hover lift + pipeline pulse
   ========================================================================= */

/* Reveal base — JS adds .visible when element enters viewport */
.reveal {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: opacity, transform;
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Hero stagger on load (no scroll trigger — fires immediately) */
.hero .reveal { transition-delay: 0s; }
.hero .reveal:nth-child(1) { transition-delay: 0.00s; }
.hero .reveal:nth-child(2) { transition-delay: 0.08s; }
.hero .reveal:nth-child(3) { transition-delay: 0.18s; }
.hero .reveal:nth-child(4) { transition-delay: 0.28s; }
.hero .reveal:nth-child(5) { transition-delay: 0.38s; }
.hero .reveal:nth-child(6) { transition-delay: 0.48s; }

/* Hero name: terracotta underline that draws itself once the name is revealed.
   ::after is pointer-events:none → does not interfere with 5-tap easter egg. */
.hero-name-wrap {
    /* already position:relative from base — kept for clarity */
}

.hero-title::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -10px;
    height: 3px;
    width: 0;
    background: var(--accent);
    border-radius: 2px;
    pointer-events: none;
    transition: width 1.1s cubic-bezier(0.16, 1, 0.3, 1) 0.55s;
}

.hero-name-wrap.visible .hero-title::after {
    width: clamp(80px, 24%, 200px);
}

/* Metric cards: subtle lift + accent border on hover */
.metric {
    transition: border-color 0.3s ease, transform 0.3s ease;
}
.metric:hover {
    border-top-color: var(--accent);
    transform: translateY(-2px);
}
.metric-num {
    transition: color 0.3s ease;
}
.metric:hover .metric-num {
    color: var(--accent);
}

/* Facets: title shifts to accent on hover, body lightens */
.facet {
    transition: background 0.3s ease;
}
.facet-title {
    transition: color 0.3s ease;
}
.facet-body {
    transition: color 0.3s ease;
}
.facet:hover .facet-title {
    color: var(--accent);
}
.facet:hover .facet-body {
    color: var(--text);
}

/* Primary CTA: micro-lift + soft glow on hover */
.btn-primary {
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.25s ease;
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(217, 119, 87, 0.28);
}

/* Pipeline: traveling pulse dot across IMAP → n8n → Python → Power BI */
.pipeline-flow {
    /* track for the pulse — sits on top of the existing grid arrows */
    overflow: visible;
}

.flow-pulse {
    position: absolute;
    top: 0.55em;            /* aligns with the "→" arrows already in CSS */
    left: 12.5%;            /* center of first column */
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 0 var(--accent-soft);
    transform: translate(-50%, -50%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.pipeline-flow.flow-active .flow-pulse {
    opacity: 1;
    animation: flow-travel 3.4s cubic-bezier(0.65, 0, 0.35, 1) infinite,
               flow-glow   3.4s ease-in-out infinite;
}

@keyframes flow-travel {
    0%   { left: 12.5%; }
    25%  { left: 37.5%; }
    50%  { left: 62.5%; }
    75%  { left: 87.5%; }
    100% { left: 12.5%; opacity: 0; }
}

@keyframes flow-glow {
    0%, 100% { box-shadow: 0 0 0 0   rgba(217, 119, 87, 0.45); }
    50%      { box-shadow: 0 0 0 8px rgba(217, 119, 87, 0);    }
}

/* When pipeline collapses on mobile (column layout), hide traveling pulse */
@media (max-width: 440px) {
    .flow-pulse { display: none; }
}

/* =========================================================================
   Facets — non-hover life: numbered, slide-in stagger, traced top border
   ========================================================================= */
.facet { position: relative; }

/* Slim terracotta segment that draws over the existing grey border-top */
.facet::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 0;
    height: 1px;
    width: 0;
    background: var(--accent);
    transition: width 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.2s;
}

.facet.visible::before {
    width: 56px;
}

/* 01 / 02 / 03 / 04 — number above the title, slides in with the facet */
.facet-title { position: relative; }

.facet-title::before {
    content: attr(data-num);
    display: block;
    font-family: var(--mono);
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--accent);
    letter-spacing: 0.16em;
    margin-bottom: 10px;
    opacity: 0;
    transform: translateX(-6px);
    transition: opacity 0.55s ease 0.35s, transform 0.55s ease 0.35s;
}

.facet.visible .facet-title::before {
    opacity: 1;
    transform: translateX(0);
}

/* Override the global .reveal slide-up with a sideways slide for facets,
   so each card "arrives" from the left and feels alive on its own. */
.facet.reveal {
    transform: translateX(-14px);
}
.facet.reveal.visible {
    transform: translateX(0);
}

/* Per-facet stagger so all four feel like a sequence */
.facets .facet.reveal:nth-child(1) { transition-delay: 0s; }
.facets .facet.reveal:nth-child(2) { transition-delay: 0.08s; }
.facets .facet.reveal:nth-child(3) { transition-delay: 0.16s; }
.facets .facet.reveal:nth-child(4) { transition-delay: 0.24s; }

/* =========================================================================
   Scroll progress bar — terracotta line at top, grows with scrollY
   ========================================================================= */
#scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 2px;
    width: 0;
    background: linear-gradient(90deg, var(--accent), #E08C6F);
    z-index: 1001;
    transition: width 0.08s linear;
    will-change: width;
    pointer-events: none;
}

/* =========================================================================
   Status pill — flips from "Not looking" to "Available · Q2 2026" on load.
   Hover expands the on-state into the long detail label.
   ========================================================================= */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px 5px 10px;
    border-radius: 999px;
    font-family: var(--display);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    margin-bottom: 24px;
    width: max-content;
    max-width: 100%;
    transition: opacity 0.28s ease,
                background 0.5s ease,
                border-color 0.5s ease,
                color 0.5s ease;
    cursor: default;
}

/* OFF state — quiet neutral (no urgency, no color) */
.status-pill[data-state="off"] {
    background: transparent;
    border: 1px solid var(--line);
    color: var(--text-faint);
}

/* ON state — color swaps with the cycled label:
     • "NOW available!!!"          → green (signal of urgency / aliveness)
     • "Open to senior BI roles…"  → terracotta (on-brand, calm) */
.status-pill[data-state="on"][data-label="on"] {
    background: rgba(110, 200, 130, 0.10);
    border: 1px solid rgba(110, 200, 130, 0.42);
    color: #C7EBCF;
}

.status-pill[data-state="on"][data-label="detail"] {
    background: rgba(217, 119, 87, 0.06);
    border: 1px solid rgba(217, 119, 87, 0.28);
    color: var(--text);
}

/* Mid-flip / mid-cycle: brief opacity dip while we swap state or label */
.status-pill.flipping,
.status-pill.cycling {
    opacity: 0;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    transition: background 0.5s ease, box-shadow 0.4s ease;
    flex-shrink: 0;
}

.status-pill[data-state="off"] .status-dot {
    background: var(--text-faint);
    box-shadow: none;
}

/* Dot pulse follows the label color */
.status-pill[data-state="on"][data-label="on"] .status-dot {
    background: #6EC882;
    box-shadow: 0 0 0 0 rgba(110, 200, 130, 0.55);
    animation: status-pulse-green 1.8s ease-in-out infinite;
}

.status-pill[data-state="on"][data-label="detail"] .status-dot {
    background: var(--accent);
    box-shadow: 0 0 0 0 rgba(217, 119, 87, 0.40);
    animation: status-pulse-accent 2.4s ease-in-out infinite;
}

/* Project-card "live" dot stays in the editorial terracotta palette */
.status-dot.small {
    width: 6px;
    height: 6px;
    background: var(--accent);
    animation: status-pulse-accent 2.4s ease-in-out infinite;
}

@keyframes status-pulse-green {
    0%, 100% { box-shadow: 0 0 0 0   rgba(110, 200, 130, 0.55); }
    50%      { box-shadow: 0 0 0 7px rgba(110, 200, 130, 0);    }
}

@keyframes status-pulse-accent {
    0%, 100% { box-shadow: 0 0 0 0   rgba(217, 119, 87, 0.40); }
    50%      { box-shadow: 0 0 0 5px rgba(217, 119, 87, 0);    }
}

/* Three labels — only one shows at a time. data-label drives the cycle. */
.status-label { display: none; white-space: nowrap; }

/* En pantallas angostas el titular en español no entra en una sola línea y el
   pill se cortaba contra el borde. Se permite que el texto envuelva y que el
   pill se ajuste al ancho disponible, con el punto alineado a la primera línea. */
@media (max-width: 560px) {
    /* El pill se acota contra el viewport, no contra el padre: en pantallas
       angostas el contenedor del layout ya desborda (defecto preexistente,
       ajeno a este bloque), asi que medido contra el padre nunca encontraria
       un limite y el texto se cortaria contra el borde en vez de envolver.
       Los 80px absorben el padding del layout y el ancho de la barra de
       scroll, que en algunos navegadores entra dentro de 100vw. */
    .status-pill {
        align-items: flex-start;
        max-width: calc(100vw - 80px);
    }
    .status-label { white-space: normal; }
    .status-pill .status-dot { margin-top: 5px; }

    /* El eyebrow del hero lleva la línea de dominio, que no entra en una línea
       en pantallas angostas. Se acota igual que el pill —contra el viewport y
       no contra el padre— porque el contenedor ya desborda y, sin esto, la
       segunda mitad del texto queda fuera de la pantalla. */
    .hero-eyebrow {
        max-width: calc(100vw - 80px);
        align-items: flex-start;
    }

    /* El titular en inglés es más largo que el anterior y quedaba 32 px fuera
       de la pantalla. Mismo recurso: se acota contra el viewport para que
       envuelva. La bajada NO se toca acá: ya se cortaba con el texto viejo,
       y eso es parte del desborde preexistente del contenedor. */
    .hero-role {
        max-width: calc(100vw - 80px);
    }
}

.status-pill[data-state="off"] .off-label { display: inline; }
.status-pill[data-state="on"][data-label="on"]     .on-label     { display: inline; }
.status-pill[data-state="on"][data-label="detail"] .detail-label { display: inline; }

/* On-state cursor — the auto-cycle does the storytelling, no hover needed */
.status-pill[data-state="on"] { cursor: default; }

/* =========================================================================
   Vertical rail — sticky section index on the left
   ========================================================================= */
.rail {
    position: sticky;
    top: 28px;
    align-self: start;
    padding-top: 148px;     /* aligns with hero content baseline */
    display: flex;
    flex-direction: column;
    gap: 18px;
    font-family: var(--display);
}

.rail-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-faint);
    text-decoration: none;
    transition: color 0.25s ease, transform 0.25s ease;
}

.rail-item:hover {
    color: var(--text-soft);
    transform: translateX(2px);
}

.rail-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-faint);
    transition: background 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
    flex-shrink: 0;
}

.rail-num {
    font-family: var(--mono);
    color: var(--text-faint);
    font-size: 0.68rem;
    letter-spacing: 0.04em;
    transition: color 0.25s ease;
}

.rail-label {
    transition: color 0.25s ease;
}

.rail-item.active {
    color: var(--text);
}

.rail-item.active .rail-dot {
    background: var(--accent);
    box-shadow: 0 0 0 4px rgba(217, 119, 87, 0.16);
    transform: scale(1.1);
}

.rail-item.active .rail-num {
    color: var(--accent);
}

@media (max-width: 980px) {
    .rail { display: none; }
}

/* =========================================================================
   Section 04 — Stack chips
   ========================================================================= */
.stack-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 28px;
    margin-top: 8px;
}

.stack-group-title {
    font-family: var(--display);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-soft);
    margin-bottom: 14px;
}

.stack-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    display: inline-flex;
    align-items: center;
    padding: 7px 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--line);
    border-radius: 999px;
    font-family: var(--display);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-soft);
    letter-spacing: 0.01em;
    transition: color 0.25s ease, border-color 0.25s ease, transform 0.2s ease, background 0.25s ease;
    cursor: default;
}

.chip:hover {
    color: var(--text);
    border-color: var(--accent);
    background: rgba(217, 119, 87, 0.06);
    transform: translateY(-1px);
}

/* =========================================================================
   Section 05 — Project mini-cards
   ========================================================================= */
.projects {
    display: grid;
    /* El minimo va envuelto en min(): auto-fit colapsa columnas pero nunca
       achica una pista por debajo de su minimo, asi que un 420px rigido
       obligaba a toda la pagina a medir 420px de ancho aunque la pantalla
       fuera mas angosta, y el desborde se veia arriba, en el hero. Con
       min(420px, 100%) la pista cede al ancho disponible y colapsa a una
       sola columna, sin necesidad de un breakpoint nuevo. */
    grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr));
    gap: 20px;
    margin-top: 8px;
}

.project-card {
    padding: 24px 26px;
    background: var(--bg-elevated);
    border: 1px solid var(--line);
    border-radius: 8px;
    transition: border-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

.project-card:hover {
    border-color: var(--line-strong);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.project-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.project-tag {
    font-family: var(--display);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent);
}

.project-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--mono);
    font-size: 0.68rem;
    color: var(--text-soft);
    letter-spacing: 0.04em;
}

.project-title {
    font-family: var(--display);
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
    letter-spacing: -0.01em;
    margin-bottom: 12px;
}

.project-body {
    font-family: var(--serif);
    font-size: 0.98rem;
    line-height: 1.6;
    color: var(--text-soft);
    margin-bottom: 18px;
}

.project-body b {
    color: var(--text);
    font-weight: 500;
}

.project-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.chip-mini {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    background: transparent;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-family: var(--mono);
    font-size: 0.7rem;
    color: var(--text-soft);
    letter-spacing: 0.02em;
}

/* Respect users who don't want motion */
@media (prefers-reduced-motion: reduce) {
    .reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }
    .metric, .metric-num, .facet, .facet-title, .facet-body,
    .btn-primary {
        transition: none;
    }
    .metric:hover, .btn-primary:hover {
        transform: none;
        box-shadow: none;
    }
    .pipeline-flow.flow-active .flow-pulse {
        animation: none;
        opacity: 0;
    }
    .status-dot, .status-dot.small { animation: none; box-shadow: none; }
    .status-pill.flipping, .status-pill.cycling { opacity: 1; }
    .rail-item, .rail-dot, .rail-num, .rail-label,
    .chip, .project-card { transition: none; }
    .chip:hover, .project-card:hover { transform: none; box-shadow: none; }
    #scroll-progress { display: none; }
}


/* ============================================================
   Fallback sin JavaScript
   .reveal nace en opacity 0 y solo la clase .visible — que agrega
   el script — lo muestra. Si el script no corre, el contenido
   tiene que verse igual. El selector lleva html delante para
   ganarle a los overrides posteriores de .facet.reveal.
   ============================================================ */
html.no-js .reveal {
    opacity: 1;
    transform: none;
    transition: none;
}

/* El párrafo del Puente lo escribe el typewriter, así que sin script queda
   vacío. El texto plano ya vive en el HTML (#hidden-vision-en): se muestra
   con el mismo estilo y se retira el párrafo animado junto con su cursor. */
html.no-js .bridge-body { display: none; }

html.no-js #hidden-vision-en {
    display: block;
    font-family: var(--serif);
    font-style: italic;
    font-size: clamp(1.3rem, 2.4vw, 1.6rem);
    line-height: 1.5;
    color: var(--text);
    max-width: 640px;
}
