/* /book/ — booking flow specific styles. Layered on top of /css/core.css.
   Brutalist match: hard borders, no soft shadows on inputs (the 4px-translate
   button hover is the one shadow effect that exists across the site).
   Mobile-first: every interactive target ≥ 44px tall. */

.booking-section {
    padding: 0 0 4rem;
    border-top: 2px solid var(--hex-black);
    background: var(--hex-white);
}

/* Server-side fallback (visible before JS unhides the form) */
.booking-fallback {
    border: 2px solid var(--hex-black);
    background: var(--hex-concrete);
    padding: 2rem;
    margin: 2rem 0;
    font-family: monospace;
    font-size: 0.9rem;
    line-height: 1.7;
}

.booking-fallback h2 {
    font-size: 1.2rem;
    text-transform: uppercase;
    margin-bottom: 1rem;
    font-family: var(--font-main);
}

.booking-fallback h2::before {
    content: "// ";
    color: var(--hex-accent);
}

.booking-fallback ol {
    margin: 1rem 0 1.5rem 1.5rem;
}

.booking-fallback li {
    margin-bottom: 0.5rem;
}

.noscript-block {
    border: 2px solid var(--hex-accent);
    padding: 1.5rem;
    margin: 2rem 0;
    background: var(--hex-white);
}

/* The form */
.booking-form {
    border: 2px solid var(--hex-black);
    background: var(--hex-white);
    margin: 2rem 0;
}

.booking-form[hidden] { display: none; }

/* Progress strip */
.progress {
    border-bottom: 2px solid var(--hex-black);
    padding: 1rem 1.5rem 0.8rem;
    background: var(--hex-concrete);
}

.progress-label {
    font-family: monospace;
    text-transform: uppercase;
    font-size: 0.8rem;
    color: var(--hex-black);
    margin-bottom: 0.5rem;
    letter-spacing: 1px;
}

.progress-bar {
    height: 6px;
    background: var(--hex-white);
    border: 1px solid var(--hex-black);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 20%;
    background: var(--gradient-blue);
    transition: width 0.25s ease;
}

/* Step container */
.step {
    border: 0;
    padding: 2rem 2.5rem;
    margin: 0;
    display: block;
    /* A fieldset otherwise grows to fit its widest control. */
    min-width: 0;
}

.step[hidden] { display: none; }

.step-title {
    font-size: 1.4rem;
    font-weight: 800;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
    letter-spacing: -0.5px;
    padding: 0;
}

.step-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2.5rem;
    flex-wrap: wrap;
}

/* Field block */
.field {
    margin-bottom: 1.8rem;
}

.field-label {
    display: block;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    letter-spacing: 0.5px;
}

.field-hint {
    display: block;
    font-family: monospace;
    color: #555;
    font-size: 0.8rem;
    margin-top: 0.3rem;
}

.field-error {
    display: none;
    font-family: monospace;
    color: #c80000;
    font-size: 0.85rem;
    margin-top: 0.5rem;
    padding: 0.5rem 0.7rem;
    border-left: 3px solid #c80000;
    background: #fff5f5;
}

.field-error.show { display: block; }

/* Inputs */
input[type=text],
input[type=email],
input[type=tel],
input[type=date],
select,
textarea {
    width: 100%;
    padding: 0.85rem 1rem;
    background: var(--hex-white);
    border: 2px solid var(--hex-black);
    border-radius: 0;
    color: var(--hex-black);
    font-size: 1rem;
    font-family: inherit;
    min-height: 48px;
    transition: background 0.15s;
}

/* On iPhone and iPad (every browser there is Safari's engine) the date box
   is drawn as a native control that ignores width: 100% and ran past the
   right edge of the form. Turning the native look off and letting it shrink
   keeps it inside the card; the picker still opens on tap. */
input[type=date] {
    -webkit-appearance: none;
    appearance: none;
    display: block;
    box-sizing: border-box;
    min-width: 0;
    max-width: 100%;
    text-align: left;
}

/* Its own rule: a browser that does not know this name drops the whole rule. */
input[type=date]::-webkit-date-and-time-value {
    text-align: left;
}

textarea {
    resize: vertical;
    line-height: 1.5;
    min-height: 120px;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    background: #f9f9ff;
    box-shadow: 4px 4px 0 var(--hex-accent);
    transform: translate(-2px, -2px);
}

