/**
 * Homepage — page-specific styles only.
 * Shared patterns (hero, stats, features, tiles, cards) live in css/components/.
 */

/* ── Why Dive With Us — header with logo ─────────────────────────────────── */

.ba-why__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    margin-bottom: 3rem;
}

.ba-why__header-text {
    flex: 1;
    min-width: 0;
}

.ba-why__header-text .ba-section__body {
    max-width: 54ch;
}

.ba-why__header-logo {
    flex-shrink: 0;
}

.ba-why__logo {
    width: 180px;
    height: 180px;
    max-width: 100%;
    object-fit: contain;
    display: block;
}

@media (max-width: 767.98px) {
    .ba-why__header {
        flex-direction: column;
        align-items: flex-start;
    }

    .ba-why__header-logo {
        display: none;
    }
}

/* ── Trustindex certificate badge ───────────────────────────────────────────
 * The badge is a floating button (bottom-left, slides in 5s after load) that
 * opens Trustindex's validation panel. It is not part of the page flow: the
 * loader appends its own element to <body> and pins it with position: fixed,
 * so this file only decides which corner it occupies. The placeholder in
 * page-home.php carries the widget id; js/trust-badge.js fetches it after load.
 *
 * The widget pins itself to the right edge — its own rule is
 *   .ti-widget[data-layout-id='74'][data-set-id='default']
 *     .ti-sticky-button.ti-position-right { right: var(--ti-cert-badge-position) }
 * The badge belongs on the left here: the WhatsApp button already owns the
 * bottom-right corner. Same variable, won by specificity rather than by piling
 * on !important, because Trustindex injects its stylesheet at runtime — after
 * this file — so an equally specific rule would lose.
 * (The native way to move it is the badge position setting in the Trustindex
 * account; this override keeps the theme self-contained.) */

html body .ti-widget[data-layout-id='74'][data-set-id='default'] .ti-sticky-button.ti-position-right {
    right: unset !important;
    left: var(--ti-cert-badge-position, 15px) !important;
}

/* ── Kouri Island guide — article teaser under the trust strip ───────────── */

/* Carries .ba-section--dark for the shared label/title/body colours (orange
   label, white title, 65% body) and only re-tints the fill: same
   --color-dark-deep as .ba-stats so the two read as one band, with the stats
   section's bottom hairline as the divider. */
.ba-kouri-preview {
    background: #fff;
    padding: 2.5rem 0 4rem;
}

.ba-kouri-preview__inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.85rem;
    max-width: 46rem;
    margin: 0 auto;
    text-align: center;
}

/* Circular photo — the square asset is cut so the clownfish's head lands dead
   centre (crop centred on source pixel 1400,715); border-radius does the mask,
   so the framing lives in the image. Ring and halo are token-driven. */
.ba-kouri-preview__photo {
    width: 240px;
    height: 240px;
    max-width: 100%;
    display: block;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid var(--color-primary);
    box-shadow: 0 0 0 9px rgba(var(--bs-primary-rgb), 0.14);
}

/* The shared section header carries its own bottom margin; inside a centred
   stack the gap does the spacing instead. */
.ba-kouri-preview__inner .ba-section__title {
    margin-bottom: 0;
}

.ba-kouri-preview__inner .ba-section__body {
    margin-bottom: 0;
    /* The teaser is lifted verbatim from the article, which contains the CJK
       name 古宇利島 — keep-all stops the line breaking inside it. */
    word-break: keep-all;
}

.ba-kouri-preview__title-link {
    color: inherit;         /* inherits the section title colour — dark on white */
    text-decoration: none;
}

.ba-kouri-preview__title-link:hover,
.ba-kouri-preview__title-link:focus-visible {
    color: var(--color-primary);
}

.ba-kouri-preview__cta {
    margin-top: 0.75rem;
}

@media (max-width: 767.98px) {
    .ba-kouri-preview {
        padding: 2rem 0 3rem;
    }

    .ba-kouri-preview__photo {
        width: 200px;
        height: 200px;
    }
}

/* ── Experiences — edge-to-edge tile section ─────────────────────────────── */

.ba-experiences {
    padding-top: 3.5rem;
}

@media (min-width: 768px) {
    .ba-experiences {
        padding-top: 6rem;
    }
}

.ba-experiences .ba-section__header {
    margin-bottom: 2.5rem;
}

/* ── Schedule ────────────────────────────────────────────────────────────── */

.ba-schedule {
    text-align: center;
    /* Anchor landing (menu + hero "View schedule" → /#schedule) must clear
       the sticky header or the "Availability" label ends up hidden behind it
       (cut off, not fully visible). Offset by header height + breathing room;
       a sliver of the white reviews section shows above — that's the
       white→gray transition the hook is supposed to land on. */
    scroll-margin-top: calc(var(--ba-header-h) + 1rem);
}

.ba-schedule__sub {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.05rem;
    max-width: 480px;
    margin: 0.5rem auto 2.5rem;
}

