/*
 * Shared components: the site chrome (header, masthead, footer), buttons, cards, the pixel
 * progress bar and the filter controls. Anything used on more than one page lives here.
 */

/*
 * `hidden` is an attribute, not a suggestion. The user-agent rule behind it is a bare
 * `display: none`, which any class here that sets its own `display` outranks — so a hidden
 * button would keep sitting on the page. Every widget hides things with the attribute, so
 * the attribute has to win.
 */
[hidden] {
    display: none !important;
}


/* ── Buttons ──────────────────────────────────────────────────────────────────────────── */

.pp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    font-family: var(--sans);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.01em;
    border: 1px solid var(--ink);
    background: transparent;
    color: var(--ink);
    cursor: pointer;
    text-decoration: none;
    transition: background 150ms, color 150ms, transform 150ms;
}

.pp-btn:hover {
    background: var(--ink);
    color: var(--bg);
}

.pp-btn:active {
    transform: translateY(1px);
}

.pp-btn[aria-disabled="true"] {
    opacity: 0.5;
    cursor: default;
}

.pp-btn[aria-disabled="true"]:hover {
    background: transparent;
    color: var(--ink);
}

.pp-btn-primary {
    background: var(--ink);
    color: var(--bg);
    border-color: var(--ink);
}

.pp-btn-primary:hover {
    background: var(--accent-strong);
    border-color: var(--accent-strong);
    color: var(--bg);
}

/* A button that is only a word: "Clear", "Sign out". */
.pp-btn-quiet {
    font-family: var(--mono);
    font-size: var(--eyebrow-size);
    letter-spacing: 0.08em;
    background: none;
    border: none;
    padding: 0;
    color: var(--accent-strong);
    cursor: pointer;
}

/* ── Site header and masthead ─────────────────────────────────────────────────────────── */

.pp-header {
    background: var(--bg);
    border-bottom: 1px solid var(--rule);
    position: sticky;
    top: 0;
    z-index: 50;
}

.pp-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 40px;
    padding-block: 22px;
}

.pp-logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--ink);
    flex-shrink: 0;
}

.pp-logo-mark {
    display: block;
}

.pp-logo-word {
    font-family: var(--serif-display);
    font-size: 21px;
    letter-spacing: -0.01em;
}

.pp-search {
    flex: 1;
    max-width: 520px;
    position: relative;
}

.pp-search-icon {
    position: absolute;
    inset-inline-start: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    pointer-events: none;
}

.pp-search input {
    width: 100%;
    padding-block: 10px;
    padding-inline: 38px 14px;
    background: var(--surface);
    border: 1px solid var(--rule);
    font-family: var(--sans);
    font-size: 14px;
    color: var(--ink);
}

.pp-nav {
    display: flex;
    align-items: center;
    gap: 28px;
}

.pp-nav a {
    font-family: var(--sans);
    font-size: 13px;
    color: var(--ink-soft);
    text-decoration: none;
    font-weight: 500;
}

.pp-nav a:hover,
.pp-nav a[aria-current="page"] {
    color: var(--ink);
}

/* The masthead strip under the header: issue, tagline, place and date. */
.pp-masthead {
    border-top: 1px solid var(--rule);
    background: var(--surface);
}

