/* ========================= FENCE ADDITIONS =========================
   Only what the fence panel needs on top of the Demo's styles.css — same palette
   (#0071e3 accent, #1d1d1f ink, #86868b muted, #d2d2d7 / #e5e5ea rules), same
   radii and press behaviour. */

.brand-word {
    font-size: 17px; font-weight: 700; letter-spacing: -0.02em;
    color: #1d1d1f; text-decoration: none; white-space: nowrap;
}

/* ---------- the way home ---------- */
/* The logo links to the home page; the caption under it says so. */
.brand-back { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-decoration: none; }
.brand-back-label {
    font-size: 11px; line-height: 1; font-weight: 500; letter-spacing: 0.01em;
    color: #86868b; white-space: nowrap; transition: color 150ms ease;
}
.brand-back:hover .brand-back-label,
.brand-back:focus-visible .brand-back-label { color: #0071e3; }
a { color: #0071e3; }
a:hover { color: #0077ed; }

.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-bottom: 12px; }
.sec-head h3 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -0.02em; color: #1d1d1f; }
.sec-val { font-size: 13px; color: #86868b; font-weight: 500; white-space: nowrap; }

/* ---------- picture cards (slat type, screen) ---------- */
.fx-grid { display: grid; gap: 10px; }
.fx-c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fx-c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.pic-card {
    position: relative; display: flex; flex-direction: column; align-items: stretch; gap: 0;
    padding: 6px 6px 10px; text-align: left; cursor: pointer; font: inherit; color: inherit;
}
.pic-card .thumb {
    display: block; aspect-ratio: 4 / 3; border-radius: 8px; overflow: hidden; background: #f0f1f4;
}
.pic-card .thumb canvas { display: block; width: 100%; height: 100%; }
.pic-card .thumb { position: relative; }
/* the screen band on the Top screen card: the chosen pattern in the slat colour */
.thumb-band { position: absolute; left: 0; right: 0; top: 0; height: 36%; background: #f0f1f4; overflow: hidden; }
.thumb-band canvas, .pat-img canvas { display: block; width: 100%; height: 100%; }
.pic-card .lb { margin: 8px 4px 0; font-size: 14px; font-weight: 600; line-height: 1.2; color: #1d1d1f; }
.pic-card .sb { margin: 2px 4px 0; font-size: 12px; color: #86868b; line-height: 1.3; }
.pic-card .check {
    position: absolute; top: 12px; right: 12px; height: 20px; width: 20px; border-radius: 999px;
    display: flex; align-items: center; justify-content: center;
    background: #0071e3; box-shadow: 0 0 0 2px #fff; opacity: 0; transform: scale(.6);
    transition: opacity 150ms ease, transform 200ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.pic-card.apple-card-selected .check { opacity: 1; transform: scale(1); }

/* ---------- screen patterns (2200×400 mm panels, masked in the slat colour) ---------- */
/* The gap under the Full infill / Top screen cards. It used to be Tailwind's mt-3, which the
   prebuilt tailwind.css does not contain, so the pattern cards sat flush against the screen
   cards and the selected card's ring ran into the one below. */
#group-pattern { margin-top: 14px; }
.fx-seg { display: flex; flex-direction: column; gap: 8px; }
.fx-seg[hidden] { display: none; }
.pat-card { display: flex; flex-direction: column; gap: 10px; width: 100%; padding: 8px 8px 10px; text-align: left; cursor: pointer; font: inherit; }
.pat-img {
    display: block; width: 100%; aspect-ratio: 2200 / 400; border-radius: 6px; overflow: hidden;
    background: #f5f5f7;
}
.pat-meta { display: flex; align-items: center; gap: 10px; padding: 0 4px; }

/* ---------- old segmented pattern control (unused) ---------- */
.fx-seg-old {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px;
    padding: 4px; background: #f5f5f7; border: 1px solid #e5e5ea; border-radius: 10px;
}
.fx-seg-old button {
    appearance: none; border: 1px solid transparent; background: transparent; border-radius: 7px;
    padding: 8px 6px; font: 500 13px/1 inherit; font-family: inherit; color: #6e6e73; cursor: pointer;
    transition: background-color 150ms ease, color 150ms ease;
}
.fx-seg-old button:hover { color: #1d1d1f; }
.fx-seg-old button[aria-pressed="true"] {
    background: #fff; color: #1d1d1f; font-weight: 600; border-color: #d2d2d7;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

/* ---------- colour swatches ---------- */
.sw-btn { background: none; border: 0; padding: 0; cursor: pointer; font: inherit; }
.sw-dot { display: block; height: 40px; width: 40px; border-radius: 999px; overflow: hidden; transition: transform 150ms ease, box-shadow 150ms ease;
    box-shadow: 0 0 0 2px #fff, 0 0 0 3px #d2d2d7; }
.sw-btn[aria-pressed="true"] .sw-dot { box-shadow: 0 0 0 2px #fff, 0 0 0 4px #0071e3; }
.sw-dot canvas { display: block; width: 100%; height: 100%; }
.sw-btn:hover .sw-dot { transform: scale(1.05); }
.sw-btn:active .sw-dot { transform: scale(0.92); }

/* ---------- size steppers ---------- */
#group-size { padding: 0; }
#group-size > * + * { margin-top: 0; }
.dim-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 20px; }
.dim-row + .dim-row { border-top: 1px solid #e5e5ea; }
.dim-label { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.dim-label label { font-size: 15px; font-weight: 600; color: #1d1d1f; letter-spacing: -0.01em; }
.dim-range { font-size: 12px; color: #86868b; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stepper {
    display: flex; align-items: stretch; flex-shrink: 0; height: 40px;
    border: 1px solid #d2d2d7; border-radius: 10px; background: #fff; overflow: hidden;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}
.stepper:focus-within { border-color: #0071e3; box-shadow: 0 0 0 4px rgba(0,113,227,0.15); }
.stepper:has(.num.bad) { border-color: #ff3b30; box-shadow: 0 0 0 4px rgba(255,59,48,0.12); }
.step-btn {
    width: 40px; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
    border: 0; background: #fff; color: #1d1d1f; cursor: pointer; padding: 0;
    transition: background-color 150ms ease, color 150ms ease;
}
.step-btn svg { height: 16px; width: 16px; transition: transform 260ms cubic-bezier(0.34, 1.56, 0.64, 1); }
.step-btn:hover { background: #f5f5f7; }
.step-btn:active { background: #e8e8ed; }
.step-btn:active svg { transform: scale(0.8); transition: transform 90ms ease-out; }
.step-btn:disabled { color: #c7c7cc; cursor: not-allowed; background: #fff; }
.step-btn:focus-visible { outline: 2px solid #0071e3; outline-offset: -2px; }
.step-field {
    display: flex; align-items: baseline; justify-content: center; gap: 4px; padding: 0 8px; width: 96px;
    border-left: 1px solid #e5e5ea; border-right: 1px solid #e5e5ea; cursor: text;
}
.step-field span { font-size: 13px; color: #86868b; line-height: 38px; }
.step-field .num {
    width: 48px; min-width: 0; height: 38px; font-family: inherit; letter-spacing: 0; border: 0; padding: 0; background: transparent; box-shadow: none; border-radius: 0;
    font-size: 16px; font-weight: 600; text-align: right; line-height: 38px;
}
.step-field .num:focus { box-shadow: none; }
@media (hover: none) { .step-btn:hover { background: #fff; } }

/* ---------- size sliders (unused) ---------- */
.dim-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.dim-top label { font-size: 14px; font-weight: 600; color: #1d1d1f; }
.num-wrap { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: #86868b; }
.num {
    width: 76px; padding: 7px 10px; border: 1px solid #d2d2d7; border-radius: 8px; background: #fff;
    font: 500 14px/1 inherit; font-family: inherit; color: #1d1d1f; text-align: right;
    font-variant-numeric: tabular-nums; outline: none; transition: border-color 150ms ease, box-shadow 150ms ease;
    -moz-appearance: textfield;
}
.num::-webkit-outer-spin-button, .num::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.num:focus { border-color: #0071e3; box-shadow: 0 0 0 4px rgba(0,113,227,0.15); }
.num.bad { border-color: #ff3b30; }

.rng {
    -webkit-appearance: none; appearance: none; width: 100%; height: 22px; margin: 0; background: transparent; cursor: pointer;
}
.rng::-webkit-slider-runnable-track {
    height: 4px; border-radius: 999px;
    background: linear-gradient(to right, #0071e3 var(--pct, 50%), #e5e5ea var(--pct, 50%));
}
.rng::-moz-range-track { height: 4px; border-radius: 999px; background: #e5e5ea; }
.rng::-moz-range-progress { height: 4px; border-radius: 999px; background: #0071e3; }
.rng::-webkit-slider-thumb {
    -webkit-appearance: none; height: 22px; width: 22px; margin-top: -9px; border-radius: 999px;
    background: #fff; border: 1px solid #d2d2d7; box-shadow: 0 2px 6px rgba(0,0,0,0.14);
    transition: transform 200ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.rng::-moz-range-thumb {
    height: 22px; width: 22px; border-radius: 999px; background: #fff; border: 1px solid #d2d2d7;
    box-shadow: 0 2px 6px rgba(0,0,0,0.14);
}
.rng:active::-webkit-slider-thumb { transform: scale(1.12); }
.rng:focus-visible { outline: 2px solid #0071e3; outline-offset: 4px; border-radius: 6px; }
.ticks { display: flex; justify-content: space-between; margin-top: 6px; font-size: 11.5px; color: #a1a1a6; font-variant-numeric: tabular-nums; }

/* tailwind's -translate-x-1/2 isn't composed in the prebuilt sheet */
#top-tools, #unity-warning { transform: translateX(-50%); }

/* ---------- Add to cart ---------- */
/* Two labels in one grid cell (the button keeps the wider one's width); .is-added swaps them,
   turns the button green and sends one ring out from it. app.js → addToCart. */
.cta-stack { display: grid; }
.cta-stack > span {
    grid-area: 1 / 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    transition: opacity 180ms ease, visibility 180ms, transform 260ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.cta-added { opacity: 0; visibility: hidden; transform: scale(0.6); }
#btn-checkout.is-added { background: #1f9d55; animation: ctaRing 700ms ease-out; }
#btn-checkout.is-added .cta-default { opacity: 0; visibility: hidden; transform: translateY(-6px); }
#btn-checkout.is-added .cta-added { opacity: 1; visibility: visible; transform: scale(1); }
@keyframes ctaRing {
    from { box-shadow: 0 0 0 0 rgba(31, 157, 85, 0.45); }
    to   { box-shadow: 0 0 0 14px rgba(31, 157, 85, 0); }
}
@media (prefers-reduced-motion: reduce) {
    #btn-checkout.is-added { animation: none; }
    .cta-stack > span { transform: none !important; }
}

/* ---------- gate: panel inert until the engine is up ---------- */
#config-panel .scroll-slim { transition: opacity 160ms ease; }
body:not(.unity-ready) #config-panel .scroll-slim { opacity: 0.45; pointer-events: none; }

@media (max-width: 820px) and (orientation: portrait), (max-height: 520px) and (orientation: landscape) {
    #top-tools { transform: none; }
}
@media (hover: none) {
    .sw-btn:hover .sw-dot { transform: none; }
}
