/* Fitting room: the 3D configurator. The suit stands on a stage at left with its colour groups and tools on top;
   the fabric colours, colourways and actions sit beside it. Desktop: both fit in one screen (the page sets
   --fr-offset to the height above it). Phones: the stage comes first and the colours follow. */
.fitting-room {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(300px, 1fr);
    gap: 20px;
    height: calc(100vh - 100px);
    min-height: 400px;
}

/* Home page: the product picker and the fitting room share one screen. */
/* Shorter than the screen, so the "More below" cue and the top of the next section show under it. */
.fr-screen {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 92px - 64px);
    min-height: 500px;
}

.nj-more {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 6px auto 0;
    padding: 2px 10px;
    background: none;
    border: 0;
    color: var(--nj-dim);
    font-family: var(--nj-display);
    font-weight: 700;
    font-size: 15px;
    letter-spacing: .08em;
    text-transform: uppercase;
    cursor: pointer;
}

.nj-more:hover {
    color: var(--nj-teal);
}

.nj-more .mud-icon-root {
    animation: nj-nudge 1.6s ease-in-out infinite;
}

@keyframes nj-nudge {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(4px); }
}

@media (prefers-reduced-motion: reduce) {
    .nj-more .mud-icon-root {
        animation: none;
    }
}

.fr-screen .fitting-room {
    flex: 1;
    height: auto;
    min-height: 0;
}

.fr-stage {
    position: relative;
    /* The stage's lit gradient fades out to the page colour at its edges, so its outline marks where it ends. */
    border: 1px solid var(--nj-edge);
    border-radius: 2px;
    overflow: hidden;
    min-height: 0;
}

/* What the viewer draws behind a suit on the night stage, shown until the canvas fades in. */
.fr-stage.fr-night {
    background: var(--nj-lit);
}

.fr-canvas {
    position: absolute;
    inset: 0;
}

.fr-stage canvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
    opacity: 0;
}

/* Fades in once the suit is drawn (set by the viewer). */
.fr-stage canvas.fr-shown {
    opacity: 1;
    transition: opacity 0.15s ease-out;
}

/* The previous suit, while the next one loads. */
.fr-stage canvas.fr-shown.fr-dim {
    opacity: 0.35;
}

.fr-progress {
    position: absolute !important;
    left: 0;
    right: 0;
    top: 0;
}

.fr-legend {
    position: absolute;
    right: 12px;
    top: 12px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.fr-legend button {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(12, 17, 24, .72);
    border: 1px solid #253042;
    color: #e7ecf2;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 500;
    padding: 5px 11px 5px 6px;
    border-radius: 2px;
    cursor: pointer;
}

.fr-legend button[aria-pressed="true"] {
    border-color: var(--fr-accent);
    box-shadow: inset 0 0 0 1px var(--fr-accent);
}

.fr-dot {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, .3);
    flex: none;
    vertical-align: middle;
    margin-right: 8px;
}

.fr-legend .fr-dot {
    margin-right: 0;
}

/* The touch scroll bar: only on touch screens, where the suit would otherwise swallow every swipe. */
.fr-scroll-rail {
    display: none;
}

@media (pointer: coarse) {
    .fr-scroll-rail {
        position: absolute;
        top: 0;
        right: 0;
        bottom: var(--fr-strip, 0px);
        width: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        touch-action: pan-y;
        background: linear-gradient(90deg, transparent, rgba(10, 16, 25, .55));
        border-left: 1px dashed rgba(201, 210, 221, .18);
    }

    .fr-scroll-rail span {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 2px;
        padding: 6px 0;
        width: 28px;
        border-radius: 14px;
        background: rgba(12, 17, 24, .75);
        border: 1px solid var(--nj-edge);
        color: #c9d2dd;
    }

    .fr-scroll-rail b {
        writing-mode: vertical-rl;
        font-family: var(--nj-display);
        font-size: 11px;
        font-weight: 600;
        letter-spacing: .14em;
        text-transform: uppercase;
        padding: 4px 0;
    }
}

/* A wide touch screen keeps the colour groups down the right side, so they move in beside the scroll bar. */
@media (pointer: coarse) and (min-width: 961px) {
    .fr-legend {
        right: 52px;
    }
}

.fr-tools {
    position: absolute;
    left: 8px;
    top: 8px;
    display: flex;
    flex-direction: column;
    background: rgba(12, 17, 24, .55);
    border-radius: 6px;
}

