/**
 * Newsletter Preference Centre.
 *
 * Scoped to .pref so nothing here reaches the rest of the site. Spacing follows
 * the theme convention of clamp() rather than fixed breakpoint steps.
 */

.pref {
    --pref-navy: #09334a;
    --pref-gold: #8c752c;
    --pref-cream: #edeae3;
    --pref-ink: #0e2537;
    --pref-muted: #5b6b78;
    --pref-line: #d8d3c9;
    --pref-surface: #fff;

    padding-top: clamp(40px, 4.1666666667vw, 80px);
    padding-bottom: clamp(40px, 4.1666666667vw, 80px);
    color: var(--pref-ink);
}

/* ---------------------------------------------------------------- Panels */

.pref__panel {
    max-width: 780px;
    margin: 0 auto;
    background: var(--pref-surface);
    border: 1px solid var(--pref-line);
    border-radius: 8px;
    padding: clamp(24px, 3.3333333333vw, 56px);
}

.pref__notice {
    max-width: 640px;
    margin: 0 auto;
    text-align: center;
    background: var(--pref-cream);
    border-radius: 8px;
    padding: clamp(32px, 3.3333333333vw, 56px);
}

/* ------------------------------------------------------------------ Type */

.pref__title {
    font-family: "freightbig pro", Georgia, serif;
    color: var(--pref-navy);
    font-size: clamp(32px, 3.3333333333vw, 48px);
    line-height: 1.15;
    font-weight: 700;
    margin: 0 0 16px;
}

.pref__lead {
    font-size: clamp(16px, 1.25vw, 18px);
    line-height: 1.6;
    color: var(--pref-muted);
    margin: 0 0 8px;
}

.pref__intro {
    margin-bottom: clamp(32px, 2.5vw, 48px);
}

.pref__identity {
    font-size: 14px;
    color: var(--pref-muted);
    margin: 16px 0 0;
    padding-top: 16px;
    border-top: 1px solid var(--pref-line);
}

.pref__identity strong {
    color: var(--pref-navy);
    font-weight: 700;
}

.pref__notice-help {
    font-size: 15px;
    color: var(--pref-muted);
    margin: 16px 0 0;
}

.pref__notice-help a {
    color: var(--pref-navy);
    text-decoration: underline;
}

/* -------------------------------------------------------------- Sections */

.pref__section {
    border: 0;
    padding: 0;
    margin: 0 0 clamp(32px, 2.5vw, 48px);
}

.pref__section-title {
    font-family: "freightbig pro", Georgia, serif;
    color: var(--pref-navy);
    font-size: clamp(22px, 1.6666666667vw, 28px);
    line-height: 1.25;
    font-weight: 700;
    padding: 0;
    margin: 0 0 16px;
}

.pref__section-copy {
    font-size: 15px;
    line-height: 1.6;
    color: var(--pref-muted);
    margin: 0 0 24px;
}

/* --------------------------------------------------------------- Options */

.pref__options {
    display: grid;
    gap: 12px;
}

