/* Endless Horse — golden edition. Vanilla CSS, no frameworks. */
:root {
  --gold-1: #fff3b0;
  --gold-2: #ffd94d;
  --gold-3: #e6a817;
  --gold-4: #9c6b0e;
  --ink: #2b1d05;
  --cream: #fffdf4;
  --sky-top: #ffe9c9;
  --sky-mid: #ffd9a0;
  --sky-low: #ffc98a;
  --card: rgba(255, 253, 244, 0.88);
  --shadow: 0 10px 30px rgba(156, 107, 14, 0.18);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 45%, var(--sky-low) 100%);
  background-attachment: fixed;
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}
h1, h2, h3, .display { font-family: 'Fredoka', 'Baloo 2', sans-serif; font-weight: 700; line-height: 1.15; }

/* ---------- header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 60;
  background: rgba(255, 253, 244, 0.82);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 2px solid rgba(230, 168, 23, 0.25);
}
.nav-inner { max-width: 1080px; margin: 0 auto; padding: 0.7rem 1.2rem; display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; color: var(--ink); font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 1.25rem; }
.brand .horse-emoji { font-size: 1.6rem; filter: sepia(0.6) saturate(3) hue-rotate(-10deg); }
.brand em { color: var(--gold-4); font-style: normal; }
.nav-links { display: flex; gap: 1.1rem; list-style: none; }
.nav-links a { text-decoration: none; color: var(--ink); font-weight: 600; font-size: 0.95rem; padding: 0.35rem 0.7rem; border-radius: 999px; transition: background 0.2s; }
.nav-links a:hover, .nav-links a.active { background: rgba(230, 168, 23, 0.18); }
@media (max-width: 640px) { .nav-links { gap: 0.4rem; } .nav-links a { font-size: 0.8rem; padding: 0.3rem 0.5rem; } }

/* ---------- layout ---------- */
.wrap { max-width: 1080px; margin: 0 auto; padding: 2.5rem 1.2rem; }
.hero { text-align: center; padding: 3.5rem 1.2rem 2rem; position: relative; }
.hero .kicker { display: inline-block; background: var(--ink); color: var(--gold-1); font-weight: 700; font-size: 0.8rem; letter-spacing: 0.12em; text-transform: uppercase; padding: 0.4rem 1rem; border-radius: 999px; margin-bottom: 1rem; }
.hero h1 { font-size: clamp(2.4rem, 6vw, 4.2rem); margin-bottom: 0.6rem; }
.hero h1 .gold { background: linear-gradient(100deg, var(--gold-4), var(--gold-2) 40%, var(--gold-1) 55%, var(--gold-2) 70%, var(--gold-4)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lead { font-size: 1.15rem; max-width: 640px; margin: 0 auto 1.6rem; }
.btn { display: inline-block; font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 1.05rem; text-decoration: none; color: #fff; background: linear-gradient(135deg, var(--gold-3), var(--gold-4)); padding: 0.85rem 2rem; border-radius: 999px; box-shadow: var(--shadow); border: none; cursor: pointer; transition: transform 0.15s, box-shadow 0.15s; }
.btn:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(156, 107, 14, 0.28); }
.btn.ghost { background: transparent; color: var(--ink); border: 2px solid var(--gold-3); box-shadow: none; }
.btn-row { display: flex; gap: 0.8rem; justify-content: center; flex-wrap: wrap; }

/* ---------- cards / content ---------- */
.card { background: var(--card); border-radius: 1.4rem; padding: 1.8rem; box-shadow: var(--shadow); border: 1px solid rgba(230, 168, 23, 0.3); margin-bottom: 1.4rem; }
.card h2 { font-size: 1.7rem; margin-bottom: 0.7rem; }
.card h3 { font-size: 1.25rem; margin: 1.1rem 0 0.4rem; }
.card p, .card li { margin-bottom: 0.7rem; }
.card ul, .card ol { padding-left: 1.4rem; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.2rem; }
table.trail { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: 0.95rem; }
table.trail th, table.trail td { text-align: left; padding: 0.65rem 0.8rem; border-bottom: 1px solid rgba(156, 107, 14, 0.2); }
table.trail th { font-family: 'Fredoka', sans-serif; background: rgba(230, 168, 23, 0.14); }
table.trail tr.grand td { background: rgba(230, 168, 23, 0.1); font-weight: 700; }
.faq details { background: var(--card); border: 1px solid rgba(230, 168, 23, 0.3); border-radius: 1rem; padding: 1rem 1.3rem; margin-bottom: 0.8rem; box-shadow: var(--shadow); }
.faq summary { font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 1.05rem; cursor: pointer; }
.faq details p { margin-top: 0.6rem; }
.steps { counter-reset: step; list-style: none; padding: 0; }
.steps li { position: relative; padding: 1.2rem 1.2rem 1.2rem 4rem; background: var(--card); border-radius: 1.2rem; margin-bottom: 1rem; box-shadow: var(--shadow); border: 1px solid rgba(230, 168, 23, 0.3); }
.steps li::before { counter-increment: step; content: counter(step); position: absolute; left: 1.1rem; top: 1.1rem; width: 2.2rem; height: 2.2rem; border-radius: 50%; background: linear-gradient(135deg, var(--gold-2), var(--gold-4)); color: #fff; font-family: 'Fredoka', sans-serif; font-weight: 700; display: flex; align-items: center; justify-content: center; }

/* ---------- game ---------- */
#game { position: relative; }
.horse-stage { position: relative; height: 100vh; height: 100svh; overflow: visible; z-index: 5; }
#horseSvg { overflow: visible; }
#horseSvg { display: block; width: min(92vw, 560px); margin: 0 auto; }
.stage-caption { position: absolute; bottom: 1rem; left: 0; right: 0; text-align: center; font-size: 0.85rem; opacity: 0.75; pointer-events: none; }

/* HUD */
.hud { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 70; display: flex; align-items: center; gap: 0.7rem; background: rgba(43, 29, 5, 0.88); color: var(--gold-1); border-radius: 999px; padding: 0.55rem 1.1rem; box-shadow: 0 8px 24px rgba(0,0,0,0.25); backdrop-filter: blur(8px); font-family: 'Fredoka', sans-serif; max-width: 94vw; flex-wrap: wrap; justify-content: center; }
.hud .count { font-size: 1.15rem; font-weight: 700; white-space: nowrap; }
.hud .count small { font-family: 'Inter', sans-serif; font-weight: 400; font-size: 0.7rem; opacity: 0.8; display: block; line-height: 1; }
.hud .best { font-size: 0.8rem; opacity: 0.85; white-space: nowrap; }
.hud button { background: rgba(255, 243, 176, 0.15); color: var(--gold-1); border: 1px solid rgba(255, 243, 176, 0.35); border-radius: 999px; padding: 0.35rem 0.8rem; font-family: 'Fredoka', sans-serif; font-size: 0.85rem; cursor: pointer; transition: background 0.2s; }
.hud button:hover { background: rgba(255, 243, 176, 0.3); }
.progress { width: 110px; height: 8px; background: rgba(255,243,176,0.2); border-radius: 999px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, var(--gold-2), var(--gold-1)); border-radius: 999px; transition: width 0.3s; }
@media (max-width: 640px) { .hud { top: 58px; gap: 0.45rem; padding: 0.45rem 0.8rem; } .hud .count { font-size: 0.95rem; } .progress { width: 70px; } }

/* track sections */
#track { position: relative; z-index: 1; }
.track-section { position: relative; height: 120vh; border-top: 2px dashed rgba(156, 107, 14, 0.25); overflow: hidden; }
.track-section.alt { background: rgba(255, 255, 255, 0.12); }
.signpost { position: absolute; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--gold-1); font-family: 'Fredoka', sans-serif; font-weight: 700; padding: 0.7rem 1.6rem; border-radius: 1rem; border: 3px solid var(--gold-3); box-shadow: var(--shadow); text-align: center; white-space: nowrap; }
.signpost.grand { background: linear-gradient(135deg, var(--gold-3), var(--gold-4)); color: #fff; font-size: 1.2rem; }
.cloud { position: absolute; background: #fff; border-radius: 999px; opacity: 0.75; filter: blur(2px); animation: drift linear infinite; }
.cloud::before, .cloud::after { content: ''; position: absolute; background: #fff; border-radius: 50%; }
@keyframes drift { from { transform: translateX(-15vw); } to { transform: translateX(115vw); } }
.grass { position: absolute; bottom: 0; left: 0; right: 0; height: 70px; background: linear-gradient(180deg, #8fce62, #5da33c); border-top: 4px solid #4c8a30; }
.bird { position: absolute; font-size: 1.4rem; animation: drift linear infinite; }

/* milestone overlay */
#milestoneOverlay { position: fixed; inset: 0; z-index: 90; display: none; align-items: center; justify-content: center; background: rgba(43, 29, 5, 0.45); backdrop-filter: blur(3px); }
#milestoneOverlay.show { display: flex; }
.milestone-card { background: var(--cream); border-radius: 1.6rem; padding: 2.2rem 2.6rem; text-align: center; max-width: 90vw; box-shadow: 0 24px 60px rgba(0,0,0,0.35); border: 3px solid var(--gold-3); animation: pop 0.45s cubic-bezier(0.2, 1.4, 0.4, 1); }
@keyframes pop { from { transform: scale(0.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.milestone-card h2 { font-size: 2rem; margin-bottom: 0.4rem; }
.milestone-card .mnum { font-size: 3rem; }
.milestone-card p { margin-bottom: 1.2rem; }
#confettiCanvas { position: fixed; inset: 0; z-index: 95; pointer-events: none; }

/* challenge banner */
#challengeBanner { display: none; position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); z-index: 70; background: var(--ink); color: var(--gold-1); border-radius: 1rem; padding: 0.9rem 1.4rem; font-family: 'Fredoka', sans-serif; box-shadow: var(--shadow); border: 2px solid var(--gold-3); max-width: 92vw; text-align: center; }
#challengeBanner.show { display: block; }
#challengeBanner button { margin-left: 0.8rem; }

/* footer */
.site-footer { background: var(--ink); color: #f5e9c8; margin-top: 3rem; }
.footer-inner { max-width: 1080px; margin: 0 auto; padding: 2.5rem 1.2rem 1.5rem; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.5rem; }
.site-footer h3 { color: var(--gold-2); font-size: 1.05rem; margin-bottom: 0.6rem; }
.site-footer a { color: #f5e9c8; text-decoration: none; opacity: 0.85; }
.site-footer a:hover { opacity: 1; text-decoration: underline; }
.site-footer ul { list-style: none; }
.site-footer li { margin-bottom: 0.35rem; font-size: 0.92rem; }
.footer-base { text-align: center; padding: 1.2rem; font-size: 0.85rem; opacity: 0.7; border-top: 1px solid rgba(255,243,176,0.15); }

/* blog */
.post-list { display: grid; gap: 1.2rem; }
.post-card { display: block; text-decoration: none; color: inherit; }
.post-card:hover { transform: translateY(-3px); transition: transform 0.2s; }
.post-meta { font-size: 0.85rem; opacity: 0.7; margin-bottom: 0.4rem; }
article.post p { margin-bottom: 1rem; }
article.post h2 { margin: 1.6rem 0 0.6rem; font-size: 1.5rem; }

/* shimmer on golden headings */
.shimmer { background: linear-gradient(100deg, var(--gold-4), var(--gold-2) 35%, #fffbe0 50%, var(--gold-2) 65%, var(--gold-4)); background-size: 200% auto; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shine 4s linear infinite; }
@keyframes shine { to { background-position: 200% center; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .cloud, .bird, .shimmer { animation: none !important; }
  .milestone-card { animation: none; }
}
