/* ============================================================================
   L'ITALIANO IN CAA — renew layout
   Three minimal-but-playful directions, scoped via .var-a / .var-b / .var-c.
   Inspired by lucaa.org but with bigger color, hand-drawn underlines, springy
   hover, colored numbered badges. Responsive via container queries on the
   artboard root → same component reflows for desktop 1280 and mobile 390.
   ============================================================================ */

@import url('https://fonts.cdnfonts.com/css/opendyslexic');

/* ---------- Tokens ------------------------------------------------------- */
.var-root {
  --red: #e63946;
  --yellow: #ffd166;
  --blue: #118ab2;
  --green: #06d6a0;

  --paper: #f6f3ec;
  --paper-2: #efeae0;
  --ink: #1a1410;
  --ink-soft: #4a3f36;
  --ink-mute: #7a6f64;
  --line: rgba(26, 20, 16, 0.16);
  --line-strong: rgba(26, 20, 16, 0.28);

  --bg: var(--paper);
  --fg: var(--ink);
  --fg-soft: var(--ink-soft);
  --fg-mute: var(--ink-mute);
  --card: #ffffff;
  --shadow: 0 1px 0 rgba(26,20,16,0.06);

  --font-display: 'Bricolage Grotesque', system-ui, sans-serif;
  --font-body: 'Manrope', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  --spring: cubic-bezier(.4, 1.6, .6, 1);

  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  font-feature-settings: "ss01" on, "cv11" on;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  width: 100%;
  min-height: 100%;
  /* Container query context: the artboard width drives mobile vs desktop. */
  container-type: inline-size;
  container-name: var;
  overflow-x: hidden;
}

.var-root *, .var-root *::before, .var-root *::after { box-sizing: border-box; }
.var-root h1, .var-root h2, .var-root h3, .var-root h4 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
  text-wrap: balance;
}
.var-root p { text-wrap: pretty; }
.var-root a { color: inherit; }

/* --- Dark theme --- */
.var-root[data-theme="dark"] {
  --bg: #14110d;
  --paper: #14110d;
  --paper-2: #1d1812;
  --fg: #f4eee2;
  --fg-soft: #d2c8b8;
  --fg-mute: #968b7d;
  --line: rgba(244, 238, 226, 0.16);
  --line-strong: rgba(244, 238, 226, 0.32);
  --card: #1d1812;
  --shadow: 0 1px 0 rgba(0,0,0,0.4);
}

/* --- High contrast --- */
.var-root[data-contrast="high"] {
  --bg: #ffffff; --paper: #ffffff; --paper-2: #ffffff;
  --fg: #000; --fg-soft: #000; --fg-mute: #000;
  --line: #000; --line-strong: #000;
  --card: #fff; --shadow: none;
}
.var-root[data-contrast="high"][data-theme="dark"] {
  --bg: #000; --paper: #000; --paper-2: #000;
  --fg: #fff; --fg-soft: #fff; --fg-mute: #fff;
  --line: #fff; --line-strong: #fff;
  --card: #000;
}

/* --- OpenDyslexic font swap --- */
.var-root[data-font="dyslexic"] {
  --font-body: 'OpenDyslexic', system-ui, sans-serif;
  --font-display: 'OpenDyslexic', system-ui, sans-serif;
  letter-spacing: 0.01em;
}

/* ============================================================================
   SHARED — TopBar (ARASAAC + CTS marks left, a11y pills right)
   ============================================================================ */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px clamp(20px, 4cqi, 56px);
  gap: 24px;
  flex-wrap: wrap;
}
.topbar-marks {
  display: flex;
  align-items: center;
  gap: 22px;
}
.brandmark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--fg-soft);
  text-decoration: none;
  transition: opacity .15s;
  opacity: 0.9;
}
.brandmark:hover { opacity: 1; }
.brandmark img {
  display: block;
  height: 36px;
  width: auto;
  max-width: 120px;
  object-fit: contain;
}
/* Brand logos always keep their natural colors — never filtered by theme
   or contrast mode. They're brand assets, not UI affordances. */
.brandmark-svg svg { display: block; height: 36px; width: auto; }
.var-root[data-theme="dark"] .brandmark-svg text { fill: var(--fg); }

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

