/* Buffones — one stylesheet. Tokens follow docs/brand-guidelines.md (themes "Paper" and "Night"). */

:root {
  /* Follows the system theme; theme.js pins it with data-theme="light" | "dark". */
  color-scheme: light dark;

  /* Change with the theme: light-dark(Paper, Night) */
  --paper: light-dark(#FFF4E2, #0E1638);
  --raised: light-dark(#FFFFFF, #1A2552);
  --ink: light-dark(#13204D, #FFF4E2);
  --ink-muted: light-dark(#4A5272, #C3C8DF);
  --blue: light-dark(#2A4BC4, #8AA2FF);
  --focus: light-dark(#2A4BC4, #F2B32E);

  /* Same in both themes */
  --navy: #13204D;
  --on-navy: #FFF4E2;
  --on-navy-muted: #D9DCEB;
  --hat-blue: #2A4BC4;
  --sky: #46B6EA;
  --gold: #F2B32E;

  --display: "Bricolage Grotesque", "Arial Black", system-ui, sans-serif;
  --sans: Figtree, "Segoe UI", system-ui, sans-serif;
  --hand: Caveat, "Comic Sans MS", cursive;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

/* Browsers without light-dark() (before 2024) get the light theme only. */
@supports not (color: light-dark(#000, #fff)) {
  :root { --paper: #FFF4E2; --raised: #FFFFFF; --ink: #13204D; --ink-muted: #4A5272; --blue: #2A4BC4; --focus: #2A4BC4; }
  .theme-toggle { display: none !important; }
}

/* Theme-specific elements (logo, toggle icon) */
.only-dark { display: none; }
:root[data-theme="dark"] .only-light { display: none; }
:root[data-theme="dark"] .only-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .only-light { display: none; }
  :root:not([data-theme="light"]) .only-dark { display: block; }
}

/* Base */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); overflow-x: clip; }
img { display: block; max-width: 100%; height: auto; }
h1, h2, h3 { margin: 0; font-family: var(--display); font-weight: 800; text-wrap: balance; }
h2 { font-size: clamp(32px, 3.6vw, 46px); line-height: 1.08; }
h3 { font-size: 26px; font-weight: 700; }
p { margin: 0; }
ul { list-style: none; margin: 0; padding: 0; }
a { color: inherit; text-decoration-thickness: 2px; text-underline-offset: 4px; }
a:hover { color: var(--blue); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

.wrap { max-width: 1200px; margin: 0 auto; padding-left: 24px; padding-right: 24px; }
.lead { font-size: 19px; line-height: 1.55; color: var(--ink-muted); max-width: 34em; }
.muted { color: var(--ink-muted); }
.eyebrow { font-family: var(--hand); font-weight: 700; font-size: 30px; line-height: 1.1; color: var(--blue); }
.scribble { font-family: var(--hand); font-weight: 700; font-size: 28px; color: var(--blue); }
.label { font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.tilt-l { transform: rotate(-1deg); }
.tilt-r { transform: rotate(1deg); }

/* Button: sticker that presses on hover. Text on gold is always navy. */
.btn {
  display: inline-flex; align-items: center; min-height: 52px; padding: 0 26px;
  background: var(--gold); color: var(--navy); border: 3px solid var(--ink); border-radius: 14px;
  box-shadow: 5px 5px 0 var(--ink); font: 700 19px var(--display); text-decoration: none; cursor: pointer;
  transition: transform .12s ease-out, box-shadow .12s ease-out;
}
.btn:hover { color: var(--navy); transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }
.btn-navy { background: var(--navy); color: var(--on-navy); border-color: var(--navy); box-shadow: 4px 4px 0 var(--on-navy); font-size: 18px; }
.btn-navy:hover { color: var(--on-navy); box-shadow: 2px 2px 0 var(--on-navy); }
.btn-light { border-color: var(--on-navy); box-shadow: 5px 5px 0 var(--on-navy); }
.btn-light:hover { box-shadow: 2px 2px 0 var(--on-navy); }

/* Card: sticker that straightens on hover */
.card {
  display: flex; flex-direction: column; gap: 12px; padding: 28px 26px 30px;
  background: var(--raised); color: var(--ink); border: 3px solid var(--ink); border-radius: 20px; box-shadow: 6px 6px 0 var(--ink);
  transition: transform .15s ease-out;
}
.card.tilt-l:hover, .card.tilt-r:hover { transform: rotate(0) translateY(-4px); }
.card.gold { background: var(--gold); color: var(--navy); border-color: var(--navy); }
.card.gold a:hover { color: inherit; }
.card.navy { background: var(--navy); color: var(--on-navy); box-shadow: 6px 6px 0 var(--blue); }
.card.navy .muted { color: var(--on-navy-muted); }

.tag {
  align-self: flex-start; padding: 4px 12px; border: 2px solid var(--ink); border-radius: 999px;
  background: var(--navy); color: var(--on-navy); font-size: 13px; font-weight: 600;
}
.gold .tag { border-color: var(--navy); }
.tag.sky { background: var(--sky); color: var(--navy); }
.tag.paper { background: var(--on-navy); color: var(--navy); }

/* Nav */
.nav { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-top: 20px; }
.nav-links { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 4px 22px; }
.nav-links > a { padding: 10px 0; font-size: 15px; font-weight: 600; text-decoration: none; }
.lang { display: flex; align-items: center; gap: 4px; font-size: 14px; font-weight: 600; color: var(--ink-muted); }
.lang a { padding: 10px 4px; color: var(--ink-muted); text-decoration: none; }
.lang a[aria-current] { color: var(--ink); text-decoration: underline; }
.theme-toggle {
  display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin: 0 -10px 0 -12px; padding: 0;
  background: none; border: 0; border-radius: 999px; color: var(--ink); cursor: pointer;
}
.theme-toggle[hidden] { display: none; }
.theme-toggle:hover { color: var(--blue); }
.theme-toggle svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Hero: Bufo peeking over the ledge */
.hero { position: relative; z-index: 2; display: flex; flex-wrap: wrap-reverse; align-items: flex-start; gap: 24px 56px; padding-top: 64px; }
.pet { position: relative; flex: none; width: 320px; height: 288px; }
.pet-clip { position: absolute; inset: -40px -30px 0; overflow: hidden; }
.pet-head { position: absolute; left: 30px; top: 40px; width: 320px; transform-origin: 50% 70%; animation: sway 4.5s ease-in-out infinite; }
.paw { position: absolute; top: 245px; z-index: 3; width: 72px; }
.paw-l { left: 40px; }
.paw-r { left: 206px; }
.pet:hover .pet-head { animation: wiggle .5s ease-in-out infinite; }
.pet:hover .paw-l { animation: pat .25s ease-in-out infinite alternate; }
.pet:hover .paw-r { animation: pat .25s ease-in-out .12s infinite alternate; }
@keyframes sway { 0%, 100% { transform: rotate(-1.5deg); } 50% { transform: rotate(1.5deg) translateY(-3px); } }
@keyframes wiggle { 0%, 100% { transform: rotate(-3deg) translateY(-4px); } 50% { transform: rotate(3deg) translateY(-4px); } }
@keyframes pat { to { translate: 0 -4px; } }

.hero-text { flex: 1 1 520px; min-width: 0; padding: 0 0 44px 6px; }
.wordmark { display: flex; flex-wrap: wrap; font-size: clamp(64px, 10vw, 148px); line-height: .9; letter-spacing: -.02em; }
.wordmark span { display: inline-block; }
@media (max-width: 480px) { .wordmark { font-size: 13vw; } }
.wordmark span:nth-child(1) { transform: rotate(-4deg) translateY(4px); }
.wordmark span:nth-child(2) { transform: rotate(3deg) translateY(-6px); }
.wordmark span:nth-child(3) { transform: rotate(-2deg) translateY(2px); }
.wordmark span:nth-child(4) { transform: rotate(4deg) translateY(-4px); }
.wordmark span:nth-child(5) { transform: rotate(-3deg) translateY(6px); color: var(--blue); }
.wordmark span:nth-child(6) { transform: rotate(2deg) translateY(-2px); }
.wordmark span:nth-child(7) { transform: rotate(-4deg) translateY(3px); }
.wordmark span:nth-child(8) { transform: rotate(3deg) translateY(-5px); }
.slogan { margin-top: 18px; font: 700 clamp(30px, 3.2vw, 44px)/1.1 var(--hand); }
.wavy { color: var(--blue); text-decoration: underline wavy var(--gold) 3px; text-underline-offset: 6px; }
.hero-text .lead { margin-top: 22px; max-width: 30em; }
.hero-text .btn { margin-top: 26px; }

/* The ledge */
.ledge { position: relative; z-index: 1; height: 10px; background: var(--navy); }
.harlequin {
  height: 28px; border-bottom: 4px solid var(--ink); background-color: var(--hat-blue);
  background-image:
    linear-gradient(45deg, var(--sky) 25%, transparent 25%, transparent 75%, var(--sky) 75%),
    linear-gradient(45deg, var(--sky) 25%, transparent 25%, transparent 75%, var(--sky) 75%);
  background-size: 28px 28px; background-position: 0 0, 14px 14px;
}
.harlequin-top { border-top: 4px solid var(--ink); border-bottom-color: var(--navy); }

/* Two doors */
.doors { padding-top: 88px; padding-bottom: 40px; }
.doors h2 { margin-bottom: 12px; font-size: clamp(34px, 4vw, 52px); line-height: 1.05; }
.doors .lead { margin-bottom: 40px; }
.door-row { display: flex; flex-wrap: wrap; gap: 32px; }
.door { flex: 1 1 380px; min-width: 0; gap: 14px; padding: 32px 32px 36px; border-radius: 24px; box-shadow: 8px 8px 0 var(--ink); text-decoration: none; font-size: 18px; line-height: 1.55; }
.door:hover { color: var(--ink); }
.door.gold:hover { color: var(--navy); }
.door .tag { padding: 6px 14px; letter-spacing: .06em; text-transform: uppercase; }
.door-title { font: 800 40px/1 var(--display); }
.door .scribble { margin-top: 8px; }
.door.gold .scribble { color: var(--navy); }

/* Studio */
.studio { padding-top: 72px; padding-bottom: 96px; }
.studio > h2 { margin: 4px 0 40px; max-width: 18em; }
.services { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 28px; }
.services svg { width: 40px; height: 40px; fill: none; stroke: var(--blue); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.services .navy svg { stroke: var(--gold); }
.services p { font-size: 17px; line-height: 1.55; }

.checkup { margin-top: 48px; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 20px 32px; padding: 28px 32px; border-radius: 24px; box-shadow: 8px 8px 0 var(--ink); }
.checkup > div { flex: 1 1 360px; min-width: 0; }
.checkup .eyebrow { font-size: 28px; color: var(--navy); }
.checkup h3 { margin: 2px 0 8px; font-weight: 800; font-size: clamp(24px, 2.6vw, 32px); line-height: 1.15; }
.checkup p { font-size: 16px; line-height: 1.5; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-size: 14px; font-weight: 600; }
.field-row { display: flex; flex-wrap: wrap; gap: 12px; }
.field input {
  flex: 1 1 220px; min-width: 0; min-height: 52px; padding: 0 16px;
  background: var(--raised); color: var(--ink); border: 3px solid var(--navy); border-radius: 14px; font: 500 16px var(--mono);
}
.field input::placeholder { color: var(--ink-muted); }

.proof { margin-top: 36px; padding: 28px 32px 32px; border-radius: 24px; box-shadow: 8px 8px 0 var(--blue); }
.proof .eyebrow { margin-bottom: 8px; color: var(--sky); }
.proof ul { display: flex; flex-wrap: wrap; gap: 24px 36px; }
.proof li { flex: 1 1 220px; display: flex; flex-direction: column; gap: 6px; font: 700 21px/1.25 var(--display); }
.proof .label { font-family: var(--sans); color: var(--gold); }

.cta-row { margin-top: 44px; display: flex; flex-wrap: wrap; align-items: center; gap: 16px 28px; }
.pills { display: flex; flex-wrap: wrap; gap: 10px; }
.pill { padding: 6px 14px; border: 2px solid var(--ink); border-radius: 999px; background: var(--navy); color: var(--on-navy); font-size: 14px; font-weight: 600; }
.pill.dashed { border-style: dashed; background: none; color: var(--ink); }
.pills .tilt-l { transform: rotate(-2deg); }
.pills .tilt-r { transform: rotate(1.5deg); }
.aside { margin-top: 36px; font: 700 30px/1.2 var(--hand); }
.aside a { color: var(--blue); text-underline-offset: 5px; }

/* Lab: a sky band in both themes, so text and outlines stay navy */
.lab { background: var(--sky); color: var(--navy); border-bottom: 4px solid var(--navy); }
.lab-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 48px 64px; padding-top: 88px; padding-bottom: 96px; }
.lab-main { flex: 999 1 560px; min-width: 0; }
.lab .eyebrow { color: var(--navy); }
.lab h2 { margin: 4px 0 16px; }
.lab .lead { margin-bottom: 36px; max-width: 32em; color: var(--navy); }
.products { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; }
.products .card { gap: 10px; padding: 26px 24px; font-size: 16px; line-height: 1.5; border-color: var(--navy); box-shadow: 6px 6px 0 var(--navy); }
.products h3 { font-size: 30px; font-weight: 800; }
.products .card > a { margin-top: auto; padding: 8px 0; font-weight: 600; }
.products .navy { box-shadow: 6px 6px 0 var(--on-navy); }
.products .navy > a { color: var(--gold); }
.products .tag { border-color: var(--navy); }
.products .tilt-l { transform: rotate(-.8deg); }
.products .tilt-r { transform: rotate(.8deg); }
.dice { flex: 1 1 260px; max-width: 320px; margin: 0 auto; }

/* Contact: a navy band in both themes */
.talk { background: var(--navy); color: var(--on-navy); }
.talk-inner { display: flex; flex-direction: column; align-items: flex-start; gap: 22px; padding-top: 88px; padding-bottom: 96px; }
.talk h2 { font-size: clamp(40px, 5vw, 68px); line-height: 1; letter-spacing: -.01em; }
.talk .lead { font-size: 20px; color: var(--on-navy-muted); max-width: 32em; }
.talk .btn { margin-top: 12px; }
.talk p:last-child { font-size: 17px; color: var(--on-navy-muted); }
.talk p a { color: var(--gold); font-weight: 600; }
.gold-text { color: var(--gold); }
footer { border-top: 2px solid #2B3A6E; }
.foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; padding-top: 24px; padding-bottom: 24px; font-size: 14px; color: #C9CDE0; }
.foot-brand { display: flex; align-items: center; gap: 10px; }

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