/* PrivacyFirst Photo Organizer — user guide stylesheet (proposed redesign).
 *
 * Editorial layout: serif display headings, a monospace label voice for
 * section numbers, figure labels and column heads, and hairline rules instead
 * of boxes. Self-contained: no web fonts, no CDN, nothing to fetch.
 *
 * Every rule here has a counterpart in gui/widgets/guide.py's
 * guide_stylesheet(), which expresses the same design in the CSS subset Qt's
 * rich-text engine implements. Markup stays inside HTML 4 so one file renders
 * in both.
 */

:root {
    --paper: #F7F7F5;
    --surface: #FFFFFF;
    --surface-2: #F0F1F4;

    --ink: #14161C;
    --body: #41464F;
    --muted: #6E747E;

    --rule: #E3E5EA;
    --rule-2: #C7CAD2;

    --accent: #4F46E5;
    --accent-ink: #3730A3;
    --accent-bg: #EEF0FF;

    --warn: #8F5511;
    --warn-bg: #FAF2E4;
    --warn-rule: #D9A05A;

    --safe: #0F6B4F;
    --safe-bg: #E8F3EE;
    --safe-rule: #4FAE80;

    --crit: #9E2F22;
    --crit-bg: #F9EBE8;
    --crit-rule: #C86B5C;

    --code-bg: #EEF0F3;
    --shadow: 0 1px 2px rgba(20, 22, 28, .05), 0 8px 26px -14px rgba(20, 22, 28, .22);

    --sidebar-width: 250px;
    --serif: ui-serif, "New York", Cambria, Constantia, "Iowan Old Style", Georgia, serif;
    --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
            "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --paper: #0E1013;
        --surface: #16181D;
        --surface-2: #1D2026;

        --ink: #ECEEF2;
        --body: #B2B8C2;
        --muted: #808795;

        --rule: #262A31;
        --rule-2: #3A404A;

        --accent: #8E88FF;
        --accent-ink: #A9A4FF;
        --accent-bg: #1A1930;

        --warn: #D9A05A;
        --warn-bg: #26201A;
        --warn-rule: #7A5A2E;

        --safe: #5CC79B;
        --safe-bg: #14251E;
        --safe-rule: #2E6B52;

        --crit: #E0796A;
        --crit-bg: #271817;
        --crit-rule: #7A3A32;

        --code-bg: #1D2026;
        --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 8px 26px -14px rgba(0, 0, 0, .8);
    }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 24px; }

body {
    margin: 0;
    background: var(--paper);
    color: var(--body);
    font-family: var(--sans);
    font-size: 16.5px;
    line-height: 1.62;
    -webkit-font-smoothing: antialiased;
}

/* ---------------------------------------------------------------- layout -- */

.page {
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    gap: 56px;
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 32px 110px;
}

main { min-width: 0; padding: 8px 0; max-width: 76ch; }

/* -------------------------------------------------------------- masthead -- */

header.masthead {
    grid-column: 1 / -1;
    padding: 68px 0 34px;
    border-bottom: 2px solid var(--ink);
    margin-bottom: 8px;
}

.eyebrow {
    font-family: var(--mono);
    font-size: 11.5px;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0 0 18px;
}

h1 {
    font-family: var(--serif);
    font-weight: 600;
    font-size: clamp(38px, 6vw, 58px);
    line-height: 1.04;
    letter-spacing: -.02em;
    color: var(--ink);
    margin: 0 0 20px;
    text-wrap: balance;
}

.masthead .lede {
    font-family: var(--serif);
    font-size: clamp(18px, 2.3vw, 21px);
    line-height: 1.5;
    color: var(--body);
    max-width: 62ch;
    margin: 0 0 24px;
}

/* One paragraph, dot-separated, so it survives Qt as a single line rather
 * than becoming a bullet list. */
.badges {
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0;
}

.badges .sep { color: var(--rule-2); padding: 0 8px; }

/* ------------------------------------------------------------------- toc -- */

.toc {
    position: sticky;
    top: 0;
    align-self: start;
    max-height: 100vh;
    overflow-y: auto;
    padding: 12px 0 32px;
    font-size: 14px;
}

.toc h2 {
    font-family: var(--mono);
    font-size: 10.5px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0 0 12px;
    font-weight: 600;
}

.toc ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; }
.toc li { margin: 0; counter-increment: toc; }

