/* ========================================
   Silicon Hallway - Main Stylesheet
   ======================================== */

/* ========================================
   CSS RESET AND BASE STYLES
======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Solid near-black technical ground, no photography this round —
       decoration comes from cyan circuit-line art, not imagery. */
    --ink: #050810;
    --glass-bg: rgba(255, 255, 255, 0.06);
    --glass-bg-strong: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.14);
    --glass-highlight: rgba(255, 255, 255, 0.09);
    /* Real native-resolution mobile rendering needs a noticeably smaller
       blur radius than what looks right on desktop — confirmed via
       getComputedStyle on a real device: backdrop-filter is applied
       identically in both cases, but "Request desktop site" renders at a
       much wider virtual viewport (980px) then scales the whole page down
       to fit the screen, which shrinks the *effective* blur radius as a
       side effect. These get overridden smaller below 768px so mobile
       gets the same real-world blur strength, not a numerically-equal but
       visually-heavier one. */
    --glass-blur-sm: 5px;
    --glass-blur-md: 7px;
    --glass-blur-lg: 9px;
    --line: rgba(255, 255, 255, 0.08);
    --nav-bg: rgba(8, 13, 24, 0.6);
    --nav-bg-scrolled: rgba(5, 9, 18, 0.78);
    --mobile-menu-bg: rgba(8, 14, 24, 0.85);
    --text-primary: #F1F6FB;
    --text-secondary: rgba(241, 246, 251, 0.65);

    /* Brand cyan. Unlike prior rounds, the solid button fill (--blue-deep)
       stays bright — text on it is dark ink (--on-accent), not white —
       so contrast holds by construction rather than needing a deliberately
       darker fill color. */
    --blue: #22D3EE;
    --blue-deep: #1BC6E4;
    --blue-deeper: #0EA8C4;
    --blue-glow: rgba(34, 211, 238, 0.35);
    --blue-soft: rgba(34, 211, 238, 0.1);
    --on-accent: #052024;

    --up: #3DDC97;
    --down: #F0495A;
    --warning: #E0B23D;

    --shadow-color: rgba(0, 0, 0, 0.55);

    --font-primary: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --font-mono: 'JetBrains Mono', Menlo, Consolas, monospace;

    --section-padding: 6rem 0;
    --container-padding: 0 2rem;
    --border-radius: 1rem;
    --shadow: 0 25px 50px -20px rgba(0, 0, 0, 0.6);
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);

    /* Back-compat aliases so any un-migrated selector still resolves. */
    --primary-blue: var(--blue-deep);
    --secondary-blue: var(--blue);
    --bg-primary: var(--ink);
    --bg-secondary: transparent;
    --bg-tertiary: var(--glass-bg-strong);
    --border-color: var(--glass-border);
}

html {
    scroll-behavior: smooth;
    /* Disable mobile browsers' automatic text-size "boosting" on narrow
       columns. This heuristic inflates font-size on real phones in ways
       that don't reproduce in desktop or CDP-emulated mobile testing,
       and is the most likely explanation for layout (e.g. breadcrumb
       wrapping) that only breaks on real devices. */
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

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

body {
    font-family: var(--font-primary);
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--ink);
    overflow-x: hidden;
}

/* ========================================
   CIRCUIT-LINE DECORATION
   Thin cyan schematic traces placed in section corners, hand-authored as a
   single SVG reused at different corners/opacities — the ambient-tech
   texture this system runs on in place of photography or a solid glow.
======================================== */

/* Wraps a .circuit-deco image so only the decoration itself gets clipped
   to its section's bounds, rather than putting overflow:hidden on the
   whole section (which would also clip/affect any glass panel sharing
   that section — an unnecessary risk even though it turned out not to be
   the actual cause of the mobile translucency issue; see --glass-blur-*
   above for that). */
