/* ==========================================================================
   Blend Software Innovations — "Obsidian Instrument" design system
   Precision-engineering aesthetic: obsidian canvas, hairline grid, a single
   light source, one electric accent. Depth comes from layered darkness.
   ========================================================================== */

:root {
    /* Brand ramp, taken from the logo's amber.
       White on this orange only reaches 2.55:1, so filled surfaces carry dark
       ink instead (7.4:1) — which is what the logo itself does. */
    --brand: #f2913c;
    --brand-dark: #d9761f;
    --brand-glow: #fbbf7a;  /* fixed light tint for fills and the dark hero */
    --on-brand: #12161f;    /* ink on any brand-filled surface */
    --brand-lift: #b45309;  /* text accent — dark enough for the light theme */
    --spark: #c2410c;

    /* Surfaces — light ("arctic") theme */
    --bg: #f4f6fb;
    --surface: #ffffff;
    --surface-2: #eef1f8;
    --ink: #070b14;
    --ink-soft: #26324a;
    --muted: #5a6884;
    --hairline: rgba(7, 11, 20, 0.09);
    --hairline-strong: rgba(7, 11, 20, 0.16);
    --grid: rgba(7, 11, 20, 0.045);
    --glow: rgba(242, 145, 60, 0.18);
    /* Layered like a physical object: a tight contact shadow, a soft mid
       ambient, and a long cast — depth reads even before anything moves. */
    --panel-shadow:
        0 1px 2px rgba(7, 11, 20, 0.04),
        0 8px 20px -12px rgba(7, 11, 20, 0.14),
        0 30px 60px -34px rgba(7, 11, 20, 0.34);
    --grain-opacity: 0.035;

    /* Type */
    --font-display: "Archivo", "Segoe UI", sans-serif;
    --font-body: "Manrope", "Segoe UI", sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Code", monospace;

    /* Motion */
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
}

.dark {
    --bg: #05070d;
    --surface: #0a0e17;
    --surface-2: #0e131f;
    --ink: #eef2f8;
    --ink-soft: #c3ccdb;
    --muted: #8492a6;
    --hairline: rgba(255, 255, 255, 0.08);
    --hairline-strong: rgba(255, 255, 255, 0.16);
    --grid: rgba(255, 255, 255, 0.032);
    --glow: rgba(242, 145, 60, 0.2);
    --panel-shadow:
        0 1px 0 rgba(255, 255, 255, 0.05) inset,
        0 8px 24px -14px rgba(0, 0, 0, 0.55),
        0 40px 90px -46px rgba(0, 0, 0, 0.95);
    --grain-opacity: 0.05;

    /* On obsidian the accent can be the light tint — it reads at 9:1 there,
       where the light theme needs the dark amber above. */
    --brand-lift: #fbbf7a;
    --spark: #fcd34d;
}

/* --------------------------------------------------------------- base --- */

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

html {
    font-family: var(--font-body);
    background-color: var(--bg);
    -webkit-font-smoothing: antialiased;
}

body {
    min-height: 100vh;
    position: relative;
    overflow-x: clip;
}

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

a {
    text-decoration: none;
}

::selection {
    background: var(--brand);
    color: var(--on-brand);
}

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

.skip-link {
    position: absolute;
    left: 1rem;
    top: -4rem;
    z-index: 100;
    padding: 0.75rem 1.25rem;
    border-radius: 999px;
    background: var(--brand);
    color: var(--on-brand);
    font-weight: 600;
    font-size: 0.875rem;
    transition: top 200ms var(--ease-out);
}

.skip-link:focus {
    top: 1rem;
}

/* ------------------------------------------------- atmosphere layers --- */

/* Hairline technical grid — the "instrument" motif, drawn behind everything. */
.atmosphere {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    /* Isolate the layer so its paint never invalidates page content. */
    contain: strict;
    isolation: isolate;
}

