/*
    The public site, styled after the legacy repository (Docs/plan/public-search-ui-parity.md):
    HPDC cyan, Open Sans where installed, grey panels, refiners on the left.
    Mobile first; the two columns appear from 48rem.
*/

:root {
    --accent: #00b5e0;
    --accent-dark: #007591; /* 4.7:1 on --panel, 5.3:1 on white (WCAG AA for body text) */
    --text: #333333;
    --muted: #5f5f5f;
    --border: #ababab;
    --panel: #f1f1f1;
    --panel-alt: #f2f2f2;
    --bg: #ffffff;
    --expired: #9b1c1c;
    --notice: #7a4f00;
    /* The smallest thing a pointer has to hit: WCAG 2.2 AA's 24 px, and on a touch screen the
       alt plan's 44 px mobile budget. Links inside a sentence are exempt, as WCAG exempts them. */
    --target: 24px;
}

@media (pointer: coarse) {
    :root {
        --target: 44px;
    }
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.5 "Open Sans", Arial, sans-serif;
}

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

a:focus-visible,
button:focus-visible,
input:focus-visible,
summary:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

.skip-link {
    position: absolute;
    left: -999px;
}

.skip-link:focus {
    left: 1rem;
    top: 1rem;
    background: var(--bg);
    padding: 0.75rem 1rem;
    z-index: 10;
}

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

/* ---- Chrome ---- */

.site-header {
    border-bottom: 3px solid var(--accent);
    background: var(--bg);
}

.site-header-inner,
main,
.site-footer {
    max-width: 75rem;
    margin: 0 auto;
    padding: 0 1rem;
}

.site-header-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1.5rem;
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

.brand {
    display: flex;
    align-items: center;
}

/*
 * 183 x 132: three times its 61 x 44 display, for high-density phones. The attributes reserve the
 * box; 44px on every screen keeps the home link a full tap target (tests/ui-budget).
 */
.brand img {
    display: block;
    height: 44px;
    width: auto;
}

.site-header nav {
    display: flex;
    gap: 1.25rem;
}

.site-header nav a {
    color: var(--text);
    text-decoration: none;
}

.site-header nav a:hover {
    color: var(--accent-dark);
    text-decoration: underline;
}

.site-footer {
    margin-top: 3rem;
    padding-top: 1rem;
    padding-bottom: 2rem;
    border-top: 1px solid var(--border);
    font-size: 0.9rem;
}

/* ---- Layout ---- */

.title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
}

h1 {
    font-size: 1.6rem;
    font-weight: 600;
    margin: 1.25rem 0 0.75rem;
}

h2 {
    font-size: 1.15rem;
    font-weight: 600;
}

.two-column {
    display: grid;
    gap: 1.5rem;
}

@media (min-width: 48rem) {
    .two-column {
        grid-template-columns: 16rem minmax(0, 1fr);
    }

    .two-column-detail {
        grid-template-columns: minmax(0, 1fr) 20rem;
    }

    /* The search page's refiners follow its results in the document (Index.cshtml). */
    .two-column-search .side-column {
        grid-column: 1;
        grid-row: 1;
    }

    .two-column-search .main-column {
        grid-column: 2;
    }

    .jump-to-filters {
        display: none;
    }
}

/* ---- Promo band ---- */

.promo {
    background: var(--panel);
    border-left: 4px solid var(--accent);
    padding: 0.75rem 1rem;
    margin-bottom: 1.25rem;
}

.promo h2 {
    margin: 0 0 0.5rem;
}

.promo-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
    gap: 1rem;
}

.button,
button {
    display: inline-block;
    background: var(--accent-dark);
    color: #fff;
    border: 0;
    border-radius: 3px;
    padding: 0.45rem 0.9rem;
    font: inherit;
    text-decoration: none;
    cursor: pointer;
}

.button:hover,
button:hover {
    background: #005f78;
}

/* ---- Search box and results ---- */

.search-box label,
.withdrawn label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.table-scroll {
    overflow-x: auto;
    max-width: 100%;
}

/* A restored entry stays on the list (ADR 0010), marked so nobody mistakes it for one in force. */
.withdrawn .restored {
    display: block;
    color: var(--muted);
    font-style: italic;
}

.search-box-row {
    display: flex;
    gap: 0.5rem;
}

.search-box-row input[type=search] {
    flex: 1;
    min-width: 0;
    padding: 0.45rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 3px;
    font: inherit;
}

.result-count {
    color: var(--muted);
    margin: 1rem 0 0.5rem;
}

.fuzzy-note {
    display: block;
}

.jump-to-filters {
    margin: 0 0 0.5rem;
}

.result-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.result {
    border-bottom: 1px solid var(--panel);
    padding: 0.6rem 0;
}

.quick-panel summary {
    cursor: pointer;
    list-style: none;
    font-size: 1.05rem;
    color: var(--accent-dark);
}

.quick-panel summary::-webkit-details-marker {
    display: none;
}

.quick-panel[open] summary .result-title,
.quick-panel summary:hover .result-title {
    text-decoration: underline;
}

