/* Custom styles for Alphaeus Ng portfolio - extracted from monolithic HTML for maintainability.
   Fonts are loaded once from index.html / page <link> tags — do not re-@import here. */

:root {
    --gold: #C9A227;
    --gold-hover: #E8C547;
    --gold-soft: rgba(201, 162, 39, 0.42);
    --gold-faint: rgba(201, 162, 39, 0.18);
    --ink: #0A0F1C;
    --ink-raised: #111827;
    --text: #F8FAFC;
    --text-muted: #94A3B8;
    --text-soft: #64748B;
    --line: rgba(255, 255, 255, 0.1);
    --line-strong: rgba(201, 162, 39, 0.45);
    --kg-modal-height: clamp(300px, 46vh, 440px);
    --kg-header-height: 42px;
    --kg-footer-height: 52px;
    --nav-bg: rgba(10, 15, 28, 0.94);
    /* One border language for the whole header chrome (default + hover + open). */
    --nav-border: rgba(201, 162, 39, 0.28);
    --nav-border-hover: rgba(201, 162, 39, 0.55);
    --nav-border-open: rgba(201, 162, 39, 0.55);
    --nav-text: rgba(248, 250, 252, 0.94);
    --nav-muted: rgba(148, 163, 184, 0.88);
    --nav-highlight: rgba(201, 162, 39, 0.1);
    --nav-shadow: 0 18px 38px rgba(0, 0, 0, 0.34);
}

body {
    font-family: 'Inter', system_ui, sans-serif;
    color: var(--text);
}

.skip-link {
    position: absolute;
    left: 1rem;
    top: 1rem;
    z-index: 100;
    padding: 0.55rem 0.95rem;
    border-radius: 999px;
    background: var(--gold);
    color: var(--ink) !important;
    font-weight: 600;
    font-size: 0.875rem;
    text-decoration: none !important;
    transform: translateY(-160%);
    transition: transform 0.15s ease;
}

.skip-link:focus,
.skip-link:focus-visible {
    transform: translateY(0);
    outline: 2px solid #E8C547;
    outline-offset: 2px;
}

/* ============================================================
   Link system
   - Clickable <a> / linkish buttons → gold
   - Non-links stay slate / white / soft (section labels use gold only as accent)
   - Solid CTAs + nav chrome opt out
   !important on color so Tailwind CDN utilities cannot override
   ============================================================ */
body a {
    color: var(--gold) !important;
    text-decoration: none !important;
    transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

body a:hover,
body a:focus-visible {
    color: var(--gold-hover) !important;
    text-decoration: none !important;
}

body a:focus-visible {
    outline: 1px solid rgba(201, 162, 39, 0.45);
    outline-offset: 2px;
}

/* Filled white CTA (e.g. Download CV) */
body a.btn-solid,
body a.btn-solid:hover,
body a.btn-solid:focus-visible {
    color: var(--ink) !important;
    text-decoration: none;
    outline: none;
}

/* Gold outline CTAs — stay gold; if filled on hover, switch to ink */
body a.btn-outline {
    color: var(--gold) !important;
    text-decoration: none;
}

body a.btn-outline:hover,
body a.btn-outline:focus-visible {
    color: var(--gold-hover) !important;
    text-decoration: none;
}

body a.btn-outline.btn-fill:hover,
body a.btn-outline.btn-fill:focus-visible {
    color: var(--ink) !important;
    background-color: var(--gold);
    border-color: var(--gold);
}

/* Quiet secondary chrome (still clickable → gold, not pure white) */
body a.btn-quiet {
    color: var(--gold) !important;
    text-decoration: none;
}

body a.btn-quiet:hover,
body a.btn-quiet:focus-visible {
    color: var(--gold-hover) !important;
}

/* Logo block: name stays light for hierarchy */
body a.nav-home-link,
body a.nav-home-link:hover,
body a.nav-home-link:focus-visible {
    color: inherit !important;
    text-decoration: none;
    outline: none;
}

body a.nav-pill,
body a.nav-pill:hover,
body a.nav-pill:focus-visible {
    color: inherit !important;
    text-decoration: none;
}

/* Dropdown / mobile items are gold links */
body .nav-submenu-link,
body .mobile-submenu-link,
body a.mobile-link {
    color: var(--gold) !important;
    text-decoration: none !important;
}

body .nav-submenu-link:hover,
body .nav-submenu-link:focus-visible,
body .mobile-submenu-link:hover,
body .mobile-submenu-link:focus-visible,
body a.mobile-link:hover,
body a.mobile-link:focus-visible {
    color: var(--gold-hover) !important;
}

/* Button elements that behave as text links */
button.linkish {
    color: var(--gold) !important;
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: color 0.15s ease;
}

button.linkish:hover,
button.linkish:focus-visible {
    color: var(--gold-hover) !important;
}

.heading-serif {
    font-family: 'Playfair Display', Georgia, serif;
    font-feature-settings: "kern" "liga" "tnum";
}

.section-header {
    font-family: 'Playfair Display', Georgia, serif;
    letter-spacing: -0.025em;
}

/* Card and visual components */
.card {
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
                box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.3s ease;
}
.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    border-color: #C9A227;
}