.atmosphere__grid {
    position: absolute;
    inset: -1px;
    background-image:
        linear-gradient(to right, var(--grid) 1px, transparent 1px),
        linear-gradient(to bottom, var(--grid) 1px, transparent 1px);
    background-size: 76px 76px;
    mask-image: radial-gradient(ellipse 110% 80% at 50% 0%, #000 30%, transparent 78%);
    -webkit-mask-image: radial-gradient(ellipse 110% 80% at 50% 0%, #000 30%, transparent 78%);
}

/* Single light source, top-centre — everything else falls away from it.
   Drifts a few pixels against the scroll so the light field sits on a deeper
   plane than the content. --scroll is written by main.js. */
.atmosphere__aurora {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(60rem 32rem at 50% -12%, var(--glow), transparent 65%),
        radial-gradient(40rem 28rem at 92% 8%, rgba(242, 145, 60, 0.1), transparent 60%);
    transform: translate3d(0, calc(var(--scroll, 0) * 0.03px), 0);
    will-change: transform;
}

/* Film grain keeps large dark fields from banding. Plain opacity rather than a
   blend mode — blending a viewport-sized fixed layer forces the whole page to
   re-composite on every scroll. */
.atmosphere__grain {
    position: absolute;
    inset: 0;
    opacity: var(--grain-opacity);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

.shell {
    position: relative;
    z-index: 1;
}

/* ---------------------------------------------------------- typography --- */

.display {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -0.035em;
    line-height: 1.02;
    color: var(--ink);
    text-wrap: balance;
}

.display--xl {
    font-size: clamp(2.85rem, 6.6vw, 5.25rem);
}

.display--lg {
    font-size: clamp(2.1rem, 4.2vw, 3.4rem);
}

.display--md {
    font-size: clamp(1.35rem, 2vw, 1.75rem);
    letter-spacing: -0.025em;
    line-height: 1.15;
}

/* Numbered technical eyebrow: "01 / CORE SERVICES" */
.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--muted);
}

.eyebrow::before {
    content: "";
    width: 1.75rem;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--brand-lift));
}

.eyebrow__index {
    color: var(--brand-lift);
}

.lede {
    color: var(--muted);
    font-size: clamp(1rem, 1.1vw, 1.125rem);
    line-height: 1.65;
    text-wrap: pretty;
}

.mono {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

/* Accent gradient on a single phrase — used once, in the hero. */
.ink-spark {
    background: linear-gradient(96deg, var(--brand-lift) 0%, var(--spark) 55%, var(--brand-lift) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* -------------------------------------------------------------- panels --- */

.panel {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--hairline);
    border-radius: 20px;
    box-shadow: var(--panel-shadow);
}

/* Corner ticks — instrument-panel registration marks. */
.panel--ticked::before,
.panel--ticked::after {
    content: "";
    position: absolute;
    width: 9px;
    height: 9px;
    border-color: var(--brand-lift);
    opacity: 0.55;
    transition: opacity 300ms var(--ease-out);
}

.panel--ticked::before {
    top: 12px;
    left: 12px;
    border-top: 1px solid;
    border-left: 1px solid;
}

.panel--ticked::after {
    bottom: 12px;
    right: 12px;
    border-bottom: 1px solid;
    border-right: 1px solid;
}

/* Cursor-tracking spotlight. --mx/--my are written by main.js. */
.spot {
    --mx: 50%;
    --my: 0%;
    overflow: hidden;
    transition: transform 500ms var(--ease-out), border-color 500ms var(--ease-out);
}

.spot::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    opacity: 0;
    transition: opacity 400ms var(--ease-out);
    background: radial-gradient(18rem 18rem at var(--mx) var(--my), rgba(251, 191, 122, 0.13), transparent 70%);
}

@media (hover: hover) {
    .spot:hover {
        transform: translateY(-4px);
        border-color: var(--hairline-strong);
    }

    .spot:hover::after {
        opacity: 1;
    }

    .spot:hover.panel--ticked::before,
    .spot:hover.panel--ticked::after {
        opacity: 1;
    }
}

/* -------------------------------------------------------------- buttons --- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.95rem 1.6rem;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1;
    transition: transform 260ms var(--ease-out), box-shadow 260ms var(--ease-out),
        background-color 260ms var(--ease-out), border-color 260ms var(--ease-out), color 260ms var(--ease-out);
}

.btn:active {
    transform: translateY(1px);
}

.btn--primary {
    position: relative;
    color: var(--on-brand);
    background: linear-gradient(180deg, var(--brand-glow) -30%, var(--brand) 50%, var(--brand-dark) 100%);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.4) inset, 0 12px 30px -12px rgba(217, 118, 31, 0.7);
}

.btn--primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset, 0 20px 42px -14px rgba(217, 118, 31, 0.85);
}

.btn--ghost {
    color: var(--ink);
    background: transparent;
    border: 1px solid var(--hairline-strong);
}

.btn--ghost:hover {
    transform: translateY(-2px);
    border-color: var(--brand-lift);
    color: var(--brand-lift);
}

.btn--sm {
    padding: 0.7rem 1.25rem;
    font-size: 0.8rem;
}

/* Arrow link with a travelling chevron. */
.link-arrow {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--brand-lift);
}

.link-arrow span {
    transition: transform 300ms var(--ease-out);
}

.link-arrow:hover span {
    transform: translateX(5px);
}

/* --------------------------------------------------------------- header --- */