.pdf-icon {
    display: inline-block;
    width: 0.85em;
    height: 1.05em;
    margin-right: 0.35rem;
    vertical-align: -0.1em;
    border: 2px solid #c0392b;
    border-radius: 2px;
    background: linear-gradient(135deg, transparent 70%, #c0392b 70%);
}

.label {
    font-weight: 600;
    margin-right: 0.25rem;
}

.label-expired {
    color: var(--expired);
}

.label-notice {
    color: var(--notice);
}

.result-meta {
    margin: 0.15rem 0 0 1.2rem;
    color: var(--muted);
    font-size: 0.9rem;
}

/*
 * Search terms in a result, as the legacy page marked them: bold, on a cyan tint pale enough to
 * keep the title's --accent-dark at 4.6:1 (axe), with a cyan rule under it to carry the colour.
 */
.result mark {
    background: #eefafd;
    box-shadow: inset 0 -2px 0 var(--accent);
    color: inherit;
    font-weight: 700;
    padding: 0 0.05em;
    border-radius: 2px;
}

.panel {
    background: var(--panel-alt);
    border: 1px solid var(--border);
    padding: 0.75rem 1rem;
    margin: 0.5rem 0 0.25rem;
}

.cover {
    display: block;
    max-width: 100%;
    height: auto;
    border: 1px solid var(--border);
    margin: 0 0 0.75rem;
}

.panel p {
    margin: 0 0 0.5rem;
}

.paging {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin: 1.25rem 0;
}

/* ---- Refiners ---- */

.refiners h2 {
    margin-top: 0;
}

.refiner {
    border-top: 1px solid var(--panel);
    padding: 0.5rem 0;
}

.refiner h3 {
    font-size: 0.95rem;
    margin: 0 0 0.25rem;
}

.refiner ul {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 18rem;
    overflow-y: auto;
}

.refiner li a {
    display: block;
    color: var(--text);
    text-decoration: none;
    font-size: 0.9rem;
}

.refiner li a:hover {
    text-decoration: underline;
}

.refiner li a.selected {
    font-weight: 700;
    color: var(--accent-dark);
}

.refiner li a.selected::before {
    content: "✓ ";
}

.count {
    color: var(--muted);
}

.refiner summary {
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--accent-dark);
}

/* ---- Detail, download, withdrawal ---- */

.facts {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.3rem 1rem;
}

.facts dt {
    font-weight: 600;
}

.facts dd {
    margin: 0;
}

.note {
    color: var(--muted);
}

.hpd-document {
    background: var(--panel);
    padding: 0.75rem 1rem;
}

.download-form label {
    display: block;
    margin: 0.4rem 0 0.2rem;
}

.download-form input[type=email] {
    width: 100%;
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 3px;
    font: inherit;
}

.download-form .terms {
    display: flex;
    gap: 0.4rem;
    align-items: baseline;
}

.download-form button {
    margin-top: 0.5rem;
}

.download-forget {
    margin-top: 0.4rem;
}

.errors ul {
    color: var(--expired);
    padding-left: 1.2rem;
}

.withdrawn-notice {
    border-left: 4px solid var(--expired);
    padding: 0.5rem 1rem;
    background: var(--panel);
}

table {
    border-collapse: collapse;
    width: 100%;
    margin-top: 1rem;
    font-size: 0.9rem;
}

th,
td {
    text-align: left;
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid var(--panel);
    vertical-align: top;
}

@media (max-width: 40rem) {
    table,
    thead,
    tbody,
    tr,
    th,
    td {
        display: block;
    }

    thead {
        position: absolute;
        left: -999px;
    }

    tr {
        border-bottom: 1px solid var(--border);
        padding: 0.4rem 0;
    }

    td {
        border: 0;
        padding: 0.1rem 0;
        /* Legacy file names (256-20131126094131.pdf) have no break points of their own. */
        overflow-wrap: anywhere;
    }

    /* The header row is hidden here, so each stacked cell names itself. */
    td[data-label]::before {
        content: attr(data-label) ": ";
        font-weight: 600;
    }
}

/* ---- Account ---- */

.signout {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.signed-in-as {
    color: var(--muted);
}

/* A sign-out is a POST, so it is a button; it reads as the header's other links. */
.link-button {
    background: none;
    border: 0;
    padding: 0;
    color: inherit;
    font: inherit;
    text-decoration: underline;
    cursor: pointer;
    min-height: var(--target);
}

.providers {
    list-style: none;
    padding: 0;
    display: grid;
    gap: 0.75rem;
    max-width: 24rem;
}

/* ---- Target sizes ---- */

.brand,
.site-header nav a,
.site-footer a,
.paging a,
.jump-to-filters a,
.title-row > a,
.refiners > p > a,
.hpd-document p > a,
.quick-panel .panel > p > a,
.withdrawn td a {
    display: inline-flex;
    align-items: center;
    min-width: var(--target);
    min-height: var(--target);
}

.brand {
    display: flex;
}

/* Text that may wrap is padded rather than given a minimum height, so it stays centred. */
.refiner li a,
.refiner summary,
.quick-panel summary {
    padding-block: 0.2rem;
    padding-block: max(0.1rem, calc((var(--target) - 1lh) / 2));
}

button,
.button,
input[type=search],
input[type=email] {
    min-height: var(--target);
}

.download-form .terms {
    align-items: center;
    min-height: var(--target);
}

@media (pointer: coarse) {
    /* Room for eight 44 px values before a list scrolls. */
    .refiner ul {
        max-height: 24rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
}