.vignette-card {
    background-color: #0A0F1C;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-left: 4px solid #C9A227;
    border-radius: 1.5rem;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), 
                box-shadow 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.2s ease;
    padding-left: 1.65rem;
}
.vignette-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    border-color: rgba(201, 162, 39, 0.22);
}
.vignette-tag {
    font-size: 0.65rem;
    letter-spacing: 0.075em;
    padding: 2px 9px;
    border-radius: 9999px;
    background: rgba(201, 162, 39, 0.08);
    color: #C9A227;
    border: 1px solid rgba(201, 162, 39, 0.18);
    white-space: nowrap;
    display: inline-block;
}

/* Modal and case study styles */
.case-study h4 {
    font-family: 'Playfair Display', Georgia, serif;
    color: #E2E8F0;
    font-size: 1.05rem;
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
}
.case-study p {
    color: #94A3B8;
    font-size: 0.98rem;
    line-height: 1.72;
}
.case-study .intersection {
    border-left: 3px solid #C9A227;
    font-style: italic;
    color: #CBD5E1;
    background: #111827;
    padding-left: 1rem;
}
.project-badge {
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    padding: 1px 10px;
    border-radius: 9999px;
    background: rgba(201, 162, 39, 0.1);
    color: #C9A227;
    border: 1px solid rgba(201, 162, 39, 0.2);
}

/* Pipeline visuals for rich modals */
.case-study .pipeline-flow {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin: 0.75rem 0;
}
.case-study .pipeline-step {
    background: #111827;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 0.75rem;
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    color: #CBD5E1;
}
.case-study .pipeline-arrow {
    color: #64748B;
    font-size: 0.9rem;
}
.case-study .pipeline-note {
    font-size: 0.75rem;
    color: #64748B;
    margin-top: 0.25rem;
}

/* Knowledge Graph modal styles */
.kg-modal-btn {
    font-size: 10px;
    padding: 3px 10px;
    border-radius: 9999px;
    border: 1px solid rgba(255,255,255,0.12);
    color: #CBD5E1;
    background: rgba(255,255,255,0.03);
    transition: all 0.15s ease;
    cursor: pointer;
}
.kg-modal-btn:hover {
    border-color: #C9A227;
    color: #C9A227;
}

/* Filter chips for reflections */
.filter-chip {
    font-size: 10px;
    padding: 1px 9px;
    border-radius: 9999px;
    border: 1px solid rgba(201,162,39,.22);
    background: rgba(10,15,28,.7);
    color: #CBD5E1;
    cursor: pointer;
    user-select: none;
    transition: all 0.15s ease;
}
.filter-chip.active {
    background: #C9A227;
    color: #0A0F1C;
    border-color: #C9A227;
    font-weight: 500;
}
.filter-chip:hover:not(.active) {
    border-color: #C9A227;
}

