/* ===========================================================
   Shared design system — used by index.html, trailmap.html,
   tictactoe.html. Each page may override the CSS variables in
   :root via a small <style> block in its own <head> to get its
   own accent color while keeping the same layout components.
   =========================================================== */

:root, html[data-theme="dark"]{
  --bg:         #0F172A;
  --surface:    #1E293B;
  --surface-2:  #263449;
  --primary:    #10B981;
  --primary-btn:#0D9668;
  --secondary:  #38BDF8;
  --text-hi:    #F8FAFC;
  --text-lo:    #94A3B8;
  --border:     #334155;
  --icon-on-primary:#0F172A;
  --difficulty-easy:#34D399;
  --difficulty-medium:#FBBF24;
  --difficulty-hard:#F87171;
  --difficulty-expert:#A78BFA;
}
html[data-theme="light"]{
  --bg:         #F8FAFC;
  --surface:    #FFFFFF;
  --surface-2:  #EEF2F6;
  --primary:    #059669;
  --primary-btn:#047857;
  --secondary:  #0284C7;
  --text-hi:    #0F172A;
  --text-lo:    #64748B;
  --border:     #E2E8F0;
  --icon-on-primary:#FFFFFF;
  --difficulty-easy:#10B981;
  --difficulty-medium:#D97706;
  --difficulty-hard:#DC2626;
  --difficulty-expert:#8B5CF6;
}

*{ box-sizing:border-box; }
html{ scroll-behavior:smooth; }

body{
  margin:0;
  background:var(--bg);
  color:var(--text-hi);
  font-family:"Inter", -apple-system, sans-serif;
  line-height:1.6;
  -webkit-font-smoothing:antialiased;
  transition:background .2s ease, color .2s ease;
}

a{ color:inherit; }
img,svg{ display:block; max-width:100%; }
::selection{ background:var(--primary); color:var(--icon-on-primary); }
:focus-visible{ outline:2px solid var(--primary); outline-offset:3px; }

.wrap{ max-width:1080px; margin:0 auto; padding:0 clamp(20px, 5vw, 56px); }

.eyebrow{
  font-family:"IBM Plex Mono", monospace;
  font-size:0.72rem;
  letter-spacing:0.14em;
  text-transform:uppercase;
  color:var(--primary);
}

h1,h2,h3{
  font-family:"Space Grotesk", "Inter", sans-serif;
  font-weight:700;
  letter-spacing:-0.01em;
  margin:0;
}

/* ---------- nav ---------- */
header.site{
  position:sticky; top:0; z-index:20;
  background:color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter:blur(8px);
  border-bottom:1px solid var(--border);
}
.nav{
  display:flex; align-items:center; justify-content:space-between;
  padding:16px clamp(20px, 5vw, 56px);
  gap:20px;
}
.nav-left{ display:flex; align-items:center; gap:16px; }
.nav-home{
  display:flex; align-items:center; gap:6px;
  text-decoration:none; color:var(--text-lo);
  font-size:0.85rem; font-weight:500;
  border-right:1px solid var(--border);
  padding-right:16px;
}
.nav-home:hover, .nav-home:focus-visible{ color:var(--primary); }
.nav-home svg{ width:15px; height:15px; }
.nav-brand{
  display:flex; align-items:center; gap:9px;
  font-family:"Space Grotesk", sans-serif; font-weight:700;
  font-size:1.15rem; text-decoration:none; color:var(--text-hi);
}
.nav-brand .mark{ color:var(--primary); }
.nav-links{
  display:flex; align-items:center; gap:26px;
  font-size:0.9rem; font-weight:500;
  list-style:none; margin:0; padding:0;
}
.nav-links a{ text-decoration:none; color:var(--text-lo); transition:color .15s ease; }
.nav-links a:hover, .nav-links a:focus-visible{ color:var(--primary); }
@media (max-width:760px){ .nav-links li.hide-mobile{ display:none; } }

