/* =====================================================
   CorpoCoders — Site Layout Shell  (.st-*)

   REQUIRES assets/site/css/site.css (tokens, base, motion gate) loaded
   first, then components.css (.cc-* primitives). This file holds the
   SHARED page chrome used by every public page via
   resources/views/site/layout/app.blade.php (CLAUDE.md §1.1):

     • ambient background (fixed grid + brand orbs)
     • centred shell wrapper
     • topbar (logo, theme toggle, auth buttons)
     • section scaffolding (eyebrow → h2 → lead + "view all")
     • footer (brand column, link columns, legal bar)

   Page CSS (home.css, articles.css, …) adds only page-specific rules.
   The `st` prefix = "site shell" — do not reuse it for page content.
===================================================== */


/* =========================
   AMBIENT BACKGROUND

   A fixed layer that never scrolls and costs nothing in layout — a
   full-page square grid (both themes) plus three blurred brand orbs.
========================= */

.st-bg {
    position: fixed;
    inset: 0;
    z-index: var(--cc-z-bg);
    pointer-events: none;
    overflow: hidden;
}

.st-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(var(--cc-grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--cc-grid-line) 1px, transparent 1px);
    background-size: 56px 56px;
    /* Full-page square grid (both themes). .st-bg is fixed, so this covers the
       whole viewport at every scroll position. A gentle radial vignette only
       softens the far corners so the grid never hard-cuts at the edges. */
    -webkit-mask-image: radial-gradient(ellipse 100% 100% at 50% 50%, #000 62%, transparent 100%);
    mask-image: radial-gradient(ellipse 100% 100% at 50% 50%, #000 62%, transparent 100%);
}

.st-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    opacity: var(--cc-orb-o);
    animation: st-float 18s ease-in-out infinite;
}

.st-orb-1 {
    width: 520px;
    height: 520px;
    top: -170px;
    left: -130px;
    background: var(--cc-brand-1);
}

.st-orb-2 {
    width: 480px;
    height: 480px;
    top: -60px;
    right: -150px;
    background: var(--cc-brand-2);
    animation-delay: -6s;
}

.st-orb-3 {
    width: 420px;
    height: 420px;
    top: 40%;
    left: 44%;
    background: var(--cc-secondary);
    opacity: calc(var(--cc-orb-o) * .5);
    animation-delay: -11s;
}

@keyframes st-float {

    0%,
    100% {
        transform: translate3d(0, 0, 0) scale(1);
    }

    50% {
        transform: translate3d(30px, 40px, 0) scale(1.08);
    }
}


/* =========================
   SHELL
========================= */

.st-shell {
    position: relative;
    z-index: var(--cc-z-content);
    max-width: var(--cc-max);
    margin: 0 auto;
    padding: 0 24px;
}


/* =========================
   TOPBAR

   Minimal for now — logo, theme toggle and auth buttons. The full
   12-item sticky nav is a later phase; this is the shared shell it grows
   from.
========================= */

.st-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 24px 0;
}

.st-logo {
    display: inline-flex;
    align-items: center;
    gap: 11px;
}

.st-logo-mark {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: var(--cc-grad);
    color: #fff;
    font-size: 20px;
    box-shadow: 0 8px 22px -8px rgba(15, 61, 222, .75);
}

.st-logo-img {
    max-width: 100%;
    height: auto;
}

.st-logo-text {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -.02em;
}

.st-logo-accent {
    background: var(--cc-grad);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.st-topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.st-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

.st-nav a {
    padding: 8px 11px;
    border-radius: 7px;
    color: var(--cc-tx-3);
    font-size: 13.5px;
    font-weight: 600;
    transition: color var(--cc-t), background var(--cc-t);
}

.st-nav a:hover, .st-nav a.is-active { background: var(--cc-surface); color: var(--cc-tx-1); }
.st-menu-btn { display: none; }

.st-icon-btn {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border: 1px solid var(--cc-border);
    border-radius: var(--cc-r-sm);
    background: var(--cc-surface);
    color: var(--cc-tx-2);
    font-size: 17px;
    cursor: pointer;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    transition: color var(--cc-t), border-color var(--cc-t), background var(--cc-t);
}

.st-icon-btn:hover {
    color: var(--cc-tx-1);
    border-color: var(--cc-border-str);
}

/* Theme icon swap — sun shows in light, moon in dark */
.st-icon-light {
    display: none;
}

.st-icon-dark {
    display: block;
}

:root[data-theme="light"] .st-icon-light {
    display: block;
}

:root[data-theme="light"] .st-icon-dark {
    display: none;
}


/* =========================
   SECTION SCAFFOLDING

   Shared chrome for content sections: a head (eyebrow → h2 → lead) with
   an optional "view all" link, and a centred variant. Reused so every
   section shares vertical rhythm. (design.md §6)
========================= */

.st-section {
    padding: 64px 0;
}

.st-section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 40px;
}

.st-section-head-center {
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.st-section-head-center p {
    margin-left: auto;
    margin-right: auto;
}

.st-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--cc-tx-3);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.st-eyebrow i {
    color: var(--cc-brand-2);
    font-size: 14px;
}

:root[data-theme="light"] .st-eyebrow i {
    color: var(--cc-brand-1);
}