/* General utilities */
.elegant-divider {
    height: 1px;
    background: linear-gradient(to right, transparent, #334155, transparent);
}

.thesis-quote {
    font-family: 'Playfair Display', Georgia, serif;
    font-style: italic;
    border-left: 4px solid #C9A227;
}

/* Site header chrome — single continuous gold line (not white/gold mixed) */
.site-nav {
    border-bottom: 1px solid var(--nav-border);
    background: transparent;
}

.site-nav.nav-scrolled {
    background-color: var(--nav-bg);
    backdrop-filter: blur(14px);
    border-bottom-color: var(--nav-border-hover);
    box-shadow: 0 10px 30px rgba(2, 6, 23, 0.28);
}

.proof-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.38rem 0.72rem;
    border-radius: 9999px;
    border: 1px solid rgba(201, 162, 39, 0.22);
    background: rgba(201, 162, 39, 0.06);
    color: #CBD5E1;
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.02em;
}

/* Header nav — floating flyout model
   Pill and menu are independent cards (no shared border / morph).
   That removes the seam problem entirely and keeps motion simple. */
.nav-menu {
    --nav-menu-ease: cubic-bezier(0.16, 1, 0.3, 1);
    --nav-menu-duration: 200ms;
    position: relative;
}

.nav-menu.is-open {
    z-index: 90;
}

/* Invisible bridge so the pointer can travel the gap without closing. */
.nav-menu::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    height: 0.7rem;
}

.nav-home-link {
    cursor: pointer;
    transition: color 0.2s ease, transform 0.2s ease;
}

.nav-home-title {
    color: #F8FAFC;
    transition: color 0.2s ease;
}

.nav-home-link:hover .nav-home-title,
.nav-home-link:focus-visible .nav-home-title {
    color: #F5D36D;
}

.nav-home-link:hover {
    transform: translateY(-1px);
}

.nav-pill {
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 2;
    gap: 0.18rem;
    min-width: 9.5rem;
    padding: 0.72rem 1rem 0.7rem;
    border-radius: 1rem;
    border: 1px solid var(--nav-border);
    background: rgba(255, 255, 255, 0.03);
    transition:
        border-color 0.18s ease,
        background-color 0.18s ease,
        box-shadow 0.18s ease;
}

.nav-pill:hover,
.nav-pill:focus-visible {
    border-color: var(--nav-border-hover);
    background: var(--nav-highlight);
    outline: none;
}

.nav-pill.active,
.nav-menu.is-open .nav-pill,
.nav-pill[aria-expanded="true"] {
    border-color: var(--nav-border-open);
    background: rgba(201, 162, 39, 0.1);
    box-shadow: inset 0 0 0 1px rgba(201, 162, 39, 0.05);
}

.nav-pill:focus-visible {
    box-shadow: 0 0 0 1px rgba(201, 162, 39, 0.22), 0 0 0 4px rgba(201, 162, 39, 0.1);
}

.nav-pill-label {
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1;
    color: var(--nav-text);
}

.nav-pill-meta {
    font-size: 0.58rem;
    line-height: 1.25;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--nav-muted);
}

/* Independent floating panel — full rounded card under the pill. */
.nav-submenu {
    position: absolute;
    top: calc(100% + 0.45rem);
    left: 0;
    z-index: 1;
    display: flex;
    width: max-content;
    min-width: 100%;
    max-width: min(18rem, calc(100vw - 1.5rem));
    flex-direction: column;
    gap: 0.1rem;
    padding: 0.4rem;
    border: 1px solid var(--nav-border);
    border-radius: 1.05rem;
    background:
        radial-gradient(circle at 20% 0%, rgba(201, 162, 39, 0.07), transparent 55%),
        linear-gradient(180deg, rgba(12, 17, 30, 0.98), rgba(10, 15, 28, 0.98));
    backdrop-filter: blur(16px);
    box-shadow:
        0 18px 40px rgba(2, 6, 23, 0.45),
        0 0 0 1px rgba(255, 255, 255, 0.03) inset;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translate3d(0, 6px, 0) scale(0.98);
    transform-origin: top center;
    transition:
        opacity var(--nav-menu-duration) var(--nav-menu-ease),
        transform var(--nav-menu-duration) var(--nav-menu-ease),
        visibility 0s linear var(--nav-menu-duration);
}

.nav-submenu.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translate3d(0, 0, 0) scale(1);
    transition:
        opacity var(--nav-menu-duration) var(--nav-menu-ease),
        transform var(--nav-menu-duration) var(--nav-menu-ease),
        visibility 0s linear 0s;
}

