/*
 * Site-specific header tweaks for tshirt.peshka.org.
 *
 * The header markup and its Tailwind CSS come from the 10Web builder build in
 * wp-content/uploads/wvc-builds/ (runtime data, not in git), so adjustments
 * live here instead. Loaded last (see functions.php), and the selectors are
 * scoped to the sticky header so nothing else on the page is affected.
 *
 * On wide screens the header row is full: the menu, newsletter button and
 * icons take ~970px of the 1280px row and cannot shrink, so the logo and the
 * search box were being squeezed. The rules below keep the logo at full size
 * and let the search box adapt to whatever space is left.
 */

/* ---- Logo: a bit larger, still well inside the 72px / 80px header ---- */
section.sticky span:has(> .wvc-logo-stack) {
    height: 3rem;       /* 48px on phones (was 40px) */
}

@media (min-width: 640px) {
    section.sticky span:has(> .wvc-logo-stack) {
        height: 3.5rem; /* 56px on tablets (was 48px) */
    }
}

@media (min-width: 1024px) {
    section.sticky span:has(> .wvc-logo-stack) {
        height: 3.75rem; /* 60px on desktop (was 48px) */
    }
}

/* Never let the crowded header shrink the logo's width (that scaled it back down). */
section.sticky div:has(> a > span > .wvc-logo-stack),
section.sticky a:has(> span > .wvc-logo-stack),
section.sticky span:has(> .wvc-logo-stack) {
    flex-shrink: 0;
}

/* "Search results" menu link duplicates the search box and costs ~110px of header. */
section.sticky nav li:has(> a[href*="/search-results"]),
section.sticky nav a[href*="/search-results"] {
    display: none;
}

/* ---- Search bar ---- */

/* The slot the search box sits in; a size container so the box can adapt. */
section.sticky div:has(> form input[type="search"]) {
    container-type: inline-size;
    position: relative;
    min-width: 2.75rem;
    height: 2.75rem;
    align-items: center;
}

section.sticky form input[type="search"] {
    height: 2.75rem;
    /* The builder's px-3 overrode pl-9, so the text ran under the icon. */
    padding-left: 2.75rem;
    padding-right: 1.125rem;
    border-radius: 9999px;
    border-color: transparent;
    background-color: hsl(220 20% 95.5%);
    font-size: 0.875rem;
    letter-spacing: 0.005em;
    text-overflow: ellipsis;
    box-shadow: none;
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

section.sticky form input[type="search"]::placeholder {
    color: var(--muted-foreground);
    opacity: 0.85;
}

section.sticky form input[type="search"]:hover {
    border-color: var(--border);
    background-color: var(--background);
}

section.sticky form input[type="search"]:focus,
section.sticky form input[type="search"]:focus-visible {
    background-color: var(--background);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 18%, transparent);
}

section.sticky form input[type="search"]::-webkit-search-cancel-button {
    cursor: pointer;
    opacity: 0.6;
}

section.sticky form svg.lucide-search {
    left: 1rem;
    width: 1.05rem;
    height: 1.05rem;
    transition: color 0.2s ease;
}

section.sticky form:focus-within svg.lucide-search {
    color: var(--primary);
}

/*
 * Tight header (slot under 192px, e.g. wide screens with the full menu):
 * show a compact "Search" pill, and open it into a full-size box over the
 * menu while typing so the search text is always visible.
 */
@container (max-width: 12rem) {
    section.sticky form input[type="search"] {
        padding-right: 0;
        color: transparent;
        cursor: pointer;
    }

    section.sticky form input[type="search"]::placeholder {
        color: transparent;
    }

    section.sticky form::after {
        content: "Search";
        position: absolute;
        left: 2.75rem;
        top: 50%;
        transform: translateY(-50%);
        font-size: 0.875rem;
        color: var(--muted-foreground);
        white-space: nowrap;
        pointer-events: none;
    }

    section.sticky form:not(:focus-within) input[type="search"]::-webkit-search-cancel-button {
        display: none;
        -webkit-appearance: none;
    }

    section.sticky form:focus-within {
        position: absolute;
        left: 0;
        top: 0;
        width: min(24rem, calc(100vw - 2rem));
        z-index: 60;
    }

    section.sticky form:focus-within::after {
        content: none;
    }

    section.sticky form:focus-within input[type="search"] {
        padding-right: 1.125rem;
        color: var(--foreground);
        cursor: text;
        box-shadow:
            0 0 0 4px color-mix(in srgb, var(--primary) 18%, transparent),
            0 10px 30px -10px rgb(15 23 42 / 0.25);
    }

    section.sticky form:focus-within input[type="search"]::placeholder {
        color: var(--muted-foreground);
    }
}

