/*
 * Product page styles, shared by the app sites (Refreshify, PermaDel, PerfWindow, Pwrschdlr).
 *
 * Each site is one brochure in the Unigrid-style series of the portfolio at
 * lukastojiljkovic.github.io/CV: a black title band, white paper, a 12-column grid and one
 * colour per publication, here the app's icon colour, which each page sets in --app and
 * --app-dark. Headings hang from 6px rules, rows are separated by one-pixel rules, and the
 * app is shown on a plate: its screenshot on a field of that colour.
 *
 * Shape: buttons have a 2px radius; everything else is square.
 */

@font-face {
    font-family: "Archivo";
    src: url("fonts/archivo-latin.woff2") format("woff2");
    font-weight: 100 900;
    font-stretch: 62% 125%;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Archivo";
    src: url("fonts/archivo-latin-ext.woff2") format("woff2");
    font-weight: 100 900;
    font-stretch: 62% 125%;
    font-display: swap;
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+2C60-2C7F, U+A720-A7FF;
}

:root {
    --band: #000;
    --on-band: #fff;
    --on-band-2: #c4c8c0;
    --on-band-hair: rgb(255 255 255 / 0.24);

    --paper: #fff;
    --ink: #0d0e0c;
    --ink-2: #4a4f47;
    --hair: #d5d9d1;

    --accent: var(--app);
    --on-accent: #fff;

    --margin: clamp(20px, 3.4vw, 48px);
    --gutter: 24px;
    color-scheme: light;
}

[data-theme="dark"] {
    --on-band-2: #a9aea4;
    --paper: #141613;
    --ink: #eef0ea;
    --ink-2: #a9aea4;
    --hair: #30352e;

    --accent: var(--app-dark);
    --on-accent: #000;
    color-scheme: dark;
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: 16px;
    scrollbar-color: var(--ink-2) var(--paper);
    -webkit-text-size-adjust: 100%;
}

body {
    background: var(--paper);
    color: var(--ink);
    font: 400 1.0625rem/1.55 "Archivo", system-ui, sans-serif;
    font-stretch: 100%;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

img { display: block; max-width: 100%; height: auto; }
ol, ul { padding: 0; list-style: none; }
code { font: 400 0.875em/1 ui-monospace, "Cascadia Mono", Consolas, monospace; white-space: nowrap; }

/* Text links are underlined in a hairline that darkens on hover. */
a {
    color: inherit;
    text-decoration-color: var(--hair);
    text-decoration-thickness: 1px;
    text-underline-offset: 4px;
}
.band a { text-decoration-color: var(--on-band-hair); }
a:hover,
.band a:hover { text-decoration-color: currentColor; }

::selection { background: var(--accent); color: var(--on-accent); }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.band :focus-visible { outline-color: var(--on-band); }

.skip {
    position: absolute;
    left: 12px;
    top: -60px;
    z-index: 10;
    background: var(--on-band);
    color: #000;
    padding: 10px 14px;
    font-weight: 650;
}
.skip:focus { top: 12px; }

.wrap { width: min(100% - 2 * var(--margin), 1344px); margin-inline: auto; }

.grid,
.band-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: var(--gutter);
}

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

.btn {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 18px;
    border: 1px solid transparent;
    border-radius: 2px;
    font-size: 0.9375rem;
    font-weight: 650;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 0.15s, border-color 0.15s;
}
.btn:active { transform: translateY(1px); }

.btn-app { background: var(--accent); color: var(--on-accent); }
.btn-app:hover { background: color-mix(in oklab, var(--accent) 86%, var(--ink)); }
.btn-line { color: var(--on-band); border-color: rgb(255 255 255 / 0.45); }
.btn-line:hover { border-color: var(--on-band); }

/* ---------- The title band ---------- */

.band { background: var(--band); color: var(--on-band); }
[data-theme="dark"] .band { box-shadow: inset 0 -1px var(--hair); }
[data-theme="dark"] .band-close { box-shadow: inset 0 1px var(--hair); }
.band-grid { padding-block: 20px 26px; }