@media (prefers-reduced-motion: reduce) {
    .nav-submenu,
    .nav-submenu.is-open,
    .nav-pill {
        transition-duration: 0.01ms !important;
        transform: none !important;
    }
}

.nav-submenu-link {
    position: relative;
    display: flex;
    align-items: center;
    min-width: 0;
    min-height: 2.2rem;
    padding: 0.48rem 0.78rem;
    border-radius: 0.75rem;
    font-size: 0.84rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    white-space: nowrap;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.nav-submenu-link:hover,
.nav-submenu-link:focus-visible {
    background: rgba(201, 162, 39, 0.1);
    outline: none;
}

.nav-submenu-link.active {
    background: rgba(201, 162, 39, 0.14);
    box-shadow: inset 2px 0 0 #C9A227;
}

.nav-submenu-link:not([href^="#"]),
.mobile-submenu-link:not([href^="#"]) {
    padding-right: 1.48rem;
}

.nav-submenu-link:not([href^="#"])::after,
.mobile-submenu-link:not([href^="#"])::after {
    content: '↗';
    position: absolute;
    right: 0.58rem;
    top: 50%;
    font-size: 0.62rem;
    line-height: 1;
    color: rgba(148, 163, 184, 0.62);
    transform: translateY(-56%);
    transition: color 150ms ease;
}

.nav-submenu-link:not([href^="#"]):hover::after,
.nav-submenu-link:not([href^="#"]):focus-visible::after,
.mobile-submenu-link:not([href^="#"]):hover::after,
.mobile-submenu-link:not([href^="#"]):focus-visible::after {
    color: rgba(226, 232, 240, 0.82);
}

.mobile-nav-panel {
    display: grid;
    gap: 0.35rem;
}

.mobile-submenu-link {
    position: relative;
    display: block;
    padding: 0.68rem 0.8rem;
    border-radius: 0.85rem;
    background: rgba(255, 255, 255, 0.03);
    font-size: 0.82rem;
}

.mobile-submenu-link.active {
    background: rgba(201, 162, 39, 0.12);
}

.chapter-disclosure {
    padding: 0 !important;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.chapter-disclosure > summary {
    list-style: none;
}

.chapter-disclosure:hover {
    border-color: rgba(201, 162, 39, 0.5);
    background: rgba(201, 162, 39, 0.08);
    box-shadow: inset 0 0 0 1px rgba(201, 162, 39, 0.12);
}

.chapter-disclosure[open] {
    border-color: rgba(201, 162, 39, 0.35);
    background: rgba(17, 24, 39, 0.98);
    cursor: pointer;
}

.chapter-disclosure[open]:hover {
    border-color: rgba(201, 162, 39, 0.5);
    background: rgba(201, 162, 39, 0.08);
    box-shadow: inset 0 0 0 1px rgba(201, 162, 39, 0.12);
}

.chapter-disclosure[open] > :not(summary) {
    cursor: pointer;
}

.chapter-disclosure-summary {
    display: block;
    list-style: none;
    cursor: pointer;
    margin: 0;
    padding: 1.25rem;
    border-radius: inherit;
}

.chapter-disclosure[open] .chapter-disclosure-summary {
    margin: 0;
    padding: 1.25rem 1.25rem 0;
}

.chapter-disclosure > :not(summary) {
    padding: 1rem 1.25rem 1.25rem;
}

.chapter-disclosure > p.mt-4 {
    margin-top: 0;
}

.chapter-disclosure-summary::marker {
    content: "";
}

.chapter-disclosure-summary::-webkit-details-marker {
    display: none;
}

.chapter-disclosure-summary:focus-visible {
    outline: none;
}

/* Hero portrait compare */
.portrait-showcase {
    position: relative;
}

.portrait-showcase:not(.is-revealed):not(.is-revealing) .portrait-phone-header,
.portrait-showcase:not(.is-revealed):not(.is-revealing) .portrait-phone-footer,
.portrait-showcase:not(.is-revealed):not(.is-revealing) .portrait-note,
.portrait-showcase:not(.is-revealed):not(.is-revealing) .portrait-divider {
    display: none;
}

.portrait-phone {
    position: relative;
    padding: 1rem;
    border-radius: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background:
        radial-gradient(circle at top, rgba(201, 162, 39, 0.12), transparent 34%),
        linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(10, 15, 28, 0.98));
    box-shadow: 0 34px 60px rgba(2, 6, 23, 0.45);
}

.portrait-showcase:not(.is-revealed):not(.is-revealing) .portrait-phone {
    padding: 0.75rem;
}

.portrait-phone::before {
    content: "";
    position: absolute;
    inset: 0.75rem;
    border-radius: 1.45rem;
    border: 1px solid rgba(201, 162, 39, 0.12);
    pointer-events: none;
}

.portrait-phone-header,
.portrait-phone-footer {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.portrait-phone-header {
    margin-bottom: 0.9rem;
}

.portrait-phone-kicker {
    font-size: 0.62rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #64748B;
}

.portrait-phone-title {
    margin-top: 0.22rem;
    font-size: 1rem;
    line-height: 1.1;
    font-weight: 600;
    letter-spacing: -0.03em;
    color: #F8FAFC;
}

.portrait-phone-status {
    flex-shrink: 0;
    padding: 0.38rem 0.7rem;
    border-radius: 9999px;
    border: 1px solid rgba(201, 162, 39, 0.22);
    background: rgba(201, 162, 39, 0.08);
    color: #C9A227;
    font-size: 0.64rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    transition: border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease;
}

button.portrait-phone-status {
    appearance: none;
    cursor: pointer;
}

button.portrait-phone-status:hover,
button.portrait-phone-status:focus-visible {
    border-color: rgba(201, 162, 39, 0.38);
    background: rgba(201, 162, 39, 0.12);
    color: #F5D36D;
    outline: none;
}

.portrait-compare {
    --portrait-reveal: 100%;
    --portrait-rock-angle: 0deg;
    position: relative;
    aspect-ratio: 9 / 14;
    overflow: hidden;
    border-radius: 1.55rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01)),
        #111827;
    touch-action: none;
    user-select: none;
    cursor: default;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.portrait-showcase:not(.is-revealed):not(.is-revealing) .portrait-compare:hover {
    border-color: rgba(255, 255, 255, 0.14);
    box-shadow: 0 20px 45px rgba(2, 6, 23, 0.22);
}

.portrait-showcase[data-portrait-click-stage="1"] .portrait-compare,
.portrait-showcase[data-portrait-click-stage="2"] .portrait-compare {
    border-color: rgba(201, 162, 39, 0.22);
}

.portrait-showcase[data-portrait-rock="soft"] .portrait-compare {
    animation: portraitRockSoft 0.52s ease;
}

.portrait-showcase[data-portrait-rock="hard"] .portrait-compare {
    animation: portraitRockHard 0.72s ease;
}

.portrait-showcase[data-portrait-tap="soft"] .portrait-compare::after,
.portrait-showcase[data-portrait-tap="hard"] .portrait-compare::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background: radial-gradient(circle at 50% 42%, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0) 48%);
    opacity: 0;
    animation: portraitTapFlash 0.2s ease-out;
}

