/* ==========================================================================
   nx-case-flagship.css — flagship case studies (/portfolio/<slug> with
   'flagship' => true in _projects-data.php). Loaded only on those pages, on
   top of the inline .nx-cs case-study styles in pages/portfolio/_detail.php.
   Uses the page's --tint. Real screenshots in plain CSS device frames.
   Rules kept: no global border-box (scoped below), full neutral hairlines
   only (no coloured edge strokes, TKT-0009), overflow-x: clip, not hidden.
   ========================================================================== */

.nx-cs-hero--flagship, .nx-fs { overflow-x: clip; }
.nx-fs-stage, .nx-fs-stage *, .nx-fs, .nx-fs * { box-sizing: border-box; }

/* ── Hero: text left, device stage right ─────────────────────────────────── */
.nx-cs-hero.nx-cs-hero--flagship {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    align-items: center;
    gap: clamp(28px, 4vw, 64px);
    padding-top: clamp(112px, 15vh, 160px);
}
.nx-cs-hero.nx-cs-hero--flagship .nx-cs-hero__inner { max-width: none; margin: 0; min-width: 0; }
.nx-cs-hero--flagship .nx-cs-hero__inner .nx-cs-title { font-size: clamp(2.8rem, 6.4vw, 5.6rem); }
.nx-cs-hero--flagship .nx-cs-hero__inner .nx-cs-tagline { font-size: clamp(1.15rem, 2vw, 1.6rem); max-width: 30ch; }
.nx-cs-hero.nx-cs-hero--flagship::after {
    background: linear-gradient(90deg, rgba(0,0,0,.55) 0%, rgba(0,0,0,.18) 55%, rgba(0,0,0,.05) 100%),
                linear-gradient(180deg, transparent 70%, rgba(0,0,0,.7) 100%);
}

.nx-cs-flag {
    width: -moz-fit-content; width: fit-content;
    display: flex; align-items: center; gap: 10px; margin: 0 0 22px;
    padding: 8px 14px; border-radius: 999px;
    border: 1px solid var(--nx-color-line-strong);
    background: color-mix(in srgb, var(--tint) 12%, rgba(255,255,255,.03));
    font-family: var(--nx-font-mono); font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: #fff;
}
.nx-cs-flag__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--tint); box-shadow: 0 0 12px var(--tint); }

/* Device stage */
.nx-fs-stage {
    position: relative; z-index: 2; margin: 0; min-width: 0;
    aspect-ratio: 16 / 12.4;
}
.nx-fs-stage .nx-fs-win { position: absolute; left: 0; top: 4%; width: 86%; }
.nx-fs-stage .nx-fs-phone { position: absolute; }
.nx-fs-stage .nx-fs-phone--a { right: 13%; bottom: 0; width: 25%; }
.nx-fs-stage .nx-fs-phone--b { right: 0; bottom: 9%; width: 21%; }
.nx-fs-stage::before {
    content: ""; position: absolute; inset: 10% 6% 0 14%; z-index: -1; pointer-events: none;
    background: radial-gradient(50% 50% at 50% 55%, color-mix(in srgb, var(--tint) 34%, transparent), transparent 70%);
    filter: blur(40px); opacity: .7;
}

