/* =====================================================
   DAWID MIKA — Portfolio — Global Styles (light theme)
   ===================================================== */

:root {
    /* Brand colours */
    --brand-primary:       #4F46E5;
    --brand-primary-rgb:   79, 70, 229;
    --brand-secondary:     #0EA5E9;
    --brand-secondary-rgb: 14, 165, 233;

    /* Gradient used on brand text & section headings */
    --brand-gradient: linear-gradient(90deg,
        #4F46E5   0%,
        #6366F1  45%,
        #0EA5E9 100%);

    /* Background */
    --bg-base: #F8FAFC;
    --bg-mid:  #FFFFFF;
    --bg-alt:  #EEF2F7;

    /* Card surface */
    --card-bg:           #FFFFFF;
    --card-border:        #E2E8F0;
    --card-shadow:        0 1px 3px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(15, 23, 42, 0.05);
    --card-shadow-hover:  0 10px 28px rgba(15, 23, 42, 0.10);

    /* Text */
    --text-primary:   #0F172A;
    --text-secondary: #475569;
    --text-muted:     #94A3B8;

    /* Navbar */
    --navbar-h: 64px;

    /* Page content width — keeps things readable on ultrawide monitors */
    --content-max: 75rem;

    /* Motion. Everything hover/transition-related references one of
       these three so the whole site's pace can be tuned from here. */
    --ease-out:     cubic-bezier(0.22, 1, 0.36, 1);
    --ease-bounce:  cubic-bezier(0.34, 1.56, 0.64, 1);
    --motion-fast:  0.25s;  /* icon nudges, small colour swaps */
    --motion-base:  0.35s;  /* card/button hover, link colour */
    --motion-slow:  0.55s;  /* navbar background, larger surfaces */

    --reveal-duration:      0.9s;
    --reveal-duration-left: 0.8s;
}

/* ── Base ──────────────────────────────────────────── */

html {
    font-size: 16px;
    scroll-behavior: smooth;
    scroll-padding-top: var(--navbar-h);
    scrollbar-width: thin;
    scrollbar-color: #A5B4FC transparent;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
    color: var(--text-primary);
    background: var(--bg-base);
    min-height: 100vh;
    overflow-x: hidden;
}

::selection {
    background: rgba(var(--brand-primary-rgb), 0.16);
}

h1, h2, h3, h4, h5 {
    font-family: "Sora", sans-serif !important;
    color: var(--text-primary);
}

a { color: var(--brand-primary); }

/* ── Buttons ───────────────────────────────────────── */

.btn {
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 0.01em;
    padding: 0.6rem 1.25rem;
    border-radius: 0.6rem;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: transform var(--motion-base) ease, box-shadow var(--motion-base) ease,
                background var(--motion-base) ease, color var(--motion-base) ease,
                border-color var(--motion-base) ease;
}

.btn:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: 2px;
}

/* Right-arrow icons inside buttons nudge on hover */
.btn .fa-arrow-right { transition: transform var(--motion-fast) ease; }
.btn:hover .fa-arrow-right { transform: translateX(3px); }

.btn-primary {
    background: var(--brand-gradient);
    color: #fff;
    box-shadow: 0 6px 16px rgba(var(--brand-primary-rgb), 0.28);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(var(--brand-primary-rgb), 0.34);
    color: #fff;
}

/* Light sweep across the primary button on hover */
.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: -80%;
    width: 45%;
    transform: skewX(-22deg);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
    transition: left var(--motion-slow) ease;
    pointer-events: none;
}

.btn-primary:hover::before { left: 130%; }

.btn-outline {
    background: transparent;
    color: var(--text-primary);
    border-color: var(--card-border);
}

.btn-outline:hover {
    border-color: var(--brand-primary);
    color: var(--brand-primary);
    background: rgba(var(--brand-primary-rgb), 0.05);
}

.btn-lg {
    padding: 0.8rem 1.6rem;
    font-size: 0.98rem;
}

.btn-sm {
    padding: 0.4rem 0.85rem;
    font-size: 0.82rem;
}

/* ── Utilities ─────────────────────────────────────── */

.text-center { text-align: center; }