.pp-masthead-inner {
    padding-block: 10px;
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

/* Signed-in/out chrome: the header carries the state, CSS decides what shows. */
.pp-header[data-authenticated="true"] [data-when-signed-out],
.pp-header[data-authenticated="false"] [data-when-signed-in] {
    display: none;
}

@media (max-width: 900px) {
    .pp-header-bar {
        flex-wrap: wrap;
        gap: 16px;
    }

    .pp-search {
        order: 3;
        max-width: none;
        flex-basis: 100%;
    }

    .pp-masthead-inner :nth-child(3) {
        display: none;
    }
}

@media (max-width: 600px) {
    .pp-nav {
        gap: 18px;
    }

    .pp-masthead-inner :nth-child(1) {
        display: none;
    }
}

/* ── Footer ───────────────────────────────────────────────────────────────────────────── */

.pp-footer {
    margin-top: 80px;
    padding-block: 32px 48px;
    border-top: 1px solid var(--rule);
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 40px;
}

.pp-footer-blurb {
    font-family: var(--serif);
    font-style: italic;
    font-size: 14px;
    color: var(--muted);
    margin-top: 14px;
    line-height: 1.5;
    max-width: 36ch;
}

.pp-footer h2 {
    font-family: var(--mono);
    font-size: var(--eyebrow-size);
    letter-spacing: var(--eyebrow-tracking);
    color: var(--ink);
    margin: 0 0 12px;
    font-weight: 600;
}

:root:lang(en) .pp-footer h2,
:root:lang(cy) .pp-footer h2 {
    text-transform: uppercase;
}

.pp-footer ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pp-footer a {
    font-family: var(--sans);
    font-size: 13px;
    color: var(--ink-soft);
    text-decoration: none;
}

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

@media (max-width: 900px) {
    .pp-footer {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 520px) {
    .pp-footer {
        grid-template-columns: 1fr;
        gap: 28px;
    }
}

/* ── Cards ────────────────────────────────────────────────────────────────────────────── */

.pp-card {
    border: 1px solid var(--rule);
    background: var(--surface);
    transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
}

.pp-card:hover,
.pp-card:focus-within {
    transform: translateY(-3px);
    box-shadow: 4px 4px 0 var(--ink);
    border-color: var(--ink);
}

/* The whole card is clickable, but only the title is a link — one tab stop, real semantics. */
.pp-card-link::after {
    content: "";
    position: absolute;
    inset: 0;
}

/* ── Genre pill ───────────────────────────────────────────────────────────────────────── */

.pp-pill {
    display: inline-block;
    font-family: var(--mono);
    font-size: var(--eyebrow-size);
    letter-spacing: 0.1em;
    padding: 4px 8px;
    font-weight: 500;
    background: var(--surface);
    color: var(--ink);
    border: 1px solid var(--rule);
}

:root:lang(en) .pp-pill,
:root:lang(cy) .pp-pill {
    text-transform: uppercase;
}

.pp-pill-dark {
    background: oklch(0 0 0 / 0.55);
    color: var(--bg);
    border-color: transparent;
}

/* ── Pixel progress ───────────────────────────────────────────────────────────────────── */

/*
 * Funding drawn as a run of pixels rather than a filled bar — the mechanic as the mark. The
 * cells are decorative: the accessible value lives on the element itself (role=progressbar with
 * aria-valuenow and aria-valuetext), and the figures below it repeat the number in text, so the
 * meaning never depends on seeing the colour.
 */
.pp-progress {
    display: flex;
    gap: 2px;
    height: 8px;
}

.pp-progress-cell {
    flex: 1;
    background: var(--rule);
}

.pp-progress-cell[data-filled="true"] {
    background: var(--accent);
}

.pp-progress-figures {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-top: 12px;
    font-family: var(--mono);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.pp-progress-raised {
    color: var(--ink);
    font-weight: 600;
}

.pp-progress-goal {
    color: var(--muted);
}

.pp-progress-percent {
    color: var(--accent-strong);
    font-weight: 600;
}

/* ── Filter controls ──────────────────────────────────────────────────────────────────── */

.pp-filters {
    background: var(--surface);
    border: 1px solid var(--rule);
    padding: 22px 22px 8px;
    position: sticky;
    top: 120px;
}

.pp-filters-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--rule);
}

.pp-filters-title {
    font-family: var(--serif-display);
    font-size: 22px;
    font-weight: 500;
    letter-spacing: -0.01em;
    margin: 0;
}

.pp-filters-active {
    font-family: var(--mono);
    font-size: var(--eyebrow-size);
    color: var(--muted);
    margin-top: 2px;
    letter-spacing: 0.08em;
}

.pp-filter-group {
    border: 0;
    padding: 0;
    margin: 0 0 22px;
}

.pp-filter-group legend {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0;
    margin-bottom: 10px;
}

.pp-filter-group legend::before {
    content: "";
    width: 4px;
    height: 4px;
    background: var(--accent);
    flex-shrink: 0;
}

.pp-option {
    display: flex;
    align-items: center;
    gap: 9px;
    padding-block: 5px;
    cursor: pointer;
    font-size: 13px;
    color: var(--ink-soft);
}

.pp-option:hover {
    color: var(--ink);
}

.pp-option input {
    appearance: none;
    width: 13px;
    height: 13px;
    margin: 0;
    flex-shrink: 0;
    border: 1px solid var(--rule-strong);
    background: var(--bg);
    cursor: pointer;
    display: grid;
    place-content: center;
}

.pp-option input[type="radio"] {
    border-radius: 50%;
}

.pp-option input::before {
    content: "";
    width: 7px;
    height: 7px;
    transform: scale(0);
    background: var(--accent-strong);
}

.pp-option input[type="radio"]::before {
    border-radius: 50%;
}

.pp-option input:checked {
    border-color: var(--accent-strong);
}

.pp-option input:checked::before {
    transform: scale(1);
}

.pp-option input:checked + .pp-option-label {
    color: var(--ink);
    font-weight: 500;
}

.pp-option-label {
    flex: 1;
}

/*
 * The facet count. The server has no counts yet (context/SERVER_WISHLIST.md — they arrive with
 * the analytics engine), so the slot is rendered empty and hidden; filling it is a data change,
 * not a re-layout.
 */
.pp-option-count {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.pp-option-count:empty {
    display: none;
}

/* ── Empty and loading states ─────────────────────────────────────────────────────────── */

.pp-empty {
    border: 1px dashed var(--rule-strong);
    background: var(--surface);
    padding: 56px 32px;
    text-align: center;
}

.pp-empty h2 {
    font-family: var(--serif-display);
    font-size: 26px;
    font-weight: 500;
    margin: 0 0 8px;
}

.pp-empty p {
    color: var(--muted);
    margin: 0 0 20px;
    font-family: var(--serif);
    font-style: italic;
    font-size: 15px;
}

/* A card-shaped shimmer while the listing loads. */
.pp-skeleton {
    border: 1px solid var(--rule);
    background: var(--surface);
    aspect-ratio: 4 / 5;
    position: relative;
    overflow: hidden;
}

.pp-skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, oklch(0.9 0.02 75 / 0.6), transparent);
    animation: pp-shimmer 1.4s infinite;
}

