/* Size Cost Page template (size-cost-page.php). Loads after single-post.css.
   Black type on white, hairlines, and one red: the buttons. */

:root {
    --scp-ink: #000;
    --scp-muted: #5f6367;
    --scp-line: #e3e3e0;
    --scp-panel: #f4f4f2;
    --scp-red: #ff2400;
    --scp-red-dark: #e02000;
    --scp-gutter: 15px;
}

/* Phones: the breadcrumb stops at the category, because the title is just below it */
@media (max-width: 767px) {
    .scp-crumb-title {
        display: none;
    }
}

/* Hero: phones show the photo first, and the answer stays first in the HTML */
.scp-hero {
    display: flex;
    flex-direction: column;
}

.scp-hero__image {
    order: -1;
}

.scp .post-title {
    margin: 0;
    color: var(--scp-ink);
    font-size: clamp(1.75rem, 7.6vw, 2.875rem);
    font-weight: 700;
    line-height: 1.12;
    letter-spacing: -0.02em;
}

.scp-hero__text {
    padding: 16px var(--scp-gutter) 0;
}

.scp-hero--no-image .scp-hero__text {
    padding-top: 8px;
}

/* The price range reads like a dimension on a building drawing. The word "to"
   stays in the HTML for crawlers and screen readers. */
.scp-price {
    margin-top: 18px;
}

