/*
Theme Name: Health Octo Genome Child
Theme URI: http://healthoctogenome.local
Description: Child theme for Health Octo Genome, customizing Astra for accessibility and branding.
Author: Milo Anderson
Template: astra
Version: 1.5.2
Text Domain: astra-child
*/

/* ============================================
   PAGE LAYOUT FIX
   ============================================ */

.entry-header.ast-header-without-markup {
    margin: 0 !important;
    padding: 0 !important;
    line-height: 0 !important;
    font-size: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
}

.ast-plain-container .site-main > .ast-article-single {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

.entry-content > .alignfull:first-child {
    margin-top: 0 !important;
}

.entry-content > p:first-child:empty,
.entry-content > p:first-child:has(> :only-child:is(br)) {
    margin: 0 !important;
    padding: 0 !important;
    line-height: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
}

/* ============================================
   ACCESSIBILITY: COLOR CONTRAST OVERRIDES
   ============================================ */

/*
 * Astra's default teal (#2a9d8f) only achieves 3.32:1 contrast on white,
 * failing WCAG AA. Override the primary color to a darker teal that
 * achieves ~6.4:1 on white (passes AA, close to AAA).
 */
:root {
    --hog-link-color: #0d6e63;
    --hog-link-hover: #094e47;
    --hog-focus-color: #0b5ea2;
    --hog-btn-blue: #0d5bc4;
    --hog-btn-blue-hover: #094a9e;
}

a {
    color: var(--hog-link-color) !important;
    text-decoration: underline;
    text-underline-offset: 2px;
}

a:hover,
a:focus {
    color: var(--hog-link-hover) !important;
}

/* Fluent Forms success message: ensure links/buttons are readable on dark bg */
.ff-message-success a,
.ff-message-success a:hover,
.ff-message-success a:focus,
.ff-message-success .wp-block-button__link {
    color: #fff !important;
    text-decoration: underline !important;
}

/* Don't underline nav links, buttons, or logo links */
.menu-link,
.wp-block-button__link,
.custom-logo-link,
.site-title a,
.ast-builder-social-element {
    text-decoration: none !important;
}

/* White nav links site-wide (header always has dark DNA background) */
.main-header-menu .menu-link,
.main-header-menu .menu-link:hover,
.main-header-menu .menu-link:focus,
.ast-builder-menu-1 .menu-item > .menu-link,
.ast-builder-menu-1 .menu-item:hover > .menu-link,
.ast-builder-menu-1 .menu-item.current-menu-item > .menu-link,
.ast-builder-menu-1 .menu-item.current-menu-ancestor > .menu-link,
.site-title a,
.site-title a:hover,
.site-title a:focus {
    color: #fff !important;
}

/* Mobile nav reverts to dark text (dropdown has white background) */
@media (max-width: 921px) {
    .ast-builder-menu-mobile .main-navigation .main-header-menu .menu-link,
    .ast-builder-menu-mobile .main-navigation .main-header-menu .menu-link:hover {
        color: var(--ast-global-color-2, #000) !important;
    }
}

/* Mobile hamburger icon white against dark header */
[data-section="section-header-mobile-trigger"] .ast-button-wrap .mobile-menu-toggle-icon .ast-mobile-svg {
    fill: #fff !important;
}
[data-section="section-header-mobile-trigger"] .ast-button-wrap .ast-mobile-menu-trigger-outline {
    border-color: #fff !important;
    color: #fff !important;
}

/* Override Astra's gray citation text (#abb8c3 = 2.02:1, unreadable) */
.has-cyan-bluish-gray-color {
    color: #525252 !important;
}

/* ============================================
   GLOBAL TYPOGRAPHY & ACCESSIBILITY
   ============================================ */

body {
    font-size: 18px;
    line-height: 1.7;
    color: #2c3e50;
}

h1, h2, h3, h4, h5, h6 {
    color: #1a3a5c;
    line-height: 1.3;
}

/* Prevent Astra from shrinking all text on tablets/mobile */
@media (max-width: 921px) {
    html {
        font-size: 100% !important;
    }
}

/* ============================================
   ACCESSIBILITY: FOCUS INDICATORS
   ============================================ */

/*
 * Universal focus indicator — Astra's default "thin dotted" is nearly
 * invisible. This provides a clear 3px blue outline on all interactive
 * elements for keyboard users.
 */
*:focus-visible {
    outline: 3px solid var(--hog-focus-color) !important;
    outline-offset: 2px !important;
    border-radius: 2px;
}

/* White focus ring for elements on dark backgrounds */
.wp-block-cover *:focus-visible,
.hog-highlight-box *:focus-visible,
.ast-theme-transparent-header .main-header-menu .menu-link:focus-visible {
    outline-color: #fff !important;
}

/* Net Promoter Score: radios are visually hidden, so show focus on the label */
.ff_net_table input:focus-visible + label.ff-el-net-label {
    outline: 3px solid var(--hog-focus-color) !important;
    outline-offset: 2px !important;
    border-radius: 2px;
}

/* Step form progress: larger "Step N of M" text — !important overrides plugin CSS */
.fluentform .ff-el-progress-status,
.fluentform .ff-el-progress .ff-el-progress-bar,
.fluentform .ff-el-progress .ff-el-progress-bar span {
    font-size: 1.125rem !important;
}

/* ============================================
   ACCESSIBILITY: MINIMUM TOUCH TARGETS
   ============================================ */

.menu-link {
    min-height: 44px;
    display: flex !important;
    align-items: center;
}

.ast-builder-social-element {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
}

.ast-footer-social-1-wrap .ast-builder-social-element svg {
    width: 24px !important;
    height: 24px !important;
}

/* ============================================
   ACCESSIBILITY: REDUCED MOTION
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ============================================
   HERO / COVER BLOCKS
   ============================================ */

.wp-block-cover {
    min-height: 500px !important;
}

.wp-block-cover .wp-block-cover__inner-container {
    max-width: 800px;
    margin: 0 auto;
}

.wp-block-cover h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 700;
    text-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.wp-block-cover p {
    font-size: clamp(1.1rem, 2.5vw, 1.35rem);
    text-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

/*
 * DNA hero image as header background on non-home pages.
 * On the home page, the transparent header overlays the full hero cover block,
 * so we only need a dark gradient there. On other pages, we show the top
 * portion of the DNA image behind the header bar.
 */
.ast-primary-header-bar,
.ast-primary-header {
    background: url('images/hog-hero-dna.png') center top / cover no-repeat !important;
    position: relative;
}

/* Dark overlay for legibility on the header image */
.ast-primary-header-bar::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    pointer-events: none;
    z-index: 0;
}

/* Ensure header contents sit above the overlay */
.ast-primary-header-bar > * {
    position: relative;
    z-index: 1;
}

/* On home page (transparent header over hero), don't show the DNA bg on the bar */
.ast-theme-transparent-header .ast-primary-header-bar,
.ast-theme-transparent-header .ast-primary-header {
    background: linear-gradient(to bottom, rgba(0,0,0,0.45) 0%, transparent 100%) !important;
}

.ast-theme-transparent-header .ast-primary-header-bar::before {
    display: none;
}

/* ============================================
   CTA BUTTONS
   ============================================ */

/*
 * Override Astra's button styles with higher specificity.
 * Astra uses .wp-block-button .wp-block-button__link (0-2-0).
 * Using #1a73e8 gives 4.51:1 on white — barely AA.
 * Darkening to #0d5bc4 gives ~5.7:1 (solid AA, near AAA for large text).
 */
.wp-block-button .wp-block-button__link {
    font-size: 1.125rem !important;
    font-weight: 600;
    padding: 16px 32px !important;
    border-radius: 6px;
    text-decoration: none !important;
    background-color: var(--hog-btn-blue) !important;
    color: #fff !important;
    border-color: var(--hog-btn-blue) !important;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.wp-block-button .wp-block-button__link:hover,
.wp-block-button .wp-block-button__link:focus {
    background-color: var(--hog-btn-blue-hover) !important;
    border-color: var(--hog-btn-blue-hover) !important;
    color: #fff !important;
    transform: translateY(-1px);
}

.wp-block-button .wp-block-button__link:focus-visible {
    outline: 3px solid #fff !important;
    outline-offset: 3px !important;
}

/* Outline button variant */
.wp-block-button.is-style-outline .wp-block-button__link {
    border: 2px solid var(--hog-btn-blue) !important;
    color: var(--hog-btn-blue) !important;
    background-color: transparent !important;
}

.wp-block-button.is-style-outline .wp-block-button__link:hover,
.wp-block-button.is-style-outline .wp-block-button__link:focus {
    background-color: var(--hog-btn-blue) !important;
    color: #fff !important;
}

/* ============================================
   CONTENT SECTIONS
   ============================================ */

.hog-section {
    padding: 60px 0;
}

.hog-section-alt {
    background-color: #f7f9fc;
    padding: 60px 0;
}

/* Darken gradient endpoint from #2c5f8a to #24527a for AAA contrast */
.hog-highlight-box {
    background: linear-gradient(135deg, #1a3a5c 0%, #24527a 100%);
    color: #fff;
    padding: 40px;
    border-radius: 12px;
    text-align: center;
}

.hog-highlight-box h2,
.hog-highlight-box h3,
.hog-highlight-box p {
    color: #fff;
}

.hog-highlight-box .stat-number {
    font-size: 3rem;
    font-weight: 800;
    display: block;
    margin-bottom: 8px;
}

/* ============================================
   FEATURE CARDS
   ============================================ */

.hog-card {
    background: #fff;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    border: 1px solid #e8edf2;
    transition: box-shadow 0.2s ease;
    height: 100%;
}

.hog-card:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.hog-card h3 {
    font-size: 1.25rem;
    margin-bottom: 12px;
    color: #1a3a5c;
}

/* ============================================
   FIGURE CAPTION (Body Clock diagram)
   ============================================ */

/* Darken text from #4a5568 to #3d4a5c for AAA on #f0f4f8 */
.hog-figure-caption {
    background-color: #f0f4f8;
    border-left: 4px solid var(--hog-btn-blue);
    padding: 20px 24px;
    border-radius: 0 8px 8px 0;
    font-size: 1rem;
    line-height: 1.8;
    color: #3d4a5c;
}

.hog-figure-caption strong {
    color: #1a3a5c;
}

/* ============================================
   CONTINUING SUPPORT CALLOUT
   ============================================ */

.hog-support-box {
    background: #e8f4f8;
    border: 2px solid var(--hog-btn-blue);
    border-radius: 12px;
    padding: 30px 36px;
}

.hog-support-box h3 {
    color: #1a3a5c;
    margin-bottom: 12px;
}

/* ============================================
   COLUMN IMAGE STYLING
   ============================================ */

.wp-block-columns .wp-block-image img {
    border-radius: 10px;
}

.wp-block-image img {
    max-width: 100%;
    height: auto;
}

.hog-pillar-images .wp-block-image img {
    width: 100% !important;
    height: 240px !important;
    object-fit: cover !important;
}

/* ============================================
   ABBREVIATION LIST
   ============================================ */

.hog-abbrev-list {
    list-style: none;
}

.hog-abbrev-list li {
    padding: 2px 0;
    border-bottom: 1px solid #e2e8f0;
}

.hog-abbrev-list li:last-child {
    border-bottom: none;
}

/* ============================================
   ACCESSIBILITY: MINIMUM FONT SIZES
   ============================================ */

/* Navigation menu links — Astra sets 14px (0.875rem) */
.ast-builder-menu .main-header-menu .menu-item > .menu-link,
.ast-builder-menu-1 .menu-item > .menu-link {
    font-size: 1rem !important;
}

/* Footer copyright — Astra sets 14px */
.ast-footer-copyright {
    font-size: 1rem !important;
}

/* Mobile menu links */
.ast-builder-menu-mobile .main-navigation .main-header-menu .menu-item > .menu-link {
    font-size: 1rem !important;
    min-height: 48px;
    display: flex !important;
    align-items: center;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

@media (max-width: 1024px) {
    .wp-block-cover {
        padding-top: 110px !important;
    }

    .wp-block-cover h1 {
        font-size: 1.8rem !important;
    }
}

@media (max-width: 782px) {
    .wp-block-cover {
        min-height: 350px !important;
        padding-top: 120px !important;
    }

    .wp-block-cover h1 {
        font-size: 1.6rem !important;
    }

    /* Shrink the site logo ~25% on mobile */
    .site-logo-img img,
    .custom-logo,
    header .custom-logo-link img {
        transform: scale(0.75);
        transform-origin: left top;
    }

    .hog-card {
        margin-bottom: 20px;
    }

    .hog-highlight-box {
        padding: 30px 20px;
    }

    .hog-highlight-box .stat-number {
        font-size: 2.4rem;
    }

    .hog-pillar-images .wp-block-image img {
        height: 200px !important;
    }

    /* Ensure mobile nav touch targets are at least 48px */
    .ast-builder-menu-mobile .main-navigation .main-header-menu .menu-item > .menu-link {
        padding-top: 12px !important;
        padding-bottom: 12px !important;
    }
}

/* ============================================
   INTAKE PORTAL: SCHEDULING / ENROLMENT FORMS
   ============================================
   Ensure text size inside the post-intake forms
   matches the rest of the site.
   ============================================ */

.hog-tab-panel .fluentform {
    font-size: inherit !important;
}

/* Also normalize key text elements inside the tabs */
.hog-tab-panel p,
.hog-tab-panel li,
.hog-tab-panel label,
.hog-tab-panel .ff-el-input--label {
    font-size: 1rem !important;
    line-height: 1.7;
}

/* Tab button bar */
.hog-tab-buttons {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #e5e7eb;
    margin-bottom: 2em;
}

.hog-tab-btn {
    flex: 1;
    padding: 14px 24px;
    border: none;
    background: #f3f4f6;
    color: #4b5563;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.hog-tab-btn:hover {
    background: #e5e7eb;
    color: #1a3a5c;
}

.hog-tab-btn.hog-tab-active {
    background: #fff;
    color: #1a3a5c;
    border-bottom-color: #0d5bc4;
}

.hog-tab-btn:focus-visible {
    outline: 3px solid #0b5ea2;
    outline-offset: -3px;
}

.hog-tab-panel[hidden] {
    display: none;
}

/* ============================================
   FLUENT FORMS: SAVE & RESUME UI OVERRIDES
   ============================================
   Hide the default save-progress banner and email
   field; replaced by custom toast (see functions.php).
   ============================================ */

[id="3_save_progress_msg"] {
    display: none !important;
}

.ff-saved-state-link,
.ff-saved-state-input,
.ff-email-address {
    display: none !important;
}

.ff-custom-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #065f46;
    color: #fff;
    padding: 14px 48px 14px 24px;
    border-radius: 8px;
    z-index: 99999;
    font-size: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.ff-custom-toast .ff-toast-close {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #fff;
    opacity: 0.7;
    line-height: 1;
    padding: 4px 8px;
}

.ff-custom-toast .ff-toast-close:hover {
    opacity: 1;
}

/* ============================================
   FLUENT BOOKING CALENDAR — MOBILE SCROLL
   ============================================
   On narrow viewports the calendar can be wider than the screen;
   allow horizontal scroll so the full calendar is accessible.
   ============================================ */

@media (max-width: 767px) {
    .hog-tab-panel {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .fcal_calendar_wrapper,
    .fcal_calendar_block_inner,
    .fcal_wrap {
        overflow-x: auto;
        overflow-y: visible;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
    }

    .fcal_wrap .fcal_holder {
        min-width: 0;
    }

    .fcal_wrap .fcal_calendar_inner {
        min-width: 320px;
        padding: 16px;
    }
}
