/*
 * Pixcen Deluxe website - implements the "WEB PAGE" frame of the 2.0 Figma design.
 *
 * Sizing: the design is drawn on a 1920px canvas. --u is one design pixel at that
 * width and shrinks with the viewport, so every value measured in Figma can be used
 * as calc(N * var(--u)). max() floors keep text and touch targets usable on small
 * screens, where the layout also switches to a single column.
 */
:root {
    --u: min(1px, calc(100vw / 1920));

    /* Colours sampled from the design. */
    --c-page: #d9d9d9;          /* top section, release notes, inner pages */
    --c-features: #b1b1b1;
    --c-card: #dddddd;
    --c-edge: rgba(255, 255, 255, 0.2);
    --c-footer: #464646;
    --c-text: #000000;
    --c-muted: #707070;         /* navigation, release metadata */
    --c-subtle: #555555;        /* section sub-headings */
    --c-footer-text: #ffffff;
    --c-footer-legal: #949494;
    --c-accent: #66bc4e;        /* Download button */
    --c-accent-hover: #58a843;
    --c-focus: #029f9d;         /* end colour of the app icon gradient */

    /*
     * Pixel type is Silkscreen (Google Fonts), as in the design: Regular for the
     * navigation, tagline and sub-headings, Bold for headings. Its lowercase letters
     * are small capitals. 1.28 is its natural line height (Figma's "Auto").
     */
    --font-pixel: "Silkscreen", ui-monospace, "Courier New", monospace;
    --font-body: "Helvetica Neue", Helvetica, Arial, sans-serif;

    /* Type scale (design px at 1920 wide, floored for small screens). */
    --fs-nav: max(15px, calc(20 * var(--u)));
    --fs-tagline: max(20px, calc(36.5 * var(--u)));
    --fs-intro: max(16px, calc(20 * var(--u)));
    --fs-h2: max(28px, calc(48 * var(--u)));
    --fs-sub: max(20px, calc(40 * var(--u)));
    --fs-h3: max(16px, calc(24 * var(--u)));
    --fs-text: max(16px, calc(23 * var(--u)));
    --fs-small: max(13px, calc(16 * var(--u)));

    --gutter: 20px;
    --wrap: 82.03%;             /* 1575 / 1920: the features column span */
    --wrap-narrow: 69.69%;      /* 1338 / 1920: release notes and footer */
}

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

html {
    scroll-behavior: smooth;
}

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

body {
    margin: 0;
    min-height: 100vh;
    background: var(--c-page);
    color: var(--c-text);
    font-family: var(--font-body);
    font-size: var(--fs-text);
    line-height: 1.26;
    -webkit-font-smoothing: antialiased;
}

img {
    max-width: 100%;
    height: auto;
}

a {
    color: inherit;
}

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

:focus-visible {
    outline: 3px solid var(--c-focus);
    outline-offset: 3px;
}

.site-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-content {
    flex: 1;
}

.wrap {
    width: var(--wrap);
    max-width: 1575px;
    margin-inline: auto;
}

/* Used together with .wrap; declared later so its width wins. */
.wrap--narrow {
    width: var(--wrap-narrow);
    max-width: 1338px;
}

/* ---------------------------------------------------------------- navigation */

.site-header {
    padding-top: max(20px, calc(57 * var(--u)));
}

.nav-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    column-gap: max(14px, calc(204 * var(--u)));
    row-gap: 8px;
    padding: 0;
    list-style: none;
}

.nav-link {
    display: inline-block;
    padding: 4px 2px;
    color: var(--c-muted);
    font-family: var(--font-pixel);
    font-size: var(--fs-nav);
    line-height: 1.1;
    text-decoration: none;
    transition: color 0.15s ease;
}

.nav-link:hover {
    color: var(--c-text);
}

/* ------------------------------------------------------------------ top/hero */

.top {
    padding-bottom: max(48px, calc(67 * var(--u)));
    text-align: center;
}

.brand {
    margin: max(36px, calc(102 * var(--u))) auto 0;
    width: max(200px, calc(462 * var(--u)));
    line-height: 0;
}

.brand img,
.page-brand img {
    display: block;
    width: 100%;
    height: auto;
}

