/* =====================================================================
   Royal Family Eventing a.s.b.l. — rfe.lu
   One stylesheet. Mobile first. Colours shared with LCCC (lccc.lu):
   change them once in :root.
   ===================================================================== */

:root {
  --purple: #4b2d8f;
  --purple-dark: #2d1660;
  --purple-deep: #170b33;
  --night: #0e0820;
  --purple-light: #efeaf9;
  --gold: #f5c518;
  --gold-soft: #e9c46a;
  --gold-dark: #b8860b;
  --text: #24212b;
  --muted: #5f5a6b;
  --on-dark: #ece6fa;
  --on-dark-muted: #b6aad3;
  --bg: #f6f5f8;
  --card: #ffffff;
  --border: #e3dfeb;
  --radius: 12px;
  --max: 1120px;
  --display: 'Chakra Petch', 'Segoe UI', system-ui, sans-serif;
}

@font-face {
  font-family: 'Chakra Petch'; font-weight: 600; font-style: normal; font-display: swap;
  src: url('fonts/chakra-petch-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Chakra Petch'; font-weight: 700; font-style: normal; font-display: swap;
  src: url('fonts/chakra-petch-700.woff2') format('woff2');
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--purple); }
h1, h2, h3 { line-height: 1.2; }

.container { max-width: var(--max); margin: 0 auto; padding: 0 16px; }
.section { padding: 72px 0; }
.section-dark { background: var(--purple-deep); color: var(--on-dark); }
.section-dark a { color: var(--gold-soft); }
.section-dark a.btn-gold { color: var(--purple-deep); }

.eyebrow {
  font-family: var(--display);
  font-size: .82rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--purple);
}
.section-dark .eyebrow, .hero .eyebrow, .next .eyebrow { color: var(--gold-soft); }

.section-title {
  font-family: var(--display);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 700;
  margin: 6px 0 14px;
  letter-spacing: 0;
}
.lead { font-size: 1.12rem; color: var(--muted); max-width: 680px; }
.section-dark .lead { color: var(--on-dark-muted); }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(14, 8, 32, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(233, 196, 106, .18);
}
.site-header .container {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 60px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; }
.brand img { width: 38px; height: 38px; border-radius: 50%; }
.brand span { font-family: var(--display); font-weight: 700; letter-spacing: .08em; font-size: 1.02rem; }
.nav { display: flex; gap: 4px 18px; flex-wrap: wrap; }
.nav a {
  font-family: var(--display); text-transform: uppercase; letter-spacing: .06em;
  color: var(--on-dark-muted); text-decoration: none; font-size: .93rem; font-weight: 600;
  padding: 6px 0;
}
.nav a:hover { color: var(--gold-soft); }
@media (max-width: 720px) {
  .site-header .container { padding-top: 8px; padding-bottom: 8px; }
  .nav { width: 100%; gap: 16px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { white-space: nowrap; }
  .nav a { font-size: .88rem; }
}

/* ---------- hero ---------- */
.hero {
  position: relative; overflow: hidden; color: #fff;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(108, 62, 200, .55), transparent 65%),
    linear-gradient(180deg, var(--purple-deep), var(--night));
}
.hero-bg {
  position: absolute; inset: 0;
  background: url('img/photos/pem24-finals-stage.jpg') center 30% / cover no-repeat;
  opacity: .16; filter: grayscale(.3);
}
.hero::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 4px;
  background: linear-gradient(90deg, transparent, var(--gold-soft), transparent);
}
.hero .container {
  position: relative; text-align: center;
  padding-top: 64px; padding-bottom: 80px;
}
.crest {
  width: 168px; height: 168px; margin: 0 auto 26px; border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(233, 196, 106, .55), 0 0 60px rgba(150, 90, 255, .45);
}
.hero h1 {
  font-family: var(--display);
  font-size: clamp(2.2rem, 7vw, 4.2rem);
  font-weight: 700; letter-spacing: .02em; text-transform: uppercase;
  color: var(--gold-soft);
  text-shadow: 0 2px 24px rgba(0, 0, 0, .5);
}
.hero .tagline {
  font-size: clamp(1.05rem, 2.4vw, 1.3rem); color: var(--on-dark);
  max-width: 640px; margin: 14px auto 30px;
}
.btns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.btn {
  display: inline-block; padding: 12px 22px; border-radius: 999px;
  font-family: var(--display); font-weight: 700; text-decoration: none; font-size: .98rem;
  text-transform: uppercase; letter-spacing: .05em;
  border: 2px solid transparent;
}
.btn-gold { background: var(--gold); color: var(--purple-deep); }
.btn-gold:hover { background: var(--gold-soft); }
.btn-ghost { border-color: rgba(233, 196, 106, .6); color: var(--gold-soft); }
.btn-ghost:hover { background: rgba(233, 196, 106, .1); }
.section .btn-ghost { color: var(--purple); border-color: var(--purple); }
.section-dark .btn-ghost { color: var(--gold-soft); border-color: rgba(233, 196, 106, .6); }