input:invalid:not(:placeholder-shown),
.field.has-error input,
.field.has-error select,
.field.has-error textarea {
    border-color: #c80000;
}

select {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8' width='12' height='8'><polygon points='0,0 12,0 6,8' fill='%23111'/></svg>");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 12px 8px;
    padding-right: 2.5rem;
    appearance: none;
    -webkit-appearance: none;
}

.char-counter {
    text-align: right;
    font-family: monospace;
    font-size: 0.75rem;
    color: #777;
    margin-top: 0.3rem;
}

/* Device picker grid */
.device-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    border: 2px solid var(--hex-black);
}

.device-option {
    cursor: pointer;
    border-right: 1px solid var(--hex-black);
    border-bottom: 1px solid var(--hex-black);
    background: var(--hex-white);
    text-align: center;
    transition: all 0.1s;
    min-height: 96px;
    display: flex;
    align-items: stretch;
}

.device-option:nth-child(3n) { border-right: none; }
.device-option:nth-last-child(-n+3) { border-bottom: none; }

.device-option input { position: absolute; opacity: 0; pointer-events: none; }

.device-option span {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem 0.5rem;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
}

.device-option span i {
    font-size: 1.6rem;
    margin-bottom: 0.4rem;
    color: var(--hex-accent);
}

.device-option:hover span,
.device-option:focus-within span {
    background: var(--hex-concrete);
}

.device-option input:checked + span {
    background: var(--gradient-blue);
    color: var(--hex-white);
    text-shadow: none;
}

.device-option input:checked + span i {
    color: var(--hex-white);
}

/* Photo upload */
.photo-drop {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 2rem 1rem;
    border: 2px dashed var(--hex-black);
    background: var(--hex-concrete);
    cursor: pointer;
    text-align: center;
    font-family: monospace;
    text-transform: uppercase;
    font-size: 0.85rem;
    min-height: 120px;
    transition: background 0.15s;
}

.photo-drop:hover,
.photo-drop.dragover {
    background: var(--hex-white);
    border-color: var(--hex-accent);
    color: var(--hex-accent);
}

.photo-drop i {
    font-size: 1.6rem;
}

.photo-drop[aria-disabled="true"] {
    opacity: 0.5;
    cursor: not-allowed;
}

.photo-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.8rem;
    margin-top: 0.8rem;
}

.photo-preview:empty { display: none; }

.photo-thumb {
    position: relative;
    border: 2px solid var(--hex-black);
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: var(--hex-concrete);
}

.photo-thumb img,
.photo-thumb canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.photo-thumb-meta {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    color: var(--hex-white);
    font-family: monospace;
    font-size: 0.7rem;
    padding: 3px 6px;
    text-transform: uppercase;
}

.photo-remove {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 28px;
    height: 28px;
    background: var(--hex-black);
    color: var(--hex-white);
    border: 2px solid var(--hex-white);
    cursor: pointer;
    font-weight: 800;
    font-size: 1rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-remove:hover { background: #c80000; }

/* Time slots */
.time-slots {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(94px, 1fr));
    gap: 0;
    border: 2px solid var(--hex-black);
    min-height: 60px;
    background: var(--hex-concrete);
}

.time-slots-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 1.5rem;
    font-family: monospace;
    font-size: 0.85rem;
    color: #555;
    text-transform: uppercase;
}

.time-slot {
    display: block;
    cursor: pointer;
    border-right: 1px solid var(--hex-black);
    border-bottom: 1px solid var(--hex-black);
    padding: 0.85rem 0.5rem;
    text-align: center;
    font-family: monospace;
    font-size: 0.95rem;
    background: var(--hex-white);
    text-transform: uppercase;
    transition: all 0.1s;
    min-height: 48px;
}

.time-slot input { position: absolute; opacity: 0; pointer-events: none; }

.time-slot:hover { background: var(--gradient-blue); color: var(--hex-white); }

.time-slot.selected {
    background: var(--gradient-blue);
    color: var(--hex-white);
    font-weight: 700;
}

.time-slot.disabled {
    background: #eee;
    color: #aaa;
    cursor: not-allowed;
    text-decoration: line-through;
}

