/* ===== Base ===== */
html, body { overflow-x: clip; }
body { background: #FFF8EE; color: #0F172A; -webkit-font-smoothing: antialiased; }
::selection { background: #C8102E; color: #fff; }
.grad-text { background: linear-gradient(100deg, #C8102E 10%, #D4A017 90%); -webkit-background-clip: text; background-clip: text; color: transparent; padding-bottom: .12em; }

/* Brush underline under section titles */
.brush { position: relative; display: inline-block; }
.brush::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -10px; height: 10px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 12' preserveAspectRatio='none'%3E%3Cpath d='M2 8 C 40 2, 80 11, 120 6 S 180 3, 198 7' fill='none' stroke='%23D4A017' stroke-width='4' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat center/100% 100%;
  transform: scaleX(0); transform-origin: left; transition: transform 900ms cubic-bezier(.22,1,.36,1) 300ms;
}
.is-visible .brush::after, .brush.is-visible::after { transform: scaleX(1); }

/* ===== Scroll reveal ===== */
.reveal, .reveal-left, .reveal-right, .reveal-zoom {
  opacity: 0; transition: opacity 700ms cubic-bezier(.22,1,.36,1), transform 700ms cubic-bezier(.22,1,.36,1);
  will-change: opacity, transform;
}
.reveal { transform: translateY(32px); }
.reveal-left { transform: translateX(-48px); }
.reveal-right { transform: translateX(48px); }
.reveal-zoom { transform: scale(.92); }
.is-visible.reveal, .is-visible.reveal-left, .is-visible.reveal-right, .is-visible.reveal-zoom { opacity: 1; transform: none; }

/* Hero headline word reveal */
.word { display: inline-block; opacity: 0; transform: translateY(40%); animation: wordUp 900ms cubic-bezier(.22,1,.36,1) forwards; }
@keyframes wordUp { to { opacity: 1; transform: none; } }

/* Page fade in */
body { animation: pageIn 600ms ease both; }
@keyframes pageIn { from { opacity: 0; } to { opacity: 1; } }

/* ===== Ambient motion ===== */
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }
@keyframes sway { 0%,100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
@keyframes drift { from { transform: translateX(-10%); } to { transform: translateX(10%); } }
@keyframes pulseRing { 0% { transform: scale(1); opacity: .6; } 100% { transform: scale(1.9); opacity: 0; } }
@keyframes gradientShift { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }
@keyframes shake { 10%,90% { transform: translateX(-1px); } 20%,80% { transform: translateX(2px); } 30%,50%,70% { transform: translateX(-4px); } 40%,60% { transform: translateX(4px); } }
@keyframes bounceY { 0%,100% { transform: translateY(0); } 50% { transform: translateY(8px); } }
@keyframes spin { to { transform: rotate(360deg); } }

.float { animation: float 6s ease-in-out infinite; }
.float-slow { animation: float 9s ease-in-out infinite; }
.sway { animation: sway 5s ease-in-out infinite; transform-origin: top center; }
.drift { animation: drift 18s ease-in-out infinite alternate; }
.bounce-y { animation: bounceY 1.8s ease-in-out infinite; }
.shake { animation: shake 450ms ease; }
.cta-gradient { background: linear-gradient(120deg, #8F0B20, #C8102E, #E0542A, #D4A017, #C8102E); background-size: 300% 300%; animation: gradientShift 14s ease infinite; }

/* ===== Buttons ===== */
.btn { position: relative; overflow: hidden; display: inline-flex; align-items: center; gap: .5rem; border-radius: 9999px; font-weight: 600; transition: transform 300ms cubic-bezier(.22,1,.36,1), box-shadow 300ms, background-color 300ms, color 300ms; }
.btn:hover { transform: translateY(-3px); }
.btn:focus-visible { outline: 3px solid #D4A017; outline-offset: 3px; }
.btn-primary { background: #C8102E; color: #fff; box-shadow: 0 10px 25px -10px rgba(200,16,46,.6); }
.btn-primary:hover { box-shadow: 0 18px 35px -12px rgba(200,16,46,.75); background: #B00D27; }
.btn-shine::before { content: ""; position: absolute; top: 0; left: -120%; width: 60%; height: 100%; background: linear-gradient(110deg, transparent, rgba(255,255,255,.45), transparent); transform: skewX(-20deg); transition: left 700ms ease; }
.btn-shine:hover::before { left: 140%; }

/* Animated link underline */
.link-u { position: relative; }
.link-u::after { content: ""; position: absolute; left: 0; bottom: -4px; height: 2px; width: 100%; background: #C8102E; transform: scaleX(0); transform-origin: right; transition: transform 350ms cubic-bezier(.22,1,.36,1); }
.link-u:hover::after, .link-u.active::after { transform: scaleX(1); transform-origin: left; }
.link-u.active { color: #C8102E; }

/* ===== Cards ===== */
.card { transition: transform 450ms cubic-bezier(.22,1,.36,1), box-shadow 450ms, border-color 450ms; }
.card:hover { transform: translateY(-8px); box-shadow: 0 28px 50px -22px rgba(15,23,42,.35); }
.card .icon-wrap { transition: background-color 400ms, color 400ms, transform 400ms; }
.card:hover .icon-wrap { background: #C8102E; color: #fff; transform: rotate(-6deg) scale(1.05); }
.grad-border { border: 2px solid transparent; background: linear-gradient(#fff,#fff) padding-box, linear-gradient(135deg,#C8102E,#D4A017) border-box; }

/* ===== Navbar ===== */
#navbar { transition: background-color 400ms, box-shadow 400ms, backdrop-filter 400ms, padding 400ms; }
#navbar.scrolled { background: rgba(255,248,238,.78); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 8px 30px -16px rgba(15,23,42,.35); }
.burger span { display: block; height: 2px; width: 22px; background: #0F172A; border-radius: 2px; transition: transform 350ms, opacity 250ms; }
.burger span + span { margin-top: 5px; }
.burger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.burger.open span:nth-child(2) { opacity: 0; }
.burger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
#mobileMenu { transition: transform 450ms cubic-bezier(.22,1,.36,1); }
#menuOverlay { transition: opacity 400ms; }

/* ===== Timeline ===== */
#timelineFill { transform-origin: top; transform: scaleY(0); }
.tl-step { opacity: 0; transform: translateY(20px) scale(.96); transition: all 600ms cubic-bezier(.22,1,.36,1); }
.tl-step.is-visible { opacity: 1; transform: none; }

/* ===== Donut ===== */
.donut-seg { transition: stroke-dasharray 1400ms cubic-bezier(.22,1,.36,1); }

/* ===== Tabs ===== */
#tabIndicator { transition: transform 450ms cubic-bezier(.22,1,.36,1), width 450ms cubic-bezier(.22,1,.36,1); }
.tab-panel { transition: opacity 400ms ease, transform 400ms ease; }
.tab-panel.hidden-panel { opacity: 0; transform: translateY(10px); pointer-events: none; position: absolute; inset: 0; visibility: hidden; }

/* ===== Accordion ===== */
.acc-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 450ms cubic-bezier(.22,1,.36,1); }
.acc-body > div { overflow: hidden; }
.acc-item.open .acc-body { grid-template-rows: 1fr; }
.acc-icon { transition: transform 400ms cubic-bezier(.22,1,.36,1); }
.acc-item.open .acc-icon { transform: rotate(45deg); }
.acc-item.open { border-color: #C8102E33; box-shadow: 0 16px 36px -22px rgba(200,16,46,.45); }

/* ===== Carousel ===== */
#testiTrack { transition: transform 700ms cubic-bezier(.22,1,.36,1); }
.dot { transition: width 400ms, background-color 400ms; }

/* ===== Modal ===== */
#videoModal { transition: opacity 350ms ease, visibility 350ms; }
#videoModal .modal-box { transition: transform 450ms cubic-bezier(.22,1,.36,1); transform: scale(.9); }
#videoModal.open { opacity: 1; visibility: visible; }
#videoModal.open .modal-box { transform: scale(1); }

/* ===== Floating label fields ===== */
.field { position: relative; }
.field input, .field select, .field textarea {
  width: 100%; border-radius: .9rem; border: 1.5px solid #E7DCCB; background: #fff; padding: 1.35rem 1rem .55rem; font-size: .95rem;
  transition: border-color 250ms, box-shadow 250ms;
}
.field textarea { min-height: 120px; resize: vertical; }
.field label { position: absolute; left: 1rem; top: 1rem; color: #64748B; font-size: .95rem; pointer-events: none; transition: all 220ms ease; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: #C8102E; box-shadow: 0 0 0 4px rgba(200,16,46,.12); }
.field input:focus + label, .field input:not(:placeholder-shown) + label,
.field textarea:focus + label, .field textarea:not(:placeholder-shown) + label,
.field select + label { top: .4rem; font-size: .72rem; color: #C8102E; font-weight: 600; letter-spacing: .02em; }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: #DC2626; }
.field .err { display: block; color: #DC2626; font-size: .78rem; margin-top: .35rem; min-height: 1rem; }
.spinner { width: 18px; height: 18px; border: 2.5px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin 700ms linear infinite; }

/* ===== Toast ===== */
#toast { transition: transform 500ms cubic-bezier(.22,1,.36,1), opacity 500ms; transform: translateY(120%); opacity: 0; }
#toast.show { transform: translateY(0); opacity: 1; }

/* ===== Back to top ===== */
#toTop { transition: opacity 400ms, transform 400ms; opacity: 0; transform: translateY(20px); pointer-events: none; }
#toTop.show { opacity: 1; transform: none; pointer-events: auto; }

/* Play pulse */
.pulse-ring::before, .pulse-ring::after { content: ""; position: absolute; inset: 0; border-radius: 9999px; background: rgba(255,255,255,.5); animation: pulseRing 2s ease-out infinite; }
.pulse-ring::after { animation-delay: 1s; }

/* Image/visual zoom on hover */
.zoom-wrap { overflow: hidden; }
.zoom-wrap .zoom { transition: transform 900ms cubic-bezier(.22,1,.36,1); }
.zoom-wrap:hover .zoom { transform: scale(1.06); }

/* Lattice pattern */
.lattice { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48'%3E%3Cpath d='M0 24h12v-12h24v12h12M24 0v12M24 36v12M0 36h12v12M36 36v12h12' fill='none' stroke='%23ffffff' stroke-opacity='.05' stroke-width='1.5'/%3E%3C/svg%3E"); }
.clouds-bg { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='80' viewBox='0 0 160 80'%3E%3Cpath d='M10 60c0-10 10-16 18-12 2-10 16-14 22-6 6-6 18-2 18 8 8 0 12 10 4 12' fill='none' stroke='%23C8102E' stroke-opacity='.06' stroke-width='2'/%3E%3Cpath d='M90 30c0-8 8-12 14-9 2-8 13-10 17-4 5-4 14-1 14 6 6 0 9 8 3 9' fill='none' stroke='%23D4A017' stroke-opacity='.09' stroke-width='2'/%3E%3C/svg%3E"); }

/* ===== Reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .reveal, .reveal-left, .reveal-right, .reveal-zoom, .tl-step, .word { opacity: 1 !important; transform: none !important; }
  #timelineFill { transform: scaleY(1) !important; }
}

/* ===== Latest information ===== */
.news-card { transition: transform 450ms cubic-bezier(.22,1,.36,1), box-shadow 450ms; }
.news-card:hover { transform: translateY(-6px); box-shadow: 0 28px 50px -22px rgba(15,23,42,.35); }
.news-card:hover .news-more svg { transform: translateX(4px); }
.news-more svg { transition: transform 300ms; }
.news-card:focus-visible { outline: 3px solid #D4A017; outline-offset: 4px; }
.ticker-dot { animation: pulseRing 1.8s ease-out infinite; }

/* ===== Gallery strip ===== */
.gallery-track {
  scroll-snap-type: x mandatory; scrollbar-width: none; -ms-overflow-style: none;
  padding-inline: max(1rem, calc((100% - 80rem) / 2 + 2rem));
  scroll-padding-inline: max(1rem, calc((100% - 80rem) / 2 + 2rem));
  overscroll-behavior-x: contain;
}
.gallery-track::-webkit-scrollbar { display: none; }
.gallery-track.dragging { scroll-snap-type: none; cursor: grabbing; }
.gallery-track.dragging .gallery-item { pointer-events: none; }
.gallery-item { scroll-snap-align: start; }
.gallery-item:focus-visible { outline: 3px solid #D4A017; outline-offset: 4px; }
.gallery-item .g-info { transform: translateY(14px); transition: transform 500ms cubic-bezier(.22,1,.36,1); }
.gallery-item .g-desc { opacity: 0; max-height: 0; transition: opacity 400ms, max-height 500ms cubic-bezier(.22,1,.36,1); }
.gallery-item:hover .g-info, .gallery-item:focus-visible .g-info { transform: none; }
.gallery-item:hover .g-desc, .gallery-item:focus-visible .g-desc { opacity: 1; max-height: 4.5rem; }
.gallery-item .g-zoom { opacity: 0; transform: scale(.8); transition: opacity 300ms, transform 300ms; }
.gallery-item:hover .g-zoom, .gallery-item:focus-visible .g-zoom { opacity: 1; transform: none; }
@media (hover: none) { .gallery-item .g-info { transform: none; } }
#galleryProgress { transition: width 200ms linear, transform 200ms linear; }

/* ===== Lightbox ===== */
#lightbox { transition: opacity 350ms ease, visibility 350ms; }
#lightbox.open { opacity: 1; visibility: visible; }
#lightbox .lb-stage { transition: transform 450ms cubic-bezier(.22,1,.36,1); transform: scale(.94); }
#lightbox.open .lb-stage { transform: none; }
#lbImg { transition: opacity 250ms ease; }
#lbImg.loading { opacity: 0; }

/* ===== Article body ===== */
.article p + p { margin-top: 1.1rem; }
