/* =============================================================================
   Puzzle Baron site styles
   Design direction: "Puzzle Grid". Light ground, chunky geometric display type,
   and a per-offering accent colour that runs through each section.

   Accent is set with a --accent custom property on a section or card, so the
   same components recolour themselves depending on what they're showing:
     websites #5B4BEA   books #E0651A   printables #0E9384   apps #D6336C
   ========================================================================== */

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

:root {
  --ink:    #14161c;
  --body:   #5a6070;
  --muted:  #878da0;
  --line:   #e7e9ef;
  --bg:     #ffffff;
  --bg-2:   #f6f7fa;
  --brand:  #5B4BEA;
  --accent: var(--brand);

  --display: 'Space Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --sans:    'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --wrap: 1240px;
  --radius: 16px;
  --shadow: 0 18px 40px -18px rgba(20, 22, 28, .28);
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

h1, h2, h3 { font-family: var(--display); letter-spacing: -.03em; margin: 0; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 32px; }

.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;
}

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 0 0 8px 0;
}
.skip:focus { left: 0; }

:where(a, button):focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------------------------------------------------------------- buttons -- */

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 14px 26px; border-radius: 10px;
  font-weight: 600; font-size: 15px; line-height: 1;
  border: 1.5px solid transparent; cursor: pointer;
  transition: background .18s, border-color .18s, transform .18s, color .18s;
}
.btn-solid { background: var(--accent); color: #fff; }
.btn-solid:hover { filter: brightness(.92); }
.btn-ghost { background: var(--bg); border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--ink); }

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

.site-header {
  position: sticky; top: 0; z-index: 30;
  background: rgba(255, 255, 255, .9);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.header-bar { display: flex; align-items: center; justify-content: space-between; height: 96px; }

/* The Baron himself, beside the name. The mascot art is a 2013 raster, so it's
   held to modest display sizes where it still looks sharp. */
/* baron.png is 238x196, so it stays retina-crisp up to a 98px CSS height.
   Don't push .logo-mascot past that without redrawing the art. */
.logo {
  display: inline-flex; align-items: center; gap: 14px;
  color: var(--ink); line-height: 1;
}
.logo-mascot {
  height: 68px; width: auto; flex: none;
  transform: translateY(2px);            /* optically centre against the cap height */
  transition: transform .25s ease;
}
.logo:hover .logo-mascot { transform: translateY(2px) rotate(-4deg) scale(1.06); }

.logo-word {
  font-family: var(--display); font-weight: 700; font-size: 29px;
  letter-spacing: -.035em;
}
.logo-word i { font-style: normal; color: var(--brand); }

.nav-toggle {
  display: none; width: 44px; height: 44px; padding: 0;
  background: none; border: 1.5px solid var(--line); border-radius: 10px; cursor: pointer;
}
.nav-toggle-bars, .nav-toggle-bars::before, .nav-toggle-bars::after {
  display: block; width: 18px; height: 2px; background: var(--ink);
  margin: 0 auto; border-radius: 2px; transition: transform .2s, opacity .2s;
}
.nav-toggle-bars { position: relative; }
.nav-toggle-bars::before, .nav-toggle-bars::after { content: ""; position: absolute; left: 0; }
.nav-toggle-bars::before { top: -6px; }
.nav-toggle-bars::after  { top:  6px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::before { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::after  { transform: translateY(-6px) rotate(-45deg); }

.nav-list {
  display: flex; align-items: center; gap: 4px;
  list-style: none; margin: 0; padding: 0;
}
.nav-list > li > a {
  display: block; padding: 9px 14px; border-radius: 8px;
  font-size: 15px; font-weight: 500; color: var(--body);
  transition: color .16s, background .16s;
}
.nav-list > li > a:hover { color: var(--ink); background: var(--bg-2); }
.nav-list > li > a[aria-current="page"] { color: var(--ink); font-weight: 600; }

.nav-cta {
  background: var(--ink) !important; color: #fff !important;
  padding: 10px 20px !important; font-weight: 600 !important;
}
.nav-cta:hover { filter: brightness(1.25); }

/* desktop dropdown: hover or keyboard focus, no JS */
.has-submenu { position: relative; }
.submenu {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 40;
  min-width: 232px; padding: 8px; margin: 0;
  list-style: none; background: var(--bg);
  border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow);
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity .16s, transform .16s, visibility .16s;
}
.has-submenu:hover .submenu,
.has-submenu:focus-within .submenu { opacity: 1; visibility: visible; transform: none; }
.submenu a {
  display: block; padding: 9px 12px; border-radius: 8px;
  font-size: 14px; color: var(--body);
}
.submenu a:hover { background: var(--bg-2); color: var(--ink); }
.submenu-all { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 6px; }
.submenu-all a { color: var(--brand); font-weight: 600; }

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

.hero {
  position: relative; overflow: hidden;
  padding: 100px 0 88px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
}
/* faint grid, fading out, echoing a logic-puzzle grid */
.hero::before {
  content: ""; position: absolute; inset: 0; opacity: .55;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(circle at 74% 30%, #000, transparent 70%);
          mask-image: radial-gradient(circle at 74% 30%, #000, transparent 70%);
}
.hero .wrap { position: relative; }

.hero-eyebrow {
  margin: 0 0 20px; font-size: 13px; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase; color: var(--brand);
}
.hero-title {
  font-size: clamp(42px, 6.4vw, 74px); font-weight: 700; line-height: 1.02;
  margin: 0 0 22px; max-width: 16ch;
}
.mark {
  background: linear-gradient(180deg, transparent 58%, #c9c2ff 58%);
  padding: 0 .08em;
}
.hero-lede { font-size: 19px; color: var(--body); max-width: 58ch; margin: 0 0 34px; }
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }

.stat-row {
  display: flex; flex-wrap: wrap; gap: 48px;
  margin: 72px 0 0; padding: 0;
}
.stat dt { font-size: 14px; color: var(--body); order: 2; }
.stat dd {
  order: 1; margin: 0 0 2px;
  font-family: var(--display); font-size: 38px; font-weight: 700; letter-spacing: -.04em;
}

/* -------------------------------------------------------------- offerings -- */

.offerings { padding: 88px 0; }

.section-heading {
  font-size: 15px; font-weight: 600; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted); margin: 0 0 32px;
}

.offering-grid {
  display: grid; gap: 24px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 268px), 1fr));
}

