/* atum Apps — site styles.
   One stylesheet for every page. Design tokens first; change colours and
   spacing there rather than in the rules below. See CLAUDE.md. */

:root {
    /* Palette */
    --night: #070d1f;            /* page background */
    --blue: #309afd;             /* brand primary (matches the lotus + icons) */
    --blue-soft: #8cc4ff;        /* links and accents on dark */
    --teal: #35b9ad;             /* second glow, taken from the hero video */
    --ink: #f4f7ff;              /* main text */
    --ink-dim: #b4c0dc;          /* secondary text */

    /* Glass sheet */
    --glass-fill: rgba(44, 78, 160, 0.26);
    --glass-edge: rgba(255, 255, 255, 0.55);
    --glass-glow: inset 0 4px 20px rgba(255, 255, 255, 0.16);
    --glass-drop: 0 8px 32px rgba(4, 12, 60, 0.45);
    --glass-blur: blur(14px) saturate(1.7);

    /* Raised tile (the neumorphic part) */
    --tile-fill: rgba(255, 255, 255, 0.09);
    --tile-raise: inset 0 1px 0 rgba(255, 255, 255, 0.28),
        inset 0 -1px 0 rgba(0, 0, 0, 0.35), 0 4px 10px rgba(0, 0, 0, 0.35);
    --tile-press: inset 0 2px 6px rgba(0, 0, 0, 0.5),
        inset 0 -1px 0 rgba(255, 255, 255, 0.12);

    --radius-sheet: 16px;
    --radius-tile: 12px;
    --page-width: 1040px;
    --gutter: 16px;
    --stage-top: 104px;          /* home page: where open panels may start, just below the logo plate */
    --apps-columns: 4;           /* phones: app tiles per dock row. js/site.js sets this from the tile count */

    --font-display: "Bricolage Grotesque", "Source Sans 3", sans-serif;
    --font-body: "Source Sans 3", "Source Sans Pro", system-ui, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    display: flex;
    flex-direction: column;
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    background-color: var(--night);
    background-image:
        radial-gradient(60vw 50vw at 8% 30%, rgba(48, 154, 253, 0.22), transparent 70%),
        radial-gradient(55vw 45vw at 95% 85%, rgba(53, 185, 173, 0.16), transparent 70%);
    background-attachment: fixed;
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 1.0625rem;
    line-height: 1.55;
}

img,
video {
    display: block;
    max-width: 100%;
}

a {
    color: var(--blue-soft);
    text-underline-offset: 0.18em;
}

a:hover {
    color: #fff;
}

:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 3px;
    border-radius: 4px;
}

h1,
h2 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.1;
    margin: 0;
}

p {
    margin: 0 0 1em;
    max-width: 62ch;
}

/* ---------- Glass ---------- */

/* The radial gradient is the "light on glass": js/site.js moves --light-x/-y
   to the mouse pointer. Off-surface by default, so it is invisible until then.
   Set background-color (not the background shorthand) on glass variants, or
   the light is lost. */
.glass {
    background-color: var(--glass-fill);
    background-image: radial-gradient(
        circle 260px at var(--light-x, -999px) var(--light-y, -999px),
        rgba(255, 255, 255, 0.17),
        transparent
    );
    background-repeat: no-repeat;
    border: 1px solid var(--glass-edge);
    border-radius: var(--radius-sheet);
    box-shadow: var(--glass-drop), var(--glass-glow);
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
}

/* ---------- Hero (video banner) ---------- */

.hero {
    position: relative;
    flex: none;
    height: clamp(220px, 42vw, 480px);
    overflow: hidden;
}

