/*
 * Open Positions — Custom Styles
 * Hannon Hill · Cascade CMS
 *
 * Depends on: Bootstrap 5, Poppins (Google Fonts)
 * Loaded on: landing page (#773), individual position page (#774)
 */

/* ─────────────────────────────────────────
   Brand tokens
───────────────────────────────────────── */
:root {
    --hh-pink: #e41961;
    --hh-dark: #22252f;
    --hh-muted: #506690;
    --hh-border: #d9e2ef;
    --hh-bg-light: #f1f4f8;
    --hh-bg-off: #f9fbfd;
    --hh-radius: 0.25rem;
    --hh-radius-pill: 20px;
    --hh-font: "Poppins", sans-serif;
    --hh-section-px: 40px;
}

/* ─────────────────────────────────────────
   Shared: page header band
   Mirrors .gradient.gradient-gray-dark from theme
───────────────────────────────────────── */
.page-header-band {
    background-image: linear-gradient(to right top, #222630, #4e5462);
    padding: 56px var(--hh-section-px) 48px;
    position: relative;
    overflow: hidden;

    &::after {
        content: "";
        position: absolute;
        top: -60px;
        right: -60px;
        width: 280px;
        height: 280px;
        border-radius: 50%;
        border: 48px solid rgba(255, 255, 255, 0.04);
        pointer-events: none;
    }

    h1 {
        font-size: 2.5rem;
        font-weight: 700;
        color: #fff;
        line-height: 1.15;
        margin-bottom: 12px;

        em {
            font-style: italic;
            font-weight: 300;
            color: rgba(255, 255, 255, 0.6);
        }
    }

    .header-sub {
        font-size: 0.95rem;
        color: rgba(255, 255, 255, 0.7);
        font-weight: 300;
        max-width: 480px;
        line-height: 1.65;
        margin: 0;
    }

    /* Detail page: tighter header */
    &.header-detail {
        padding: 36px var(--hh-section-px) 32px;
    }
}

.eyebrow-label {
    display: inline-block;
    background: var(--hh-pink);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    padding: 4px 12px;
    border-radius: var(--hh-radius-pill);
    margin-bottom: 14px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    margin-bottom: 14px;
    transition: color 0.15s;

    &:hover {
        color: var(--hh-pink);
        text-decoration: none;
    }
}

.position-hero-title {
    font-size: 1.9rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 14px;
    line-height: 1.2;
}

.hero-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.hero-tag {
    font-size: 0.68rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: var(--hh-radius-pill);
    letter-spacing: 0.2px;
}
.hero-tag-dept {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}
.hero-tag-type {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.85);
}
.hero-tag-level {
    background: var(--hh-pink);
    color: #fff;
}
.hero-tag-remote {
    background: rgba(40, 180, 100, 0.25);
    color: #fff;
}

/* ─────────────────────────────────────────
   Landing: department groups
───────────────────────────────────────── */
.positions-section {
    padding: 48px var(--hh-section-px) 56px;
    display: grid;
    grid-template-columns: 450px 1fr;
    gap: 48px;
    align-items: start;
}

@media (width <= 1024px) {
    .positions-section {
        grid-template-columns: 1fr;
    }
}

.dept-group {
    margin-bottom: 48px;

    &:last-child {
        margin-bottom: 0;
    }
}

.dept-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--hh-dark);
}

.dept-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.4px;
    color: var(--hh-dark);
}

.dept-count {
    background: var(--hh-pink);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--hh-radius-pill);
    line-height: 1.4;
}

/* ─────────────────────────────────────────
   Landing: position rows
───────────────────────────────────────── */
.position-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border: 1px solid var(--hh-border);
    border-radius: var(--hh-radius);
    margin-bottom: 8px;
    background: #fff;
    text-decoration: none;
    color: inherit;
    transition:
        border-color 0.15s,
        box-shadow 0.15s,
        transform 0.15s;

    &:hover {
        border-color: var(--hh-pink);
        box-shadow: 0 2px 12px color-mix(in srgb, var(--hh-pink) 10%, transparent);
        transform: translateX(4px);
        text-decoration: none;
        color: inherit;

        .position-arrow {
            transform: translateX(4px);
        }
    }
}

.position-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--hh-dark);
    margin-bottom: 6px;
}

.position-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

.pos-tag {
    font-size: 0.68rem;
    font-weight: 500;
    padding: 3px 9px;
    border-radius: var(--hh-radius-pill);
    line-height: 1.4;
}
.pos-tag-type {
    background: var(--hh-bg-light);
    color: var(--hh-muted);
}
.pos-tag-level {
    background: #fce4ed;
    color: var(--hh-pink);
}
.pos-tag-remote {
    background: #e8f5ee;
    color: #2a7a4f;
}
.pos-tag-evergreen {
    background: #fff8e8;
    color: #b07d00;
    border: 1px dashed #d4a800;
}