.offering {
  display: flex; flex-direction: column;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden;
  transition: transform .2s, box-shadow .2s, border-color .2s;
}
.offering:hover {
  transform: translateY(-6px);
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

/* three overlapping thumbnails as a teaser */
.offering-stack {
  position: relative; height: 150px;
  background: var(--bg-2); border-bottom: 1px solid var(--line);
  overflow: hidden;
}
.offering-stack img {
  position: absolute; top: 26px; width: 54%; aspect-ratio: 3/2;
  object-fit: cover; border-radius: 8px;
  border: 2px solid var(--bg);
  box-shadow: 0 6px 18px -8px rgba(20, 22, 28, .5);
  transition: transform .3s;
}
.offering-stack img:nth-child(1) { left: 6%;  transform: rotate(-6deg); z-index: 1; }
.offering-stack img:nth-child(2) { left: 23%; transform: rotate(  0deg); z-index: 2; }
.offering-stack img:nth-child(3) { left: 40%; transform: rotate( 6deg); z-index: 3; }
.offering:hover .offering-stack img:nth-child(1) { transform: rotate(-9deg) translateX(-6px); }
.offering:hover .offering-stack img:nth-child(3) { transform: rotate( 9deg) translateX( 6px); }

.offering-body { padding: 22px; display: flex; flex-direction: column; flex: 1; }
.offering-count {
  align-self: flex-start;
  font-family: var(--display); font-size: 12px; font-weight: 700;
  color: #fff; background: var(--accent);
  padding: 4px 10px; border-radius: 999px; margin-bottom: 12px;
}
.offering h3 { font-size: 22px; font-weight: 700; margin: 0 0 8px; }
.offering p { margin: 0 0 18px; font-size: 14px; color: var(--body); flex: 1; }
.offering-go { font-size: 14px; font-weight: 600; color: var(--accent); }

/* ----------------------------------------------------------------- closer -- */

.closer { border-top: 1px solid var(--line); background: var(--bg-2); padding: 64px 0; }
.closer-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 32px; flex-wrap: wrap;
}
.closer h2 { font-size: 30px; font-weight: 700; margin: 0 0 8px; }
.closer p { margin: 0; color: var(--body); max-width: 58ch; }

/* -------------------------------------------------------------- page head -- */

.page-head {
  padding: 72px 0 40px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
}
.page-eyebrow {
  margin: 0 0 14px; font-size: 13px; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase; color: var(--accent);
}
.page-title { font-size: clamp(34px, 5vw, 52px); font-weight: 700; margin: 0 0 14px; }
.page-lede { margin: 0; font-size: 18px; color: var(--body); max-width: 62ch; }

/* ---------------------------------------------------------------- filters -- */

.listing { padding: 40px 0 88px; }

.filter { margin: 0 0 8px; }

/* Sort sits below any filter rows and above the grid. On its own on the
   puzzle-type pages, where there is nothing to filter by. */
.sortbar { margin: 0 0 34px; }
.sortbar .filter-label { margin-top: 20px; }
.listing > .wrap > .sortbar:first-child .filter-label { margin-top: 0; }
.filter-label {
  display: block; margin: 22px 0 10px;
  font-size: 12px; font-weight: 600; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted);
}
.filter-chips { display: flex; flex-wrap: wrap; gap: 9px; }