/* ── Device frames ───────────────────────────────────────────────────────── */
.nx-fs-win {
    border-radius: clamp(10px, 1.2vw, 14px); overflow: hidden; background: #0b0b0b;
    border: 1px solid rgba(255,255,255,.12);
    box-shadow: 0 40px 90px -24px rgba(0,0,0,.85), 0 0 0 1px rgba(0,0,0,.4);
}
.nx-fs-win__bar {
    display: flex; align-items: center; gap: 6px; height: 26px; padding: 0 12px;
    background: #131414; border-bottom: 1px solid rgba(255,255,255,.07);
}
.nx-fs-win__bar i { width: 8px; height: 8px; border-radius: 50%; background: #3a3c3e; flex: 0 0 auto; }
.nx-fs-win__bar span {
    margin-left: 10px; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
    font: 500 10.5px/1 var(--nx-font-mono, monospace); color: rgba(255,255,255,.45); letter-spacing: .04em;
}
.nx-fs-win picture, .nx-fs-win img { display: block; width: 100%; height: auto; }

.nx-fs-phone {
    padding: clamp(4px, .55vw, 8px); border-radius: clamp(18px, 2.4vw, 32px);
    background: #0c0c0c; border: 1px solid rgba(255,255,255,.15);
    box-shadow: 0 34px 70px -14px rgba(0,0,0,.9);
}
.nx-fs-phone picture, .nx-fs-phone img { display: block; width: 100%; height: auto; }
.nx-fs-phone img { border-radius: clamp(14px, 1.9vw, 25px); }

/* ── Shared section bits ─────────────────────────────────────────────────── */
.nx-fs-wrap { max-width: 1180px; margin-inline: auto; padding-inline: clamp(20px, 5vw, 64px); }
.nx-fs-eyebrow {
    display: flex; align-items: center; gap: 12px; margin: 0 0 16px;
    font-family: var(--nx-font-mono); font-size: 12px; letter-spacing: .22em; text-transform: uppercase; color: var(--nx-color-text-muted);
}
.nx-fs-eyebrow span { color: var(--tint); }
.nx-fs-h2 {
    font-family: var(--nx-font-display); font-weight: 600; color: var(--nx-color-text);
    font-size: clamp(1.7rem, 3.4vw, 2.7rem); line-height: 1.08; letter-spacing: -.03em;
    margin: 0 0 20px; text-wrap: balance; max-width: 22ch;
}
.nx-fs p { color: var(--nx-color-text-muted); line-height: 1.75; font-size: 1.05rem; margin: 0 0 16px; }
.nx-fs-list { list-style: none; margin: 22px 0 0; padding: 0; display: grid; gap: 12px; }
.nx-fs-list li {
    position: relative; padding-left: 24px; color: var(--nx-color-text); line-height: 1.55; font-size: .98rem;
}
.nx-fs-list li::before {
    content: ""; position: absolute; left: 2px; top: .55em; width: 7px; height: 7px; border-radius: 50%;
    background: var(--tint); box-shadow: 0 0 10px color-mix(in srgb, var(--tint) 60%, transparent);
}

/* ── 01 Brief ────────────────────────────────────────────────────────────── */
.nx-fs-brief { padding: clamp(56px, 8vw, 110px) 0 clamp(20px, 3vw, 40px); }
.nx-fs-brief__grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(28px, 5vw, 72px); align-items: start; }
.nx-fs-index {
    border: 1px solid var(--nx-color-line); border-radius: 18px; background: var(--nx-color-surface);
    padding: clamp(22px, 2.6vw, 32px);
}
.nx-fs-index__k { font-family: var(--nx-font-mono); font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--tint) !important; margin: 0 0 14px !important; }
.nx-fs-index ol { list-style: none; margin: 0; padding: 0; counter-reset: fsi; }
.nx-fs-index li { counter-increment: fsi; border-top: 1px solid var(--nx-color-line); }
.nx-fs-index li:first-child { border-top: 0; }
.nx-fs-index a {
    display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 14px; padding: 14px 0;
    text-decoration: none; color: var(--nx-color-text);
}
.nx-fs-index a::before { content: counter(fsi, decimal-leading-zero); grid-row: span 2; font-family: var(--nx-font-mono); font-size: 12px; color: var(--nx-color-text-dim); padding-top: 4px; }
.nx-fs-index a span { font-family: var(--nx-font-display); font-weight: 600; font-size: 1.12rem; transition: color .3s ease; }
.nx-fs-index a small { color: var(--nx-color-text-muted); font-size: .9rem; }
.nx-fs-index a:hover span { color: var(--tint); }
.nx-fs-index__foot { font-size: .9rem !important; margin: 14px 0 0 !important; }