.fr-tools .mud-icon-button {
    color: #c9d2dd;
}

/* The 3D view's how-to: shown once, then from the "?" button. */
.fr-help {
    position: absolute;
    left: 50%;
    bottom: 16px;
    transform: translateX(-50%);
    width: min(460px, calc(100% - 24px));
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px 16px;
    background: rgba(10, 16, 25, .92);
    border: 1px solid var(--nj-edge);
    border-radius: 2px;
    color: var(--nj-text);
}

.fr-help-title {
    font-family: var(--nj-display);
    font-size: 18px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.fr-help .fr-mode {
    align-self: flex-start;
}

.fr-help-table {
    border-collapse: collapse;
    font-size: 13px;
}

.fr-help-table th, .fr-help-table td {
    padding: 3px 14px 3px 0;
    text-align: left;
    vertical-align: top;
}

.fr-help-table th {
    color: var(--nj-dim);
    font-weight: 400;
    white-space: nowrap;
}

.fr-help-table tr:first-child th:not(:first-child) {
    color: var(--nj-teal);
    font-family: var(--nj-display);
    text-transform: uppercase;
    letter-spacing: .08em;
    font-weight: 600;
}

.fr-help .mud-button-root {
    align-self: flex-end;
}

/* "Click the suit to zoom", shown for a moment when the wheel scrolls the page over the suit. */
.fr-wheel-msg {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    padding: 8px 14px;
    border-radius: 4px;
    background: rgba(12, 17, 24, .8);
    color: #eef3f7;
    font-size: 14px;
    pointer-events: none;
    opacity: 0;
    transition: opacity .2s;
}

.fr-wheel-hint .fr-wheel-msg {
    opacity: 1;
}

.fr-side {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.fr-scroll {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 22px;
    min-height: 0;
    overflow-y: auto;
    padding-right: 4px;
    padding-bottom: 14px;
}

/* Save / revert and the page's own actions (add to cart) stay below the scrolling colours. */
.fr-foot {
    flex: none;
    display: grid;
    gap: 10px;
    padding-top: 12px;
    border-top: 1px solid var(--fr-line);
}

.fr-eyebrow {
    font-family: var(--nj-display);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--mud-palette-text-secondary);
}

.fr-title {
    font-family: var(--nj-display);
    text-transform: uppercase;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: .02em;
    line-height: 1.1;
}

.fr-selection-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}

.fr-mode {
    display: inline-flex;
    border: 1px solid var(--fr-line);
    border-radius: 2px;
    overflow: hidden;
}

.fr-mode button, .fr-swatch, .fr-colourway, .fr-pick {
    font: inherit;
    color: inherit;
    cursor: pointer;
}

.fr-mode button {
    background: none;
    border: 0;
    padding: 5px 12px;
    font-family: var(--nj-display);
    text-transform: uppercase;
    letter-spacing: .08em;
    font-weight: 600;
    font-size: 13px;
}

.fr-mode button[aria-pressed="true"] {
    background: var(--fr-accent);
    color: var(--nj-ink);
    font-weight: 700;
}

.fr-swatches {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
    gap: 6px;
}

.fr-swatch {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    background: none;
    border: 1px solid transparent;
    border-radius: 2px;
    padding: 4px;
    text-align: left;
}

.fr-swatch span {
    height: 34px;
    border-radius: 3px;
    border: 1px solid var(--fr-line);
}

.fr-swatch em {
    font-style: normal;
    font-size: 12px;
    line-height: 1.2;
}

.fr-swatch[aria-pressed="true"], .fr-colourway[aria-pressed="true"], .fr-pick[aria-pressed="true"] {
    border-color: var(--fr-accent);
    box-shadow: inset 0 0 0 1px var(--fr-accent);
}

.fr-note {
    margin: 0;
    color: var(--mud-palette-text-secondary);
}

/* Customer print (prototype, ?print): the file input hides behind a button-like label. */
.fr-print-upload {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--fr-line);
    border-radius: 2px;
    padding: 6px 10px;
    margin-bottom: 8px;
    cursor: pointer;
    font-family: var(--nj-display);
    text-transform: uppercase;
}

.fr-print-upload:hover, .fr-print-upload:focus-within {
    border-color: var(--fr-accent);
}

.fr-print-upload input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.fr-print-how {
    margin: 8px 0;
}

.fr-print-how summary {
    cursor: pointer;
    color: var(--fr-accent);
}