.topline {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 24px;
    font-size: 0.9375rem;
    font-weight: 500;
}
.mark { display: flex; align-items: center; gap: 10px; margin-right: auto; font-weight: 700; text-decoration: none; }
.mark img { width: 24px; height: 24px; }

.nav { display: flex; gap: 24px; }
.nav a { text-decoration: none; color: var(--on-band-2); }
.nav a:hover { color: var(--on-band); text-decoration: underline; }

.topline-actions { display: flex; align-items: center; gap: 20px; }
#theme {
    min-height: 32px;
    padding: 0 12px;
    background: none;
    color: inherit;
    font: inherit;
    border: 1px solid rgb(255 255 255 / 0.45);
    border-radius: 2px;
    cursor: pointer;
}
#theme:hover { border-color: var(--on-band); }
.theme-dark,
[data-theme="dark"] .theme-light { display: none; }
[data-theme="dark"] .theme-dark { display: inline; }

.title { grid-column: 1 / 9; align-self: end; margin-top: clamp(28px, 4vh, 44px); }
h1,
.close-title {
    font-size: clamp(2.75rem, 5.4vw, 4.75rem);
    line-height: 0.95;
    font-weight: 720;
    font-stretch: 104%;
    letter-spacing: -0.035em;
    text-wrap: balance;
}
.sub {
    margin-top: 18px;
    max-width: 58ch;
    font-size: clamp(1.0625rem, 1.4vw, 1.25rem);
    line-height: 1.4;
    color: var(--on-band-2);
}

/* The download block stands where the portfolio keeps its Open to roles block. */
.get-it {
    grid-column: 9 / 13;
    align-self: end;
    border-top: 1px solid var(--on-band);
    padding-top: 14px;
}
.free { font-size: clamp(1.5rem, 2.1vw, 1.875rem); line-height: 1.12; font-weight: 650; letter-spacing: -0.02em; }
.where { margin-top: 8px; font-size: 0.9375rem; color: var(--on-band-2); }
.band-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }

/* ---------- The lead: the app on its plate, and what it does at a glance ---------- */

.lead { margin-top: 24px; }

.plate {
    --pad: clamp(12px, 2.2vw, 28px);
    position: relative;
    aspect-ratio: 3 / 2;
    background: color-mix(in oklab, var(--app) 16%, var(--paper));
}
[data-theme="dark"] .plate { background: color-mix(in oklab, var(--app-dark) 14%, var(--paper)); }
.plate img {
    position: absolute;
    inset: 0;
    margin: auto;
    width: auto;
    max-width: calc(100% - 2 * var(--pad));
    max-height: calc(100% - 2 * var(--pad));
    outline: 1px solid color-mix(in oklab, var(--ink) 18%, transparent);
}
.shot-dark,
[data-theme="dark"] .shot-light { display: none; }
[data-theme="dark"] .shot-dark { display: block; }

.plate-hero { --pad: clamp(16px, 3vw, 40px); grid-column: 1 / 9; aspect-ratio: 16 / 9; }

.readout { grid-column: 9 / 13; align-self: start; border-top: 6px solid var(--accent); }
.readout .row { padding: 12px 0 14px; border-bottom: 1px solid var(--hair); }
.readout dt { font-size: 0.875rem; color: var(--ink-2); }
.readout dd { margin-top: 2px; font-weight: 650; line-height: 1.4; }
.readout b { font-weight: inherit; color: var(--accent); }

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

.section { margin-top: clamp(80px, 9vw, 128px); }
.section > * { grid-column: 1 / -1; }

.section-title {
    border-top: 6px solid var(--ink);
    padding-top: 14px;
    margin-bottom: 40px;
    font-size: clamp(2rem, 3.4vw, 2.75rem);
    line-height: 1;
    font-weight: 720;
    letter-spacing: -0.03em;
}
.section-lede { grid-column: 1 / 8; margin: -24px 0 40px; color: var(--ink-2); }

h3 { font-size: 1.25rem; line-height: 1.25; font-weight: 700; letter-spacing: -0.01em; }

/* Features: columns that hang from an ink rule. */
.cells { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 40px var(--gutter); }
.cell { border-top: 1px solid var(--ink); padding-top: 14px; }
.cell p { margin-top: 8px; color: var(--ink-2); }