.a11y {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.a11y-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  min-height: 36px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--fg-soft);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s, transform .2s var(--spring);
}
.a11y-btn:hover { background: var(--paper-2); color: var(--fg); }
.a11y-btn:active { transform: scale(0.96); }
.a11y-btn.is-on {
  background: var(--ink);
  color: var(--paper);
}
.var-root[data-theme="dark"] .a11y-btn.is-on { background: var(--fg); color: var(--bg); }
.a11y-glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
}

/* ============================================================================
   SHARED — ARASAAC pictogram tile
   ============================================================================ */
.apicto {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: #ffffff;
  flex-shrink: 0;
  overflow: hidden;
  transition: transform .35s var(--spring), box-shadow .25s;
}
.apicto-ring {
  box-shadow: inset 0 0 0 2px var(--ring, var(--line));
}
.apicto img {
  display: block;
  width: 84%;
  height: 84%;
  object-fit: contain;
}
.apicto.is-loading {
  background:
    linear-gradient(110deg, transparent 30%, rgba(0,0,0,0.04) 50%, transparent 70%),
    var(--paper-2);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.apicto-fallback {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--fg-mute);
}
.var-root[data-contrast="high"] .apicto { background: #fff; box-shadow: inset 0 0 0 2px #000; }
.var-root[data-theme="dark"] .apicto { background: #fff; /* keep symbols readable */ }

/* ============================================================================
   SHARED — colored marquee strip (playful decoration)
   ============================================================================ */
.color-strip {
  display: flex;
  height: 8px;
  width: 100%;
}
.color-strip span { flex: 1; }
.color-strip span:nth-child(1) { background: var(--red); }
.color-strip span:nth-child(2) { background: var(--yellow); }
.color-strip span:nth-child(3) { background: var(--blue); }
.color-strip span:nth-child(4) { background: var(--green); }

/* Hand-drawn wavy underline used as a highlight */
.wavy-hl {
  position: relative;
  display: inline-block;
  white-space: nowrap;
}
.wavy-hl svg {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -6px;
  width: 100%;
  height: 12px;
  overflow: visible;
}

/* ============================================================================
   FOOTER — minimal centered
   ============================================================================ */
.footer-common {
  padding: 48px clamp(20px, 4cqi, 56px) 56px;
  text-align: center;
  border-top: 1px solid var(--line);
  margin-top: 80px;
}
.footer-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 28px;
}
.footer-dots span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
}
.footer-dots span:nth-child(1) { background: var(--red); }
.footer-dots span:nth-child(2) { background: var(--yellow); }
.footer-dots span:nth-child(3) { background: var(--blue); }
.footer-dots span:nth-child(4) { background: var(--green); }
.footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
  font-size: 14px;
  flex-wrap: wrap;
}
.footer-links a {
  color: var(--fg);
  text-decoration: none;
  border-bottom: 1px solid var(--line-strong);
  padding-bottom: 1px;
}
.footer-links a:hover { color: var(--red); border-color: var(--red); }
.footer-dot { color: var(--fg-mute); }
.footer-credit, .footer-arasaac {
  margin: 6px 0;
  color: var(--fg-soft);
  font-size: 13.5px;
}
.footer-credit a, .footer-arasaac a {
  color: var(--fg);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid var(--line-strong);
}

/* ============================================================================
   VARIATION A — LISTA CENTRATA
   ============================================================================ */
.var-a { display: flex; flex-direction: column; min-height: 100%; }

.var-a-hero {
  text-align: center;
  padding: clamp(32px, 6cqi, 64px) clamp(20px, 4cqi, 56px) 32px;
  max-width: 1180px;
  margin: 0 auto;
  width: 100%;
}
.var-a-eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-mute);
  margin-bottom: 20px;
}
.var-a-title {
  font-size: clamp(48px, 9cqi, 96px);
  line-height: 0.95;
  letter-spacing: -0.04em;
  font-weight: 800;
  margin-bottom: 24px;
}
.var-a-title .dot-r { color: var(--red); }
.var-a-title .dot-y { color: var(--yellow); -webkit-text-stroke: 1.5px var(--ink); }
.var-a-root[data-theme="dark"] .var-a-title .dot-y { -webkit-text-stroke: 1.5px var(--paper); }
.var-a-title .dot-b { color: var(--blue); }
.var-a-title .dot-g { color: var(--green); }
.var-a-title .wiggle {
  display: inline-block;
  animation: wiggle 5s ease-in-out infinite;
  transform-origin: 50% 80%;
}
.var-a-title .wiggle.d2 { animation-delay: 1.2s; }
.var-a-title .wiggle.d3 { animation-delay: 2.4s; }
.var-a-title .wiggle.d4 { animation-delay: 3.6s; }
@keyframes wiggle {
  0%, 92%, 100% { transform: rotate(0); }
  94% { transform: rotate(-6deg); }
  96% { transform: rotate(8deg); }
  98% { transform: rotate(-3deg); }
}

