/* PC Diag download page (meldev.se/pcdiag). */
/* Same look as meldev.se/melcad: cyan glass on near-black, Fraunces / Geist / Geist Mono; violet from the PC Diag app. */
:root {
    --bg-0: #050608;
    --bg-1: #0a0c11;
    --bg-card: rgba(15, 20, 38, 0.55);
    --line: rgba(74, 216, 255, 0.10);
    --line-strong: rgba(74, 216, 255, 0.28);
    --text: #e8edf2;
    --text-soft: #c2c9d3;
    --text-dim: #8b95a3;
    --cyan: #4ad8ff;
    --cyan-soft: #7ee5ff;
    --cyan-bright: #b9efff;
    --violet: #7c5cff;              /* PC Diag accent */
    --ink: #04162a;
    --ok: #5fe3a1;
    --warn: #ffc66b;

    --sans: "Geist", "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
    --mono: "Geist Mono", "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    --display: "Fraunces", "Geist", Georgia, serif;

    --max-w: 1120px;
    --pad: clamp(1rem, 4vw, 2rem);
    --radius: 14px;
    color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
    margin: 0;
    background: var(--bg-0);
    color: var(--text);
    font-family: var(--sans);
    font-size: 17px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    padding-top: calc(64px + env(safe-area-inset-top, 0px));
    min-height: 100vh;
    display: flex; flex-direction: column;
    overflow-x: hidden;
    overflow-wrap: break-word;
}
img { max-width: 100%; display: block; }
a { color: var(--cyan); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
a:hover { color: var(--cyan-soft); text-decoration-color: currentColor; }
::selection { background: var(--cyan); color: var(--ink); }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; border-radius: 4px; }
code { font-family: var(--mono); font-size: 0.86em; color: var(--cyan-bright); white-space: nowrap; }

.grain {
    position: fixed; inset: 0; pointer-events: none; z-index: 200;
    opacity: 0.04; mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.92' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.6 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
    background-size: 180px 180px;
}

/* ---------- nav ---------- */
.nav {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    height: calc(64px + env(safe-area-inset-top, 0px));
    padding: env(safe-area-inset-top, 0px) var(--pad) 0;
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    background: linear-gradient(180deg, rgba(10,12,17,0.95), rgba(10,12,17,0.85));
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    border-bottom: 1px solid var(--line);
}
.nav-logo { display: flex; align-items: center; flex-shrink: 0; }
.nav-logo img {
    height: 26px; width: auto;
    filter: invert(1) brightness(1.05) drop-shadow(0 0 8px rgba(74,216,255,0.4));
}
.nav-links { display: flex; align-items: center; gap: clamp(0.9rem, 4vw, 1.6rem); }
.nav-links a {
    font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.12em; text-transform: uppercase;
    color: var(--text-dim); text-decoration: none; padding: 0.6rem 0;
    border-bottom: 1px solid transparent; white-space: nowrap;
}
.nav-links a:hover { color: var(--cyan-bright); border-bottom-color: var(--cyan); }