@keyframes pp-shimmer {
    from { transform: translateX(-100%); }
    to { transform: translateX(100%); }
}

/* ── The pixel spinner ────────────────────────────────────────────────────────────────── */

/*
 * Three pixels pulsing in turn: something is happening. Always `aria-hidden` beside a line of
 * text that says *what* is happening, and announced separately.
 */
.pp-pixel-spinner {
    display: inline-flex;
    gap: 4px;
}

.pp-pixel-spinner span {
    width: 7px;
    height: 7px;
    background: var(--accent-strong);
    animation: pp-pixel-pulse 1.1s ease-in-out infinite;
}

.pp-pixel-spinner span:nth-child(2) {
    animation-delay: 0.16s;
}

.pp-pixel-spinner span:nth-child(3) {
    animation-delay: 0.32s;
}

@keyframes pp-pixel-pulse {
    0%, 70%, 100% { opacity: 0.2; }
    35% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .pp-pixel-spinner span {
        animation: none;
        opacity: 0.55;
    }
}

/* ── Shared between the project page and the wizard ───────────────────────────────────── */

/* ── The 70% threshold: a term of the deal, so it is styled as one ────────────────────── */

.pp-threshold {
    border: 1px solid var(--accent-strong);
    border-inline-start-width: 4px;
    background: color-mix(in oklch, var(--accent) 10%, var(--surface));
    padding: 18px 20px;
}