.lang-chip{
  font-family:"IBM Plex Mono", monospace;
  font-size:0.72rem; letter-spacing:0.04em;
  color:var(--text-lo);
  border:1px solid var(--border);
  border-radius:20px;
  padding:5px 12px;
}

.theme-toggle{
  display:flex; align-items:center; gap:6px;
  background:var(--surface-2);
  border:1px solid var(--border);
  border-radius:20px;
  padding:5px 6px;
  cursor:pointer;
  color:var(--text-lo);
  font-family:"IBM Plex Mono", monospace;
  font-size:0.72rem;
}
.theme-toggle svg{ width:16px; height:16px; }
.theme-toggle .dot{
  width:22px; height:22px; border-radius:50%;
  background:var(--primary);
  display:flex; align-items:center; justify-content:center;
  color:var(--icon-on-primary);
  transition:transform .2s ease;
}

/* ---------- notice bar ---------- */
.notice-bar{
  background:var(--surface-2);
  border-bottom:1px solid var(--border);
  padding:10px clamp(20px, 5vw, 56px);
}
.notice-bar .wrap{
  display:flex; align-items:center; gap:10px;
  font-size:0.85rem; color:var(--text-lo);
}
.notice-bar svg{ width:16px; height:16px; flex-shrink:0; color:var(--difficulty-medium); }
.notice-bar strong{ color:var(--text-hi); font-weight:600; }

/* ---------- hero ---------- */
.hero{
  position:relative; overflow:hidden;
  padding:clamp(64px,10vw,120px) 0 clamp(48px,8vw,84px);
  border-bottom:1px solid var(--border);
}
.hero-inner{ position:relative; z-index:2; max-width:700px; }
.hero h1{
  font-size:clamp(2.6rem, 7vw, 4.4rem);
  line-height:1.04;
  margin:18px 0 22px;
}
.hero h1 span{ color:var(--primary); }
.hero p.lede{
  font-size:1.15rem; color:var(--text-lo);
  max-width:48ch; margin:0 0 34px;
}
.hero-actions{ display:flex; gap:14px; flex-wrap:wrap; }

