/* heap. — site additions (v2)
   Extends brand.css. Adds sticky top tab-bar, footer sitemap with columns,
   screenshot tabs, CTA buttons, feature cards. Reuses tokens from :root in
   brand.css — no new colour literals.
*/

/* ---------- doc-wide nav offset ---------- */

:root {
    --nav-h: 64px;
    --subnav-h: 52px;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--nav-h) + 16px);
}

body.with-subnav {
    scroll-padding-top: calc(var(--nav-h) + var(--subnav-h) + 16px);
}

/* ---------- sticky top tab-bar ---------- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(11, 14, 19, 0.78);
    backdrop-filter: saturate(140%) blur(14px);
    -webkit-backdrop-filter: saturate(140%) blur(14px);
    border-bottom: 1px solid var(--hair);
}

.topbar-inner {
    max-width: 1320px;
    margin: 0 auto;
    padding: 0 clamp(20px, 4vw, 56px);
    height: var(--nav-h);
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 36px;
}

.brand-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
}

.brand-link .mark {
    display: block;
}

.brand-link .wm {
    font-family: var(--sans);
    font-weight: 500;
    letter-spacing: -0.035em;
    font-size: 22px;
    color: var(--brand-ink);
    line-height: 1;
}

.brand-link .wm .dot {
    color: var(--brand-accent);
}

.topbar-tabs {
    display: flex;
    align-items: center;
    justify-self: center;
    gap: 4px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 4px;
}

.tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 36px;
    padding: 0 14px;
    border-radius: 8px;
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text3);
    text-decoration: none;
    transition: color 120ms ease, background 120ms ease;
}

.tab:hover {
    color: var(--text);
}

.tab .num {
    color: var(--text4);
    font-size: 10px;
}

.tab.active {
    color: var(--text);
    background: var(--bg2);
    box-shadow: inset 0 0 0 1px var(--border);
}

.tab.active .num {
    color: var(--accent);
}

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

.btn-ghost,
.btn-solid {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 36px;
    padding: 0 14px;
    border-radius: 8px;
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    text-decoration: none;
    border: 1px solid var(--border);
    color: var(--text2);
    background: transparent;
    transition: color 120ms ease, border-color 120ms ease, background 120ms ease;
}

.btn-ghost:hover {
    color: var(--text);
    border-color: var(--text4);
}

.btn-solid {
    color: var(--accent);
    border-color: var(--accent);
}

.btn-solid:hover {
    background: var(--accent);
    color: var(--bg);
}

.btn-ghost .arrow,
.btn-solid .arrow {
    font-size: 12px;
    line-height: 1;
}

/* mobile collapse for tab pill */
@media (max-width: 980px) {
    .topbar-inner {
        grid-template-columns: auto 1fr;
        gap: 16px;
    }

    .topbar-tabs {
        display: none;
    }

    .topbar-actions .btn-ghost {
        display: none;
    }
}

/* ---------- secondary section sub-nav (brand book) ---------- */

.subnav {
    position: sticky;
    top: var(--nav-h);
    z-index: 40;
    background: rgba(11, 14, 19, 0.78);
    backdrop-filter: saturate(140%) blur(14px);
    -webkit-backdrop-filter: saturate(140%) blur(14px);
    border-bottom: 1px solid var(--hair);
}

.subnav-inner {
    max-width: 1320px;
    margin: 0 auto;
    padding: 0 clamp(20px, 4vw, 56px);
    height: var(--subnav-h);
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
}

.subnav-inner::-webkit-scrollbar {
    display: none;
}

.subnav-inner::before {
    content: "sections";
    flex: 0 0 auto;
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text4);
    margin-right: 18px;
    padding-right: 18px;
    border-right: 1px solid var(--border);
    white-space: nowrap;
}

.sub-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 32px;
    padding: 0 12px;
    border-radius: 7px;
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text4);
    text-decoration: none;
    white-space: nowrap;
    transition: color 120ms ease, background 120ms ease;
}

.sub-tab:hover {
    color: var(--text2);
}

.sub-tab .num {
    color: var(--text4);
    font-weight: 500;
}

.sub-tab.active {
    color: var(--text);
    background: var(--panel);
    box-shadow: inset 0 0 0 1px var(--border);
}

.sub-tab.active .num {
    color: var(--accent);
}

/* ---------- override old .util to hide (we don't use it any more) ---------- */

.util {
    display: none;
}

/* ---------- cover (landing) ---------- */

/* override brand.css cover so the H1 wordmark doesn't collide with the new top bar */
.cover {
    min-height: min(820px, calc(100vh - var(--nav-h)));
    padding-top: clamp(80px, 16vh, 180px);
    padding-bottom: clamp(80px, 14vh, 140px);
}

/* product surface that sits in the hero on the landing page */
.hero-surface {
    position: relative;
    margin-top: clamp(56px, 8vh, 96px);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    background: var(--panel);
    box-shadow: 0 40px 80px -50px #000, 0 0 0 1px rgba(255, 255, 255, 0.02) inset;
}

