/* ==========================================================================
   boringandfunny — core stylesheet
   Tokens first, then layout, then components. One file, no build step.
   ========================================================================== */

:root {
  /* Palette. Cream base is fixed by the brand; the illustrations carry the
     colour, so the chrome stays quiet and uses one violet accent. */
  --cream:  #FBF6EC;
  --paper:  #FFFFFF;
  --ink:    #2A211C;
  --ink-60: #6B5D53;
  --dust:   #E6DCC8;
  --grape:  #4B37C9;
  --grape-dark: #3A2AA3;
  --sun:    #FFC93C;
  --lava:   #E2553D;

  /* Type */
  --display: "Bricolage Grotesque", "Trebuchet MS", system-ui, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* Scale — 1.25 ratio, clamped for fluid sizing */
  --t-xs:  0.8125rem;
  --t-sm:  0.9375rem;
  --t-md:  1.0625rem;
  --t-lg:  clamp(1.25rem, 1.1rem + 0.7vw, 1.5rem);
  --t-xl:  clamp(1.6rem, 1.3rem + 1.5vw, 2.25rem);
  --t-2xl: clamp(2.1rem, 1.5rem + 3vw, 3.6rem);

  /* Space */
  --s1: 0.25rem;
  --s2: 0.5rem;
  --s3: 0.75rem;
  --s4: 1rem;
  --s5: 1.5rem;
  --s6: 2rem;
  --s7: 3rem;
  --s8: 4.5rem;

  --radius: 18px;
  --radius-sm: 12px;
  --pill: 999px;
  --wrap: 1160px;
  --read: 64ch;

  /* The sticker shadow: a hard offset, never a soft grey blur. */
  --lift: 4px 4px 0 var(--ink);
  --lift-sm: 3px 3px 0 var(--ink);
}

/* --------------------------------------------------------------- reset -- */

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

/* The hidden attribute must win over any component display rule. Without
   this, .btn[hidden] and similar stay visible. */
[hidden] { display: none !important; }

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

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--body);
  font-size: var(--t-md);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img, video, svg, canvas { max-width: 100%; display: block; }
img, video { height: auto; }

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 0 0 var(--s3);
  text-wrap: balance;
}

h1 { font-size: var(--t-2xl); }
h2 { font-size: var(--t-xl); }
h3 { font-size: var(--t-lg); font-weight: 700; }

p { margin: 0 0 var(--s4); max-width: var(--read); }

a { color: var(--grape); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { color: var(--grape-dark); }

ul, ol { margin: 0 0 var(--s4); padding-left: 1.3em; max-width: var(--read); }
li { margin-bottom: var(--s2); }

/* Layout lists are structure, not prose: they must not inherit the reading cap
   or the list indent. */
.grid, .chips, .crumbs, .site-footer nav ul {
  max-width: none;
  padding-left: 0;
}

button { font: inherit; color: inherit; }

/* Keyboard focus must always be obvious. */
:focus-visible {
  outline: 3px solid var(--grape);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: var(--cream);
  padding: var(--s3) var(--s4);
  z-index: 100;
  border-radius: 0 0 var(--radius-sm) 0;
}
.skip:focus { left: 0; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* -------------------------------------------------------------- layout -- */

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--s4);
}

main { flex: 1 0 auto; }

.section { padding-block: var(--s7); }
.section--tight { padding-block: var(--s5); }

/* -------------------------------------------------------------- header -- */

.site-header {
  border-bottom: 2px solid var(--ink);
  background: var(--cream);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  min-height: 64px;
}

.wordmark {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.3rem;
  letter-spacing: -0.03em;
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: baseline;
}
.wordmark b { font-weight: 800; color: var(--grape); }
.wordmark:hover { color: var(--ink); }

/* -------------------------------------------------------------- button -- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  min-height: 48px;
  padding: var(--s3) var(--s5);
  border-radius: var(--pill);
  border: 2px solid var(--ink);
  background: var(--ink);
  color: var(--cream);
  font-family: var(--display);
  font-weight: 700;
  font-size: var(--t-sm);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: var(--lift-sm);
  transition: transform .12s ease, box-shadow .12s ease, background-color .12s ease;
}
.btn:hover { color: var(--cream); transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.btn:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--ink); }

.btn--sun { background: var(--sun); color: var(--ink); }
.btn--sun:hover { color: var(--ink); background: #ffd45f; }

.btn--ghost { background: transparent; color: var(--ink); box-shadow: none; }
.btn--ghost:hover { background: var(--paper); color: var(--ink); box-shadow: var(--lift-sm); }

.btn--big { min-height: 60px; padding: var(--s4) var(--s7); font-size: var(--t-lg); box-shadow: var(--lift); }

.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------------------------------------------------------------- hero -- */

.hero { padding-block: var(--s7) var(--s6); text-align: center; }
.hero h1 { margin-inline: auto; max-width: 16ch; }
.hero p {
  margin-inline: auto;
  max-width: 46ch;
  font-size: var(--t-lg);
  color: var(--ink-60);
  line-height: 1.45;
}
.hero__actions { margin-top: var(--s5); display: flex; gap: var(--s3); justify-content: center; flex-wrap: wrap; }

