/* ==========================================================================
   Reprographics — ink on bond paper.

   The sheet is the interface: a white plate on a grey press bed, carrying the
   one thing the page is for, the format transformation. Everything else is
   measured and quiet. The only accent is a highlighter mark, and it is spent
   on the single word in the heading that changes from domain to domain.
   ========================================================================== */

:root {
    /* Ink never goes to pure black; press black is slightly cool. */
    --ink: #17191D;
    --ink-2: #474D55;
    --ink-3: #656C75;

    --paper: #FFFFFF;
    --stock: #EAEDEF;
    --rule: #CDD3D8;
    --rule-soft: #E2E6E9;

    --mark: #FFE55C;
    --mark-wash: #FFF6CE;
    --focus: #0B57D0;
    --stop: #A32B22;

    --font-display: 'Archivo', 'Helvetica Neue', Arial, sans-serif;
    --font-body: 'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;

    --measure: 40rem;
    --wrap: 58rem;
    --gutter: clamp(1.25rem, 5vw, 3rem);
    --band: clamp(2.25rem, 5vw, 3.5rem);
}

/* --- Baseline ------------------------------------------------------------ */

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

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

body {
    margin: 0;
    padding: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 1.0625rem;
    line-height: 1.6;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: -0.018em;
    line-height: 1.15;
    text-wrap: balance;
    margin: 0;
}

/* Sizes live here and nowhere else, so a section class can never fight them. */
h1 {
    font-size: clamp(1.875rem, 1.4rem + 2vw, 2.5rem);
    font-weight: 800;
    letter-spacing: -0.028em;
}

h2 {
    font-size: clamp(1.375rem, 1.1rem + 1vw, 1.75rem);
}

h3 {
    font-size: 1.0625rem;
    letter-spacing: -0.01em;
}

p {
    margin: 0;
}

a {
    color: var(--ink);
    text-decoration-color: var(--rule);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
    transition: text-decoration-color 120ms ease;
}

a:hover {
    text-decoration-color: var(--ink);
}

/* FocusOnNavigate parks focus on each page's <h1> so screen readers land in the
   right place. It is not a control, so it does not wear a ring. */
h1:focus {
    outline: none;
}

/* Rings go on things you can act on. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
[tabindex='0']:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 3px;
    border-radius: 1px;
}

img {
    max-width: 100%;
    height: auto;
}

/* --- Shared shapes -------------------------------------------------------
   .wrap is the only horizontal container. .band is the only vertical rhythm.
   Nothing else sets section padding, so the two can never cancel out.        */

.wrap {
    max-width: var(--wrap);
    margin-inline: auto;
    padding-inline: var(--gutter);
}

.band {
    padding-block: var(--band);
}

.band + .band {
    border-top: 1px solid var(--rule-soft);
}

.prose {
    max-width: var(--measure);
}

.prose > * + * {
    margin-top: 1rem;
}

.prose > h2 + *,
.prose > h3 + * {
    margin-top: 0.65rem;
}

.prose h2 {
    margin-top: 2.75rem;
}

.prose > h2:first-child {
    margin-top: 0;
}

.prose ul {
    padding-left: 1.15rem;
    margin: 0;
}

.prose li + li {
    margin-top: 0.55rem;
}

.prose code {
    font-family: var(--font-mono);
    font-size: 0.875em;
    color: var(--ink);
    background: var(--stock);
    border-radius: 2px;
    padding: 0.1em 0.3em;
}

/* A caption, an eyebrow, a unit — anything that labels rather than reads. */
.label {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-3);
}

/* The highlighter. A swipe across the text, not a filled box behind it. */
.mark {
    background: linear-gradient(
        to bottom,
        transparent 24%,
        var(--mark) 24%,
        var(--mark) 96%,
        transparent 96%
    );
    color: var(--ink);
    padding-inline: 0.12em;
}

/* --- Masthead ------------------------------------------------------------ */

/* Full-bleed rule, like the hero and the colophon; the content inside is wrapped. */
.masthead {
    border-bottom: 1px solid var(--rule);
}

.masthead__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-block: 1.125rem;
}

/* The site answers on several domains, so the wordmark is the host itself. */
.wordmark {
    font-family: var(--font-mono);
    font-size: 0.9375rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    text-decoration: none;
    color: var(--ink);
}

.switch {
    display: flex;
    border: 1px solid var(--rule);
    border-radius: 3px;
    overflow: hidden;
    background: var(--paper);
}

.switch__opt {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    padding: 0.4rem 0.85rem;
    text-decoration: none;
    color: var(--ink-2);
    white-space: nowrap;
    transition: background-color 120ms ease, color 120ms ease;
}