.tagline {
    margin-top: max(28px, calc(103 * var(--u)));
    font-family: var(--font-pixel);
    font-size: var(--fs-tagline);
    font-weight: 400;
    line-height: 1.28;
}

.intro {
    max-width: 80.76%;          /* 1272 / 1575 */
    margin: max(12px, calc(8 * var(--u))) auto 0;
    font-size: var(--fs-intro);
    line-height: 1.2;
}

.intro p + p {
    margin-top: 0.6em;
}

/* Screenshot collage: offsets are fractions of the 1551x797 box they span in Figma. */
.hero-shots {
    display: grid;
    width: 80.78%;              /* 1551 / 1920 */
    max-width: 1551px;
    margin: max(40px, calc(95 * var(--u))) auto 0;
}

.hero-shot {
    grid-area: 1 / 1;
    display: block;
}

.hero-shot-main {
    width: 81.43%;
    margin-left: 11.09%;
}

.hero-shot-dialog {
    width: 24.82%;
    margin-top: 17.47%;
    filter: drop-shadow(0 calc(10 * var(--u)) calc(24 * var(--u)) rgba(0, 0, 0, 0.18));
}

.hero-shot-strip {
    width: 40.3%;
    margin-top: 42.36%;
    margin-left: 59.7%;
    outline: 1px solid var(--c-edge);
    outline-offset: -1px;
}

/* ------------------------------------------------------------------ download */

.top-download {
    margin-top: max(36px, calc(52 * var(--u)));
    scroll-margin-top: 24px;
}

.download-cta {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: max(12px, calc(16 * var(--u)));
}

.btn-download {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: max(180px, calc(246 * var(--u)));
    min-height: max(48px, calc(58 * var(--u)));
    padding: 0 1.2em;
    border-radius: 999px;
    background: var(--c-accent);
    color: #fff;
    font-family: var(--font-body);
    font-size: max(18px, calc(24 * var(--u)));
    font-weight: 700;
    text-decoration: none;
    transition: background 0.15s ease, transform 0.15s ease;
}

.btn-download:hover {
    background: var(--c-accent-hover);
}

.btn-download:active {
    transform: translateY(1px);
}

/*
 * Platform links: discreet fallbacks under the smart Download button. No frame or
 * fill, muted text, darkening on hover or while a menu is open.
 */
.platform-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px 6px;
    padding: 0;
    margin: 0;
    list-style: none;
    font-size: 15px;
}
.platform-list > li { position: relative; }
.platform-direct, .download-picker summary {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 6px;
    color: var(--c-muted);
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    list-style: none;
    transition: color 0.15s ease, background 0.15s ease;
}
.download-picker summary::-webkit-details-marker { display: none; }
.platform-direct:hover, .download-picker summary:hover,
.download-picker[open] summary { color: var(--c-text); background: rgba(0, 0, 0, 0.06); }

/* Chevron drawn in CSS so it centres on the text instead of sitting on the baseline. */
.chevron {
    width: 0.4em;
    height: 0.4em;
    margin-top: -0.2em;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg);
    transition: transform 0.15s ease, margin 0.15s ease;
}
.download-picker[open] .chevron { transform: rotate(-135deg); margin-top: 0.2em; }
@media (prefers-reduced-motion: reduce) {
    .platform-direct, .download-picker summary, .chevron { transition: none; }
}

