/* ============================================================
   Landing hub — scottruiter.github.io
   Cinematic front door: live scan-line canvas + four portals.
   Shares the design tokens of site.css but stays independent.
   ============================================================ */

:root {
    --bg: #070b12;
    --bg-2: #0b111c;
    --surface: #101826;
    --line: #1e2c42;
    --text: #dbe5f1;
    --text-dim: #8fa1b8;
    --accent: #4fd1ff;
    --accent-2: #7c6cff;
    --amber: #ffc860;
    --font-display: "Space Grotesk", "Segoe UI", sans-serif;
    --font-body: "Inter", "Segoe UI", sans-serif;
    --font-mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
}

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

html { height: 100%; }

body {
    min-height: 100vh;
    min-height: 100svh;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 17px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }

::selection { background: rgba(79, 209, 255, .3); }

/* ---------- Background layers ---------- */
#scan {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    z-index: 0;
}

.vignette {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background:
        radial-gradient(ellipse 70% 55% at 50% 38%, rgba(7, 11, 18, 0) 0%, rgba(7, 11, 18, .35) 60%, rgba(7, 11, 18, .85) 100%),
        linear-gradient(180deg, rgba(7, 11, 18, .55) 0%, rgba(7, 11, 18, 0) 28%, rgba(7, 11, 18, 0) 55%, rgba(7, 11, 18, .92) 100%);
}

/* ---------- Corner HUD ---------- */
.hud {
    position: fixed;
    top: 20px;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-family: var(--font-mono);
    font-size: 11px;
    line-height: 1.4;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: rgba(79, 209, 255, .6);
    pointer-events: none;
    opacity: 0;
    animation: fadein 1.2s ease .9s forwards;
}

.hud span:first-child { color: rgba(143, 161, 184, .55); }
.hud-tl { left: 24px; }
.hud-tr { right: 24px; text-align: right; }

@keyframes fadein { to { opacity: 1; } }

/* ---------- Stage layout ---------- */
.stage {
    position: relative;
    z-index: 2;
    min-height: 100vh;
    min-height: 100svh;
    max-width: 1280px;
    margin: 0 auto;
    padding: clamp(76px, 12vh, 128px) clamp(16px, 4vw, 48px) 26px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    gap: clamp(36px, 6vh, 76px);
}

/* ---------- Hero ---------- */
.hero {
    text-align: center;
    max-width: 960px;
}

.kicker {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: .8rem;
    letter-spacing: .3em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 22px;
}

h1 {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2.7rem, 7.4vw, 6.6rem);
    line-height: .98;
    letter-spacing: -.035em;
    text-wrap: balance;
}

.grad {
    background: linear-gradient(92deg, #4fd1ff 0%, #8ad9ff 30%, #7c6cff 60%, #4fd1ff 100%);
    background-size: 220% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: shimmer 18s ease-in-out infinite alternate;
}

@keyframes shimmer {
    from { background-position: 0% 50%; }
    to { background-position: 100% 50%; }
}

.sub {
    margin: 26px auto 0;
    max-width: 660px;
    color: var(--text-dim);
    font-size: clamp(1rem, 1.45vw, 1.18rem);
    line-height: 1.6;
    text-wrap: pretty;
}

/* ---------- Portals ---------- */
/* The tile area arranges itself from how many tiles it holds: --cols is
   chosen so the rows stay balanced (4 → 4, 5-6 → 3+2/3+3, 7-8 → 4+3/4+4,
   9 → 3x3, 10+ → 4 per row). Rows share the available height equally.
   Each tile keeps a minimum height, so with more tiles than fit the page
   simply grows and scrolls rather than clipping anything. */
.portals {
    --cols: 4;
    --gap: 14px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-content: stretch;
    gap: var(--gap);
    width: 100%;
}

.portals:has(.portal:nth-child(5)) { --cols: 3; }
.portals:has(.portal:nth-child(7)) { --cols: 4; }
.portals:has(.portal:nth-child(9)) { --cols: 3; }
.portals:has(.portal:nth-child(10)) { --cols: 4; }

.portal {
    position: relative;
    display: block;
    flex: 0 1 calc((100% - (var(--cols) - 1) * var(--gap)) / var(--cols));
    aspect-ratio: 3 / 4;
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .08);
    background: var(--surface);
    color: var(--text);
    isolation: isolate;
    transition: transform .5s cubic-bezier(.2, .8, .2, 1), border-color .35s ease, box-shadow .5s ease;
}

.portal img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: saturate(.7) brightness(.6);
    transition: transform 1.2s cubic-bezier(.2, .8, .2, 1), filter .5s ease;
    z-index: -1;
}

.portal::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(180deg, rgba(7, 11, 18, .02) 0%, rgba(7, 11, 18, .3) 45%, rgba(7, 11, 18, .94) 100%);
}

.portal-body {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    padding: 22px 20px 20px;
}

.portal-tag {
    display: block;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: .2em;
    text-transform: uppercase;
    color: var(--accent);
}

.portal h2 {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.45rem, 2vw, 1.85rem);
    letter-spacing: -.02em;
    margin: 8px 0 6px;
}

.portal p {
    color: var(--text-dim);
    font-size: .88rem;
    line-height: 1.45;
    transition: color .3s ease;
}