.var-a-tagline {
  font-size: clamp(16px, 2cqi, 21px);
  line-height: 1.45;
  color: var(--fg-soft);
  max-width: 580px;
  margin: 0 auto;
}

.var-a-decor {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 32px;
}
.var-a-decor span {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  transition: transform .3s var(--spring);
}
.var-a-decor:hover span { transform: translateY(-3px); }
.var-a-decor span:nth-child(1) { background: var(--red); }
.var-a-decor span:nth-child(2) { background: var(--yellow); }
.var-a-decor span:nth-child(3) { background: var(--blue); }
.var-a-decor span:nth-child(4) { background: var(--green); }
.var-a-decor span:nth-child(2) { transition-delay: .05s; }
.var-a-decor span:nth-child(3) { transition-delay: .1s; }
.var-a-decor span:nth-child(4) { transition-delay: .15s; }

.var-a-howto {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  max-width: 880px;
  margin: 56px auto 0;
  padding: 0 clamp(20px, 4cqi, 56px);
}
.var-a-step { text-align: center; }
.var-a-step-n {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 14px;
  color: var(--ink);
}
.var-a-step:nth-child(1) .var-a-step-n { background: var(--red); color: white; }
.var-a-step:nth-child(2) .var-a-step-n { background: var(--yellow); }
.var-a-step:nth-child(3) .var-a-step-n { background: var(--blue); color: white; }
.var-a-step h3 { font-size: 17px; }

.var-a-section-label {
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: 760px;
  margin: 96px auto 28px;
  padding: 0 clamp(20px, 4cqi, 56px);
}
.var-a-section-label .rule { flex: 1; height: 1px; background: var(--line); }
.var-a-section-label .label {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-mute);
}

.var-a-list {
  max-width: 1180px;
  margin: 0 auto;
  width: 100%;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.var-a-game {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 24px;
  min-width: 0;
  padding: 22px 4px;
  border-top: 1px solid var(--line);
  text-decoration: none;
  color: var(--fg);
  position: relative;
  transition: padding-left .25s var(--spring), background .15s;
}
.var-a-game:last-child { border-bottom: 1px solid var(--line); }
.var-a-game:hover {
  padding-left: 18px;
  background: var(--paper-2);
}
.var-a-thumb {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.var-a-thumb .apicto {
  transition: transform .35s var(--spring);
}
.var-a-game:hover .var-a-thumb .apicto {
  transform: rotate(-6deg) scale(1.05);
}
.var-a-thumb-num {
  position: absolute;
  top: -6px;
  right: -8px;
  min-width: 26px;
  height: 26px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--game-color);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: -0.02em;
  border: 2px solid var(--bg);
  z-index: 1;
}
.var-a-game-body { min-width: 0; }
.var-a-game-body h3 {
  font-size: clamp(19px, 2.2cqi, 26px);
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 4px;
}
.var-a-game-body p {
  margin: 0;
  font-size: 15px;
  color: var(--fg-soft);
  line-height: 1.5;
  max-width: 480px;
}
.var-a-game-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-mute);
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  white-space: nowrap;
}
.var-a-game.is-new .var-a-game-tag {
  color: var(--ink);
  background: var(--green);
  border-color: var(--green);
  font-weight: 700;
}
.var-a-game.is-soon {
  cursor: default;
  opacity: 0.7;
}
.var-a-game.is-soon:hover {
  padding-left: 4px;
  background: transparent;
}
.var-a-game.is-soon .var-a-game-tag {
  background: repeating-linear-gradient(45deg, var(--paper-2) 0 6px, transparent 6px 12px), var(--card);
  color: var(--fg-soft);
  border-color: var(--line-strong);
  font-weight: 700;
}
.var-a-game.is-soon .var-a-thumb .apicto {
  filter: grayscale(0.4);
}
.var-a-game.is-soon:hover .var-a-thumb .apicto { transform: none; }
.var-a-game.is-soon .var-a-game-arrow { opacity: 0.4; }