.download-picker[open] { position: relative; z-index: 5; }
.download-options {
    position: absolute;
    z-index: 10;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    min-width: 100%;
    width: max-content;
    max-width: min(340px, 76vw);
    margin: 0;
    padding: 6px;
    border: 1px solid #aaa;
    border-radius: 10px;
    background: #fafafa;
    box-shadow: 0 12px 28px #0002;
    list-style: none;
}
.download-options a {
    display: grid;
    gap: 5px;
    padding: 12px;
    border-radius: 5px;
    color: var(--c-text);
    text-decoration: none;
}
.download-options a:hover { background: #e5eedf; }
.download-options strong { font-weight: 600; }
.download-options small { font-size: 13px; color: #555; }
.download-history-link { color: #444; font-size: 15px; text-underline-offset: 4px; }
.release-card .platform-list { justify-content: flex-start; margin: 22px 0; }
.release-card .platform-list { margin-left: -10px; }   /* align link text with the card text */
.release-card .download-options { margin: 0; left: 0; transform: none; }
.release-date { margin-top: 8px; color: #555; font-size: 15px; }
.downloads-heading { margin: 48px 0 24px; font-family: var(--font-pixel); }
:where(a, summary):focus-visible { outline: 3px solid var(--c-focus); outline-offset: 4px; }
/* Small screens: the links stay in one row; the last menu hugs the right edge. */
@media (max-width: 540px) {
    .platform-list > li:last-child .download-options { left: auto; right: 0; transform: none; }
}


/* ------------------------------------------------------------------ features */

.features {
    padding: max(56px, calc(84 * var(--u))) 0 max(64px, calc(226 * var(--u)));
    background: var(--c-features);
}

.section-heading {
    margin-bottom: max(40px, calc(81 * var(--u)));
}

.section-heading h2 {
    font-family: var(--font-pixel);
    font-size: var(--fs-h2);
    font-weight: 700;
    line-height: 1.28;
    text-transform: uppercase;
}

.section-heading p {
    color: var(--c-subtle);
    font-family: var(--font-pixel);
    font-size: var(--fs-sub);
    line-height: 1.28;
}

.features .feature-row {
    display: grid;
    grid-template-columns: 793fr 671fr;
    column-gap: 7.05%;          /* 111 / 1575 */
    align-items: center;
}

.features .feature-row + .feature-row {
    margin-top: max(48px, calc(90 * var(--u)));
}

.feature-media {
    display: flex;
    flex-direction: column;
    gap: calc(13 * var(--u));
}

.feature-shot {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
}

.feature-media figure {
    margin: 0;
}

.feature-media figcaption {
    margin-top: 0.4em;
    color: #333;
    font-size: var(--fs-small);
    line-height: 1.4;
}

/* Pause/Play: a small round icon over the image's bottom-right corner. */
.feature-motion-frame {
    position: relative;
}

.feature-motion-toggle {
    position: absolute;
    right: 10px;
    bottom: 10px;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.15s ease, background 0.15s ease;
}

.feature-motion-frame:hover .feature-motion-toggle,
.feature-motion-toggle:hover,
.feature-motion-toggle:focus-visible {
    opacity: 1;
    background: rgba(0, 0, 0, 0.75);
}

.feature-motion-toggle[hidden] {
    display: none;
}

.feature-motion-toggle:focus-visible {
    outline: 2px solid var(--c-focus);
    outline-offset: 3px;
}

.feature-supporting {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 32px;
    margin-top: max(56px, calc(100 * var(--u)));
    padding-top: 32px;
    border-top: 1px solid #777;
}

.feature-supporting h3 {
    font-size: var(--fs-h3);
    line-height: 1.3;
}

.feature-supporting p {
    margin-top: 0.5em;
    font-size: var(--fs-text);
    line-height: 1.4;
}

@media (max-width: 860px) {
    .feature-supporting {
        grid-template-columns: 1fr;
        gap: 24px;
    }
}

/* Two dialogs overlapping, as placed in Figma (647 and 645 wide in a 793 column). */
.feature-row--overlap .feature-media {
    display: grid;
}

.feature-row--overlap .feature-shot {
    grid-area: 1 / 1;
}

.feature-row--overlap .feature-shot:first-child {
    width: 81.59%;
}

.feature-row--overlap .feature-shot:last-child {
    width: 81.34%;
    margin-top: 31.15%;
    margin-left: 18.41%;
}

.feature-item + .feature-item {
    margin-top: max(28px, calc(98 * var(--u)));
}

.feature-item h3 {
    font-family: var(--font-pixel);
    font-size: var(--fs-h3);
    font-weight: 700;
    line-height: 1.3;
    text-transform: uppercase;
}

.feature-item p {
    margin-top: 0.15em;
    font-size: var(--fs-text);
    line-height: 1.26;
}

/* ------------------------------------------------------------- release notes */

.release-notes {
    padding: max(56px, calc(81 * var(--u))) 0 max(64px, calc(148 * var(--u)));
}

.release-notes .section-heading {
    margin-bottom: max(32px, calc(65 * var(--u)));
}

/* Here the sub-heading is body text in the design, not pixel type. */
.release-notes .section-heading p {
    margin-top: calc(11 * var(--u));
    color: var(--c-text);
    font-family: var(--font-body);
    font-size: max(16px, calc(24 * var(--u)));
    line-height: 1.2;
}

.release-list {
    display: grid;
    gap: max(20px, calc(35 * var(--u)));
}

.release-card {
    padding: max(20px, calc(35 * var(--u))) max(20px, calc(38 * var(--u)));
    border: 1px solid var(--c-edge);
    border-radius: max(8px, calc(10 * var(--u)));
    background: var(--c-card);
    box-shadow: 0 calc(4 * var(--u)) calc(16 * var(--u)) rgba(0, 0, 0, 0.06);
    font-size: max(15px, calc(22 * var(--u)));
    line-height: 1.32;
}

.release-card-title {
    font-family: var(--font-body);
    font-size: inherit;
    font-weight: 700;
}

.release-card-meta {
    margin-left: 0.35em;
    color: var(--c-muted);
    font-weight: 400;
}

.release-card-meta a {
    color: inherit;
    text-decoration: none;
}

.release-card-meta a:hover {
    color: var(--c-text);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.release-card ul {
    margin-top: 0.5em;
    padding-left: max(24px, calc(39 * var(--u)));
}

.release-card li::marker {
    color: var(--c-text);
}

.release-empty {
    color: var(--c-muted);
}

.release-more {
    margin-top: max(20px, calc(35 * var(--u)));
    text-align: center;
}

.release-more[hidden] {
    display: none;
}

.release-more a,
.text-link {
    color: var(--c-text);
    font-family: var(--font-pixel);
    font-size: var(--fs-nav);
    text-underline-offset: 3px;
}

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

.site-footer {
    padding: max(40px, calc(102 * var(--u))) 0 max(24px, calc(40 * var(--u)));
    background: var(--c-footer);
    color: var(--c-footer-text);
    font-size: max(15px, calc(22 * var(--u)));
    line-height: 1.32;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.footer-heading {
    font-family: var(--font-body);
    font-size: inherit;
    font-weight: 700;
}

.footer-col p {
    max-width: 16em;
}

.footer-links {
    padding: 0;
    list-style: none;
}

.footer-links a {
    color: var(--c-footer-text);
    text-decoration: none;
}

.footer-links a:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.footer-legal {
    margin-top: max(36px, calc(88 * var(--u)));
    color: var(--c-footer-legal);
    font-size: var(--fs-small);
}

/* --------------------------------------------------------------- inner pages */

.page {
    padding: max(40px, calc(90 * var(--u))) 0 max(64px, calc(148 * var(--u)));
}

.page-header {
    margin-bottom: max(32px, calc(64 * var(--u)));
    text-align: center;
}

.page-brand {
    display: block;
    width: max(120px, calc(200 * var(--u)));
    margin: 0 auto max(24px, calc(48 * var(--u)));
}

.page-title {
    font-family: var(--font-pixel);
    font-size: var(--fs-h2);
    font-weight: 700;
    line-height: 1.1;
    text-transform: uppercase;
}

.page-subtitle {
    margin-top: 0.4em;
    color: var(--c-subtle);
    font-family: var(--font-pixel);
    font-size: max(17px, calc(26 * var(--u)));
}

.page .download-cta {
    margin-bottom: max(32px, calc(64 * var(--u)));
}

.package-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: max(16px, calc(24 * var(--u)));
    margin-bottom: max(32px, calc(64 * var(--u)));
    padding: 0;
    list-style: none;
}

.package-list:empty {
    display: none;
}

.package-card {
    display: grid;
    gap: 4px;
    padding: max(18px, calc(28 * var(--u)));
    border: 1px solid var(--c-edge);
    border-radius: max(8px, calc(10 * var(--u)));
    background: var(--c-card);
}

.package-platform {
    font-family: var(--font-pixel);
    font-size: var(--fs-h3);
    font-weight: 700;
    text-transform: uppercase;
}

.package-meta {
    color: var(--c-muted);
}

.package-link {
    overflow-wrap: anywhere;
}

.release-card--current {
    margin-bottom: max(32px, calc(64 * var(--u)));
}

.release-card--current .release-more {
    text-align: left;
}

.page-back {
    margin-top: max(32px, calc(64 * var(--u)));
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: max(16px, calc(24 * var(--u)));
}

.card {
    display: block;
    padding: max(20px, calc(32 * var(--u)));
    border: 1px solid var(--c-edge);
    border-radius: max(8px, calc(10 * var(--u)));
    background: var(--c-card);
    color: var(--c-text);
    text-decoration: none;
}

.card--link:hover {
    background: #e6e6e6;
}

.card-meta {
    color: var(--c-muted);
    font-size: var(--fs-small);
}

.card-title {
    margin: 0.2em 0 0.4em;
    font-family: var(--font-pixel);
    font-size: var(--fs-h3);
    font-weight: 700;
    line-height: 1.3;
    text-transform: uppercase;
}

.card-title a {
    text-decoration: none;
}

.card .text-link {
    display: inline-block;
    margin-top: 0.8em;
}

.term-list {
    padding-left: 1.2em;
}

/* Markdown bodies (download notes, FAQ, blog posts, the legacy features page). */
.content-markdown {
    max-width: 52em;
    margin-inline: auto;
    font-size: max(16px, calc(21 * var(--u)));
    line-height: 1.45;
}

.content-markdown--centered {
    text-align: center;
}

.content-markdown--wide {
    max-width: none;
}

.content-markdown h1,
.content-markdown h2,
.content-markdown h3 {
    margin: 1.4em 0 0.5em;
    font-family: var(--font-pixel);
    font-weight: 700;
    line-height: 1.2;
    text-transform: uppercase;
}

.content-markdown h1 {
    font-size: 1.6em;
}

.content-markdown h2 {
    font-size: 1.25em;
}

.content-markdown h3 {
    font-size: 1.05em;
}

.content-markdown > :first-child,
.content-markdown > div:first-child > :first-child {
    margin-top: 0;
}

.content-markdown p,
.content-markdown ul,
.content-markdown ol {
    margin: 0 0 1em;
}

.content-markdown ul,
.content-markdown ol {
    padding-left: 1.4em;
}

.content-markdown a {
    text-underline-offset: 3px;
}

.content-markdown code,
.content-markdown pre {
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
    font-size: 0.9em;
}

.content-markdown code {
    padding: 0.1em 0.3em;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.07);
}

.content-markdown pre {
    overflow: auto;
    padding: 1em;
    border-radius: 8px;
    background: var(--c-footer);
    color: var(--c-footer-text);
}

.content-markdown pre code {
    padding: 0;
    background: none;
}

.content-markdown img {
    display: block;
}

/* Legacy /features/ page markup. */
.content-markdown .feature-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.8fr);
    gap: max(20px, calc(48 * var(--u)));
    align-items: center;
    margin: max(28px, calc(56 * var(--u))) 0;
}

.content-markdown .feature-text h2 {
    margin-top: 0;
}

.content-markdown details {
    margin-bottom: 12px;
    padding: 14px 18px;
    border: 1px solid var(--c-edge);
    border-radius: 8px;
    background: var(--c-card);
}

.content-markdown summary {
    cursor: pointer;
    font-weight: 700;
}

.content-markdown details[open] summary {
    margin-bottom: 0.6em;
}

/* ---------------------------------------------------------------- responsive */

@media (max-width: 860px) {
    :root {
        --wrap: calc(100% - 2 * var(--gutter));
        --wrap-narrow: calc(100% - 2 * var(--gutter));
    }

    .intro {
        max-width: 40em;
    }

    .hero-shots {
        width: calc(100% - 2 * var(--gutter));
    }

    .features .feature-row {
        grid-template-columns: 1fr;
        row-gap: 24px;
    }

    .footer-grid {
        grid-template-columns: 1fr 1fr;
        row-gap: 28px;
    }

    .content-markdown .feature-row {
        grid-template-columns: 1fr;
    }
}

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

    /* Keep mobile navigation compact, with an odd final link centered. */
    .nav-list {
        display: grid;
        grid-template-columns: repeat(2, auto);
        column-gap: 32px;
        justify-items: center;
    }

    .nav-list li:last-child:nth-child(odd) {
        grid-column: 1 / -1;
    }
}
