/* ==========================================================================
   New design (Carrot, Oct 2026): sample request (screen 21): list, shipping, confirmation
   3-step bar, rows with meters/hangers steppers, summary, the loom mark, floating-label form,
   the woven success mark. Values from the delivered prototype (app.css .flow-steps, .bk-*,
   .fl-*, .ship-*, .confirm-*, .empty-loom). Loaded only for Preview users.
   ========================================================================== */

/* ---------- 1. List  2. Shipping  3. Confirm ---------- */
.s2-flow-steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    padding: 0 16px 18px;
}
.s2-flow-steps.s2-flow-steps-top {
    padding-top: 22px;
}
.s2-flow-step-bar {
    position: relative;
    display: block;
    height: 3px;
    overflow: hidden;
    background: var(--s2-border);
}
.s2-flow-step-bar::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--s2-indigo);
    transform: scaleX(0);
    transform-origin: left center;
}
.s2-flow-step.is-done .s2-flow-step-bar::after {
    transform: scaleX(1);
}
.s2-flow-step.is-active .s2-flow-step-bar::after {
    animation: s2BarFill 0.8s var(--s2-ease-in-out) 0.35s forwards;
}
.s2-flow-step-label {
    display: block;
    margin-top: 7px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--s2-text-faint);
}
.s2-flow-step.is-active .s2-flow-step-label,
.s2-flow-step.is-done .s2-flow-step-label {
    color: var(--s2-indigo);
}

/* ---------- Rows ---------- */
.s2-bk-list {
    border-top: 1px solid var(--s2-border);
}
.s2-bk-row {
    position: relative;
    display: grid;
    grid-template-columns: 84px 1fr;
    gap: 14px;
    padding: 16px 44px 16px 16px;
    border-bottom: 1px solid var(--s2-border);
    background: #fff;
    overflow: hidden;
    transition: transform 0.4s cubic-bezier(0.55, 0, 0.35, 1), opacity 0.4s ease,
                height 0.35s var(--s2-ease-in-out) 0.2s, padding 0.35s ease 0.2s;
    animation: s2LogoRise 0.55s var(--s2-ease-out) calc(0.3s + var(--d, 0) * 70ms) backwards;
}
/* Removed: slides out to the right and closes */
.s2-bk-row.is-removing {
    transform: translateX(105%);
    opacity: 0;
    height: 0 !important;
    padding-top: 0;
    padding-bottom: 0;
}
.s2-bk-thumb {
    display: block;
    width: 84px;
    height: 100px;
    object-fit: cover;
}
.s2-bk-name {
    font-size: 13px;
    font-weight: 700;
    line-height: 1.3;
    text-transform: uppercase;
    color: var(--s2-indigo);
}
.s2-bk-code {
    margin: 2px 0 8px;
    font-size: 11px;
    color: var(--s2-text-muted);
}
.s2-bk-step {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 0;
}
.s2-bk-step-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--s2-indigo);
}
.s2-bk-step-label small {
    display: block;
    font-size: 10px;
    font-weight: 400;
    text-transform: none;
    color: var(--s2-text-muted);
}
.s2-stepper-sm .s2-stepper-btn {
    width: 30px;
    height: 28px;
    font-size: 15px;
}
.s2-stepper-sm .s2-stepper-val {
    width: auto;
    min-width: 24px;
    font-size: 13px;
}
.s2-bk-remove {
    position: absolute;
    top: 12px;
    right: 8px;
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: none;
    color: var(--s2-text-muted);
    cursor: pointer;
}

/* ---------- Summary ---------- */
.s2-bk-summary {
    padding: 18px 16px 28px;
}
.s2-bk-summary-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--s2-indigo);
}
.s2-bk-summary-row strong {
    font-weight: 900;
}
.s2-bk-summary-sub {
    margin: 6px 0 18px;
    font-size: 12px;
    font-weight: 400;
    text-transform: none;
    color: var(--s2-text-muted);
}

/* ---------- Empty list: the loom keeps weaving ---------- */
.s2-empty-loom {
    width: 64px;
    height: 64px;
    margin-bottom: 20px;
    overflow: visible;
}
.s2-empty-loom .s2-weave-thread {
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    animation: s2LoomWeave 3.2s var(--s2-ease-in-out) calc(0.4s + var(--d, 0) * 0.12s) infinite;
}

/* ---------- Shipping form ---------- */
.s2-ship-form {
    padding: 4px 16px 32px;
}
.s2-ship-group-title {
    margin: 24px 0 4px;
    font-family: var(--s2-font);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--s2-indigo);
}
.s2-ship-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.s2-ship-row.s2-ship-row-phone {
    grid-template-columns: 84px 1fr;
}
.s2-fl-field {
    position: relative;
    display: block;
    margin-top: 6px;
    padding-top: 18px;
}
.s2-fl-field input,
.s2-fl-field select {
    width: 100%;
    padding: 8px 0;
    border: 0;
    border-bottom: 1px solid var(--s2-border);
    border-radius: 0;
    background: transparent;
    font-family: var(--s2-font);
    font-size: 16px; /* 16px so iOS does not zoom in */
    color: var(--s2-indigo);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}