/* ---------- hero: the Higgsfield banner (two laptops, encrypted link) on the right ---------- */
.hero {
    position: relative; isolation: isolate;
    min-height: clamp(560px, 80vh, 800px);
    display: flex; align-items: center;
    padding: clamp(3rem, 8vh, 5rem) var(--pad) clamp(6rem, 12vh, 8rem);
    overflow: hidden;
}
/* the art only fills the right part, fading in from the left, so the text keeps a calm dark side */
.hero-bg {
    position: absolute; inset: 0 0 0 34%; z-index: -1;
    background: url("/pcdiag/hero.jpg?v=1.0.1") 88% 100% / cover no-repeat;
    -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 30%);
    mask-image: linear-gradient(90deg, transparent 0%, #000 30%);
    animation: drift 28s ease-in-out infinite alternate;
    transform-origin: 70% 80%;
}
/* keep the text side dark, fade into the page at the bottom, soft grid on top */
.hero::before {
    content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
    background:
        linear-gradient(90deg, rgba(5,6,8,0.96) 0%, rgba(5,6,8,0.84) 30%, rgba(5,6,8,0.2) 58%, rgba(5,6,8,0) 100%),
        linear-gradient(180deg, rgba(5,6,8,0.55) 0%, rgba(5,6,8,0) 22%, rgba(5,6,8,0) 78%, var(--bg-0) 100%);
}
.hero::after {
    content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
    background-image:
        linear-gradient(rgba(74,216,255,0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(74,216,255,0.045) 1px, transparent 1px);
    background-size: 56px 56px;
    mask-image: radial-gradient(ellipse at 18% 45%, #000 10%, transparent 60%);
    -webkit-mask-image: radial-gradient(ellipse at 18% 45%, #000 10%, transparent 60%);
}
@keyframes drift {
    from { transform: scale(1.02) translate3d(0, 0, 0); }
    to   { transform: scale(1.07) translate3d(-1%, -0.6%, 0); }
}
.hero-inner { width: 100%; max-width: var(--max-w); margin: 0 auto; }
.hero-inner > * { max-width: 560px; }

.brand { display: flex; align-items: center; gap: 0.9rem; }
.app-icon {
    width: 64px; height: 64px; flex-shrink: 0;
    border-radius: 22.37%;
    box-shadow:
        0 0 0 1px rgba(255,255,255,0.1),
        0 12px 28px rgba(0,0,0,0.5),
        0 0 32px rgba(124,92,255,0.4);
}
.brand-name { font-weight: 700; font-size: 1.35rem; letter-spacing: -0.01em; line-height: 1.1; }
.brand-ver { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--cyan-bright); margin-top: 0.25rem; }

h1 {
    font-family: var(--display); font-weight: 500;
    font-size: clamp(2.8rem, 8vw, 5rem); line-height: 1.02; letter-spacing: -0.02em;
    margin: clamp(1.4rem, 4vh, 2rem) 0 0;
}
h1 em, h2 em {
    font-style: italic; color: var(--cyan);
    text-shadow: 0 0 28px rgba(74,216,255,0.35);
}
.lede { color: var(--text-soft); font-size: 1.1rem; margin: 1.3rem 0 0; }

.hero-cta { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-top: 2rem; }
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.6rem;
    padding: 0.95rem 1.6rem;
    border-radius: 10px;
    font-weight: 700; font-size: 0.95rem; letter-spacing: 0.02em;
    text-decoration: none; cursor: pointer;
    border: 1px solid transparent;
    transition: transform .12s, box-shadow .2s, background .2s, border-color .2s, color .2s, filter .2s;
}
.btn svg { width: 18px; height: 18px; }
.btn-primary {
    background: linear-gradient(180deg, var(--cyan-soft), var(--cyan));
    color: var(--ink);
    border-color: var(--cyan);
    box-shadow: 0 0 0 1px rgba(74,216,255,0.4), 0 0 24px rgba(74,216,255,0.28), inset 0 1px 0 rgba(255,255,255,0.4);
}
.btn-primary:hover {
    color: var(--ink); filter: brightness(1.08); transform: translateY(-2px);
    box-shadow: 0 0 0 1px rgba(74,216,255,0.7), 0 0 36px rgba(74,216,255,0.5), inset 0 1px 0 rgba(255,255,255,0.5);
}
.btn-primary:active { transform: translateY(0); }
.btn-ghost { background: rgba(5,6,8,0.35); color: var(--text); border-color: var(--line-strong); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.btn-ghost:hover { background: rgba(74,216,255,0.06); border-color: var(--cyan); color: var(--cyan-bright); }
.hero-dl-size { font-family: var(--mono); font-size: 0.8rem; font-weight: 600; opacity: 0.7; }
.hero-note { font-family: var(--mono); font-size: 0.76rem; letter-spacing: 0.04em; color: var(--text-dim); margin: 1rem 0 0; }
.hero-note.is-warn { color: var(--warn); }

/* entrance */
.rise { animation: rise .8s cubic-bezier(.2,.7,.2,1) both; }
.hero-inner .rise:nth-child(2) { animation-delay: .08s; }
.hero-inner .rise:nth-child(3) { animation-delay: .16s; }
.hero-inner .rise:nth-child(4) { animation-delay: .24s; }
.hero-inner .rise:nth-child(5) { animation-delay: .30s; }
.shot.rise { animation-delay: .35s; animation-duration: 1.1s; }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

/* ---------- page ---------- */
main { width: 100%; max-width: var(--max-w); margin: 0 auto; padding: 0 var(--pad) 4rem; flex: 1; }

/* ---------- the app's welcome screen (its own rounded window and shadow) ---------- */
.shot { position: relative; margin: clamp(-5rem, -8vh, -3rem) auto 0; max-width: 900px; }
.shot-glow {
    position: absolute; inset: 10% 4% 0; z-index: -1;
    background: radial-gradient(ellipse at 50% 45%, rgba(124,92,255,0.32), rgba(74,216,255,0.16) 48%, transparent 72%);
    filter: blur(40px);
}
.shot-img { width: 100%; height: auto; }

.chip {
    position: absolute; z-index: 2;
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.5rem 0.95rem;
    border-radius: 999px;
    border: 1px solid var(--line-strong);
    background: rgba(10,12,17,0.82);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--cyan-bright);
    box-shadow: 0 12px 30px rgba(0,0,0,0.5);
    animation: float 6s ease-in-out infinite;
}
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 10px var(--cyan); }
.chip-a { left: -2.2rem; top: 30%; }
.chip-b { right: -2.2rem; bottom: 17%; animation-delay: -3s; }
.chip-b .dot { background: var(--ok); box-shadow: 0 0 10px var(--ok); }
@keyframes float { 50% { transform: translateY(-8px); } }