/* Very tight (under 96px): icon-only circle, same open-on-focus behaviour. */
@container (max-width: 6rem) {
    section.sticky form input[type="search"] {
        padding-left: 0;
    }

    section.sticky form::after {
        content: none;
    }

    section.sticky form svg.lucide-search {
        left: 50%;
        transform: translateX(-50%);
    }

    section.sticky form:focus-within input[type="search"] {
        padding-left: 2.75rem;
    }

    section.sticky form:focus-within svg.lucide-search {
        left: 1rem;
        transform: none;
    }
}

/* ---- Checkout payment chooser (assets/js/checkout-payment-choice.js) ---- */
#tshirt-pay-choice {
    display: grid;
    gap: 0.625rem;
    margin-top: 0.25rem;
}

#tshirt-pay-choice .tshirt-pay-option {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: var(--background);
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

#tshirt-pay-choice .tshirt-pay-option:hover {
    border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
}

#tshirt-pay-choice .tshirt-pay-option.is-checked {
    border-color: var(--primary);
    background: color-mix(in srgb, var(--primary) 5%, var(--background));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 14%, transparent);
}

#tshirt-pay-choice input[type="radio"] {
    margin-top: 0.2rem;
    width: 1rem;
    height: 1rem;
    accent-color: var(--primary);
    flex-shrink: 0;
}

#tshirt-pay-choice .tshirt-pay-text {
    display: grid;
    gap: 0.15rem;
}

#tshirt-pay-choice .tshirt-pay-text strong {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--foreground);
}

#tshirt-pay-choice .tshirt-pay-text small {
    font-size: 0.8rem;
    line-height: 1.4;
    color: var(--muted-foreground);
}

/* ---- Checkout delivery point picker (assets/js/checkout-delivery-point.js) ---- */
#tshirt-delivery-point {
    margin-top: 1rem;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: color-mix(in srgb, var(--muted) 60%, var(--background));
}

#tshirt-delivery-point .tdp-title {
    margin: 0 0 0.625rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--foreground);
}

#tshirt-delivery-point .tdp-input {
    width: 100%;
    height: 2.75rem;
    padding: 0 0.875rem;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    background: var(--background);
    font-size: 0.875rem;
    color: var(--foreground);
}

#tshirt-delivery-point .tdp-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}

#tshirt-delivery-point .tdp-results {
    margin-top: 0.5rem;
    max-height: 18rem;
    overflow-y: auto;
    display: grid;
    gap: 0.375rem;
}

#tshirt-delivery-point .tdp-result {
    display: grid;
    gap: 0.125rem;
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    background: var(--background);
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

#tshirt-delivery-point .tdp-result:hover,
#tshirt-delivery-point .tdp-result:focus-visible {
    border-color: var(--primary);
    background: color-mix(in srgb, var(--primary) 5%, var(--background));
    outline: none;
}

#tshirt-delivery-point .tdp-result-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--foreground);
}

#tshirt-delivery-point .tdp-result-sub,
#tshirt-delivery-point .tdp-hint {
    font-size: 0.78rem;
    line-height: 1.4;
    color: var(--muted-foreground);
}

#tshirt-delivery-point .tdp-hint {
    margin: 0.5rem 0 0;
}

#tshirt-delivery-point .tdp-hint a {
    color: var(--primary);
    text-decoration: underline;
}

#tshirt-delivery-point .tdp-tag {
    margin-left: 0.5rem;
    padding: 0.05rem 0.4rem;
    border-radius: 9999px;
    background: color-mix(in srgb, var(--primary) 12%, transparent);
    color: var(--primary);
    font-size: 0.7rem;
    font-style: normal;
    font-weight: 600;
}

