/* PrivatePaste, "Night vault" brand. Dark is the default; light mode swaps to pale lavender with a deeper violet. */
/* Font URLs carry ?v=N because they are behind a long-lived CDN cache: bump N whenever a font file changes. */

@font-face {
    font-family: "Sora";
    src: url("/fonts/sora-latin.woff2?v=1") format("woff2");
    font-weight: 100 800;
    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: "Sora";
    src: url("/fonts/sora-latin-ext.woff2?v=1") format("woff2");
    font-weight: 100 800;
    font-display: swap;
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
    color-scheme: dark;
    --night: #15122B;
    --surface: #1D1838;
    --raised: #262046;
    --line: #2E2756;
    --text: #E9E6F7;
    --muted: #9A94BD;
    --accent: #B7A5FF;
    --accent-ink: #15122B;
    --accent-soft: rgba(183, 165, 255, .14);
    --danger: #FF8FA3;
    --danger-soft: rgba(255, 143, 163, .12);
    --glow: 0 0 0 3px rgba(183, 165, 255, .16);
    --radius: 14px;
}

@media (prefers-color-scheme: light) {
    :root {
        color-scheme: light;
        --night: #F6F4FD;
        --surface: #FFFFFF;
        --raised: #EFEBFC;
        --line: #E1DBF7;
        --text: #1E1A38;
        --muted: #625C88;
        --accent: #5B45D6;
        --accent-ink: #FFFFFF;
        --accent-soft: rgba(91, 69, 214, .10);
        --danger: #C2364A;
        --danger-soft: rgba(194, 54, 74, .08);
        --glow: 0 0 0 3px rgba(91, 69, 214, .14);
    }
}

* { box-sizing: border-box; }
/* Scripts show and hide whole blocks with the hidden attribute; it wins over any display rule. */
[hidden] { display: none !important; }

body {
    margin: 0;
    min-height: 100vh;
    background: var(--night);
    color: var(--text);
    font: 400 15px/1.5 "Sora", system-ui, -apple-system, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-underline-offset: 3px; }
h1 { font-size: 1.35rem; font-weight: 600; letter-spacing: -.01em; margin: 0 0 1.25rem; }
main { max-width: 46rem; margin: 0 auto; padding: 1.5rem 16px 3rem; }
.muted { color: var(--muted); }
.error { color: var(--danger); font-weight: 600; margin: 0; }

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

/* Header */
.bar {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    max-width: 46rem; margin: 0 auto; padding: 1.1rem 16px .4rem;
}
.brand { display: inline-flex; align-items: center; gap: .6rem; color: var(--text); text-decoration: none; }
.brand img { width: 34px; height: 34px; display: block; }
.wordmark { font-size: 1.15rem; font-weight: 600; letter-spacing: -.01em; }
.wordmark span { font-weight: 300; color: var(--accent); }
nav { display: flex; align-items: center; gap: .25rem; }
nav a, nav button.link {
    color: var(--muted); text-decoration: none; font-size: .9rem; padding: .4rem .7rem; border-radius: 99px; white-space: nowrap;
}
nav a:hover, nav button.link:hover { color: var(--text); background: var(--raised); }
nav a[aria-current="page"] { color: var(--text); background: var(--raised); }
form.inline { display: inline; margin: 0; }