/* ── Pillars ─────────────────────────────────────────────────────────────── */
.nx-fs-pillar { padding: clamp(56px, 8vw, 120px) 0; border-top: 1px solid var(--nx-color-line); scroll-margin-top: 80px; }
.nx-fs-pillar:first-of-type { border-top: 0; }
.nx-fs-pillar__grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(28px, 5vw, 72px); align-items: center; }
.nx-fs-pillar--flip .nx-fs-pillar__grid { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
.nx-fs-pillar--flip .nx-fs-pillar__text { order: 2; }
.nx-fs-pillar--flip .nx-fs-visual { order: 1; }
.nx-fs-pillar__text, .nx-fs-visual { min-width: 0; }

.nx-fs-visual { position: relative; }
.nx-fs-visual::before {
    content: ""; position: absolute; inset: 8% 4%; z-index: -1; pointer-events: none;
    background: radial-gradient(50% 50% at 50% 50%, color-mix(in srgb, var(--tint) 22%, transparent), transparent 70%);
    filter: blur(36px);
}
.nx-fs-visual--site { padding-bottom: 12%; }
.nx-fs-visual--site .nx-fs-win { width: 88%; }
.nx-fs-phone--float { position: absolute; right: 0; bottom: 0; width: 27%; }
.nx-fs-visual--phones { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(10px, 1.6vw, 22px); align-items: start; }
.nx-fs-visual--phones .nx-fs-phone--mid { margin-top: clamp(24px, 4vw, 56px); }
.nx-fs-visual--two { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 520px; margin-inline: auto; width: 100%; }

/* ── 06 Arabic first ─────────────────────────────────────────────────────── */
.nx-fs-ar { padding: clamp(56px, 8vw, 120px) 0; border-top: 1px solid var(--nx-color-line); }
.nx-fs-ar__head { max-width: 760px; margin: 0 auto clamp(32px, 5vw, 56px); text-align: center; }
.nx-fs-ar__head .nx-fs-eyebrow { justify-content: center; }
.nx-fs-ar__head .nx-fs-h2 { margin-inline: auto; }
.nx-fs-ar__quote {
    font-family: 'IBM Plex Sans Arabic', var(--nx-font-sans); font-size: clamp(1.5rem, 3.4vw, 2.4rem) !important;
    line-height: 1.5 !important; color: var(--tint) !important; margin: 18px 0 0 !important;
}
.nx-fs-ar__visual { position: relative; max-width: 1000px; margin-inline: auto; padding-bottom: 8%; }
.nx-fs-ar__visual .nx-fs-win { width: 84%; margin-left: auto; }
.nx-fs-ar__visual .nx-fs-phone--float { left: 0; right: auto; width: 22%; }

/* ── 07 Trust ────────────────────────────────────────────────────────────── */
.nx-fs-trust { padding: clamp(56px, 8vw, 120px) 0; border-top: 1px solid var(--nx-color-line); }
.nx-fs-trust__head { margin-bottom: clamp(26px, 4vw, 44px); }
.nx-fs-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(12px, 1.6vw, 20px); }
.nx-fs-tile {
    border: 1px solid var(--nx-color-line); border-radius: 16px; background: var(--nx-color-surface);
    padding: clamp(20px, 2.4vw, 28px);
    transition: background .4s ease, transform .4s var(--nx-ease-out, ease);
}
.nx-fs-tile:hover { background: var(--nx-color-surface-2, #121316); transform: translateY(-3px); }
.nx-fs-tile h3 { font-family: var(--nx-font-display); font-weight: 600; font-size: 1.12rem; color: var(--nx-color-text); margin: 0 0 10px; }
.nx-fs-tile p { font-size: .96rem; line-height: 1.6; margin: 0; }
.nx-fs-stack { list-style: none; margin: clamp(26px, 4vw, 40px) 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.nx-fs-stack li {
    padding: 8px 14px; border-radius: 999px; border: 1px solid var(--nx-color-line);
    font-family: var(--nx-font-mono); font-size: 12px; letter-spacing: .06em; color: var(--nx-color-text-muted);
}

/* ── Gallery ─────────────────────────────────────────────────────────────── */
.nx-fs-gallery { padding: clamp(48px, 7vw, 100px) 0 0; border-top: 1px solid var(--nx-color-line); }
.nx-fs-gallery__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(14px, 1.8vw, 24px); }
.nx-fs-shot { margin: 0; min-width: 0; }
.nx-fs-shot--wide { grid-column: 1 / -1; }
.nx-fs-shot picture, .nx-fs-shot img {
    display: block; width: 100%; height: auto; border-radius: clamp(12px, 1.6vw, 18px);
}
.nx-fs-shot img { border: 1px solid var(--nx-color-line); }
.nx-fs-shot figcaption { margin-top: 12px; font-size: .92rem; color: var(--nx-color-text-muted); }
.nx-fs-note { margin: 22px 0 0 !important; font-size: .86rem !important; color: var(--nx-color-text-dim) !important; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
    .nx-cs-hero.nx-cs-hero--flagship {
        grid-template-columns: minmax(0, 1fr); min-height: 0;
        padding-bottom: clamp(40px, 8vw, 64px);
    }
    .nx-cs-hero--flagship .nx-cs-scroll { display: none; }
    .nx-fs-stage { aspect-ratio: 16 / 13; }
    .nx-fs-brief__grid,
    .nx-fs-pillar__grid,
    .nx-fs-pillar--flip .nx-fs-pillar__grid { grid-template-columns: minmax(0, 1fr); }
    .nx-fs-pillar--flip .nx-fs-pillar__text,
    .nx-fs-pillar--flip .nx-fs-visual { order: 0; }
    .nx-fs-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
    .nx-fs-tiles, .nx-fs-gallery__grid { grid-template-columns: minmax(0, 1fr); }
    .nx-fs-win__bar { height: 20px; padding: 0 8px; gap: 4px; }
    .nx-fs-win__bar i { width: 6px; height: 6px; }
    .nx-fs-win__bar span { font-size: 9px; margin-left: 6px; }
    .nx-fs-visual--phones { gap: 8px; }
}
@media (prefers-reduced-motion: reduce) {
    .nx-fs-tile { transition: none; }
    .nx-fs-tile:hover { transform: none; }
}