.ba-schedule__calendar {
    margin-bottom: 2.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.ba-schedule__calendar::-webkit-scrollbar {
    height: 6px;
}

.ba-schedule__calendar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

/* ── ICS Calendar — theme restyle ─────────────────────────────────────────
   The plugin enqueues its own stylesheet after the theme, so these rules are
   scoped under .ba-schedule__calendar .ics-calendar.darkmode — higher
   specificity than the plugin's .ics-calendar / .ics-calendar.darkmode —
   guaranteeing they win regardless of load order. All colours via tokens.  */

.ba-schedule__calendar .ics-calendar {
    margin: 0;
    font-family: var(--font-base);
}

.ba-schedule__calendar .ics-calendar.darkmode {
    /* Surface */
    --r34ics--element--month--background: var(--color-dark-deep);

    /* Day header row */
    --r34ics--element--month--th--background: rgba(255, 255, 255, 0.05);
    --r34ics--element--month--th--color: var(--color-text-light);

    /* Day cells */
    --r34ics--element--month--day--background: transparent;
    --r34ics--element--month--day--color: var(--color-text-light);
    --r34ics--element--month--off--background: rgba(255, 255, 255, 0.03);
    --r34ics--element--month--off--color: var(--color-text-faint);

    /* Today */
    --r34ics--element--month--today-day--background: var(--color-primary);
    --r34ics--element--month--today-day--color: #fff;

    /* Events */
    --r34ics--element--events--color: var(--color-text-light);
    --r34ics--element--events--color--link: var(--color-primary);
    --r34ics--element--events--color--link-hover: var(--color-primary-dark);
    --r34ics--element--events--accent--background: var(--color-primary);
    --r34ics--element--events--accent--color: #fff;
    --r34ics--element--month--events-li--border-bottom-color: rgba(255, 255, 255, 0.07);

    /* Hover detail block (default event toggle) */
    --r34ics--element--hover-block--background: var(--color-dark-deep);
    --r34ics--element--hover-block--border-color: rgba(255, 255, 255, 0.12);
    --r34ics--element--hover-block--box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);

    /* Week select */
    --r34ics--element--select--background: var(--color-dark-deep);
    --r34ics--element--select--color: var(--color-text-light);
}

/* Card frame — collapse borders so border-radius clips cleanly */
.ba-schedule__calendar .ics-calendar-month-grid {
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
}

.ba-schedule__calendar .ics-calendar-month-grid th {
    font-weight: 600;
    letter-spacing: 0.06em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.ba-schedule__calendar .ics-calendar-month-grid td {
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.ba-schedule__calendar .ics-calendar-month-grid tbody tr:last-child td {
    border-bottom: 0;
}

.ba-schedule__calendar .ics-calendar-month-grid ul.events li {
    transition: background 0.2s;
}

.ba-schedule__calendar .ics-calendar-month-grid ul.events li:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Week select + colour key */
.ba-schedule__calendar .ics-calendar-select {
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 0.5rem;
    padding: 0.35rem 0.75rem;
    font-family: var(--font-base);
    font-size: 0.8rem;
}

.ba-schedule__calendar .ics-calendar-color-key {
    color: var(--color-text-light);
    font-size: 0.85rem;
}

.ba-schedule__cta {
    padding-top: 0.5rem;
}

/* ── Founder Story ───────────────────────────────────────────────────────── */

.ba-founder__inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
}

.ba-founder__video {
    position: relative;
    aspect-ratio: 16 / 9;
    border-radius: 0.5rem;
    overflow: hidden;
}

.ba-founder__video iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.ba-founder__quote {
    margin: 1.5rem 0 2rem;
    padding-left: 1.25rem;
    border-left: 3px solid var(--color-orange);
}

.ba-founder__quote p {
    font-size: 1.15rem;
    font-style: italic;
    line-height: 1.7;
    color: var(--color-text-muted);
    margin-bottom: 0.75rem;
}

.ba-founder__quote cite {
    font-size: 0.9rem;
    font-style: normal;
    font-weight: 600;
    color: var(--color-orange);
}

@media (max-width: 767.98px) {
    .ba-founder__inner {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

/* ── Blog ────────────────────────────────────────────────────────────────── */

.ba-blog {
    text-align: center;
}

/* .ba-blog__grid / .ba-blog__cta moved to css/components/card.css — the
   article footer uses the same row now, and this file is front-page-only. */

/* ── Lazy schedule (P0-9) — calendar loads on demand ─────────────────────── */

.ba-schedule__lazy-body { display: none; }
.ba-schedule__calendar.is-loaded .ba-schedule__lazy-body { display: block; }
.ba-schedule__calendar.is-loaded .ba-schedule__lazy-btn { display: none; }

/* Blue accent button with calendar icon — deliberately distinct from the
   orange .btn-primary CTAs elsewhere on the page. White on --color-primary-dark
   passes AA (4.9:1). */
.ba-schedule__lazy-btn {
    --bs-btn-bg: var(--color-primary-dark);
    --bs-btn-border-color: var(--color-primary-dark);
    --bs-btn-hover-bg: #2458a8;
    --bs-btn-hover-border-color: #2458a8;
    --bs-btn-active-bg: #1e4d92;
    --bs-btn-active-border-color: #1e4d92;
    --bs-btn-color: #fff;
    --bs-btn-hover-color: #fff;
    --bs-btn-active-color: #fff;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    min-height: 48px;
    box-shadow: 0 4px 16px rgba(46, 111, 204, 0.35);
    transition: background-color 0.2s, border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}
.ba-schedule__lazy-btn:hover,
.ba-schedule__lazy-btn:focus-visible {
    box-shadow: 0 6px 20px rgba(46, 111, 204, 0.45);
    transform: translateY(-2px);
}
.ba-schedule__lazy-btn .bi { font-size: 1.1em; }

/* Reviews section — offset the sticky header when linked from the stat strip */
.ba-reviews {
    scroll-margin-top: calc(var(--ba-header-h) + 1rem);
}