/* ---- 2-column "tabella" layout for the 7 games --------------------------- */
.var-a-games-grid {
  max-width: 1180px;
  width: 100%;
  min-width: 0;
  margin: 0 auto;
  padding: 0 clamp(20px, 4cqi, 56px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  column-gap: 40px;
}
.var-a-games-grid > .var-a-game {
  border-top: 1px solid var(--line);
  border-bottom: none;
}
.var-a-games-grid > .var-a-game:nth-last-child(-n+2) {
  border-bottom: 1px solid var(--line);
}
.var-a-games-center {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 clamp(20px, 4cqi, 56px);
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 40px;
}
.var-a-games-center::before {
  content: none;
}
.var-a-games-center > .var-a-game {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

/* ---- Colored tone tag — uses the game color, subtle tint background ------ */
.var-a-game .var-a-game-tag {
  color: var(--game-color);
  border-color: color-mix(in oklab, var(--game-color) 35%, var(--line));
  background: color-mix(in oklab, var(--game-color) 8%, transparent);
}
.var-root[data-theme="dark"] .var-a-game .var-a-game-tag {
  background: color-mix(in oklab, var(--game-color) 14%, transparent);
}

/* ---- Page-top color stripe (decorative band of the 4 brand colors) ------- */
.page-stripe {
  display: flex;
  height: 5px;
  width: 100%;
  position: sticky;
  top: 0;
  z-index: 10;
}
.page-stripe span { flex: 1; }
.page-stripe span:nth-child(1) { background: var(--red); }
.page-stripe span:nth-child(2) { background: var(--yellow); }
.page-stripe span:nth-child(3) { background: var(--blue); }
.page-stripe span:nth-child(4) { background: var(--green); }

/* ---- Confetti decoration around the hero (subtle scattered shapes) ------- */
.var-a-hero {
  position: relative;
}
.confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
}
.confetti span {
  position: absolute;
  display: block;
  opacity: 0.85;
}
.confetti .c-r {
  top: 18%; left: 6%;
  width: 12px; height: 12px;
  background: var(--red);
  border-radius: 999px;
  transform: rotate(-12deg);
  animation: floaty 7s ease-in-out infinite;
}
.confetti .c-y {
  top: 8%; right: 9%;
  width: 14px; height: 14px;
  background: var(--yellow);
  border-radius: 3px;
  transform: rotate(20deg);
  animation: floaty 6.5s ease-in-out -1.5s infinite;
}
.confetti .c-b {
  bottom: 22%; left: 11%;
  width: 10px; height: 10px;
  background: var(--blue);
  transform: rotate(45deg);
  animation: floaty 7.5s ease-in-out -3s infinite;
}
.confetti .c-g {
  bottom: 14%; right: 7%;
  width: 16px; height: 4px;
  background: var(--green);
  border-radius: 4px;
  transform: rotate(-25deg);
  animation: floaty 8s ease-in-out -2s infinite;
}
.confetti .c-r2 {
  top: 60%; right: 18%;
  width: 6px; height: 6px;
  background: var(--red);
  border-radius: 999px;
  opacity: 0.5;
  animation: floaty 9s ease-in-out -4s infinite;
}
.confetti .c-b2 {
  top: 70%; left: 18%;
  width: 8px; height: 2px;
  background: var(--blue);
  transform: rotate(60deg);
  opacity: 0.6;
  animation: floaty 8.5s ease-in-out -2.5s infinite;
}
@keyframes floaty {
  0%, 100% { transform: translateY(0) rotate(var(--rot, 0deg)); }
  50% { transform: translateY(-8px) rotate(calc(var(--rot, 0deg) + 6deg)); }
}

/* ---- Collapse to a single column before the dense rows start clipping --- */
@container var (max-width: 1000px) {
  .var-a-games-grid { grid-template-columns: minmax(0, 1fr); column-gap: 0; }
  .var-a-games-grid > .var-a-game { border-bottom: none; }
  .var-a-games-grid > .var-a-game:last-child { border-bottom: 1px solid var(--line); }
}

/* ---- 2-col grid → 1-col on mobile -------------------------------------- */
@container var (max-width: 700px) {
  .var-a-games-grid { grid-template-columns: minmax(0, 1fr); column-gap: 0; }
  .var-a-games-grid > .var-a-game { border-bottom: none !important; }
  .var-a-games-grid > .var-a-game:last-child { border-bottom: 1px solid var(--line) !important; }
  .var-a-games-center { margin-top: 0; grid-template-columns: 1fr; column-gap: 0; }
  .var-a-games-center::before { display: none; }
  .var-a-games-center > .var-a-game { border-top: none; border-bottom: 1px solid var(--line); }
  /* confetti smaller and less dense on narrow screens */
  .confetti span { transform: scale(0.7); }
}
.var-a-game-arrow {
  font-size: 22px;
  color: var(--fg-mute);
  font-family: var(--font-display);
  transition: transform .25s var(--spring), color .15s;
}
.var-a-game:hover .var-a-game-arrow {
  transform: translateX(6px);
  color: var(--game-color);
}

/* ============================================================================
   VARIATION B — GRIGLIA TRANQUILLA
   ============================================================================ */
.var-b { display: flex; flex-direction: column; min-height: 100%; }
.var-b .topbar { border-bottom: 1px solid var(--line); }

.var-b-hero {
  padding: clamp(40px, 6cqi, 72px) clamp(20px, 4cqi, 56px) 16px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 56px;
  max-width: 1180px;
  margin: 0 auto;
  width: 100%;
}
.var-b-hero-text h1 {
  font-size: clamp(36px, 6cqi, 72px);
  line-height: 1;
  letter-spacing: -0.03em;
  margin-bottom: 18px;
}
.var-b-hero-text h1 .hl {
  position: relative;
  white-space: nowrap;
  color: var(--ink);
}
.var-b-root[data-theme="dark"] .var-b-hero-text h1 .hl { color: var(--fg); }
.var-b-hero-text h1 .hl svg {
  position: absolute;
  left: -2%;
  right: -2%;
  bottom: -10px;
  width: 104%;
  height: 14px;
  overflow: visible;
}
.var-b-hero-text p {
  font-size: clamp(15px, 1.6cqi, 18px);
  line-height: 1.5;
  color: var(--fg-soft);
  max-width: 520px;
  margin: 0;
}
.var-b-hero-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--fg-mute);
  text-align: right;
}
.var-b-hero-meta strong { color: var(--fg); font-weight: 600; }
.var-b-hero-meta .pulse {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
}
.var-b-hero-meta .pulse::before {
  content: '';
  width: 8px; height: 8px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(6,214,160,0.6);
  animation: pulse 2.2s ease-out infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(6,214,160,0.6); }
  60% { box-shadow: 0 0 0 8px rgba(6,214,160,0); }
  100% { box-shadow: 0 0 0 0 rgba(6,214,160,0); }
}

