/* ============================================================================
   Base — reset, typography, layout primitives and shared utilities
   ========================================================================= */

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

* {
    margin: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}

body {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    color: var(--ink);
    background: var(--paper);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
}

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

input,
button,
textarea,
select {
    font: inherit;
    color: inherit;
}

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

button {
    cursor: pointer;
    background: none;
    border: none;
}

::selection {
    background: var(--mint);
    color: var(--ink);
}

:focus-visible {
    outline: 2px solid var(--mint-deep);
    outline-offset: 3px;
    border-radius: 4px;
}

/* ---- Headings -------------------------------------------------------- */

h1, h2, h3, h4, h5 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.04;
    letter-spacing: -0.02em;
    color: var(--ink);
    text-wrap: balance;
}

h1 { font-size: clamp(2.6rem, 6vw, 5.4rem); font-weight: 700; }
h2 { font-size: clamp(2rem, 4vw, 3.2rem); }
h3 { font-size: clamp(1.3rem, 2.4vw, 1.9rem); }
h4 { font-size: 1.15rem; letter-spacing: -0.01em; }

p { text-wrap: pretty; }

.serif {
    font-family: var(--font-serif);
    font-weight: 400;
    font-style: italic;
    letter-spacing: -0.01em;
}

.mono {
    font-family: var(--font-mono);
    font-size: 0.76rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.6em;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--ink-muted);
}

.eyebrow::before {
    content: "";
    width: 26px;
    height: 1px;
    background: currentColor;
    opacity: 0.6;
}

.lede {
    font-size: clamp(1.05rem, 1.6vw, 1.3rem);
    line-height: 1.55;
    color: var(--ink-soft);
}

.muted { color: var(--ink-muted); }

/* ---- Layout primitives ---------------------------------------------- */

.container {
    width: 100%;
    max-width: var(--maxw);
    margin-inline: auto;
    padding-inline: var(--gutter);
}

.section {
    padding-block: clamp(64px, 10vw, 130px);
}

.stack { display: flex; flex-direction: column; }
.stack-sm > * + * { margin-top: 0.75rem; }
.stack-md > * + * { margin-top: 1.4rem; }
.cluster {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}
.between {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.grow { flex: 1; }

.divider {
    height: 1px;
    background: var(--line);
    border: 0;
}

.grid { display: grid; gap: clamp(18px, 2.4vw, 32px); }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 940px) {
    .cols-3, .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
    .cols-2, .cols-3, .cols-4 { grid-template-columns: 1fr; }
}

/* ---- Utility --------------------------------------------------------- */

.hide { display: none !important; }
.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}
.text-center { text-align: center; }
.uppercase { text-transform: uppercase; }
.nowrap { white-space: nowrap; }
.full { width: 100%; }

/* ---- Scroll reveal --------------------------------------------------- */

[data-reveal] {
    opacity: 0;
    transform: translateY(26px);
    transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
    will-change: opacity, transform;
}
[data-reveal].is-in {
    opacity: 1;
    transform: none;
}

/* ---- Ambient living overlay ------------------------------------------ */

.ambient {
    position: fixed;
    inset: 0;
    z-index: 5;
    pointer-events: none;
    overflow: hidden;
}
.ambient__orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0;
    animation: orb-rise 20s var(--ease) infinite;
}
.ambient__orb--sky { width: 46vmax; height: 46vmax; left: -12vmax; top: 6vh; background: radial-gradient(circle, rgba(0, 98, 155, 0.6), transparent 65%); }
.ambient__orb--blue { width: 42vmax; height: 42vmax; right: -14vmax; top: 34vh; background: radial-gradient(circle, rgba(0, 98, 155, 0.5), transparent 65%); animation-duration: 26s; animation-delay: -9s; }
.ambient__orb--coral { width: 36vmax; height: 36vmax; left: 34vw; bottom: -16vmax; background: radial-gradient(circle, rgba(255, 91, 58, 0.4), transparent 65%); animation-duration: 32s; animation-delay: -16s; }
@keyframes orb-rise {
    0% { opacity: 0; transform: translate3d(0, 8vh, 0) scale(0.92); }
    14% { opacity: var(--orb-o, 0.9); }
    50% { opacity: var(--orb-o, 0.9); transform: translate3d(4vw, -5vh, 0) scale(1.1); }
    86% { opacity: var(--orb-o, 0.9); }
    100% { opacity: 0; transform: translate3d(-3vw, -12vh, 0) scale(0.95); }
}

.dust { position: absolute; inset: 0; }
.dust i {
    position: absolute;
    bottom: -2vh;
    left: 0;
    width: var(--s, 5px);
    height: var(--s, 5px);
    border-radius: 50%;
    background: currentColor;
    color: var(--blue);
    opacity: 0;
    transform: translate3d(0, 0, 0);
    animation: dust-rise var(--d, 16s) linear infinite;
    animation-delay: var(--delay, 0s);
}
.dust i:nth-child(3n) { color: var(--violet); }
.dust i:nth-child(3n+1) { color: var(--blue-deep); }
@keyframes dust-rise {
    0% { opacity: 0; transform: translate3d(0, 0, 0); }
    10% { opacity: var(--o, 0.5); }
    88% { opacity: var(--o, 0.5); }
    100% { opacity: 0; transform: translate3d(var(--x, 0px), -108vh, 0); }
}

@keyframes pan { to { background-position: -300% 0; } }

/* ---- Boot splash ------------------------------------------------------ */

.boot {
    min-height: 100vh;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 1.4rem;
    background: var(--ink);
}
.boot__mark {
    width: clamp(80px, 14vw, 120px);
    height: clamp(80px, 14vw, 120px);
    border-radius: 26px;
    padding: 5px;
    background: var(--paper);
    overflow: hidden;
    box-shadow: var(--shadow-lift);
    animation: bob 1.6s var(--ease) infinite alternate;
}
.boot__mark img { width: 100%; height: 100%; object-fit: contain; display: block; }
.boot__text {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--paper-2);
    letter-spacing: -0.02em;
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
}
.boot__dots { display: inline-flex; gap: 3px; }
.boot__dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--blue); animation: blink 1.2s var(--ease) infinite; }
.boot__dots i:nth-child(2) { animation-delay: 0.2s; }
.boot__dots i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 40% { opacity: 0.2; } 100% { opacity: 1; } }
@keyframes bob { from { transform: translateY(0); } to { transform: translateY(-8px); } }

/* Blazor's boot-failure bar. The runtime flips it to display:block on a crash. */
#blazor-error-ui {
    display: none;
    position: fixed;
    inset: auto 0 0 0;
    z-index: 1000;
    padding: 0.7rem 1.3rem;
    background: #FFE9A8;
    color: var(--ink);
    box-shadow: 0 -2px 12px rgba(10, 15, 28, 0.16);
    font-family: var(--font-body);
    font-size: 0.9rem;
}
#blazor-error-ui a { color: var(--blue); margin-left: 0.6rem; font-weight: 600; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.9rem; top: 0.5rem; }