.masthead {
    position: sticky;
    top: 0;
    z-index: 50;
    transition: background-color 400ms var(--ease-out), border-color 400ms var(--ease-out),
        backdrop-filter 400ms var(--ease-out);
    border-bottom: 1px solid transparent;
}

.masthead[data-stuck="true"] {
    background: color-mix(in srgb, var(--bg) 78%, transparent);
    backdrop-filter: blur(18px) saturate(160%);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
    border-bottom-color: var(--hairline);
}

.navlink {
    position: relative;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--muted);
    transition: color 260ms var(--ease-out);
}

.navlink::after {
    content: "";
    position: absolute;
    left: 0;
    right: 100%;
    bottom: -6px;
    height: 1px;
    background: var(--brand-lift);
    transition: right 320ms var(--ease-out);
}

.navlink:hover {
    color: var(--ink);
}

.navlink:hover::after {
    right: 0;
}

/* Monogram with a soft internal light. */
.monogram {
    display: grid;
    place-items: center;
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 12px;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: -0.02em;
    color: var(--on-brand);
    background: linear-gradient(150deg, var(--brand-glow), var(--brand) 45%, var(--brand-dark));
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.45) inset, 0 8px 22px -10px rgba(217, 118, 31, 0.75);
}

/* ----------------------------------------------------------- hero scene --- */

/* The scene viewport stays obsidian in both themes — the wireframe's additive
   glow only reads against darkness, and a fixed dark aperture reads as a
   deliberate instrument rather than an inconsistency. */
.hero-3d {
    background:
        radial-gradient(circle at 32% 28%, rgba(252, 211, 77, 0.16), transparent 58%),
        radial-gradient(circle at 74% 78%, rgba(242, 145, 60, 0.24), transparent 62%),
        linear-gradient(158deg, #0b1120 0%, #05070d 100%);
    border-color: rgba(255, 255, 255, 0.1);
}

/* Text laid over the always-dark viewport. */
.on-scene {
    color: #8fa0b8;
}

.hero-3d__canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.hero-3d__fallback {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 600ms var(--ease-out);
}

.hero-3d[data-ready="true"] .hero-3d__fallback {
    opacity: 0;
    pointer-events: none;
}

/* Floating readout pinned to the scene. */
.readout {
    backdrop-filter: blur(14px) saturate(150%);
    -webkit-backdrop-filter: blur(14px) saturate(150%);
    background: color-mix(in srgb, var(--surface) 72%, transparent);
}

.pulse-dot {
    position: relative;
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: #34d399;
    box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.6);
    animation: pulse 2.4s var(--ease-out) infinite;
}

@keyframes pulse {
    70% { box-shadow: 0 0 0 9px rgba(52, 211, 153, 0); }
    100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}

/* -------------------------------------------------------------- marquee --- */

.marquee {
    position: relative;
    overflow: hidden;
    mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}

.marquee__track {
    display: flex;
    width: max-content;
    animation: slide 46s linear infinite;
}

.marquee:hover .marquee__track {
    animation-play-state: paused;
}

.marquee__item {
    display: inline-flex;
    align-items: center;
    gap: 2.75rem;
    padding-right: 2.75rem;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.26em;
    text-transform: uppercase;
    color: var(--muted);
    white-space: nowrap;
}

.marquee__item::after {
    content: "";
    width: 4px;
    height: 4px;
    border-radius: 999px;
    background: var(--brand-lift);
    opacity: 0.5;
}

@keyframes slide {
    to { transform: translateX(-50%); }
}

/* ---------------------------------------------------------------- cards --- */

/* Service cards tilt toward the pointer. --rx/--ry are written by main.js. */
.tilt {
    --rx: 0deg;
    --ry: 0deg;
    transform: perspective(1100px) rotateX(var(--rx)) rotateY(var(--ry));
    transform-style: preserve-3d;
    transition: transform 400ms var(--ease-out), border-color 400ms var(--ease-out);
    will-change: transform;
}

.tilt > * {
    transform: translateZ(24px);
}

/* Soft tilt — the element rotates as one plane toward the pointer without
   pushing its children forward. Used on large composite surfaces (the hero
   instrument) where a full parallax pop would feel unstable. */
.tilt--soft {
    --rx: 0deg;
    --ry: 0deg;
    transform: perspective(1500px) rotateX(var(--rx)) rotateY(var(--ry));
    transform-style: preserve-3d;
    transition: transform 600ms var(--ease-out);
    will-change: transform;
}

.card-icon {
    display: grid;
    place-items: center;
    width: 3rem;
    height: 3rem;
    border-radius: 14px;
    color: var(--brand-lift);
    background: color-mix(in srgb, var(--brand) 14%, transparent);
    border: 1px solid color-mix(in srgb, var(--brand-lift) 28%, transparent);
    transition: transform 400ms var(--ease-out);
}

