/* ==========================================================================
   Rack theme — one-page clothing store (StorkPlus)
   The collection hangs side-on from a rail; the active piece turns to face
   the shopper (CSS 3D rotateY on the product photo). Photos on white or
   transparent backgrounds both work: white is multiplied into the page.
   ========================================================================== */

:root {
    --rack-bg: #f4f0ea;
    --rack-ink: #1c1b19;
    --rack-muted: #8a8478;
    --rack-line: #e2dcd2;
    --rack-card: #fbf9f5;
    --rack-ease: cubic-bezier(.22, .8, .24, 1);
    --rack-h: 350px;        /* height of one hanging slot */
    --rack-slot: 92px;      /* width of a garment seen side-on */
    --rack-slot-on: 230px;  /* width of the garment facing front */
}

body.rack-theme {
    margin: 0;
    background: var(--rack-bg);
    color: var(--rack-ink);
    font-family: 'Inter', 'Cairo', system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
}

body.rack-theme.rack-rtl { font-family: 'Cairo', 'Inter', system-ui, sans-serif; }

.rack-page { min-height: 100vh; display: flex; flex-direction: column; }
.rack-main { flex: 1 0 auto; }

/* ── header ─────────────────────────────────────────────────────────────── */
.rack-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 24px;
    padding: 18px clamp(16px, 4vw, 48px);
}

.rack-logo { justify-self: start; display: inline-flex; align-items: center; text-decoration: none; color: var(--rack-ink); }
.rack-logo img { max-height: 36px; width: auto; display: block; }
.rack-logo span { font-weight: 700; font-size: 18px; letter-spacing: -.01em; }

.rack-nav { display: flex; gap: 26px; }
.rack-nav a { color: var(--rack-muted); text-decoration: none; font-size: 13.5px; font-weight: 500; transition: color .2s; white-space: nowrap; }
.rack-nav a:hover, .rack-nav a:focus-visible { color: var(--rack-ink); }

.rack-tools { justify-self: end; display: flex; align-items: center; gap: 10px; }

.rack-search {
    display: flex; align-items: center; gap: 6px;
    background: rgba(28, 27, 25, .05); border-radius: 999px; padding: 7px 14px; width: 180px;
}
.rack-search svg { width: 16px; height: 16px; flex: none; }
.rack-search input { border: 0; background: transparent; outline: none; width: 100%; font: inherit; font-size: 13px; color: var(--rack-ink); }

.rack-icon-btn {
    position: relative; display: inline-grid; place-items: center;
    width: 38px; height: 38px; border-radius: 50%; border: 0; background: transparent; color: var(--rack-ink); cursor: pointer;
}
.rack-icon-btn:hover { background: rgba(28, 27, 25, .06); }
.rack-icon-btn svg, .rack-search svg, .rack-close svg {
    fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}
.rack-icon-btn svg { width: 21px; height: 21px; }

.rack-cart-count {
    position: absolute; top: 2px; inset-inline-end: 0;
    min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px;
    background: var(--rack-ink); color: #fff; font-size: 10px; font-weight: 700; line-height: 17px; text-align: center;
}
.rack-cart-count[hidden] { display: none; }

.rack-lang { color: var(--rack-muted); font-size: 13px; text-decoration: none; padding: 0 6px; }
.rack-lang:hover { color: var(--rack-ink); }

/* ── hero / rack ────────────────────────────────────────────────────────── */
.rack-hero { text-align: center; padding: clamp(18px, 4vh, 44px) 0 24px; }

/* The one-page home: the rack sits in the middle of the screen, between header and footer. */
.rack-main:has(> .rack-hero) { display: flex; flex-direction: column; }
.rack-main > .rack-hero {
    flex: 1 0 auto; display: flex; flex-direction: column; justify-content: center; align-items: center;
    padding-bottom: clamp(18px, 4vh, 44px);
}
.rack-main > .rack-hero > * { width: 100%; }
.rack-main > .rack-hero > .rack-eyebrow { width: auto; }

.rack-eyebrow {
    margin: 0; font-size: 11px; font-weight: 600; letter-spacing: .22em; text-transform: uppercase; color: var(--rack-muted);
    display: inline-flex; gap: 10px;
}
.rack-rtl .rack-eyebrow { letter-spacing: 0; font-size: 13px; }

.rack-rail-wrap { position: relative; max-width: 1360px; margin: 26px auto 0; padding: 0 clamp(16px, 4vw, 48px); }