.screens { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 48px var(--gutter); margin-top: 72px; }
figcaption { margin-top: 14px; font-size: 0.9375rem; color: var(--ink-2); }
/* One screenshot across the page, on a plate shaped like it. */
.figure-wide { margin-top: 72px; }
.figure-wide .plate { aspect-ratio: 16 / 9; }

/* How it works: rows on the page grid; numbered only where the order matters. */
.steps { border-top: 1px solid var(--ink); counter-reset: step; }
.steps li { padding: 20px 0 24px; border-bottom: 1px solid var(--hair); counter-increment: step; }
.steps li > div { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 8px var(--gutter); }
.steps h3 { grid-column: 1 / 5; }
.steps p { grid-column: 5 / 13; max-width: 68ch; color: var(--ink-2); }
.steps-seq h3::before {
    content: counter(step);
    display: inline-block;
    min-width: 1.5em;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}

/* Testing and limits: two columns of rows. */
.split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 40px var(--gutter); }
.split h3 { padding-bottom: 12px; border-bottom: 1px solid var(--ink); }
.split li { padding: 14px 0; border-bottom: 1px solid var(--hair); color: var(--ink-2); }
.split li b { font-weight: 650; color: var(--ink); }

.faq { grid-column: 1 / 9; border-top: 1px solid var(--ink); }
.faq details { border-bottom: 1px solid var(--hair); }
.faq summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    padding: 16px 0;
    font-size: 1.125rem;
    font-weight: 650;
    cursor: pointer;
    list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
    content: "";
    flex: none;
    width: 12px;
    height: 12px;
    background:
        linear-gradient(currentColor, currentColor) center / 12px 2px no-repeat,
        linear-gradient(currentColor, currentColor) center / 2px 12px no-repeat;
}
.faq details[open] summary::after { background-size: 12px 2px, 0 0; color: var(--accent); }
.faq details p { max-width: 68ch; padding-bottom: 20px; color: var(--ink-2); }

/* ---------- The closing band: the download, then the small print ---------- */

.band-close { margin-top: clamp(96px, 12vw, 160px); }
.band-close .band-grid { padding-block: clamp(56px, 8vw, 96px) 28px; }
.get-copy { grid-column: 1 / 8; }
.get-facts { grid-column: 9 / 13; align-self: end; font-size: 0.9375rem; }
.get-facts div {
    display: grid;
    grid-template-columns: 7.5em minmax(0, 1fr);
    gap: 16px;
    padding: 10px 0;
    border-top: 1px solid var(--on-band-hair);
}
.get-facts div:first-child { border-top-color: var(--on-band); }
.get-facts dt { color: var(--on-band-2); }
.get-facts dd { font-weight: 500; }

.foot {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px 24px;
    margin-top: 72px;
    padding-top: 18px;
    border-top: 1px solid var(--on-band-hair);
    font-size: 0.875rem;
    color: var(--on-band-2);
}
.foot nav { display: flex; flex-wrap: wrap; gap: 8px 24px; }
.foot p { flex-basis: 100%; font-size: 0.8125rem; }

/* ---------- Responsive: modules change in whole units ---------- */

@media (max-width: 1100px) {
    .title { grid-column: 1 / 8; }
    .get-it { grid-column: 8 / 13; }
    .plate-hero,
    .readout { grid-column: 1 / -1; }
    .readout { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); column-gap: var(--gutter); margin-top: 24px; }
}

@media (max-width: 900px) {
    :root { --gutter: 16px; }
    .grid,
    .band-grid { grid-template-columns: minmax(0, 1fr); }
    .grid > *,
    .band-grid > * { grid-column: 1 / -1; }
    .nav { display: none; }
    .get-it { margin-top: 36px; }
    .get-facts { margin-top: 40px; }
    .plate-hero { aspect-ratio: 3 / 2; }
    .cells { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .screens,
    .split,
    .steps li > div { grid-template-columns: minmax(0, 1fr); }
    .steps h3,
    .steps p { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
    .topline-actions a { display: none; }
    .cells { grid-template-columns: minmax(0, 1fr); }
    .readout { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .get-facts div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
}

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