/* wheresrocko — shared stylesheet: design tokens + site chrome (nav, buttons,
   footer, 404). The home/hub layout layers on top in /home.css, the same way
   /play/play.css layers for the game.
   Design system ported from "Rocko's Creative Library": warm paper, Fredoka +
   Nunito, Rocko orange-red. Fonts are loaded via <link> in each page's <head>. */
:root {
  --paper:      #FBFAF7;   /* warm page background */
  --surface:    #FFFFFF;   /* cards */
  --card:       #FFFFFF;   /* alias kept for the hub layout */
  --surface-2:  #F2EFE9;   /* insets, pills */
  --ink:        #211E1A;
  --ink-soft:   #6C665E;
  --line:       #E8E3DA;
  --brand:      #F04E37;   /* Rocko orange-red */
  --brand-ink:  #B8351F;
  --accent:     #F04E37;   /* alias for any fallback */

  --radius: 18px;
  --shadow:      0 1px 2px rgba(30,22,14,.05), 0 8px 24px rgba(30,22,14,.06);
  --shadow-lift: 0 2px 6px rgba(30,22,14,.08), 0 14px 34px rgba(30,22,14,.12);
  --font-display: 'Fredoka', ui-rounded, 'Segoe UI', system-ui, sans-serif;
  --font-body:    'Nunito', ui-rounded, 'Segoe UI', system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper:     #16140F;
    --surface:   #201D17;
    --card:      #201D17;
    --surface-2: #2A2620;
    --ink:       #F3EEE5;
    --ink-soft:  #A7A096;
    --line:      #332E26;
    --brand:     #FF6A52;
    --brand-ink: #FF8873;
    --accent:    #FF6A52;
    --shadow:      0 1px 2px rgba(0,0,0,.30), 0 8px 24px rgba(0,0,0,.28);
    --shadow-lift: 0 2px 6px rgba(0,0,0,.40), 0 14px 34px rgba(0,0,0,.40);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font-body);
  font-weight: 600;
  color: var(--ink);
  /* Rocko's-World daylight scene — the shared site background. Games override it
     with their festive stage (body.rk-land), the Quiet Corner has its own chrome
     (it doesn't load this file), and /for-rocko keeps its golden scene inline. */
  background:
    linear-gradient(rgba(20,30,50,.12), rgba(20,30,50,.26)),
    url("/img/bg-daylight.webp?v=028b2eb");
  background-size: cover, cover;
  background-position: center bottom, center bottom;
  background-repeat: no-repeat, no-repeat;
  background-attachment: fixed, fixed;
  background-color: #6f93b8;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-ink); }
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; line-height: 1.08; letter-spacing: -.01em; margin: 0; }

/* ---------- brand mark (nav + footer) ---------- */
.brand {
  display: inline-flex; align-items: center; gap: .46em;
  font-family: var(--font-display); font-weight: 700; font-size: 1.18rem;
  color: var(--ink); text-decoration: none;
}
.brand::before {
  content: ""; width: 1.35em; height: 1.35em; flex: 0 0 auto;
  background: url("/logo.svg?v=028b2eb") center / contain no-repeat;
  filter: drop-shadow(0 3px 6px rgba(240,78,55,.28));
}