/* The video fades out at the bottom so the dock appears to sit on it. */
.hero video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top; /* any cropping comes off the bottom, which fades out anyway */
    -webkit-mask-image: linear-gradient(to bottom, #000 50%, transparent);
    mask-image: linear-gradient(to bottom, #000 50%, transparent);
}

.hero--plain {
    height: 150px;
}

.brand {
    position: absolute;
    z-index: 2;
    top: var(--gutter);
    left: max(var(--gutter), calc((100vw - var(--page-width)) / 2));
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 18px 10px 12px;
    color: var(--ink);
    text-decoration: none;
}

.brand:hover {
    color: var(--ink);
}

/* Darker glass for anything sitting directly on the video, so it stays legible. */
.brand,
.video-toggle {
    background-color: rgba(7, 13, 31, 0.6);
}

.brand img {
    width: 54px;
    height: auto;
}

.wordmark {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.7rem;
    line-height: 1.1;
    letter-spacing: -0.01em;
}

.wordmark-atum {
    color: var(--blue);
}

.tagline {
    margin: 0;
    font-size: 0.9rem;
    color: var(--ink-dim);
}

.video-toggle {
    position: absolute;
    z-index: 2;
    top: var(--gutter);
    right: max(var(--gutter), calc((100vw - var(--page-width)) / 2));
    display: none; /* shown by js/site.js, which is what makes it work */
    place-items: center;
    width: 46px;
    height: 46px;
    padding: 0;
    color: var(--ink);
    cursor: pointer;
}

.js .video-toggle {
    display: grid;
}

.video-toggle svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.video-toggle .icon-play,
.video-toggle[aria-pressed="true"] .icon-pause {
    display: none;
}

.video-toggle[aria-pressed="true"] .icon-play {
    display: block;
}

/* ---------- Page column ---------- */

.page {
    position: relative;
    z-index: 1;
    display: flex;
    flex: 1;
    flex-direction: column;
    width: min(var(--page-width), 100% - 2 * var(--gutter));
    margin: -64px auto 0;
    padding-bottom: var(--gutter);
}

.hero--plain + .page {
    margin-top: -24px;
}

/* ---------- Dock: the app picker ---------- */

.dock {
    position: sticky; /* only matters without JS, when panels scroll past it */
    bottom: var(--gutter);
    z-index: 3;
    display: flex;
    flex: none;
    flex-wrap: wrap;
    gap: 6px 28px;
    margin-top: 18px;
    padding: 14px 18px 12px;
    background-color: rgba(12, 26, 66, 0.82); /* denser than other glass */
}

.dock-group {
    flex: none;
}

.dock-group--apps {
    flex: 1 0 auto;
}

/* Group label with a rule running off to the right. */
.dock-label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 10px;
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--ink-dim);
}

.dock-label::after {
    content: "";
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.4);
}