.circuit-clip {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.circuit-deco {
    position: absolute;
    width: 620px;
    max-width: 70vw;
    height: auto;
    pointer-events: none;
    z-index: 0;
    opacity: 0.7;
}

.circuit-deco-tl {
    top: 0;
    left: 0;
}

.circuit-deco-tr {
    top: 0;
    right: 0;
    transform: scaleX(-1);
}

.circuit-deco-br {
    bottom: 0;
    right: 0;
    transform: rotate(180deg);
}

.circuit-deco-bl {
    bottom: 0;
    left: 0;
    transform: rotate(180deg) scaleX(-1);
}

/* ========================================
   BACKGROUND GLOW
   A few large, fixed, low-opacity cyan blooms sitting behind the whole
   page — not decoration by themselves, but the thing every glass panel's
   backdrop-filter needs behind it to actually read as glass rather than a
   flat tinted card. Fixed (not absolute) so it's consistent regardless of
   page length or scroll position.
======================================== */

.bg-glow {
    position: fixed;
    inset: 0;
    z-index: -3;
    background:
        radial-gradient(ellipse 900px 650px at 12% 15%, rgba(34, 211, 238, 0.13), transparent 60%),
        radial-gradient(ellipse 800px 600px at 88% 45%, rgba(34, 211, 238, 0.1), transparent 60%),
        radial-gradient(ellipse 1000px 750px at 50% 95%, rgba(27, 198, 228, 0.09), transparent 60%);
}

/* ========================================
   SURFACES
   Cards/nav/forms are subtly raised off the near-black ground with a
   hairline border and a soft blur — the blur mostly softens whatever
   circuit-line decoration passes behind a panel.
======================================== */

.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur-md)) saturate(150%);
    -webkit-backdrop-filter: blur(var(--glass-blur-md)) saturate(150%);
    border: 1px solid var(--glass-border);
    box-shadow: inset 0 1px 0 var(--glass-highlight);
}

.glass-strong {
    background: var(--glass-bg-strong);
    backdrop-filter: blur(var(--glass-blur-lg)) saturate(150%);
    -webkit-backdrop-filter: blur(var(--glass-blur-lg)) saturate(150%);
    border: 1px solid var(--glass-border);
    box-shadow: inset 0 1px 0 var(--glass-highlight);
}

/* ========================================
   UTILITY CLASSES
======================================== */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--container-padding);
    position: relative;
    z-index: 1;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.85rem;
    min-height: 3rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 999px;
    transition: var(--transition);
    border: none;
    cursor: pointer;
    font-size: 0.98rem;
    line-height: 1;
}

.btn-primary {
    background: var(--blue-deep);
    color: var(--on-accent);
    box-shadow: 0 15px 35px -12px var(--blue-glow);
}

.btn-primary:hover {
    background: var(--blue-deeper);
    transform: translateY(-2px);
}

.btn-outline {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur-sm)) saturate(150%);
    -webkit-backdrop-filter: blur(var(--glass-blur-sm)) saturate(150%);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
    box-shadow: inset 0 1px 0 var(--glass-highlight);
    font-weight: 600;
}

.btn-outline:hover {
    border-color: var(--blue);
    background: var(--blue-soft);
}

.btn-outline-dark {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur-sm)) saturate(150%);
    -webkit-backdrop-filter: blur(var(--glass-blur-sm)) saturate(150%);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
    box-shadow: inset 0 1px 0 var(--glass-highlight);
    font-weight: 600;
}

.btn-outline-dark:hover {
    border-color: var(--blue);
    background: var(--blue-soft);
}

.btn-secondary {
    background: var(--glass-bg);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
    box-shadow: inset 0 1px 0 var(--glass-highlight);
}

.btn-secondary:hover {
    border-color: var(--blue);
    color: var(--blue);
    transform: translateY(-2px);
}

.btn-large {
    padding: 1.05rem 2.2rem;
    min-height: 3.25rem;
    font-size: 1.05rem;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-primary);
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur-sm)) saturate(150%);
    -webkit-backdrop-filter: blur(var(--glass-blur-sm)) saturate(150%);
    border: 1px solid var(--glass-border);
    box-shadow: inset 0 1px 0 var(--glass-highlight);
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    margin-bottom: 1.25rem;
}