/* ---------- stats ---------- */
.stats {
  background: var(--purple-dark); color: #fff;
  border-bottom: 1px solid rgba(233, 196, 106, .2);
}
.stats .container {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px;
}
.stat { padding: 26px 12px; text-align: center; }
.stat strong {
  display: block; font-family: var(--display); font-size: clamp(1.7rem, 4vw, 2.3rem); color: var(--gold-soft);
}
.stat span { font-size: .9rem; color: var(--on-dark-muted); }
@media (min-width: 760px) { .stats .container { grid-template-columns: repeat(4, 1fr); } }

/* ---------- about ---------- */
.split { display: grid; gap: 36px; align-items: center; }
@media (min-width: 880px) { .split { grid-template-columns: 1.1fr .9fr; } }
.split p + p { margin-top: 14px; }
.pillars { display: grid; gap: 14px; margin-top: 26px; }
@media (min-width: 560px) { .pillars { grid-template-columns: repeat(3, 1fr); } }
.pillar {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; border-top: 3px solid var(--gold);
}
.pillar h3 { font-size: 1rem; color: var(--purple-dark); margin-bottom: 4px; }
.pillar p { font-size: .92rem; color: var(--muted); }
.photo-stack { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.photo-stack img { border-radius: var(--radius); aspect-ratio: 1; object-fit: cover; width: 100%; }
.photo-stack img:first-child { grid-column: span 2; aspect-ratio: 16 / 10; }

/* ---------- timeline ----------
   Without JS: every .era is shown as a compact card, one below the other.
   With JS (.tl.is-live): a year bar on top, one card at a time. */
.tl { margin-top: 32px; }
.tl-stage { display: grid; gap: 14px; }

.era {
  position: relative; overflow: hidden;
  display: grid; gap: 18px; align-items: center; align-content: start;
  padding: 22px;
  background: linear-gradient(135deg, rgba(108, 62, 200, .22), rgba(255, 255, 255, .03));
  border: 1px solid rgba(233, 196, 106, .22);
  border-radius: 16px;
}
/* big faint year in the background */
.era::before {
  content: attr(data-year);
  position: absolute; right: -6px; bottom: -28px; z-index: 0;
  font-family: var(--display); font-weight: 700; line-height: 1;
  font-size: clamp(5rem, 16vw, 10rem);
  color: rgba(233, 196, 106, .07);
  pointer-events: none;
}
.era > * { position: relative; z-index: 1; }
.era h3 { font-family: var(--display); font-size: 1.35rem; color: #fff; margin-bottom: 8px; }
.era p { color: var(--on-dark-muted); font-size: .97rem; }
.era p + p { margin-top: 10px; }
.era strong { color: var(--on-dark); }
.era-next { border-color: rgba(245, 197, 24, .6); box-shadow: 0 0 40px rgba(245, 197, 24, .12) inset; }

.era-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.era-tags span, .medal {
  display: inline-block; font-family: var(--display); font-size: .78rem; font-weight: 600;
  letter-spacing: .04em; text-transform: uppercase;
  padding: 3px 10px; border-radius: 999px;
  background: rgba(233, 196, 106, .1); color: var(--gold-soft); border: 1px solid rgba(233, 196, 106, .3);
}
.medals { display: flex; flex-wrap: wrap; gap: 6px; }
.medal { font-size: .85rem; background: rgba(233, 196, 106, .16); }

.era-photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.era-photos img {
  width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px;
  border: 1px solid rgba(233, 196, 106, .2);
}
.era-photos img:only-child { grid-column: 1 / -1; aspect-ratio: 16 / 9; }
.era-photos:has(img:nth-child(2):last-child) { grid-template-columns: 1fr 1fr; }
.btn-sm { padding: 8px 16px; font-size: .85rem; }

@media (min-width: 820px) {
  .era { grid-template-columns: 1.15fr 1fr; padding: 28px 30px; gap: 28px; }
}

/* year bar (built by script.js) */
.tl-bar { position: relative; display: none; margin-bottom: 18px; }
.tl.is-live .tl-bar { display: block; }
.tl-years {
  position: relative; display: flex; gap: 0;
  overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none;
  padding: 4px 2px 2px;
}
.tl-years::-webkit-scrollbar { display: none; }
.tl-line, .tl-fill {
  position: absolute; left: 0; top: 19px; height: 2px; pointer-events: none;
}
.tl-line { right: 0; background: rgba(233, 196, 106, .18); }
.tl-fill {
  width: 0; background: linear-gradient(90deg, var(--gold-dark), var(--gold-soft));
  box-shadow: 0 0 10px rgba(233, 196, 106, .6);
  transition: width .45s ease;
}
.tl-year {
  flex: 1 0 84px; position: relative; z-index: 1;
  background: none; border: 0; cursor: pointer;
  padding: 0 4px 6px; text-align: center; color: var(--on-dark-muted);
  font-family: var(--display); line-height: 1.2;
}
.tl-year::before {
  content: ''; display: block; width: 16px; height: 16px; margin: 9px auto 10px;
  border-radius: 50%; background: var(--purple-deep);
  border: 2px solid rgba(233, 196, 106, .45);
  transition: transform .25s ease, background .25s ease, box-shadow .25s ease;
}
.tl-year b { display: block; font-size: 1.05rem; font-weight: 700; }
.tl-year small { display: block; font-size: .7rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; opacity: .8; }
.tl-year:hover { color: #fff; }
.tl-year:hover::before { border-color: var(--gold-soft); }
.tl-year.is-past::before { background: var(--gold-dark); border-color: var(--gold-soft); }
.tl-year[aria-selected="true"] { color: var(--gold-soft); }
.tl-year[aria-selected="true"]::before {
  background: var(--gold); border-color: #fff; transform: scale(1.35);
  box-shadow: 0 0 0 5px rgba(245, 197, 24, .18), 0 0 18px rgba(245, 197, 24, .7);
}
.tl-year:focus-visible { outline: 2px solid var(--gold-soft); outline-offset: 2px; border-radius: 8px; }

/* one card at a time */
.tl.is-live .tl-stage { display: grid; gap: 0; }
.tl.is-live .era { grid-area: 1 / 1; visibility: hidden; opacity: 0; transform: translateX(24px); }
.tl.is-live .era.from-left { transform: translateX(-24px); }
.tl.is-live .era.is-active {
  visibility: visible; opacity: 1; transform: none;
  transition: opacity .4s ease, transform .4s ease, visibility 0s;
}

.tl-controls { display: none; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; }
.tl.is-live .tl-controls { display: flex; }
.tl-arrow {
  width: 44px; height: 44px; border-radius: 50%; cursor: pointer;
  background: rgba(255, 255, 255, .05); color: var(--gold-soft);
  border: 1px solid rgba(233, 196, 106, .4); font-size: 1.2rem; line-height: 1;
}
.tl-arrow:hover:not(:disabled) { background: rgba(233, 196, 106, .15); }
.tl-arrow:disabled { opacity: .3; cursor: default; }
.tl-count { font-family: var(--display); color: var(--on-dark-muted); font-size: .9rem; letter-spacing: .08em; }
.tl-count b { color: var(--gold-soft); }

/* phones: cards size to their own content instead of the tallest year */
@keyframes tl-in { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }
@keyframes tl-in-left { from { opacity: 0; transform: translateX(-18px); } to { opacity: 1; transform: none; } }
@media (max-width: 819px) {
  .tl.is-live .era { display: none; }
  .tl.is-live .era.is-active { display: grid; animation: tl-in .35s ease; }
  .tl.is-live .era.is-active.from-left { animation-name: tl-in-left; }
}

@media (prefers-reduced-motion: reduce) {
  .tl.is-live .era.is-active { animation: none; }
  .tl-fill, .tl-year::before, .tl.is-live .era.is-active { transition: none; }
  .tl.is-live .era, .tl.is-live .era.from-left { transform: none; }
}

/* ---------- scroll mode (script.js adds .story-scroll on big screens) ----------
   The section gets tall; its content stays pinned while scrolling moves through the years. */
.story-scroll { padding: 0; }
.story-scroll .story-track { height: calc(var(--steps, 7) * 42vh + 100vh); }
.story-scroll .story-sticky {
  position: sticky; top: 60px;
  min-height: calc(100vh - 60px);
  display: flex; align-items: center;
  padding: 28px 0;
}
.story-scroll .story-sticky > .container { width: 100%; }
.story-scroll .tl { margin-top: 22px; }
.story-scroll .tl-fill { transition: none; }
/* after scrolling past: short again, nothing pinned (script.js adds .story-done) */
.story-scroll.story-done .story-track { height: auto; }
.story-scroll.story-done .story-sticky { position: static; min-height: 0; padding: 72px 0; }
.story-scroll.story-done .tl-fill { transition: width .45s ease; }

/* ---------- hint under the card ---------- */
.tl-controls { position: relative; }
.tl-hint {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  white-space: nowrap; text-align: center;
  font-family: var(--display); font-size: .8rem; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase; color: var(--gold-soft);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  transition: opacity .5s ease;
  animation: tl-hint-glow 2.2s ease-in-out infinite;
}
.tl.hint-done .tl-hint { opacity: 0; pointer-events: none; animation: none; }
.tl-count { transition: opacity .5s ease; }
.tl:not(.hint-done) .tl-count { opacity: 0; }
@keyframes tl-hint-glow { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }

/* little mouse with a scrolling wheel */
.tl-mouse {
  position: relative; width: 16px; height: 25px; border: 2px solid currentColor; border-radius: 9px; flex: none;
}
.tl-mouse::after {
  content: ''; position: absolute; left: 50%; top: 4px; width: 2px; height: 5px; margin-left: -1px;
  background: currentColor; border-radius: 2px; animation: tl-wheel 1.6s ease-in-out infinite;
}
@keyframes tl-wheel { 0% { transform: translateY(0); opacity: 1; } 80% { transform: translateY(8px); opacity: 0; } 100% { opacity: 0; } }

/* tapping finger: a pulsing ring */
.tl-tap {
  position: relative; width: 14px; height: 14px; border-radius: 50%; background: currentColor; flex: none;
}
.tl-tap::after {
  content: ''; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid currentColor;
  animation: tl-ping 1.6s ease-out infinite;
}
@keyframes tl-ping { from { transform: scale(.5); opacity: 1; } to { transform: scale(1.4); opacity: 0; } }

/* next dot pulses until the visitor has used the timeline */
.tl:not(.hint-done) .tl-year[aria-selected="true"] + .tl-year::before {
  animation: tl-next 1.8s ease-in-out infinite;
}
@keyframes tl-next {
  0%, 100% { box-shadow: 0 0 0 0 rgba(233, 196, 106, 0); }
  50% { box-shadow: 0 0 0 6px rgba(233, 196, 106, .25); border-color: var(--gold-soft); }
}

/* ---------- play mode timer bar ---------- */
.tl-timer {
  position: absolute; left: 16px; right: 16px; top: 0; z-index: 2; height: 3px;
  border-radius: 3px; overflow: hidden; pointer-events: none; opacity: 0;
  grid-area: 1 / 1;
}
.tl-timer span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold-dark), var(--gold)); }
.tl.is-playing .tl-timer { opacity: 1; }
.tl.is-playing .tl-timer span { animation: tl-timer 6s linear forwards; }
@keyframes tl-timer { from { width: 0; } to { width: 100%; } }
.tl-stage { position: relative; }