/* ---------- sections ---------- */
main > section { margin-top: clamp(3.5rem, 9vw, 6rem); scroll-margin-top: 84px; }
.section-tag { display: block; font-family: var(--mono); font-size: 0.76rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--cyan); margin-bottom: 0.7rem; }
h2 {
    font-family: var(--display); font-weight: 500;
    font-size: clamp(1.9rem, 4.6vw, 2.8rem); line-height: 1.1; letter-spacing: -0.015em;
    margin: 0 0 clamp(1.4rem, 3vw, 2rem);
}
h3 { font-size: 1.05rem; font-weight: 600; line-height: 1.35; margin: 0 0 0.4rem; color: var(--text); }
p { margin: 0 0 0.9rem; color: var(--text-soft); }
p:last-child { margin-bottom: 0; }
strong, b { color: var(--text); font-weight: 600; }

.card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: clamp(1.1rem, 4vw, 1.6rem);
}
.card-accent { border-color: var(--line-strong); box-shadow: 0 0 40px rgba(74,216,255,0.06); }
.card h3 + p + h3 { margin-top: 1.1rem; }

/* ---------- feature tiles ---------- */
.feat-grid, .how-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
    border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
    background: var(--line); gap: 1px;
    margin: 0; padding: 0; list-style: none;
}
.feat {
    position: relative;
    background: linear-gradient(180deg, rgba(12,15,24,0.96), rgba(8,10,15,0.96));
    padding: clamp(1.3rem, 3vw, 1.8rem);
    transition: background .3s;
}
.feat:hover { background: linear-gradient(180deg, rgba(16,24,38,0.98), rgba(9,12,18,0.98)); }
.feat svg {
    width: 34px; height: 34px; margin-bottom: 1rem;
    fill: none; stroke: var(--cyan); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
    filter: drop-shadow(0 0 6px rgba(74,216,255,0.45));
}
.feat p { font-size: 0.95rem; line-height: 1.6; }