.eyebrow::before {
    content: "";
    width: 0.4rem;
    height: 0.4rem;
    border-radius: 999px;
    background: var(--blue);
    box-shadow: 0 0 8px 1px var(--blue-glow);
    flex: none;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    text-align: center;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.section-title .accent {
    color: var(--blue);
    font-style: italic;
}

.section-subtitle {
    font-size: 1.15rem;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 3rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.page-title {
    font-size: 2.75rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.page-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.6;
    max-width: 60ch;
}

/* ========================================
   ICON TILES
======================================== */

.icon-tile {
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--blue-soft);
    border: 1px solid rgba(34, 211, 238, 0.35);
    box-shadow: 0 0 24px -6px var(--blue-glow);
    flex: none;
    transition: var(--transition);
}

.icon-tile svg {
    width: 1.5rem;
    height: 1.5rem;
    stroke: var(--blue);
    fill: none;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ========================================
   DEVICE FRAMES
   Pure-CSS laptop and phone chassis used for the portfolio section — the
   "screen" is whatever screenshot image sits inside, real or a clearly
   labeled placeholder (see .device-placeholder-badge).
======================================== */

.device-stage {
    position: relative;
    padding: 1rem 0.5rem 2.75rem;
}

.device-frame-laptop {
    position: relative;
    width: 100%;
}

.device-frame-laptop .device-screen {
    position: relative;
    aspect-ratio: 16 / 10;
    border-radius: 0.6rem 0.6rem 0.25rem 0.25rem;
    overflow: hidden;
    background: #0A1120;
    border: 7px solid #131A28;
    border-bottom-width: 3px;
    box-shadow: var(--shadow);
}

.device-frame-laptop .device-screen img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.device-frame-laptop .device-base {
    height: 0.85rem;
    margin: 0 -0.75rem;
    background: linear-gradient(180deg, #1A2233 0%, #0D1320 100%);
    border-radius: 0 0 0.6rem 0.6rem;
    position: relative;
}

.device-frame-laptop .device-base::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 4rem;
    height: 5px;
    border-radius: 0 0 6px 6px;
    background: #060A12;
}

.device-frame-tablet {
    position: relative;
    width: 100%;
}

.device-frame-tablet .device-screen {
    position: relative;
    aspect-ratio: 3 / 2;
    border-radius: 0.9rem;
    overflow: hidden;
    background: #0A1120;
    border: 10px solid #131A28;
    box-shadow: var(--shadow);
}

.device-frame-tablet .device-screen img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.device-frame-tablet .device-screen::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 0.4rem;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #060A12;
}

.device-frame-phone {
    position: absolute;
    right: -1.25rem;
    bottom: -1.75rem;
    width: 34%;
    max-width: 168px;
    z-index: 2;
    filter: drop-shadow(0 20px 35px rgba(0, 0, 0, 0.55));
}

/* A lone phone (no companion laptop) is centered and shown larger rather
   than pinned to a corner as if overlapping something. */
.device-stage.phone-only {
    display: flex;
    justify-content: center;
    padding: 0.5rem 0 1.5rem;
}

.device-stage.phone-only .device-frame-phone {
    position: static;
    width: 46%;
    max-width: 210px;
}

.device-frame-phone .device-screen {
    position: relative;
    aspect-ratio: 9 / 19.5;
    border-radius: 1.4rem;
    overflow: hidden;
    background: #0A1120;
    border: 6px solid #131A28;
}

.device-frame-phone .device-screen img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.device-frame-phone .device-screen::before {
    content: "";
    position: absolute;
    top: 0.4rem;
    left: 50%;
    transform: translateX(-50%);
    width: 34%;
    height: 8px;
    border-radius: 999px;
    background: #131A28;
    z-index: 1;
}

/* A bare app screen with its own aspect ratio (e.g. BareInvestfolio's 9:20
   preview) sits in the phone bezel at its natural height: no cropping and no
   stretching, which the fixed 9 / 19.5 screen above would force. */
.device-frame-phone .device-screen-native {
    aspect-ratio: auto;
}

.device-frame-phone .device-screen-native picture {
    display: block;
}

.device-frame-phone .device-screen-native img {
    height: auto;
    object-fit: contain;
}

/* Some product shots (e.g. a marketing render that already includes its
   own phone/device mockup) shouldn't be stuffed into our CSS bezel too --
   that doubles up the device chrome and forces a foreign aspect ratio
   through object-fit: cover. This variant just shows the image at its own
   aspect ratio, no bezel, no cropping. */
.device-stage.image-only {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0.5rem 0 1.5rem;
}

.device-stage.image-only img {
    width: 100%;
    max-width: 340px;
    height: auto;
    display: block;
    filter: drop-shadow(0 20px 35px rgba(0, 0, 0, 0.45));
}

.device-placeholder-badge {
    position: absolute;
    top: 0.6rem;
    left: 0.6rem;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    line-height: 1;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-primary);
    background: rgba(5, 8, 16, 0.78);
    border: 1px solid var(--glass-border);
    box-shadow: inset 0 1px 0 var(--glass-highlight);
    padding: 0.3rem 0.55rem;
    border-radius: 999px;
    backdrop-filter: blur(8px) saturate(150%);
}