.switch__opt + .switch__opt {
    border-left: 1px solid var(--rule);
}

.switch__opt:hover {
    background: var(--stock);
    color: var(--ink);
}

.switch__opt[aria-current='page'] {
    background: var(--ink);
    color: var(--paper);
}

/* --- Hero: the press bed ------------------------------------------------- */

.hero {
    background: var(--stock);
    border-bottom: 1px solid var(--rule);
}

.hero__inner {
    padding-block: clamp(2.25rem, 6vw, 3.75rem);
}

.hero__title {
    font-size: clamp(2rem, 1.3rem + 3vw, 3.125rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    max-width: 18ch;
}

.hero__standfirst {
    margin: 0.9rem 0 0;
    max-width: 52ch;
    color: var(--ink-2);
    font-size: 1.0625rem;
}

/* --- The plate ----------------------------------------------------------- */

.plate-set {
    margin-top: clamp(1.75rem, 4vw, 2.5rem);
}

.plate {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    min-height: 15rem;
    padding: clamp(1.5rem, 5vw, 3rem);
    background: var(--paper);
    border: 1px solid var(--rule);
    border-radius: 2px;
    box-shadow: 0 1px 2px rgba(23, 25, 29, 0.05), 0 8px 24px -12px rgba(23, 25, 29, 0.22);
    transition: border-color 140ms ease, box-shadow 140ms ease;
}

/* Corners appear only while a file is over the plate: state, not decoration. */
.plate::before,
.plate::after {
    content: '';
    position: absolute;
    width: 1.5rem;
    height: 1.5rem;
    opacity: 0;
    transition: opacity 140ms ease;
    pointer-events: none;
}

.plate::before {
    top: -0.5rem;
    left: -0.5rem;
    border-top: 2px solid var(--ink);
    border-left: 2px solid var(--ink);
}

.plate::after {
    bottom: -0.5rem;
    right: -0.5rem;
    border-bottom: 2px solid var(--ink);
    border-right: 2px solid var(--ink);
}

.plate.is-over {
    border-color: var(--ink);
    background: var(--mark-wash);
}

.plate.is-over::before,
.plate.is-over::after {
    opacity: 1;
}

.plate.is-over .transform__fmt--from {
    color: var(--ink);
}

/* The transformation, set as the largest thing on the page. */
.transform {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(0.75rem, 2.2vw, 1.25rem);
    width: 100%;
}

.transform__fmt {
    font-family: var(--font-mono);
    font-size: clamp(1.5rem, 0.8rem + 3.4vw, 3rem);
    font-weight: 600;
    letter-spacing: -0.035em;
    line-height: 1;
    white-space: nowrap;
}

.transform__fmt--from {
    color: var(--ink-3);
    text-align: right;
}

.transform__fmt--from.is-loaded {
    color: var(--ink);
}

.transform__fmt--to {
    color: var(--ink);
    text-align: left;
}

/* A rule with a head, and a fill that travels it while the file converts. */
.transform__arrow {
    position: relative;
    flex: 0 1 6rem;
    height: 2px;
    background: var(--rule);
}

.transform__arrow::after {
    content: '';
    position: absolute;
    right: -1px;
    top: 50%;
    translate: 0 -50%;
    border-block: 6px solid transparent;
    border-left: 11px solid var(--rule);
}

.transform__fill {
    position: absolute;
    inset: 0 auto 0 0;
    width: 0;
    background: var(--ink);
}

.is-converting .transform__arrow {
    background: var(--rule);
}

.is-converting .transform__arrow::after {
    border-left-color: var(--ink);
}

.is-converting .transform__fill {
    animation: travel 2.4s cubic-bezier(0.32, 0.72, 0.3, 1) infinite;
}

@keyframes travel {
    0% { width: 0; }
    70% { width: 100%; }
    100% { width: 100%; }
}

.plate__hint {
    font-size: 0.9375rem;
    color: var(--ink-2);
    text-align: center;
}

.plate__file {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: var(--ink);
    word-break: break-all;
    text-align: center;
}

/* A dimension line, the way a drawing states a limit. */
.dim {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.875rem;
    color: var(--ink-3);
}

/* Tall boxes carrying a centred 1px rule, so the end borders read as ticks. */
.dim::before,
.dim::after {
    content: '';
    flex: 1;
    height: 7px;
    background: linear-gradient(var(--rule), var(--rule)) center / 100% 1px no-repeat;
}

.dim::before {
    border-left: 1px solid var(--rule);
}

.dim::after {
    border-right: 1px solid var(--rule);
}

/* --- Controls ------------------------------------------------------------ */

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.625rem;
    margin-top: 1.25rem;
}