@media (prefers-reduced-motion: reduce) {
  .tl-hint, .tl-mouse::after, .tl-tap::after, .tl-year::before { animation: none !important; }
}

/* ---------- gallery ---------- */
.gallery {
  display: grid; gap: 8px; margin-top: 30px;
  grid-template-columns: repeat(2, 1fr);
}
@media (min-width: 700px) { .gallery { grid-template-columns: repeat(4, 1fr); } }
.gallery figure { position: relative; overflow: hidden; border-radius: 10px; background: var(--purple-deep); }
.gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; transition: transform .4s ease; }
.gallery figure:hover img { transform: scale(1.04); }
.gallery figcaption {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 10px 8px;
  font-size: .8rem; color: #fff; font-weight: 600;
  background: linear-gradient(transparent, rgba(14, 8, 32, .85));
}
@media (min-width: 700px) {
  .gallery .wide { grid-column: span 2; }
  .gallery .wide img { aspect-ratio: 2 / 1; height: 100%; }
}
@media (prefers-reduced-motion: reduce) { .gallery img { transition: none; } html { scroll-behavior: auto; } }

/* ---------- next chapter (LCCC) ---------- */
.next {
  background:
    radial-gradient(ellipse at 80% 0%, rgba(245, 197, 24, .12), transparent 55%),
    linear-gradient(160deg, var(--purple-dark), var(--purple-deep));
  color: var(--on-dark);
}
.next .split { align-items: start; }
.lccc-card {
  background: #fff; color: var(--text); border-radius: 16px; padding: 22px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .35);
}
.lccc-card img.logo { max-width: 220px; margin: 0 auto 14px; }
.lccc-card dl { display: grid; gap: 10px; margin: 8px 0 18px; }
.lccc-card dt { font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 700; }
.lccc-card dd { font-weight: 600; }
.lccc-card .btn { display: block; text-align: center; }
.lccc-card .btn-gold { background: var(--purple); color: #fff; }
.lccc-card .btn-gold:hover { background: var(--purple-dark); }
.next-photos { display: grid; grid-template-columns: 1.5fr 1fr; gap: 10px; margin-top: 24px; }
.next-photos img { border-radius: 10px; width: 100%; height: 100%; object-fit: cover; max-height: 280px; }
.next p + p { margin-top: 12px; }
.quote {
  font-family: var(--display); font-weight: 600; font-size: 1.2rem; color: var(--gold-soft);
  border-left: 3px solid var(--gold-soft); padding-left: 16px; margin: 22px 0;
}

/* ---------- partners ---------- */
.partners { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.partners li {
  list-style: none; background: var(--card); border: 1px solid var(--border);
  border-radius: 999px; padding: 8px 16px; font-weight: 600; font-size: .93rem; color: var(--purple-dark);
}
.partners li.key { border-color: var(--gold); background: #fffbea; }

/* ---------- contact / footer ---------- */
.contact-grid { display: grid; gap: 16px; margin-top: 26px; }
@media (min-width: 700px) { .contact-grid { grid-template-columns: repeat(3, 1fr); } }
.contact-card {
  background: rgba(255, 255, 255, .04); border: 1px solid rgba(233, 196, 106, .22);
  border-radius: var(--radius); padding: 20px;
}
.contact-card h3 { font-size: 1rem; color: #fff; margin-bottom: 6px; }
.contact-card p { color: var(--on-dark-muted); font-size: .95rem; }
.contact-card a { word-break: break-word; }

.site-footer {
  background: var(--night); color: var(--on-dark-muted); font-size: .88rem;
  padding: 28px 0; border-top: 1px solid rgba(233, 196, 106, .15);
}
.site-footer .container { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }
.site-footer a { color: var(--on-dark-muted); }

/* ---------- legal page ---------- */
.legal { max-width: 760px; }
.legal h2 { font-size: 1.2rem; margin: 28px 0 8px; color: var(--purple-dark); }
.legal p + p { margin-top: 10px; }