.position-arrow {
    color: var(--hh-pink);
    font-size: 1.2rem;
    font-weight: 700;
    flex-shrink: 0;
    margin-left: 20px;
    transition: transform 0.15s;
}

/* ─────────────────────────────────────────
   Landing: CTA band
───────────────────────────────────────── */
.cta-band {
    background: var(--hh-bg-light);
    border-top: 1px solid var(--hh-border);
    padding: 36px var(--hh-section-px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;

    h3 {
        font-size: 1.1rem;
        font-weight: 700;
        color: var(--hh-dark);
        margin-bottom: 4px;
    }

    p {
        font-size: 0.85rem;
        color: var(--hh-muted);
        margin: 0;
    }
}

/* ─────────────────────────────────────────
   Detail: two-column layout
───────────────────────────────────────── */
.detail-body {
    display: grid;
    grid-template-columns: 2fr 1fr;
    align-items: start;
}

@media (width <= 768px) {
    .detail-body {
        grid-template-columns: 1fr;
    }
    .apply-sidebar {
        border-top: 1px solid var(--hh-border);
        padding-top: 28px;
        position: static; /* unstick on mobile — sticky makes no sense in single column */
    }
}

/* ─────────────────────────────────────────
   Detail: job content (left column)
───────────────────────────────────────── */
.job-content {
    padding: 40px var(--hh-section-px) 52px;
    border-right: 1px solid var(--hh-border);

    h3 {
        font-size: 1rem;
        font-weight: 700;
        color: var(--hh-dark);
        margin: 0 0 14px;

        /* Pink accent line — matches .heading-line from hannon-hill-2024.css */
        &::after {
            content: "";
            display: block;
            margin-top: 8px;
            width: 32px;
            height: 2px;
            background: var(--hh-pink);
        }
    }

    p {
        font-size: 0.9rem;
        color: var(--hh-muted);
        line-height: 1.75;
        margin-bottom: 20px;
    }

    ul {
        font-size: 0.9rem;
        color: var(--hh-muted);
        line-height: 1.8;
        padding-left: 1.25rem;
        margin-bottom: 24px;

        li::marker {
            color: var(--hh-pink);
        }
    }

    .perks-band {
        margin: 28px calc(-1 * var(--hh-section-px)) -52px;
        border-radius: 0;
    }
}

.content-divider {
    border: none;
    border-top: 1px solid var(--hh-border);
    margin: 28px 0;
}

/* ─────────────────────────────────────────
   Detail: apply sidebar (right column)
   + Clive form overrides
───────────────────────────────────────── */
.apply-sidebar {
    padding: 32px 24px;
    background: var(--hh-bg-off);
    position: sticky;
    top: var(--nav-height, 0px);

    h4 {
        font-size: 1rem;
        font-weight: 700;
        color: var(--hh-dark);
        margin-bottom: 4px;
    }

    .sidebar-sub {
        font-size: 0.78rem;
        color: var(--hh-muted);
        margin-bottom: 20px;
        line-height: 1.5;
    }

    /* ── Clive form overrides ── */
    .clive-form {
        font-family: var(--hh-font);

        .clive-form-description-wrapper {
            display: none; /* sidebar already has its own heading */
        }
    }

    .clive-label-left {
        .clive-field-wrapper {
            display: block;
            margin: 0 0 12px;
            padding: 0;
            font-size: inherit;

            & > label,
            & div.clive-legend-wrapper {
                flex: none;
                max-width: none;
                padding-right: 0;
            }
        }

        .clive-field {
            flex: none;
        }
    }

    .clive-fieldset {
        margin: 0 0 12px;
        padding: 0;

        .clive-field-wrapper {
            margin: 0;
            padding: 0;
        }
    }

    .clive-field-wrapper {
        & > label,
        & .clive-legend {
            font-size: 0.72rem;
            font-weight: 600;
            color: var(--hh-dark);
            display: block;
            margin: 0 0 4px;
            padding: 0;
            max-width: none;
        }

        /* "- Optional" indicator */
        & > label:first-child::after,
        & .clive-legend-wrapper > legend:first-child::after {
            font-weight: 400;
            color: var(--hh-muted);
            font-style: italic;
        }

        /* Required asterisk */
        &.clive-required > label:first-child::after,
        &.clive-required .clive-legend-wrapper > legend:first-child::after {
            content: " *";
            color: var(--hh-pink);
            opacity: 1;
        }

        &.clive-validation-error :is(input, select):invalid {
            border-color: red;
        }

        :is(.clive-radiobuttons, .clive-checkboxes) > * + * {
            margin-left: 0;
        }
    }

    .clive-field {
        margin: 0;

        & > :is(input, select, textarea) {
            width: 100%;
            border: 1px solid var(--hh-border);
            border-radius: var(--hh-radius);
            padding: 7px 10px;
            font-family: var(--hh-font);
            font-size: 0.78rem;
            color: var(--hh-dark);
            background: #fff;
            box-sizing: border-box;
            height: auto;
            transition: border-color 0.15s;

            &:focus-visible {
                border-color: var(--hh-pink);
                outline: 2px solid var(--hh-pink);
                outline-offset: 1px;
            }
        }

        & > :is(input, select):hover {
            border-color: var(--hh-pink);
        }

        /* File upload — only properties that differ from the generic input rule */
        & > input[type="file"] {
            border: 2px dashed var(--hh-border);
            padding: 12px;
            font-size: 0.75rem;
            color: var(--hh-muted);
            cursor: pointer;

            &:hover {
                border-color: var(--hh-pink);
            }
        }

        & > .clive-field-help-text {
            font-size: 0.7rem;
            color: var(--hh-muted);
            margin: 4px 0 0;
        }
    }

    :is(.clive-radiobuttons, .clive-checkboxes) {
        margin: 0;
        display: flex;
        flex-direction: row;
        gap: 4px;

        label {
            font-size: 0.78rem;
            color: var(--hh-dark);
            display: flex;
            align-items: center;
            gap: 6px;
            margin: 0;
        }
    }

    /* Live Clive submit — extras beyond the shared base */
    .clive-submit {
        height: auto;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
    }

    .clive-submit-wrapper {
        margin: 4px 0 0;
    }

    .clive-dropdown-wrapper::after {
        color: var(--hh-muted);
    }

    .clive-validation-error-text {
        font-size: 0.7rem;
    }

    /* reCAPTCHA — scale to fit sidebar */
    .g-recaptcha {
        transform: scale(0.82);
        transform-origin: 0 0;
        margin-bottom: -10px;
    }
}

/* Clive Form field styles — mirrors hannon-hill.css conventions */
.clive-field-mock {
    margin-bottom: 12px;

    label {
        font-size: 0.72rem;
        font-weight: 600;
        color: var(--hh-dark);
        display: block;
        margin-bottom: 4px;

        .req {
            color: var(--hh-pink);
        }

        em {
            font-weight: 400;
            color: var(--hh-muted);
        }
    }

    :is(input, textarea, select) {
        width: 100%;
        border: 1px solid var(--hh-border);
        border-radius: var(--hh-radius);
        padding: 7px 10px;
        font-family: var(--hh-font);
        font-size: 0.78rem;
        color: var(--hh-dark);
        background: #fff;
        box-sizing: border-box;
        transition: border-color 0.15s;

        &:focus-visible {
            border-color: var(--hh-pink);
            outline: 2px solid var(--hh-pink);
            outline-offset: 1px;
        }
    }

    textarea {
        resize: vertical;
        min-height: 72px;
    }
}

.upload-field {
    border: 2px dashed var(--hh-border);
    border-radius: var(--hh-radius);
    padding: 12px;
    text-align: center;
    font-size: 0.75rem;
    color: var(--hh-muted);
    background: #fff;
    cursor: pointer;
    transition: border-color 0.15s;
    line-height: 1.5;

    &:hover {
        border-color: var(--hh-pink);
    }

    span {
        color: var(--hh-pink);
        font-weight: 600;
    }
}

/* Submit button — shared base for mock and live Clive form */
.clive-submit-mock,
.apply-sidebar .clive-submit {
    display: block;
    width: 100%;
    background: var(--hh-pink);
    color: #fff;
    font-family: var(--hh-font);
    font-size: 0.75rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 1.45px;
    padding: 10px 16px;
    border-radius: var(--hh-radius);
    border: none;
    cursor: pointer;
    text-align: center;
    transition: background 0.2s;
}

.clive-submit-mock {
    margin-top: 4px;
}

.clive-submit-mock:hover,
.apply-sidebar .clive-submit:hover,
.apply-sidebar .clive-submit:focus {
    background: var(--hh-dark);
    border: none;
}

.sidebar-divider {
    border: none;
    border-top: 1px solid var(--hh-border);
    margin: 16px 0;
}

.sidebar-note {
    font-size: 0.7rem;
    color: var(--hh-muted);
    text-align: center;
    line-height: 1.5;

    a {
        color: var(--hh-pink);
    }
}

/* ─────────────────────────────────────────
   Utility: breakout
   Fills full viewport width with the element's background without
   shifting the element or its content. The ::before pseudo stretches
   left and right to the viewport edges and inherits the background.
   No overflow-x fix needed.
───────────────────────────────────────── */
.breakout {
    position: relative;

    &::before {
        content: "";
        position: absolute;
        inset: 0;
        left: calc(50% - 50vw);
        right: calc(50% - 50vw);
        background: inherit;
        z-index: -1;
    }
}

/* ─────────────────────────────────────────
   Utility: auto-grid
   Override column count inline: style="--cols: 2"
   Override gap inline:          style="--grid-gap: 24px"
───────────────────────────────────────── */
.auto-grid {
    display: grid;
    grid-template-columns: repeat(var(--cols, 3), 1fr);
    gap: var(--grid-gap, 32px);
    align-items: start;
}

@media (width <= 768px) {
    .auto-grid {
        grid-template-columns: 1fr;
    }
}

/* Masonry-style columns for department groups */
.dept-columns {
    columns: 2;
    column-gap: 32px;

    .dept-group {
        break-inside: avoid;
        margin-bottom: 32px;
    }
}

@media (width <= 768px) {
    .dept-columns {
        columns: 1;
    }
}

/* Positions intro text (left column) */
.positions-intro {
    h2 {
        font-size: 1.6rem;
        font-weight: 700;
        color: var(--hh-dark);
        line-height: 1.25;
        margin-bottom: 14px;

        em {
            font-style: italic;
            font-weight: 300;
            color: var(--hh-muted);
        }
    }

    p {
        font-size: 0.85rem;
        color: var(--hh-muted);
        line-height: 1.7;
        margin-bottom: 12px;

        &:last-child {
            margin-bottom: 0;
        }
    }
}

/* ─────────────────────────────────────────
   Landing: shared section label
───────────────────────────────────────── */
.section-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 1.8px;
    text-transform: uppercase;
    color: var(--hh-pink);
    margin-bottom: 10px;
}

