/* =====================================================================
   Application page (/applications/<slug>, page_applications_category.xml),
   one design for every application, filled from its Website Applications
   record. Top: icon and NCC class (pop-up from applications.css /
   applications.js), name, intro, buttons and the banner photo; then the
   "Ideal for" wall types on grey, the whole labelled drawing, the performance tables
   (snippets.css, unchanged) and the case study slider (home.css).
   Headings, buttons and colours: components.css.
   ===================================================================== */

/* ---------- top ---------- */

.ap-top {
    padding: 40px 0 56px;
    overflow-x: clip;       /* a closed NCC pop-up doesn't widen the page */
    background: #fff;
    font-family: var(--dc-font);
}
.ap-breadcrumbs {
    margin-bottom: 24px;
}
.ap-top-grid {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    gap: 56px;
    align-items: center;
}
.ap-class {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}
.ap-class-icon {
    flex: none;
    width: 48px;
    height: 48px;
    margin: -6px 0;
    object-fit: contain;
}
.ap-class .apps-ncc {
    margin-left: 0;
}
/* the pop-up opens downwards here: there's no room above at the top of the page */
.ap-class .ap-ncc-pop {
    top: calc(100% + 10px);
    right: auto;
    bottom: auto;
    left: -12px;
    transform: translateY(-4px);
}
.ap-class .ap-ncc-pop::after {
    top: auto;
    right: auto;
    bottom: 100%;
    left: 24px;
    margin-top: 0;
    margin-bottom: -6px;
    transform: rotate(-135deg);
}
.ap-class .ap-ncc-pop::before {
    top: auto;
    bottom: 100%;
}
.ap-title {
    font-size: 2.75rem;
    line-height: 1.02;
}
.ap-top .ap-lead {
    margin: 18px 0 0;
    color: var(--dc-ink);
    font-family: var(--dc-font-head);
    font-size: 1.375rem;
    font-weight: bold;
    line-height: 1.2;
}
.ap-intro {
    max-width: 60ch;
    margin-top: 14px;
}
.ap-top .ap-intro p {
    margin: 0 0 10px;
    color: var(--dc-muted);
    font-size: 1rem;
    line-height: 1.6;
}
.ap-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 28px;
}
.ap-top-photo {
    overflow: hidden;
    background: var(--dc-soft);
}
.ap-top-photo img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 3 / 2;
    object-fit: cover;
}

/* ---------- ideal for ---------- */

.ap-ideal {
    padding: 48px 0 52px;
    background: #f5f5f5;
    font-family: var(--dc-font);
}
.ap-ideal-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 20px 0 0;
    padding: 0;
    list-style: none;
}
.ap-ideal .ap-ideal-list li {
    padding: 10px 16px;
    border: 1px solid var(--dc-line);
    background: #fff;
    color: var(--dc-text);
    font-size: 0.9375rem;
    line-height: 1.3;
}

/* ---------- where Dincel is used ----------
   The wall types (red ticks, two columns) beside the labelled drawing, which
   floats over a light grey band with the theme's grey dots fading from top
   to bottom (the drawings have a transparent background). */

