/* =========================================================================
   JHS Experience Layer
   A small design system for the redesigned interior pages: editorial type,
   card surfaces, and a set of scroll/pointer effects.

   Motion contract: everything degrades safely. Reveal states are only armed
   once jhs-experience.js confirms IntersectionObserver support and that the
   visitor has not asked for reduced motion, so content is never hidden by CSS
   alone.
   ========================================================================= */

.jhs-x {
    --ink: #001c54;
    --body: #37415c;
    --muted: #6b748d;
    --accent: #fec001;
    --line: #e6ecf6;
    --surface: #f5f7fb;
    --card: #ffffff;

    font-family: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    color: var(--body);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.jhs-x section { position: relative; }
.jhs-x-pad { padding: 88px 0; }
.jhs-x-pad-sm { padding: 64px 0; }
.jhs-x-light { background: #fff; }
.jhs-x-tint { background: var(--surface); }
.jhs-x-dark { background: var(--ink); color: rgba(255, 255, 255, .8); }

/* ---- 1. Type ---- */
.jhs-x-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    font-size: 12.5px;
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--accent);
}

.jhs-x-eyebrow::before {
    content: "";
    width: 32px;
    height: 2px;
    background: var(--accent);
}

.jhs-x-display {
    margin: 0 0 22px;
    font-size: clamp(2rem, 1.4rem + 2.2vw, 3.1rem);
    line-height: 1.1;
    letter-spacing: -.5px;
    font-weight: 800;
    color: var(--ink);
}

.jhs-x-title {
    margin: 0 0 16px;
    font-size: clamp(1.55rem, 1.2rem + 1.4vw, 2.25rem);
    line-height: 1.22;
    font-weight: 800;
    color: var(--ink);
}

.jhs-x-lead { margin: 0 0 18px; font-size: 17.5px; line-height: 1.8; font-weight: 500; }
.jhs-x-body { margin: 0 0 16px; font-size: 16px; line-height: 1.8; font-weight: 500; }
.jhs-x-sub { margin: 0; font-size: 16px; line-height: 1.75; font-weight: 500; }

.jhs-x-dark .jhs-x-display,
.jhs-x-dark .jhs-x-title { color: #fff; }
.jhs-x-dark .jhs-x-lead,
.jhs-x-dark .jhs-x-sub,
.jhs-x-dark .jhs-x-body { color: rgba(255, 255, 255, .78); }

.jhs-x-head { max-width: 780px; margin: 0 0 48px; }
.jhs-x-head.is-centred { margin-left: auto; margin-right: auto; text-align: center; }
.jhs-x-head .jhs-x-title { margin-bottom: 14px; }

/* ---- 2. Surfaces ---- */
.jhs-x-card {
    position: relative;
    padding: 34px 32px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 18px;
    overflow: hidden;
    transition: transform .45s cubic-bezier(.22, .61, .36, 1),
                box-shadow .45s ease,
                border-color .45s ease;
}

.jhs-x-card:hover {
    transform: translateY(-6px);
    border-color: #dbe3f1;
    box-shadow: 0 26px 52px rgba(0, 28, 84, .13);
}

.jhs-x-card h3 { margin: 0 0 10px; font-size: 19px; font-weight: 800; color: var(--ink); }
.jhs-x-card p { margin: 0; font-size: 15.5px; line-height: 1.75; font-weight: 500; }

.jhs-x-index {
    display: block;
    margin-bottom: 14px;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 1.4px;
    color: var(--accent);
}

.jhs-x-tag {
    display: block;
    margin-bottom: 14px;
    font-size: 12.5px;
    font-weight: 800;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: #8590a8;
}

/* ---- 3. Pointer spotlight (cards lit from the cursor) ---- */
.jhs-x-spot::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(320px circle at var(--mx, 50%) var(--my, 0%),
                rgba(255, 165, 0, .16), transparent 62%);
    opacity: 0;
    transition: opacity .4s ease;
    pointer-events: none;
}

.jhs-x-spot:hover::before { opacity: 1; }

.jhs-x-dark .jhs-x-spot::before {
    background: radial-gradient(320px circle at var(--mx, 50%) var(--my, 0%),
                rgba(255, 165, 0, .22), transparent 62%);
}

/* ---- 4. Sticky stack (cards deal themselves as the page scrolls) ---- */
.jhs-x-stack { display: grid; gap: 26px; }

@media (min-width: 992px) {
    .jhs-x-stack { gap: 34px; }

    .jhs-x-stack > .jhs-x-stack-item {
        position: sticky;
        top: calc(120px + var(--i, 0) * 26px);
    }

    .jhs-x-stack > .jhs-x-stack-item:last-child { margin-bottom: 10vh; }
}