.pref__options--grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.pref__options--inline {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.pref__option {
    position: relative;
}

/* The native control stays in the DOM for keyboard and screen readers, sized
   over the label so focus rings land in the right place. */
.pref__control {
    position: absolute;
    top: 18px;
    left: 18px;
    width: 20px;
    height: 20px;
    margin: 0;
    opacity: 0;
}

.pref__label {
    display: block;
    position: relative;
    padding: 18px 18px 18px 54px;
    border: 1px solid var(--pref-line);
    border-radius: 6px;
    cursor: pointer;
    background: var(--pref-surface);
    transition: border-color .2s ease, background-color .2s ease;
}

.pref__label::before {
    content: "";
    position: absolute;
    top: 18px;
    left: 18px;
    width: 20px;
    height: 20px;
    border: 1.5px solid var(--pref-navy);
    border-radius: 3px;
    background: var(--pref-surface);
    transition: background-color .2s ease;
}

.pref__option--compact .pref__label {
    padding: 14px 16px 14px 50px;
}

.pref__option--compact .pref__label::before,
.pref__option--compact .pref__control {
    top: 14px;
    left: 16px;
}

/* Radios read as circles. */
input[type="radio"].pref__control + .pref__label::before {
    border-radius: 50%;
}

.pref__label-title {
    display: block;
    font-weight: 700;
    font-size: 16px;
    line-height: 1.4;
    color: var(--pref-navy);
}

.pref__label-desc {
    display: block;
    font-size: 14px;
    line-height: 1.55;
    color: var(--pref-muted);
    margin-top: 4px;
}

.pref__label:hover {
    border-color: var(--pref-navy);
}

.pref__control:checked + .pref__label {
    border-color: var(--pref-navy);
    background: #f7f9fa;
}

.pref__control:checked + .pref__label::before {
    background: var(--pref-navy);
}

/* Tick mark for checkboxes. */
input[type="checkbox"].pref__control:checked + .pref__label::after {
    content: "";
    position: absolute;
    top: 24px;
    left: 24px;
    width: 8px;
    height: 4px;
    border-left: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(-45deg);
}

.pref__option--compact input[type="checkbox"].pref__control:checked + .pref__label::after {
    top: 20px;
    left: 22px;
}

/* Dot for radios. */
input[type="radio"].pref__control:checked + .pref__label::after {
    content: "";
    position: absolute;
    top: 20px;
    left: 22px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #fff;
}

.pref__control:focus-visible + .pref__label {
    outline: 2px solid var(--pref-gold);
    outline-offset: 2px;
}

/* ----------------------------------------------------------------- Phone */

.pref__phone {
    margin: -4px 0 4px;
    padding: 20px;
    background: var(--pref-cream);
    border-radius: 6px;
}

.pref__phone-label {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: var(--pref-navy);
    margin-bottom: 8px;
}

.pref__input {
    width: 100%;
    max-width: 320px;
    padding: 12px 14px;
    font-size: 16px;
    color: var(--pref-ink);
    background: var(--pref-surface);
    border: 1px solid var(--pref-line);
    border-radius: 4px;
}

.pref__input:focus {
    outline: 2px solid var(--pref-gold);
    outline-offset: 1px;
    border-color: var(--pref-navy);
}

.pref__input.is-invalid {
    border-color: #b3261e;
}

.pref__hint {
    font-size: 13px;
    line-height: 1.5;
    color: var(--pref-muted);
    margin: 10px 0 0;
}

/* -------------------------------------------------------------- Birthday */

.pref__date {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.pref__date-part {
    flex: 1 1 120px;
    min-width: 0;
}

.pref__select {
    width: 100%;
    padding: 12px 14px;
    font-size: 16px;
    color: var(--pref-ink);
    background: var(--pref-surface);
    border: 1px solid var(--pref-line);
    border-radius: 4px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%2309334a' stroke-width='1.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

.pref__select:focus {
    outline: 2px solid var(--pref-gold);
    outline-offset: 1px;
    border-color: var(--pref-navy);
}

/* --------------------------------------------------------------- Actions */

.pref__actions {
    padding-top: 8px;
}

.pref__submit {
    display: inline-block;
    min-width: 220px;
    padding: 14px 32px;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.5;
    color: #fff;
    background: var(--pref-navy);
    border: 1px solid var(--pref-navy);
    border-radius: 4px;
    cursor: pointer;
    transition: background-color .3s ease, color .3s ease;
}

.pref__submit:hover:not(:disabled) {
    background: var(--pref-surface);
    color: var(--pref-navy);
}

.pref__submit:disabled {
    opacity: .6;
    cursor: default;
}

.pref__error {
    padding: 14px 16px;
    margin: 0 0 24px;
    font-size: 15px;
    line-height: 1.5;
    color: #7a1c16;
    background: #fdeceb;
    border: 1px solid #f3c6c2;
    border-radius: 4px;
}

.pref__link {
    padding: 0;
    font-size: 16px;
    font-weight: 500;
    color: var(--pref-navy);
    background: none;
    border: 0;
    text-decoration: underline;
    cursor: pointer;
}

/* ---------------------------------------------------------- Confirmation */

.pref__panel--confirm {
    text-align: center;
    background: var(--pref-cream);
    border-color: transparent;
}

.pref__confirm-mark {
    color: var(--pref-gold);
    margin-bottom: 24px;
}

.pref__panel--confirm .pref__lead {
    margin-bottom: 24px;
}

/* Only ever shown on environments where writes are held back. A class-level
   display would outrank the browser's [hidden] rule, so restore it here. */
.pref__simulated[hidden] {
    display: none;
}

.pref__simulated {
    display: inline-block;
    padding: 8px 14px;
    margin: 0 0 24px;
    font-size: 13px;
    line-height: 1.5;
    color: #7a5a00;
    background: #fff6e0;
    border: 1px solid #e8d49a;
    border-radius: 4px;
}

/* ------------------------------------------- My Account call to action */

/* Wrapper holding the navigation and the card as one column. It takes over the
   navigation's own width and gutter, which are reset inside. */
.pref-nav-col {
    display: flex;
    flex-direction: column;
    width: 350px;
    min-width: 350px;
    margin-right: 80px;
}

.woocommerce-account .pref-nav-col .woocommerce-MyAccount-navigation {
    width: 100%;
    min-width: 0;
    margin-right: 0;
}

@media screen and (max-width: 1440px) {
    .pref-nav-col {
        width: 280px;
        min-width: 280px;
        margin-right: 40px;
    }
}

@media screen and (max-width: 992px) {
    .pref-nav-col {
        width: 100%;
        min-width: 0;
        margin-right: 0;
    }
}

.pref-cta {
    margin-top: 24px;
    padding: 24px 20px;
    background: #edeae3;
    border-radius: 8px;
    text-align: center;
}

.pref-cta__icon {
    display: inline-flex;
    color: #8c752c;
    margin-bottom: 12px;
}

.pref-cta__icon svg path {
    fill: currentColor;
}

.pref-cta__title {
    font-family: "freightbig pro", Georgia, serif;
    font-size: 20px;
    line-height: 1.25;
    font-weight: 700;
    color: #09334a;
    margin: 0 0 8px;
}

.pref-cta__copy {
    font-size: 14px;
    line-height: 1.55;
    color: #5b6b78;
    margin: 0 0 16px;
}

.pref-cta__link {
    display: inline-block;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
    color: #fff;
    background: #09334a;
    border: 1px solid #09334a;
    border-radius: 4px;
    transition: background-color .3s ease, color .3s ease;
    text-decoration: none;
}

.pref-cta__link:hover {
    color: #09334a;
    background: #fff;
}

/* ---------------------------------------------------------------- Mobile */

@media only screen and (max-width: 767px) {
    .pref__options--grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .pref__submit {
        width: 100%;
    }
}
