/* --scroll: 0 at the top of the page → 1 once the hero is scrolled past (set by main.js)
   --scroll-y: raw scroll position in px, used for the background parallax */
:root {
    --bg: #251b2d;
    --surface: #30243a;
    --text: #f6f1f9;
    --muted: #b9adc4;
    --accent: #c792ea;
    --border: #4a3b57;
    --border-strong: #8a7a99;

    --scroll: 0;
    --scroll-y: 0;
    --pad: 48px;
    --logo-w: 188px;
    --hero-w: min(1280px, 92vw);

    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 16px/26px Montserrat, system-ui, sans-serif;
}

a { color: var(--accent); }
a:hover { color: var(--text); }

h1, h2, h3, p { margin: 0; }

.padded {
    padding-left: var(--pad);
    padding-right: var(--pad);
}

.container {
    max-width: 1120px;
    margin: 0 auto;
}

.eyebrow {
    font-size: 12px;
    line-height: 16px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.muted { color: var(--muted); }

/* ---------- Fixed background layers ---------- */

.background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: calc(100vh + 720px);
    background: var(--bg) url(../images/background.svg) center top / cover no-repeat;
    transform: translate3d(0, calc(var(--scroll-y) * -0.25px), 0);
    will-change: transform;
}

.halo {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background: rgba(199, 146, 234, .07);
    backdrop-filter: blur(1px);
}

.leaves {
    position: fixed;
    inset: 0;
    z-index: 2;
    overflow: hidden;
    pointer-events: none;
    opacity: calc(1 - var(--scroll) * 0.75);
}

.leaf-fall {
    position: absolute;
    top: -8vh;
    animation: fall linear infinite;
}

.leaf {
    display: block;
    clip-path: url(#leaf-shape);
    animation: sway ease-in-out infinite alternate;
}

.veil {
    position: fixed;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    background: rgba(58, 44, 70, calc(var(--scroll) * 0.55));
    backdrop-filter: blur(calc(var(--scroll) * 9px));
}

/* ---------- Logo: big and centred at the top, shrinks into the header on scroll ---------- */

.logo {
    position: fixed;
    z-index: 12;
    left: calc(50% * (1 - var(--scroll)) + var(--pad) * var(--scroll));
    top: calc(46% * (1 - var(--scroll)) + 36px * var(--scroll));
    width: calc(var(--hero-w) * (1 - var(--scroll)) + var(--logo-w) * var(--scroll));
    transform: translate(calc(-50% * (1 - var(--scroll))), -50%);
}

.logo img {
    display: block;
    width: 100%;
    height: auto;
}

/* ---------- Header ---------- */

.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
}

.header-bg {
    position: absolute;
    inset: 0;
    opacity: var(--scroll);
    background: rgba(37, 27, 45, .82);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(12px);
}

.nav-row {
    position: relative;
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    opacity: var(--scroll);
}

.site-header nav a {
    display: flex;
    align-items: center;
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
}

.site-header nav a:hover { color: var(--accent); }

.desktop-nav {
    display: flex;
    gap: 32px;
    font-size: 14px;
    line-height: 22px;
}

.desktop-nav a { min-height: 44px; }

.menu-button {
    display: none;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: rgba(48, 36, 58, .8);
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    color: var(--text);
    cursor: pointer;
}

.mobile-nav {
    position: relative;
    display: flex;
    flex-direction: column;
    padding-top: 8px;
    padding-bottom: 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    opacity: var(--scroll);
}

.mobile-nav a { min-height: 48px; }
.mobile-nav a + a { border-top: 1px solid var(--border); }

.mobile-nav[hidden],
.at-top .mobile-nav { display: none; }

.at-top .nav-row { visibility: hidden; }

/* ---------- Content ---------- */

main {
    position: relative;
    z-index: 5;
}

.section {
    padding-bottom: 96px;
    scroll-margin-top: 104px;
}

.hero {
    height: 100vh;
    min-height: 480px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    padding-bottom: 32px;
}