#tshirt-delivery-point .tdp-selected {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem;
    border: 1px solid var(--primary);
    border-radius: 0.375rem;
    background: var(--background);
}

#tshirt-delivery-point .tdp-selected-text {
    font-size: 0.85rem;
    line-height: 1.45;
    color: var(--foreground);
}

#tshirt-delivery-point .tdp-link {
    flex-shrink: 0;
    border: 0;
    background: none;
    color: var(--primary);
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
}

#tshirt-delivery-point .tdp-button {
    height: 2.75rem;
    padding: 0 1.25rem;
    border: 0;
    border-radius: 0.375rem;
    background: var(--primary);
    color: var(--primary-foreground, #fff);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
}

/* BOX NOW's widget draws its own backdrop, panel and close button, so the
   frame simply covers the screen; our close button sits over theirs. */
.tdp-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: transparent;
}

.tdp-modal-panel {
    position: absolute;
    inset: 0;
}

.tdp-modal-frame {
    width: 100%;
    height: 100%;
    border: 0;
    background: transparent;
}

.tdp-modal-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 2;
    width: 2.25rem;
    height: 2.25rem;
    border: 0;
    border-radius: 9999px;
    background: #fff;
    box-shadow: 0 2px 8px rgb(15 23 42 / 0.25);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
}

/* ---- Language + currency switch in the header (assets/js/site-i18n.js) ---- */
#tshirt-locale {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-right: 0.25rem;
}

#tshirt-locale select {
    height: 2rem;
    padding: 0 1.4rem 0 0.5rem;
    border: 1px solid var(--border);
    border-radius: 9999px;
    background-color: var(--background);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%2364748b' stroke-width='1.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--foreground);
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

#tshirt-locale select:hover {
    border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
}

#tshirt-locale select:focus-visible {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}

@media (max-width: 400px) {
    #tshirt-locale select {
        padding: 0 1.1rem 0 0.4rem;
        background-position: right 0.35rem center;
    }
}

/* ---- Subtle "A Bulgarian shop" footer line ---- */
#tshirt-made-in-bg {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0.5rem 0 0;
    font-size: 0.75rem;
    opacity: 0.75;
}

#tshirt-made-in-bg svg {
    flex-shrink: 0;
    border-radius: 1px;
}

/* ---- "Charged in EUR" note under cart / checkout totals ---- */
#tshirt-currency-note {
    margin: 0.5rem 0 0;
    font-size: 0.75rem;
    line-height: 1.4;
    color: var(--muted-foreground);
}

/* ---- Bulgarian pages: Cyrillic fallbacks ----
 * Syne (headings) has no Cyrillic and Plus Jakarta Sans only partly, so
 * Cyrillic letters fall back to Unbounded / Manrope (Google Fonts, loaded in
 * tshirt-shop.php). unicode-range means only the Cyrillic files download,
 * and only when Cyrillic text is on the page. */
html[lang="bg"] {
    --font-serif: Syne, Unbounded, serif;
    --font-sans: "Plus Jakarta Sans", Manrope, sans-serif;
}

html[lang="bg"] body {
    font-family: var(--font-sans);
}

html[lang="bg"] .font-serif {
    font-family: Syne, Unbounded, serif;
}

/* Compact header search label */
@container (max-width: 12rem) {
    html[lang="bg"] section.sticky form::after {
        content: "Търсене";
    }
}

/* Bulgarian label must also disappear in the icon-only circle. */
@container (max-width: 6rem) {
    html[lang="bg"] section.sticky form::after {
        content: none;
    }
}

/* Tighter language / currency switch so the crowded header keeps room. */
#tshirt-locale select {
    padding: 0 1.15rem 0 0.45rem;
    background-position: right 0.4rem center;
    font-size: 0.72rem;
}

/* Slightly tighter header menu (desktop, where the full menu shows) so the
   search box keeps room for its label next to the language/currency switch. */
@media (min-width: 1024px) {
    section.sticky nav a,
    section.sticky nav button {
        padding-left: 0.3rem;
        padding-right: 0.3rem;
    }

    section.sticky nav ul {
        gap: 0.25rem;
    }

    section.sticky .max-w-\[1280px\] > div:last-child {
        gap: 0.6rem;
    }
}