.btn{
  display:inline-flex; align-items:center; gap:9px;
  font-family:"Inter", sans-serif; font-weight:600; font-size:0.92rem;
  text-decoration:none; padding:13px 22px; border-radius:8px;
  border:1px solid transparent;
  transition:transform .15s ease, background .15s ease, border-color .15s ease;
}
.btn:hover{ transform:translateY(-1px); }
.btn-primary{ background:var(--primary-btn); color:#FFFFFF; }
.btn-primary:hover{ filter:brightness(1.08); }
.btn-ghost{ border-color:var(--border); color:var(--text-hi); background:transparent; }
.btn-ghost:hover{ border-color:var(--primary); color:var(--primary); }
.btn-disabled{ pointer-events:none; opacity:0.5; cursor:not-allowed; }

.hero-tags{ display:flex; gap:10px; flex-wrap:wrap; margin-top:30px; }
.tag{
  font-family:"IBM Plex Mono", monospace; font-size:0.72rem;
  color:var(--text-lo); border:1px solid var(--border);
  border-radius:6px; padding:5px 10px;
}

/* ---------- divider motif ---------- */
.gpx-divider{ position:relative; width:100%; line-height:0; background:var(--bg); }
.gpx-divider svg{ width:100%; height:auto; display:block; }
.gpx-divider .fill{ fill:var(--surface); }
.gpx-divider .line{ fill:none; stroke:var(--primary); stroke-width:2; }
.gpx-label{
  position:absolute; font-family:"IBM Plex Mono", monospace;
  font-size:0.62rem; letter-spacing:0.08em; color:var(--text-lo);
  text-transform:uppercase;
}
.gpx-label.left{ left:clamp(20px,5vw,56px); top:10px; }
.gpx-label.right{ right:clamp(20px,5vw,56px); bottom:10px; }

/* ---------- features ---------- */
.features{ background:var(--surface); padding:clamp(56px,9vw,96px) 0; }
.section-head{ max-width:560px; margin-bottom:44px; }
.section-head h2{ font-size:clamp(1.7rem,4vw,2.3rem); margin-top:10px; }
.section-head p{ color:var(--text-lo); margin:14px 0 0; }

.feature-grid{
  display:grid; grid-template-columns:repeat(3,1fr); gap:1px;
  background:var(--border); border:1px solid var(--border); border-radius:10px;
  overflow:hidden;
}
@media (max-width:820px){ .feature-grid{ grid-template-columns:repeat(2,1fr); } }
@media (max-width:560px){ .feature-grid{ grid-template-columns:1fr; } }

.feature{ background:var(--surface); padding:30px 26px; }
.feature .icon{
  width:38px; height:38px; border-radius:9px;
  background:var(--surface-2); display:flex; align-items:center; justify-content:center;
  color:var(--primary); margin-bottom:16px;
}
.feature .icon svg{ width:19px; height:19px; }
.feature h3{ font-size:1.05rem; margin:0 0 8px; }
.feature p{ color:var(--text-lo); margin:0; font-size:0.92rem; }

.also-row{ margin-top:24px; display:flex; gap:10px; flex-wrap:wrap; }

/* ---------- showcase (gif / screenshot demos) ---------- */
.showcase{ background:var(--bg); padding:clamp(56px,9vw,96px) 0; }
.showcase-grid{ display:grid; grid-template-columns:repeat(3,1fr); gap:20px; }
@media (max-width:820px){ .showcase-grid{ grid-template-columns:1fr; } }

.showcase-card{
  background:var(--surface); border:1px solid var(--border); border-radius:12px;
  padding:14px; display:flex; flex-direction:column; gap:14px;
  box-shadow:0 20px 44px -30px rgba(0,0,0,0.5);
}
.showcase-card .frame{
  background:var(--surface-2); border-radius:8px; overflow:hidden;
}
.showcase-card .frame img{ width:100%; height:100%; object-fit:contain; display:block; }
.showcase-card .caption{ padding:0 6px 6px; }
.showcase-card .caption h3{ font-size:0.98rem; margin:0 0 4px; }
.showcase-card .caption p{ color:var(--text-lo); font-size:0.85rem; margin:0; }

/* screenshot pair (light/dark side by side) used on app pages with fewer, wider shots */
.shot-pair{ display:grid; grid-template-columns:1fr 1fr; gap:16px; }
@media (max-width:640px){ .shot-pair{ grid-template-columns:1fr; } }
.shot-pair figure{ margin:0; }
.shot-pair img{
  width:100%; border-radius:10px; border:1px solid var(--border);
  background:var(--surface-2);
}
.shot-pair figcaption{
  margin-top:8px; font-family:"IBM Plex Mono", monospace; font-size:0.7rem;
  color:var(--text-lo); text-transform:uppercase; letter-spacing:0.05em;
}

/* callout card, e.g. for a game's unique twist/mechanic */
.twist-card{
  background:var(--surface); border:1px solid var(--border); border-radius:12px;
  padding:28px 30px; display:flex; gap:20px; align-items:flex-start;
}
.twist-card .icon{
  width:42px; height:42px; border-radius:10px; flex-shrink:0;
  background:var(--surface-2); display:flex; align-items:center; justify-content:center;
  color:var(--primary);
}
.twist-card .icon svg{ width:22px; height:22px; }
.twist-card h3{ font-size:1.1rem; margin:0 0 8px; }
.twist-card p{ color:var(--text-lo); margin:0; font-size:0.95rem; }

/* ---------- preview (svg / route demo) ---------- */
.preview{ padding:clamp(56px,9vw,96px) 0; background:var(--bg); }
.preview-grid{ display:grid; grid-template-columns:1.05fr 0.95fr; gap:40px; align-items:center; }
@media (max-width:820px){ .preview-grid{ grid-template-columns:1fr; } }

.map-card{
  background:var(--surface); border:1px solid var(--border); border-radius:12px;
  padding:16px; box-shadow:0 30px 60px -34px rgba(0,0,0,0.5);
}
.map-card .frame{ background:var(--surface-2); border-radius:8px; overflow:hidden; position:relative; }
.map-card svg, .map-card img{ width:100%; height:auto; display:block; }
.map-caption{
  font-family:"IBM Plex Mono", monospace; font-size:0.7rem; color:var(--text-lo);
  margin-top:14px; display:flex; justify-content:space-between; flex-wrap:wrap; gap:6px;
}

.difficulty-legend{ display:flex; gap:12px; margin-top:14px; flex-wrap:wrap; }
.difficulty-legend span{
  display:flex; align-items:center; gap:6px;
  font-family:"IBM Plex Mono", monospace; font-size:0.68rem; color:var(--text-lo);
}
.difficulty-legend i{ width:9px; height:9px; border-radius:50%; display:inline-block; }

.preview-copy h2{ font-size:clamp(1.7rem,4vw,2.3rem); margin-bottom:16px; }
.preview-copy p{ color:var(--text-lo); margin:0 0 16px; }
.stat-row{ display:flex; gap:30px; margin-top:26px; flex-wrap:wrap; }
.stat{ font-family:"IBM Plex Mono", monospace; }
.stat b{ display:block; font-size:1.5rem; color:var(--text-hi); font-family:"Space Grotesk",sans-serif; }
.stat span{ font-size:0.7rem; color:var(--text-lo); text-transform:uppercase; letter-spacing:0.05em; }

.route-anim{ animation:draw 4.5s ease-in-out infinite; }
@keyframes draw{
  0%   { stroke-dashoffset:520; }
  55%  { stroke-dashoffset:0; }
  100% { stroke-dashoffset:0; }
}
@media (prefers-reduced-motion: reduce){ .route-anim{ animation:none; stroke-dashoffset:0; } }

/* ---------- download ---------- */
.download{
  background:var(--surface); padding:clamp(56px,9vw,96px) 0;
  border-top:1px solid var(--border); border-bottom:1px solid var(--border);
}
.platform-grid{ display:grid; grid-template-columns:repeat(3,1fr); gap:16px; }
@media (max-width:760px){ .platform-grid{ grid-template-columns:1fr; } }

.platform-card{
  background:var(--bg); border:1px solid var(--border); border-radius:10px;
  padding:26px 24px; display:flex; flex-direction:column; gap:14px;
  transition:border-color .15s ease;
}
.platform-card:hover{ border-color:var(--primary); }
.platform-card .os{
  display:flex; align-items:center; gap:11px;
  font-family:"Space Grotesk", sans-serif; font-weight:700; font-size:1.05rem;
}
.platform-card .os svg{ width:22px; height:22px; flex-shrink:0; color:var(--primary); }
.platform-card p{ color:var(--text-lo); font-size:0.88rem; margin:0; }
.platform-card .btn{ justify-content:center; margin-top:auto; }

.release-note{
  margin-top:28px; font-family:"IBM Plex Mono", monospace; font-size:0.78rem;
  color:var(--text-lo); display:flex; gap:8px; align-items:baseline; flex-wrap:wrap;
}
.release-note code{ background:var(--bg); padding:2px 8px; border-radius:5px; color:var(--text-hi); }
.release-note a{ color:var(--primary); text-decoration:none; }
.release-note a:hover{ text-decoration:underline; }

/* ---------- footer ---------- */
footer{ background:var(--bg); padding:40px 0; }
.footer-row{
  display:flex; justify-content:space-between; align-items:center;
  flex-wrap:wrap; gap:14px;
  font-family:"IBM Plex Mono", monospace; font-size:0.75rem; color:var(--text-lo);
}
.footer-row a{ text-decoration:none; color:var(--text-lo); }
.footer-row a:hover{ color:var(--primary); }

/* ---------- hub (index.html — app picker) ---------- */
.hub-hero{
  padding:clamp(64px,10vw,120px) 0 clamp(40px,7vw,64px);
  border-bottom:1px solid var(--border);
}
.hub-hero h1{ font-size:clamp(2.4rem, 6vw, 3.6rem); line-height:1.05; margin:16px 0 14px; }
.hub-hero p{ color:var(--text-lo); font-size:1.1rem; max-width:56ch; margin:0; }

.app-section{ padding:clamp(48px,8vw,80px) 0; }
.app-grid{ display:grid; grid-template-columns:1fr 1fr; gap:22px; }
@media (max-width:760px){ .app-grid{ grid-template-columns:1fr; } }

.app-card{
  display:flex; flex-direction:column;
  background:var(--surface); border:1px solid var(--border); border-radius:14px;
  overflow:hidden; text-decoration:none; color:var(--text-hi);
  transition:transform .15s ease, border-color .15s ease;
}
.app-card:hover{ transform:translateY(-3px); border-color:var(--app-accent, var(--primary)); }
.app-card .media{
  aspect-ratio:16/9; background:var(--surface-2);
  display:flex; align-items:center; justify-content:center;
  overflow:hidden; position:relative;
}
.app-card .media img{ width:100%; height:100%; object-fit:cover; }
.app-card .media .glyph{
  font-family:"Space Grotesk", sans-serif; font-weight:700; font-size:3rem;
  color:var(--app-accent, var(--primary));
}
.app-card .body{ padding:24px 26px 28px; display:flex; flex-direction:column; gap:12px; flex:1; }
.app-card .body .kicker{
  font-family:"IBM Plex Mono", monospace; font-size:0.68rem; letter-spacing:0.1em;
  text-transform:uppercase; color:var(--app-accent, var(--primary));
}
.app-card .body h2{ font-size:1.4rem; }
.app-card .body p{ color:var(--text-lo); font-size:0.95rem; margin:0; flex:1; }
.app-card .body .tags{ display:flex; gap:8px; flex-wrap:wrap; margin-top:4px; }
.app-card .body .open{
  margin-top:10px; display:inline-flex; align-items:center; gap:6px;
  font-weight:600; font-size:0.9rem; color:var(--app-accent, var(--primary));
}
.app-card .body .open svg{ width:15px; height:15px; transition:transform .15s ease; }
.app-card:hover .body .open svg{ transform:translateX(3px); }

/* ---------- social links (hub page) ---------- */
.social-section{
  padding:0 0 clamp(56px,9vw,96px);
}
.social-section .section-head{ margin-bottom:26px; }
.social-row{ display:flex; gap:14px; flex-wrap:wrap; }
.social-card{
  display:inline-flex; align-items:center; gap:12px;
  background:var(--surface); border:1px solid var(--border); border-radius:10px;
  padding:14px 20px; text-decoration:none; color:var(--text-hi);
  transition:border-color .15s ease, transform .15s ease;
}
.social-card:hover{ border-color:var(--primary); transform:translateY(-2px); }
.social-card .icon{
  width:34px; height:34px; border-radius:8px;
  background:var(--surface-2); display:flex; align-items:center; justify-content:center;
  color:var(--primary); flex-shrink:0;
}
.social-card .icon svg{ width:18px; height:18px; }
.social-card .label{ display:flex; flex-direction:column; gap:1px; }
.social-card .label b{ font-size:0.92rem; font-weight:600; }
.social-card .label span{ font-size:0.78rem; color:var(--text-lo); }

@media (prefers-reduced-motion: reduce){
  html{ scroll-behavior:auto; }
  .btn, .theme-toggle .dot, .app-card, .app-card .body .open svg, .social-card{ transition:none; }
}