.portrait-showcase.is-revealing .portrait-compare {
    cursor: progress;
}

.portrait-showcase.is-revealed .portrait-compare {
    cursor: ew-resize;
}

.portrait-compare:focus-visible {
    box-shadow: 0 0 0 1px rgba(201, 162, 39, 0.75), 0 0 0 4px rgba(201, 162, 39, 0.16);
}

.portrait-compare.is-dragging {
    cursor: grabbing;
}

.portrait-image,
.portrait-overlay {
    position: absolute;
    inset: 0;
}

.portrait-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

.portrait-image-original {
    object-position: 50% 18%;
    filter: saturate(0.98);
}

.portrait-image-generated {
    object-position: 50% 20%;
}

.portrait-overlay {
    clip-path: inset(0 calc(100% - var(--portrait-reveal)) 0 0);
}

.portrait-compare.is-settling .portrait-overlay {
    transition: clip-path 0.23s cubic-bezier(0.22, 0.82, 0.22, 1);
}

/* ---- Procedural shatter FX (generated per click in js/main.js) ---- */

.portrait-fx-flash {
    position: absolute;
    z-index: 6;
    width: 0;
    height: 0;
    left: 50%;
    top: 40%;
    pointer-events: none;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.28) 0%, rgba(255, 255, 255, 0.08) 32%, rgba(255, 255, 255, 0) 72%);
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.2);
    mix-blend-mode: soft-light;
}