.var-b-howto {
  max-width: 1180px;
  margin: 36px auto 0;
  padding: 0 clamp(20px, 4cqi, 56px);
  display: flex;
  gap: 12px;
  align-items: stretch;
  flex-wrap: wrap;
}
.var-b-howto-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  font-size: 14px;
  color: var(--fg-soft);
  flex: 1 1 240px;
}
.var-b-howto-pill strong { color: var(--fg); font-weight: 600; }
.var-b-howto-pill .num {
  width: 26px; height: 26px;
  border-radius: 999px;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 800;
  flex-shrink: 0;
}
.var-b-howto-pill:nth-child(1) .num { background: var(--red); color: white; }
.var-b-howto-pill:nth-child(2) .num { background: var(--yellow); }
.var-b-howto-pill:nth-child(3) .num { background: var(--blue); color: white; }

.var-b-grid {
  max-width: 1180px;
  margin: 56px auto 0;
  padding: 0 clamp(20px, 4cqi, 56px);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.var-b-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  text-decoration: none;
  color: var(--fg);
  position: relative;
  overflow: hidden;
  transition: transform .28s var(--spring), border-color .15s, box-shadow .25s;
  min-height: 240px;
}
.var-b-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 6px;
  background: var(--game-color);
}
.var-b-card::after {
  content: attr(data-num);
  position: absolute;
  right: -8px;
  bottom: -38px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 160px;
  line-height: 1;
  color: var(--game-color);
  opacity: 0.07;
  letter-spacing: -0.06em;
  pointer-events: none;
  transition: opacity .25s, transform .35s var(--spring);
}
.var-b-card:hover {
  transform: translateY(-4px) rotate(-0.4deg);
  border-color: var(--game-color);
  box-shadow: 0 18px 36px -20px rgba(26,20,16,0.22);
}
.var-b-card:hover::after {
  opacity: 0.16;
  transform: scale(1.04) translate(-4px, -4px);
}
.var-b-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.var-b-card-num {
  width: 34px; height: 34px;
  border-radius: 999px;
  background: var(--game-color);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 800;
}
.var-b-card-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-mute);
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
}
.var-b-card.is-new .var-b-card-tag {
  color: var(--ink);
  background: var(--green);
  border-color: var(--green);
  animation: nudge 3.5s ease-in-out infinite;
}
@keyframes nudge {
  0%, 86%, 100% { transform: rotate(0); }
  90% { transform: rotate(-3deg) scale(1.05); }
  94% { transform: rotate(3deg) scale(1.05); }
}
.var-b-card h3 {
  font-size: clamp(18px, 1.9cqi, 24px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  position: relative;
}
.var-b-card p {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--fg-soft);
  flex: 1;
  position: relative;
}
.var-b-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--fg-mute);
  font-family: var(--font-mono);
  position: relative;
}
.var-b-card-foot .arrow {
  color: var(--game-color);
  font-weight: 700;
  font-size: 18px;
  font-family: var(--font-display);
  transition: transform .25s var(--spring);
}
.var-b-card:hover .var-b-card-foot .arrow { transform: translateX(4px); }