.time-slot.disabled:hover { background: #eee; color: #aaa; }

/* Consent */
.consent-row {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    cursor: pointer;
    line-height: 1.5;
}

.consent-row input[type=checkbox] {
    width: 24px;
    height: 24px;
    margin-top: 2px;
    accent-color: var(--hex-accent);
    flex: 0 0 auto;
    cursor: pointer;
}

.consent-row a { color: var(--hex-accent); font-weight: 700; }

.consent-note {
    margin-top: 0.6rem;
    font-family: monospace;
    font-size: 0.8rem;
    color: #555;
    line-height: 1.6;
    padding-left: 33px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.95rem 2rem;
    border: 2px solid var(--hex-black);
    text-transform: uppercase;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.1s;
    font-size: 0.95rem;
    font-family: inherit;
    min-height: 48px;
    background: var(--hex-white);
    color: var(--hex-black);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--gradient-blue);
    color: var(--hex-white);
}

.btn-primary:hover:not(:disabled) {
    transform: translate(4px, 4px);
    box-shadow: -4px -4px 0 var(--hex-black);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--hex-concrete);
}

/* Review summary */
.review {
    border: 2px solid var(--hex-black);
    background: var(--hex-concrete);
    padding: 0;
    margin-bottom: 1rem;
}

.review-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--hex-grid);
    align-items: flex-start;
    flex-wrap: wrap;
}

.review-row:last-child { border-bottom: none; }

.review-key {
    font-family: monospace;
    text-transform: uppercase;
    font-size: 0.8rem;
    color: #555;
    flex: 0 0 130px;
}

.review-val {
    flex: 1;
    word-break: break-word;
    text-align: right;
}

.review-val.review-photos {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.review-val.review-photos img,
.review-val.review-photos canvas {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border: 1px solid var(--hex-black);
    display: block;
}

.review-edit {
    background: none;
    border: 1px solid var(--hex-black);
    font-family: monospace;
    font-size: 0.7rem;
    text-transform: uppercase;
    padding: 4px 8px;
    cursor: pointer;
    margin-left: auto;
    color: var(--hex-black);
}

.review-edit:hover { background: var(--hex-black); color: var(--hex-white); }

/* Submit error block */
.submit-error {
    border: 2px solid #c80000;
    background: #fff5f5;
    color: #c80000;
    padding: 1rem 1.5rem;
    font-family: monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 1rem;
}

/* Confirmation */
.confirmation {
    text-align: center;
}

.confirmation-lead {
    font-size: 1.05rem;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.reference-block {
    border: 2px solid var(--hex-black);
    background: var(--hex-concrete);
    padding: 1.5rem;
    margin: 0 auto 1.5rem;
    max-width: 320px;
}

.reference-label {
    font-family: monospace;
    text-transform: uppercase;
    font-size: 0.8rem;
    color: #555;
    margin-bottom: 0.5rem;
}

.reference-id {
    font-family: monospace;
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--hex-accent);
}

.confirmation-note {
    font-family: monospace;
    font-size: 0.85rem;
    color: #555;
    margin-bottom: 1.5rem;
}

.confirmation .step-actions { justify-content: center; }

/* Mobile */
@media (max-width: 768px) {
    .step {
        padding: 1.5rem 1.2rem;
    }

    .step-title {
        font-size: 1.15rem;
    }

    .device-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .device-option:nth-child(3n) { border-right: 1px solid var(--hex-black); }
    .device-option:nth-child(2n) { border-right: none; }
    .device-option:nth-last-child(-n+3) { border-bottom: 1px solid var(--hex-black); }
    .device-option:nth-last-child(-n+2) { border-bottom: none; }

    .step-actions { flex-direction: column-reverse; }
    .step-actions .btn { width: 100%; }

    .review-row {
        flex-direction: column;
        gap: 0.4rem;
    }

    .review-key { flex: none; }
    .review-val { text-align: left; }
    .review-val.review-photos { justify-content: flex-start; }
}

@media (max-width: 400px) {
    .step { padding: 1.2rem 0.8rem; }
    .photo-preview { grid-template-columns: repeat(2, 1fr); }
    .time-slots { grid-template-columns: repeat(3, 1fr); }
}

/* Reduced motion: drop the button-hover translate that triggers reflow */
@media (prefers-reduced-motion: reduce) {
    .btn-primary:hover:not(:disabled),
    input:focus, select:focus, textarea:focus {
        transform: none !important;
        box-shadow: none !important;
    }
}
