/* ===========================================================================
   RKFocus — configure a print. Loads after css/base.css.

   Class names here are a contract with scripts/configurator.js, which builds
   the material and size options and swaps state classes on .price-state,
   .wall-print and .cart-feedback by assigning className outright. Those three
   must not be given extra classes in the markup.
   ======================================================================== */

.configure-page main {
    max-width: var(--measure);
    margin: 0 auto;
    padding: clamp(40px, 5vw, 70px) var(--pad-x) clamp(50px, 7vw, 100px);
}

/* ===========================================================================
   Masthead
   ======================================================================== */

.cfg-head__crumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--faint);
}

.cfg-head__crumbs a {
    transition: color 0.4s ease;
}

.cfg-head__crumbs a:hover {
    color: var(--ivory);
}

.cfg-head__crumbs [aria-current] {
    color: var(--muted);
}

.cfg-head__row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 14px 32px;
    margin-top: clamp(16px, 2.2vw, 28px);
    padding-bottom: clamp(14px, 1.8vw, 22px);
    border-bottom: 1px solid var(--line);
}

.cfg-head__title {
    font-family: var(--serif);
    font-weight: 400;
    font-size: clamp(34px, 5vw, 72px);
    line-height: 1;
    letter-spacing: -0.012em;
}

.cfg-head__meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--faint);
    white-space: nowrap;
}

.cfg-head__foot {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 18px 40px;
    margin-top: clamp(16px, 2vw, 24px);
}

.cfg-head__note {
    max-width: 56ch;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.7;
}

/* The not-found state has no __row or __foot to space things out. */
.cfg-head__title + .cfg-head__note {
    margin-top: 16px;
}

.cfg-head__note + .link-cta {
    margin-top: 26px;
}

/* ===========================================================================
   Layout — the picture leads, the options follow.
   ======================================================================== */

.print-configurator {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(340px, 0.8fr);
    gap: clamp(28px, 4vw, 72px);
    margin-top: clamp(34px, 4.5vw, 64px);
    align-items: start;
}

/* ===========================================================================
   View-only frame — no configurator to show
   ======================================================================== */

.cfg-unavailable {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1fr);
    align-items: center;
    gap: clamp(28px, 5vw, 72px);
    margin-top: clamp(34px, 4.5vw, 64px);
}

/* Capped at the capture's own width — enlarging it here would contradict the
   sentence next to it. */
.cfg-unavailable img {
    width: 100%;
    max-width: min(100%, var(--frame-max, 100%));
    height: auto;
    border: 1px solid var(--line-soft);
}

.cfg-unavailable p:not(.section-eyebrow) {
    max-width: 46ch;
    margin: 18px 0 30px;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.7;
}

@media (max-width: 780px) {
    .cfg-unavailable {
        grid-template-columns: 1fr;
    }
}

/* ===========================================================================
   Preview
   ======================================================================== */

.scene-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.scene-tabs button {
    padding: 8px 16px;
    border: 1px solid var(--line);
    color: var(--muted);
    font-family: var(--mono);
    font-size: 10.5px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    transition: color 0.4s ease, border-color 0.4s ease, background 0.4s ease;
}

.scene-tabs button:hover {
    color: var(--ivory);
    border-color: rgba(242, 239, 232, 0.3);
}

.scene-tabs button[aria-pressed='true'] {
    color: var(--ink);
    background: var(--ivory);
    border-color: var(--ivory);
}

.room-scene {
    position: relative;
    overflow: hidden;
    aspect-ratio: 3 / 2;
    background: var(--ink-2);
    border: 1px solid var(--line-soft);
}

.room-scene > img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.room-scale-note {
    position: absolute;
    right: 12px;
    bottom: 11px;
    padding: 6px 10px;
    background: rgba(8, 9, 11, 0.62);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: rgba(242, 239, 232, 0.8);
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

/* --- the print on the wall: geometry is set from JS in px, so only the
       material treatments live here --- */

.wall-print {
    position: absolute;
    overflow: hidden;
    transform: translate(-50%, -50%);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.4);
    transition: width 0.25s var(--ease), height 0.25s var(--ease), left 0.25s var(--ease), top 0.25s var(--ease);
}

.wall-print img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wall-print.fit-border {
    background: #f5f4ef;
}

.wall-print.fit-border img {
    object-fit: contain;
}

.wall-print.material-fine-art {
    background: #f1eee7;
    box-shadow: 0 7px 15px rgba(0, 0, 0, 0.32);
}

.wall-print.material-fine-art.fit-fill {
    padding: var(--edge-size, 2px);
}

.wall-print.material-canvas {
    box-shadow: 3px 5px 14px rgba(0, 0, 0, 0.5);
    filter: saturate(0.94) contrast(0.98);
}

