/* The workbench: the app bar, the three parts (form, previews, HTML and checks) and the
   layouts they take at each width, then the previews. Only the workbench loads this.

   Breakpoints, in the 1.2x terms app.css explains:
     720px   phone below it - one column, smaller type, labels shed from the app bar
     1320px  the form beside the rest; the app owns the viewport and each column scrolls
     1800px  the previews and the HTML get a column each */

/* ==== Shell ================================================================= */

:root {
    --og-appbar-h: 3rem;
    --og-mono: 'JetBrains Mono', 'Cascadia Mono', 'Consolas', ui-monospace, monospace;
}

.app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    font-size: 0.875rem;
}

.app :focus-visible {
    outline: 2px solid var(--og-accent);
    outline-offset: 2px;
}

/* ==== App bar =============================================================== */

.appbar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: none;
    box-sizing: border-box;
    height: var(--og-appbar-h);
    padding: 0 1rem;
    background: var(--og-chrome);
    border-bottom: 1px solid var(--og-border);
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: none;
    padding: 0.25rem;
    margin-left: -0.25rem;
    border-radius: 0.375rem;
    color: inherit;
    text-decoration: none;
}

.brand-mark {
    width: 1.625rem;
    height: 1.625rem;
}

/* The mark is the favicon's artwork, recoloured from the theme so the card stays the
   lightest thing in the bar in either palette. */