.s2-fl-select select {
    padding-right: 18px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2300315A' stroke-width='2.4'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 2px center;
}
/* The label sits in the field and moves up, smaller, once it has a value */
.s2-fl-label {
    position: absolute;
    left: 0;
    top: 26px;
    font-size: 14px;
    color: var(--s2-text-faint);
    pointer-events: none;
    transform-origin: left top;
    transition: transform 0.3s var(--s2-ease-out), color 0.2s ease;
}
.s2-fl-field input:focus ~ .s2-fl-label,
.s2-fl-field input:not(:placeholder-shown) ~ .s2-fl-label,
.s2-fl-field select:focus ~ .s2-fl-label,
.s2-fl-field select:valid ~ .s2-fl-label,
.s2-fl-label.is-static {
    transform: translateY(-22px) scale(0.78);
    color: var(--s2-blue);
}
.s2-fl-line {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    background: var(--s2-indigo);
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 0.4s var(--s2-ease-in-out);
}
.s2-fl-field input:focus ~ .s2-fl-line,
.s2-fl-field select:focus ~ .s2-fl-line {
    transform: scaleX(1);
}
.s2-fl-field.is-invalid .s2-fl-line {
    transform: scaleX(1);
    background: var(--s2-red);
}
.s2-fl-field.is-invalid .s2-fl-label {
    color: var(--s2-red);
}
.s2-fl-field.shake {
    animation: s2FieldShake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}
/* Filled from the account: the line runs through each field once */
.s2-fl-field.is-filled .s2-fl-line {
    animation: s2FieldFill 0.6s var(--s2-ease-in-out) calc(var(--d, 0) * 80ms) both;
}
.s2-fl-field.is-locked {
    opacity: 0.55;
}

/* Square checkbox */
.s2-fl-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 20px;
    font-size: 13px;
    line-height: 1.4;
    color: var(--s2-indigo);
    cursor: pointer;
}
.s2-fl-check input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.s2-fl-check-box {
    position: relative;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin-top: 1px;
    border: 1.5px solid var(--s2-indigo);
    transition: background 0.2s ease;
}
.s2-fl-check-box::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 1px;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) scale(0);
    transition: transform 0.3s var(--s2-ease-spring);
}
.s2-fl-check input:checked + .s2-fl-check-box {
    background: var(--s2-indigo);
}
.s2-fl-check input:checked + .s2-fl-check-box::after {
    transform: rotate(45deg) scale(1);
}

.s2-ship-error {
    margin: 18px 0 0;
    font-size: 13px;
    line-height: 1.5;
    color: var(--s2-red);
}
.s2-ship-error[hidden] {
    display: none;
}
.s2-ship-submit {
    margin-top: 28px;
}
.s2-ship-submit.is-sending {
    opacity: 0.7;
    pointer-events: none;
}

/* ---------- 3. Confirmation: the square opens and its threads weave in ---------- */
.s2-confirm {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 30px 24px 32px;
    text-align: center;
}
.s2-confirm .s2-kicker {
    margin: 0 0 4px;
}
.s2-confirm-mark {
    width: 96px;
    height: 96px;
    margin-bottom: 18px;
    overflow: visible;
}
.s2-confirm-mark .s2-weave-square {
    transform-box: fill-box;
    transform-origin: center bottom;
    animation: s2Fabric 0.6s var(--s2-ease-in-out) 0.2s both;
}
.s2-confirm-mark .s2-weave-thread {
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    animation: s2Thread 0.5s cubic-bezier(0.55, 0, 0.25, 1) calc(0.75s + var(--d, 0) * 110ms) both;
}
.s2-confirm > :not(.s2-confirm-mark) {
    animation: s2LogoRise 0.6s var(--s2-ease-out) 1.4s both;
}
.s2-flow-title.s2-confirm-title {
    font-size: 22px;
}
.s2-confirm-text {
    margin: 0 0 14px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--s2-indigo-dark);
}
#s2ConfirmStep[hidden],
#s2ShipStep[hidden] {
    display: none;
}

@keyframes s2BarFill { to { transform: scaleX(1); } }
@keyframes s2LoomWeave {
    0%   { stroke-dashoffset: 1; }
    35%  { stroke-dashoffset: 0; }
    65%  { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: -1; }
}
@keyframes s2FieldShake {
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}
@keyframes s2FieldFill {
    0%   { transform: scaleX(0); }
    50%  { transform: scaleX(1); }
    100% { transform: scaleX(1); opacity: 0; }
}
@keyframes s2Fabric {
    0%   { transform: scale(0.15, 0.03); }
    45%  { transform: scale(1, 0.03); }
    100% { transform: scale(1, 1); }
}
@keyframes s2Thread { to { stroke-dashoffset: 0; } }

@media (prefers-reduced-motion: reduce) {
    .s2-bk-row, .s2-flow-step.is-active .s2-flow-step-bar::after, .s2-fl-field.shake,
    .s2-confirm-mark .s2-weave-square, .s2-confirm > * { animation: none; }
    .s2-flow-step.is-active .s2-flow-step-bar::after { transform: scaleX(1); }
    .s2-empty-loom .s2-weave-thread, .s2-confirm-mark .s2-weave-thread { animation: none; stroke-dashoffset: 0; }
}