/* ---- "Find a Shirt on Request" page (page-shirt-request.php) ---- */
.tsr {
    max-width: 1280px;
    margin: 0 auto;
    padding: 3rem 1rem 4rem;
    color: var(--foreground);
}

@media (min-width: 640px) {
    .tsr {
        padding: 4rem 1.5rem 5rem;
    }
}

.tsr-hero {
    max-width: 46rem;
    margin: 0 auto 3rem;
    text-align: center;
}

.tsr-eyebrow {
    margin: 0 0 0.75rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--primary);
}

.tsr-title {
    margin: 0;
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.01em;
}

.tsr-lead {
    margin: 1.25rem 0 0;
    font-size: 1.05rem;
    line-height: 1.6;
    color: var(--muted-foreground);
}

.tsr-honest {
    display: inline-block;
    margin: 1.25rem 0 0;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    background: color-mix(in srgb, var(--primary) 8%, var(--background));
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary);
}

.tsr-h2 {
    margin: 0 0 1.5rem;
    font-size: 1.5rem;
    font-weight: 800;
}

.tsr-steps,
.tsr-form-wrap {
    max-width: 60rem;
    margin: 0 auto 3rem;
}

.tsr-step-list {
    display: grid;
    gap: 1rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

@media (min-width: 768px) {
    .tsr-step-list {
        grid-template-columns: repeat(4, 1fr);
    }
}

.tsr-step-list li {
    position: relative;
    padding: 1.25rem;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    background: var(--card, var(--background));
}

.tsr-step-no {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    margin-bottom: 0.75rem;
    border-radius: 9999px;
    background: var(--primary);
    color: var(--primary-foreground, #fff);
    font-weight: 700;
    font-size: 0.875rem;
}

.tsr-step-list h3 {
    margin: 0 0 0.375rem;
    font-size: 1rem;
    font-weight: 700;
}

.tsr-step-list p {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.55;
    color: var(--muted-foreground);
}

.tsr-terms {
    margin-top: 1rem;
    padding: 1rem 1.25rem;
    border-left: 3px solid var(--primary);
    border-radius: 0.375rem;
    background: color-mix(in srgb, var(--muted) 70%, var(--background));
    font-size: 0.875rem;
    line-height: 1.55;
}

.tsr-terms p {
    margin: 0.25rem 0;
}

.tsr-form,
.tsr-done {
    padding: 1.5rem;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    background: var(--card, var(--background));
}

@media (min-width: 640px) {
    .tsr-form,
    .tsr-done {
        padding: 2rem;
    }
}

.tsr-grid {
    display: grid;
    gap: 1rem;
}

@media (min-width: 640px) {
    .tsr-grid {
        grid-template-columns: 1fr 1fr;
    }

    .tsr-wide {
        grid-column: 1 / -1;
    }
}

.tsr-field {
    display: grid;
    gap: 0.375rem;
}

.tsr-field > span {
    font-size: 0.8rem;
    font-weight: 600;
}

.tsr-field input,
.tsr-field select,
.tsr-field textarea {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    background: var(--background);
    font: inherit;
    font-size: 0.9rem;
    color: var(--foreground);
}

.tsr-field input,
.tsr-field select {
    height: 2.75rem;
    padding-top: 0;
    padding-bottom: 0;
}

.tsr-field input:focus,
.tsr-field select:focus,
.tsr-field textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}

.tsr-invalid input,
.tsr-invalid select,
.tsr-invalid textarea {
    border-color: #dc2626;
}

.tsr-agree.tsr-invalid span {
    color: #dc2626;
}

.tsr-hp {
    position: absolute !important;
    left: -9999px !important;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.tsr-agree {
    display: flex;
    gap: 0.625rem;
    align-items: flex-start;
    margin: 1.25rem 0 0;
    font-size: 0.85rem;
    line-height: 1.5;
    cursor: pointer;
}

.tsr-agree input {
    flex-shrink: 0;
    width: 1.05rem;
    height: 1.05rem;
    margin-top: 0.15rem;
    accent-color: var(--primary);
}

.tsr-error {
    margin: 1rem 0 0;
    font-size: 0.875rem;
    color: #dc2626;
}

.tsr-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 3rem;
    margin-top: 1.25rem;
    padding: 0 1.5rem;
    border: 0;
    border-radius: 0.375rem;
    background: var(--primary);
    color: var(--primary-foreground, #fff);
    font-size: 0.95rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

@media (min-width: 640px) {
    .tsr-submit {
        width: auto;
    }
}

.tsr-submit:disabled {
    opacity: 0.6;
    cursor: wait;
}

.tsr-done h3 {
    margin: 0 0 0.5rem;
    font-size: 1.5rem;
    font-weight: 800;
}

.tsr-done-number {
    font-weight: 700;
    color: var(--primary);
}

@media (min-width: 1024px) {
    /* Less space around the search box, which keeps it wide enough for its label. */
    section.sticky div:has(> form input[type="search"]) {
        margin-left: 0.5rem;
        margin-right: 0.5rem;
    }
}

/* Shirt request launch offer (first 20 free) */
.tsr-offer {
    display: inline-block;
    margin: 1.25rem 0 0;
    padding: 0.875rem 1.25rem;
    border: 1px dashed var(--primary);
    border-radius: 0.75rem;
    background: color-mix(in srgb, var(--primary) 6%, var(--background));
    font-size: 0.9rem;
    line-height: 1.5;
}

.tsr-offer p {
    margin: 0;
}

.tsr-offer-left {
    margin-top: 0.25rem !important;
    color: var(--primary);
    font-weight: 600;
}

.tsr-offer-note {
    margin: 1rem 0 0;
    font-size: 0.85rem;
    color: var(--muted-foreground);
}

.tsr-done-free p {
    margin: 0.25rem 0;
}

/* "I'm not a robot" box on the registration form (assets/js/signup-captcha.js) */
.tsc {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    margin: 0.5rem 0 0.25rem;
    padding: 0.75rem 0.875rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: color-mix(in srgb, var(--muted) 60%, var(--background));
    font-size: 0.875rem;
    cursor: pointer;
    user-select: none;
}

.tsc input {
    width: 1.15rem;
    height: 1.15rem;
    margin: 0;
    accent-color: var(--primary);
    cursor: pointer;
}

.tsc-text {
    font-weight: 600;
    color: var(--foreground);
}

.tsc-status {
    margin-left: auto;
    font-size: 0.8rem;
    color: var(--muted-foreground);
}

.tsc[data-state="done"] {
    border-color: color-mix(in srgb, #16a34a 55%, var(--border));
}

.tsc[data-state="done"] .tsc-status {
    color: #16a34a;
    font-weight: 600;
}

.tsc[data-state="error"] .tsc-status {
    color: #dc2626;
}

/* CAPTCHA wrapper: Google reCAPTCHA or the fallback box, plus the
   "tick the box first" state */
.tsc-wrap {
    margin: 0.5rem 0 0.25rem;
}

.tsc-recaptcha {
    min-height: 78px;
}

.tsc-wrap.tsc-invalid .tsc-recaptcha > div,
.tsc-wrap.tsc-invalid .tsc {
    border-radius: 4px;
    box-shadow: 0 0 0 2px #dc2626;
}

.tsc-required {
    margin: 0.4rem 0 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: #dc2626;
}

@keyframes tsc-shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

.tsc-shake {
    animation: tsc-shake 0.4s ease;
}

@media (prefers-reduced-motion: reduce) {
    .tsc-shake {
        animation: none;
    }
}

/* Header menu: links centre their text like the "Collections" dropdown
   trigger does, so all top-level items sit on one line. */
#header nav li > a[data-slot="navigation-menu-link"] {
    justify-content: center;
}

/* Home hero: "Shop all shirts" + "About us" side by side (site-i18n.js) */
.tshirt-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

#tshirt-hero-about {
    background: transparent !important;
    color: var(--foreground) !important;
    border: 2px solid var(--foreground) !important;
    box-shadow: none !important;
}

#tshirt-hero-about:hover,
#tshirt-hero-about:focus-visible {
    background: var(--foreground) !important;
    color: var(--background) !important;
}
