/**
 * Bookwhen plugin styles.
 *
 * Matches Docs/bookwhenplugin/design-screenshots/*.png and the HALC design system
 * (CLAUDE.md). Typography inherits from the theme; only buttons and form controls
 * set their own type scale.
 */

/* ---- Tokens ---------------------------------------------------------- */

.bookwhen {
    --bw-navy:  var(--color-navy,  #385d8c);
    --bw-pale:  var(--color-pale,  #eef3f8);
    --bw-teal:  var(--color-teal,  #93cddc);
    --bw-sky:   var(--color-sky,   #d2eaf0);
    --bw-text:  var(--color-text,  #787878);
    --bw-white: var(--color-white, #ffffff);
    --bw-font:  var(--font-primary, 'Roboto', sans-serif);
    --bw-radius-card: 16px;
    --bw-radius-btn: 8px;
    --bw-radius-control: 8px;
    --bw-control-height: 46px;
    --bw-shadow: 0 2px 14px rgba(0, 0, 0, 0.08);
    --bw-container: var(--theme-normal-container-max-width, 1290px);
    --bw-gutter: 20px;

    box-sizing: border-box;
    color: var(--bw-text);
}

.bookwhen *,
.bookwhen *::before,
.bookwhen *::after {
    box-sizing: inherit;
}

.bookwhen-container {
    max-width: var(--bw-container);
    width: var(--theme-container-width, 100%);
    margin: 0 auto;
    padding: 0 var(--bw-gutter);
}

/* ---- Buttons (CLAUDE.md button rules) -------------------------------- */

.bookwhen-btn {
    display: inline-block;
    padding: 14px 34px;
    font-family: var(--bw-font);
    font-size: 18px;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: var(--bw-radius-btn);
    cursor: pointer;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.bookwhen-btn--primary {
    background-color: var(--bw-navy);
    color: var(--bw-white);
}

.bookwhen-btn--primary:hover,
.bookwhen-btn--primary:focus {
    background-color: var(--bw-teal);
    color: var(--bw-navy);
}

.bookwhen-btn--secondary {
    background-color: var(--bw-teal);
    color: var(--bw-navy);
}

.bookwhen-btn--secondary:hover,
.bookwhen-btn--secondary:focus {
    background-color: var(--bw-navy);
    color: var(--bw-white);
}

.bookwhen-btn:focus-visible {
    outline: 3px solid var(--bw-navy);
    outline-offset: 2px;
}

.bookwhen-btn.is-disabled {
    background-color: var(--bw-sky);
    color: var(--bw-text);
    cursor: not-allowed;
}

/* ---- Events page: header ---------------------------------------------- */

.bookwhen-events__header {
    background-color: var(--bw-white);
    padding: 60px 0 50px;
}

.bookwhen-events__heading {
    margin: 0;
    color: var(--bw-navy);
    text-align: center;
}

/* ---- Events page: filter band ---------------------------------------- */

.bookwhen-filters {
    background-color: var(--bw-navy);
    padding: 21px 0;
}

.bookwhen-filters__form {
    display: flex;
    align-items: center;
    gap: 14px;
}

.bookwhen-filters__modes {
    display: flex;
    align-items: center;
    gap: 24px;
    margin: 0;
    padding: 0;
    border: 0;
    min-width: 0;
    flex: 0 0 auto;
}

.bookwhen .bookwhen-filters__modes,
.bookwhen .bookwhen-filters__modes legend {
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
}

.bookwhen .screen-reader-text {
    position: absolute !important;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    border: 0;
    white-space: nowrap;
}

.bookwhen .bookwhen-checkbox {
    display: inline-flex;
    margin: 0;
    padding: 0;
    flex-direction: row;
    flex-wrap: nowrap;
    white-space: nowrap;
    font-weight: 400;
    align-items: center;
    gap: 21px;
    position: relative;
    cursor: pointer;
    color: var(--bw-white);
    font-family: var(--bw-font);
    font-size: 18px;
    line-height: 1;
}

.bookwhen .bookwhen-checkbox input[type="checkbox"] {
    position: absolute !important; /* themes (Blocksy) set position: relative on checkboxes */
    opacity: 0;
    width: 1px;
    height: 1px;
    margin: 0;
    padding: 0;
    border: 0;
    -webkit-appearance: none;
    appearance: none;
    pointer-events: none;
}

.bookwhen .bookwhen-checkbox__box {
    display: inline-block;
    margin: 0;
    border: 0;
    box-shadow: none;
    vertical-align: middle;
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    background-color: var(--bw-white);
    border-radius: 5px;
    position: relative;
}

.bookwhen .bookwhen-checkbox input:checked + .bookwhen-checkbox__box::after {
    content: "";
    position: absolute;
    left: 10px;
    top: 4px;
    width: 7px;
    height: 14px;
    border: solid var(--bw-navy);
    border-width: 0 3px 3px 0;
    transform: rotate(45deg);
}

.bookwhen .bookwhen-checkbox input:focus-visible + .bookwhen-checkbox__box {
    outline: 3px solid var(--bw-teal);
    outline-offset: 2px;
}

/* Four controls share the row: two selects, the search box and the button. */
.bookwhen-filters__category,
.bookwhen-filters__role,
.bookwhen-filters__search {
    position: relative;
    flex: 1 1 0;
    min-width: 0;
}

.bookwhen-filters__search {
    flex-grow: 1.5;
}


.bookwhen .bookwhen-select,
.bookwhen .bookwhen-input,
.bookwhen .bookwhen-input[type="search"] {
    display: block;
    width: 100%;
    height: var(--bw-control-height);
    min-height: var(--bw-control-height);
    max-height: none;
    margin: 0;
    padding: 0 30px;
    font-family: var(--bw-font);
    font-size: 20px;
    line-height: var(--bw-control-height);
    color: var(--bw-text);
    background-color: var(--bw-white) !important; /* theme sets a form-field background variable */
    background-image: none !important;              /* theme draws its own select arrow */
    border: 0 !important;
    border-radius: var(--bw-radius-control);
    box-shadow: none !important;
    outline: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.bookwhen .bookwhen-select:focus,
.bookwhen .bookwhen-input:focus {
    background-color: var(--bw-white) !important;
    border: 0 !important;
    box-shadow: none !important;
    color: var(--bw-text);
}

.bookwhen .bookwhen-select {
    padding-right: 60px;
    cursor: pointer;
}

.bookwhen-select::-ms-expand {
    display: none;
}

.bookwhen .bookwhen-select__icon {
    position: absolute;
    z-index: 1;
    display: block;
    right: 25px;
    top: 50%;
    width: 22px;
    height: 22px;
    transform: translateY(-50%);
    color: var(--bw-navy);
    pointer-events: none;
}

.bookwhen .bookwhen-filters__search-icon {
    position: absolute;
    z-index: 1;
    display: block;
    left: 14px;
    top: 50%;
    width: 28px;
    height: 28px;
    transform: translateY(-50%);
    color: var(--bw-navy);
    pointer-events: none;
}

.bookwhen .bookwhen-input,
.bookwhen .bookwhen-input[type="search"] {
    padding-left: 69px;
}

.bookwhen-input::placeholder {
    color: var(--bw-text);
    opacity: 1;
}

.bookwhen-input::-webkit-search-decoration,
.bookwhen-input::-webkit-search-cancel-button {
    -webkit-appearance: none;
}

.bookwhen .bookwhen-select:focus-visible,
.bookwhen .bookwhen-input:focus-visible {
    outline: 3px solid var(--bw-teal);
    outline-offset: 2px;
}

.bookwhen .bookwhen-filters__submit {
    flex: 0 0 auto;
    margin: 0 0 0 auto;
    min-width: 150px;
    padding: 0 24px;
    height: var(--bw-control-height);
    min-height: var(--bw-control-height);
    line-height: var(--bw-control-height);
    border: 0;
    border-radius: var(--bw-radius-btn);
    background-image: none;
    box-shadow: none;
    text-transform: none;
    letter-spacing: normal;
    font-size: 16px; /* Design shows the filter button text a step smaller than the standard 18px button. */
}

/* ---- Events page: grid and cards ------------------------------------- */
/* Card design: events-page-design-updated.png (white info card, two buttons). */

.bookwhen-events__body {
    padding-top: 60px;
    padding-bottom: 50px;
}

.bookwhen-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 27px;
}

.bookwhen-card {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 30px;
    background-color: var(--bw-white);
    border: 1px solid var(--bw-pale);
    border-radius: var(--bw-radius-card);
    box-shadow: var(--bw-shadow);
    text-align: left;
}

.bookwhen-card__title {
    margin: 0;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--bw-teal);
    color: var(--bw-navy);
    /* Deliberate override of the inherited h2 size: the card design uses a compact title. */
    font-size: var(--bw-card-title-size, 19px);
    font-weight: 700;
    line-height: 1.3;
}

.bookwhen-card__link {
    color: inherit;
    text-decoration: none;
}

.bookwhen-card__link:hover,
.bookwhen-card__link:focus {
    color: inherit;
    text-decoration: underline;
}

.bookwhen-card__link:focus-visible {
    outline: 3px solid var(--bw-navy);
    outline-offset: 2px;
}

.bookwhen-card__meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 20px 0 0;
    padding: 0 0 16px;
    border-bottom: 2px solid var(--bw-teal);
    list-style: none;
    color: var(--bw-navy);
    font-family: var(--bw-font);
    font-size: 16px;
    line-height: 1.25;
}

.bookwhen-card__meta-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 0;
}

.bookwhen-card__meta-icon {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    margin-top: 2px;
}

.bookwhen-card__excerpt {
    margin: 22px 0 0;
    color: var(--bw-text);
    font-family: var(--bw-font);
    font-size: 15px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 6;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.bookwhen-card__actions {
    display: flex;
    gap: 26px;
    margin-top: auto;
    padding-top: 22px;
}

.bookwhen .bookwhen-card__button {
    flex: 1 1 0;
    min-width: 0;
    padding: 12px 10px;
    font-size: 16px;
    line-height: 1.2;
}

/* ---- Pagination -------------------------------------------------------- */

.bookwhen-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 40px;
    font-family: var(--bw-font);
    color: var(--bw-text);
}

.bookwhen-pagination__page,
.bookwhen-pagination__arrow {
    display: inline-block;
    min-width: 28px;
    padding: 4px 6px;
    text-align: center;
    text-decoration: none;
    color: var(--bw-text);
    border-radius: 4px;
}

.bookwhen-pagination__page:hover,
.bookwhen-pagination__arrow:hover,
.bookwhen-pagination__page:focus,
.bookwhen-pagination__arrow:focus {
    color: var(--bw-navy);
    text-decoration: underline;
}

.bookwhen-pagination__page.is-current {
    color: var(--bw-navy);
    font-weight: 700;
}

.bookwhen-pagination__arrow.is-disabled {
    opacity: 0.4;
}

/* ---- Notices ----------------------------------------------------------- */

.bookwhen-notice {
    margin: 0;
    padding: 24px 28px;
    text-align: center;
    color: var(--bw-text);
}

.bookwhen-notice--error,
.bookwhen-notice--admin {
    text-align: left;
    background-color: var(--bw-pale);
    border-left: 4px solid var(--bw-navy);
    border-radius: 8px;
}

.bookwhen-notice__link {
    margin-left: 8px;
    color: var(--bw-navy);
    text-decoration: underline;
}

/* ---- Detail page --------------------------------------------------------- */

.bookwhen-detail {
    background-color: var(--bw-white);
    padding: 60px 0 80px;
}

.bookwhen-detail__back {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
    font-family: var(--bw-font);
    font-size: 18px;
    color: var(--bw-navy);
    text-decoration: none;
}

.bookwhen-detail__back:hover,
.bookwhen-detail__back:focus {
    color: var(--bw-navy);
    text-decoration: underline;
}

.bookwhen-detail__back-icon {
    width: 16px;
    height: 16px;
}

.bookwhen-detail__card {
    max-width: 980px;
    margin: 0 auto;
    padding: 56px 70px 60px;
    background-color: var(--bw-white);
    border-radius: var(--bw-radius-card);
    box-shadow: var(--bw-shadow);
}

.bookwhen-detail__title {
    margin: 0 0 32px;
    padding-bottom: 20px;
    color: var(--bw-navy);
    /* Deliberate override of the inherited h1 size: a step smaller than page headings. */
    font-size: var(--bw-detail-title-size, 34px);
    line-height: 1.2;
    border-bottom: 2px solid var(--bw-teal);
}

.bookwhen-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px 56px;
    margin: 0;
    padding: 0;
    list-style: none;
    color: var(--bw-navy);
    font-family: var(--bw-font);
    font-size: 20px;
}

.bookwhen-meta__item {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin: 0;
}

.bookwhen-meta__item--location {
    flex-basis: 100%;
}

.bookwhen-meta__icon {
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
}

.bookwhen-detail__description {
    margin-top: 40px;
    color: var(--bw-text);
}

.bookwhen-detail__description > :first-child {
    margin-top: 0;
}

.bookwhen-detail__description > :last-child {
    margin-bottom: 0;
}

.bookwhen-detail__actions {
    margin-top: 48px;
}

/* ---- Tablet -------------------------------------------------------------- */

@media (min-width: 769px) and (max-width: 1023px) {
    .bookwhen-filters__form {
        flex-wrap: wrap;
        row-gap: 16px;
    }

    .bookwhen-filters__category,
    .bookwhen-filters__role {
        flex: 1 1 30%;
        margin-left: 0;
    }

    .bookwhen-filters__search {
        flex: 1 1 60%;
        margin-left: 0;
    }

    .bookwhen .bookwhen-filters__submit {
        margin-left: 0;
    }

    .bookwhen-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 24px;
    }

    .bookwhen-card {
        padding: 26px;
    }

    .bookwhen-card__title {
        font-size: var(--bw-card-title-size-tablet, 18px);
    }

    .bookwhen-detail__card {
        padding: 40px 40px 48px;
    }

    .bookwhen-detail__title {
        font-size: var(--bw-detail-title-size-tablet, 30px);
    }

    .bookwhen-meta {
        gap: 16px 40px;
    }
}

/* ---- Mobile -------------------------------------------------------------- */

@media (max-width: 768px) {
    .bookwhen-container {
        padding: 0 16px;
    }

    .bookwhen-events__header {
        padding: 40px 0 30px;
    }

    .bookwhen-filters {
        padding: 20px 0;
    }

    .bookwhen-filters__form {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }

    .bookwhen-filters__modes {
        justify-content: flex-start;
    }

    .bookwhen-filters__category,
    .bookwhen-filters__role,
    .bookwhen-filters__search {
        flex: 0 0 auto;
        margin-left: 0;
    }

    .bookwhen .bookwhen-filters__submit {
        margin-left: 0;
        width: 100%;
    }

    .bookwhen-events__body {
        padding-top: 40px;
        padding-bottom: 40px;
    }

    .bookwhen-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 20px;
    }

    .bookwhen-card {
        padding: 24px 20px;
    }

    .bookwhen-card__title {
        font-size: var(--bw-card-title-size-mobile, 18px);
    }

    .bookwhen-card__actions {
        gap: 16px;
    }

    .bookwhen-detail {
        padding: 32px 0 56px;
    }

    .bookwhen-detail__back {
        margin-bottom: 24px;
    }

    .bookwhen-detail__card {
        padding: 28px 20px 32px;
        border-radius: 12px;
    }

    .bookwhen-detail__title {
        font-size: var(--bw-detail-title-size-mobile, 26px);
    }

    .bookwhen-meta {
        flex-direction: column;
        gap: 14px;
        font-size: 18px;
    }

    .bookwhen-detail__actions .bookwhen-btn {
        display: block;
        width: 100%;
    }
}

/* ---- Small phones: stack the two card buttons ----------------------------- */

@media (max-width: 480px) {
    .bookwhen-card__actions {
        flex-direction: column;
    }
}
