/*
 * SecureShare's own styles. The look comes from the Zavanto design system: tokens in zavanto/css/tokens.css and
 * the zv- components in zavanto/css/components.css (both copied from Zavanto/Design, see design/zavanto/README.md).
 * This file only adds what the components do not have: page layout, icons, states the bundle lacks and the home page visual. It uses
 * token names only, never colour values.
 * No external fonts or CDNs: the CSP only allows files from this site.
 */

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

html {
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
}

h1, h2, h3 {
    margin: 0;
}

h1:focus, [tabindex="-1"]:focus {
    outline: none;
}

p {
    margin: 0;
}

a {
    color: var(--accent-ink);
}

    a:hover {
        text-decoration-thickness: 2px;
    }

a.zv-btn {
    text-decoration: none;
}

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

code {
    font-family: var(--font-mono);
}

.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* Icons (Shared/Icon.razor): 2px line, round ends, currentColor. */

.icon {
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.icon-sm {
    width: 16px;
    height: 16px;
}

.icon-bold {
    stroke-width: 2.4;
}

.text-success {
    color: var(--success);
}

.text-danger {
    color: var(--danger);
}

.text-muted {
    color: var(--ink-muted);
}

/* Columns: forms are content-max wide, the home page page-max. */

.narrow, .wide {
    width: 100%;
    margin: 0 auto;
    padding: 0 var(--space-5);
}

.narrow {
    max-width: var(--content-max);
}

.wide {
    max-width: var(--page-max);
}

.page-stack {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

/* The share form (Pages/Share.razor): a fieldset only to disable every control until the prerendered page is
   interactive; it lays out like the page stack and has no border of its own. */
.share-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

/* Page heading: type style "display" with "lead" below. */

.page-intro {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

    .page-intro h1 {
        font-size: 36px;
        line-height: 42px;
        font-weight: 700;
        letter-spacing: -0.01em;
    }

.lead {
    font-size: 18px;
    line-height: 28px;
    color: var(--ink-muted);
}

@media (max-width: 600px) {
    .page-intro h1 {
        font-size: 30px;
        line-height: 36px;
    }

    .zv-done-title {
        font-size: 26px;
    }

    .zv-card, .zv-empty {
        padding: var(--space-5);
    }

    .zv-disclosure-toggle {
        padding: var(--space-5);
    }

    .zv-disclosure-panel {
        padding: var(--space-5);
    }
}

.card-subtitle {
    font-size: 18px;
    font-weight: 700;
}

.card-tight {
    gap: 14px;
}

.zv-card-title .icon {
    width: 22px;
    height: 22px;
}

/* Fields and controls: small additions to the bundle */

.zv-input:focus {
    outline-offset: 1px;
}

.input-tall {
    height: 48px;
}

.input-row {
    display: flex;
    gap: var(--space-2);
}

    .input-row .zv-input {
        flex: 1 1 auto;
        min-width: 0;
    }

.zv-input[aria-invalid="true"] {
    border-width: 2px;
}

.zv-hint-error,
.zv-hint-warning {
    display: flex;
    gap: var(--space-2);
    align-items: flex-start;
    font-weight: 600;
}

    .zv-hint-error .icon,
    .zv-hint-warning .icon {
        margin-top: 2px;
    }

.zv-check:focus-within {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.zv-check input:focus-visible {
    outline: none;
}

/* A square button next to a field (show/hide secret). */
.field-icon-btn {
    width: var(--control-md);
    height: var(--control-md);
    border: 1px solid var(--line-control);
    background: var(--surface-field);
    color: var(--ink);
}

    .field-icon-btn[aria-pressed="true"] {
        border-color: var(--accent);
        background: var(--accent-soft);
    }

.zv-icon-btn:hover {
    color: var(--ink);
    background: var(--surface-sunken);
}

/* The bundle's dropzone keeps the file input 1px wide; covering the zone with it makes dropping files work too. */
.zv-dropzone {
    position: relative;
}

    .zv-dropzone input[type=file] {
        inset: 0;
        width: 100%;
        height: 100%;
        cursor: pointer;
    }

    .zv-dropzone:hover {
        border-color: var(--accent);
    }

.dropzone-text {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    text-align: left;
}

.zv-stepper button:disabled {
    color: var(--ink-muted);
    cursor: default;
}

.zv-stepper button:focus-visible {
    outline-offset: -2px;
}

.zv-stepper output {
    padding: 0 6px;
}

.zv-chip:hover {
    border-color: var(--accent);
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--space-5);
}

/* Buttons */

.zv-btn-small {
    min-height: 40px;
    padding: 0 14px;
    font-size: 14px;
}

    .zv-btn-small svg {
        width: 16px;
        height: 16px;
    }

.zv-btn-ghost {
    align-self: flex-start;
    font-size: 15px;
}

/* Destructive actions (delete the share now). */
.zv-btn-ghost.text-danger {
    color: var(--danger);
}

.zv-btn.btn-danger {
    background: var(--danger);
    border-color: var(--danger);
    color: var(--on-accent);
}

/* Busy buttons keep full colour; the spinner and text show that work is going on. */
.zv-btn[aria-busy=true]:disabled {
    opacity: 1;
    cursor: progress;
}

.spinner {
    width: 1em;
    height: 1em;
    flex: none;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .spinner {
        animation-duration: 2s;
    }

    .zv-disclosure-chevron, .zv-faq summary svg {
        transition: none;
    }
}

.actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-4);
}

.actions-tight {
    gap: var(--space-2);
}

/* Confirmation states the bundle lacks: mails that could not be sent. */

.zv-done-icon .icon {
    width: 26px;
    height: 26px;
}

.zv-done-icon.is-warning {
    background: var(--warning-soft);
    color: var(--warning);
}

.zv-done-icon.is-danger {
    background: var(--danger-soft);
    color: var(--danger);
}

.zv-notice .zv-notice-body {
    font-size: 15px;
    line-height: 1.5;
}

.note {
    display: flex;
    gap: var(--space-2);
    align-items: flex-start;
    font-size: 14px;
    line-height: 20px;
    color: var(--ink-muted);
    font-variant-numeric: tabular-nums;
}

    .note .icon {
        margin-top: 2px;
    }

.zv-files .zv-btn {
    flex: 0 0 auto;
    font-size: 14px;
    padding: 0 var(--space-4);
}

.file-status {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.section-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
}

/* Shared text on Pickup, in mono so l, I and 1 can be told apart. */
.secret-text {
    margin: 0;
    width: 100%;
    max-height: 60vh;
    overflow: auto;
    padding: var(--space-4) 18px;
    background: var(--surface-field);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 16px;
    line-height: 1.6;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

    .secret-text.is-hidden {
        color: var(--ink-muted);
        letter-spacing: 0.1em;
    }

.key-from-link {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-3) var(--space-3) var(--space-4);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-field);
}

    .key-from-link > span {
        flex: 1 1 200px;
        font-size: 15px;
        font-weight: 600;
    }

    .key-from-link .zv-btn-ghost {
        align-self: center;
        font-size: 14px;
    }