.portrait-fx-flash.is-active {
    animation: portraitImpactFlash 0.28s cubic-bezier(0.15, 0.8, 0.25, 1) forwards;
}

.portrait-shatter-layer,
.portrait-chip-layer,
.portrait-dust-layer,
.portrait-cracks {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.portrait-shatter-layer {
    z-index: 2;
    opacity: 0;
}

.portrait-chip-layer {
    z-index: 3;
}

.portrait-dust-layer {
    z-index: 5;
    overflow: visible;
}

.portrait-cracks {
    z-index: 4;
    /* Translucent glass, but legible enough to read the fracture network. */
    opacity: 0.92;
    mix-blend-mode: soft-light;
}

.portrait-cracks-svg {
    width: 100%;
    height: 100%;
    display: block;
    overflow: visible;
}

.portrait-crack-path {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0;
    animation: portraitCrackDraw 0.42s cubic-bezier(0.2, 0.75, 0.2, 1) forwards;
}

/* Thin hairline edge — glass, not ink. */
.portrait-crack-path.is-edge {
    stroke: rgba(255, 255, 255, 0.22);
    stroke-width: 0.95;
    filter: drop-shadow(0 0 0.45px rgba(8, 12, 20, 0.22));
}

/* Soft specular highlight along the fracture. */
.portrait-crack-path.is-highlight {
    stroke: rgba(255, 255, 255, 0.34);
    stroke-width: 0.5;
}

/* Faint cool-glass sheen instead of opaque gold. */
.portrait-crack-path.is-sheen {
    stroke: rgba(226, 236, 255, 0.16);
    stroke-width: 0.7;
}

.portrait-chip {
    position: absolute;
    left: 0;
    top: 0;
    background-image: url("../assets/alphaeus-portrait.jpg");
    background-repeat: no-repeat;
    background-size: cover;
    background-position: 50% 20%;
    opacity: 0;
    will-change: transform, opacity;
    filter: drop-shadow(0 6px 10px rgba(2, 6, 23, 0.28));
    animation: portraitChipFly var(--portrait-chip-duration, 0.62s) cubic-bezier(0.14, 0.72, 0.22, 1) var(--portrait-chip-delay, 0s) forwards;
}

.portrait-dust {
    position: absolute;
    left: 0;
    top: 0;
    width: var(--portrait-dust-size, 3px);
    height: var(--portrait-dust-size, 3px);
    margin-left: calc(var(--portrait-dust-size, 3px) * -0.5);
    margin-top: calc(var(--portrait-dust-size, 3px) * -0.5);
    border-radius: 9999px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.85), rgba(201, 162, 39, 0.35) 55%, transparent 72%);
    opacity: 0;
    will-change: transform, opacity;
    animation: portraitDustFly var(--portrait-dust-duration, 0.55s) cubic-bezier(0.12, 0.7, 0.2, 1) var(--portrait-dust-delay, 0s) forwards;
}

.portrait-shatter-piece {
    --portrait-shard-delay: 0s;
    --portrait-shard-duration: 0.95s;
    --portrait-shard-fall-transform: translate3d(0, 180px, 0) rotate(12deg) scale(0.92);
    position: absolute;
    inset: 0;
    background-image: url("../assets/alphaeus-portrait.jpg");
    background-position: 50% 20%;
    background-repeat: no-repeat;
    background-size: cover;
    opacity: 0;
    filter: drop-shadow(0 12px 20px rgba(2, 6, 23, 0.22));
    will-change: transform, opacity, filter;
    transform-origin: var(--portrait-shard-origin-x, 50%) var(--portrait-shard-origin-y, 40%);
}

.portrait-showcase.is-revealed .portrait-cracks,
.portrait-showcase.is-revealed .portrait-chip-layer,
.portrait-showcase.is-revealed .portrait-dust-layer,
.portrait-showcase.is-revealed .portrait-fx-flash {
    display: none;
}