.ap-where {
    padding: 72px 0;
    /* the theme's grey dots, fading out from the top to plain grey at the bottom */
    background:
        linear-gradient(to bottom, rgba(242, 242, 242, 0.92) 0%, #f2f2f2 45%),
        url("/theme_dincel/static/production/img/background-dots-grey.png"),
        #f2f2f2;
    font-family: var(--dc-font);
}
.ap-where-grid {
    display: grid;
    grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
    gap: 48px;
    align-items: center;
}
.ap-where .dc-intro {
    margin-top: 12px;
}
.ap-where .ap-where-label {
    margin: 28px 0 12px;
    padding-top: 20px;
    border-top: 1px solid #dcdcdc;
    color: var(--dc-ink);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.ap-where-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 20px;
}
.ap-where .ap-where-list li {
    margin: 0;
    color: var(--dc-text);
    font-size: 0.875rem;
    line-height: 1.4;
}
.ap-where-drawing {
    margin: 0;
}
.ap-where-open {
    position: relative;
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    cursor: zoom-in;
}
.ap-where-open:focus-visible {
    outline: 2px solid var(--dc-red);
    outline-offset: 4px;
}
.ap-where-drawing img {
    display: block;
    width: 100%;
    height: auto;
    filter: drop-shadow(0 18px 24px rgba(0, 0, 0, 0.08));
}
/* "View larger", bottom right of the drawing */
.ap-where-hint {
    position: absolute;
    right: 0;
    bottom: 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid var(--dc-line);
    background: #fff;
    color: var(--dc-ink);
    font-family: var(--dc-font);
    font-size: 0.8125rem;
    font-weight: 500;
    transition: border-color 0.15s, color 0.15s;
}
.ap-where-open:hover .ap-where-hint,
.ap-where-open:focus-visible .ap-where-hint {
    border-color: var(--dc-ink);
    color: var(--dc-red);
}
.ap-where-hint svg {
    display: block;
}

/* the drawing large: fits the screen; on phones it's wider than the screen
   and scrolls sideways so the labels can be read */
html.ap-zoom-open {
    overflow: hidden;
}
.ap-zoom,
.ap-zoom:modal {
    inset: 0;
    width: 100%;
    max-width: none;
    height: 100%;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: #fff;
}
.ap-zoom::backdrop {
    background: #fff;
}
.ap-zoom:focus {
    outline: none;
}
.ap-zoom-body {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 64px 32px 32px;
    overflow: auto;
    cursor: zoom-out;
}
.ap-zoom-body img {
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 100%;
}
.ap-zoom-close {
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border: 1px solid var(--dc-line);
    border-radius: 0;
    background: #fff;
    color: var(--dc-ink);
    cursor: pointer;
}
.ap-zoom-close:hover {
    border-color: var(--dc-ink);
}
.ap-zoom-close:focus-visible {
    outline: 2px solid var(--dc-red);
    outline-offset: 2px;
}
.ap-zoom-close svg {
    display: block;
}

/* the performance tables keep their own styles; only the band behind them */
.ap-body.snippet_applications_category_top .table-section {
    scroll-margin-top: 80px;    /* "See the performance tables" clears the sticky header */
    padding-top: 24px;
    padding-bottom: 56px;   /* the notes panel doesn't run into the grey case studies band */
}

/* ---------- performance tables ----------
   The internal and external tables (application_table_*_v3, laid out by
   snippets.css). Same structure, restyled to the site: readable header text,
   the NCC row in red, the requirement groups in ink rather than mid grey (the
   white text on #a39f9e was hard to read), larger figures, and a clear line
   between wall systems. Also applies to the floating copy of the header
   (floatThead) that follows the page while scrolling. */
.ap-body .application-table {
    font-family: var(--dc-font);
}
/* title and wall-type filter above each table */
.ap-body .application-table .title-wrapper h2 {
    margin: 0;
    padding-bottom: 2px;
    color: var(--dc-red);
    font-family: var(--dc-font-head);
    font-size: 1.5rem;
    line-height: 1.15;
}
.ap-body .application-table .title-wrapper p {
    margin: 0;
    color: var(--dc-muted);
    font-size: 0.8125rem;
}
.ap-body .application-table thead label {
    display: block;
    margin: 18px 0 0;
    color: var(--dc-text);
    font-size: 0.75rem;
    font-weight: 500;
}
.ap-body .application-table thead select {
    display: block;
    width: 260px;
    height: 40px;
    margin-top: 6px;
    padding: 0 36px 0 12px;
    border: 1px solid var(--dc-line);
    border-radius: 0;
    background-color: #fff;
    color: var(--dc-ink);
    font-family: var(--dc-font);
    font-size: 0.8125rem;
    cursor: pointer;
}
.ap-body .application-table thead select:focus-visible {
    outline: 2px solid var(--dc-red);
    outline-offset: 1px;
}

/* header cells */
.ap-body .application-table thead th {
    padding: 8px 6px;
    color: var(--dc-text);
    font-size: 0.6875rem;
    font-weight: 500;
    line-height: 1.3;
    vertical-align: middle;
}
.ap-body .application-table thead .blank {
    vertical-align: top;
    text-align: left;
}
.ap-body .application-table thead .ncc-col {
    padding: 10px 6px;
    background-color: var(--dc-red);
    color: #fff;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.ap-body .application-table thead .fire-col,
.ap-body .application-table thead .acoustic-col,
.ap-body .application-table thead .waterproof-col {
    background-color: #2b2b2b;
    color: #fff;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
/* the second level of a group (Columns and walls, Basement wall...) a step lighter */
.ap-body .application-table thead .fire-col.heading,
.ap-body .application-table thead .acoustic-col.heading,
.ap-body .application-table thead .waterproof-col.heading {
    background-color: #555;
}
.ap-body .application-table thead .last-header-row th {
    border-bottom: 2px solid var(--dc-red);
}

/* body cells */
.ap-body .application-table tbody td {
    padding: 7px 6px;
    color: var(--dc-text);
    font-size: 0.8125rem;
    line-height: 1.35;
}
/* a line above each wall system (its first row) */
.ap-body .application-table tbody tr[class*="rowNum0"] td {
    border-top: 1px solid #d6d6d6;
}
.ap-body .application-table tbody .col-img {
    padding: 12px 10px 12px 0;
    text-align: left;
    vertical-align: top;
}
.ap-body .application-table tbody .number {
    color: var(--dc-ink);
    font-family: var(--dc-font-head);
    font-size: 1.125rem;
    line-height: 1.2;
}
.ap-body .application-table tbody .number span {
    font-weight: 400;
}
.ap-body .application-table tbody .contents {
    color: var(--dc-text);
    font-size: 0.75rem;
    line-height: 1.45;
}
.ap-body .application-table tbody .contents .image img {
    max-width: 100%;
    margin: 6px 0;
}

/* ---------- notes under the tables ----------
   The guidance, NCC provisions, product densities and footnotes after the
   external table (.app-terms, application_table_ext_v3). The theme sets its
   paragraphs at 12px and leaves the list at the body size; here they share
   one size on a quiet grey panel. */
.ap-body .app-terms {
    z-index: 1;             /* the theme's 1002 put it over the site header when scrolling */
    margin: 32px 0 0;
    padding: 24px 28px;
    background: var(--dc-soft);
    font-family: var(--dc-font);
}
.ap-body .app-terms p,
.ap-body .app-terms li {
    margin: 0 0 8px;
    color: var(--dc-muted);
    font-size: 0.8125rem;
    line-height: 1.6;
}
/* the first line is the guidance-only note: it leads */
.ap-body .app-terms p:first-child {
    color: var(--dc-ink);
    font-weight: 500;
}
/* product densities: two columns of short lines */
.ap-body .app-terms ul {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2px 32px;
    margin: 4px 0 16px;
    padding: 0 0 0 18px;
}
.ap-body .app-terms li {
    margin: 0;
}
.ap-body .app-terms li::marker {
    color: var(--dc-red);
}
.ap-body .app-terms p:last-child {
    margin-bottom: 0;
}

/* ---------- tablets and phones ---------- */

/* below desktop the drawing would be too small beside the list: one column,
   heading and wall types first, then the drawing at full width */
@media (max-width: 1199.98px) {
    .ap-where {
        padding: 56px 0;
    }
    .ap-where-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 32px;
    }
    .ap-where-list {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 991.98px) {
    .ap-top-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 32px;
    }
    .ap-top-photo {
        order: -1;
    }
    .ap-title {
        font-size: 2.25rem;
    }
}

@media (max-width: 767.98px) {
    .ap-top {
        padding: 24px 0 40px;
    }
    .ap-title {
        font-size: 2rem;
    }
    .ap-top .ap-lead {
        font-size: 1.1875rem;
    }
    .ap-actions .dc-btn {
        flex: 1 1 100%;
    }
    .ap-ideal {
        padding: 36px 0 40px;
    }
    /* the theme hides the notes on phones; they qualify the tables, so keep them */
    .ap-body .app-terms {
        display: block;
        padding: 20px 16px;
    }
    .ap-body .app-terms ul {
        grid-template-columns: minmax(0, 1fr);
    }
    .ap-ideal .ap-ideal-list li {
        padding: 8px 12px;
        font-size: 0.875rem;
    }
    .ap-where {
        padding: 40px 0;
    }
    .ap-where-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px 12px;
    }
    .ap-where .ap-where-list li {
        font-size: 0.8125rem;
    }
    .ap-where-hint {
        padding: 6px 10px;
        font-size: 0.75rem;
    }
    /* phones: the drawing at its own size, scroll sideways to read it */
    .ap-zoom-body {
        justify-content: flex-start;
        padding: 72px 16px 16px;
    }
    .ap-zoom-body img {
        flex: none;
        width: 1100px;
        max-width: none;
        max-height: none;
    }
}
