/* 7bananas ✨ maximum sparkle. Shared by every page. */
:root {
  --ink: #2a0845;          /* deep grape: all text, outlines and sticker shadows */
  --pink: #ff2da6;
  --orange: #ff8a00;
  --yellow: #ffe600;
  --lime: #a6ff00;
  --cyan: #00d4ff;
  --purple: #8b2cff;
  --bubblegum: #ffd6f0;
  --paper: #ffffff;
  --rainbow: linear-gradient(100deg, var(--pink), var(--orange), var(--yellow), var(--lime), var(--cyan), var(--purple), var(--pink));
  --font-display: "Titan One", "Fredoka", system-ui, sans-serif;
  --font-body: "Fredoka", system-ui, sans-serif;
  --font-code: "JetBrains Mono", ui-monospace, monospace;
  --measure: 68ch;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  font: 400 1.0625rem/1.65 var(--font-body);
  background-color: #ff8fd1;
  /* glitter: three layers of tiny stars over a rainbow wash */
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cg fill='%23ffffff'%3E%3Cpath d='M20 12l2 6 6 2-6 2-2 6-2-6-6-2 6-2z'/%3E%3Cpath d='M98 40l1.5 4.5 4.5 1.5-4.5 1.5-1.5 4.5-1.5-4.5-4.5-1.5 4.5-1.5z'/%3E%3Cpath d='M60 104l2.5 7.5 7.5 2.5-7.5 2.5-2.5 7.5-2.5-7.5-7.5-2.5 7.5-2.5z'/%3E%3Ccircle cx='124' cy='112' r='2'/%3E%3Ccircle cx='44' cy='64' r='1.5'/%3E%3Ccircle cx='132' cy='8' r='1.5'/%3E%3C/g%3E%3C/svg%3E"),
    radial-gradient(circle at 20% 15%, rgba(255,255,255,0.55) 0 1.5px, transparent 2px),
    radial-gradient(circle at 70% 60%, rgba(255,255,255,0.45) 0 1px, transparent 1.5px),
    linear-gradient(135deg, #ff5fc1 0%, #ffa94d 18%, #fff04d 34%, #b8ff4d 50%, #4de8ff 66%, #a45dff 84%, #ff5fc1 100%);
  background-size: 140px 140px, 23px 23px, 37px 37px, 160% 160%;
  background-attachment: fixed;
  animation: rainbow-drift 40s ease-in-out infinite alternate;
}
@keyframes rainbow-drift { to { background-position: 140px 280px, 0 0, 0 0, 100% 100%; } }

a { color: var(--purple); font-weight: 600; text-decoration-thickness: 2px; text-underline-offset: 0.2em; }
a:hover { color: var(--pink); }
a:focus-visible, .button:focus-visible { outline: 4px solid var(--ink); outline-offset: 3px; border-radius: 8px; }
img, svg { display: block; max-width: 100%; }

/* Unfilled values. Search the files for "$" to find every one. */
.var {
  font-family: var(--font-code); font-size: 0.82em; font-weight: 600; color: #b0006e;
  background: var(--bubblegum); border: 1.5px dashed var(--pink);
  padding: 0.02em 0.4em; border-radius: 6px; white-space: nowrap;
}

.wrap { width: 100%; max-width: 1120px; margin-inline: auto; padding-inline: 16px; }
@media (min-width: 760px) { .wrap { padding-inline: 32px; } }

/* ── Header ─────────────────────────────────────────── */
.site-header {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  padding-block: 0.65rem;
  background: rgba(255, 255, 255, 0.72);
  -webkit-backdrop-filter: blur(12px) saturate(1.5); backdrop-filter: blur(12px) saturate(1.5);
  border-bottom: 3px solid var(--ink);
  box-shadow: 0 4px 0 rgba(42, 8, 69, 0.18);
}
/* paints the phone status-bar band above the sticky header (zero height elsewhere) */
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 21; background: #fff; }
/* keep jump-link targets clear of the header */
html { scroll-padding-top: 6.5rem; }

.site-header .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem 1.5rem; }
.brand { display: flex; align-items: center; gap: 0.5rem; text-decoration: none; color: var(--ink); }
.brand img { width: 52px; height: auto; filter: drop-shadow(0 3px 0 var(--ink)); }
.brand span { font: 400 1.75rem/1 var(--font-display); color: #fff; -webkit-text-stroke: 1.5px var(--ink); paint-order: stroke fill; text-shadow: 0 3px 0 var(--ink); }
.site-nav ul { display: flex; flex-wrap: wrap; gap: 0.5rem; list-style: none; margin: 0; padding: 0; }
.site-nav a {
  display: block; padding: 0.35rem 0.85rem; border-radius: 999px; text-decoration: none;
  color: var(--ink); background: #fff; border: 2.5px solid var(--ink); box-shadow: 0 3px 0 var(--ink);
  font-weight: 600; font-size: 0.95rem;
}
.site-nav li:nth-child(6n+1) a:hover, .site-nav li:nth-child(6n+1) a[aria-current="page"] { background: var(--pink); color: #fff; }
.site-nav li:nth-child(6n+2) a:hover, .site-nav li:nth-child(6n+2) a[aria-current="page"] { background: var(--orange); }
.site-nav li:nth-child(6n+3) a:hover, .site-nav li:nth-child(6n+3) a[aria-current="page"] { background: var(--yellow); }
.site-nav li:nth-child(6n+4) a:hover, .site-nav li:nth-child(6n+4) a[aria-current="page"] { background: var(--lime); }
.site-nav li:nth-child(6n+5) a:hover, .site-nav li:nth-child(6n+5) a[aria-current="page"] { background: var(--cyan); }
.site-nav li:nth-child(6n+6) a:hover, .site-nav li:nth-child(6n+6) a[aria-current="page"] { background: var(--purple); color: #fff; }

@media (max-width: 640px) {
  html { scroll-padding-top: 7.5rem; }
  .site-header { padding-block: 0.5rem; }
  .brand img { width: 44px; }
  .brand span { font-size: 1.4rem; }
  .site-nav { width: 100%; min-width: 0; }
  .site-nav ul { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 5px; scrollbar-width: none; }
  .site-nav ul::-webkit-scrollbar { display: none; }
  .site-nav li { flex: none; }
  .site-nav ul { gap: 0.35rem; }
  .site-nav a { font-size: 0.82rem; padding: 0.25rem 0.55rem; border-width: 2px; box-shadow: 0 2px 0 var(--ink); }
}

/* ── Type ───────────────────────────────────────────── */
h1, h2, h3 { margin: 0; line-height: 1.12; }
h2 { font: 400 clamp(1.7rem, 3.6vw, 2.4rem)/1.1 var(--font-display); margin-top: 2.5rem; }
h3 { font: 600 1.3rem/1.25 var(--font-body); margin-top: 1.9rem; }
.panel > h2:first-child, .panel > header > h2:first-child { margin-top: 0; }
p, ul, ol, table, pre, dl { margin: 0.85rem 0 0; }
.prose { max-width: var(--measure); }
.prose li + li { margin-top: 0.3rem; }
.muted { color: #6a4a86; }

/* Rainbow glitter title text. The one big animated moment on each page. */
.glitter-title {
  font: 400 clamp(2.8rem, 9vw, 6.5rem)/0.95 var(--font-display);
  background: var(--rainbow); background-size: 300% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  -webkit-text-stroke: 2px var(--ink);
  filter: drop-shadow(0 6px 0 var(--ink)) drop-shadow(0 0 18px rgba(255,255,255,0.9));
  animation: shimmer 6s linear infinite;
}
@keyframes shimmer { to { background-position: 300% 0; } }

/* ── Sticker panels: white so text stays readable on the rainbow ── */
.panel {
  position: relative; margin-top: 2rem; padding: clamp(1.25rem, 3vw, 2.25rem);
  border: 6px solid transparent; border-radius: 30px;
  background: linear-gradient(#fff, #fff) padding-box, var(--rainbow) border-box;
  box-shadow: 9px 9px 0 var(--ink);
}
.panel.plain { background: linear-gradient(#fff, #fff) padding-box, linear-gradient(var(--ink), var(--ink)) border-box; }

/* ── Buttons ────────────────────────────────────────── */
.actions { display: flex; flex-wrap: wrap; gap: 0.85rem; margin-top: 1.6rem; }
.button {
  display: inline-block; padding: 0.75rem 1.3rem; border-radius: 999px; text-decoration: none;
  font: 400 1.1rem/1 var(--font-display); color: var(--ink); border: 3px solid var(--ink);
  box-shadow: 0 5px 0 var(--ink); transition: transform 0.12s, box-shadow 0.12s;
}
.button:hover { color: var(--ink); transform: translateY(2px); box-shadow: 0 3px 0 var(--ink); }
.button:active { transform: translateY(5px); box-shadow: 0 0 0 var(--ink); }
.button.hot { background: var(--pink); color: #fff; }
.button.hot:hover { color: #fff; }
.button.sun { background: var(--yellow); }

/* ── Hero ───────────────────────────────────────────── */
.hero { display: grid; gap: 1.5rem; align-items: center; padding-block: 1.5rem 1rem; }
@media (min-width: 880px) { .hero { grid-template-columns: 1.15fr 1fr; } }
.hero-art { position: relative; max-width: 460px; justify-self: center; }
.hero-art img { width: 100%; filter: drop-shadow(0 0 28px #fff); }

/* ── Model card ─────────────────────────────────────── */
.model-card { display: grid; gap: 1.5rem; }
.model-card > *, .hero > * { min-width: 0; } /* let wide tables scroll instead of stretching the page */
@media (min-width: 880px) { .model-card { grid-template-columns: 300px 1fr; align-items: start; } }
.portrait {
  border: 4px solid var(--ink); border-radius: 24px; padding: 1rem;
  background: radial-gradient(circle at 50% 40%, #fff 30%, var(--bubblegum) 70%, #e9d5ff);
  box-shadow: 6px 6px 0 var(--ink); text-align: center;
}
.portrait .id { font-family: var(--font-code); font-size: 0.9rem; word-break: break-all; margin-top: 0.5rem; }
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; list-style: none; padding: 0; margin: 0; }
.chips li { border: 2px solid var(--ink); border-radius: 999px; padding: 0.05rem 0.65rem; font-size: 0.92rem; background: #fff; }

/* ── Tables ─────────────────────────────────────────── */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.97rem; }
th, td { text-align: left; vertical-align: top; padding: 0.6rem 0.85rem; border-bottom: 2px dotted #e3c6f5; }
thead th { background: var(--ink); color: #fff; font-weight: 600; }
thead th:first-child { border-top-left-radius: 14px; }
thead th:last-child { border-top-right-radius: 14px; }
tbody th { font-weight: 600; white-space: nowrap; }
tbody tr:nth-child(even) { background: #fff5fb; }
.spec tbody th { width: 34%; white-space: normal; }

/* ── Code ───────────────────────────────────────────── */
code { font-family: var(--font-code); font-size: 0.86em; background: #f6ecff; padding: 0.06em 0.32em; border-radius: 5px; overflow-wrap: anywhere; }
pre {
  background: var(--ink); color: #fdf4ff; border-radius: 18px; padding: 1.1rem 1.25rem; overflow-x: auto;
  font: 0.85rem/1.6 var(--font-code); border: 3px solid var(--ink); box-shadow: inset 0 0 0 2px var(--purple);
}
td code { overflow-wrap: normal; white-space: nowrap; } /* tables already scroll sideways */
pre code { background: none; padding: 0; font-size: inherit; color: inherit; }
pre .var { background: rgba(255, 45, 166, 0.22); color: #ffb8e6; border-color: #ff8fd1; font-size: 1em; }
pre .c { color: #c7a8ff; }  /* comments */
pre .s { color: var(--lime); } /* strings */

/* ── Callout ────────────────────────────────────────── */
.callout { border: 3px solid var(--ink); border-radius: 20px; padding: 1rem 1.25rem; background: #fffbe0; margin-top: 1.25rem; box-shadow: 4px 4px 0 var(--ink); }
.callout > :first-child { margin-top: 0; }

/* Legal pages: "the short version" summaries */
.short { margin-top: 0.6rem; padding: 0.5rem 0.9rem; border-left: 6px solid var(--pink); background: #fff0f8; border-radius: 0 12px 12px 0; }

/* ── In-page contents ───────────────────────────────── */
.toc { columns: 2 14rem; column-gap: 2rem; padding-left: 1.2rem; }

/* ── Footer ─────────────────────────────────────────── */
.site-footer { margin-top: 4rem; padding-block: 2.25rem; background: var(--ink); color: #fff; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 1.25rem 2rem; justify-content: space-between; align-items: center; }
.site-footer a { color: #fff; }
.site-footer a:hover { color: var(--yellow); }
.site-footer ul { display: flex; flex-wrap: wrap; gap: 0.4rem 1.25rem; list-style: none; padding: 0; margin: 0; }
.site-footer .var { background: rgba(255,255,255,0.12); color: #ffb8e6; border-color: #ff8fd1; }

main { padding-bottom: 1rem; }
.page-title { padding-block: 1rem 0.5rem; }
.page-title p { margin-top: 1rem; display: inline-block; background: #fff; border: 3px solid var(--ink); border-radius: 16px; padding: 0.45rem 0.9rem; box-shadow: 4px 4px 0 var(--ink); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