.pp-threshold-heading {
    font-family: var(--mono);
    font-size: var(--eyebrow-size);
    letter-spacing: var(--eyebrow-tracking);
    margin: 0 0 8px;
    color: var(--accent-strong);
}

:root:lang(en) .pp-threshold-heading,
:root:lang(cy) .pp-threshold-heading {
    text-transform: uppercase;
}

.pp-threshold p {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    color: var(--ink-soft);
}


.pp-breakdown {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.pp-breakdown > div {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    font-size: 13px;
}

.pp-breakdown dt {
    color: var(--ink-soft);
}

.pp-breakdown dd {
    margin: 0;
    font-variant-numeric: tabular-nums;
}

.pp-breakdown-total {
    border-top: 1px solid var(--rule-strong);
    padding-top: 9px;
    margin-top: 3px;
    font-weight: 600;
}

.pp-breakdown-total dt {
    color: var(--ink);
}

.pp-breakdown-large > div {
    font-size: 15px;
}

/* ── Paying for a featured placement (dashboard row and wizard step 4) ─────────────────── */

/*
 * Stripe draws the card form in its own iframe; the frame around it is ours. The total sits
 * on the same line as what is being bought and again on the button, so the figure charged is
 * never out of sight while the card is typed.
 */
.pp-placement-checkout {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 16px;
    padding: 20px;
    border: 1px solid var(--rule);
    background: var(--surface);
    max-width: 34rem;
}

.pp-placement-checkout .pp-checkout-summary {
    display: grid;
    gap: 6px;
    margin: 0;
}

.pp-placement-checkout .pp-checkout-summary > div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.pp-placement-checkout .pp-checkout-summary dt {
    color: var(--ink-soft);
}

.pp-placement-checkout .pp-checkout-summary dd {
    margin: 0;
    text-align: end;
}

.pp-placement-checkout .pp-checkout-status {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    color: var(--ink-soft);
}

.pp-placement-checkout .pp-checkout-message {
    margin: 0;
}

.pp-placement-checkout [data-action="pay"] {
    align-self: flex-start;
}

.pp-placement-checkout[aria-busy="true"] [data-action="pay"] {
    cursor: progress;
}

/* ── Fields ───────────────────────────────────────────────────────────────────────────── */
/* Moved from pages/create.css on 2026-11-29: the name form uses them on the dashboard and the
   verification page too. */

.pp-field {
    margin-bottom: 22px;
    border: 0;
    padding: 0;
}

fieldset.pp-field {
    border: 1px solid var(--rule);
    padding: 18px 20px 4px;
    background: var(--surface);
}

.pp-field > label,
.pp-field legend {
    display: block;
    font-family: var(--sans);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
    padding: 0;
}

.pp-field input[type="text"],
.pp-field input[type="url"],
.pp-field input[type="number"],
.pp-field select,
.pp-field textarea {
    width: 100%;
    max-width: 62ch;
    padding: 9px 11px;
    border: 1px solid var(--rule-strong);
    background: var(--bg);
    font-family: var(--sans);
    font-size: 14px;
    color: var(--ink);
}

.pp-field textarea {
    resize: vertical;
    line-height: 1.5;
}

.pp-field-help {
    font-size: 12px;
    color: var(--muted);
    margin: 6px 0 0;
    max-width: 62ch;
    line-height: 1.45;
}

.pp-field > .pp-field-help:first-of-type {
    margin: 0 0 8px;
}

.pp-field-note {
    font-size: 12px;
    color: var(--ink-soft);
    margin: 10px 0 0;
    line-height: 1.45;
}

.pp-field-note[data-warning] {
    color: var(--accent-strong);
    font-weight: 500;
}

.pp-field-error {
    font-size: 12px;
    color: var(--accent-strong);
    font-weight: 500;
    margin: 6px 0 0;
    max-width: 62ch;
}

[aria-invalid="true"] {
    border-color: var(--accent-strong) !important;
}