.jhs-x-stack-item {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 34px;
    align-items: center;
    padding: 34px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: 0 22px 44px rgba(0, 28, 84, .10);
}

.jhs-x-stack-item .jhs-x-stack-media { margin: 0; overflow: hidden; border-radius: 16px; }

.jhs-x-stack-item .jhs-x-stack-media img {
    display: block;
    width: 100%;
    height: 240px;
    object-fit: cover;
    transform: scale(1.01);
    transition: transform .8s cubic-bezier(.22, .61, .36, 1);
}

.jhs-x-stack-item:hover .jhs-x-stack-media img { transform: scale(1.07); }
.jhs-x-stack-item h3 { margin: 0 0 12px; font-size: 23px; font-weight: 800; color: var(--ink); }
.jhs-x-stack-item p { margin: 0; font-size: 16px; line-height: 1.8; font-weight: 500; }

@media (max-width: 991px) {
    .jhs-x-stack-item { grid-template-columns: 1fr; gap: 22px; padding: 26px; }
    .jhs-x-stack-item .jhs-x-stack-media img { height: 220px; }
}

/* ---- 5. Tiles: image cards with a caption that rises on hover ---- */
.jhs-x-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; }

.jhs-x-tile {
    position: relative;
    display: block;
    overflow: hidden;
    border-radius: 18px;
    isolation: isolate;
    transform-style: preserve-3d;
    transition: transform .5s cubic-bezier(.22, .61, .36, 1), box-shadow .5s ease;
}

.jhs-x-tile img {
    display: block;
    width: 100%;
    height: 320px;
    object-fit: cover;
    transition: transform .9s cubic-bezier(.22, .61, .36, 1), filter .6s ease;
}

.jhs-x-tile::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0, 28, 84, 0) 38%, rgba(0, 28, 84, .82) 100%);
    transition: opacity .5s ease;
}

.jhs-x-tile figcaption {
    position: absolute;
    left: 24px;
    right: 24px;
    bottom: 22px;
    z-index: 2;
    transform: translateY(10px);
    transition: transform .5s cubic-bezier(.22, .61, .36, 1);
}

.jhs-x-tile figcaption strong {
    display: block;
    font-size: 18px;
    font-weight: 800;
    color: #fff;
}

.jhs-x-tile figcaption span {
    display: block;
    margin-top: 4px;
    font-size: 13.5px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0);
    transition: color .45s ease;
}

.jhs-x-tile:hover { box-shadow: 0 30px 56px rgba(0, 28, 84, .22); }
.jhs-x-tile:hover img { transform: scale(1.08); }
.jhs-x-tile:hover figcaption { transform: translateY(0); }
.jhs-x-tile:hover figcaption span { color: rgba(255, 255, 255, .8); }

@media (max-width: 1199px) { .jhs-x-tiles { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 575px) {
    .jhs-x-tiles { grid-template-columns: 1fr; }
    .jhs-x-tile img { height: 260px; }
}

/* ---- 6. Marquee ribbon ---- */
.jhs-x-ribbon {
    overflow: hidden;
    padding: 18px 0;
    background: var(--ink);
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}

.jhs-x-ribbon-track {
    display: flex;
    width: max-content;
    gap: 0;
    animation: jhsXMarquee 34s linear infinite;
}

.jhs-x-ribbon:hover .jhs-x-ribbon-track { animation-play-state: paused; }

.jhs-x-ribbon-track span {
    display: inline-flex;
    align-items: center;
    gap: 26px;
    padding-right: 26px;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 2.4px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .82);
    white-space: nowrap;
}

.jhs-x-ribbon-track span::after {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
}

@keyframes jhsXMarquee {
    from { transform: translate3d(0, 0, 0); }
    to   { transform: translate3d(-50%, 0, 0); }
}

/* ---- 7. Rail: numbered list with a scroll-drawn spine ---- */
.jhs-x-rail { position: relative; padding-left: 46px; }

.jhs-x-rail::before {
    content: "";
    position: absolute;
    left: 13px;
    top: 6px;
    bottom: 6px;
    width: 2px;
    background: var(--line);
}

.jhs-x-rail::after {
    content: "";
    position: absolute;
    left: 13px;
    top: 6px;
    width: 2px;
    height: calc(var(--progress, 0) * 100%);
    max-height: calc(100% - 12px);
    background: var(--accent);
    transition: height .2s linear;
}

.jhs-x-rail-item { position: relative; padding: 0 0 34px; }
.jhs-x-rail-item:last-child { padding-bottom: 0; }

.jhs-x-rail-item::before {
    content: "";
    position: absolute;
    left: -39px;
    top: 7px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--accent);
    z-index: 1;
}