/* ============================================================================
   VARIATION C — COMPOSITIVA (editoriale)
   ============================================================================ */
.var-c { display: flex; flex-direction: column; min-height: 100%; }

.var-c-masthead {
  padding: 24px clamp(20px, 4cqi, 64px) 40px;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 32px;
}
.var-c-masthead h1 {
  font-size: clamp(56px, 9cqi, 112px);
  line-height: 0.9;
  letter-spacing: -0.045em;
  font-weight: 800;
}
.var-c-masthead h1 .it { color: var(--red); }
.var-c-masthead h1 .caa {
  font-style: italic;
  font-weight: 500;
  background: linear-gradient(180deg, transparent 64%, var(--yellow) 64%, var(--yellow) 92%, transparent 92%);
  padding: 0 6px;
}
.var-c-masthead-aside {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-mute);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.8;
}
.var-c-masthead-aside .issue {
  display: inline-block;
  font-size: 11px;
  color: var(--ink);
  background: var(--green);
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  margin-bottom: 6px;
  letter-spacing: 0.12em;
}

.var-c-intro {
  padding: 32px clamp(20px, 4cqi, 64px);
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 64px;
  border-bottom: 1px solid var(--line);
}
.var-c-intro-lead {
  font-family: var(--font-display);
  font-size: clamp(20px, 2.6cqi, 30px);
  line-height: 1.25;
  font-weight: 500;
  letter-spacing: -0.015em;
}
.var-c-intro-lead em { font-style: italic; color: var(--blue); }
.var-c-intro-lead strong {
  font-weight: 700;
  background: linear-gradient(180deg, transparent 62%, var(--yellow) 62%);
  padding: 0 3px;
}
.var-c-intro-meta {
  display: flex;
  flex-direction: column;
  gap: 18px;
  font-size: 14px;
  color: var(--fg-soft);
  line-height: 1.55;
}
.var-c-intro-meta dt {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-mute);
  margin-bottom: 2px;
}
.var-c-intro-meta dd { margin: 0; }

