/*
 * Archive Layout — Hello Elementor Child v2.2
 */

.hec-archive {
    --hec-max-width: 1360px;

    font-family: var(--hec-font-body);
    color: var(--hec-text);
    background: var(--hec-bg);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

body:has(.hec-archive) {
    background: var(--hec-bg);
}

.hec-archive__hero {
    min-height: var(--hec-archive-hero-min, 90vh);
    padding: var(--hec-gutter);
    display: flex;
    align-items: center;
    position: relative;
}

/* When archive has a background image: full 100vh hero with image covering entire section */
.hec-archive__hero--image {
    min-height: 100vh;
    background-image:
        linear-gradient(rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.55)),
        var(--hec-archive-bg-image);
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
}

/* White text on hero-with-image */
.hec-archive__hero--image .hec-archive__title,
.hec-archive__hero--image .hec-archive__kicker,
.hec-archive__hero--image .hec-archive__count {
    color: #ffffff;
}

.hec-archive__hero--image .hec-archive__title {
    text-shadow: 0 2px 24px rgba(0, 0, 0, 0.25);
}

.hec-archive__hero--image .hec-archive__intro p {
    color: #ffffff;
    opacity: 0.92;
}

.hec-archive__hero--image .hec-archive__intro a {
    color: #ffffff;
    text-decoration-color: rgba(255, 255, 255, 0.6);
    opacity: 1;
}

.hec-archive__hero--image .hec-archive__intro a:hover {
    color: #ffffff;
    text-decoration-color: #ffffff;
}

/* Decorations go white on image too */
.hec-archive__hero--image .hec-archive__signature,
.hec-archive__hero--image .hec-archive__tagline,
.hec-archive__hero--image .hec-archive__arrow {
    color: #ffffff;
}

.hec-archive__hero--image .hec-archive__signature--outlined {
    color: transparent;
    -webkit-text-stroke: 1px #ffffff;
}

.hec-archive__hero-inner {
    width: 100%;
    max-width: var(--hec-max-width);
    margin: 0 auto;
    display: grid;
    grid-template-rows: auto 1fr;
    gap: 4rem;
    min-height: 70vh;
    position: relative;
    padding-bottom: 5rem; /* reserve space for absolutely-positioned decorations at bottom */
}

/* Image hero: headline vertically centered (title + intro sit in dead center of the image) */
.hec-archive__hero--image .hec-archive__hero-inner {
    min-height: calc(100vh - 2 * var(--hec-gutter));
}

.hec-archive__hero--image .hec-archive__headline {
    justify-content: center;
}

.hec-archive__top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    color: var(--hec-text);
    opacity: 0.7;
}

.hec-archive__kicker {
    position: relative;
    padding-left: 1.2rem;
    opacity: 1;
}

.hec-archive__kicker::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--hec-accent);
    transform: translateY(-50%);
}

.hec-archive__count {
    opacity: 0.55;
}

/* Headline group — title + intro centered together inside hero */
.hec-archive__headline {
    align-self: center;
    text-align: center;
    width: 100%;
    min-width: 0; /* prevent grid blowout from long titles */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.hec-archive__title {
    font-family: var(--hec-archive-title-font, var(--hec-font-heading));
    font-weight: 500;
    font-size: var(--hec-archive-title-scale, clamp(4rem, 17vw, 14rem));
    line-height: 0.95;
    letter-spacing: -0.02em;
    margin: 0;
    color: var(--hec-text);
    max-width: 100%;
    overflow-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
}

/* Scale title font down based on character bucket set server-side (PHP strlen). */
.hec-archive__title[data-length="short"] {
    /* Uses default size — giant. */
}

.hec-archive__title[data-length="medium"] {
    font-size: clamp(3rem, 11vw, 8.5rem);
}

.hec-archive__title[data-length="long"] {
    font-size: clamp(2.2rem, 7vw, 5rem);
    line-height: 1.05;
    letter-spacing: -0.015em;
}

.hec-archive__title[data-length="xlong"] {
    font-size: clamp(1.8rem, 4.5vw, 3.5rem);
    line-height: 1.15;
    letter-spacing: -0.01em;
}

/* Intro — sits inside hero, directly under title */
.hec-archive__intro {
    max-width: 58ch;
    width: 100%;
    margin: 0;
}

.hec-archive__intro p {
    font-family: var(--hec-font-heading);
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1.05rem, 1.8vw, 1.35rem);
    line-height: 1.55;
    color: var(--hec-text);
    opacity: 0.75;
    margin: 0 0 0.85rem;
}