.portrait-showcase.is-revealing .portrait-overlay {
    transition: opacity 0.08s linear 0.06s;
    opacity: 0;
}

.portrait-showcase.is-revealing .portrait-chip-layer,
.portrait-showcase.is-revealing .portrait-dust-layer {
    opacity: 0;
    transition: opacity 0.12s ease 0.04s;
}

.portrait-showcase.is-revealing .portrait-shatter-layer {
    opacity: 1;
}

.portrait-showcase.is-revealing .portrait-shatter-piece.is-flying {
    animation: portraitPhotoShardFall var(--portrait-shard-duration) cubic-bezier(0.12, 0.68, 0.22, 1) var(--portrait-shard-delay) forwards;
}

.portrait-showcase.is-revealing .portrait-cracks {
    animation: portraitCrackFadeOut 0.42s ease 0.12s forwards;
}

@keyframes portraitRockSoft {
    0% {
        transform: rotate(0deg) scale(1);
    }

    28% {
        transform: rotate(-1.35deg) scale(0.994);
    }

    56% {
        transform: rotate(1.05deg) scale(1.002);
    }

    100% {
        transform: rotate(0deg) scale(1);
    }
}

@keyframes portraitRockHard {
    0% {
        transform: rotate(0deg) scale(1);
    }

    16% {
        transform: rotate(-2.4deg) scale(0.988);
    }

    40% {
        transform: rotate(1.8deg) scale(1.004);
    }

    68% {
        transform: rotate(-0.95deg) scale(0.996);
    }

    100% {
        transform: rotate(0deg) scale(1);
    }
}

@keyframes portraitTapFlash {
    0% {
        opacity: 0;
    }

    35% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

@keyframes portraitImpactFlash {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.15);
    }

    24% {
        opacity: 0.55;
        transform: translate(-50%, -50%) scale(1);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1.7);
    }
}

@keyframes portraitCrackDraw {
    0% {
        opacity: 0;
        stroke-dashoffset: var(--portrait-crack-length, 120);
    }

    22% {
        opacity: 0.78;
    }

    100% {
        opacity: 0.62;
        stroke-dashoffset: 0;
    }
}

@keyframes portraitChipFly {
    0% {
        opacity: 0.95;
        transform: translate3d(var(--portrait-chip-x, 0px), var(--portrait-chip-y, 0px), 0)
            rotate(var(--portrait-chip-rot-start, 0deg))
            scale(1);
    }

    100% {
        opacity: 0;
        filter: drop-shadow(0 10px 14px rgba(2, 6, 23, 0.12)) blur(0.4px);
        transform: translate3d(var(--portrait-chip-tx, 12px), var(--portrait-chip-ty, 28px), 0)
            rotate(var(--portrait-chip-rot-end, 40deg))
            scale(var(--portrait-chip-scale-end, 0.78));
    }
}

@keyframes portraitDustFly {
    0% {
        opacity: 0.9;
        transform: translate3d(var(--portrait-dust-x, 0px), var(--portrait-dust-y, 0px), 0) scale(1);
    }

    100% {
        opacity: 0;
        transform: translate3d(var(--portrait-dust-tx, 10px), var(--portrait-dust-ty, 24px), 0) scale(0.35);
    }
}

@keyframes portraitPhotoShardFall {
    0% {
        opacity: 1;
        filter: drop-shadow(0 10px 18px rgba(2, 6, 23, 0.2));
        transform: translate3d(0, 0, 0) rotate(0deg) scale(1);
    }

    12% {
        opacity: 1;
    }

    100% {
        opacity: 0;
        filter: drop-shadow(0 22px 30px rgba(2, 6, 23, 0.12)) blur(0.45px);
        transform: var(--portrait-shard-fall-transform);
    }
}

@keyframes portraitCrackFadeOut {
    0% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .portrait-showcase[data-portrait-rock] .portrait-compare,
    .portrait-fx-flash.is-active,
    .portrait-chip,
    .portrait-dust,
    .portrait-crack-path,
    .portrait-showcase.is-revealing .portrait-shatter-piece.is-flying {
        animation: none !important;
    }

    .portrait-showcase.is-revealing .portrait-overlay {
        transition: none;
        opacity: 0;
    }
}