.st-section-head h2 {
    margin-top: 14px;
    font-size: clamp(1.6rem, 3.1vw, 2.15rem);
}

.st-section-head p {
    margin-top: 12px;
    max-width: 56ch;
    color: var(--cc-tx-2);
}

/* "View all" link — arrow nudges on hover */
.st-see-all {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    flex: 0 0 auto;
    color: var(--cc-tx-2);
    font-size: 14px;
    font-weight: 600;
    transition: color var(--cc-t);
}

.st-see-all i {
    transition: transform var(--cc-t);
}

.st-see-all:hover {
    color: var(--cc-brand-2);
}

.st-see-all:hover i {
    transform: translateX(3px);
}

:root[data-theme="light"] .st-see-all:hover {
    color: var(--cc-brand-1);
}


/* =========================
   FOOTER

   Sits on a top hairline. A wide brand column (logo, blurb, socials) plus
   five link columns, then a legal bottom-bar. Muted by default — links
   and social tiles light to brand on hover (§1.9, footer text is tx-3).
========================= */

.st-footer {
    position: relative;
    z-index: var(--cc-z-content);
    border-top: 1px solid var(--cc-border);
    margin-top: 32px;
}

.st-footer-top {
    display: grid;
    grid-template-columns: 1.5fr repeat(5, 1fr);
    gap: 40px 32px;
    padding: 64px 0 48px;
}

.st-foot-brand {
    max-width: 300px;
}

.st-foot-blurb {
    margin-top: 16px;
    color: var(--cc-tx-3);
    font-size: 14px;
    line-height: 1.65;
}

/* Social tiles */
.st-foot-social {
    display: flex;
    gap: 10px;
    margin-top: 22px;
}

.st-foot-social a {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border: 1px solid var(--cc-border);
    border-radius: var(--cc-r-sm);
    background: var(--cc-surface);
    color: var(--cc-tx-3);
    font-size: 17px;
    transition: color var(--cc-t), border-color var(--cc-t), background var(--cc-t), transform var(--cc-t);
}

.st-foot-social a:hover {
    color: var(--cc-brand-2);
    border-color: var(--cc-border-str);
    background: var(--cc-grad-soft);
    transform: translateY(-2px);
}

:root[data-theme="light"] .st-foot-social a:hover {
    color: var(--cc-brand-1);
}

/* Link columns */
.st-foot-col h4 {
    margin-bottom: 16px;
    color: var(--cc-tx-1);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.st-foot-col ul {
    list-style: none;
    display: grid;
    gap: 11px;
}

.st-foot-col a {
    color: var(--cc-tx-3);
    font-size: 14px;
    transition: color var(--cc-t), padding-left var(--cc-t);
}

.st-foot-col a:hover {
    color: var(--cc-tx-1);
    padding-left: 4px;
}

/* Legal bottom-bar */
.st-foot-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px 24px;
    padding: 22px 0 40px;
    border-top: 1px solid var(--cc-border);
    color: var(--cc-tx-3);
    font-size: 13px;
}

.st-foot-legal {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
}

.st-foot-legal a {
    color: var(--cc-tx-3);
    transition: color var(--cc-t);
}

.st-foot-legal a:hover {
    color: var(--cc-tx-1);
}


/* =========================
   RESPONSIVE  (§1.10)
========================= */

@media (max-width: 960px) {
    .st-menu-btn { display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--cc-border); border-radius: var(--cc-r-sm); background: var(--cc-surface); color: var(--cc-tx-1); font-size: 20px; cursor: pointer; }
    .st-nav { display: none; position: absolute; top: 78px; left: 18px; right: 18px; z-index: 20; flex-direction: column; align-items: stretch; gap: 4px; padding: 10px; border: 1px solid var(--cc-border-str); border-radius: var(--cc-r-md); background: var(--cc-bg); box-shadow: 0 18px 38px -18px rgba(0, 0, 0, .55); }
    .st-nav.is-open { display: flex; }
    .st-nav a { padding: 12px; }
    .st-section {
        padding: 48px 0;
    }

    /* Footer: brand row spans full width, links wrap to 3 columns */
    .st-footer-top {
        grid-template-columns: repeat(3, 1fr);
        gap: 36px 28px;
    }

    .st-foot-brand {
        grid-column: 1 / -1;
        max-width: 420px;
    }
}

@media (max-width: 560px) {
    .st-shell {
        padding: 0 18px;
    }

    .st-topbar {
        padding: 18px 0;
    }

    .st-logo-img {
        max-width: 150px;
    }

    /* Auth buttons collapse to keep the topbar on one line */
    .st-auth-hide {
        display: none;
    }

    .st-section {
        padding: 40px 0;
    }

    /* Section head stacks — the "view all" link drops below the title */
    .st-section-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
        margin-bottom: 28px;
    }

    /* Footer: two columns of links, centred legal bar */
    .st-footer-top {
        grid-template-columns: repeat(2, 1fr);
        gap: 32px 24px;
        padding: 48px 0 40px;
    }

    .st-foot-bottom {
        justify-content: center;
        text-align: center;
    }

    .st-foot-legal {
        justify-content: center;
    }
}


/* =========================
   MOTION PREFERENCE
========================= */

@media (prefers-reduced-motion: reduce) {
    .st-orb {
        animation: none;
    }
}