.hero-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    opacity: calc(1 - var(--scroll) * 1.6);
}

.scroll-hint {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-height: 44px;
    color: var(--text);
    text-decoration: none;
}

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

.made-in-canada {
    display: block;
    height: 22px;
    width: auto;
}

#intro { padding-top: 96px; }

.intro {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 24px;
}

h1 {
    max-width: 880px;
    padding-bottom: 8px;
    font-size: 64px;
    line-height: 1;
    font-weight: 700;
    letter-spacing: -0.01em;
    background: linear-gradient(180deg, #f95c1f, #d7519e);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.intro p { max-width: 640px; }

.button {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    margin-top: 8px;
    padding: 0 24px;
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    background: rgba(48, 36, 58, .6);
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-decoration: none;
}

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

h2 {
    margin-bottom: 8px;
    font-size: 28px;
    line-height: 34px;
    font-weight: 700;
}

.grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
    margin-top: 32px;
}

.card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 24px;
    background: rgba(48, 36, 58, .6);
    border: 1px solid var(--border);
    border-radius: 12px;
    transition: border-color .15s;
}

.card:hover { border-color: var(--border-strong); }

.card.placeholder { border: 1px dashed var(--border-strong); }

.card h3 {
    font-size: 20px;
    line-height: 28px;
    font-weight: 600;
}

.card h3 a {
    color: var(--text);
    text-decoration: none;
}

/* Make the whole card clickable */
.card h3 a::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
}

.card:hover h3 a { color: var(--accent); }

.topics {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: auto 0 0;
    padding: 0;
    list-style: none;
    font-size: 12px;
    line-height: 16px;
    font-weight: 600;
    color: var(--accent);
}

/* Full description stays in the markup; it's clamped to 3 lines at whatever width the card is */
.card p {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    overflow: hidden;
    font-size: 14px;
    line-height: 22px;
    font-weight: 500;
    color: var(--muted);
}

.all-projects {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    margin-top: 16px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}

.contributors {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin: 32px 0 0;
    padding: 0;
    list-style: none;
}

.contributor {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: rgba(48, 36, 58, .6);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.contributor img {
    flex: none;
    border-radius: 50%;
    object-fit: cover;
    background: var(--surface);
}

.contributor div { min-width: 0; }

.contributor-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
}

.contributor-name a {
    color: var(--text);
    text-decoration: none;
}

.contributor-name a:hover { color: var(--accent); }

.contributor-commits {
    font-size: 14px;
    line-height: 22px;
    color: var(--muted);
}

.badge {
    align-self: flex-start;
    padding: 4px 12px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: 12px;
    line-height: 16px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--muted);
}

.site-footer {
    padding-top: 32px;
    padding-bottom: 32px;
    background: rgba(37, 27, 45, .82);
    border-top: 1px solid var(--border);
}

.site-footer .container {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    font-size: 14px;
    line-height: 22px;
    font-weight: 500;
}

.site-footer a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

/* ---------- Animations ---------- */

.bounce { animation: bounce 1.8s ease-in-out infinite; }

@keyframes fall {
    from { transform: translate3d(0, 0, 0); }
    to { transform: translate3d(6vw, 120vh, 0); }
}

@keyframes sway {
    from { transform: translateX(-18px) rotate(-50deg); }
    to { transform: translateX(18px) rotate(70deg); }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(8px); }
}

/* ---------- Responsive ---------- */

@media (min-width: 701px) {
    .mobile-nav { display: none !important; }
}

@media (max-width: 900px) {
    .grid, .contributors { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
    :root {
        --pad: 16px;
        --logo-w: 150px;
    }

    .grid, .contributors { grid-template-columns: minmax(0, 1fr); }
    h1 { font-size: 40px; }
    .desktop-nav { display: none; }
    .menu-button { display: flex; }
}

@media (prefers-reduced-motion: reduce) {
    :root { scroll-behavior: auto; }
    .leaf-fall, .leaf, .bounce { animation: none; }
    .leaf-fall { top: auto; }
}
