/* Theme-independent layout for alveary.af.codes.
   Layered on top of a trimmed Spectre.css build, where 1rem = 20px.
   Color tokens live in index-light.css / index-dark.css. */

:root {
    --font-mono: ui-monospace, "SF Mono", SFMono-Regular, "Segoe UI Mono", "Roboto Mono", Menlo, Consolas, monospace;

    /* Scroll-to-top button geometry. The footer derives its bottom padding from
       these, so the button and the footer text can never collide. */
    --fab-size: 2rem;
    --fab-inset: 1.5rem;
}

body {
    background: var(--bg);
    color: var(--fg);
}

/* Spectre styles every anchor purple. Scope it back out; links here are
   either hero buttons or footer text. */
a,
a:visited {
    color: inherit;
}

/* Sections --------------------------------------------------------------- */

.section-hero {
    /* .top-brand and .top-actions are absolute; without this they would anchor
       to the initial containing block instead of the hero. */
    position: relative;
    padding: 4.4rem .5rem 2.2rem;
}

.section-feature {
    padding: 2.6rem .5rem;
}

/* Top brand -------------------------------------------------------------- */

/* Mirrors .top-actions on the opposite corner; both rely on the hero being
   the positioned ancestor. */
.top-brand {
    position: absolute;
    top: .85rem;
    left: 1.5rem;
    height: 2rem;
    display: flex;
    align-items: center;
}

.top-brand .brand-logo {
    display: inline-flex;
    padding: .2rem;
}

/* Same substitution as the footer links: drop Spectre's purple focus ring for
   the accent outline. */
.top-brand .brand-logo:focus {
    box-shadow: none;
}

.top-brand .brand-logo:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.top-brand .brand-logo img {
    display: block;
    width: 1.6rem;
    height: auto;
    border-radius: 50%;
}

/* Top actions ------------------------------------------------------------ */

.top-actions {
    position: absolute;
    top: .85rem;
    right: 1.5rem;
    height: 2rem;
    display: flex;
    align-items: center;
    gap: .4rem;
}

.top-btn {
    align-items: center;
    background: none;
    border: none;
    border-radius: .1rem;
    cursor: pointer;
    display: inline-flex;
    height: 2rem;
    justify-content: center;
    padding: .2rem;
    width: 2rem;
    color: inherit;
    opacity: .7;
    transition: opacity .2s ease, color .2s ease;
}

@media (hover: hover) and (pointer: fine) {
    .top-btn:hover {
        opacity: 1;
    }
}

.top-btn:focus-visible {
    opacity: 1;
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
    display: none;
}

/* App icon --------------------------------------------------------------- */

/* Composites AppIcon.icon for the web: the gradient plate comes from the
   theme sheets, the bee is the layer artwork. Corner radius approximates the
   macOS squircle. */
.app-icon {
    width: 7.5rem;
    aspect-ratio: 1;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
    border-radius: 22.37%;
}

.app-icon .bee {
    position: absolute;
    inset: 0;
    margin: auto;
    width: 90%;
    /* icon.json: scale 0.9, y translation -14.25pt of 1024 = -1.39% of the
       icon, which is -1.55% of the bee's own box. Cancels the ~1.24% low bias
       baked into the artwork, landing it optically centered. */
    transform: translateY(-1.55%);
}

/* Typography ------------------------------------------------------------- */

h1,
.section-feature h2 {
    font-family: var(--font-mono);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .06em;
}

h1 {
    font-size: 1.8rem;
    margin: 1rem 0 0;
}

.section-feature h2 {
    font-size: 1.3rem;
    margin-bottom: .6rem;
}

.tagline {
    max-width: 30rem;
    margin: .75rem auto 0;
    font-size: .9rem;
    line-height: 1.5rem;
    color: var(--secondary);
}

.feature-copy {
    margin: 0 auto 1.8rem;
    font-size: .85rem;
    line-height: 1.4rem;
    color: var(--secondary);
}

.section-accent {
    width: 2.2rem;
    height: 4px;
    margin: 0 auto 1.1rem;
    border-radius: 2px;
    background: var(--accent);
}

/* Buttons ---------------------------------------------------------------- */

.cta-row {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: .6rem;
    margin-top: 1.6rem;
}

.btn-hero {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    height: 2.4rem;
    padding: 0 1.3rem;
    border-radius: .5rem;
    font-size: .85rem;
    font-weight: 700;
    white-space: nowrap;
    transition: transform .3s cubic-bezier(0.34, 1.56, 0.64, 1), filter .2s ease;
}

.btn-hero,
.btn-hero:hover,
.btn-hero:focus,
.btn-hero:active,
.btn-hero:visited {
    text-decoration: none;
}