.brand-mark-card { fill: var(--og-text); }
.brand-mark-image { fill: var(--og-accent); }
.brand-mark-sun { fill: #ffe0d1; }
.brand-mark-hill { fill: color-mix(in srgb, var(--og-accent) 70%, #8a2a0a); }
.brand-mark-line { fill: none; stroke: var(--og-faint); stroke-width: 2.4; stroke-linecap: round; }

.brand-name {
    color: var(--og-text);
    font-size: 1.0625rem;
    font-weight: 700;
    letter-spacing: -0.015em;
}

.brand-name-accent {
    color: var(--og-accent);
}

.brand-tagline {
    padding-left: 0.75rem;
    border-left: 1px solid var(--og-border);
    color: var(--og-muted);
    font-size: 0.8125rem;
    white-space: nowrap;
}

.appbar-spacer {
    flex: 1;
}

.appbar-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.bar-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.3125rem 0.625rem;
    border: 1px solid transparent;
    border-radius: 0.375rem;
    background: transparent;
    color: var(--og-muted);
    font: inherit;
    font-size: 0.8125rem;
    white-space: nowrap;
    cursor: pointer;
}

.bar-btn:hover {
    background: var(--og-chrome-hover);
    border-color: var(--og-border);
    color: var(--og-text);
}

.bar-btn svg,
.action-btn svg,
.ghost-btn svg,
.panel-icon svg {
    width: 1rem;
    height: 1rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.theme-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    flex: none;
    padding: 0.25rem 0.625rem;
    border: 1px solid var(--og-border);
    border-radius: 999px;
    background: transparent;
    color: var(--og-muted);
    font: inherit;
    font-size: 0.75rem;
    cursor: pointer;
}

.theme-btn:hover:not(:disabled) {
    background: var(--og-chrome-hover);
    color: var(--og-text);
}

.theme-btn:disabled {
    cursor: default;
    opacity: 0.6;
}

@media (max-width: 1100px) {
    .brand-tagline {
        display: none;
    }
}

@media (max-width: 720px) {
    .appbar {
        gap: 0.375rem;
        padding: 0 0.625rem;
    }

    .bar-label,
    .theme-btn-label {
        display: none;
    }

    .bar-btn {
        padding: 0.4375rem;
    }
}

/* ==== Jump links (phones) =================================================== */

.jump {
    display: none;
}

@media (max-width: 1319.98px) {
    .jump {
        position: sticky;
        top: var(--og-appbar-h);
        z-index: 4;
        display: flex;
        gap: 0.25rem;
        padding: 0.375rem 0.75rem;
        overflow-x: auto;
        background: color-mix(in srgb, var(--og-chrome-2) 92%, transparent);
        backdrop-filter: blur(8px);
        border-bottom: 1px solid var(--og-border);
        scrollbar-width: none;
    }

    .jump a {
        display: inline-flex;
        align-items: center;
        gap: 0.375rem;
        flex: 1;
        justify-content: center;
        padding: 0.375rem 0.625rem;
        border-radius: 999px;
        color: var(--og-muted);
        font-size: 0.8125rem;
        font-weight: 500;
        text-decoration: none;
        white-space: nowrap;
    }

    .jump a:hover {
        background: var(--og-chrome-hover);
        color: var(--og-text);
    }

    /* The parts the jump links land on clear both sticky bars. */
    .og-col-form,
    .og-col-preview,
    .panel-output,
    .panel-checks {
        scroll-margin-top: calc(var(--og-appbar-h) + 3rem);
    }
}

.jump-badge {
    min-width: 1.125rem;
    padding: 0 0.3125rem;
    border-radius: 999px;
    background: var(--og-warn);
    color: #1a1300;
    font-size: 0.6875rem;
    font-weight: 700;
    line-height: 1.125rem;
    text-align: center;
}

.jump-badge.is-error {
    background: var(--og-bad);
    color: #fff;
}

/* ==== Layout ================================================================ */

/* A phone and a narrow window: one column, the page scrolls. */
.og {
    flex: 1;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
    box-sizing: border-box;
    width: 100%;
    max-width: 52rem;
    margin: 0 auto;
    padding: 1rem;
}

.og-side {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
    align-content: start;
}

.og-col {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
}

@media (max-width: 720px) {
    .og {
        gap: 0.75rem;
        padding: 0.75rem;
    }

    .og-side,
    .og-col {
        gap: 0.75rem;
    }
}

/* The form beside everything else. The app now owns the viewport and each column
   scrolls on its own, so the previews stay in view while the form is filled in. */
@media (min-width: 1320px) {
    html,
    body {
        height: 100%;
        overflow: hidden;
    }

    .app {
        height: 100vh;
        height: 100dvh;
        min-height: 0;
    }

    .og {
        min-height: 0;
        max-width: none;
        grid-template-columns: minmax(25rem, 29rem) minmax(0, 1fr);
        gap: 0;
        padding: 0;
    }

    .og-col-form,
    .og-side {
        min-height: 0;
        overflow-y: auto;
        padding: 1.25rem;
        scrollbar-gutter: stable;
    }

    .og-col-form {
        border-right: 1px solid var(--og-border);
        background: color-mix(in srgb, var(--og-chrome-2) 55%, var(--og-bg));
    }
}

/* Three columns: the previews and the HTML each get one. */
@media (min-width: 1800px) {
    .og-side {
        grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
        gap: 0;
        padding: 0;
        overflow: hidden;
    }

    .og-col-preview,
    .og-col-output {
        min-height: 0;
        overflow-y: auto;
        padding: 1.25rem;
        scrollbar-gutter: stable;
    }

    .og-col-output {
        border-left: 1px solid var(--og-border);
    }
}

.intro {
    margin: 0 0.125rem;
    color: var(--og-muted);
    font-size: 0.875rem;
    line-height: 1.55;
}

.intro code,
.field-help code,
.dialog-text code {
    font-family: var(--og-mono);
    font-size: 0.875em;
    color: var(--og-text);
}

.foot {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    padding: 0.25rem 0.25rem 0.5rem;
    color: var(--og-faint);
    font-size: 0.75rem;
}

.foot a {
    color: var(--og-muted);
}

.foot a:hover {
    color: var(--og-accent);
}

/* ==== Panels ================================================================ */

.panel {
    min-width: 0;
    background: var(--og-pane);
    border: 1px solid var(--og-border);
    border-radius: 0.75rem;
    box-shadow: var(--og-shadow);
}

.panel[hidden] {
    display: none;
}

.panel-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 2.75rem;
    box-sizing: border-box;
    padding: 0.5rem 0.75rem 0.5rem 0.875rem;
    border-bottom: 1px solid var(--og-border-soft);
}

.panel-head-wrap {
    flex-wrap: wrap;
}

.panel-icon {
    display: grid;
    place-items: center;
    flex: none;
    width: 1.625rem;
    height: 1.625rem;
    border-radius: 0.4375rem;
    background: var(--og-accent-wash);
    color: var(--og-accent);
}

.panel-icon svg {
    width: 0.9375rem;
    height: 0.9375rem;
}

.panel-title {
    margin: 0;
    color: var(--og-text);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.panel-count {
    padding: 0.0625rem 0.5rem;
    border-radius: 999px;
    background: var(--og-chrome-hover);
    color: var(--og-muted);
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
}

.panel-count:empty {
    display: none;
}

.panel-spacer {
    flex: 1;
}

.panel-body {
    padding: 0.875rem;
}

/* ==== Form fields =========================================================== */

.fields {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    min-width: 0;
}

.field-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.field-row-3 {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.2fr);
}

@media (max-width: 420px) {
    .field-row {
        grid-template-columns: minmax(0, 1fr);
    }

    .field-row-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .field-row-3 > :last-child {
        grid-column: 1 / -1;
    }
}

.field-head {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    min-width: 0;
}

.field-label {
    color: var(--og-text);
    font-size: 0.8125rem;
    font-weight: 600;
    white-space: nowrap;
}

/* The tag a field becomes - quiet, but there for anyone learning the vocabulary. */
.field-tag {
    min-width: 0;
    overflow: hidden;
    color: var(--og-faint);
    font-family: var(--og-mono);
    font-size: 0.6875rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.field-count {
    margin-left: auto;
    color: var(--og-faint);
    font-family: var(--og-mono);
    font-size: 0.6875rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.field-count.is-near {
    color: var(--og-warn);
}

.field-count.is-over {
    color: var(--og-bad);
    font-weight: 700;
}

.field-input {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    padding: 0.5625rem 0.75rem;
    border: 1px solid var(--og-border);
    border-radius: 0.5rem;
    background: var(--og-field);
    color: var(--og-text);
    font: inherit;
    font-size: 0.9375rem;
    line-height: 1.4;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field-input::placeholder {
    color: var(--og-faint);
}

.field-input:hover {
    border-color: color-mix(in srgb, var(--og-border) 50%, var(--og-muted));
}

.app .field-input:focus-visible,
.dialog .field-input:focus-visible {
    outline: none;
    border-color: var(--og-accent);
    box-shadow: 0 0 0 3px var(--og-accent-wash);
}

/* Grows with what is typed, where the browser can do that. */
textarea.field-input {
    min-height: 4.75rem;
    resize: vertical;
    field-sizing: content;
}

select.field-input {
    padding-right: 2rem;
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--og-muted) 50%),
        linear-gradient(135deg, var(--og-muted) 50%, transparent 50%);
    background-position: calc(100% - 1.05rem) 55%, calc(100% - 0.75rem) 55%;
    background-size: 0.3rem 0.3rem;
    background-repeat: no-repeat;
    cursor: pointer;
}

/* Dates: the picker icon follows the theme. */
input[type="date"].field-input {
    min-height: 2.5rem;
}

.field-help {
    margin: 0;
    color: var(--og-faint);
    font-size: 0.75rem;
    line-height: 1.45;
}

.field-help-wide {
    margin-top: -0.375rem;
}

.field-color {
    display: flex;
    gap: 0.5rem;
}

.field-swatch {
    flex: none;
    box-sizing: border-box;
    width: 2.5rem;
    height: auto;
    min-height: 2.375rem;
    padding: 0.1875rem;
    border: 1px solid var(--og-border);
    border-radius: 0.5rem;
    background: var(--og-field);
    cursor: pointer;
}

.field-swatch::-webkit-color-swatch-wrapper {
    padding: 0;
}

.field-swatch::-webkit-color-swatch {
    border: 0;
    border-radius: 0.3125rem;
}

.field-swatch::-moz-color-swatch {
    border: 0;
    border-radius: 0.3125rem;
}

/* The image field, with a thumbnail of what the previews are showing. */
.image-row {
    display: flex;
    gap: 0.875rem;
    align-items: flex-start;
}

.image-row-fields {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.image-thumb {
    position: relative;
    flex: none;
    display: grid;
    place-items: center;
    width: 7rem;
    aspect-ratio: 1.91;
    margin-top: 1.5rem;
    overflow: hidden;
    border: 1px solid var(--og-border);
    border-radius: 0.5rem;
    background: repeating-linear-gradient(-45deg, var(--og-pane-alt) 0 6px, var(--og-pane) 6px 12px);
}

.image-thumb img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-thumb:not([data-state="loaded"]) img {
    display: none;
}

.image-thumb-note {
    padding: 0 0.375rem;
    color: var(--og-faint);
    font-size: 0.6875rem;
    text-align: center;
}

.image-thumb[data-state="loaded"] .image-thumb-note {
    display: none;
}

.image-thumb[data-state="error"] {
    border-color: color-mix(in srgb, var(--og-bad) 60%, var(--og-border));
}

.image-thumb[data-state="error"] .image-thumb-note {
    color: var(--og-bad);
}

.image-meta {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    min-height: 1.25rem;
    font-size: 0.75rem;
}

.image-size {
    color: var(--og-muted);
    font-variant-numeric: tabular-nums;
}

.image-size.is-ok {
    color: var(--og-ok);
}

.image-size.is-warn {
    color: var(--og-warn);
}

.image-size.is-error {
    color: var(--og-bad);
}

@media (max-width: 420px) {
    .image-row {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .image-thumb {
        width: 100%;
        margin-top: 0;
    }
}

.local {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
}

.local-note {
    color: var(--og-muted);
    font-size: 0.75rem;
}

.local-note[hidden] {
    display: none;
}

.local-note strong {
    color: var(--og-text);
    font-weight: 600;
    word-break: break-all;
}

.ghost-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4375rem;
    padding: 0.375rem 0.75rem;
    border: 1px dashed var(--og-border);
    border-radius: 0.5rem;
    background: transparent;
    color: var(--og-muted);
    font: inherit;
    font-size: 0.8125rem;
    cursor: pointer;
}

.ghost-btn:hover {
    border-color: var(--og-accent-dim);
    background: var(--og-accent-wash);
    color: var(--og-text);
}

.link-btn {
    padding: 0;
    border: 0;
    background: none;
    color: var(--og-accent);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.link-btn:hover {
    text-decoration: underline;
}

.link-btn[hidden] {
    display: none;
}

/* ==== Buttons, tabs, pills ================================================== */

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4375rem;
    padding: 0.4375rem 0.875rem;
    border: 1px solid var(--og-border);
    border-radius: 0.5rem;
    background: var(--og-pane-alt);
    color: var(--og-text);
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
}

.action-btn:hover {
    background: var(--og-chrome-hover);
}

.action-primary {
    border-color: var(--og-accent);
    background: var(--og-accent);
    color: var(--og-accent-ink);
}

.action-primary:hover {
    border-color: var(--og-accent-bright);
    background: var(--og-accent-bright);
}

.action-primary.is-done {
    border-color: var(--og-ok);
    background: var(--og-ok);
    color: #fff;
}

/* The platform tabs. They scroll sideways rather than wrap when there is no room. */
.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    flex-basis: 100%;
    order: 9;
    margin: 0.375rem -0.25rem 0;
    padding: 0 0.25rem 0.125rem;
}

/* On a phone they scroll sideways rather than take three rows. */
@media (max-width: 720px) {
    .tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
    }
}

.tab {
    flex: none;
    padding: 0.375rem 0.5625rem;
    border: 1px solid transparent;
    border-radius: 0.5rem;
    background: transparent;
    color: var(--og-muted);
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
}

.tab:hover:not(.is-on) {
    background: var(--og-chrome-hover);
    color: var(--og-text);
}

.tab.is-on {
    border-color: var(--og-accent-dim);
    background: var(--og-accent-wash);
    color: var(--og-accent);
}

.output-opts {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    padding: 0.625rem 0.875rem;
    border-bottom: 1px solid var(--og-border-soft);
}

.seg {
    display: inline-flex;
    flex: none;
    overflow: hidden;
    border: 1px solid var(--og-border);
    border-radius: 0.4375rem;
}

.seg > button {
    padding: 0.3125rem 0.75rem;
    border: 0;
    background: transparent;
    color: var(--og-muted);
    font: inherit;
    font-size: 0.8125rem;
    white-space: nowrap;
    cursor: pointer;
}

.seg > button + button {
    border-left: 1px solid var(--og-border);
}

.seg > button:hover:not(.is-on) {
    background: var(--og-chrome-hover);
    color: var(--og-text);
}

.seg > button.is-on {
    background: var(--og-accent-wash);
    color: var(--og-accent);
    font-weight: 600;
}

.pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3125rem;
    padding: 0.25rem 0.625rem;
    border: 1px solid var(--og-border);
    border-radius: 999px;
    background: transparent;
    color: var(--og-muted);
    font: inherit;
    font-size: 0.75rem;
    white-space: nowrap;
    cursor: pointer;
}