.toc a {
    display: block;
    padding: 5px 10px 5px 34px;
    position: relative;
    color: var(--body);
    text-decoration: none;
    border-left: 1px solid var(--rule);
}

.toc a::before {
    content: counter(toc, decimal-leading-zero);
    position: absolute;
    left: 10px;
    font-family: var(--mono);
    font-size: 11px;
    color: var(--muted);
}

.toc a:hover { color: var(--ink); background: var(--surface); border-left-color: var(--accent); }
.toc a:hover::before { color: var(--accent); }

/* ------------------------------------------------------------ typography -- */

/* The rule between sections is an <hr>, not a border on the heading: Qt's
 * rich-text engine draws no border on a block element at all (it paints the
 * background and stops), and <hr> is the one horizontal rule it does draw.
 * It ignores the colour there and uses its own hairline, which is close
 * enough; here it is styled properly. */
hr.sec-rule {
    border: none;
    border-top: 1px solid var(--rule-2);
    height: 0;
    margin: 62px 0 0;
}

hr.sec-rule:first-of-type { margin-top: 30px; }

/* The section number is its own block above the heading rather than a <span>
 * inside it: Qt has no display:block for an inline element, so a span would
 * run straight into the heading text. */
.sec-num {
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .12em;
    color: var(--accent);
    margin: 22px 0 8px;
}

h2 {
    font-family: var(--serif);
    font-weight: 600;
    font-size: clamp(25px, 3.4vw, 32px);
    line-height: 1.15;
    letter-spacing: -.015em;
    color: var(--ink);
    margin: 0 0 8px;
    text-wrap: balance;
}

h3 {
    font-family: var(--sans);
    font-size: 17.5px;
    font-weight: 650;
    color: var(--ink);
    margin: 36px 0 6px;
}

h4 {
    font-family: var(--mono);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 28px 0 6px;
}

p { margin: 0 0 14px; }

.lede {
    font-family: var(--serif);
    font-size: 19px;
    line-height: 1.5;
    color: var(--ink);
    margin: 14px 0 22px;
    max-width: 66ch;
}

ul, ol { margin: 0 0 16px; padding-left: 22px; }
li { margin: 0 0 7px; }
li::marker { color: var(--muted); }

a { color: var(--accent-ink); text-decoration-thickness: 1px; text-underline-offset: 2px; }

strong { color: var(--ink); font-weight: 650; }

code, kbd {
    font-family: var(--mono);
    font-size: .875em;
}

code { background: var(--code-bg); color: var(--ink); padding: .1em .34em; border-radius: 3px; }

kbd {
    background: var(--surface);
    border: 1px solid var(--rule-2);
    border-bottom-width: 2px;
    border-radius: 5px;
    padding: 1px 6px;
    font-size: .8em;
    white-space: nowrap;
}

/* The name of something on screen -- the single most common mark in the
 * document, and what makes an instruction scannable. */
.ui {
    font-family: var(--sans);
    font-size: .93em;
    font-weight: 650;
    color: var(--accent-ink);
    background: var(--accent-bg);
    border-radius: 4px;
    padding: 1px 6px;
    white-space: nowrap;
}

/* --------------------------------------------------------------- figures -- */

/* A one-cell table, not a <div>: Qt paints a border and honours padding on a
 * table cell and on nothing else, so this is the only markup that reads as a
 * panel in both engines. See gui/widgets/guide.py. */
.figure {
    width: 100%;
    border-collapse: collapse;
    margin: 26px 0 30px;
}

.figure td {
    background: var(--surface);
    border: 1px solid var(--rule);
    padding: 16px 16px 14px;
}

.figure img {
    display: block;
    width: 100%;
    height: auto;
    border: 1px solid var(--rule);
    border-radius: 4px;
}

.figlabel {
    font-family: var(--mono);
    font-size: 10.5px;
    letter-spacing: .11em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0 0 10px;
}

/* A <p class="figcaption"> rather than a <figcaption>: Qt's rich-text engine
 * knows only HTML 4 and drops tags outside it, taking the caption's text with
 * it into the next paragraph. One file serves both, so the markup is the one
 * both understand. */
.figcaption {
    margin: 12px 0 0;
    font-size: 14.5px;
    line-height: 1.5;
    color: var(--muted);
}

.figcaption strong { color: var(--body); }