.btn-download,
.btn-download:hover,
.btn-download:focus,
.btn-download:visited {
    background: var(--accent);
    color: var(--on-accent);
    box-shadow: 0 2px 6px var(--cta-shadow);
}

.btn-ghost,
.btn-ghost:hover,
.btn-ghost:focus,
.btn-ghost:visited {
    color: var(--fg);
    border: 1px solid var(--hairline-strong);
    font-weight: 600;
    box-shadow: none;
}

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

/* Two-line button label. Both lines together are shorter than the button's
   2.4rem height, so the GitHub button stays level with the download one. */
.btn-stack {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.15;
}

.btn-subtext {
    font-size: .55rem;
    font-weight: 500;
    color: var(--secondary);
}

/* scripts/platform-gate.js flags non-Mac visitors on <html>; the download is
   macOS-only, so the button becomes a faded, inert label there. */
.download-label-unavailable {
    display: none;
}

.not-macos .download-label {
    display: none;
}

.not-macos .download-label-unavailable {
    display: inline;
}

.not-macos .btn-download {
    opacity: .45;
    box-shadow: none;
    cursor: default;
    pointer-events: none;
}

@media (hover: hover) and (pointer: fine) {
    .btn-hero:hover {
        transform: scale(1.03);
    }

    .btn-download:hover {
        filter: brightness(1.05);
    }
}

/* Screenshots ------------------------------------------------------------ */

/* Each shot is wrapped in a <picture> so it can carry a dark variant. Left
   inline it would put the block-level image in an inline box, adding a
   line-height gap under it. */
picture {
    display: block;
}

/* The shots are cropped to the window, whose own rounded corners are
   transparent — so no border or radius here; drop-shadow follows the alpha and
   rounds the shadow to match. */
.screenshot {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1953 / 1299;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .2)) drop-shadow(0 4px 8px rgba(0, 0, 0, .15));
}

.screenshot-hero {
    margin-top: 2.6rem;
}

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

.site-footer {
    /* The scroll-to-top button is fixed over the bottom-right corner, and at
       narrow widths this line is wide enough to run under it once the page is
       scrolled to the end. Reserve the button's band plus a gap. */
    padding: 2.4rem .5rem calc(var(--fab-inset) + var(--fab-size) + .5rem);
    text-align: center;
    font-size: .7rem;
    color: var(--secondary);
}

.site-footer p {
    margin: 0;
}

.site-footer a,
.site-footer a:visited {
    color: inherit;
    text-decoration: none;
}

/* Spectre suppresses the UA outline on anchors and substitutes a purple
   box-shadow focus ring; replace both with the accent outline. */
.site-footer a:focus {
    box-shadow: none;
}

.site-footer a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

@media (hover: hover) and (pointer: fine) {
    .site-footer a:hover {
        color: var(--fg);
        text-decoration: underline;
    }
}

/* Scroll-to-top ---------------------------------------------------------- */

/* Do NOT rename this to a generic "back to top" name (jump-to-top, back-to-top,
   scroll-to-top): ad-block cosmetic filters hide those id/class names, which
   makes the button vanish in browsers with a content blocker. */
.overview-return {
    position: fixed;
    right: var(--fab-inset);
    bottom: var(--fab-inset);
    width: var(--fab-size);
    height: var(--fab-size);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--fab-border);
    border-radius: 50%;
    cursor: pointer;
    color: var(--fab-fg);
    background: var(--fab-bg);
    -webkit-backdrop-filter: blur(12px) saturate(160%);
    backdrop-filter: blur(12px) saturate(160%);
    box-shadow: 0 4px 16px var(--fab-shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(0.5rem);
    transition: opacity .25s ease, transform .3s cubic-bezier(0.34, 1.56, 0.64, 1), visibility .25s ease;
    z-index: 300;
}

.overview-return.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

@media (hover: hover) and (pointer: fine) {
    .overview-return.visible:hover {
        transform: translateY(0) scale(1.05);
    }
}

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

@media (max-width: 600px) {
    .section-hero {
        padding: 3.6rem .5rem 1.4rem;
    }

    .section-feature {
        padding: 1.6rem .5rem;
    }

    /* Bottom padding stays at the base value; it clears the scroll-to-top
       button, which doesn't shrink here. */
    .site-footer {
        padding-top: 1.6rem;
    }

    .app-icon {
        width: 5.5rem;
    }

    h1 {
        font-size: 1.4rem;
    }

    .section-feature h2 {
        font-size: 1.1rem;
    }

    .screenshot-hero {
        margin-top: 2rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
    }

    .btn-hero:hover,
    .overview-return.visible:hover {
        transform: none;
    }
}