/* Home page: sections page-max wide, space-9 apart. */

.home {
    display: flex;
    flex-direction: column;
    gap: var(--space-9);
    padding-top: calc(var(--space-8) - var(--space-7));
    padding-bottom: calc(var(--space-9) - 56px);
}

@media (max-width: 600px) {
    .home {
        gap: var(--space-8);
        padding-top: 0;
    }

    .zv-hero, .zv-section {
        padding: 0;
    }

    .zv-compare {
        padding: var(--space-5);
    }

    .zv-cta {
        padding: var(--space-6) var(--space-5);
    }
}

.zv-hero, .zv-section {
    width: 100%;
}

.zv-hero-visual .zv-card {
    padding: var(--space-5);
    gap: var(--space-3);
    box-shadow: 0 8px 24px color-mix(in srgb, var(--ink) 10%, transparent);
}

.visual-head {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

    .visual-head strong {
        font-size: 17px;
    }

.visual-tick {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: var(--success-soft);
    color: var(--success);
}

.visual-link {
    display: flex;
    gap: var(--space-2);
}

    .visual-link span:first-child {
        flex: 1 1 auto;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        padding: 10px var(--space-3);
        border: 1px solid var(--line-control);
        border-radius: var(--radius-sm);
        background: var(--surface-field);
        font-family: var(--font-mono);
        font-size: 13px;
    }

    .visual-link span:last-child {
        padding: 10px 14px;
        border-radius: var(--radius-sm);
        background: var(--accent);
        color: var(--on-accent);
        font-size: 13px;
        font-weight: 700;
        white-space: nowrap;
    }

.visual-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

    .visual-tags span {
        padding: 5px 10px;
        border-radius: var(--radius-full);
        background: var(--accent-soft);
        color: var(--ink);
        font-size: 12px;
        font-weight: 600;
    }

.visual-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 14px var(--space-4);
    background: var(--surface-raised);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    font-size: 14px;
}

    .visual-row .zv-file-type {
        width: 36px;
        height: 36px;
        font-size: 10px;
    }