.btn {
    font-family: var(--font-body);
    font-size: 0.9375rem;
    font-weight: 500;
    line-height: 1.2;
    padding: 0.6rem 1.1rem;
    border: 1px solid var(--ink);
    border-radius: 3px;
    background: var(--ink);
    color: var(--paper);
    cursor: pointer;
    transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease;
}

.btn:hover:not(:disabled) {
    background: #000;
}

.btn--quiet {
    background: transparent;
    color: var(--ink);
    border-color: var(--rule);
}

.btn--quiet:hover:not(:disabled) {
    background: var(--paper);
    border-color: var(--ink);
}

.btn--danger {
    background: transparent;
    color: var(--stop);
    border-color: var(--rule);
}

.btn--danger:hover:not(:disabled) {
    background: transparent;
    border-color: var(--stop);
}

.btn:disabled {
    opacity: 0.38;
    cursor: not-allowed;
}

/* --- Accepted formats ---------------------------------------------------- */

.accepts {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.5rem 0.75rem;
    margin-top: 1.5rem;
}

.accepts__list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.accepts__list li {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    color: var(--ink-2);
    background: var(--paper);
    border: 1px solid var(--rule);
    border-radius: 2px;
    padding: 0.1rem 0.45rem;
}

/* --- FAQ ----------------------------------------------------------------- */

.faq {
    max-width: var(--measure);
    margin-top: 1.5rem;
    border-top: 1px solid var(--rule-soft);
}

.faq__item {
    padding-block: 1.375rem;
    border-bottom: 1px solid var(--rule-soft);
}

.faq__item p {
    margin: 0.4rem 0 0;
    color: var(--ink-2);
}

.figure {
    margin: 1.25rem 0 0;
}

.figure img {
    display: block;
    width: 26rem;
    max-width: 100%;
    border: 1px solid var(--rule);
    border-radius: 2px;
}

.figure figcaption {
    margin-top: 0.5rem;
}

/* --- Support ------------------------------------------------------------- */

.support {
    max-width: var(--measure);
}

.support p {
    color: var(--ink-2);
    margin: 0.65rem 0 1.5rem;
}

/* --- Footer -------------------------------------------------------------- */

.colophon {
    border-top: 1px solid var(--rule);
    background: var(--stock);
}

.colophon__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem 1.5rem;
    padding-block: 1.5rem;
}

.colophon__links {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
}

.colophon a {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    color: var(--ink-2);
    text-decoration: none;
}

.colophon a:hover {
    color: var(--ink);
    text-decoration: underline;
}

/* --- Debug output (DEBUG builds only) ------------------------------------ */

.debug-errors:not(:empty) {
    display: block;
    margin-top: 1.5rem;
    padding: 0.75rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    white-space: pre-wrap;
    color: var(--stop);
    border: 1px solid var(--rule);
    background: var(--paper);
}

/* --- Narrow screens ------------------------------------------------------
   The transformation turns to read top-to-bottom rather than shrinking to
   nothing; the arrow rotates with it.                                        */

@media (max-width: 30rem) {
    .transform {
        flex-direction: column;
        gap: 1.1rem;
    }

    .transform__fmt--from,
    .transform__fmt--to {
        text-align: center;
    }

    .transform__arrow {
        flex: none;
        width: 2px;
        height: 3rem;
        background: var(--rule);
    }

    .transform__arrow::after {
        right: 50%;
        top: auto;
        bottom: -1px;
        translate: 50% 0;
        border-block: none;
        border-inline: 5px solid transparent;
        border-top: 9px solid var(--rule);
        border-left: none;
    }

    .is-converting .transform__arrow::after {
        border-left-color: transparent;
        border-top-color: var(--ink);
    }

    .transform__fill {
        inset: 0 0 auto 0;
        width: auto;
        height: 0;
    }

    .is-converting .transform__fill {
        animation-name: travel-down;
    }

    @keyframes travel-down {
        0% { height: 0; }
        70% { height: 100%; }
        100% { height: 100%; }
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }

    /* Without travel, the arrow still has to read as "in progress". */
    .is-converting .transform__fill {
        width: 100%;
        height: 100%;
    }
}

/* --- MudBlazor: only the snackbar is still its own ------------------------ */

.mud-snackbar,
.mud-snackbar-content-message {
    font-family: var(--font-body);
}

/* --- Blazor framework ----------------------------------------------------- */

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4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