.wall-print.material-metal::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(120deg, rgba(255, 255, 255, 0.18), transparent 32%, rgba(255, 255, 255, 0.04) 67%, transparent);
}

.wall-print.material-framed {
    padding: var(--mat-size, 3px);
    border: var(--frame-size, 4px) solid #171717;
    background: #f5f4ef;
}

.wall-print.material-framed img {
    object-fit: contain;
}

.wall-print.material-poster {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.28);
}

.preview-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px 16px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--line-soft);
}

.preview-summary strong {
    font-family: var(--serif);
    font-weight: 400;
    font-size: clamp(19px, 1.9vw, 26px);
    line-height: 1.15;
}

.preview-summary span {
    font-family: var(--mono);
    font-size: 10.5px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--faint);
}

/* ===========================================================================
   Controls
   ======================================================================== */

.configurator-controls {
    min-width: 0;
}

/* A fieldset's default min-inline-size is min-content, which stops the
   horizontal option rails below from ever shrinking to the viewport. */
.step {
    min-inline-size: 0;
    margin: 0 0 clamp(26px, 3vw, 40px);
    padding: 0 0 clamp(24px, 2.6vw, 34px);
    border: 0;
    border-bottom: 1px solid var(--line-soft);
}

.step legend {
    display: flex;
    align-items: baseline;
    gap: 12px;
    width: 100%;
    margin-bottom: 18px;
    padding: 0;
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--ivory);
}

.step legend span {
    color: var(--gold);
}

/* --- material --- */

.material-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.option-card,
.size-option {
    position: relative;
    cursor: pointer;
}

.option-card input,
.size-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.option-card > span {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    height: 100%;
    min-height: 74px;
    padding: 13px 14px 13px 18px;
    border: 1px solid var(--line);
    background: rgba(242, 239, 232, 0.015);
    transition: border-color 0.35s ease, background 0.35s ease;
}

/* A hairline of the material's own colour, so the list reads as substances
   rather than as a list of names. */
.option-card > span::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 2px;
    background: var(--swatch, var(--line));
}

.option-card--photo > span {
    --swatch: #d8d5cc;
}

.option-card--fine-art > span {
    --swatch: #bca982;
}

.option-card--poster > span {
    --swatch: #8f9598;
}

.option-card--canvas > span {
    --swatch: #8d7155;
}

.option-card--metal > span {
    --swatch: #aebbc2;
}

.option-card--framed > span {
    --swatch: #58493e;
}

.option-card strong {
    font-family: var(--serif);
    font-weight: 400;
    font-size: 19px;
    line-height: 1.15;
}

.option-card small {
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.45;
}

/* Which option is active has to be unmistakable at a glance — this is a
   choice someone is about to pay for, not a navigational hint. */
.option-card input:checked + span,
.size-option input:checked + span {
    border-color: var(--ivory);
    background: rgba(242, 239, 232, 0.1);
    color: var(--ivory);
}

.option-card input:checked + span::before {
    width: 4px;
}

.size-option input:checked + span small {
    color: var(--muted);
}

.option-card > span:hover,
.size-option > span:hover {
    border-color: rgba(242, 239, 232, 0.32);
}

.option-card input:focus-visible + span,
.size-option input:focus-visible + span {
    outline: 1px solid var(--gold);
    outline-offset: 2px;
}