.rack-rail {
    position: absolute; top: 30px; inset-inline: clamp(16px, 4vw, 48px); height: 4px; border-radius: 4px;
    background: linear-gradient(180deg, #ddd8cf 0%, #a49e94 55%, #c9c3b9 100%);
    box-shadow: 0 1px 2px rgba(0, 0, 0, .12);
}
.rack-rail i {
    position: absolute; top: 50%; width: 12px; height: 12px; border-radius: 50%; transform: translateY(-50%);
    background: radial-gradient(circle at 35% 35%, #e9e5de, #8f897f);
}
.rack-rail i:first-child { inset-inline-start: -4px; }
.rack-rail i:last-child { inset-inline-end: -4px; }

.rack-items {
    list-style: none; margin: 0; padding: 0;
    display: flex; justify-content: center; align-items: flex-start;
    height: var(--rack-h);
}

.rack-item {
    position: relative; flex: 0 0 var(--rack-slot); height: 100%;
    transition: flex-basis .6s var(--rack-ease);
}
.rack-item.is-active { flex-basis: var(--rack-slot-on); z-index: 3; }

.rack-garment {
    all: unset; box-sizing: border-box; position: absolute; inset: 0; cursor: pointer;
    transform-origin: 50% 30px;
    animation: rack-sway 6s ease-in-out infinite;
    animation-delay: calc(var(--i) * -.7s);
}
.rack-garment:focus-visible .rack-figure { outline: 2px solid var(--rack-ink); outline-offset: 4px; }
.rack-item.is-active .rack-garment { animation: rack-settle .9s var(--rack-ease); }

@keyframes rack-sway {
    0%, 100% { transform: rotate(-.6deg); }
    50% { transform: rotate(.6deg); }
}
@keyframes rack-settle {
    0% { transform: rotate(2.2deg); }
    45% { transform: rotate(-1.2deg); }
    100% { transform: rotate(0); }
}

/* hanger: hook sits on the rail */
.rack-hanger {
    position: absolute; top: 20px; left: 50%; width: 58px; transform: translateX(-50%) scaleX(.42);
    transition: transform .6s var(--rack-ease);
}
.rack-item.is-active .rack-hanger { transform: translateX(-50%) scaleX(1); }
.rack-hanger svg { display: block; width: 100%; height: auto; fill: none; stroke: #6e695f; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }

/* price tag on a string */
.rack-tag {
    position: absolute; top: 36px; inset-inline-end: calc(50% + 4px); z-index: 2;
    transform-origin: top right; transform: rotate(6deg);
    padding-top: 10px; pointer-events: none;
}
.rack-rtl .rack-tag { transform-origin: top left; transform: rotate(-6deg); }
.rack-tag::before { content: ''; position: absolute; top: 0; inset-inline-end: 6px; width: 1px; height: 11px; background: #9a948a; }
.rack-tag span {
    display: block; background: #fff; color: var(--rack-ink); font-size: 9.5px; font-weight: 600; white-space: nowrap;
    padding: 3px 6px; border-radius: 3px; box-shadow: 0 1px 3px rgba(0, 0, 0, .12);
}
.rack-item.is-active .rack-tag { transform: rotate(-4deg) translateX(-46px); }
.rack-rtl .rack-item.is-active .rack-tag { transform: rotate(4deg) translateX(46px); }

/* the garment: a front photo turned side-on in 3D */
.rack-figure {
    position: absolute; top: 44px; left: 50%; width: 210px; height: 300px;
    transform: translateX(-50%) perspective(900px) rotateY(62deg);
    transform-origin: 50% 0;
    transition: transform .65s var(--rack-ease);
    /* Photos on white are multiplied into this page-coloured backing: blending
       can't reach the page itself through the 3D-transformed parents. */
    background: var(--rack-bg);
}
.rack-rtl .rack-figure { transform: translateX(-50%) perspective(900px) rotateY(-62deg); }
.rack-item.is-active .rack-figure { transform: translateX(-50%) perspective(900px) rotateY(0deg) scale(1.04); }
/* Transparent cut-outs need no backing, so no box shows while the piece turns. */
.rack-figure.is-cutout { background: none; }
.rack-figure.is-cutout img { mix-blend-mode: normal; filter: drop-shadow(0 10px 14px rgba(40, 30, 20, .10)); }

.rack-figure img {
    width: 100%; height: 100%; object-fit: contain; object-position: 50% 0;
    mix-blend-mode: multiply; user-select: none; pointer-events: none;
}

/* caption under the rack */
/* Above the hanging pieces: a turned-away figure reaches below the rack and
   must not paint over the name. */
.rack-caption { position: relative; z-index: 5; margin-top: 6px; min-height: 120px; }
.rack-caption-name { margin: 0 0 4px; font-size: 15px; font-weight: 600; }
.rack-caption-line { margin: 0 auto 14px; max-width: 520px; font-size: 13px; color: var(--rack-muted); }

.rack-pill {
    font: inherit; font-size: 12.5px; font-weight: 500; color: var(--rack-ink);
    background: var(--rack-card); border: 1px solid var(--rack-line); border-radius: 999px; padding: 8px 20px; cursor: pointer;
    transition: background .2s, color .2s, border-color .2s;
}
.rack-pill:hover { background: var(--rack-ink); color: #fff; border-color: var(--rack-ink); }

.rack-empty { margin: 80px auto; color: var(--rack-muted); }

/* ── product panel ──────────────────────────────────────────────────────── */
.rack-panel {
    position: fixed; inset: 0; z-index: 1040; background: var(--rack-bg); overflow-y: auto;
    opacity: 0; transition: opacity .35s ease;
}
.rack-panel.is-open { opacity: 1; }
.rack-panel[hidden] { display: none; }

.rack-close {
    position: absolute; top: 18px; inset-inline-end: clamp(16px, 4vw, 48px); z-index: 2;
    display: inline-flex; align-items: center; gap: 6px;
    font: inherit; font-size: 13px; color: var(--rack-muted); background: none; border: 0; cursor: pointer;
}
.rack-close:hover { color: var(--rack-ink); }
.rack-close svg { width: 16px; height: 16px; }

.rack-panel-inner {
    min-height: 100%; max-width: 1080px; margin: 0 auto; padding: 72px clamp(16px, 4vw, 48px) 48px;
    display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: center; gap: clamp(24px, 5vw, 72px);
}

.rack-panel-media { position: relative; text-align: center; padding-top: 34px; background: var(--rack-bg); }
.rack-panel-media img {
    max-width: 100%; max-height: 68vh; object-fit: contain; mix-blend-mode: multiply;
    transform: translateY(14px) rotateY(60deg); opacity: 0; transform-origin: 50% 0;
    transition: transform .7s var(--rack-ease), opacity .5s ease;
}
.rack-panel.is-open .rack-panel-media img { transform: none; opacity: 1; }
.rack-hanger-lg { top: 0; width: 96px; transform: translateX(-50%); }

.rack-panel-info { max-width: 360px; }
.rack-panel-cat { margin: 0 0 6px; font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--rack-muted); }
.rack-rtl .rack-panel-cat { letter-spacing: 0; font-size: 12.5px; }
.rack-panel-name { margin: 0 0 4px; font-size: 26px; font-weight: 600; letter-spacing: -.01em; }
.rack-panel-price { margin: 0 0 18px; font-size: 15px; }

.rack-tabs { display: flex; gap: 18px; border-bottom: 1px solid var(--rack-line); margin-bottom: 10px; }
.rack-tabs button {
    font: inherit; font-size: 12.5px; color: var(--rack-muted); background: none; border: 0; padding: 0 0 8px; cursor: pointer;
    border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.rack-tabs button.is-on { color: var(--rack-ink); border-bottom-color: var(--rack-ink); }
.rack-tab-body { font-size: 13px; color: #55504a; line-height: 1.6; margin: 0 0 18px; min-height: 42px; }

.rack-size-label { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--rack-muted); margin: 0 0 8px; }
.rack-rtl .rack-size-label { letter-spacing: 0; font-size: 12.5px; }
.rack-sizes { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.rack-sizes button {
    min-width: 42px; height: 42px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--rack-line);
    background: var(--rack-card); color: var(--rack-ink); font: inherit; font-size: 13px; cursor: pointer; transition: all .2s;
}
.rack-sizes button:hover { border-color: var(--rack-ink); }
.rack-sizes button[aria-checked="true"] { background: var(--rack-ink); color: #fff; border-color: var(--rack-ink); }
.rack-sizes button:disabled { opacity: .35; text-decoration: line-through; cursor: not-allowed; }

.rack-add {
    width: 100%; height: 50px; border-radius: 999px; border: 0; cursor: pointer;
    background: var(--rack-ink); color: #fff; font: inherit; font-size: 14px; font-weight: 600;
    transition: transform .15s, opacity .2s;
}
.rack-add:hover { transform: translateY(-1px); }
.rack-add:disabled { opacity: .6; cursor: progress; }
.rack-add.is-done { background: #2f5e3a; }

.rack-panel-msg { margin: 10px 0 0; font-size: 12.5px; color: #a33a2a; }
.rack-panel-msg[hidden] { display: none; }

.rack-panel-links { display: flex; justify-content: space-between; gap: 12px; margin-top: 16px; font-size: 12.5px; }
.rack-panel-links a { color: var(--rack-muted); text-decoration: none; }
.rack-panel-links a:hover { color: var(--rack-ink); text-decoration: underline; }
.rack-panel-links a[hidden] { display: none; }

.rack-fly { position: fixed; z-index: 2000; pointer-events: none; mix-blend-mode: multiply; }

/* ── Sylius pages inside the frame (product page, cart, checkout, cards) ── */
.rack-theme .btn-primary,
.rack-theme .btn-primary:disabled,
.rack-theme .btn-primary.disabled {
    --bs-btn-bg: var(--rack-ink); --bs-btn-border-color: var(--rack-ink); --bs-btn-color: #fff;
    --bs-btn-hover-bg: #000; --bs-btn-hover-border-color: #000; --bs-btn-hover-color: #fff;
    --bs-btn-active-bg: #000; --bs-btn-active-border-color: #000; --bs-btn-active-color: #fff;
    --bs-btn-disabled-bg: var(--rack-ink); --bs-btn-disabled-border-color: var(--rack-ink); --bs-btn-disabled-color: #fff;
    --bs-btn-focus-shadow-rgb: 28, 27, 25;
    background: var(--rack-ink) !important; border-color: var(--rack-ink) !important; color: #fff !important;
    border-radius: 999px; font-weight: 600; padding: .7rem 1.6rem;
}
.rack-theme .btn-primary:hover { background: #000 !important; border-color: #000 !important; }
.rack-theme .btn-primary .icon { fill: currentColor; color: #fff; }
.rack-theme #add-to-cart-button { width: 100%; }
/* The bundled stylesheet colours plain links white (made for a dark header). */
.rack-main a:not(.btn) { color: var(--rack-ink); text-underline-offset: 3px; }
.rack-theme .btn-outline-secondary,
.rack-theme .btn-outline-primary {
    background: transparent !important; color: var(--rack-ink) !important; border-color: var(--rack-line) !important;
    border-radius: 999px;
}
.rack-theme .btn-outline-secondary:hover,
.rack-theme .btn-outline-primary:hover { border-color: var(--rack-ink) !important; }
.rack-theme .btn-outline-secondary .icon, .rack-theme .btn-outline-primary .icon { color: var(--rack-ink); fill: currentColor; }

/* Product-card quick add-to-cart + size overlay (shared card template). */
.product-card-atc { position: static; }
.product-card-atc .atc-toggle { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.product-card-atc .atc-open { cursor: pointer; }
.atc-overlay {
    display: none; position: absolute; inset: 0; z-index: 5; padding: 1rem; overflow: auto;
    background: var(--rack-card); border-radius: inherit;
}
.product-card-atc .atc-toggle:checked ~ .atc-overlay { display: flex; flex-direction: column; }
.atc-overlay .atc-overlay-body { margin: auto 0; width: 100%; }
.atc-overlay .atc-overlay-title { font-weight: 600; margin-bottom: .5rem; }
.atc-overlay .atc-close { position: absolute; top: .4rem; inset-inline-end: .4rem; cursor: pointer; line-height: 1; color: #555; }
.atc-overlay .atc-close:hover { color: var(--rack-ink); }

.rack-footer { text-align: center; color: var(--rack-muted); font-size: 12px; padding: 28px 16px; }

body.rack-panel-open { overflow: hidden; }

/* ── phones / tablets ───────────────────────────────────────────────────── */
@media (max-width: 860px) {
    :root { --rack-h: 320px; --rack-slot: 70px; --rack-slot-on: 180px; }
    .rack-header { grid-template-columns: auto 1fr; row-gap: 10px; }
    .rack-nav { grid-column: 1 / -1; grid-row: 2; overflow-x: auto; gap: 18px; scrollbar-width: none; }
    .rack-search { display: none; }
    .rack-items { justify-content: flex-start; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x proximity; padding: 0 20px; scrollbar-width: none; }
    .rack-item { scroll-snap-align: center; }
    .rack-figure { width: 170px; height: 250px; }
    .rack-panel-inner { grid-template-columns: 1fr; padding-top: 56px; align-items: start; }
    .rack-panel-media img { max-height: 46vh; }
    .rack-panel-info { max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
    .rack-garment, .rack-item.is-active .rack-garment { animation: none; }
    .rack-item, .rack-figure, .rack-hanger, .rack-panel, .rack-panel-media img { transition: none; }
}