.hec-archive__intro p:last-child {
    margin-bottom: 0;
}

.hec-archive__intro a {
    color: var(--hec-accent);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
    transition: color 0.25s ease;
    opacity: 1;
}

.hec-archive__intro a:hover {
    color: var(--hec-accent-dark);
}

/* ========================================================================
   Hero Decorations — positionable signature, arrow, tagline
   ======================================================================== */

/* Arrow kept in its original bottom-left corner so scroll-indicator semantics survive. */
.hec-archive__arrow {
    position: absolute;
    bottom: 0;
    left: 0;
    font-size: 2rem;
    line-height: 1;
    color: var(--hec-text);
    opacity: 0.5;
    animation: hecArrowBounce 2.4s ease-in-out infinite;
    font-family: var(--hec-font-body);
    z-index: 1;
}

/* If signature or tagline is also at bottom-left, shift arrow up */
.hec-archive__hero-inner:has(.hec-archive__deco--bl:not(.hec-archive__arrow)) .hec-archive__arrow {
    bottom: 3.5rem;
}

@keyframes hecArrowBounce {
    0%, 100% { transform: translateY(0); opacity: 0.5; }
    50%      { transform: translateY(10px); opacity: 1; }
}

/* Signature — base (position + style modifiers layer on) */
.hec-archive__signature {
    color: var(--hec-text);
    line-height: 1;
}

/* Signature styles */
.hec-archive__signature--serif-large {
    font-family: var(--hec-archive-title-font, var(--hec-font-heading));
    font-weight: 500;
    font-size: clamp(2.5rem, 5vw, 4rem);
    letter-spacing: -0.02em;
}

.hec-archive__signature--uppercase-small {
    font-family: var(--hec-font-body);
    font-weight: 500;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.25em;
    opacity: 0.65;
}

.hec-archive__signature--italic {
    font-family: var(--hec-archive-title-font, var(--hec-font-heading));
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1.4rem, 2.5vw, 2rem);
    letter-spacing: 0;
    opacity: 0.8;
}

.hec-archive__signature--outlined {
    font-family: var(--hec-archive-title-font, var(--hec-font-heading));
    font-weight: 600;
    font-size: clamp(2.5rem, 5vw, 4rem);
    letter-spacing: -0.02em;
    color: transparent;
    -webkit-text-stroke: 1px var(--hec-text);
    text-stroke: 1px var(--hec-text);
}

/* Tagline — always small uppercase muted type, position can vary */
.hec-archive__tagline {
    font-family: var(--hec-font-body);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    color: var(--hec-text);
    opacity: 0.6;
    line-height: 1.4;
}

/* Position utilities — shared by signature + tagline */
.hec-archive__deco {
    position: absolute;
    z-index: 2;
    max-width: 45%;
    overflow-wrap: break-word;
    word-break: break-word;
}

.hec-archive__deco--tl {
    top: 0;
    left: 0;
}

.hec-archive__deco--tr {
    top: 0;
    right: 0;
    text-align: right;
}

.hec-archive__deco--bl {
    bottom: 0;
    left: 0;
}

.hec-archive__deco--br {
    bottom: 0;
    right: 0;
    text-align: right;
}

.hec-archive__deco--center {
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    max-width: 80%;
}

/* When signature and arrow both at bl: let arrow keep bl, signature shifts right */
.hec-archive__signature.hec-archive__deco--bl ~ .hec-archive__arrow,
.hec-archive__arrow + .hec-archive__signature.hec-archive__deco--bl {
    /* Only an issue if authored to both be BL. Leave as-is; authors can pick different positions. */
}

/* Arrow character sizing variants — override when character is small */
.hec-archive__arrow {
    display: inline-block;
}

.hec-archive__list {
    max-width: var(--hec-max-width);
    margin: 0 auto;
    padding: 4rem var(--hec-gutter) 6rem;
    display: flex;
    flex-direction: column;
    gap: var(--hec-list-gap, 8rem);
}