/* numbered steps: the number sits top right of each tile */
.how-grid { counter-reset: how; }
.how-grid .feat { counter-increment: how; }
.how-grid .feat::after {
    content: "0" counter(how);
    position: absolute; top: 1.1rem; right: 1.3rem;
    font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0.1em; color: var(--text-dim);
}

/* ---------- control: tiles + the permission switches ---------- */
.control-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1.1rem; align-items: start; }
.control-grid .feat-grid { grid-template-columns: 1fr 1fr; }
.perm-title, .perm-sub {
    display: block; font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-dim);
    margin-bottom: 0.8rem;
}
.perm-sub { margin-top: 1.2rem; }
.perm { margin: 0; padding: 0; list-style: none; }
.perm li { display: flex; align-items: center; gap: 0.75rem; font-size: 0.93rem; color: var(--text-soft); line-height: 1.3; }
.perm li + li { margin-top: 0.6rem; }
.perm li::before {
    content: ""; flex-shrink: 0;
    width: 34px; height: 19px; border-radius: 999px;
    background: radial-gradient(circle at 10px 50%, #fff 5.5px, transparent 6.5px), #202026;
    border: 1px solid #3a3a44;
}
.perm li.on { color: var(--text); }
.perm li.on::before {
    background: radial-gradient(circle at 24px 50%, #fff 5.5px, transparent 6.5px), var(--violet);
    border-color: var(--violet);
    box-shadow: 0 0 12px rgba(124,92,255,0.45);
}
.perm-note { margin-top: 1.2rem; font-size: 0.85rem; color: var(--text-dim); }

/* ---------- downloads ---------- */
.dl-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.6rem; align-items: center; }
.dl-card { display: flex; flex-direction: column; gap: 1.1rem; transition: border-color .3s, box-shadow .3s; }
.dl-card.is-yours {
    border-color: var(--line-strong);
    box-shadow: 0 0 0 1px rgba(74,216,255,0.15), 0 0 60px rgba(74,216,255,0.10);
}

.dl-head { display: flex; align-items: center; gap: 0.9rem; }
.os-mark {
    width: 46px; height: 46px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 12px;
    border: 1px solid var(--line-strong);
    background: rgba(74,216,255,0.05);
    color: var(--cyan-bright);
}
.os-mark svg { width: 22px; height: 22px; }
.dl-head h3 { font-size: 1.3rem; margin: 0; }
.dl-req { font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.04em; color: var(--text-dim); margin: 0.1rem 0 0; }

.dl-btn {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: 0.95rem 1.25rem;
    border-radius: 12px;
    background: linear-gradient(180deg, var(--cyan-soft), var(--cyan));
    border: 1px solid var(--cyan);
    color: var(--ink);
    text-decoration: none;
    box-shadow: 0 0 0 1px rgba(74,216,255,0.4), 0 0 24px rgba(74,216,255,0.28), inset 0 1px 0 rgba(255,255,255,0.4);
    transition: transform .12s, box-shadow .2s, filter .2s;
}
.dl-btn:hover {
    color: var(--ink); filter: brightness(1.08); transform: translateY(-2px);
    box-shadow: 0 0 0 1px rgba(74,216,255,0.7), 0 0 36px rgba(74,216,255,0.5), inset 0 1px 0 rgba(255,255,255,0.5);
}
.dl-btn:active { transform: translateY(0); }
.dl-btn-text { display: grid; line-height: 1; }
.dl-btn-text em {
    font-family: var(--mono); font-style: normal;
    font-size: 0.65rem; letter-spacing: 0.18em; text-transform: uppercase;
    color: rgba(4,22,42,0.7); margin-bottom: 5px;
}
.dl-btn-text strong { color: var(--ink); font-weight: 700; font-size: 1.12rem; letter-spacing: -0.01em; }
.dl-btn-side { display: flex; align-items: center; gap: 0.55rem; font-family: var(--mono); font-size: 0.8rem; font-weight: 600; }
.dl-btn-side svg { width: 20px; height: 20px; }

.dl-file { font-family: var(--mono); font-size: 0.74rem; color: var(--text-dim); margin: -0.5rem 0 0; }

.badge {
    display: inline-flex; align-items: center; gap: 0.5rem; align-self: flex-start;
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.badge-ok { color: var(--ok); border: 1px solid rgba(95,227,161,0.3); background: rgba(95,227,161,0.06); }
.badge-warn { color: var(--warn); border: 1px solid rgba(255,198,107,0.3); background: rgba(255,198,107,0.06); }

.steps { margin: 0; padding: 0; list-style: none; counter-reset: step; }
.steps li { position: relative; padding-left: 2.1rem; color: var(--text-soft); font-size: 0.95rem; line-height: 1.55; }
.steps li + li { margin-top: 0.6rem; }
.steps li::before {
    counter-increment: step; content: counter(step);
    position: absolute; left: 0; top: 0.05rem;
    width: 1.45rem; height: 1.45rem; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--line-strong); background: rgba(74,216,255,0.05);
    font-family: var(--mono); font-size: 0.7rem; color: var(--cyan-bright);
}

.sha { margin-top: auto; border-top: 1px solid var(--line); padding-top: 0.9rem; }
.sha summary {
    cursor: pointer; list-style: none;
    font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-dim);
}
.sha summary::-webkit-details-marker { display: none; }
.sha summary::before { content: "+ "; color: var(--cyan); }
.sha[open] summary::before { content: "\2212  "; }
.sha summary:hover { color: var(--cyan-bright); }
.sha code {
    display: block; margin-top: 0.6rem;
    font-size: 0.72rem; line-height: 1.5; color: var(--text-soft);
    white-space: normal; word-break: break-all; user-select: all;
}

