/* =====================================================================
   Motion & surface system — shared by the marketing landing page and the
   public cause pages.

   Everything here is opt-in through a class or a data attribute, so no
   existing page changes appearance until it asks for it. The whole file
   degrades to "no movement, same layout" under prefers-reduced-motion.
   ===================================================================== */

:root {
    --tt-navy: #0f284a;
    --tt-navy-deep: #0a1c36;
    --tt-gold: #d4a557;
    --tt-gold-deep: #b98936;
    --tt-ink: #14161a;
    --tt-muted: #55606f;
    --tt-line: #ecedf1;
    --tt-ease: cubic-bezier(.2, .8, .2, 1);
    --tt-radius: 16px;
    --tt-shadow-sm: 0 6px 18px rgba(15, 20, 30, .07);
    --tt-shadow-md: 0 16px 38px rgba(15, 20, 30, .12);
    --tt-shadow-lg: 0 26px 60px rgba(15, 20, 30, .18);
}

/* Anchored sections must clear the sticky navbar instead of hiding under it. */
html {
    scroll-behavior: smooth;
    scroll-padding-top: 88px;
}
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
}

/* ---------------------------------------------------------------------
   Scroll-reveal: one engine (assets/js/scroll-reveal.js), several flavours.
   `data-reveal` on its own keeps the original rise-and-fade.
   --------------------------------------------------------------------- */
[data-reveal] {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity .7s var(--tt-ease), transform .7s var(--tt-ease), filter .7s ease;
    transition-delay: var(--tt-reveal-delay, 0ms);
    will-change: opacity, transform;
}
[data-reveal="left"]  { transform: translate3d(-36px, 0, 0); }
[data-reveal="right"] { transform: translate3d(36px, 0, 0); }
[data-reveal="zoom"]  { transform: scale(.94); }
[data-reveal="blur"]  { transform: translateY(18px); filter: blur(8px); }
[data-reveal="rise"]  { transform: translate3d(0, 48px, 0) scale(.98); }

[data-reveal].is-visible {
    opacity: 1;
    transform: none;
    filter: none;
    will-change: auto;
}

/* Line-by-line headline reveal (JS splits the text into .tt-line spans). */
.tt-split { display: block; overflow: hidden; }
.tt-split .tt-line {
    display: block;
    transform: translateY(110%);
    transition: transform .9s var(--tt-ease);
    transition-delay: var(--tt-line-delay, 0ms);
}
.is-visible .tt-split .tt-line,
.tt-split.is-visible .tt-line { transform: translateY(0); }

/* ---------------------------------------------------------------------
   Reading-progress bar + back-to-top (rendered once in base.html.twig)
   --------------------------------------------------------------------- */
.tt-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 100%;
    transform: scaleX(0);
    transform-origin: 0 50%;
    background: linear-gradient(90deg, var(--tt-gold) 0%, #f2c684 60%, #fff 100%);
    z-index: 1080;
    pointer-events: none;
}

.tt-to-top {
    position: fixed;
    right: 18px;
    bottom: 88px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, .18);
    background: var(--tt-navy);
    color: #fff;
    display: grid;
    place-items: center;
    box-shadow: var(--tt-shadow-md);
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity .3s ease, transform .3s var(--tt-ease), visibility .3s;
    z-index: 1035;
}
.tt-to-top.is-on { opacity: 1; visibility: visible; transform: none; }
.tt-to-top:hover { background: var(--tt-gold); color: var(--tt-ink); }

/* ---------------------------------------------------------------------
   Sticky mobile call-to-action bar
   --------------------------------------------------------------------- */
.tt-sticky-cta {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1030;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--tt-line);
    transform: translateY(110%);
    transition: transform .35s var(--tt-ease);
}
.tt-sticky-cta.is-on { transform: none; }
.tt-sticky-cta .btn { width: 100%; }
@media (min-width: 992px) { .tt-sticky-cta { display: none; } }

/* ---------------------------------------------------------------------
   Surfaces: cards that lift, tilt and catch a soft sheen on hover
   --------------------------------------------------------------------- */
.tt-card {
    position: relative;
    background: #fff;
    border: 1px solid var(--tt-line);
    border-radius: var(--tt-radius);
    box-shadow: var(--tt-shadow-sm);
    transition: transform .35s var(--tt-ease), box-shadow .35s ease, border-color .35s ease;
    overflow: hidden;
}
.tt-card::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(320px circle at var(--tt-mx, 50%) var(--tt-my, 0%),
                rgba(212, 165, 87, .16), transparent 62%);
    opacity: 0;
    transition: opacity .35s ease;
    pointer-events: none;
}
.tt-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--tt-shadow-md);
    border-color: rgba(212, 165, 87, .45);
}
.tt-card:hover::after { opacity: 1; }