.chip {
  font-family: var(--sans); font-size: 14px; font-weight: 500; color: var(--body);
  background: var(--bg); border: 1.5px solid var(--line); border-radius: 10px;
  padding: 9px 15px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  transition: border-color .16s, color .16s, background .16s;
}
.chip span { font-family: var(--display); font-size: 12px; font-weight: 700; color: var(--muted); }
.chip:hover { border-color: var(--accent); color: var(--ink); }
.chip.is-on {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.chip.is-on span { color: rgba(255, 255, 255, .75); }

.filter-empty {
  margin: 40px 0; padding: 32px; text-align: center;
  color: var(--body); background: var(--bg-2); border-radius: var(--radius);
}

/* ------------------------------------------------------------------ cards -- */

.card-grid {
  display: grid; gap: 24px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 272px), 1fr));
}

/* Cards settle into the grid on arrival, staggered by position. The stagger is
   capped in the template at 14 steps, so a 76-card page finishes in about half
   a second instead of crawling down the page for two. */
@keyframes card-settle {
  from { opacity: 0; transform: translateY(16px) scale(.97); }
  to   { opacity: 1; transform: none; }
}
.card-grid .card,
.offering-grid .offering {
  animation: card-settle .45s cubic-bezier(.2, .8, .3, 1) both;
  animation-delay: calc(var(--i, 0) * 32ms);
}

.card {
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden;
  transition: transform .2s, box-shadow .2s, border-color .2s;
}
.card:hover {
  transform: translateY(-6px);
  border-color: var(--accent);
  box-shadow: var(--shadow);
}
.card[hidden] { display: none; }

.card-link { display: flex; flex-direction: column; height: 100%; }

.card-media {
  display: block; aspect-ratio: 3/2; overflow: hidden;
  background: var(--bg-2); border-bottom: 1px solid var(--line);
}
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .45s; }
.card:hover .card-media img { transform: scale(1.06); }

.card-body { display: flex; flex-direction: column; flex: 1; padding: 18px 20px 20px; }
.card-tag {
  align-self: flex-start; margin-bottom: 10px;
  font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent);
  padding: 4px 9px; border-radius: 999px;
}
.card-title { font-size: 17px; font-weight: 600; line-height: 1.3; margin: 0 0 8px; }
.card-blurb { display: block; font-size: 14px; color: var(--body); line-height: 1.55; flex: 1; }
.card-go { display: block; margin-top: 16px; font-size: 14px; font-weight: 600; color: var(--accent); }

/* ------------------------------------------------------------- breadcrumb -- */

.breadcrumb { border-bottom: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.breadcrumb .wrap { display: flex; gap: 10px; flex-wrap: wrap; padding-top: 18px; padding-bottom: 18px; }
.breadcrumb a { color: var(--body); }
.breadcrumb a:hover { color: var(--ink); }

/* ------------------------------------------------------------- item page -- */

.item { padding: 56px 0 72px; }
.item-layout {
  display: grid; grid-template-columns: 1.05fr .95fr; gap: 56px; align-items: start;
}
.item-media {
  border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; background: var(--bg-2);
}
.item-media img { width: 100%; aspect-ratio: 3/2; object-fit: cover; }

.item-tag {
  display: inline-block; margin-bottom: 16px;
  font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
  color: #fff; background: var(--accent); padding: 6px 13px; border-radius: 999px;
}
.item-title { font-size: clamp(30px, 4vw, 44px); font-weight: 700; margin: 0 0 20px; }
.item-para { color: var(--body); margin: 0 0 16px; font-size: 16.5px; }

.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin: 28px 0 0; }

.store-badge {
  display: inline-flex; flex-direction: column; justify-content: center;
  min-width: 168px; padding: 10px 20px; border-radius: 10px;
  background: var(--ink); color: #fff; line-height: 1.25;
  transition: filter .18s, transform .18s;
}
.store-badge:hover { filter: brightness(1.3); transform: translateY(-2px); }
.store-badge-sm { font-size: 11px; opacity: .8; }
.store-badge-lg { font-family: var(--display); font-size: 17px; font-weight: 600; }

.item-types { margin-top: 34px; padding-top: 24px; border-top: 1px solid var(--line); }
.item-types-label {
  display: block; margin-bottom: 12px;
  font-size: 12px; font-weight: 600; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted);
}
.pill {
  display: inline-block; margin: 0 7px 7px 0; padding: 7px 14px;
  font-size: 14px; color: var(--body);
  border: 1.5px solid var(--line); border-radius: 999px;
  transition: border-color .16s, color .16s;
}
.pill:hover { border-color: var(--accent); color: var(--accent); }

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