.option-card.is-disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.loading-copy {
    grid-column: 1 / -1;
    color: var(--faint);
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

/* --- size --- */

.size-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.size-option > span {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 58px;
    padding: 10px 6px;
    border: 1px solid var(--line);
    background: rgba(242, 239, 232, 0.015);
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: 0.04em;
    text-align: center;
    transition: border-color 0.35s ease, background 0.35s ease;
}

.size-option small {
    color: var(--faint);
    font-size: 9.5px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

/* --- finish --- */

.select-label {
    display: block;
    margin-bottom: 9px;
    color: var(--faint);
    font-family: var(--mono);
    font-size: 10.5px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.variant-select {
    width: 100%;
    min-height: 48px;
    padding: 10px 14px;
    border: 1px solid var(--line);
    background: rgba(242, 239, 232, 0.015);
    color: var(--ivory);
    font: inherit;
    font-size: 15px;
    transition: border-color 0.35s ease;
}

.variant-select:hover:not(:disabled) {
    border-color: rgba(242, 239, 232, 0.3);
}

.variant-select:disabled {
    color: var(--muted);
    cursor: not-allowed;
}

.variant-select option {
    background: var(--ink-2);
    color: var(--ivory);
}

/* --- fit --- */

.fit-choice-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 10px;
}

.fit-choice {
    position: relative;
    cursor: pointer;
}

.fit-choice input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.fit-choice > span {
    display: flex;
    flex-direction: column;
    gap: 5px;
    height: 100%;
    min-height: 82px;
    padding: 14px 15px;
    border: 1px solid var(--line);
    background: rgba(242, 239, 232, 0.015);
    transition: border-color 0.35s ease, background 0.35s ease;
}

.fit-choice strong {
    font-family: var(--serif);
    font-weight: 400;
    font-size: 18px;
    line-height: 1.2;
}

.fit-choice small {
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.45;
}

.fit-choice input:checked + span {
    border-color: var(--ivory);
    background: rgba(242, 239, 232, 0.1);
}

.fit-choice > span:hover {
    border-color: rgba(242, 239, 232, 0.32);
}

.fit-choice input:focus-visible + span {
    outline: 1px solid var(--gold);
    outline-offset: 2px;
}

.fit-status {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 15px 16px;
    border: 1px solid var(--line);
    background: rgba(242, 239, 232, 0.015);
}

.fit-status strong {
    font-weight: 400;
    font-size: 15px;
}

.fit-status span {
    color: var(--muted);
    font-size: 13.5px;
    line-height: 1.55;
}

.crop-confirmation {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    margin-top: 10px;
    padding: 13px 15px;
    border: 1px solid rgba(200, 164, 106, 0.45);
    background: rgba(200, 164, 106, 0.08);
    color: #e8d6b4;
    font-size: 13.5px;
    line-height: 1.5;
    cursor: pointer;
}

.crop-confirmation[hidden] {
    display: none;
}

.crop-confirmation input {
    margin-top: 3px;
    accent-color: var(--gold);
}

.quality-note {
    min-height: 1.5em;
    margin-top: 12px;
    color: var(--muted);
    font-size: 13.5px;
    line-height: 1.5;
}

.quality-note.warning {
    color: var(--gold);
}

/* ===========================================================================
   Price and checkout
   ======================================================================== */

.checkout {
    padding-top: 4px;
}

.price-state span {
    display: block;
    font-family: var(--mono);
    font-size: 10.5px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--faint);
}

.price-state strong {
    display: block;
    margin: 8px 0 10px;
    font-family: var(--serif);
    font-weight: 400;
    font-size: clamp(34px, 4vw, 52px);
    line-height: 1;
    letter-spacing: -0.01em;
}

.price-state.is-loading strong {
    opacity: 0.4;
}

.price-state.is-error strong {
    font-size: clamp(19px, 2vw, 24px);
    color: var(--gold);
}

.checkout-placeholder {
    width: 100%;
    margin-top: clamp(20px, 2.5vw, 30px);
    padding: 17px 20px;
    border: 1px solid var(--line);
    color: var(--muted);
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    cursor: not-allowed;
    transition: color 0.4s ease, background 0.4s ease, border-color 0.4s ease;
}

.checkout-placeholder:not(:disabled) {
    border-color: var(--ivory);
    background: var(--ivory);
    color: var(--ink);
    cursor: pointer;
}

.checkout-placeholder:not(:disabled):hover {
    border-color: var(--gold);
    background: var(--gold);
}

.cart-feedback {
    min-height: 1.4em;
    margin-top: 12px;
    color: var(--muted);
    font-size: 13.5px;
    line-height: 1.5;
}

.cart-feedback a {
    color: var(--ivory);
    border-bottom: 1px solid var(--gold);
}

.cart-feedback.is-error {
    color: var(--gold);
}

/* ===========================================================================
   Responsive
   ======================================================================== */

@media (min-width: 981px) {
    .preview-panel {
        position: sticky;
        top: 92px;
    }
}

@media (max-width: 980px) {
    .print-configurator {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 620px) {
    .cfg-head__row {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    /* Horizontal rails keep long option lists from pushing the preview and
       the price off the screen on a phone. */
    .material-grid,
    .size-grid {
        display: flex;
        max-width: 100%;
        gap: 8px;
        padding-bottom: 8px;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        overscroll-behavior-inline: contain;
    }

    .option-card {
        flex: 0 0 min(76vw, 260px);
        scroll-snap-align: start;
    }

    .size-option {
        flex: 0 0 94px;
        scroll-snap-align: start;
    }

    .fit-choice-grid {
        grid-template-columns: 1fr;
    }

    .scene-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
    }

    .scene-tabs button {
        flex: 0 0 auto;
    }
}

@media (prefers-reduced-motion: reduce) {

    .wall-print,
    .option-card > span,
    .size-option > span,
    .scene-tabs button,
    .checkout-placeholder {
        transition: none;
    }
}