/* ---------- nav — cartoony + animated (for kids) ---------- */
.site-nav {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap;
  max-width: 1100px; margin: 0 auto;
  --scallop: 13px;
  padding: 10px 22px calc(12px + var(--scallop));
  /* FUN: a pale-rainbow candy bar with a scalloped party-banner bottom edge,
     centered logo + pills (same on every page, not OS-mode dependent) */
  background: linear-gradient(90deg, #FFE7EE 0%, #FFF4E1 18%, #E9FBEC 38%, #E2FAF4 56%, #E6F1FF 74%, #F1EAFF 89%, #FFE7F3 100%);
  -webkit-mask: radial-gradient(var(--scallop) at 50% 100%, #0000 98%, #000) 50% 100% / calc(2 * var(--scallop)) 100% repeat-x;
  mask: radial-gradient(var(--scallop) at 50% 100%, #0000 98%, #000) 50% 100% / calc(2 * var(--scallop)) 100% repeat-x;
  filter: drop-shadow(0 5px 8px rgba(20,40,80,.18));
}
/* the nav brand shows a bobbing Rocko instead of the map-pin */
.site-nav .brand::before { display: none; }
.site-nav .brand { font-size: 1.35rem; }
.brand-dog {
  width: 40px; height: 40px; object-fit: contain; flex: 0 0 auto;
  filter: drop-shadow(0 3px 5px rgba(0,0,0,.28));
  transform-origin: 70% 90%;
  animation: navbob 2.6s ease-in-out infinite, navglow 2.8s ease-in-out infinite;
}
.brand:hover .brand-dog { animation-duration: .5s; }
@keyframes navbob {
  0%, 100% { transform: translateY(0) rotate(-6deg); }
  30%      { transform: translateY(-4px) rotate(-6deg); }
  45%      { transform: translateY(-3px) rotate(9deg); }
  60%      { transform: translateY(-3px) rotate(-9deg); }
  75%      { transform: translateY(-3px) rotate(9deg); }
}
@keyframes navglow {
  0%, 100% { filter: drop-shadow(0 3px 5px rgba(0,0,0,.28)) drop-shadow(0 0 4px rgba(255,201,60,.25)); }
  50%      { filter: drop-shadow(0 3px 5px rgba(0,0,0,.28)) drop-shadow(0 0 12px rgba(255,201,60,.8)); }
}
.brand-accent { color: var(--brand); }
.site-nav .brand:hover .brand-text { transform: rotate(-1.5deg); }
.brand-text { display: inline-block; transition: transform .15s ease; }

/* chunky colorful pill links that pop + wiggle on hover */
.nav-links { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; justify-content: center; }
.nav-links a .nav-ico { width: 1.4em; height: 1.4em; object-fit: contain; vertical-align: -.4em; margin-right: 1px; }
.nav-links a {
  --nc: var(--brand);
  text-decoration: none; font-family: var(--font-display); font-weight: 600; font-size: .82rem;
  color: #fff; background: var(--nc); padding: 5px 11px; border-radius: 999px;
  border: 1.5px solid rgba(255,255,255,.55);
  box-shadow: 0 3px 0 rgba(0,0,0,.18);
  white-space: nowrap;
  transition: transform .13s cubic-bezier(.2,.85,.3,1.6), box-shadow .13s ease;
}
.nav-links a:hover, .nav-links a:focus-visible {
  transform: translateY(-2px) rotate(-3deg) scale(1.06);
  box-shadow: 0 6px 0 rgba(0,0,0,.2); outline: none;
}
.nav-links a:active { transform: translateY(1px) scale(.96); box-shadow: 0 2px 0 rgba(0,0,0,.2); }
/* grown-up section links (Quiet Corner + For Parents) — calmer, set a little apart */
.nav-links a.nav-grown { border-color: rgba(255,255,255,.32); box-shadow: 0 3px 0 rgba(0,0,0,.14); }
.nav-links a.nav-grown-start { margin-left: 12px; }
@media (max-width: 420px) { .nav-links a.nav-grown-start { margin-left: 0; } }
/* Home button — Rocko's doghouse graphic (instead of clicking the logo) */
/* the doghouse is the site's home button — a big round badge, top-left */
.site-nav .brand-home {
  flex: 0 0 auto; display: grid; place-items: center; padding: 0; line-height: 0;
  width: 70px; height: 70px; border-radius: 50%;
  background: radial-gradient(120% 120% at 50% 18%, #fff 0%, #FFE9A8 62%, #FFC93C 100%);
  border: 3px solid #fff;
  box-shadow: 0 7px 18px rgba(10,4,30,.45), inset 0 1px 0 rgba(255,255,255,.7);
  transition: transform .15s cubic-bezier(.2,.85,.3,1.6);
}
.brand-home img { height: 56px; width: 56px; object-fit: contain; display: block;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.28)); transition: transform .15s ease; }
.brand-home:hover, .brand-home:focus-visible { transform: rotate(-4deg) scale(1.06); outline: none; }
.brand-home:hover img, .brand-home:focus-visible img { transform: scale(1.04); }
@media (max-width: 420px) { .site-nav .brand-home { width: 56px; height: 56px; } .brand-home img { height: 46px; width: 46px; } }
.nav-links a.nav-home { background: none; border: 0; box-shadow: none; padding: 0; }
.nav-home img { height: 50px; width: auto; display: block; filter: drop-shadow(0 2px 5px rgba(0,0,0,.4)); }
@media (max-width: 420px) { .nav-home img { height: 42px; } }

@media (prefers-reduced-motion: reduce) {
  .brand-dog { animation: none; }
  .nav-links a, .brand-text { transition: none; }
}
@media (max-width: 420px) {
  .nav-links a { padding: 4px 9px; font-size: .76rem; }
  .site-nav { padding: 10px 12px; }
}

/* ---------- shared page layout ---------- */
main { max-width: 760px; margin: 0 auto; padding: 0 20px 64px; }

/* ---------- buttons ---------- */
/* Buttons — "paw pop": chunky gold pill with a springy arcade press.
   .btn        = standard action button ("the rest")
   .btn.play   = a dog-bone treat for the main Play / Let's-play buttons
   .btn.ghost  = quiet secondary */
.btn {
  display: inline-flex; align-items: center; gap: .5em;
  padding: 14px 26px; border-radius: 999px;
  font-family: var(--font-display); font-weight: 600; font-size: 1.05rem;
  background: #FFC93C; color: #241454; text-decoration: none; border: 0; cursor: pointer;
  box-shadow: 0 6px 0 #C98A12, 0 12px 22px rgba(201,138,18,.34);
  transition: transform .06s ease, box-shadow .06s ease, filter .1s ease;
}
.btn:hover { filter: brightness(1.04); }
.btn:active { transform: translateY(5px); box-shadow: 0 1px 0 #C98A12, 0 5px 12px rgba(201,138,18,.34); }

/* the main Play buttons — a dog-bone treat (best for short labels) */
.btn.play {
  background: #F7ECD9; color: #7A4A2B; padding: 13px 40px;
  border: 3px solid #E4CDA6; position: relative;
  box-shadow: 0 7px 16px rgba(0,0,0,.32);
  transition: transform .1s ease;
}
.btn.play::before, .btn.play::after {
  content: ""; position: absolute; top: 50%; width: 30px; height: 38px;
  background: #F7ECD9; border: 3px solid #E4CDA6; border-radius: 50%;
  transform: translateY(-50%); z-index: -1;
}
.btn.play::before { left: -15px; }
.btn.play::after  { right: -15px; }
.btn.play:hover  { transform: translateY(-2px); filter: none; }
.btn.play:active { transform: translateY(1px); box-shadow: 0 4px 12px rgba(0,0,0,.32); }

.btn.ghost {
  background: var(--surface); color: var(--ink);
  border: 1.5px solid var(--line); box-shadow: var(--shadow);
}
.btn.ghost:hover  { border-color: var(--brand); color: var(--brand-ink); filter: none; }
.btn.ghost:active { transform: translateY(2px); box-shadow: var(--shadow); }

.fine { color: var(--ink-soft); font-size: .9rem; font-weight: 700; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ---------- shared level-lock styling (see /progress.js) ----------
   Games add .locked / .done to a .level-card and a .level-badge glyph in the
   thumb; this styles them consistently everywhere. Uses the global --brand
   token (the find game may still carry local overrides in play.css). */
.level-thumb { position: relative; }
.level-badge {
  position: absolute; top: 8px; right: 8px; z-index: 2; width: 30px; height: 30px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 15px; line-height: 1; color: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.35);
}
.level-badge.lock  { background: rgba(13,16,32,.82); }
.level-badge.check { background: var(--brand); font-weight: 900; }
.level-card.locked { cursor: default; }
.level-card.locked .level-thumb img { filter: grayscale(1) brightness(.66); }
.level-card.locked:hover { transform: none; box-shadow: var(--shadow); }
.level-card.done { outline: 2px solid var(--brand); outline-offset: -2px; }
.level-card.nudge { animation: cardNudge .4s ease; }
@keyframes cardNudge { 0%,100% { transform: none; }
  20%,60% { transform: translateX(-6px); } 40%,80% { transform: translateX(6px); } }
.level-progress { grid-column: 1 / -1; text-align: center; color: var(--ink-soft);
  font-weight: 700; font-size: .9rem; }

/* The home / hub layout lives in /home.css (loaded on top, like /play/play.css). */

/* ---------- 404 ---------- */
.notfound { text-align: center; padding: 70px 0 40px; }
.notfound-art { width: 84px; height: 84px; margin-bottom: 10px;
  filter: drop-shadow(0 8px 16px rgba(240,78,55,.28)); }
.notfound h1 { font-size: clamp(1.9rem, 4vw, 2.7rem); margin: 0 0 .3em; }
.notfound p { color: var(--ink-soft); font-size: 1.1rem; font-weight: 700; margin: 0 0 1.5em; }

/* ---------- footer ---------- */
.site-foot { border-top: 1px solid var(--line); margin-top: 28px; background: var(--surface-2); }
.foot-inner {
  max-width: 1100px; margin: 0 auto; padding: 11px 16px;
  display: flex; align-items: center; justify-content: center; gap: 6px 16px; flex-wrap: wrap;
}
.foot-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; }
.foot-links a { text-decoration: none; color: var(--ink-soft); font-weight: 700; font-size: .85rem; white-space: nowrap; }
.foot-links a:hover { color: var(--brand-ink); }
.foot-copy { color: var(--ink-soft); font-size: .8rem; font-weight: 700; text-align: center; }

/* ---------- content / legal pages ---------- */
main.page { max-width: 760px; margin: 26px auto 48px; padding: 14px 30px 34px;
  /* the daylight scene is always light, so pin light-mode tokens here (dark text
     on the white reading card) regardless of the OS dark-mode preference */
  --ink: #1c2434; --ink-soft: #4b5563; --surface: #F4F7FB; --card: #fff; --line: #dbe3ec;
  color: #1c2434;
  background: rgba(255,255,255,.96); border: 1px solid rgba(255,255,255,.85);
  border-radius: 22px; box-shadow: 0 16px 40px rgba(20,60,90,.18); }
@media (max-width: 620px) { main.page { margin: 16px 12px 32px; padding: 10px 18px 26px; border-radius: 18px; } }
.page-head { padding: 20px 0 6px; }
.page-head h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin: 0 0 .18em; }
.page-head h1 .accent { color: var(--brand); }
.page-sub { color: var(--ink-soft); font-weight: 700; font-size: .95rem; }
.prose { color: var(--ink); font-weight: 600; }
.prose h2 { font-size: 1.35rem; margin: 1.7em 0 .5em; }
.prose h3 { font-size: 1.06rem; margin: 1.2em 0 .35em; }
.prose p { margin: 0 0 1em; max-width: 68ch; }
.prose ul { margin: 0 0 1em; padding-left: 1.3em; max-width: 66ch; }
.prose li { margin: .3em 0; }
.prose a { color: var(--brand-ink); }
.prose strong { color: var(--ink); }
.prose .tldr {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 20px; margin: 0 0 20px; box-shadow: var(--shadow);
}
.prose .tldr h2 { margin-top: 0; }
.draft-note {
  background: color-mix(in srgb, var(--brand) 10%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--brand) 32%, var(--line));
  border-radius: 12px; padding: 12px 16px; margin: 6px 0 22px;
  color: var(--ink); font-weight: 700; font-size: .9rem; line-height: 1.5;
}
.draft-note b { color: var(--brand-ink); }

/* ============================================================= *
 *  DANCE TO THE MUSIC                                            *
 *  music-dance.js sets --beat (0..1) on <html> and body.rk-dancing
 *  while any <audio> is playing, so Rocko & friends bounce along. *
 * ============================================================= */
@media (prefers-reduced-motion: no-preference) {
  /* the hero star does the big dance */
  body.rk-dancing .hub-hero-art {
    animation: none !important;
    /* sit a touch lower + gentler bounce so he never hits the string lights */
    transform: translateY(calc(10px - var(--beat, 0) * 14px))
               scale(calc(.95 + var(--beat, 0) * .05))
               rotate(calc((var(--beat, 0) - .45) * 10deg));
    transition: transform .06s linear;
  }
  /* the home doghouse badge bops on every screen where music plays */
  body.rk-dancing .brand-home {
    transform: translateY(calc(var(--beat, 0) * -4px))
               scale(calc(1 + var(--beat, 0) * .13))
               rotate(calc((var(--beat, 0) - .5) * 10deg));
  }
  /* the album cover pulses to the beat (the cover keeps its own "playing" slide) */
  body.rk-dancing .art { transition: transform .06s linear; transform: scale(calc(1 + var(--beat, 0) * .06)); }
}