.portal-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    font-weight: 600;
    font-size: .88rem;
    color: var(--text);
    opacity: .75;
    transition: opacity .3s ease;
}

.portal-cta i {
    font-style: normal;
    transition: transform .3s cubic-bezier(.2, .8, .2, 1);
}

.portal:hover,
.portal:focus-visible {
    transform: translateY(-6px);
    border-color: rgba(79, 209, 255, .55);
    box-shadow:
        0 28px 60px -24px rgba(79, 209, 255, .45),
        inset 0 0 0 1px rgba(79, 209, 255, .18);
}

.portal:hover img,
.portal:focus-visible img {
    transform: scale(1.07);
    filter: saturate(1) brightness(.8);
}

.portal:hover p,
.portal:focus-visible p { color: var(--text); }

.portal:hover .portal-cta,
.portal:focus-visible .portal-cta { opacity: 1; }

.portal:hover .portal-cta i,
.portal:focus-visible .portal-cta i { transform: translateX(5px); }

.portal:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

/* ---------- Footer bar ---------- */
.foot {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px 24px;
    padding-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, .07);
    color: var(--text-dim);
    font-size: .84rem;
}

.foot-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 24px;
}

.foot-links a {
    color: var(--text-dim);
    font-weight: 500;
    letter-spacing: .02em;
    transition: color .2s ease;
}

.foot-links a:hover,
.foot-links a:focus-visible { color: var(--accent); }

/* ---------- Entrance ---------- */
.rise {
    opacity: 0;
    transform: translateY(18px);
    animation: rise 1s cubic-bezier(.2, .8, .2, 1) forwards;
    animation-delay: var(--d, 0s);
}

@keyframes rise {
    to { opacity: 1; transform: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
    .stage > .portals:has(.portal) { --cols: 2; }
    .portal { aspect-ratio: 4 / 3; }
}

@media (max-width: 760px) {
    .hud { display: none; }
    .stage { padding-top: clamp(56px, 9vh, 88px); gap: 32px; }
    .kicker { font-size: .72rem; letter-spacing: .24em; margin-bottom: 16px; }
    .sub { margin-top: 18px; }
    .foot { justify-content: center; text-align: center; }
    .foot-links { justify-content: center; gap: 6px 18px; }
}

@media (max-width: 520px) {
    .stage > .portals:has(.portal) { --cols: 1; --gap: 12px; }
    .portal { aspect-ratio: 2 / 1; }
    .portal-body { padding: 16px; }
    .portal p { display: none; }
    .portal-cta { margin-top: 8px; }
}

/* ---------- Single-screen layout on desktop ----------
   Everything is sized from the viewport height so the page never scrolls.
   Narrow or very short viewports fall back to the scrolling layout below. */
@media (min-height: 520px) {
    /* min-height rather than height: the tiles grow to fill the screen when
       they fit, and the page scrolls only when there are too many of them. */
    .stage {
        min-height: 100vh;
        min-height: 100svh;
        padding: clamp(40px, 8vh, 88px) clamp(16px, 4vw, 48px) 10px;
        gap: clamp(12px, 2.6vh, 36px);
    }

    .hero { flex: 0 0 auto; }
    .kicker { font-size: clamp(.62rem, 1.05vh, .8rem); margin-bottom: clamp(8px, 1.6vh, 22px); }
    h1 { font-size: clamp(1.9rem, min(8.6vh, 9.6vw), 6.6rem); }
    .sub { margin-top: clamp(10px, 2vh, 26px); font-size: clamp(.88rem, 1.75vh, 1.18rem); max-width: 60ch; }

    .portals {
        flex: 1 1 auto;
        min-height: 0;
        --gap: clamp(10px, 1.4vw, 16px);
    }
    .portal { aspect-ratio: auto; min-height: 150px; }
    .portal-body { padding: clamp(12px, 2vh, 22px) clamp(14px, 1.6vw, 20px); }
    .portal h2 { font-size: clamp(1.1rem, 2.6vh, 1.85rem); margin: clamp(4px, .8vh, 8px) 0 clamp(3px, .6vh, 6px); }
    .portal p { font-size: clamp(.78rem, 1.45vh, .9rem); }
    .portal-cta { margin-top: clamp(6px, 1.2vh, 14px); font-size: clamp(.78rem, 1.4vh, .9rem); }

    .foot { flex: 0 0 auto; padding-top: 10px; font-size: .8rem; }
}

/* Tablets and phones in single-screen mode: a 2 x 2 grid of portals. */
@media (min-height: 520px) and (max-width: 980px) {
    .stage > .portals:has(.portal) { --cols: 2; --gap: 10px; }
    .portal { aspect-ratio: auto; min-height: 140px; }
    .portal p { display: none; }
    .portal-body { padding: 12px 14px; }
}

/* Short windows: drop the blurbs so the cards stay readable. */
@media (min-height: 520px) and (max-height: 720px) {
    .portal p { display: none; }
    .sub { display: none; }
}

@media (min-height: 520px) and (max-width: 520px) {
    .sub { display: none; }
    .foot { gap: 6px 14px; font-size: .74rem; }
    .foot-links { gap: 4px 12px; }
}

@media (prefers-reduced-motion: reduce) {
    .rise, .hud, .grad { animation: none; opacity: 1; transform: none; }
    .portal, .portal img, .portal-cta i { transition: none; }
}