/* Controls */
button, input[type=search], input[type=text], input[type=password] {
    font: inherit; color: var(--text); background: var(--raised);
    border: 1px solid var(--line); border-radius: 10px; padding: .55rem .85rem;
}
input::placeholder { color: var(--muted); }
input[type=search]:focus, input[type=text]:focus, input[type=password]:focus { outline: none; border-color: var(--accent); box-shadow: var(--glow); }
button { cursor: pointer; transition: background-color .15s, border-color .15s, color .15s; }
button:hover { border-color: var(--accent); }
button:disabled { cursor: default; opacity: .8; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
button.primary:hover { filter: brightness(1.06); }
button.link { border: 0; background: none; padding: 0; }
a.button {
    display: inline-block; text-decoration: none; font-size: inherit; line-height: inherit;
    border: 1px solid transparent; border-radius: 10px; padding: .55rem .85rem; transition: background-color .15s, color .15s;
}
a.button.ghost { color: var(--muted); }
a.button.ghost:hover, a.button.ghost:focus-visible, a.button.ghost[aria-current] { color: var(--accent); background: var(--accent-soft); }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); }
button.ghost:hover, button.ghost:focus-visible { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
button.copy { background: var(--accent-soft); border-color: transparent; color: var(--accent); font-weight: 600; }
button.copy:hover { border-color: var(--accent); }
button.copy.done { background: var(--accent); color: var(--accent-ink); }
button.copy.failed { background: var(--danger-soft); color: var(--danger); }

/* Row actions (Copy, Pin, Delete) are compact icon buttons; the name is in aria-label and the tooltip. */
button.icon-button { padding: .5rem .6rem; line-height: 0; }
.btn-icon { width: 18px; height: 18px; flex: none; }
button.copy .done-icon, button.copy.done .idle-icon { display: none; }
button.copy.done .done-icon { display: inline; }

/* Sign in */
.signin { max-width: 22rem; margin: 10vh auto 0; display: grid; gap: .75rem; }
.signin .logo { width: 64px; height: 64px; margin-bottom: .25rem; }
.signin .wordmark { margin: 0; font-size: 1.5rem; }
.signin h1 { margin: 0 0 .5rem; font-size: 1rem; font-weight: 400; color: var(--muted); }
.signin label { font-size: .85rem; color: var(--muted); }
.signin button { margin-top: .25rem; }

/* History */
.search { display: flex; gap: .5rem; margin-bottom: 1.25rem; }
.search input { flex: 1; min-width: 0; }

.clips { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.clip {
    display: flex; gap: .85rem; align-items: flex-start;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem .9rem;
}
.clip.newest { border-color: var(--accent); box-shadow: var(--glow); }
.kind {
    flex: none; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
    background: var(--raised); color: var(--accent);
}
.kind svg { width: 18px; height: 18px; }
.body { flex: 1; min-width: 0; }
.text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; max-height: 7.5em; overflow: hidden; }
.body a { overflow-wrap: anywhere; }
.thumb { max-width: min(256px, 100%); max-height: 256px; border-radius: 8px; display: block; }
.file-lines { list-style: none; margin: .4rem 0 0; padding: 0; display: grid; gap: .1rem; }
.file-line { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.file-name { flex: 0 1 auto; min-width: 0; overflow-wrap: anywhere; }
.file-size { flex: none; font-size: .85rem; }
.file-line button { margin-left: auto; }
/* A download is not destructive: accent on hover, not the ghost button's danger red. */
button.file-download:hover, button.file-download:focus-visible { color: var(--accent); background: var(--accent-soft); }
.meta { color: var(--muted); font-size: .78rem; margin-top: .3rem; }

/* Source device platform: drawn in the muted colour, about the text's cap height, right before the device name. */
.platform {
    width: 1.15em; height: 1.15em; vertical-align: -.2em; margin-right: .35em; flex: none;
    color: var(--muted);
}
/* Who copied the clip: a small accent pill right before the platform icon; only there while the server has several people. */
.person-chip {
    display: inline-block; font-size: 11px; font-weight: 600; line-height: 1.5; padding: 0 .55rem; margin-right: .45em;
    border-radius: 99px; background: var(--accent-soft); color: var(--accent); vertical-align: .05em;
    max-width: 14em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.actions { flex: none; display: flex; gap: .3rem; align-items: center; }
.actions form { margin: 0; }
.list-footer { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.25rem; }
.list-footer:not(:has(button:not([hidden]))) { display: none; }
.empty { text-align: center; padding: 3rem 1rem; border: 1px dashed var(--line); border-radius: var(--radius); }

.sr-only {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
    clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* History / Pinned tabs */
.tabs { display: flex; gap: .25rem; margin-bottom: 1rem; }
.tabs a { color: var(--muted); text-decoration: none; font-size: .9rem; padding: .4rem .9rem; border-radius: 99px; }
.tabs a:hover { color: var(--text); background: var(--raised); }
.tabs a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); font-weight: 600; }

/* Type filter chips under the search: one pressed at a time, styled like the tabs' selected state. */
.search:has(+ .filters) { margin-bottom: .75rem; }
.filters { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1.25rem; }
.chip {
    display: inline-flex; align-items: center; gap: .35rem; font-size: .85rem; font-weight: 600; line-height: 1.2;
    padding: .35rem .7rem; border-radius: 8px; background: var(--surface); color: var(--muted);
}
.chip:hover { color: var(--text); border-color: var(--line); }
.chip[aria-pressed="true"] { color: var(--text); background: var(--accent-soft); border-color: var(--accent); }
.chip[aria-pressed="true"] .chip-icon { color: var(--accent); }
.chip-icon { display: inline-flex; }
.chip-icon svg { width: 14px; height: 14px; }

/* Pin: a marker on pinned rows in History, and the toggle in every row's actions. */
.pin-icon { width: 1.15em; height: 1.15em; vertical-align: -.2em; flex: none; }
.pin-marker { color: var(--accent); margin-right: .35em; }
.pin-marker .pin-icon { width: 1.05em; height: 1.05em; }
button.pin-toggle { padding: .5rem .6rem; line-height: 0; }
button.pin-toggle .pin-icon { width: 18px; height: 18px; vertical-align: baseline; }
button.pin-toggle[aria-pressed="true"] { color: var(--accent); }
button.pin-toggle:hover, button.pin-toggle:focus-visible { color: var(--accent); background: var(--accent-soft); }
button.pin-toggle[aria-pressed="true"] .pin-icon { fill: currentColor; }
button.pin-toggle.failed, button.pin-toggle.failed:hover { color: var(--danger); background: var(--danger-soft); }

/* Unlock and first setup: one centered column, like Sign in. */
.vault-panel { max-width: 24rem; margin: 8vh auto 0; }
.vault-panel .hint { margin: -.75rem 0 1rem; }
.passphrase-form { display: grid; gap: .3rem; }
.passphrase-form label { font-size: .85rem; color: var(--muted); margin-top: .3rem; }
.passphrase-form button { justify-self: start; margin-top: .6rem; }
.passphrase-form .error { margin-bottom: .4rem; }
form[aria-busy="true"] { cursor: progress; }

/* Settings */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; margin-bottom: .8rem; }
.panel h2 { font-size: 1rem; font-weight: 600; margin: 0; }
.panel label { font-weight: 600; }
.hint { margin: .15rem 0 .75rem; font-size: .85rem; }
.field { display: flex; align-items: center; gap: .75rem; }
select {
    font: inherit; color: var(--text); background: var(--raised);
    border: 1px solid var(--line); border-radius: 10px; padding: .55rem .85rem;
}
select:focus { outline: none; border-color: var(--accent); box-shadow: var(--glow); }
.saved { color: var(--accent); font-size: .85rem; }
button.danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; font-weight: 600; }
button.danger:hover { border-color: var(--danger); }