/* ========================================
   ANIMATIONS
======================================== */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.animate-on-scroll {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.animate-on-scroll.animate {
    opacity: 1;
    transform: translateY(0);
}

/* ========================================
   RESPONSIVE DESIGN
======================================== */

@media (max-width: 900px) {
    :root {
        --section-padding: 4rem 0;
    }
}

@media (max-width: 768px) {
    :root {
        --section-padding: 3.5rem 0;
        --container-padding: 0 1.25rem;
        /* Real phones render backdrop-filter at true native resolution,
           where these radii (tuned by eye on desktop) are too strong for
           the thin 1-1.5px circuit-line strokes and wash them out almost
           completely. Desktop testing didn't catch this because Chrome's
           "request desktop site" mode on Android renders at a wider
           virtual viewport then scales the whole page down, which shrinks
           the effective blur radius as a side effect and made the same
           values look fine there. */
        --glass-blur-sm: 2px;
        --glass-blur-md: 3px;
        --glass-blur-lg: 4px;
    }

    .section-title {
        font-size: 1.85rem;
    }

    .page-title {
        font-size: 2.15rem;
    }

    .page-subtitle {
        font-size: 1.1rem;
    }

    .btn {
        width: 100%;
    }

    .circuit-deco {
        width: 420px;
        opacity: 0.55;
    }

    /* These ellipses are sized for a wide desktop canvas. On a ~380-420px
       phone viewport they're 2-3x wider than the screen, so the visible
       area never reaches a blob's faded edge — the whole screen sits
       inside one bright core with no light/dark variation, reading as
       flat instead of atmospheric. Scaling them down lets the same
       falloff complete within a narrow viewport. */
    .bg-glow {
        background:
            radial-gradient(ellipse 480px 350px at 15% 12%, rgba(34, 211, 238, 0.14), transparent 60%),
            radial-gradient(ellipse 420px 320px at 88% 40%, rgba(34, 211, 238, 0.11), transparent 60%),
            radial-gradient(ellipse 520px 400px at 50% 92%, rgba(27, 198, 228, 0.1), transparent 60%);
    }
}

@media (max-width: 480px) {
    :root {
        --container-padding: 0 1rem;
    }

    .page-title {
        font-size: 1.85rem;
    }

    .section-title {
        font-size: 1.6rem;
    }
}

@media (pointer: coarse) {
    a, button, .btn, .nav-link, .filter-btn {
        min-height: 44px;
    }
}

/* ========================================
   FULLSCREEN IMAGE MODAL
======================================== */

.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(2, 4, 9, 0.94);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-modal.active {
    opacity: 1;
}

.image-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.image-modal-content {
    position: relative;
    max-width: 95%;
    max-height: 95%;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 1;
}

.modal-image {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s ease;
}

.image-modal-close {
    position: absolute;
    top: -50px;
    right: -10px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px) saturate(150%);
    z-index: 2;
}

.image-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.08);
}

.image-modal-close span {
    color: white;
    font-size: 22px;
    font-weight: 300;
    line-height: 1;
}

.image-modal-caption {
    margin-top: 1rem;
    color: white;
    text-align: center;
    font-size: 1rem;
    max-width: 600px;
    opacity: 0.9;
    line-height: 1.5;
}

.image-modal-navigation {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
    transform: translateY(-50%);
}

.nav-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    font-size: 24px;
    font-weight: 300;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px) saturate(150%);
    pointer-events: auto;
    margin: 0 16px;
}

.nav-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.08);
}

.nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.prev-btn {
    margin-left: 16px;
}

.next-btn {
    margin-right: 16px;
}

.screenshot-item img,
.featured-main-image,
.product-card .screenshot,
.card-image .screenshot {
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.screenshot-item img:hover,
.featured-main-image:hover,
.product-card .screenshot:hover,
.card-image .screenshot:hover {
    transform: scale(1.015);
    box-shadow: 0 8px 28px -8px var(--shadow-color);
}

@media (max-width: 768px) {
    .image-modal-content {
        max-width: 98%;
        max-height: 98%;
    }

    .modal-image {
        max-height: 72vh;
    }

    .image-modal-close {
        top: -46px;
        right: 0;
        width: 40px;
        height: 40px;
    }

    .image-modal-close span {
        font-size: 20px;
    }

    .nav-btn {
        width: 44px;
        height: 44px;
        font-size: 20px;
        margin: 0 8px;
    }

    .image-modal-caption {
        font-size: 0.9rem;
        margin-top: 0.5rem;
        padding: 0 1rem;
    }
}