/* ─────────────────────────────────────────
   Landing: perks section
───────────────────────────────────────── */
.perks-section {
    padding: 56px var(--hh-section-px);
    background: var(--hh-bg-off);
    border-bottom: 1px solid var(--hh-border);

    & > .section-label {
        margin-bottom: 32px;
    }
}

.perks-band {
    background: var(--hh-dark);
    padding: 48px var(--hh-section-px);
    border-top: 3px solid var(--hh-pink);

    & > .section-label {
        margin-bottom: 6px;
    }

    h3 {
        font-size: 1.1rem;
        font-weight: 700;
        color: #fff;
        margin-bottom: 32px;
    }

    .perk-item {
        border-top-color: rgba(255, 255, 255, 0.12);

        h4 {
            color: #fff;
        }

        p {
            color: rgba(255, 255, 255, 0.5);
        }
    }
}

/* Landing page: light variant — scoped to landing container */
.open-positions-container > .perks-band {
    background: #fff;
    border-top: 3px solid var(--hh-pink);
    border-bottom: 1px solid var(--hh-border);

    h3 {
        color: var(--hh-dark);
    }

    .perk-item {
        border-top-color: var(--hh-border);

        h4 {
            color: var(--hh-dark);
        }

        p {
            color: var(--hh-muted);
        }
    }
}

