html {
    scroll-behavior: smooth;
}

/* =========================================================
   Carousel
   ========================================================= */
.carousel-track {
    display: flex;
    width: max-content;
    will-change: transform;
    cursor: grab;
    /* Vertical page pan stays with the browser, horizontal pan is ours */
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
}
.carousel-track.dragging { cursor: grabbing; }
.carousel-row {
    overflow: hidden;
    padding: 4px 0;
    mask-image: linear-gradient(to right, transparent, black 5%, black 95%, transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 5%, black 95%, transparent);
}

/* =========================================================
   Hero — typography helpers
   ========================================================= */
.font-display {
    letter-spacing: -0.01em;
}

.dot-grid {
    background-image: radial-gradient(circle, rgba(255, 255, 255, 0.18) 1px, transparent 1px);
    background-size: 24px 24px;
}

.highlight-underline {
    background-image: linear-gradient(transparent 65%, rgba(147, 197, 253, 0.55) 65%, rgba(147, 197, 253, 0.55) 92%, transparent 92%);
    padding: 0 0.1em;
}

/* Pill eyebrow label */
.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.85);
    padding: 0.4rem 0.85rem;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    white-space: nowrap;
    max-width: 100%;
}
@media (min-width: 640px) {
    .eyebrow { font-size: 0.66rem; letter-spacing: 0.12em; padding: 0.4rem 1rem; }
}
@media (min-width: 1280px) {
    .eyebrow { font-size: 0.7rem; letter-spacing: 0.14em; }
}
.eyebrow::before {
    content: '';
    flex: 0 0 6px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #93c5fd;
    box-shadow: 0 0 0 4px rgba(147, 197, 253, 0.25);
    animation: eyebrow-pulse 2s ease-in-out infinite;
}
@keyframes eyebrow-pulse {
    0%, 100% { box-shadow: 0 0 0 4px rgba(147, 197, 253, 0.25); }
    50%      { box-shadow: 0 0 0 8px rgba(147, 197, 253, 0);    }
}
.eyebrow.eyebrow-light {
    color: rgba(17, 24, 39, 0.8);
    border-color: rgba(17, 24, 39, 0.12);
    background: rgba(17, 24, 39, 0.04);
}
.eyebrow.eyebrow-light::before {
    background: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.22);
    animation: eyebrow-pulse-light 2s ease-in-out infinite;
}
@keyframes eyebrow-pulse-light {
    0%, 100% { box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.22); }
    50%      { box-shadow: 0 0 0 8px rgba(59, 130, 246, 0);    }
}

/* =========================================================
   Buttons
   ========================================================= */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.9rem 1.6rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: transform 0.2s, box-shadow 0.2s, background 0.2s, border-color 0.2s;
    white-space: nowrap;
    cursor: pointer;
}
.btn-primary {
    background: #ffffff;
    color: #1e40af;
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px -12px rgba(0, 0, 0, 0.45);
    background: #eff6ff;
}
.btn-ghost {
    background: transparent;
    color: #ffffff;
    border: 2px solid rgba(255, 255, 255, 0.6);
}
.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: #ffffff;
}
.btn .arrow { transition: transform 0.2s; display: inline-block; }
.btn:hover .arrow { transform: translate(3px, -3px); }

/* =========================================================
   Stat badge — glass card on blue
   ========================================================= */
.stat-badge {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 14px;
    padding: 1.05rem 1.2rem;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    transition: background 0.25s, border-color 0.25s, transform 0.25s;
}
.stat-badge:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}
.stat-badge .num {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    color: #ffffff;
    letter-spacing: -0.01em;
}
.stat-badge .num .plus {
    color: #fbbf24;
    font-style: italic;
    margin-left: 0.05em;
}
.stat-badge .label {
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.75);
    margin-top: 0.4rem;
    letter-spacing: 0.02em;
    line-height: 1.3;
}

/* =========================================================
   Orbit graphic
   ========================================================= */
.orbit-wrap {
    position: relative;
    aspect-ratio: 1;
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    /* Only chips should catch pointer events — ring/track/center boxes are inert */
    pointer-events: none;
}
.orbit-ring {
    position: absolute;
    inset: 0;
    border: 1px dashed rgba(255, 255, 255, 0.22);
    border-radius: 50%;
}
.orbit-ring.r2 {
    inset: 12%;
    border-style: solid;
    border-color: rgba(255, 255, 255, 0.12);
}
.orbit-ring.r3 {
    inset: 26%;
    border-style: dashed;
    border-color: rgba(147, 197, 253, 0.35);
}
.orbit-ring.r4 {
    inset: 40%;
    border-style: solid;
    border-color: rgba(255, 255, 255, 0.08);
}