/* ---------------------------------------------------------------- tables -- */

.table-wrap {
    overflow-x: auto;
    margin: 20px 0 24px;
    border: 1px solid var(--rule);
    background: var(--surface);
}

table.data {
    border-collapse: collapse;
    width: 100%;
    min-width: 460px;
    font-size: 15px;
}

table.data caption {
    caption-side: top;
    text-align: left;
    padding: 13px 16px 0;
    font-family: var(--mono);
    font-size: 10.5px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted);
}

table.data th, table.data td {
    text-align: left;
    vertical-align: top;
    padding: 10px 16px;
    border: none;
    border-bottom: 1px solid var(--rule);
}

table.data thead th {
    font-family: var(--mono);
    font-size: 10.5px;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 600;
    border-bottom: 1px solid var(--rule-2);
    white-space: nowrap;
}

table.data tbody td:first-child {
    color: var(--ink);
    font-weight: 600;
    white-space: nowrap;
}

table.data tbody tr:last-child td { border-bottom: none; }

/* The privacy statement in the masthead. A callout, but the masthead spans
 * both grid columns, so it needs the reading measure the body copy has. */
.promise { max-width: 78ch; margin-top: 26px; }

/* -------------------------------------------------------------- callouts -- */

/* Same one-cell-table reason as .figure. */
.callout { width: 100%; border-collapse: collapse; margin: 22px 0; }

.callout td {
    background: var(--surface);
    border: 1px solid var(--rule);
    border-left: 3px solid var(--rule-2);
    padding: 14px 18px;
    font-size: 15.5px;
}

.callout p { margin: 0 0 10px; }
.callout p:last-child { margin-bottom: 0; }

.callout .callout-title {
    font-family: var(--mono);
    font-size: 10.5px;
    letter-spacing: .1em;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--muted);
    margin: 0 0 7px;
}

.callout.note td { border-left-color: var(--accent); background: var(--accent-bg); }
.callout.note .callout-title { color: var(--accent-ink); }

.callout.tip td { border-left-color: var(--safe-rule); background: var(--safe-bg); }
.callout.tip .callout-title { color: var(--safe); }

.callout.warn td { border-left-color: var(--warn-rule); background: var(--warn-bg); }
.callout.warn .callout-title { color: var(--warn); }

.callout.safe td { border-left-color: var(--safe-rule); background: var(--safe-bg); }
.callout.safe .callout-title { color: var(--safe); }

/* ------------------------------------------------------------- step list -- */

ol.steps { counter-reset: step; list-style: none; padding-left: 0; margin: 18px 0 22px; }

ol.steps > li {
    counter-increment: step;
    position: relative;
    padding-left: 46px;
    margin: 0 0 16px;
}

ol.steps > li::before {
    content: counter(step, decimal-leading-zero);
    position: absolute;
    left: 0;
    top: 2px;
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    border-left: 2px solid var(--accent);
    padding-left: 10px;
}

/* ----------------------------------------------------------- colour keys -- */

.swatch {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    margin-right: 7px;
    border: 1px solid rgba(0, 0, 0, .18);
}

.swatch.amber { background: #F2B705; }
.swatch.green { background: #10B981; }
.swatch.grey { background: #94A3B8; }
.swatch.red { background: #EF4444; }
.swatch.orange { background: #F97316; }
.swatch.white { background: #FFFFFF; }

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

footer {
    grid-column: 1 / -1;
    margin-top: 72px;
    padding-top: 22px;
    border-top: 1px solid var(--rule);
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: .04em;
    color: var(--muted);
}

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

@media (max-width: 1020px) {
    .page { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 0 20px 72px; }
    hr.sec-rule { margin-top: 46px; }
    .toc { position: static; max-height: none; padding: 10px 0 4px;
           border-bottom: 1px solid var(--rule); margin-bottom: 10px; }
    .toc ol { display: flex; flex-wrap: wrap; gap: 2px 6px; padding-bottom: 14px; }
    .toc a { border-left: none; padding: 4px 10px 4px 28px; }
    .toc a::before { left: 6px; }
    header.masthead { padding-top: 40px; }
    h2 { margin-top: 48px; }
}

@media print {
    .toc { display: none; }
    .page { display: block; max-width: none; padding: 0; }
    hr.sec-rule { break-before: page; border: none; margin: 0; }
}