.setup-shot { margin: 0; }
.setup-shot img { margin: 0 auto; filter: drop-shadow(0 30px 60px rgba(0,0,0,0.6)) drop-shadow(0 0 40px rgba(124,92,255,0.15)); }
.setup-shot figcaption { text-align: center; font-size: 0.9rem; color: var(--text-dim); margin-top: 1rem; }

/* ---------- help ---------- */
.help-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 1.1rem; align-items: start; }
.mail { display: inline-block; margin-top: 0.3rem; font-family: var(--mono); font-size: 1.02rem; color: var(--cyan-bright); }

/* ---------- footer ---------- */
.foot {
    border-top: 1px solid var(--line);
    padding: 1.5rem var(--pad) calc(1.5rem + env(safe-area-inset-bottom, 0px));
    display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.4rem 1.4rem;
    font-family: var(--mono); font-size: 0.78rem; color: var(--text-dim);
}
.foot a { color: var(--text-dim); text-decoration: none; }
.foot a:hover { color: var(--cyan-bright); }

/* ---------- narrower screens ---------- */
@media (max-width: 1000px) {
    .control-grid, .dl-grid, .help-grid { grid-template-columns: 1fr; }
    .chip-a { left: 0.5rem; }
    .chip-b { right: 0.5rem; }
}
@media (max-width: 760px) {
    .nav-links a:not([href="#download"]) { display: none; }
    .hero { min-height: 0; align-items: flex-start; padding-top: 2.5rem; padding-bottom: 6rem; }
    .hero-bg { inset: 0; background-position: 62% 100%; opacity: 0.55; -webkit-mask-image: none; mask-image: none; }
    .hero::before {
        background: linear-gradient(180deg, rgba(5,6,8,0.6) 0%, rgba(5,6,8,0.86) 45%, var(--bg-0) 100%);
    }
    .shot { margin-top: -3rem; }
    .chip { font-size: 0.62rem; padding: 0.4rem 0.7rem; }
    .chip-a { top: auto; bottom: -1rem; }
    .chip-b { display: none; }
    .control-grid .feat-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .hero-bg, .chip, .rise { animation: none; }
    .dl-btn, .btn { transition: none; }
}