.text-primary-gradient {
    background: var(--brand-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.me-1 { margin-right: 0.25rem; }
.me-2 { margin-right: 0.5rem; }
.ms-1 { margin-left: 0.25rem; }
.ms-2 { margin-left: 0.5rem; }
.mt-4 { margin-top: 1.5rem; }

/* ── Motion: shared keyframes ──────────────────────── */

@keyframes fade-up {
    from { opacity: 0; translate: 0 24px; }
    to   { opacity: 1; translate: 0 0; }
}

@keyframes reveal-in {
    from { opacity: 0; translate: 0 28px; }
    to   { opacity: 1; translate: 0 0; }
}

@keyframes reveal-in-left {
    from { opacity: 0; translate: -28px 0; }
    to   { opacity: 1; translate: 0 0; }
}

/* ── Motion: scroll-reveal system ──────────────────────
   `html.js` is set by an inline <head> script only when
   IntersectionObserver is available, so without JS nothing
   is ever hidden. site.js adds .revealed on first intersection.
   Animations use the individual `translate` property so they
   never fight component hover `transform`s. */

html.js .reveal { opacity: 0; }

html.js .reveal.revealed {
    animation: reveal-in var(--reveal-duration) var(--ease-out) var(--reveal-delay, 0s) both;
}

html.js .reveal.reveal-left.revealed {
    animation-name: reveal-in-left;
    animation-duration: var(--reveal-duration-left);
}

/* Stagger children of a grid/list — combine with .reveal on each child */
.reveal-stagger > :nth-child(2) { --reveal-delay: 130ms; }
.reveal-stagger > :nth-child(3) { --reveal-delay: 260ms; }
.reveal-stagger > :nth-child(4) { --reveal-delay: 390ms; }
.reveal-stagger > :nth-child(5) { --reveal-delay: 520ms; }
.reveal-stagger > :nth-child(6) { --reveal-delay: 650ms; }
.reveal-stagger > :nth-child(7) { --reveal-delay: 780ms; }
.reveal-stagger > :nth-child(8) { --reveal-delay: 910ms; }

/* Fixed delay helpers for hand-ordered entrances */
.reveal-d1 { --reveal-delay: 150ms; }
.reveal-d2 { --reveal-delay: 320ms; }

/* ── Social links ──────────────────────────────────── */

.social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    margin: 0.15rem;
    font-size: 1.1rem;
    line-height: 1;
    border-radius: 50%;
    background: var(--bg-alt);
    text-decoration: none;
    transition: transform var(--motion-base) ease, opacity var(--motion-base) ease;
}

.social-link:hover {
    transform: scale(1.1);
    opacity: 0.85;
}

/* ── 404 / Error status pages ──────────────────────── */

.nf-wrap {
    min-height: calc(100vh - var(--navbar-h));
    margin-top: var(--navbar-h);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.nf-content {
    text-align: center;
    max-width: 28rem;
    animation: fade-up 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.nf-code {
    font-family: "JetBrains Mono", monospace;
    font-size: 3.5rem;
    font-weight: 700;
    background: var(--brand-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.nf-title {
    font-size: 1.4rem;
    margin-bottom: 0.75rem;
}

.nf-desc {
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 0.5rem;
}

.nf-request-id {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.nf-btn {
    display: inline-flex;
    align-items: center;
    margin-top: 1.25rem;
    padding: 0.65rem 1.4rem;
    border-radius: 0.6rem;
    background: var(--brand-gradient);
    color: #fff;
    font-family: "Inter", sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    transition: transform var(--motion-base) ease, box-shadow var(--motion-base) ease;
}

.nf-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(var(--brand-primary-rgb), 0.3);
    color: #fff;
}

/* ── Blazor error boundary ─────────────────────────── */

.blazor-error-boundary {
    background: #b91c1c;
    padding: 1rem;
    color: white;
    border-radius: 0.5rem;
}

.blazor-error-boundary::after { content: "An error has occurred." }

/* ── Form validation (kept for future forms) ───────── */

.valid.modified:not([type=checkbox]) { outline: 1px solid #16a34a; }
.invalid                             { outline: 1px solid #dc2626; }
.validation-message                  { color: #dc2626; }

/* ── Reduced motion ────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
    /* Zeroing *-delay is the part that's easy to forget: without it,
       elements with an animation-delay (the hero stagger, the typed
       eyebrow, reveal-stagger children, …) still sit in their `from`
       keyframe state — usually invisible — for the full delay before
       snapping into view once the (now near-instant) animation plays.
       That reads as "content pops in after the page finishes loading"
       instead of "no motion", which is the opposite of the intent. */
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-delay: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        transition-delay: 0.01ms !important;
    }

    html { scroll-behavior: auto; }

    html.js .reveal { opacity: 1; }
}