.visual-name {
    flex: 1 1 auto;
    min-width: 0;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.visual-indent-1 {
    margin-left: 32px;
}

.visual-indent-2 {
    margin-left: 64px;
}

@media (max-width: 600px) {
    .visual-indent-1 {
        margin-left: var(--space-4);
    }

    .visual-indent-2 {
        margin-left: 32px;
    }
}

.zv-cta .zv-btn-primary {
    flex: 0 0 auto;
}

/* Blazor */

#blazor-error-ui {
    background: var(--warning-soft);
    color: var(--ink);
    border-top: 1px solid var(--warning-line);
    bottom: 0;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: var(--danger-soft);
    color: var(--danger);
    border: 1px solid var(--danger);
    padding: 1rem 1.25rem;
    border-radius: var(--radius-sm);
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

/* The home column already has the page gutter; the bundle's sections add their own. */
.home .zv-hero, .home .zv-section {
    padding: 0;
}

.zv-field > .zv-stepper {
    align-self: flex-start;
}

/* The disclosure title sits inside an h2; keep the summary at body weight. */
.zv-disclosure-summary {
    font-weight: 400;
}

/* Home page: the guides under the questions (Pages/Index.razor). */
.home-guides {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

    .home-guides h3 {
        margin: 0;
        font-size: 18px;
        font-weight: 700;
    }

    .home-guides ul {
        margin: 0;
        padding-left: 22px;
        display: flex;
        flex-direction: column;
        gap: var(--space-2);
        font-size: 16px;
        line-height: 1.5;
    }

    .home-guides a {
        font-weight: 600;
    }

/* Guides (Guides/GuideArticle.razor): one readable column with breadcrumbs, the text, the questions and the button. */
.guide-page {
    padding: var(--space-7) 0 var(--space-8);
}

.guide {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
}

.guide-crumbs ol {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    font-size: 14px;
    color: var(--ink-muted);
}

    .guide-crumbs li + li::before {
        content: "›";
        margin-right: var(--space-2);
    }

.guide-title {
    margin: 0;
    font-size: 36px;
    line-height: 1.15;
    font-weight: 800;
    letter-spacing: -0.02em;
    overflow-wrap: break-word;
    hyphens: auto;
}

.guide-prose {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    font-size: 17px;
    line-height: 1.7;
}

    .guide-prose > * {
        margin: 0;
    }

    .guide-prose h2 {
        margin-top: var(--space-5);
        font-size: 24px;
        line-height: 1.25;
        font-weight: 700;
        letter-spacing: -0.01em;
    }

    .guide-prose ul,
    .guide-prose ol {
        padding-left: 22px;
        display: flex;
        flex-direction: column;
        gap: var(--space-2);
    }

/* The tables wrap their text to fit a phone; should a long word not fit, the table scrolls sideways inside its frame,
   never the page. */
.guide-tablewrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
}

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

    .guide-tablewrap table {
        width: 100%;
        border-collapse: collapse;
        font-size: 15px;
        line-height: 1.55;
    }

    .guide-tablewrap thead th,
    .guide-tablewrap thead td {
        text-align: left;
        font-size: 13px;
        font-weight: 700;
        color: var(--ink-muted);
        padding: 10px 12px;
        border-bottom: 1px solid var(--line-control);
        background: var(--surface-sunken);
    }

    .guide-tablewrap tbody th,
    .guide-tablewrap tbody td {
        text-align: left;
        vertical-align: top;
        padding: 12px;
        overflow-wrap: break-word;
        hyphens: auto;
        border-bottom: 1px solid var(--line);
    }

    .guide-tablewrap tbody th {
        font-weight: 700;
    }

    .guide-tablewrap tbody tr:last-child th,
    .guide-tablewrap tbody tr:last-child td {
        border-bottom: none;
    }

.guide-faq {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

    .guide-faq h2 {
        margin: 0;
        font-size: 24px;
        line-height: 1.25;
        font-weight: 700;
    }

.guide-end {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-4);
    padding-top: var(--space-5);
    border-top: 1px solid var(--line);
}

.guide-button {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
}

.guide-button p {
    margin: 0;
    font-size: 14px;
    color: var(--ink-muted);
}

.guide-more {
    margin: 0;
    padding-left: 22px;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    font-size: 16px;
    font-weight: 600;
}

p.guide-more {
    padding-left: 0;
}

.guide-disclaimer {
    margin: 0;
    font-size: 14px;
    color: var(--ink-muted);
}

@media (max-width: 600px) {
    .guide-title {
        font-size: 30px;
    }

    .guide-tablewrap thead th,
    .guide-tablewrap thead td,
    .guide-tablewrap tbody th,
    .guide-tablewrap tbody td {
        padding: 10px 8px;
        font-size: 14px;
    }

    .guide-prose {
        font-size: 16px;
    }
}