/* People: one card per person, their devices listed under the name. */
.people { display: grid; gap: .8rem; margin-bottom: .8rem; }
.person-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1.1rem; }
.person-head { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; }
.person-head .person-chip { font-size: .85rem; padding: .15rem .7rem; margin: 0; }
.role { color: var(--muted); font-size: .8rem; }
.person-actions { margin-left: auto; display: flex; align-items: center; gap: .2rem; flex-wrap: wrap; }
.person-actions form { margin: 0; }
.person-card .error { margin-top: .7rem; }
.person-edit { margin-top: .8rem; padding-top: .8rem; border-top: 1px solid var(--line); display: grid; gap: .4rem; }
.person-edit label { font-size: .85rem; color: var(--muted); }
.person-edit .field { flex-wrap: wrap; }
.person-edit input { flex: 1; min-width: 10rem; }
.person-devices { list-style: none; margin: .7rem 0 0; padding: 0; }
.person-devices li {
    display: flex; align-items: center; justify-content: space-between; gap: .75rem;
    padding: .45rem 0; border-top: 1px solid var(--line);
}
.person-devices form { margin: 0; flex: none; }
.device-text { min-width: 0; overflow-wrap: anywhere; font-size: .9rem; }
.device-name { font-weight: 600; }
.device-text .muted { font-size: .85rem; }
.no-devices { margin: .7rem 0 0; font-size: .85rem; }
.add-person .add-fields { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin-bottom: .75rem; }
.add-person .add-fields label { display: grid; gap: .3rem; font-size: .85rem; color: var(--muted); font-weight: 400; }
.add-person .error { margin-bottom: .75rem; }

/* Change password */
.panel > .error, .panel > .saved { margin: 0 0 .75rem; }
.password-form { display: grid; gap: .3rem; max-width: 22rem; }
.password-form label { font-size: .85rem; color: var(--muted); font-weight: 400; margin-top: .3rem; }
.password-form button { justify-self: start; margin-top: .6rem; }

/* Dialogs (Add a device, Reset encryption): the same surface as a panel, over a dimmed page. */
dialog {
    background: var(--surface); color: var(--text);
    border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem;
    width: min(26rem, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); overflow-y: auto;
}
dialog::backdrop { background: rgba(10, 8, 24, .66); }
dialog h2 { font-size: 1rem; font-weight: 600; margin: 0 0 .6rem; }
dialog p { margin: 0 0 .75rem; }
dialog .hint { margin: .15rem 0 .5rem; }
.dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: .6rem; margin-top: .9rem; }
.password-form .dialog-actions { justify-content: flex-end; }
.password-form .dialog-actions button { justify-self: auto; margin-top: 0; }
/* Black modules on a white quiet zone in both themes, so phones can scan it. */
.qr { display: block; width: 100%; max-width: 17rem; height: auto; margin: 0 auto .9rem; border-radius: 8px; }

@media (max-width: 34rem) {
    .clip { flex-wrap: wrap; }
    /* All five chips on one line at 360px. */
    .filters { gap: .3rem; }
    .chip { padding: .35rem .5rem; gap: .25rem; font-size: .8rem; }
    .actions { width: 100%; justify-content: flex-end; }
    .bar .wordmark { display: none; }
    nav { gap: 0; }
    /* Five items (with Lock) must fit a 360px phone next to the logo. */
    nav a, nav button.link { padding: .4rem .3rem; font-size: .8rem; }

    .add-person .add-fields { grid-template-columns: 1fr; }
    /* Actions wrap under the name; the negative margin lines the first label up with the chip. */
    .person-actions { margin-left: -.6rem; width: calc(100% + .6rem); gap: 0; }
    .person-actions a.button, .person-actions button { padding: .55rem .6rem; }
    .person-devices li { align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
    button, a.button { transition: none; }
}