.related { padding: 64px 0 88px; border-top: 1px solid var(--line); background: var(--bg-2); }
.related-head {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 24px; margin-bottom: 28px; flex-wrap: wrap;
}
.related-head h2 { font-size: 28px; font-weight: 700; }
.related-all { font-size: 15px; font-weight: 600; color: var(--accent); }
.related-all:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- contact -- */

.contact { padding: 72px 0 96px; }
.contact-inner { max-width: 60ch; }
.contact-lede { font-size: 19px; color: var(--body); margin: 0 0 28px; }
.contact-email {
  font-family: var(--display); font-size: clamp(24px, 4vw, 36px); font-weight: 600;
  letter-spacing: -.02em; margin: 0 0 16px;
}
.contact-note { font-size: 15px; color: var(--muted); margin: 0; }
.contact-note code {
  font-size: .95em; background: var(--bg-2); padding: 2px 6px; border-radius: 5px;
}

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

.site-footer { background: var(--ink); color: #9aa0af; padding: 64px 0 32px; margin-top: 0; }
.footer-grid {
  display: grid; gap: 44px;
  grid-template-columns: 2fr 1fr 1.4fr 1fr;
  padding-bottom: 44px;
}
.site-footer .logo { color: #fff; margin-bottom: 18px; }
.site-footer .logo-word { font-size: 28px; }
.site-footer .logo-word i { color: #8b7dff; }
.logo-footer .logo-mascot { height: 72px; }
.footer-brand p { margin: 0; font-size: 14px; line-height: 1.6; max-width: 42ch; }

.footer-col h2 {
  font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  color: #fff; margin: 0 0 16px;
}
.footer-col ul { list-style: none; margin: 0; padding: 0; }
.footer-col li { display: flex; gap: 8px; align-items: baseline; margin-bottom: 9px; font-size: 14px; }
.footer-col a { color: #9aa0af; transition: color .16s; }
.footer-col a:hover { color: #fff; }
.footer-col li span { font-family: var(--display); font-size: 11px; color: #5f6575; }
.footer-types { columns: 2; column-gap: 24px; }
.footer-types li { display: block; break-inside: avoid; }

.footer-base {
  border-top: 1px solid rgba(255, 255, 255, .1); padding-top: 26px;
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.footer-base p { margin: 0; font-size: 13px; }
.footer-legal a { color: #9aa0af; transition: color .16s; }
.footer-legal a:hover { color: #fff; }

/* ------------------------------------------------------------------ prose -- */
/* Long-form legal copy. Deliberately narrow and plain. */

.prose { padding: 56px 0 88px; }
.prose-inner { max-width: 68ch; }
.prose-inner p { margin: 0 0 18px; color: var(--body); font-size: 16.5px; }
.prose-inner p strong { color: var(--ink); }
.prose-inner a { color: var(--brand); text-decoration: underline; text-underline-offset: 2px; }
.prose-inner a:hover { color: var(--ink); }
.prose-inner ul, .prose-inner ol { margin: 0 0 18px; padding-left: 22px; color: var(--body); }
.prose-inner li { margin-bottom: 8px; }

/* ------------------------------------------------------------ responsive -- */

@media (max-width: 1080px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 900px) {
  .item-layout { grid-template-columns: 1fr; gap: 32px; }
}

@media (max-width: 820px) {
  .wrap { padding: 0 20px; }

  .header-bar { height: 76px; }
  .logo-mascot { height: 52px; }
  .logo-word { font-size: 23px; }
  .logo { gap: 10px; }

  .nav-toggle { display: block; }
  .primary-nav {
    position: absolute; left: 0; right: 0; top: 100%;
    background: var(--bg); border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow);
    display: none; padding: 12px 20px 20px;
  }
  .primary-nav.is-open { display: block; }
  .nav-list { flex-direction: column; align-items: stretch; gap: 2px; }
  .nav-list > li > a { padding: 12px 10px; font-size: 16px; }
  .nav-cta { text-align: center; margin-top: 8px; }

  .submenu {
    position: static; opacity: 1; visibility: visible; transform: none;
    box-shadow: none; border: 0; border-left: 2px solid var(--line);
    border-radius: 0; margin: 2px 0 6px 10px; padding: 0 0 0 10px;
  }
  .submenu a { padding: 8px 4px; }

  .hero { padding: 60px 0 56px; }
  .stat-row { gap: 28px 40px; margin-top: 48px; }
  .stat dd { font-size: 30px; }

  .offerings, .listing { padding-top: 48px; padding-bottom: 60px; }
  .page-head { padding: 48px 0 32px; }
  .related { padding: 48px 0 64px; }
}

@media (max-width: 560px) {
  .footer-grid { grid-template-columns: 1fr; gap: 32px; }
  .card-grid, .offering-grid { grid-template-columns: 1fr; }
  .closer-inner { align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-delay: 0ms !important;      /* or a staggered card still waits */
    transition-duration: .01ms !important;
  }
}