.var-c-featured {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
  transition: background .2s;
}
.var-c-featured:hover { background: var(--paper-2); }
.var-c-featured-art {
  background: linear-gradient(135deg, var(--green) 0%, color-mix(in oklab, var(--green) 70%, var(--blue)) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  border-right: 1px solid var(--line);
  position: relative;
  overflow: hidden;
  min-height: 320px;
}
.var-c-featured-art::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 18% 22%, rgba(255,255,255,0.4) 0, transparent 18%),
    radial-gradient(circle at 82% 78%, rgba(0,0,0,0.18) 0, transparent 22%),
    repeating-linear-gradient(45deg, transparent 0, transparent 18px, rgba(255,255,255,0.18) 18px, rgba(255,255,255,0.18) 19px);
}
.var-c-featured-art-inner {
  position: relative;
  text-align: center;
  color: var(--ink);
}
.var-c-featured-art-glyph {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(120px, 18cqi, 220px);
  line-height: 1;
  letter-spacing: -0.04em;
}
.var-c-featured-art-glyph .uc { color: var(--ink); }
.var-c-featured-art-glyph .lc {
  color: var(--red);
  font-style: italic;
  display: inline-block;
  animation: bob 3.5s ease-in-out infinite;
}
@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-6px) rotate(3deg); }
}
.var-c-featured-art-cap {
  margin-top: 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
}
.var-c-featured-body {
  padding: clamp(28px, 4cqi, 56px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
}
.var-c-featured-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  background: var(--ink);
  color: var(--green);
  padding: 5px 12px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.var-c-root[data-theme="dark"] .var-c-featured-tag { background: var(--green); color: var(--ink); }
.var-c-featured-body h2 {
  font-size: clamp(36px, 5cqi, 60px);
  line-height: 1;
  letter-spacing: -0.03em;
}
.var-c-featured-body p {
  margin: 0;
  font-size: clamp(15px, 1.6cqi, 18px);
  line-height: 1.55;
  color: var(--fg-soft);
  max-width: 440px;
}
.var-c-featured-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  align-self: flex-start;
  margin-top: 8px;
  padding: 14px 22px;
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
  border-radius: 999px;
  transition: transform .25s var(--spring);
}
.var-c-root[data-theme="dark"] .var-c-featured-cta { background: var(--fg); color: var(--bg); }
.var-c-featured:hover .var-c-featured-cta { transform: translateX(4px); }

.var-c-grid {
  padding: 48px clamp(20px, 4cqi, 64px) 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
}
.var-c-cell {
  padding: 28px clamp(16px, 2cqi, 32px);
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 56px 1fr auto;
  align-items: center;
  gap: 24px;
  text-decoration: none;
  color: var(--fg);
  position: relative;
  transition: background .15s;
}
.var-c-cell:nth-child(odd) { border-right: 1px solid var(--line); }
.var-c-cell:hover { background: var(--paper-2); }
.var-c-cell .apicto { transition: transform .35s var(--spring); }
.var-c-cell:hover .apicto { transform: rotate(-6deg) scale(1.04); }
.var-c-cell h3 {
  font-size: clamp(18px, 2cqi, 26px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}
.var-c-cell p {
  margin: 0;
  font-size: 14px;
  color: var(--fg-soft);
  line-height: 1.45;
  max-width: 380px;
}
.var-c-cell-arrow {
  color: var(--fg-mute);
  font-size: 22px;
  font-family: var(--font-display);
  transition: transform .25s var(--spring), color .15s;
}
.var-c-cell:hover .var-c-cell-arrow { color: var(--game-color); transform: translate(3px, -3px); }

/* ============================================================================
   ACCESSIBILITY — focus rings, skip link, reduced motion
   ============================================================================ */
.var-root :focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
  border-radius: 4px;
}
.var-root[data-theme="dark"] :focus-visible {
  outline-color: var(--yellow);
}
.var-root[data-contrast="high"] :focus-visible {
  outline-width: 4px;
}

/* Skip link — visible only when focused via keyboard */
.skip-link {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 100;
  padding: 12px 18px;
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
  font-weight: 700;
  border-radius: 0 0 8px 0;
  transform: translateY(-110%);
  transition: transform .15s;
}
.skip-link:focus { transform: translateY(0); }

/* Respect users who prefer reduced motion: disable wiggle, bob, nudge,
   pulse, shimmer, springs. Hover transforms stay, but instant. */