.fr-print-how img {
    display: block;
    width: 100%;
    height: auto;
    margin: 8px 0;
    border-radius: 2px;
}

.fr-print-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 8px;
}

.fr-print-list button {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    background: none;
    border: 1px solid var(--fr-line);
    border-radius: 2px;
    padding: 6px 9px;
    color: inherit;
    text-align: left;
}

.fr-print-list button span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fr-print-list button em {
    font-style: normal;
    color: var(--mud-palette-text-secondary);
    white-space: nowrap;
}

.fr-print-list button[aria-pressed="true"] {
    border-color: var(--fr-accent);
    box-shadow: inset 0 0 0 1px var(--fr-accent);
}

/* Handles over the selected graphic on the 3D view (prints.js). Only the handles take the pointer; elsewhere the
   suit turns as usual. */
.fr-print-overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    touch-action: none;
    overflow: visible;
}

.fr-print-frame {
    fill: rgba(255, 255, 255, 0.04);
    stroke: var(--fr-accent);
    stroke-width: 1.5;
    stroke-dasharray: 6 4;
    pointer-events: all;
    cursor: move;
    touch-action: none;
}

.fr-print-corner, .fr-print-knob {
    fill: #fff;
    stroke: var(--fr-accent);
    stroke-width: 2;
    pointer-events: all;
    touch-action: none;
}

.fr-print-corner {
    cursor: nwse-resize;
}

.fr-print-knob {
    cursor: grab;
}

.fr-print-stem {
    stroke: var(--fr-accent);
    stroke-width: 1.5;
}

.fr-print-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.fr-colourways {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 6px;
}

.fr-colourway {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    background: none;
    border: 1px solid var(--fr-line);
    border-radius: 2px;
    padding: 7px 9px;
    text-align: left;
    font-family: var(--nj-display);
    text-transform: uppercase;
    letter-spacing: .04em;
    font-size: 14px;
    font-weight: 600;
}

.fr-surprise {
    border-style: dashed;
    border-color: var(--fr-accent);
}

.fr-more {
    justify-content: center;
    align-items: center;
    color: var(--mud-palette-text-secondary);
    border-style: dashed;
}

.fr-more:hover {
    color: inherit;
    border-color: var(--fr-accent);
}

.fr-surprise:disabled {
    cursor: progress;
}

/* Before the first roll the strip hints at "any colour". */
.fr-strip .fr-any {
    background: linear-gradient(90deg, #ef800e, #e60993, #1fbaba, #e7fc25, #17c144);
}

.fr-strip {
    display: flex;
    height: 10px;
    border-radius: 2px;
    overflow: hidden;
}

.fr-strip i {
    flex: 1;
}

.fr-spec {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.fr-spec td {
    padding: 5px 0;
    border-bottom: 1px solid var(--fr-line);
    vertical-align: middle;
}

.fr-spec tr {
    cursor: pointer;
}

.fr-spec tr:hover td, .fr-spec tr:focus-visible td {
    background: rgba(24, 180, 196, .08);
}

.fr-spec tr[aria-selected="true"] td {
    background: rgba(24, 180, 196, .14);
    color: var(--nj-text);
}

.fr-spec tr[aria-selected="true"] td:first-child {
    box-shadow: inset 2px 0 0 var(--fr-accent);
}

.fr-spec td:first-child {
    padding-left: 6px;
}

.fr-spec td:last-child {
    padding-right: 6px;
    text-align: right;
    color: var(--mud-palette-text-secondary);
}

.fr-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Product picker above the home page fitting room. */
.fr-picker-wrap {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
}

.fr-picker {
    flex: 1;
    min-width: 0;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 6px;
}

.fr-picker-arrow {
    flex: none;
    width: 34px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--nj-ink2);
    border: 1px solid var(--nj-edge);
    border-radius: 2px;
    color: var(--nj-text);
    cursor: pointer;
}

.fr-picker-arrow:hover:not(:disabled) {
    border-color: var(--nj-teal);
    color: var(--nj-teal);
}

.fr-picker-arrow:disabled {
    opacity: 0.35;
    cursor: default;
}

.fr-pick {
    flex: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    width: 96px;
    padding: 4px 4px 6px;
    background: none;
    border: 1px solid var(--nj-edge);
    border-radius: 2px;
    font-family: var(--nj-display);
    text-transform: uppercase;
    letter-spacing: .04em;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
}

.fr-pick span {
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fr-pick img {
    width: 52px;
    height: 52px;
    object-fit: contain;
}
