/* Free tools pages: the Bob Knowhow meme maker (/tools/bob-knowhow) and the tools page (/tools). Scoped to body.bob-page. Plan: docs/plan-bob-meme-maker.md */

/* Comic fonts, self-hosted (SIL Open Font License 1.1: fine to embed in the pictures people export). */
@font-face { font-family: "Bangers"; src: url("/fonts/bangers.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Comic Neue"; src: url("/fonts/comic-neue-700.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Comic Neue"; src: url("/fonts/comic-neue-700-italic.woff2") format("woff2"); font-weight: 700; font-style: italic; font-display: swap; }
@font-face { font-family: "Patrick Hand"; src: url("/fonts/patrick-hand.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }

.bob-page {
  --room: #0E1A33;      /* Bob's wall */
  --room-2: #16254A;
  --glow: #8FC1FF;      /* his laptop's light */
  --bubble: #FFFDF7;
  --pen: #121826;
  --comic: "Bangers", Impact, "Arial Narrow", sans-serif;
  background: var(--room);
}
/* The site's header in its dark theme, the same values as the home page (home-dark.css) and the shared header's
   theme="dark" (src/shared-header.js): ink glass, paper links, the wordmark's bars light. The light bar would show as grey on navy. */
body.bob-page .masthead { background: rgba(14, 23, 38, .88); box-shadow: 0 1px 0 rgba(246, 243, 238, .08); }
body.bob-page .wordmark { color: var(--paper); }
body.bob-page .wordmark__mark rect[fill="#0E1726"] { fill: var(--paper); }
body.bob-page .nav__link, body.bob-page .nav-toggle { color: var(--paper); }
body.bob-page .nav .btn { --bg: var(--amber); --fg: var(--ink); }
body.bob-page .nav .btn::before { background: var(--paper); }
@media (max-width: 1000px) {
  body.bob-page .nav { background: var(--ink); border-bottom-color: var(--line-dark); }
  body.bob-page .masthead.is-open { background: var(--ink); }
  body.bob-page .nav__link { border-bottom-color: var(--line-dark); }
}
.bob-page .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.bob {
  color: #E6ECF7;
  padding: clamp(1.75rem, 4vw, 3.5rem) 0 clamp(3rem, 7vw, 6rem);
  /* halftone dots, the comic printer's grain, fading out down the page */
  background:
    radial-gradient(circle at 70% 18%, rgba(143, 193, 255, .16), transparent 42rem),
    radial-gradient(rgba(143, 193, 255, .09) 1.2px, transparent 1.6px) 0 0 / 14px 14px,
    var(--room);
}

/* ---------- Heading ---------- */
.bob__head { max-width: 46rem; margin-bottom: clamp(1.5rem, 3.5vw, 2.5rem); }
.bob__title {
  font-family: var(--comic); font-weight: 400; letter-spacing: .015em; line-height: .92;
  font-size: clamp(3.2rem, 9vw, 7rem); color: var(--bubble);
  text-shadow: .045em .055em 0 var(--amber), .09em .11em 0 var(--pen);
  transform: rotate(-2deg); transform-origin: 0 100%;
}
.bob__lede { margin-top: 1.1rem; max-width: 38rem; font-size: clamp(1.02rem, .98rem + .3vw, 1.18rem); color: #C9D4E8; }

/* ---------- Tool layout ---------- */
.bob__tool { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(19rem, 1fr); gap: clamp(1.5rem, 3vw, 2.75rem); align-items: start; }
/* The picture and Bob's introduction stay in view together beside the controls. */
.bob__side { position: sticky; top: 5.5rem; }
.bob__intro {
  position: relative; margin: clamp(1.75rem, 3vw, 2.5rem) 0 0 .5rem; max-width: 40rem; padding: 1rem 1.25rem 1.1rem;
  background: var(--bubble); color: var(--pen); border: 3px solid var(--pen); border-radius: 18px;
  box-shadow: 6px 7px 0 var(--amber), 6px 7px 0 2px var(--pen); transform: rotate(.6deg);
}
/* A tail pointing up at Bob: it's his own words. */
.bob__intro::before {
  content: ""; position: absolute; top: -14px; left: 2.5rem; width: 22px; height: 22px; background: var(--bubble);
  border-left: 3px solid var(--pen); border-top: 3px solid var(--pen); transform: rotate(45deg);
}
.bob__intro-text { font-family: "Comic Neue", "Comic Sans MS", system-ui, sans-serif; font-weight: 700; font-size: clamp(1rem, .95rem + .25vw, 1.12rem); line-height: 1.45; }
.bob__panel {
  position: relative; border: 6px solid var(--bubble); border-radius: 6px; background: var(--pen);
  box-shadow: 12px 14px 0 var(--amber), 12px 14px 0 3px var(--pen), 0 30px 80px -20px rgba(143, 193, 255, .45);
  transform: rotate(-1deg);
}
.bob__canvas { display: block; width: 100%; height: auto; aspect-ratio: 2472 / 1964; }

/* The one entrance: the panel is stamped onto the page. The bubble pops in on the canvas (public/js/bob.js). */
/* Hidden until the script stamps it in; shown anyway after 2.5 s if the script never runs. */
@media (scripting: enabled) { .bob:not(.is-ready) .bob__panel { animation: bob-show 0s 2.5s both; } }
@keyframes bob-show { from { opacity: 0; } to { opacity: 1; } }
.bob.is-ready .bob__panel { animation: bob-stamp .55s var(--ease-out) both; }
@keyframes bob-stamp {
  0% { opacity: 0; transform: translateY(18px) rotate(-4deg) scale(1.04); }
  70% { opacity: 1; transform: rotate(-.6deg) scale(.995); }
  100% { opacity: 1; transform: rotate(-1deg) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .bob.is-ready .bob__panel { animation: none; opacity: 1; }
  .bob__title { transform: none; }
}

/* ---------- The script sheet (controls) ---------- */
.bob__sheet {
  background: var(--bubble); color: var(--pen); border: 3px solid var(--pen); border-radius: 18px;
  padding: clamp(1.1rem, 2.4vw, 1.6rem); box-shadow: 8px 9px 0 var(--pen);
  display: grid; gap: 1.15rem;
}
.bob__field { display: grid; gap: .45rem; }
.bob__label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.bob__label { font-family: var(--comic); font-size: 1.35rem; letter-spacing: .03em; line-height: 1.1; color: var(--pen); padding: 0; }
.bob__count { font-size: .85rem; color: #4A5468; font-variant-numeric: tabular-nums; }
.is-tight .bob__count { color: #B42318; }
.bob__text {
  width: 100%; resize: vertical; min-height: 6.2rem;
  font: 700 1.1rem/1.4 "Comic Neue", "Comic Sans MS", system-ui, sans-serif; /* 16px or more: phones don't zoom in on focus */
  color: var(--pen); background: #fff; border: 2.5px solid var(--pen); border-radius: 12px; padding: .75rem .85rem;
}
.bob__text:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
.bob__hint { font-size: .88rem; color: #3D4659; line-height: 1.45; }
.bob__hint kbd { font-family: inherit; font-weight: 700; background: #FFF1D6; border: 1px solid #E8C98B; border-radius: 5px; padding: 0 .3em; white-space: nowrap; }
.bob__filter { font-size: .88rem; font-weight: 600; color: #8A5300; }

.bob__group { border: 0; padding: 0; margin: 0; min-width: 0; display: grid; gap: .5rem; }
.bob__pair { display: flex; flex-wrap: wrap; gap: 1.15rem 1.6rem; }
.bob__chips { display: flex; flex-wrap: wrap; gap: .45rem; }

.bob-chip { position: relative; cursor: pointer; }
.bob-chip input, .bob-swatch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.bob-chip span {
  display: inline-flex; align-items: center; min-height: 2.6rem; padding: .35rem .95rem;
  border: 2px solid var(--pen); border-radius: 999px; background: #fff; font-weight: 600; font-size: .95rem;
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), background-color .18s;
}
.bob-chip input:checked + span { background: var(--amber); box-shadow: 3px 3px 0 var(--pen); transform: translate(-1px, -1px); }
.bob-chip input:focus-visible + span { outline: 3px solid var(--glow); outline-offset: 2px; }
.bob-chip--comic span { font-family: "Comic Neue", "Comic Sans MS", sans-serif; font-weight: 700; }
.bob-chip--poster span { font-family: var(--comic); font-weight: 400; font-size: 1.08rem; letter-spacing: .04em; }
.bob-chip--hand span { font-family: "Patrick Hand", "Bradley Hand", sans-serif; font-weight: 400; font-size: 1.1rem; }

.bob-swatch { position: relative; display: inline-block; width: 2.6rem; height: 2.6rem; border-radius: 50%; border: 2px solid var(--pen); cursor: pointer; transition: transform .18s var(--ease), box-shadow .18s; }
.bob-swatch--ink { background: #121826; }
.bob-swatch--navy { background: #1E3A8A; }
.bob-swatch--red { background: #B42318; }
.bob-swatch--green { background: #17643A; }
.bob-swatch--purple { background: #6B2BB5; }
.bob-swatch:has(input:checked) { box-shadow: 0 0 0 3px var(--bubble), 0 0 0 6px var(--amber); transform: scale(1.06); }
.bob-swatch:has(input:focus-visible) { outline: 3px solid var(--glow); outline-offset: 6px; }

.bob__actions { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; padding-top: .2rem; }
.bob__download { font-size: 1.05rem; box-shadow: 4px 5px 0 var(--amber); }
.bob__idea {
  font: inherit; font-weight: 600; color: var(--pen); background: none; border: 0; cursor: pointer; padding: .6rem .2rem;
  text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; text-decoration-color: var(--amber);
}
.bob__idea:hover { text-decoration-color: var(--pen); }
.bob__status { min-height: 1.4em; font-size: .92rem; font-weight: 600; color: #17643A; }
.bob__status:empty { display: none; }
.bob__small { font-size: .84rem; line-height: 1.5; color: #4A5468; }

/* ---------- Save dialog (phones whose browser can't download or share a file) ---------- */
.bob__dialog { width: min(92vw, 44rem); border: 3px solid var(--pen); border-radius: 16px; padding: 1rem; background: var(--bubble); color: var(--pen); }
.bob__dialog::backdrop { background: rgba(8, 14, 30, .78); }
.bob__dialog[open] { display: grid; gap: .9rem; justify-items: center; }
.bob__dialog-title { font-weight: 700; text-align: center; }
.bob__dialog-img { width: 100%; height: auto; border-radius: 6px; }

/* ---------- After the tool ---------- */
.bob__more { margin-top: clamp(3rem, 6vw, 4.5rem); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem 2rem; padding-top: 1.75rem; border-top: 2px dashed rgba(143, 193, 255, .3); }
.bob__more p { max-width: 36rem; color: #C9D4E8; }

/* ---------- Narrow screens: 1 plain column that scrolls normally ---------- */
/* Kringle, 1 Nov 2026: "We don't need to split page of Bob say it." On phones nothing is sticky or fixed and nothing is
   sized to the screen height, so the keyboard can't leave Bob covering the text box: picture, then controls, then intro. */
@media (max-width: 900px) {
  .bob__tool { grid-template-columns: 1fr; }
  .bob__side { position: static; display: contents; }
  .bob__sheet { order: 1; }
  .bob__intro { order: 2; margin: 1.5rem 0 0; }
  .bob__intro::before { display: none; } /* Bob is far above here, so no tail */
  .bob__panel { border-width: 4px; box-shadow: 6px 7px 0 var(--amber), 6px 7px 0 2px var(--pen); transform: rotate(-.6deg); }
  @keyframes bob-stamp { 0% { opacity: 0; transform: translateY(12px) rotate(-3deg); } 100% { opacity: 1; transform: rotate(-.6deg); } }
  .bob__head { margin-bottom: 1.25rem; }
}
/* A short desktop window: the picture and the introduction scroll with the page instead of hiding the introduction. */
@media (min-width: 901px) and (max-height: 760px) { .bob__side { position: static; } }

/* ---------- Free tools page (/tools): 1 card per tool ---------- */
.tools__list { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr)); gap: clamp(1.25rem, 3vw, 2rem); }
.tool-card__link {
  display: grid; height: 100%; text-decoration: none; color: var(--pen); background: var(--bubble);
  border: 3px solid var(--pen); border-radius: 18px; overflow: hidden; box-shadow: 8px 9px 0 var(--amber);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.tool-card__link:hover, .tool-card__link:focus-visible { transform: translate(-2px, -2px) rotate(-.4deg); box-shadow: 11px 12px 0 var(--amber); }
.tool-card__link:focus-visible { outline: 3px solid var(--glow); outline-offset: 4px; }
.tool-card__img { width: 100%; height: auto; aspect-ratio: 2472 / 1964; object-fit: cover; border-bottom: 3px solid var(--pen); }
.tool-card__body { display: grid; gap: .5rem; padding: 1.1rem 1.25rem 1.3rem; }
.tool-card__name { font-family: var(--comic); font-size: 1.7rem; letter-spacing: .02em; line-height: 1.05; }
.tool-card__text { color: #3D4659; }
.tool-card__go { font-weight: 700; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; text-decoration-color: var(--amber); }
@media (prefers-reduced-motion: reduce) { .tool-card__link { transition: none; } .tool-card__link:hover, .tool-card__link:focus-visible { transform: none; } }

.bob__crumb { margin-bottom: .9rem; font-size: .95rem; }
.bob__crumb a { color: #C9D4E8; text-decoration-color: var(--amber); text-underline-offset: 3px; }

/* ---------- Make it funnier (the joke engine button) ---------- */
.bob__funny { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin-top: .35rem; }
.bob__funnier {
  font: 400 1.25rem/1 var(--comic); letter-spacing: .04em; color: var(--pen); cursor: pointer;
  background: var(--amber); border: 2.5px solid var(--pen); border-radius: 999px; padding: .65rem 1.2rem; min-height: 2.75rem;
  box-shadow: 3px 4px 0 var(--pen); transition: transform .15s var(--ease), box-shadow .15s var(--ease);
}
.bob__funnier:hover { transform: translate(-1px, -1px) rotate(-1deg); box-shadow: 4px 5px 0 var(--pen); }
.bob__funnier:active { transform: translate(2px, 2px); box-shadow: 1px 2px 0 var(--pen); }
.bob__funnier:focus-visible { outline: 3px solid var(--glow); outline-offset: 3px; }
.bob__funnier:disabled { opacity: .65; cursor: progress; transform: none; }
.bob__back { font: inherit; font-weight: 600; font-size: .95rem; color: var(--pen); background: none; border: 0; padding: .5rem .2rem; cursor: pointer; text-decoration: underline; text-underline-offset: 4px; }
.bob__send-note { font-size: .84rem; line-height: 1.45; color: #4A5468; }
.bob__turnstile:empty { display: none; }
@media (prefers-reduced-motion: reduce) { .bob__funnier { transition: none; } .bob__funnier:hover { transform: none; } }
.bob__joke-status { font-size: .92rem; font-weight: 600; color: #17643A; }
.bob__joke-status:empty { display: none; }
