/*
 * Fluxer.Dad: one stylesheet for the home page (the full-screen Hampus) and the reading pages (legal, sitemap,
 * changelog, 404). Colours are Fluxer's official brand colours, from its press and brand kit (fluxer.com/press,
 * checked 28 November 2026): Fluxer Blue #4641D9, Deep indigo #3530B4, Soft indigo #C9C7FF, Light indigo #E3E2FF and
 * the dark #121035. Light follows the device; dark is the same palette turned around.
 */

:root {
  --fluxer-blue: #4641D9;
  --deep-indigo: #3530B4;
  --soft-indigo: #C9C7FF;
  --light-indigo: #E3E2FF;
  --midnight: #121035;

  --bg: var(--light-indigo);
  --stage: var(--soft-indigo);
  --ink: var(--midnight);
  --muted: rgba(18, 16, 53, 0.72);
  --accent: var(--fluxer-blue);
  --accent-strong: var(--deep-indigo);
  --card: #FFFFFF;
  --line: rgba(18, 16, 53, 0.16);
  --button: var(--light-indigo);
  --button-hover: #FFFFFF;
  --shadow: var(--midnight);
  --marquee: var(--fluxer-blue);
  --photo-shadow: var(--fluxer-blue);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: var(--midnight);
    --stage: var(--midnight);
    --ink: var(--light-indigo);
    --muted: rgba(227, 226, 255, 0.72);
    --accent: var(--soft-indigo);
    --accent-strong: var(--light-indigo);
    --card: #1B1950;
    --line: rgba(201, 199, 255, 0.2);
    --button: var(--fluxer-blue);
    --button-hover: var(--deep-indigo);
    --shadow: var(--soft-indigo);
    --marquee: var(--fluxer-blue);
    --photo-shadow: var(--deep-indigo);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Fluxer Sans", "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 18px;
  line-height: 1.55;
}

a { color: var(--accent); text-underline-offset: 0.15em; }
a:hover { color: var(--accent-strong); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.visually-hidden, .skip:not(:focus) {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.skip:focus { position: fixed; top: 8px; left: 8px; z-index: 100; background: var(--card); padding: 8px 12px; }

.dev-banner {
  background: var(--midnight); color: var(--light-indigo); text-align: center;
  font-size: 14px; padding: 6px 16px;
}
.dev-banner a { color: var(--soft-indigo); }

/* ---------- The home page: hampus hampus hampus ---------- */

body.home {
  background: var(--stage);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  cursor: grab;
  -webkit-tap-highlight-color: transparent;
}
body.home.holding { cursor: grabbing; }

.marquee {
  width: 100%;
  max-width: 100vw;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  color: var(--marquee);
  font-size: 32px;
  font-weight: 700;
  line-height: 1.3;
  flex: none;
}
.marquee-track { display: flex; width: max-content; animation: marquee-scroll 40s linear infinite; }
.marquee-right .marquee-track { animation-direction: reverse; }
.marquee-track span { display: block; padding-right: 0.5em; }
@keyframes marquee-scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }

.stage {
  flex: 1;
  width: 100%;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding-inline: 32px;
}

.pet-wrap { position: relative; margin-bottom: 12px; }

.pet {
  display: block;
  padding: 0;
  border: 0;
  background: none;
  cursor: inherit;
  border-radius: 12px;
}
/* Hampus, cut out of his photo: no frame, just a flat offset shadow in Fluxer Blue (Deep indigo in dark). The figure
   (the photo, plus his Santa hat and beard in December) moves as one, so the hat squishes and changes look with him. */
.hampus-fig {
  position: relative;
  display: block;
  pointer-events: none;
  transform-origin: 50% 100%;
  /* A look sets --look-t (its shape) and --look (its colour); a press squishes whatever shape it has. */
  transform: var(--look-t, scale(1));
  filter: var(--look, saturate(1)) drop-shadow(6px 6px 0 var(--photo-shadow));
  transition: transform 240ms cubic-bezier(0.34, 1.56, 0.64, 1), filter 200ms ease, opacity 200ms ease;
}
#hampus {
  display: block;
  width: auto;
  height: max(180px, 17vw);
  max-height: 42vh;
}
body.holding .hampus-fig {
  transform: var(--look-t, scale(1)) scale(0.84, 0.76);
  transition-duration: 80ms, 200ms, 200ms;
  transition-timing-function: ease-out, ease, ease;
}
/* December: a Santa hat and beard (our own drawings, views/home.php), placed in the photo's own 480 x 609 frame. */
.santa-hat, .santa-beard { position: absolute; display: block; }
.santa-hat { left: 22.917%; top: -32.841%; width: 79.167%; height: 52.545%; }
.santa-beard { left: 33.333%; top: 39.409%; width: 50%; height: 41.051%; }
body.santa .pet-wrap { margin-top: 8vh; }
body.santa .count { top: 22%; }