.dock-tiles {
    display: flex;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.tile {
    display: flex;
    width: 92px;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    color: var(--ink);
    font-size: 0.82rem;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
}

.tile-icon {
    display: grid;
    place-items: center;
    width: 66px;
    height: 66px;
    border-radius: var(--radius-tile);
    background: var(--tile-fill);
    box-shadow: var(--tile-raise);
    transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.tile-icon img {
    width: 44px;
    height: 44px;
    object-fit: contain;
}

.tile:hover .tile-icon {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.tile:active .tile-icon {
    box-shadow: var(--tile-press);
    transform: translateY(1px);
}

/* The selected app: pressed in, with a white ring. */
.tile[aria-current="true"] .tile-icon {
    background: rgba(48, 154, 253, 0.28);
    box-shadow: var(--tile-press), 0 0 0 2px #fff;
    transform: none;
}

/* ---------- Stage: one panel per app ---------- */

/* Panels open directly above the dock. */
.stage {
    display: flex;
    flex: 1;
    flex-direction: column;
    justify-content: flex-end;
    min-height: 0;
}

/* .panel is the glass shell; .panel-body inside it holds (and scrolls) the content. */
.panel {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background-color: rgba(12, 26, 66, 0.84); /* dense, so text stays readable over the video */
    transform-origin: 50% 100%;
}

.panel + .panel {
    margin-top: 18px;
}

/* With JS, only the selected panel is shown. Without it they all stack. */
.js .panel {
    display: none;
    margin-top: 0;
}

.js .panel.is-active {
    display: flex;
    animation: panel-rise 260ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Opening: the panel rises out of the dock. Closing: it sinks back.
   Switching apps: the new panel slides in from the side its tile is on.
   js/site.js adds the from-left / from-right / is-closing classes. */
.js .panel.from-right {
    animation-name: panel-from-right;
}

.js .panel.from-left {
    animation-name: panel-from-left;
}

.js .panel.is-closing {
    animation: panel-sink 170ms ease-in forwards;
}

@keyframes panel-rise {
    from {
        opacity: 0;
        transform: translateY(32px) scale(0.95);
    }
}

@keyframes panel-sink {
    to {
        opacity: 0;
        transform: translateY(32px) scale(0.95);
    }
}

@keyframes panel-from-right {
    from {
        opacity: 0;
        transform: translateX(48px);
    }
}

@keyframes panel-from-left {
    from {
        opacity: 0;
        transform: translateX(-48px);
    }
}

.panel-body {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 36px;
    align-items: start;
    min-height: 0;
    padding: 30px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: none; /* scrolls by wheel or touch, no visible bar */
}

.panel-body::-webkit-scrollbar {
    display: none;
}

/* Landscape artwork sits beside the text in equal halves. */
.panel--wide .panel-body {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

/* Close button, added to each panel by js/site.js. */
.panel-close {
    position: absolute;
    z-index: 1;
    top: 14px;
    right: 14px;
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 0;
    border-radius: var(--radius-tile);
    background: var(--tile-fill);
    box-shadow: var(--tile-raise);
    color: var(--ink);
    cursor: pointer;
}

.panel-close:hover {
    background: rgba(255, 255, 255, 0.16);
}

.panel-close:active {
    box-shadow: var(--tile-press);
}

.panel-close svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 2.4;
    stroke-linecap: round;
}

.js .panel h2 {
    padding-right: 50px; /* room for the close button */
}

.panel h2 {
    font-size: clamp(1.7rem, 3.4vw, 2.3rem);
    letter-spacing: -0.015em;
    margin-bottom: 0.6em;
}

.panel-kind {
    color: var(--ink-dim);
}

.panel-ps {
    margin-top: 1.6em;
}

/* Portrait screenshots are sized by height so a panel fits the window without scrolling. */
.shot {
    width: auto;
    height: clamp(220px, 100dvh - 420px, 541px);
    border-radius: 26px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.45);
}

.panel--wide .shot {
    width: 100%;
    height: auto;
    border-radius: 14px;
}

/* Stand-in for an app that has no screenshot yet. */
.shot--empty {
    display: grid;
    place-items: center;
    aspect-ratio: 554 / 1200;
    padding: 12px;
    background: var(--tile-fill);
    box-shadow: var(--tile-press);
    color: var(--ink-dim);
    font-size: 0.95rem;
    text-align: center;
}

.panel-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
    margin-top: 1.6em;
}

.badge img {
    width: 180px;
    height: 60px;
    border-radius: 10px;
}

.button {
    display: inline-block;
    padding: 11px 20px;
    border-radius: var(--radius-tile);
    background: var(--tile-fill);
    box-shadow: var(--tile-raise);
    color: var(--ink);
    font-weight: 600;
    text-decoration: none;
}

.button:hover {
    background: rgba(255, 255, 255, 0.16);
}

.button:active {
    box-shadow: var(--tile-press);
}

/* ---------- Home page: a fixed window that never scrolls ----------
   With JS (and a window tall enough to be usable) the home page is pinned to
   the window: video at the top, dock at the bottom, and an open panel grows
   upward from the dock over the video. A panel too tall for the space scrolls
   inside itself. Without JS the page is an ordinary scrolling document. */

@media (min-height: 520px) {
    .js .home {
        height: 100dvh;
        overflow: hidden;
    }

    .js .home .page {
        position: fixed;
        inset: var(--stage-top) 0 0;
        margin: 0 auto;
    }

    .js .home .panel {
        max-height: 100%;
    }
}

/* ---------- Long-form pages (privacy policies) ---------- */

.prose {
    max-width: 800px;
    padding: 34px clamp(20px, 5vw, 56px) 38px;
}

.prose h1 {
    font-size: clamp(1.9rem, 4vw, 2.6rem);
    letter-spacing: -0.015em;
    margin-bottom: 0.7em;
}

.prose p {
    max-width: 68ch;
}

.back-link {
    display: inline-block;
    margin-bottom: 1.4em;
}

/* ---------- Footer ---------- */

.site-footer {
    flex: none;
    margin-top: 14px;
    color: var(--ink-dim);
    font-size: 0.85rem;
    text-align: center;
}

.site-footer a {
    color: inherit;
}

/* ---------- Small screens ---------- */

@media (max-width: 700px) {
    :root {
        --stage-top: 92px;
    }

    /* Twice the height it would otherwise get; the sides crop off-screen. */
    .hero:not(.hero--plain) {
        height: min(440px, 60dvh);
    }

    .brand img {
        width: 40px;
    }

    .wordmark {
        font-size: 1.35rem;
    }

    .tagline {
        font-size: 0.8rem;
    }

    .page {
        margin-top: -40px;
    }

    /* Two columns side by side: Apps (two rows of tiles) and Studio (one tile
       per row). Always exactly two tile rows; tiles shrink to fit, never scroll. */
    .dock {
        flex-wrap: nowrap;
        gap: 12px;
        margin-top: 12px;
        padding: 8px 10px;
    }

    .dock-group--apps {
        flex: 1 1 0;
        min-width: 0;
    }

    /* Studio is one tile wide: the same width as an app tile. */
    .dock-group--studio {
        flex: 0 0 calc((100% - 12px) / (var(--apps-columns) + 1));
        min-width: 0;
    }

    .dock-label {
        margin-bottom: 6px;
        font-size: 0.72rem;
    }

    .dock-tiles {
        display: grid;
        grid-template-columns: repeat(var(--apps-columns), minmax(0, 1fr));
        gap: 9px 4px;
    }

    .dock-group--studio .dock-tiles {
        grid-template-columns: minmax(0, 1fr);
    }

    /* js/site.js marks the tile that starts the second row (shorter row on top). */
    .dock-tiles .tile-row-start {
        grid-column-start: 1;
    }

    .tile {
        width: auto;
        gap: 4px;
        font-size: 0.66rem;
        line-height: 1.15;
    }

    .tile-icon {
        width: 44px;
        height: 44px;
        border-radius: 10px;
    }

    .tile-icon img {
        width: 30px;
        height: 30px;
    }

    .panel-body,
    .panel--wide .panel-body {
        grid-template-columns: minmax(0, 1fr);
        gap: 16px;
        padding: 18px;
        font-size: 0.9rem;
        line-height: 1.5;
    }

    .panel h2 {
        font-size: 1.4rem;
    }

    /* Portrait screenshots at half size; landscape ones span the panel. */
    .shot {
        width: 110px;
        height: auto;
        margin-inline: auto;
        border-radius: 14px;
    }

    .panel--wide .shot {
        width: 100%;
    }

    /* Keep a full-width image clear of the close button. */
    .js .panel--wide .panel-body {
        padding-top: 58px;
    }

    .shot--empty {
        font-size: 0.75rem;
    }

    .panel-close {
        top: 10px;
        right: 10px;
        width: 38px;
        height: 38px;
    }

    .site-footer {
        margin-top: 10px;
        font-size: 0.75rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .tile-icon {
        transition: none;
    }

    .js .panel.is-active,
    .js .panel.is-closing {
        animation: none;
    }
}