.hero-surface .surface-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--hair);
    background: var(--bg2);
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text4);
    letter-spacing: 0.06em;
}

.hero-surface .surface-bar .dots {
    display: flex;
    gap: 6px;
    margin-right: 10px;
}

.hero-surface .surface-bar .dots span {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #2b333f;
}

.hero-surface .surface-bar .meta {
    margin-left: auto;
    color: var(--text4);
}

.hero-surface img {
    display: block;
    width: 100%;
    height: auto;
}

.hero-surface .badge {
    position: absolute;
    left: 18px;
    bottom: 18px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(11, 14, 19, 0.7);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border);
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text2);
}

.hero-surface .badge::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 12px var(--accent);
}

/* ---------- old .cta retained for compatibility, with refresh ---------- */

.cta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 32px;
}

.cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
    background: transparent;
    border: 1px solid var(--accent);
    border-radius: 8px;
    padding: 12px 20px;
    text-decoration: none;
    transition: background 120ms ease, color 120ms ease;
}

.cta:hover {
    background: var(--accent);
    color: var(--bg);
}

.cta.secondary {
    color: var(--text3);
    border-color: var(--border);
}

.cta.secondary:hover {
    color: var(--text);
    background: var(--panel);
    border-color: var(--text3);
}

.cta .arrow {
    font-family: var(--mono);
    font-size: 11px;
    line-height: 1;
}

/* ---------- highlights / feature grid (refreshed) ---------- */

.feature-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    background: var(--hair);
    border: 1px solid var(--hair);
    border-radius: 14px;
    overflow: hidden;
}

@media (max-width: 980px) {
    .feature-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 620px) {
    .feature-grid {
        grid-template-columns: 1fr;
    }
}

.feature-card {
    background: var(--panel);
    padding: 32px 28px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 180px;
    position: relative;
    transition: background 160ms ease;
}

.feature-card:hover {
    background: var(--panel2);
}

.feature-card .num {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.18em;
    color: var(--text4);
    text-transform: uppercase;
}

.feature-card h4 {
    color: var(--text);
    font-size: 17px;
    font-family: var(--sans);
    font-weight: 500;
    margin: 0;
}

.feature-card p {
    color: var(--text3);
    font-size: 14px;
    line-height: 1.55;
    margin: 0;
}

.feature-card .glyph {
    position: absolute;
    top: 28px;
    right: 28px;
    width: 28px;
    height: 28px;
    color: var(--text4);
}

/* ---------- screenshot tabs (landing) ---------- */

.screens {
    margin-top: 48px;
}

.screen-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
    padding: 6px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    width: fit-content;
}

.screen-tab {
    appearance: none;
    background: transparent;
    border: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    border-radius: 8px;
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text3);
    transition: color 120ms ease, background 120ms ease;
}

.screen-tab:hover {
    color: var(--text);
}

.screen-tab[aria-selected="true"] {
    color: var(--text);
    background: var(--bg2);
    box-shadow: inset 0 0 0 1px var(--border);
}

.screen-tab .num {
    color: var(--text4);
}

.screen-tab[aria-selected="true"] .num {
    color: var(--accent);
}

.screen-panel {
    display: none;
}

.screen-panel[data-active="true"] {
    display: block;
}

.screen-frame {
    position: relative;
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    background: var(--panel);
    box-shadow: 0 40px 100px -50px #000;
}

.screen-frame .surface-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--hair);
    background: var(--bg2);
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text4);
    letter-spacing: 0.06em;
}

.screen-frame .surface-bar .dots {
    display: flex;
    gap: 6px;
    margin-right: 10px;
}

.screen-frame .surface-bar .dots span {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #2b333f;
}

.screen-frame .surface-bar .meta {
    margin-left: auto;
    color: var(--text4);
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.screen-frame img {
    display: block;
    width: 100%;
    height: auto;
}

.screen-caption {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 32px;
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--hair);
}

.screen-caption h4 {
    color: var(--text);
    font-family: var(--sans);
    font-weight: 500;
    font-size: 15px;
    margin: 0;
}

.screen-caption p {
    color: var(--text3);
    font-size: 14px;
    margin: 0;
    max-width: 60ch;
}

@media (max-width: 820px) {
    .screen-caption {
        grid-template-columns: 1fr;
    }
}

/* ---------- build grid ---------- */

.build-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

@media (max-width: 980px) {
    .build-grid {
        grid-template-columns: 1fr;
    }
}

.build-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
    overflow: hidden;
}

.build-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0.4;
}

.build-card .os {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text4);
}

.build-card h4 {
    margin: 0;
    color: var(--text);
    font-family: var(--sans);
    font-weight: 500;
    font-size: 17px;
}

.build-card pre {
    margin: 0;
    padding: 16px;
    background: var(--bg);
    border: 1px solid var(--hair);
    border-radius: 8px;
    color: var(--text2);
    font-family: var(--mono);
    font-size: 12px;
    line-height: 1.65;
    overflow-x: auto;
}