/* JS writes --tt-tilt-x/y from the pointer position on [data-tilt]. */
[data-tilt] {
    transform-style: preserve-3d;
    transition: transform .4s var(--tt-ease);
}
[data-tilt].is-tilting {
    transform: perspective(900px)
               rotateX(var(--tt-tilt-x, 0deg))
               rotateY(var(--tt-tilt-y, 0deg))
               translateY(-6px);
    transition: transform .12s linear;
}

/* ---------------------------------------------------------------------
   Animated backgrounds
   --------------------------------------------------------------------- */
.tt-aurora {
    position: absolute;
    inset: -25%;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(38% 42% at 22% 30%, rgba(212, 165, 87, .30), transparent 62%),
        radial-gradient(34% 40% at 78% 26%, rgba(79, 209, 139, .18), transparent 62%),
        radial-gradient(46% 46% at 55% 82%, rgba(64, 122, 214, .26), transparent 64%);
    filter: blur(18px);
    animation: tt-aurora 22s ease-in-out infinite alternate;
}
@keyframes tt-aurora {
    0%   { transform: translate3d(-3%, -2%, 0) scale(1.02); }
    50%  { transform: translate3d(3%, 2%, 0) scale(1.10); }
    100% { transform: translate3d(-2%, 3%, 0) scale(1.05); }
}

.tt-grain::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    opacity: .35;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.35'/%3E%3C/svg%3E");
}

/* Section seam: a hairline that draws itself in as the section arrives. */
.tt-seam { position: relative; }
.tt-seam::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    width: 0;
    height: 1px;
    transform: translateX(-50%);
    background: linear-gradient(90deg, transparent, var(--tt-gold), transparent);
    transition: width 1.1s var(--tt-ease);
}
.tt-seam.is-visible::before { width: min(720px, 82%); }

/* ---------------------------------------------------------------------
   Counters, marquee, pills
   --------------------------------------------------------------------- */
.tt-count { font-variant-numeric: tabular-nums; }

.tt-marquee {
    overflow: hidden;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
            mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.tt-marquee-track {
    display: flex;
    gap: 42px;
    width: max-content;
    animation: tt-marquee 32s linear infinite;
}
.tt-marquee:hover .tt-marquee-track { animation-play-state: paused; }
@keyframes tt-marquee { to { transform: translateX(-50%); } }

/* ---------------------------------------------------------------------
   Focus visibility — the whole system is keyboard-navigable
   --------------------------------------------------------------------- */
a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
    outline: 3px solid var(--tt-gold);
    outline-offset: 3px;
    border-radius: 6px;
}

.tt-skip-link {
    position: absolute;
    left: 12px;
    top: -60px;
    z-index: 1090;
    background: var(--tt-navy);
    color: #fff;
    padding: 10px 16px;
    border-radius: 0 0 10px 10px;
    transition: top .2s ease;
}
.tt-skip-link:focus { top: 0; color: #fff; }

/* ---------------------------------------------------------------------
   Lightbox (community mural)
   --------------------------------------------------------------------- */
.tt-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1090;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(8, 10, 14, .88);
    backdrop-filter: blur(6px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .3s ease, visibility .3s;
}
.tt-lightbox.is-on { opacity: 1; visibility: visible; }
.tt-lightbox img {
    max-width: min(92vw, 900px);
    max-height: 82vh;
    border-radius: 18px;
    box-shadow: var(--tt-shadow-lg);
    transform: scale(.94);
    transition: transform .35s var(--tt-ease);
}
.tt-lightbox.is-on img { transform: scale(1); }
.tt-lightbox-caption {
    color: #e7ecf5;
    margin-top: 14px;
    font-size: .9rem;
    text-align: center;
}
.tt-lightbox-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 0;
    background: rgba(255, 255, 255, .14);
    color: #fff;
    font-size: 1.1rem;
}

/* ---------------------------------------------------------------------
   Respect the user's motion setting — nothing above may move.
   --------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    [data-reveal],
    [data-reveal].is-visible {
        opacity: 1 !important;
        transform: none !important;
        filter: none !important;
        transition: none !important;
    }
    .tt-split .tt-line { transform: none; transition: none; }
    .tt-aurora,
    .tt-marquee-track { animation: none; }
    .tt-card,
    [data-tilt],
    .tt-lightbox img { transition: none; }
    [data-tilt].is-tilting { transform: none; }
    .tt-seam::before { transition: none; }
}