.jhs-x-rail-item strong { display: block; margin-bottom: 8px; font-size: 18px; font-weight: 800; color: var(--ink); }
.jhs-x-rail-item span { font-size: 15.5px; line-height: 1.75; font-weight: 500; }

.jhs-x-dark .jhs-x-rail::before { background: rgba(255, 255, 255, .18); }
.jhs-x-dark .jhs-x-rail-item::before { background: var(--ink); }
.jhs-x-dark .jhs-x-rail-item strong { color: #fff; }
.jhs-x-dark .jhs-x-rail-item span { color: rgba(255, 255, 255, .78); }

/* ---- 8. Quote ---- */
.jhs-x-quote {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 0 0 26px;
    /* the theme skins every blockquote as a bordered card */
    border: none !important;
    border-left: 3px solid var(--accent) !important;
    background: transparent !important;
    border-radius: 0;
    box-shadow: none;
}

.jhs-x-quote::before,
.jhs-x-quote::after,
.jhs-x-quote cite::before,
.jhs-x-quote cite::after { content: none !important; }

.jhs-x-quote p {
    margin: 0 0 14px;
    font-size: clamp(1.15rem, .95rem + .7vw, 1.55rem);
    line-height: 1.55;
    font-weight: 700;
    color: var(--ink);
}

.jhs-x-quote cite {
    display: block;
    padding: 0 !important;
    background: transparent !important;
    font-size: 13.5px;
    font-style: normal;
    font-weight: 700;
    letter-spacing: .4px;
    color: var(--muted);
}

.jhs-x-dark .jhs-x-quote p { color: #fff; }
.jhs-x-dark .jhs-x-quote cite { color: rgba(255, 255, 255, .7); }

/* ---- 9. Buttons & CTA ---- */
.jhs-x-cta-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 34px;
    padding: 44px 48px;
    background: var(--ink);
    border-radius: 22px;
}

.jhs-x-cta-inner h2 { margin: 0 0 8px; font-size: 25px; font-weight: 800; color: #fff; }
.jhs-x-cta-inner p { margin: 0; font-size: 16px; line-height: 1.7; color: rgba(255, 255, 255, .82); }
.jhs-x-cta-actions { display: flex; flex-wrap: wrap; gap: 12px; flex-shrink: 0; }

.jhs-x-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 50px;
    padding: 13px 26px;
    border-radius: 10px;
    border: 1.5px solid transparent;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    transition: transform .2s ease, background-color .2s ease, border-color .2s ease, color .2s ease;
}

.jhs-x-btn.is-primary { background: var(--accent); color: var(--ink); }
.jhs-x-btn.is-primary:hover { background: #fff; color: var(--ink); transform: translateY(-2px); }
.jhs-x-btn.is-ghost { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .5); }
.jhs-x-btn.is-ghost:hover { border-color: #fff; background: rgba(255, 255, 255, .1); transform: translateY(-2px); }

@media (max-width: 991px) {
    .jhs-x-pad { padding: 60px 0; }
    .jhs-x-pad-sm { padding: 46px 0; }
    .jhs-x-cta-inner { flex-direction: column; align-items: flex-start; padding: 34px 30px; }
}

@media (max-width: 575px) {
    .jhs-x-pad { padding: 46px 0; }
    .jhs-x-cta-actions { width: 100%; }
    .jhs-x-btn { flex: 1 1 100%; }
    .jhs-x-card { padding: 28px 24px; }
}

/* ---- 10. Reveal states (armed by JS only) ---- */
[data-x] { opacity: 1; }

.jhs-x-ready [data-x] {
    opacity: 0;
    transform: translateY(24px);
    will-change: transform, opacity;
}

.jhs-x-ready [data-x="scale"] { transform: translateY(20px) scale(.97); }
.jhs-x-ready [data-x="left"] { transform: translateX(-26px); }
.jhs-x-ready [data-x="right"] { transform: translateX(26px); }
/* a full inset would clip the element to zero area, which stops
   IntersectionObserver ever reporting it — keep part of it measurable */
.jhs-x-ready [data-x="clip"] { transform: none; clip-path: inset(0 0 55% 0); }

.jhs-x-ready [data-x].is-in {
    opacity: 1;
    transform: none;
    clip-path: inset(0 0 0 0);
    transition: opacity .75s cubic-bezier(.22, .61, .36, 1),
                transform .75s cubic-bezier(.22, .61, .36, 1),
                clip-path .9s cubic-bezier(.22, .61, .36, 1);
    transition-delay: var(--d, 0ms);
}

.jhs-x-ready [data-x].is-done { will-change: auto; }

@media (prefers-reduced-motion: reduce) {
    .jhs-x-ribbon-track { animation: none; }
    .jhs-x-stack > .jhs-x-stack-item { position: static; }
}