.portrait-divider {
    position: absolute;
    top: 0;
    bottom: 0;
    left: var(--portrait-reveal);
    width: 0;
    pointer-events: none;
}

.portrait-compare.is-settling .portrait-divider {
    transition: left 0.34s cubic-bezier(0.22, 0.8, 0.24, 1);
}

.portrait-divider::before {
    content: "";
    position: absolute;
    left: -1px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(201, 162, 39, 0.95));
    box-shadow: 0 0 24px rgba(201, 162, 39, 0.35);
}

.portrait-handle {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translate(-50%, -50%);
    width: 2.8rem;
    height: 2.8rem;
    border-radius: 9999px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(10, 15, 28, 0.88);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.16rem;
    box-shadow: 0 14px 30px rgba(2, 6, 23, 0.38);
}

.portrait-handle span {
    display: inline-block;
    width: 3px;
    height: 15px;
    border-radius: 9999px;
    background: #C9A227;
}

.portrait-note {
    position: absolute;
    z-index: 7;
    left: 0.8rem;
    right: 0.8rem;
    bottom: 0.9rem;
    padding: 0.78rem 0.85rem;
    border-radius: 1rem;
    background: linear-gradient(180deg, rgba(10, 15, 28, 0.2), rgba(10, 15, 28, 0.84));
    font-size: 0.8rem;
    line-height: 1.45;
    color: #E2E8F0;
    pointer-events: auto;
}

.portrait-note a {
    color: var(--gold);
    text-decoration: none;
}

.portrait-note a:hover {
    color: var(--gold-hover);
    text-decoration: none;
}

.portrait-phone-footer {
    margin-top: 0.9rem;
}

.portrait-toggle {
    flex: 1;
    padding: 0.78rem 0.9rem;
    border-radius: 0.95rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    color: #94A3B8;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.portrait-toggle:hover {
    border-color: rgba(201, 162, 39, 0.28);
    color: #E2E8F0;
}

.portrait-toggle.is-active {
    border-color: rgba(201, 162, 39, 0.45);
    background: rgba(201, 162, 39, 0.12);
    color: #F8FAFC;
}

@media (max-width: 767px) {
    .nav-pill {
        min-width: 0;
    }

}

/* —— Project quick-link tabs (under primary nav) —— */
.project-tabs-bar {
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(8, 12, 22, 0.92);
    backdrop-filter: blur(14px);
}

.project-tabs-inner {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    max-width: 80rem;
    margin: 0 auto;
    padding: 0.45rem 1.5rem 0.55rem;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(201, 162, 39, 0.35) transparent;
}

.project-tabs-label {
    flex-shrink: 0;
    margin-right: 0.35rem;
    font-size: 0.58rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #64748b;
}

.project-tab {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.38rem 0.78rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.03);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: #cbd5e1 !important;
    white-space: nowrap;
    transition:
        border-color 0.15s ease,
        background-color 0.15s ease,
        color 0.15s ease,
        box-shadow 0.15s ease;
}

.project-tab:hover,
.project-tab:focus-visible {
    border-color: rgba(201, 162, 39, 0.45);
    background: rgba(201, 162, 39, 0.1);
    color: #f8fafc !important;
    outline: none;
}

.project-tab.is-current {
    border-color: rgba(201, 162, 39, 0.55);
    background: rgba(201, 162, 39, 0.14);
    color: #f5d36d !important;
    box-shadow: inset 0 0 0 1px rgba(201, 162, 39, 0.08);
}

.project-tab-ext {
    font-size: 0.58rem;
    opacity: 0.55;
    font-weight: 500;
}

/* Space for fixed nav + project tabs */
body.has-project-tabs {
    --site-nav-offset: 7.75rem;
}

body.has-project-tabs .site-nav + * {
    /* first main block after nav — hero uses its own pt; set for skip targets */
}

@media (max-width: 767px) {
    .project-tabs-bar {
        display: none;
    }

    body.has-project-tabs {
        --site-nav-offset: 5rem;
    }
}

/* Conviction page specific */
.conviction-card {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.conviction-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}