.build-card code {
    font-family: inherit;
}

.build-card .note {
    color: var(--text4);
    font-size: 12px;
    margin: 0;
}

/* ---------- surfaces gallery (landing) ---------- */

.surface-stack {
    display: grid;
    gap: 28px;
}

.surface-stack .surface {
    padding: 32px;
}

.surface-stack .surface img {
    width: 100%;
    height: auto;
    display: block;
}

/* ---------- brand teaser cells ---------- */

.brand-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 24px;
    margin-top: 32px;
}

@media (max-width: 820px) {
    .brand-row {
        grid-template-columns: 1fr;
    }
}

.brand-row .canvas {
    padding: 48px 24px;
    min-height: 200px;
}

.brand-row .canvas img {
    max-width: 70%;
    height: auto;
}

.brand-row .canvas img.wordmark-asset {
    max-width: 60%;
}

.brand-row .canvas img.lockup-asset {
    max-width: 80%;
}

/* ---------- hero CTAs sit inside cover.lede-row ---------- */

.cover .lede-row .descriptor {
    font-family: var(--sans);
    font-size: 19px;
    color: var(--text2);
    margin: 0 0 8px 0;
}

.cover .lede-row .descriptor-fine {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text4);
    letter-spacing: 0.06em;
    margin: 0;
}

/* ---------- chips ---------- */

.chip-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 4px;
}

/* ---------- key numbers strip ---------- */

.stat-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    background: var(--hair);
    border: 1px solid var(--hair);
    border-radius: 14px;
    overflow: hidden;
    margin-top: 56px;
}

@media (max-width: 820px) {
    .stat-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

.stat {
    background: var(--panel);
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat .v {
    font-family: var(--serif);
    font-weight: 300;
    font-size: clamp(32px, 4vw, 44px);
    line-height: 1;
    color: var(--text);
    letter-spacing: -0.02em;
}

.stat .v .u {
    font-family: var(--mono);
    font-size: 13px;
    color: var(--text4);
    letter-spacing: 0.06em;
    margin-left: 4px;
}

.stat .k {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text4);
}

/* ---------- footer / sitemap ---------- */

footer.foot {
    display: block;
    border-top: 1px solid var(--hair);
    padding: 0 !important;
    margin-top: 80px;
}

.foot-inner {
    padding: clamp(56px, 8vh, 96px) var(--gut) 36px;
    display: grid;
    grid-template-columns: 1.3fr 1fr 1fr 1fr;
    gap: 48px;
}

@media (max-width: 980px) {
    .foot-inner {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 560px) {
    .foot-inner {
        grid-template-columns: 1fr;
    }
}

.foot-brand .brand-link .wm {
    font-size: 28px;
}

.foot-brand p {
    margin-top: 16px;
    color: var(--text3);
    font-size: 14px;
    max-width: 34ch;
}

.foot-brand .mini-tags {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.foot-col h5 {
    margin: 0 0 14px 0;
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text4);
    font-weight: 500;
}

.foot-col ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 10px;
}

.foot-col a {
    color: var(--text2);
    text-decoration: none;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: color 120ms ease;
}

.foot-col a:hover {
    color: var(--text);
}

.foot-col a .ext {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text4);
}

.foot-bottom {
    padding: 18px var(--gut);
    border-top: 1px solid var(--hair);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text4);
}

.foot-bottom .right {
    display: flex;
    gap: 18px;
    align-items: center;
    color: var(--text4);
}

.foot-bottom .right .dot {
    color: var(--brand-accent);
}

/* ---------- in-line section anchors offset (handled by scroll-padding) ---------- */

section[id] {
    scroll-margin-top: calc(var(--nav-h) + 16px);
}

body.with-subnav section[id] {
    scroll-margin-top: calc(var(--nav-h) + var(--subnav-h) + 16px);
}

/* ---------- small visual polish over the brand.css base ---------- */

.cover .wordmark-xl {
    /* tighter so it doesn't overlap the new sticky nav at small heights */
    font-size: clamp(120px, 20vw, 260px);
    margin-bottom: 48px;
}

.eyebrow .num {
    color: var(--accent);
    font-weight: 500;
}

/* used on the inline subhead under sections */
.section-head {
    display: grid;
    grid-template-columns: 1fr 1.4fr;
    gap: 48px 64px;
    align-items: end;
    margin-bottom: 64px;
}

@media (max-width: 820px) {
    .section-head {
        grid-template-columns: 1fr;
        gap: 24px;
    }
}

.section-head h2 {
    margin: 0;
}

.section-head .desc {
    color: var(--text2);
    font-size: 17px;
    line-height: 1.6;
    max-width: 56ch;
    margin: 0;
}

/* ---------- on-brand-page section spacing tweak ---------- */

body.with-subnav section:first-of-type {
    padding-top: clamp(80px, 12vh, 160px);
}