.hec-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(2rem, 6vw, 6rem);
    align-items: center;
}

.hec-row--flip .hec-row__media { order: 2; }
.hec-row--flip .hec-row__body  { order: 1; }

.hec-row__media {
    position: relative;
    display: block;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: var(--hec-bg-soft);
    text-decoration: none;
}

.hec-row__media img,
.hec-row__placeholder {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    transition: transform 0.9s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                filter 0.6s ease;
}

.hec-row__placeholder {
    background: var(--hec-bg-soft);
}

.hec-row__media:hover img,
.hec-row__media:hover .hec-row__placeholder {
    transform: scale(1.04);
}

.hec-row__index {
    position: absolute;
    top: 1rem;
    left: 1rem;
    font-family: var(--hec-font-body);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.2em;
    color: #fff;
    mix-blend-mode: difference;
    padding: 0.3rem 0.6rem;
    z-index: 2;
}

.hec-row__body {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.hec-row__title {
    font-family: var(--hec-font-heading);
    font-weight: 500;
    font-size: clamp(1.8rem, 3.5vw, 3rem);
    line-height: 1.08;
    margin: 0;
    letter-spacing: -0.01em;
}

html body .hec-row__title a,
html body .hec-row__title a:link,
html body .hec-row__title a:visited,
html body .hec-row__title a:hover,
html body .hec-row__title a:focus,
html body .hec-row__title a:active {
    color: var(--hec-text);
    text-decoration: none !important;
    text-decoration-line: none !important;
    border-bottom: none !important;
    background-image: none !important;
    transition: color 0.3s ease;
}

html body .hec-row__title a:hover,
html body .hec-row__title a:focus {
    color: var(--hec-accent);
}

.hec-row__excerpt {
    font-size: 1.05rem;
    line-height: 1.6;
    color: var(--hec-text);
    opacity: 0.75;
    font-weight: 300;
    max-width: 38ch;
}

.hec-row__link {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.78rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--hec-text);
    text-decoration: none;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--hec-text);
    transition: color 0.3s ease, border-color 0.3s ease, gap 0.3s ease;
}

.hec-row__link:hover {
    color: var(--hec-accent);
    border-color: var(--hec-accent);
    gap: 1rem;
}

.hec-archive__pagination {
    max-width: var(--hec-max-width);
    margin: 0 auto;
    padding: 2rem var(--hec-gutter) 6rem;
}

.hec-archive__pagination .nav-links,
.hec-archive__pagination .navigation {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.hec-archive__pagination a,
.hec-archive__pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    height: 2.5rem;
    padding: 0 0.75rem;
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--hec-text);
    opacity: 0.7;
    text-decoration: none;
    border: 1px solid transparent;
    transition: all 0.25s ease;
}

.hec-archive__pagination a:hover,
.hec-archive__pagination .page-numbers.current {
    color: var(--hec-accent);
    border-color: var(--hec-accent);
    opacity: 1;
}

.hec-reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.9s ease, transform 0.9s ease;
}

.hec-reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

.hec-archive__empty {
    max-width: var(--hec-max-width);
    margin: 0 auto;
    padding: 6rem var(--hec-gutter);
    text-align: center;
    font-family: var(--hec-font-heading);
    font-size: 1.5rem;
    color: var(--hec-text);
    opacity: 0.6;
}

/* Responsive */
@media (max-width: 900px) {
    .hec-archive__hero {
        min-height: 70vh;
    }

    .hec-archive__hero-inner {
        gap: 2.5rem;
    }

    .hec-row {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .hec-row--flip .hec-row__media { order: 1; }
    .hec-row--flip .hec-row__body  { order: 2; }

    .hec-row__media {
        aspect-ratio: 16 / 10;
    }

    .hec-archive__list {
        gap: 5rem;
    }
}

@media (max-width: 560px) {
    .hec-archive__top {
        font-size: 0.7rem;
        letter-spacing: 0.18em;
    }

    .hec-row__title {
        font-size: 1.6rem;
    }

    .hec-row__excerpt {
        font-size: 0.98rem;
    }
}