@media (prefers-reduced-motion: reduce) {
  .var-root *,
  .var-root *::before,
  .var-root *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================================================
   RESPONSIVE — container queries on the artboard root
   Triggers when an artboard is narrower than ~700px (mobile artboard = 390).
   ============================================================================ */
@container var (max-width: 700px) {
  .topbar {
    padding: 18px 18px;
    gap: 14px;
    flex-wrap: wrap;
    align-items: center;
  }
  .topbar-marks {
    gap: 14px;
  }
  .brandmark span { display: none; }
  .a11y { padding: 3px; gap: 2px; }
  .a11y-btn {
    padding: 8px;
    min-width: 36px;
    min-height: 36px;
    justify-content: center;
  }
  .a11y-btn:has(.a11y-glyph) .a11y-label { display: none; }

  /* --- A mobile --- */
  .var-a-hero { padding: 24px 20px 16px; }
  .var-a-eyebrow { font-size: 11px; margin-bottom: 14px; letter-spacing: 0.14em; }
  .var-a-tagline { font-size: 16px; }
  .var-a-decor { margin-top: 24px; gap: 8px; }
  .var-a-howto {
    grid-template-columns: 1fr;
    gap: 22px;
    margin-top: 36px;
    padding: 0 20px;
  }
  .var-a-step {
    display: grid;
    grid-template-columns: 40px 1fr;
    text-align: left;
    gap: 14px;
    align-items: center;
  }
  .var-a-step-n { margin-bottom: 0; }
  .var-a-step h3 { font-size: 16px; margin-bottom: 2px; }
  .var-a-step p { font-size: 14px; }
  .var-a-section-label { margin: 56px auto 20px; padding: 0 20px; }
  .var-a-list { padding: 0 20px; }
  .var-a-game {
    grid-template-columns: 60px 1fr auto;
    gap: 14px;
    padding: 18px 0;
  }
  .var-a-game:hover { padding-left: 6px; }
  .var-a-thumb .apicto { width: 52px !important; height: 52px !important; }
  .var-a-thumb-num { min-width: 22px; height: 22px; font-size: 11px; }
  .var-a-game-body h3 { font-size: 18px; }
  .var-a-game-body p { display: none; }
  .var-a-game-tag { display: none; }
  .var-a-game-arrow { font-size: 18px; }

  /* --- B mobile --- */
  .var-b-hero {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 36px 20px 12px;
  }
  .var-b-hero-text h1 { font-size: 36px; }
  .var-b-hero-text p { font-size: 15px; }
  .var-b-hero-meta {
    text-align: left;
    flex-direction: row;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
  }
  .var-b-hero-meta .pulse { justify-content: flex-start; }
  .var-b-howto { padding: 0 20px; margin-top: 22px; flex-direction: column; }
  .var-b-howto-pill { font-size: 13.5px; }
  .var-b-grid {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 0 20px;
    margin-top: 36px;
  }
  .var-b-card { min-height: 0; padding: 22px; }
  .var-b-card h3 { font-size: 19px; }
  .var-b-card::after { font-size: 110px; bottom: -22px; }

  /* --- C mobile --- */
  .var-c-masthead {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 16px 20px 22px;
    align-items: start;
  }
  .var-c-masthead h1 { font-size: 56px; }
  .var-c-masthead-aside { text-align: left; }
  .var-c-intro {
    grid-template-columns: 1fr;
    gap: 22px;
    padding: 24px 20px;
  }
  .var-c-intro-lead { font-size: 20px; }
  .var-c-featured { grid-template-columns: 1fr; }
  .var-c-featured-art {
    border-right: none;
    border-bottom: 1px solid var(--line);
    min-height: 220px;
    padding: 32px;
  }
  .var-c-featured-art-glyph { font-size: 140px; }
  .var-c-featured-body { padding: 28px 20px; }
  .var-c-featured-body h2 { font-size: 36px; }
  .var-c-grid {
    grid-template-columns: 1fr;
    padding: 28px 20px 0;
  }
  .var-c-cell {
    padding: 20px 0;
    border-right: none !important;
    grid-template-columns: 56px 1fr auto;
    gap: 16px;
  }
  .var-c-cell .apicto { width: 48px !important; height: 48px !important; }
  .var-c-cell h3 { font-size: 19px; }
  .var-c-cell p { display: none; }

  /* --- Footer mobile --- */
  .footer-common { padding: 36px 20px 40px; margin-top: 56px; }
  .footer-credit, .footer-arasaac { font-size: 12.5px; }
}