.spot:hover .card-icon {
    transform: translateZ(48px) scale(1.06);
}

/* Big index numeral behind each "why" card. */
.numeral {
    position: absolute;
    top: -0.35rem;
    right: 0.9rem;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 4.5rem;
    line-height: 1;
    letter-spacing: -0.05em;
    color: var(--ink);
    opacity: 0.05;
    pointer-events: none;
}

/* ---------------------------------------------------------------- proof --- */

/* Client marks sit desaturated until hovered, so the strip reads as one
   texture rather than a row of competing brand colours.
   The dimming lives on the inner mark, not on .logo-mark itself, because that
   element also carries data-reveal — and [data-reveal].is-revealed sets
   opacity: 1 at a higher specificity, which would cancel it. */
.logo-mark {
    display: flex;
    align-items: center;
}

.logo-mark__img,
.logo-mark__word {
    opacity: 0.6;
    filter: grayscale(1);
    transition: opacity 400ms var(--ease-out), filter 400ms var(--ease-out);
}

.logo-mark:hover .logo-mark__img,
.logo-mark:hover .logo-mark__word {
    opacity: 1;
    filter: grayscale(0);
}

.logo-mark__img {
    height: 1.75rem;
    width: auto;
    object-fit: contain;
}

/* Fallback when no artwork exists yet. */
.logo-mark__word {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.05rem;
    letter-spacing: -0.02em;
    color: var(--ink);
}

/* The headline number is the whole point of a case-study card. */
.metric {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(2.2rem, 3.6vw, 2.9rem);
    line-height: 1;
    letter-spacing: -0.045em;
    font-variant-numeric: tabular-nums;
    background: linear-gradient(150deg, var(--brand-lift), var(--spark));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.quote-mark {
    position: absolute;
    top: 0.75rem;
    right: 1.35rem;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 4.5rem;
    line-height: 1;
    color: var(--brand-lift);
    opacity: 0.13;
    pointer-events: none;
}

.stat-value {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(2.1rem, 3.4vw, 2.9rem);
    letter-spacing: -0.045em;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    background: linear-gradient(180deg, var(--ink) 20%, color-mix(in srgb, var(--ink) 55%, transparent));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* Ruled list — hairline separators instead of bullet dots. */
.ruled > li {
    display: flex;
    gap: 1rem;
    padding: 1.05rem 0;
    border-top: 1px solid var(--hairline);
    color: var(--muted);
    font-size: 0.925rem;
    line-height: 1.55;
}

.ruled > li:first-child {
    border-top: 0;
    padding-top: 0;
}

.ruled__marker {
    flex: none;
    margin-top: 0.35rem;
    width: 0.65rem;
    height: 1px;
    background: var(--brand-lift);
}

/* --------------------------------------------------------- section rule --- */

/* A hairline that ignites at its centre — marks the top of each section. */
.beam {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--hairline-strong) 22%, var(--brand-lift) 50%, var(--hairline-strong) 78%, transparent);
    opacity: 0.55;
}

/* ------------------------------------------------------- legal pages --- */

.legal {
    color: var(--muted);
    font-size: 0.95rem;
    line-height: 1.75;
    text-wrap: pretty;
}

.legal > p {
    margin-top: 1.15rem;
}

.legal h2 {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.15rem;
    letter-spacing: -0.02em;
    color: var(--ink);
    margin-top: 2.6rem;
}

.legal ul {
    margin-top: 1.15rem;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.legal li {
    position: relative;
    padding-left: 1.25rem;
}

.legal li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.7rem;
    width: 0.55rem;
    height: 1px;
    background: var(--brand-lift);
}

.legal strong {
    color: var(--ink-soft);
    font-weight: 600;
}

.legal a {
    color: var(--brand-lift);
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: color-mix(in srgb, var(--brand-lift) 45%, transparent);
}

.legal a:hover {
    text-decoration-color: var(--brand-lift);
}

/* ------------------------------------------------------- scroll reveals --- */

[data-reveal] {
    opacity: 0;
    transform: translateY(26px);
    transition: opacity 900ms var(--ease-out), transform 900ms var(--ease-out);
    transition-delay: var(--reveal-delay, 0ms);
}

[data-reveal].is-revealed {
    opacity: 1;
    transform: none;
}

@media (prefers-reduced-motion: reduce) {
    [data-reveal] {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .marquee__track {
        animation: none;
    }

    .pulse-dot {
        animation: none;
    }

    .tilt,
    .tilt--soft {
        transform: none;
    }

    .atmosphere__aurora {
        transform: none;
    }

    * {
        scroll-behavior: auto !important;
    }
}