.pill::before {
    content: "";
    width: 0.4375rem;
    height: 0.4375rem;
    border-radius: 50%;
    border: 1px solid currentColor;
}

.pill:hover {
    border-color: var(--og-accent-dim);
    color: var(--og-text);
}

.pill.is-on {
    border-color: var(--og-accent-dim);
    background: var(--og-accent-wash);
    color: var(--og-accent);
}

.pill.is-on::before {
    background: currentColor;
}

/* ==== The HTML ============================================================== */

.code {
    margin: 0;
    padding: 0.875rem 1rem 1rem;
    max-height: 32rem;
    overflow: auto;
    border-radius: 0 0 0.75rem 0.75rem;
    background: var(--og-pane-alt);
    color: var(--og-text);
    font-family: var(--og-mono);
    font-size: 0.78125rem;
    line-height: 1.65;
    tab-size: 4;
    /* Long attribute values wrap under their own line rather than running off. */
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* With a column of its own, the HTML fills it and scrolls inside, so the checks under it
   stay in view however long the code is. */
@media (min-width: 1800px) {
    .og-col-output {
        overflow: hidden;
    }

    .panel-output {
        display: flex;
        flex-direction: column;
        flex: 1 1 auto;
        min-height: 14rem;
    }

    .code {
        flex: 1;
        min-height: 0;
        max-height: none;
    }

    .panel-checks {
        flex: 0 1 auto;
        min-height: 0;
        max-height: 45%;
        overflow-y: auto;
    }
}

.code .t-punct { color: var(--og-muted); }
.code .t-tag { color: var(--og-code-tag); }
.code .t-attr { color: var(--og-code-attr); }
.code .t-value { color: var(--og-code-value); }
.code .t-comment { color: var(--og-code-comment); font-style: italic; }

/* ==== Checks ================================================================ */

.score {
    font-size: 0.75rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.score.is-ok { color: var(--og-ok); }
.score.is-warn { color: var(--og-warn); }
.score.is-error { color: var(--og-bad); }

.checks {
    margin: 0;
    padding: 0.375rem 0;
    list-style: none;
}

.check {
    display: flex;
    gap: 0.625rem;
    padding: 0.4375rem 0.875rem;
    color: var(--og-text);
    font-size: 0.8125rem;
    line-height: 1.45;
}

.check + .check {
    border-top: 1px solid var(--og-border-soft);
}

.check-icon {
    display: grid;
    place-items: center;
    flex: none;
    width: 1.125rem;
    height: 1.125rem;
    margin-top: 0.0625rem;
    border-radius: 50%;
    font-size: 0.6875rem;
    font-weight: 800;
    line-height: 1;
}

.check-ok .check-icon {
    background: color-mix(in srgb, var(--og-ok) 18%, transparent);
    color: var(--og-ok);
}

.check-warn .check-icon {
    background: color-mix(in srgb, var(--og-warn) 20%, transparent);
    color: var(--og-warn);
}

.check-error .check-icon {
    background: color-mix(in srgb, var(--og-bad) 20%, transparent);
    color: var(--og-bad);
}

.check-ok {
    color: var(--og-muted);
}

/* ==== Import dialog ========================================================= */

.dialog {
    box-sizing: border-box;
    width: min(40rem, calc(100vw - 2rem));
    max-height: calc(100vh - 2rem);
    padding: 0;
    border: 1px solid var(--og-border);
    border-radius: 0.875rem;
    background: var(--og-pane);
    color: var(--og-text);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
    font-size: 0.875rem;
}

.dialog::backdrop {
    background: rgba(5, 6, 8, 0.6);
    backdrop-filter: blur(2px);
}

.dialog-inner {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.25rem;
}

.dialog-title {
    margin: 0;
    font-size: 1.0625rem;
    font-weight: 700;
}

.dialog-text {
    margin: 0;
    color: var(--og-muted);
    line-height: 1.5;
}

.dialog-source {
    min-height: 12rem;
    font-family: var(--og-mono);
    font-size: 0.8125rem;
}

.dialog-error {
    margin: 0;
    color: var(--og-bad);
    font-size: 0.8125rem;
}

.dialog-error[hidden] {
    display: none;
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* ==== Toast ================================================================= */

.toast {
    position: fixed;
    left: 50%;
    bottom: 1.25rem;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 0.875rem;
    max-width: calc(100vw - 2rem);
    padding: 0.625rem 0.75rem 0.625rem 1rem;
    border: 1px solid var(--og-border);
    border-radius: 0.625rem;
    background: var(--og-chrome);
    color: var(--og-text);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
    font-size: 0.8125rem;
    transform: translateX(-50%);
    animation: toast-in 0.18s ease;
}

.toast[hidden] {
    display: none;
}

.toast-undo {
    padding: 0.25rem 0.625rem;
    border: 1px solid var(--og-accent-dim);
    border-radius: 0.375rem;
    background: var(--og-accent-wash);
    color: var(--og-accent);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.toast-undo[hidden] {
    display: none;
}

@keyframes toast-in {
    from { opacity: 0; transform: translate(-50%, 0.5rem); }
}

@media (prefers-reduced-motion: reduce) {
    .toast {
        animation: none;
    }
}

/* ==== Previews: the list ==================================================== */

/* "All" lays the previews out as a masonry of columns, as many as fit; a single
   platform gets the panel to itself at a realistic width. */
.pv-list {
    padding: 1rem;
    columns: 16rem;
    column-gap: 1rem;
}

/* A search result is wide and short, so in "All" it runs across the top. */
.pv-list[data-show="all"] .pv-google {
    column-span: all;
}

.pv-list:not([data-show="all"]) {
    columns: auto;
}

.pv {
    break-inside: avoid;
    margin: 0 0 1rem;
}

.pv-list[data-show="all"] .pv:last-child {
    margin-bottom: 0;
}

.pv-list:not([data-show="all"]) .pv {
    display: none;
    max-width: 34rem;
    margin: 0.5rem auto;
}

.pv-list[data-show="google"] .pv-google,
.pv-list[data-show="facebook"] .pv-facebook,
.pv-list[data-show="x"] .pv-x,
.pv-list[data-show="linkedin"] .pv-linkedin,
.pv-list[data-show="discord"] .pv-discord,
.pv-list[data-show="slack"] .pv-slack,
.pv-list[data-show="whatsapp"] .pv-whatsapp {
    display: block;
}

.pv-list[data-show="google"] .pv-google {
    max-width: 40rem;
}

.pv-label {
    margin: 0 0 0.4375rem 0.125rem;
    color: var(--og-muted);
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.pv-list:not([data-show="all"]) .pv-label {
    display: none;
}

/* Each platform's own surface. The colours are each platform's, in its light or dark
   look to match the app's theme - `light-dark()` picks by the `color-scheme` app.css
   sets, so one declaration covers both. */
.pv-frame {
    overflow: hidden;
    padding: 0.875rem;
    border: 1px solid var(--pv-line);
    border-radius: 0.625rem;
    background: var(--pv-bg);
    color: var(--pv-text);
    font-family: var(--pv-font, 'Segoe UI', system-ui, -apple-system, Helvetica, Arial, sans-serif);
    font-size: 0.875rem;
    line-height: 1.35;
}

/* Text the user has not given: a placeholder, or (when the platform would show nothing)
   not there at all. */
.pv [data-bind].is-empty {
    opacity: 0.45;
    font-style: italic;
}

.pv [data-bind][hidden] {
    display: none !important;
}

.pv-avatar {
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff9f6e, #e0572e);
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    font-style: normal !important;
    opacity: 1 !important;
}

.pv-post {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    margin-bottom: 0.75rem;
}

.pv-post-who {
    display: flex;
    flex-direction: column;
    min-width: 0;
    font-size: 0.8125rem;
}

.pv-post-who strong {
    overflow: hidden;
    color: var(--pv-text);
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pv-post-who span {
    color: var(--pv-sub);
    font-size: 0.75rem;
}

/* An image slot. Without an image it is not there; when one fails to load it shows a
   placeholder in its place, so the layout of the card is still judged. */
.pv-img {
    position: relative;
    overflow: hidden;
    background: var(--pv-img-bg, rgba(127, 127, 127, 0.15));
}

.pv-img img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pv-list.no-image .pv-img {
    display: none !important;
}

.pv-list.image-error .pv-img img {
    visibility: hidden;
}

.pv-list.image-error .pv-img::after {
    content: "Image did not load";
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: repeating-linear-gradient(-45deg, rgba(127, 127, 127, 0.12) 0 8px, rgba(127, 127, 127, 0.2) 8px 16px);
    padding: 0.25rem;
    color: var(--pv-sub);
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
}

/* Lines that platforms cut off after N lines. */
.clamp-1,
.fb-desc,
.li-domain,
.x-domain,
.g-crumb,
.wa-domain {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ==== Google ================================================================ */

.pv-google {
    --pv-bg: light-dark(#ffffff, #1f1f1f);
    --pv-line: light-dark(#e3e3e3, #3c4043);
    --pv-text: light-dark(#474747, #bfbfbf);
    --pv-sub: light-dark(#4d5156, #9aa0a6);
    --pv-font: Arial, 'Segoe UI', sans-serif;
}

.pv-google .pv-frame {
    padding: 1rem 1.125rem;
}

.g-result {
    display: flex;
    gap: 1rem;
}

.g-main {
    flex: 1;
    min-width: 0;
}

.g-site {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    margin-bottom: 0.3125rem;
}

.g-favicon {
    width: 1.75rem;
    height: 1.75rem;
    font-size: 0.75rem;
    border: 1px solid var(--pv-line);
}

.g-site-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.25;
}

.g-site-name {
    color: light-dark(#202124, #dadce0);
    font-size: 0.875rem;
}

.g-crumb {
    color: var(--pv-sub);
    font-size: 0.75rem;
}

.g-title {
    margin: 0 0 0.25rem;
    overflow: hidden;
    color: light-dark(#1a0dab, #99c3ff);
    font-size: 1.25rem;
    font-weight: 400;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.g-desc {
    display: -webkit-box;
    margin: 0;
    overflow: hidden;
    color: var(--pv-sub);
    font-size: 0.875rem;
    line-height: 1.58;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.g-date {
    color: light-dark(#70757a, #9aa0a6);
}

.g-date:not(:empty)::after {
    content: "\00a0\2014\00a0";
}

.g-thumb {
    flex: none;
    width: 5.75rem;
    height: 5.75rem;
    margin-top: 1.75rem;
    border-radius: 0.5rem;
}

/* ==== Facebook ============================================================== */

.pv-facebook {
    --pv-bg: light-dark(#ffffff, #242526);
    --pv-line: light-dark(#dadde1, #3e4042);
    --pv-text: light-dark(#050505, #e4e6eb);
    --pv-sub: light-dark(#65676b, #b0b3b8);
    --pv-font: 'Segoe UI', Helvetica, Arial, sans-serif;
}

.pv-facebook .pv-frame {
    padding: 0.75rem 0 0;
}

.pv-facebook .pv-post {
    padding: 0 0.875rem;
}

.fb-card {
    border-top: 1px solid var(--pv-line);
}

.fb-img {
    aspect-ratio: 1.91;
}

.fb-body {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    padding: 0.625rem 0.875rem 0.75rem;
    background: light-dark(#f0f2f5, #3a3b3c);
}

.fb-domain {
    color: var(--pv-sub);
    font-size: 0.75rem;
    text-transform: uppercase;
}

.fb-title {
    display: -webkit-box;
    overflow: hidden;
    color: var(--pv-text);
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.3;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.fb-desc {
    color: var(--pv-sub);
    font-size: 0.875rem;
}

/* ==== X ===================================================================== */

.pv-x {
    --pv-bg: light-dark(#ffffff, #000000);
    --pv-line: light-dark(#cfd9de, #2f3336);
    --pv-text: light-dark(#0f1419, #e7e9ea);
    --pv-sub: light-dark(#536471, #71767b);
    --pv-font: 'Segoe UI', -apple-system, Roboto, Helvetica, Arial, sans-serif;
}

.x-card {
    overflow: hidden;
    border: 1px solid var(--pv-line);
    border-radius: 1rem;
}

.x-img {
    aspect-ratio: 1.91;
}

/* Large card: the title sits on the image, the text block is not shown. */
.x-overlay {
    position: absolute;
    left: 0.75rem;
    bottom: 0.75rem;
    max-width: calc(100% - 1.5rem);
    box-sizing: border-box;
    padding: 0.125rem 0.375rem;
    overflow: hidden;
    border-radius: 0.25rem;
    background: rgba(0, 0, 0, 0.77);
    color: #fff;
    font-size: 0.8125rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.x-body {
    display: none;
}

.x-from {
    display: block;
    margin-top: 0.25rem;
    color: var(--pv-sub);
    font-size: 0.8125rem;
}

/* Summary card: a square thumbnail beside the text. */
.pv-list[data-card="summary"] .x-card {
    display: flex;
}

.pv-list[data-card="summary"] .x-img {
    flex: none;
    width: 8rem;
    aspect-ratio: 1;
    border-right: 1px solid var(--pv-line);
}

.pv-list[data-card="summary"] .x-overlay,
.pv-list[data-card="summary"] .x-from {
    display: none;
}

.pv-list[data-card="summary"] .x-body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.125rem;
    min-width: 0;
    padding: 0.625rem 0.75rem;
    font-size: 0.875rem;
}

.x-domain {
    color: var(--pv-sub);
}

.x-title {
    overflow: hidden;
    color: var(--pv-text);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.x-desc {
    display: -webkit-box;
    overflow: hidden;
    color: var(--pv-sub);
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

/* ==== LinkedIn ============================================================== */

.pv-linkedin {
    --pv-bg: light-dark(#ffffff, #1b1f23);
    --pv-line: light-dark(#e0dfdc, #38434f);
    --pv-text: light-dark(rgba(0, 0, 0, 0.9), rgba(255, 255, 255, 0.9));
    --pv-sub: light-dark(rgba(0, 0, 0, 0.6), rgba(255, 255, 255, 0.6));
    --pv-font: -apple-system, system-ui, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

.pv-linkedin .pv-frame {
    padding: 0.75rem 0 0;
}

.pv-linkedin .pv-post {
    padding: 0 0.875rem;
}

.li-img {
    aspect-ratio: 1.91;
}

.li-body {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.625rem 0.875rem 0.75rem;
    background: light-dark(#edf3f8, #293138);
}

.li-title {
    display: -webkit-box;
    overflow: hidden;
    color: var(--pv-text);
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.35;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.li-domain {
    color: var(--pv-sub);
    font-size: 0.75rem;
}

/* ==== Chat (Discord, Slack) ================================================= */

.chat-msg {
    display: flex;
    gap: 0.75rem;
}

.chat-avatar {
    background: linear-gradient(135deg, #7b8cff, #4f5bd5);
}

.chat-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.chat-who {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.chat-who strong {
    color: var(--pv-text);
    font-weight: 700;
}

.chat-who span {
    color: var(--pv-sub);
    font-size: 0.6875rem;
}

.chat-link {
    color: var(--pv-link);
    overflow-wrap: anywhere;
}

.chat-link.is-empty {
    color: var(--pv-sub);
}

/* ==== Discord =============================================================== */

.pv-discord {
    --pv-bg: light-dark(#ffffff, #313338);
    --pv-line: light-dark(#e3e5e8, #26272b);
    --pv-text: light-dark(#313338, #dbdee1);
    --pv-sub: light-dark(#5c5e66, #949ba4);
    --pv-link: light-dark(#006ce7, #00a8fc);
    --pv-font: 'gg sans', 'Noto Sans', 'Segoe UI', Helvetica, Arial, sans-serif;
}

/* The bar down the left is the page's theme-color, as Discord draws it. */
.dc-embed {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.625rem;
    max-width: 27rem;
    margin-top: 0.25rem;
    padding: 0.625rem 0.875rem 0.875rem 0.75rem;
    border-left: 4px solid var(--pv-theme, light-dark(#e3e5e8, #1e1f22));
    border-radius: 0.25rem;
    background: light-dark(#f2f3f5, #2b2d31);
}

.dc-text {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    min-width: 0;
}

.dc-site {
    color: var(--pv-text);
    font-size: 0.75rem;
}

.dc-title {
    color: var(--pv-link);
    font-size: 0.9375rem;
    font-weight: 600;
}

.dc-desc {
    color: var(--pv-text);
    font-size: 0.8125rem;
    line-height: 1.4;
}

.dc-img {
    border-radius: 0.25rem;
    aspect-ratio: 1.91;
}

/* Summary card: Discord moves the image to a thumbnail on the right. */
.pv-list[data-card="summary"] .dc-embed {
    grid-template-columns: minmax(0, 1fr) 5rem;
}

.pv-list[data-card="summary"] .dc-img {
    width: 5rem;
    height: 5rem;
    aspect-ratio: auto;
}

/* ==== Slack ================================================================= */

.pv-slack {
    --pv-bg: light-dark(#ffffff, #1a1d21);
    --pv-line: light-dark(#dddddd, #35373b);
    --pv-text: light-dark(#1d1c1d, #d1d2d3);
    --pv-sub: light-dark(#616061, #ababad);
    --pv-link: light-dark(#1264a3, #1d9bd1);
    --pv-font: Lato, 'Slack-Lato', 'Segoe UI', Helvetica, Arial, sans-serif;
}

.sl-unfurl {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-top: 0.25rem;
    padding-left: 0.75rem;
    border-left: 4px solid light-dark(#dddddd, #35373b);
}

.sl-site {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    color: var(--pv-text);
    font-size: 0.8125rem;
    font-weight: 700;
}

.sl-favicon {
    width: 1rem;
    height: 1rem;
    border-radius: 0.1875rem;
    font-size: 0.5625rem;
}

.sl-title {
    color: var(--pv-link);
    font-size: 0.9375rem;
    font-weight: 700;
}

.sl-desc {
    color: var(--pv-text);
    font-size: 0.875rem;
    line-height: 1.45;
}

.sl-img {
    max-width: 22rem;
    margin-top: 0.375rem;
    border: 1px solid var(--pv-line);
    border-radius: 0.5rem;
    aspect-ratio: 1.91;
}

/* ==== WhatsApp ============================================================== */

.pv-whatsapp {
    --pv-bg: light-dark(#efeae2, #0b141a);
    --pv-line: light-dark(#e2dcd3, #1f2c33);
    --pv-text: light-dark(#111b21, #e9edef);
    --pv-sub: light-dark(#667781, #8696a0);
    --pv-link: light-dark(#027eb5, #53bdeb);
    --pv-font: 'Segoe UI', Helvetica, 'Helvetica Neue', Arial, sans-serif;
}

.pv-whatsapp .pv-frame {
    padding: 1rem;
}

.wa-bubble {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    max-width: 21rem;
    margin-left: auto;
    padding: 0.25rem 0.25rem 0.375rem;
    border-radius: 0.5rem 0 0.5rem 0.5rem;
    background: light-dark(#d9fdd3, #005c4b);
    box-shadow: 0 1px 0.5px rgba(11, 20, 26, 0.13);
}

.wa-card {
    overflow: hidden;
    border-radius: 0.375rem;
    background: light-dark(#d1f4cc, #025144);
}

.wa-img {
    aspect-ratio: 1.91;
}

.wa-body {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    padding: 0.5rem 0.625rem;
}

.wa-title {
    display: -webkit-box;
    overflow: hidden;
    color: var(--pv-text);
    font-size: 0.875rem;
    font-weight: 600;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.wa-desc {
    display: -webkit-box;
    overflow: hidden;
    color: var(--pv-sub);
    font-size: 0.75rem;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.wa-domain {
    color: var(--pv-sub);
    font-size: 0.75rem;
}

.wa-link {
    padding: 0 0.375rem;
    color: var(--pv-link);
    font-size: 0.875rem;
    overflow-wrap: anywhere;
}

.wa-link.is-empty {
    color: var(--pv-sub);
}

.wa-time {
    align-self: flex-end;
    padding: 0 0.375rem;
    color: var(--pv-sub);
    font-size: 0.6875rem;
}

.wa-ticks {
    color: #53bdeb;
}