.scp-price__range {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    color: var(--scp-ink);
    font-size: clamp(1.5rem, 7.2vw, 2.5rem);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.scp-price__to {
    flex: 1 1 auto;
    min-width: 24px;
    max-width: 120px;
    height: 13px;
    border-left: 2px solid var(--scp-ink);
    border-right: 2px solid var(--scp-ink);
    background: linear-gradient(var(--scp-ink), var(--scp-ink)) center / 100% 2px no-repeat;
    font-size: 0;
}

.scp-price__note {
    margin: 8px 0 0;
    color: var(--scp-muted);
    font-size: 0.8125rem;
    line-height: 1.45;
}

.scp .post-excerpt {
    margin: 14px 0 0;
    color: var(--scp-ink);
    font-size: 1.0625rem;
    line-height: 1.5;
}

.scp-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.scp-actions .scp-btn {
    flex: 1 1 0;
    min-width: 0;
    padding: 0 8px;
    font-size: 0.9375rem;
}

/* The photo runs edge to edge on phones */
.scp-hero__image img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

.scp-sheet {
    padding: 24px var(--scp-gutter) 0;
}

.scp-byline {
    order: -2;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    color: var(--scp-muted);
    font-size: 0.875rem;
    line-height: 1.35;
}

.scp-byline img {
    flex: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.scp-byline a {
    color: var(--scp-ink);
    font-weight: 600;
    text-decoration: none;
}

/* The article comes first in the HTML. On phones the byline and Skip To links sit above it. */
.scp-layout {
    display: flex;
    flex-direction: column;
}

.scp-main {
    display: contents;
}

.scp-side {
    order: -1;
    min-width: 0;
}

.scp-card {
    display: none;
}

/* Skip To: plain anchor links, stacked */
.scp-toc {
    margin-bottom: 8px;
}

.scp-toc__title {
    margin: 0 0 8px;
    color: var(--scp-ink);
    font-size: 1rem;
    font-weight: 600;
}

.scp-toc ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.scp-toc li {
    margin: 0 0 10px;
}

.scp-toc a {
    color: var(--scp-red);
    font-size: 0.9375rem;
    line-height: 1.35;
    text-decoration: underline;
}

/* Body */
.scp .post-content {
    min-width: 0;
    margin-bottom: 0;
    color: #222;
    font-size: 1.0625rem;
    line-height: 1.65;
}

.scp .post-content h2 {
    margin-top: 2.25rem;
    color: var(--scp-ink);
    font-size: clamp(1.5rem, 5.6vw, 1.875rem);
    line-height: 1.2;
    letter-spacing: -0.01em;
}

.scp .post-content h3 {
    color: var(--scp-ink);
    font-size: 1.25rem;
    line-height: 1.3;
}

.scp .post-content a {
    color: var(--scp-red);
}

/* Captions from the Image block's caption box: small and left aligned */
.scp .post-content figcaption {
    margin-top: 6px;
    color: var(--scp-muted);
    font-size: 0.75rem;
    line-height: 1.4;
    text-align: left;
}

/* Tables: hairlines and a strong header rule, no boxes */
.scp .post-content table {
    font-variant-numeric: tabular-nums;
}

.scp .post-content .wp-block-table thead {
    border-bottom: 2px solid var(--scp-ink);
}

.scp .post-content .wp-block-table th,
.scp .post-content .wp-block-table td {
    border: 0;
    border-bottom: 1px solid var(--scp-line);
}

.scp .post-content .wp-block-table th {
    color: var(--scp-ink);
    font-weight: 600;
    border-bottom: 0;
}

.scp .post-content .wp-block-table tbody td:first-child {
    color: var(--scp-ink);
    font-weight: 600;
}

/* Table text lines up with the headings above it */
.scp .post-content .wp-block-table th:first-child,
.scp .post-content .wp-block-table td:first-child {
    padding-left: 0;
}

/* Phones: tables only scroll when they really can't fit */
@media (max-width: 768px) {
    .scp .post-content table {
        min-width: 0;
        table-layout: auto;
        font-size: 0.9375rem;
    }

    .scp .post-content table th,
    .scp .post-content table td {
        padding: 9px 12px 9px 0;
        word-break: normal;
        overflow-wrap: normal;
    }
}

/* Buttons */
.scp-btn {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0 22px;
    border: 1px solid var(--scp-ink);
    border-radius: 4px;
    background: #fff;
    color: var(--scp-ink);
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.scp-btn:hover {
    background: var(--scp-ink);
    color: #fff;
}

.scp-btn--primary {
    border-color: var(--scp-red);
    background: var(--scp-red);
    color: #fff;
}

.scp-btn--primary:hover {
    border-color: var(--scp-red-dark);
    background: var(--scp-red-dark);
}

.scp-btn:focus-visible {
    outline: 2px solid var(--scp-ink);
    outline-offset: 2px;
}

/* Closing call to action */
.scp-cta {
    margin-top: 40px;
    padding: 20px var(--scp-gutter);
    background: var(--scp-panel);
}

.scp-cta__title {
    margin: 0 0 18px;
    color: var(--scp-ink);
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
}

.scp-cta__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.scp-cta .scp-btn {
    flex: 1 1 200px;
    min-width: 0;
}

.scp-related {
    padding: 32px var(--scp-gutter);
}

.scp-related__title {
    margin: 0 0 16px;
    color: var(--scp-ink);
    font-size: 1.25rem;
    font-weight: 600;
}

.scp-related__list {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
}

/* Desktop: text and photo side by side, then the article with a sticky price card */
@media (min-width: 1024px) {
    /* html and body both set overflow-x, which turns body into a scroll box and
       stops the price card sticking. html still prevents sideways scrolling. */
    body.post-template-size-cost-page {
        overflow: visible;
    }

    .scp-hero {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 48px;
        align-items: center;
        max-width: 1200px;
        margin: 0 auto;
        padding: 16px var(--scp-gutter) 40px;
        box-sizing: border-box;
    }

    .scp-hero--no-image {
        grid-template-columns: minmax(0, 760px);
    }

    .scp-hero__image {
        order: 0;
    }

    .scp-hero__text {
        padding: 0;
    }

    .scp-actions {
        flex-wrap: wrap;
        gap: 10px;
        margin-top: 24px;
    }

    .scp-actions .scp-btn {
        flex: 0 0 auto;
        padding: 0 22px;
        font-size: 1rem;
    }

    .scp-hero__image img {
        border-radius: 4px;
    }

    .scp-sheet {
        box-sizing: border-box;
        max-width: 1200px;
        margin: 0 auto;
        padding: 0 var(--scp-gutter);
    }

    .scp-main {
        display: block;
        min-width: 0;
    }

    .scp-byline {
        order: 0;
    }

    .scp-layout {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 300px;
        gap: 56px;
        align-items: start;
    }

    .scp-side {
        order: 0;
        position: sticky;
        top: 24px;
    }

    .scp-card {
        display: grid;
        gap: 10px;
        margin-bottom: 28px;
        padding-bottom: 24px;
        border-bottom: 2px solid var(--scp-ink);
    }

    .scp-card p {
        margin: 0;
    }

    .scp-card__name {
        font-size: 1rem;
        font-weight: 600;
        color: var(--scp-ink);
    }

    .scp-card .scp-card__price {
        margin-bottom: 6px;
        font-size: 1.375rem;
        font-weight: 700;
        color: var(--scp-ink);
        font-variant-numeric: tabular-nums;
    }

    .scp-toc {
        margin: 0;
    }

    .scp-toc li {
        margin: 0;
    }

    .scp-toc a {
        display: block;
        padding: 7px 0;
        color: var(--scp-ink);
        text-decoration: none;
    }

    .scp-toc a:hover {
        color: var(--scp-red);
    }

    .scp-cta {
        margin-top: 64px;
        padding: 28px var(--scp-gutter);
    }

    .scp-cta__inner {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 32px;
        max-width: 1170px;
        margin: 0 auto;
    }

    .scp-cta__title {
        margin: 0;
        font-size: 1.875rem;
    }

    .scp-cta .scp-btn {
        flex: 0 0 auto;
    }

    .scp-related {
        box-sizing: border-box;
        max-width: 1200px;
        margin: 0 auto;
        padding: 40px var(--scp-gutter) 56px;
    }

    .scp-related__list {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 28px;
    }
}