/* The looks (LOOKS in hampus.js cycles through them). Colours: */
body.look-blurple { --look: grayscale(1) sepia(1) hue-rotate(205deg) saturate(3.2) brightness(0.9); }
body.look-vintage { --look: sepia(0.85) contrast(1.05) brightness(1.05); }
body.look-noir { --look: grayscale(1) contrast(1.35); }
body.look-negative { --look: invert(1) hue-rotate(180deg); }
body.look-ghost .hampus-fig { opacity: 0.4; }
/* Shapes: */
body.look-mirror { --look-t: scaleX(-1); }
body.look-flipped { --look-t: rotate(180deg); }
body.look-tiny { --look-t: scale(0.45); }
body.look-giant { --look-t: scale(1.35); }
body.look-squashed { --look-t: scale(1.3, 0.6); }
body.look-stretched { --look-t: scale(0.65, 1.3); }
/* Moving (on the button around the photo, so a press still squishes; still for reduced motion, see the end): */
body.look-wobbly .pet { animation: wobble 900ms ease-in-out infinite alternate; transform-origin: 50% 100%; }
body.look-party .pet { animation: party 1.6s linear infinite; }
@keyframes wobble { from { transform: rotate(-9deg); } to { transform: rotate(9deg); } }
@keyframes party { from { filter: hue-rotate(0deg) saturate(1.6); } to { filter: hue-rotate(360deg) saturate(1.6); } }

.count {
  position: absolute;
  top: 4px;
  right: -34px;
  margin: 0;
  transform: rotate(-10deg);
  font-size: 22px;
  font-weight: 700;
}

.heading { margin: 0; font-size: max(32px, 4vw); line-height: 1.15; font-weight: 700; text-wrap: balance; }
.subtitle { margin: 6px 0 0; font-size: max(16px, 2vw); text-wrap: balance; }

@keyframes blink { 0%, 75% { opacity: 1; } 76%, 100% { opacity: 0; } }
.blink { animation: blink 500ms ease-in infinite alternate; }

.controls {
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 0 16px 6px;
  text-align: center;
  flex: none;
}
.buttons { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

.chunky {
  padding: 6px 12px;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  background: var(--button);
  border: 2px solid var(--ink);
  border-radius: 4px;
  box-shadow: 3px 3px 0 var(--shadow);
  cursor: pointer;
}
.chunky:hover { background: var(--button-hover); }
.chunky:active { box-shadow: 1px 1px 0 var(--shadow); transform: translate(2px, 2px); }
.chunky[hidden] { display: none; }

.home-links { margin: 0; font-size: 13px; line-height: 1.5; opacity: 0.8; }
.home-links a { color: inherit; }
.home-disclaimer { display: block; }

/* ---------- Reading pages ---------- */

.wrap { max-width: 860px; margin: 0 auto; padding: 0 16px; }

.top { display: flex; align-items: center; justify-content: space-between; padding: 20px 0; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-size: 24px; font-weight: 700; }
.brand img { border-radius: 8px; }
.brand b { color: var(--accent); }

.page-head { padding: 24px 0 8px; }
.page-head h1 { margin: 6px 0 4px; font-size: clamp(34px, 6vw, 52px); line-height: 1.1; letter-spacing: -0.01em; }
.lead { margin: 0; font-size: 20px; color: var(--muted); }
.crumb { font-size: 16px; }
.crumbs { font-size: 16px; display: flex; gap: 8px; flex-wrap: wrap; }

.card {
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 10px;
  box-shadow: 5px 5px 0 var(--shadow);
  padding: 8px 28px 24px;
  margin: 20px 0 32px;
}
.prose { overflow-wrap: anywhere; }
.prose h2 { font-size: 26px; line-height: 1.2; margin: 28px 0 8px; }
.prose h3 { margin: 18px 0 6px; }
.prose ul { padding-left: 22px; }
.prose li { margin: 4px 0; }
.prose code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 0.88em; background: var(--bg); padding: 1px 5px; border-radius: 4px; }
.prose table { width: 100%; border-collapse: collapse; font-size: 16px; margin: 12px 0; display: block; overflow-x: auto; }
.prose th, .prose td { text-align: left; vertical-align: top; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.updated { margin-top: 28px; font-size: 15px; color: var(--muted); }

.legal-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 20px 0; }
.legal-grid a {
  display: flex; flex-direction: column; gap: 4px;
  padding: 14px 16px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  text-decoration: none;
  box-shadow: 3px 3px 0 var(--shadow);
}
.legal-grid a:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--shadow); }
.legal-grid strong { color: var(--accent); font-size: 19px; }
.legal-grid span { font-size: 15px; color: var(--muted); }

/* Changelog badges: the house order and colours (Added, Changed, Fixed, Removed, Security, Deprecated). */
.prose h3 .cl-badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 14px; font-weight: 700; color: #fff; background: #8a8a94;
}
.prose h3 .cl-badge.cl-added { background: #2ecc71; }
.prose h3 .cl-badge.cl-changed { background: #3ba7ff; }
.prose h3 .cl-badge.cl-fixed { background: #ffa64d; }
.prose h3 .cl-badge.cl-removed { background: #ff4d4d; }
.prose h3 .cl-badge.cl-security { background: #b06bff; }
.prose h3 .cl-badge.cl-deprecated { background: #8a8a94; }

.big-hampus { display: block; width: auto; height: 170px; filter: drop-shadow(5px 5px 0 var(--photo-shadow)); margin: 20px 0 8px; }
.btns { display: flex; gap: 10px; flex-wrap: wrap; margin: 18px 0 8px; }
.btns .chunky { text-decoration: none; display: inline-block; }

.footer { border-top: 2px solid var(--line); padding: 20px 0 32px; font-size: 15px; color: var(--muted); }
.footer p { margin: 6px 0; }
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 18px; font-weight: 700; }
.footer-small { font-size: 13px; }

@media (max-width: 520px) {
  .card { padding: 4px 18px 20px; }
  .marquee { font-size: 26px; }
}

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