@keyframes chip-spin {
    from { transform: translateX(-50%) rotate(0deg); }
    to   { transform: translateX(-50%) rotate(360deg); }
}

.orbit-track {
    position: absolute;
    inset: 0;
    will-change: transform;
}
.orbit-track.mid { inset: 13%; }
.orbit-track.inner { inset: 27%; }

.orbit-chip {
    position: absolute;
    top: -18px;
    left: 50%;
    transform: translateX(-50%);
    background: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 999px;
    padding: 0.45rem 0.9rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: #1e40af;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    animation: chip-spin 8s linear infinite;
    cursor: grab;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    pointer-events: auto;
}
/* Invisible hit area for comfortable touch targets */
.orbit-chip::before {
    content: "";
    position: absolute;
    inset: -10px -8px;
    border-radius: inherit;
}
.orbit-chip.dragging {
    cursor: grabbing;
    z-index: 5;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
    /* Freeze chip-spin where it currently is (pauses, doesn't reset to 0) */
    animation-play-state: paused;
}

.orbit-chip i { font-size: 0.9rem; }
.orbit-chip i.fa-code,
.orbit-chip i.fa-sitemap,
.orbit-chip i.fa-cloud       { color: #3b82f6; }
.orbit-chip i.fa-cogs,
.orbit-chip i.fa-microchip   { color: #1e40af; }
.orbit-chip i.fa-robot,
.orbit-chip i.fa-flask,
.orbit-chip i.fa-handshake   { color: #f59e0b; }

.orbit-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #ffffff 0%, #eff6ff 60%, #dbeafe 100%);
    border: 1px solid rgba(255, 255, 255, 0.35);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: clamp(1.4rem, 3vw, 2rem);
    font-weight: 700;
    line-height: 1;
    color: #1e40af;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    text-align: center;
    letter-spacing: -0.02em;
}
.orbit-center em { font-style: italic; font-weight: 500; font-size: 0.9em; opacity: 0.85; }

/* Center is interactive: tap to toggle vinyl, drag to scratch */
.orbit-center {
    pointer-events: auto;
    cursor: grab;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    transition: box-shadow 0.3s;
    will-change: transform;
}
.orbit-center:hover {
    box-shadow: 0 14px 48px rgba(0, 0, 0, 0.38);
}
.orbit-center.dragging {
    cursor: grabbing;
}

/* Freeze each chip's own counter-rotation in vinyl mode so they ride
   the track as a piece. The track + center rotation is JS-driven now. */
.orbit-vinyl .orbit-chip {
    animation-play-state: paused;
}

/* =========================================================
   Dark mode adjustments for custom helpers
   ========================================================= */
/* Eyebrow used on light sections (Portfolio, About, …) needs to flip
   from "dark text on light bg" to "light text on dark bg". */
.dark .eyebrow.eyebrow-light {
    color: rgba(241, 245, 249, 0.85);
    border-color: rgba(241, 245, 249, 0.18);
    background: rgba(241, 245, 249, 0.06);
}
.dark .eyebrow.eyebrow-light::before {
    background: #60a5fa;
    box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.25);
    animation: eyebrow-pulse-light-dark 2s ease-in-out infinite;
}
@keyframes eyebrow-pulse-light-dark {
    0%, 100% { box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.25); }
    50%      { box-shadow: 0 0 0 8px rgba(96, 165, 250, 0);    }
}

/* Btn-primary on dark contact section: keep white but a touch dimmer
   so it doesn't shout against the very dark gradient. */
.dark .btn-primary {
    background: #e2e8f0;
}
.dark .btn-primary:hover {
    background: #f1f5f9;
}

/* Soft transitions on theme switch */
html.theme-fade body,
html.theme-fade nav,
html.theme-fade section,
html.theme-fade footer {
    transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

/* =========================================================
   Manual pause — body.paused freezes all CSS-animated bits.
   JS-driven motion (orbit autospin, carousel scroll) is gated
   separately by the same flag inside js/main.js.
   ========================================================= */
body.paused .orbit-chip,
body.paused .eyebrow::before,
body.paused .eyebrow.eyebrow-light::before {
    animation-play-state: paused;
}

/* =========================================================
   Reduced motion
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
    .orbit-chip { animation: none; }
    html { scroll-behavior: auto; }
}