/* --------------------------------------------------------------- chips -- */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  padding: 0;
  margin: 0 0 var(--s5);
  list-style: none;
}
.chips li { margin: 0; }

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: var(--s2) var(--s4);
  border-radius: var(--pill);
  border: 2px solid var(--ink);
  background: transparent;
  font-family: var(--display);
  font-weight: 700;
  font-size: var(--t-sm);
  cursor: pointer;
  text-decoration: none;
  color: var(--ink);
}
.chip:hover { background: var(--paper); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--grape); border-color: var(--grape); color: #fff; }

/* ---------------------------------------------------------------- grid -- */

.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--s4);
  padding: 0;
  margin: 0;
  list-style: none;
}
.grid li { margin: 0; }

@media (min-width: 680px)  { .grid { grid-template-columns: repeat(3, 1fr); gap: var(--s5); } }
@media (min-width: 1000px) { .grid { grid-template-columns: repeat(4, 1fr); } }

/* ---------------------------------------------------------------- card -- */

.card {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--lift);
  transition: transform .14s ease, box-shadow .14s ease;
}
.card:hover, .card:focus-within { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--ink); }

.card__media {
  aspect-ratio: 1024 / 687;
  background: var(--dust);
  border-bottom: 2px solid var(--ink);
  overflow: hidden;
}
.card__media img { width: 100%; height: 100%; object-fit: cover; }

.card__body {
  padding: var(--s4);
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  flex: 1;
}

.card__title {
  font-family: var(--display);
  font-weight: 700;
  font-size: var(--t-md);
  line-height: 1.2;
  margin: 0;
}
.card__title a { color: var(--ink); text-decoration: none; }
.card__title a::after { content: ""; position: absolute; inset: 0; }
.card { position: relative; }
.card__title a:hover { color: var(--grape); }
.card__title { text-wrap: balance; }

.card__cta { margin-top: auto; align-self: flex-start; }

/* --------------------------------------------------------- breadcrumbs -- */

.crumbs {
  font-size: var(--t-sm);
  color: var(--ink-60);
  padding: var(--s4) 0 0;
  margin: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
}
.crumbs li { margin: 0; display: flex; gap: var(--s2); align-items: center; }
.crumbs li + li::before { content: "›"; color: var(--dust); }
.crumbs a { color: var(--ink-60); }

/* ------------------------------------------------------------ page/exp -- */

.exp-head { padding-block: var(--s5) var(--s4); }
.exp-head p { font-size: var(--t-lg); color: var(--ink-60); line-height: 1.45; }

/* The stage is where each experiment lives. */
.stage {
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--lift);
  padding: var(--s5);
  margin-bottom: var(--s6);
  min-height: 320px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: var(--s4);
  overflow: hidden;
}
.stage--flush { padding: 0; }
.stage--dark { background: #16120F; border-color: var(--ink); color: #F3ECE0; }

.exp-body { max-width: var(--read); }
.exp-body h2 { margin-top: var(--s6); }
.exp-body h2:first-child { margin-top: 0; }

/* ------------------------------------------------------------- results -- */

.result {
  font-family: var(--display);
  font-weight: 700;
  font-size: var(--t-xl);
  line-height: 1.25;
  max-width: 24ch;
  margin: 0;
  min-height: 2.4em;
  display: flex;
  align-items: center;
  justify-content: center;
  text-wrap: balance;
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  text-align: left;
  width: min(100%, 22rem);
}
.field label { font-family: var(--display); font-weight: 700; font-size: var(--t-sm); }
.field input {
  font: inherit;
  min-height: 48px;
  padding: var(--s2) var(--s4);
  border: 2px solid var(--ink);
  border-radius: var(--pill);
  background: var(--cream);
  color: var(--ink);
}

/* --------------------------------------------------------------- share -- */

.share {
  display: flex;
  align-items: center;
  gap: var(--s3);
  flex-wrap: wrap;
  padding: var(--s4) 0 var(--s6);
}
.share__note { font-size: var(--t-sm); color: var(--ink-60); margin: 0; }

/* ------------------------------------------------------------- related -- */

.related { border-top: 2px solid var(--ink); padding-top: var(--s6); }
.related .grid { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 680px) { .related .grid { grid-template-columns: repeat(4, 1fr); } }

/* ------------------------------------------------------------ ad slots -- */

/* Reserved space so enabling ads later does not shift the layout. */
.ad-slot { display: none; margin: var(--s6) auto; text-align: center; }
.ad-slot[data-ads="on"] { display: block; min-height: 90px; }

/* -------------------------------------------------------------- footer -- */

.site-footer {
  border-top: 2px solid var(--ink);
  background: var(--paper);
  padding-block: var(--s6);
  margin-top: var(--s7);
  font-size: var(--t-sm);
}
.site-footer__inner { display: flex; flex-wrap: wrap; gap: var(--s5); justify-content: space-between; }
.site-footer nav ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: var(--s4); }
.site-footer li { margin: 0; }
.site-footer a { color: var(--ink); }
.site-footer p { margin: 0; color: var(--ink-60); max-width: 40ch; }

.coffee {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  font-family: var(--display);
  font-weight: 700;
  color: var(--ink);
  text-decoration-color: var(--sun);
  text-decoration-thickness: 3px;
}

/* ----------------------------------------------------------------- 404 -- */

.notfound { text-align: center; padding-block: var(--s8) var(--s6); }
.notfound p { margin-inline: auto; }

/* --------------------------------------------------- reduced motion -- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .card:hover, .btn:hover { transform: none; }
}