.perk-item {
    border-top: 2px solid var(--hh-border);
    padding-top: 16px;

    h4 {
        font-size: 0.9rem;
        font-weight: 700;
        color: var(--hh-dark);
        margin-bottom: 8px;
    }

    p {
        font-size: 0.82rem;
        color: var(--hh-muted);
        line-height: 1.7;
        margin: 0;
    }
}

/* ─────────────────────────────────────────
   Landing: values / mission section
───────────────────────────────────────── */
.values-section {
    padding: 56px var(--hh-section-px);
    background: var(--hh-bg-light);
    border-bottom: 1px solid var(--hh-border);
}

.values-intro {
    margin-bottom: 36px;
    max-width: 560px;

    h2 {
        font-size: 2rem;
        font-weight: 700;
        color: var(--hh-dark);
        line-height: 1.2;
        margin-bottom: 12px;

        em {
            font-style: italic;
            font-weight: 300;
            color: var(--hh-muted);
        }
    }

    p {
        font-size: 0.9rem;
        color: var(--hh-muted);
        line-height: 1.7;
        margin: 0;
    }
}

.values-card {
    background-color: #222630;
    background-size: cover;
    background-position: center;
    border-radius: 0.375rem;
    padding: 28px 24px 24px;
    min-height: 160px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s;

    /* Gradient overlay — sits above the bg image, below the text */
    &::before {
        content: "";
        position: absolute;
        inset: 0;
        background: linear-gradient(
            to right top,
            rgba(34, 38, 48, 0.88),
            rgba(78, 84, 98, 0.65)
        );
        transition: opacity 0.2s;
    }

    &:hover {
        transform: translateY(-3px);

        &::before {
            opacity: 0.75;
        }
    }
}

.values-card-label,
.values-card p {
    position: relative;
    z-index: 1;
}

.values-card-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 6px;
}

.values-card p {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.65);
    line-height: 1.55;
    margin: 0;
}
