/* ==========================================================
   Pleasant Mischief — site styles
   Plain CSS, no build step. Colours live in :root.
   ========================================================== */

@font-face {
  font-family: "Fraunces";
  src: url("/fonts/fraunces-latin-soft-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Fraunces";
  src: url("/fonts/fraunces-latin-wght-italic.woff2") format("woff2");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("/fonts/instrument-sans-latin-wght-normal.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #faf5ec;
  --paper-deep: #f2eadc;
  --ink: #161413;
  --ink-soft: #4a4541;
  --red: #e2402a;        /* signature accent — from the smile */
  --red-ink: #c22e1a;    /* darker red for small text (AA contrast on paper) */
  --rule: #d9cfbf;
  --red-btn: #cf3420;   /* button fill: white text passes AA */

  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
  --sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

  --gutter: clamp(1rem, 5vw, 4rem);
  --max: 76rem;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 5rem; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: clamp(1rem, .95rem + .25vw, 1.125rem);
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* faint paper grain — a single inline SVG, no image request */
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none; z-index: 100;
  opacity: .35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .3  0 0 0 0 .25  0 0 0 0 .2  0 0 0 .08 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

::selection { background: var(--red); color: var(--paper); }

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

a { color: inherit; text-decoration-thickness: 1.5px; text-underline-offset: .18em; }
a:hover { color: var(--red-ink); }

:focus-visible {
  outline: 2.5px solid var(--red);
  outline-offset: 4px;
  border-radius: 3px;
}

.skip {
  position: absolute; left: -999px; top: .5rem;
  background: var(--ink); color: var(--paper);
  padding: .6rem 1rem; z-index: 200; border-radius: 4px;
}
.skip:focus { left: .5rem; }

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

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* ---------- type ---------- */

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 560;
  line-height: 1.05;
  letter-spacing: -.015em;
  font-variation-settings: "SOFT" 100;
  margin: 0;
}

.kicker {
  font-family: var(--sans);
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--red-ink);
  margin: 0 0 1.25rem;
  display: flex; align-items: center; gap: .7rem;
}
.kicker::before {
  content: ""; width: 1.8rem; height: 2px; background: currentColor;
  border-radius: 2px; transform: rotate(-4deg);
}

.lede {
  font-family: var(--serif);
  font-size: clamp(1.25rem, 1.05rem + .8vw, 1.6rem);
  line-height: 1.4;
  font-weight: 380;
}

em, .italic { font-family: var(--serif); font-style: italic; }

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

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s;
}
.site-header.scrolled { border-bottom-color: var(--rule); }

.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; min-height: 4.25rem;
}

.brand {
  display: flex; align-items: center; gap: .65rem;
  text-decoration: none; color: var(--ink);
  font-family: var(--serif); font-weight: 600; font-size: 1.05rem;
  letter-spacing: -.01em;
}
.brand:hover { color: var(--ink); }
.brand img { width: 3.1rem; height: auto; transition: transform .5s var(--ease); }
.brand:hover img { transform: rotate(-8deg) scale(1.06); }

.nav { display: flex; gap: clamp(.9rem, 2.2vw, 2rem); font-size: .95rem; }
.nav a { text-decoration: none; position: relative; padding-block: .3rem; }
.nav a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
  background: var(--red); border-radius: 2px;
  transform: scaleX(0) rotate(-2deg); transform-origin: left;
  transition: transform .35s var(--ease);
}
.nav a:hover::after, .nav a[aria-current="page"]::after { transform: scaleX(1) rotate(-2deg); }
.nav a:hover { color: var(--ink); }

.nav-toggle { display: none; }

@media (max-width: 760px) {
  .brand span { display: none; }
  .nav-toggle {
    display: inline-flex; align-items: center; gap: .5rem;
    background: none; border: 1.5px solid var(--ink); border-radius: 999px;
    padding: .45rem .95rem; font: 600 .85rem var(--sans); color: var(--ink); cursor: pointer;
  }
  .nav {
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; gap: 0;
    background: var(--paper); border-bottom: 1px solid var(--rule);
    padding: .5rem var(--gutter) 1.25rem;
    display: none;
  }
  .nav.open { display: flex; }
  .nav a { padding: .8rem 0; font-family: var(--serif); font-size: 1.35rem; border-bottom: 1px dashed var(--rule); }
  .nav a::after { display: none; }
}

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

.hero { padding-block: clamp(2.5rem, 7vw, 6rem) clamp(3rem, 8vw, 7rem); }

.hero .wrap {
  display: grid; gap: clamp(2rem, 5vw, 5rem);
  align-items: center;
}
@media (min-width: 860px) {
  .hero .wrap { grid-template-columns: 1fr 1.05fr; }
}

/* The logo, built from four faithful layers so the face can move */
.logo-stack {
  display: block;
  position: relative;
  width: min(100%, 30rem);
  aspect-ratio: 1032 / 996;
  margin-inline: auto;
}
.logo-stack img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  user-select: none; -webkit-user-drag: none;
}
/* transform origins = centre of each feature within the logo */
.logo-stack .eye-open   { transform-origin: 72.4% 66%; }
.logo-stack .eye-closed { transform-origin: 33.9% 77.5%; }
.logo-stack .smile      { transform-origin: 55.3% 87.7%; transition: transform .6s var(--ease); }
.logo-stack .words      { transform-origin: 50% 30%; }

.logo-stack.blink .eye-open { animation: blink .26s ease-in-out; }
@keyframes blink {
  0%, 100% { transform: scaleY(1); }
  45%, 55% { transform: scaleY(.08); }
}
.logo-stack:hover .smile, .logo-stack.grin .smile { transform: scale(1.12, 1.18) rotate(-3deg); }
.logo-stack.load .words { animation: settle 1.2s var(--ease) both; }
.logo-stack.load .eye-open,
.logo-stack.load .eye-closed { animation: pop .7s var(--ease) .55s both; }
.logo-stack.load .smile { animation: pop .8s var(--ease) .8s both; }
@keyframes settle { from { opacity: 0; transform: translateY(10px) rotate(-2deg); } }
@keyframes pop { from { opacity: 0; transform: scale(.6); } }

.hero h1 { margin: 0; }
.hero .tagline {
  font-family: var(--serif);
  font-weight: 520;
  font-size: clamp(2.3rem, 1.4rem + 3.8vw, 4.4rem);
  line-height: 1.02;
  letter-spacing: -.025em;
  color: var(--ink);
  margin: 0 0 1.5rem;
  text-wrap: balance;
}
.hero .tagline .not { font-style: italic; font-weight: 400; color: var(--red-ink); }

.hero .little {
  font-family: var(--serif); font-style: italic;
  font-size: clamp(1.1rem, 1rem + .4vw, 1.35rem);
  margin: 0 0 1.75rem;
}
.hero .little span { white-space: nowrap; }
.trouble { position: relative; display: inline-block; }
.trouble svg {
  position: absolute; left: -4%; width: 108%; bottom: -.55em; height: .7em;
  overflow: visible;
}

.hero p { max-width: 34rem; color: var(--ink-soft); }
.hero p strong { color: var(--ink); font-weight: 600; }

/* ---------- hand-drawn stroke reveal ---------- */

.draw path[pathLength], path.draw {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 1.1s var(--ease);
}
.in .draw path[pathLength], .in path.draw, .draw.in path[pathLength] { stroke-dashoffset: 0; }

.reveal { opacity: 0; transform: translateY(18px); transition: opacity .9s var(--ease), transform .9s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- section scaffolding ---------- */

section { position: relative; }
.section { padding-block: clamp(4rem, 10vw, 8.5rem); }

.squiggle-rule { width: 100%; height: 18px; color: var(--ink); opacity: .85; }

/* ---------- philosophy ---------- */

.philosophy .statement {
  font-family: var(--serif);
  font-weight: 420;
  font-size: clamp(1.9rem, 1.2rem + 3vw, 3.6rem);
  line-height: 1.12;
  letter-spacing: -.02em;
  max-width: 22ch;
  margin: 0;
  text-wrap: pretty;
}
@media (min-width: 900px) { .philosophy .statement { max-width: 24ch; } }
.philosophy .statement em { color: var(--red-ink); }

/* the playful surprise: "upside down" flips */
.flip {
  display: inline-block;
  font-style: italic;
  color: var(--red-ink);
  transition: transform .9s cubic-bezier(.5, -.4, .3, 1.4);
}
.flip.flipped { transform: rotate(180deg); }
.flip:hover { transform: rotate(180deg); }
.flip.flipped:hover { transform: rotate(0); }

.philosophy .aside {
  margin-top: clamp(2rem, 4vw, 3rem);
  display: flex; align-items: center; gap: 1rem;
  font-family: var(--serif); font-style: italic; font-size: 1.2rem;
  color: var(--ink-soft);
}
.philosophy .aside svg { width: 3.2rem; flex: none; color: var(--red); }

/* ---------- what we make ---------- */

.make h2 {
  font-size: clamp(2.4rem, 1.5rem + 4vw, 5rem);
  margin-bottom: clamp(2.5rem, 6vw, 4.5rem);
}
.make h2 em { font-weight: 400; }

.disciplines { list-style: none; margin: 0; padding: 0; }
.discipline {
  display: grid;
  grid-template-columns: 3.2rem 1fr;
  gap: 1.25rem 1.5rem;
  padding-block: clamp(1.75rem, 4vw, 2.75rem);
  border-top: 1.5px solid var(--ink);
  align-items: start;
}
.discipline:last-child { border-bottom: 1.5px solid var(--ink); }
.discipline .num {
  font-family: var(--serif); font-style: italic; font-weight: 400;
  font-size: 1.5rem; color: var(--red-ink); line-height: 1;
  padding-top: .35rem;
}
.discipline h3 {
  font-size: clamp(1.8rem, 1.3rem + 2vw, 3rem);
  margin-bottom: .6rem;
}
.discipline p { margin: 0; max-width: 32rem; color: var(--ink-soft); }
.discipline .doodle {
  grid-column: 2;
  width: clamp(7rem, 22vw, 11rem);
  color: var(--ink);
}
.discipline .doodle .r { stroke: var(--red); }
.discipline .doodle .rf { fill: var(--red); }

@media (min-width: 760px) {
  .discipline { grid-template-columns: 4rem 1fr 13rem; }
  .discipline .doodle { grid-column: 3; grid-row: 1; justify-self: end; }
}

.discipline .doodle svg { transition: transform .6s var(--ease); }
.discipline:hover .doodle svg { transform: rotate(-6deg) scale(1.05); }

/* ---------- featured project ---------- */

.featured {
  background: var(--ink);
  color: var(--paper);
  border-radius: clamp(0px, 3vw, 2.5rem);
  margin-inline: clamp(0rem, 2vw, 1.5rem);
  overflow: hidden;
}
.featured .kicker { color: #ff8a73; }
.featured a:hover { color: #ff8a73; }

.featured-grid { display: grid; gap: clamp(2.5rem, 6vw, 5rem); }
@media (min-width: 960px) { .featured-grid { grid-template-columns: 1.1fr .9fr; align-items: center; } }

.featured h2 {
  font-size: clamp(2.6rem, 1.4rem + 5vw, 5.6rem);
  letter-spacing: -.03em;
  margin-bottom: 1.25rem;
}
.featured .promise {
  font-family: var(--serif); font-style: italic; font-weight: 380;
  font-size: clamp(1.3rem, 1.1rem + 1vw, 1.9rem);
  line-height: 1.25;
  margin: 0 0 1.75rem;
  color: #ffd8cf;
}
.featured p { color: #d9d2c7; max-width: 36rem; }
.featured .no-tv {
  display: inline-flex; align-items: center; gap: .6rem;
  font-weight: 600; color: var(--paper);
}
.featured .no-tv svg { width: 1.6rem; color: var(--red); }

.games { list-style: none; padding: 0; margin: 2.25rem 0 0; display: grid; gap: 1.1rem; }
.game {
  display: grid; grid-template-columns: 2.75rem 1fr; gap: 1rem; align-items: start;
  padding-top: 1.1rem; border-top: 1px dashed #5a524c;
}
.game svg { width: 2.75rem; color: var(--paper); }
.game svg .r { stroke: var(--red); }
.game h3 { font-size: 1.45rem; margin-bottom: .2rem; font-weight: 520; }
.game p { margin: 0; font-size: .98rem; }

.status {
  margin-top: 2.25rem;
  display: inline-flex; align-items: center; gap: .6rem;
  font-size: .85rem; letter-spacing: .04em;
  border: 1px solid #5a524c; border-radius: 999px; padding: .45rem 1rem;
  color: #d9d2c7;
}
.status .dot { width: .55rem; height: .55rem; border-radius: 50%; background: var(--red); animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }

.button {
  display: inline-flex; align-items: center; gap: .7rem;
  margin-top: 2rem;
  padding: .95rem 1.6rem;
  border-radius: 999px;
  background: var(--red-btn);
  color: #fff;
  font-weight: 600; text-decoration: none;
  transition: transform .35s var(--ease), background .3s;
}
.button svg { width: 1.3rem; transition: transform .35s var(--ease); }
.button:hover { color: #fff; background: var(--red-ink); transform: rotate(-1.5deg); }
.button:hover svg { transform: translateX(4px); }
.featured .button { color: #fff; }

.table-art { width: 100%; max-width: 32rem; margin-inline: auto; color: var(--paper); }
.table-art .r { stroke: var(--red); }
.table-art .rf { fill: var(--red); }
.table-art .phone { transition: transform .8s var(--ease); transform-box: fill-box; transform-origin: center; }
.table-art:hover .p1 { transform: rotate(-8deg) translateY(-4px); }
.table-art:hover .p2 { transform: rotate(6deg) translateY(-6px); }
.table-art:hover .p3 { transform: rotate(-4deg) translateY(-3px); }
.table-art:hover .p4 { transform: rotate(9deg) translateY(-5px); }

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

.contact { text-align: center; }
.contact h2 {
  font-size: clamp(2.4rem, 1.3rem + 5vw, 5.4rem);
  letter-spacing: -.03em;
  max-width: 14ch; margin: 0 auto 1.5rem;
  text-wrap: balance;
}
.contact h2 em { color: var(--red-ink); font-weight: 400; }
.contact p { color: var(--ink-soft); margin: 0 auto; max-width: 30rem; }
.email {
  display: inline-block; position: relative;
  margin-top: 2.25rem;
  font-family: var(--serif); font-weight: 480;
  font-size: clamp(1.4rem, 1rem + 2.4vw, 2.6rem);
  text-decoration: none; letter-spacing: -.01em;
  word-break: break-word;
}
.email svg { position: absolute; left: -3%; width: 106%; bottom: -.4em; height: .5em; overflow: visible; }
.email:hover { color: var(--ink); }
.email:hover svg path { animation: wiggle .5s ease-in-out; }
@keyframes wiggle { 50% { transform: translateY(-2px) scaleX(.98); } }
.contact .place { margin-top: 2rem; font-size: .95rem; letter-spacing: .04em; }

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

.site-footer {
  border-top: 1.5px solid var(--ink);
  padding-block: 3rem 2.5rem;
  font-size: .92rem;
}
.site-footer .wrap { display: grid; gap: 2rem; }
@media (min-width: 760px) { .site-footer .wrap { grid-template-columns: auto 1fr auto; align-items: end; } }

.foot-brand { display: flex; gap: 1rem; align-items: center; }
.foot-face { width: 4.25rem; cursor: pointer; transition: transform .4s var(--ease); }
.foot-face:hover { transform: rotate(10deg) scale(1.08); }
.foot-brand address { font-style: normal; line-height: 1.5; }
.foot-brand strong { font-family: var(--serif); font-size: 1.1rem; font-weight: 600; }
.foot-links { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; justify-self: start; }
@media (min-width: 760px) { .foot-links { justify-self: center; } }
.copyright { color: var(--ink-soft); margin: 0; }

/* ---------- inner pages (privacy / support / terms) ---------- */

.page-head { padding-block: clamp(3rem, 8vw, 6rem) clamp(2rem, 4vw, 3rem); }
.page-head h1 { font-size: clamp(2.5rem, 1.5rem + 4.5vw, 5rem); letter-spacing: -.03em; max-width: 16ch; }
.page-head .updated { margin-top: 1.25rem; color: var(--ink-soft); font-size: .92rem; }

.prose { max-width: 44rem; padding-bottom: clamp(4rem, 9vw, 7rem); }
.prose h2 {
  font-size: clamp(1.5rem, 1.25rem + 1vw, 2rem);
  margin: 3rem 0 .9rem;
  display: flex; gap: .8rem; align-items: baseline;
}
.prose h2 .n { font-style: italic; font-weight: 400; color: var(--red-ink); font-size: .8em; }
.prose h3 { font-size: 1.2rem; margin: 2rem 0 .5rem; font-weight: 600; }
.prose p, .prose li { color: #2b2724; }
.prose ul, .prose ol { padding-left: 1.3rem; }
.prose li { margin-bottom: .45rem; }
.prose li::marker { color: var(--red); }
.prose .note {
  border-left: 3px solid var(--red);
  padding: .9rem 1.2rem; margin: 1.75rem 0;
  background: var(--paper-deep); border-radius: 0 8px 8px 0;
  font-size: .97rem;
}
.prose .contact-card {
  margin-top: 1.25rem; padding: 1.25rem 1.4rem;
  border: 1.5px solid var(--ink); border-radius: 14px;
  font-style: normal;
}

.steps { counter-reset: step; list-style: none; padding: 0 !important; }
.steps li {
  counter-increment: step; position: relative;
  padding-left: 3rem; margin-bottom: 1.1rem;
}
.steps li::before {
  content: counter(step);
  position: absolute; left: 0; top: -.1rem;
  width: 2rem; height: 2rem; border-radius: 50%;
  border: 1.5px solid var(--ink);
  display: grid; place-items: center;
  font-family: var(--serif); font-style: italic; font-size: 1rem;
}

.toc, .prose .toc { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 1rem; padding: 0; list-style: none; }
.toc a {
  display: inline-block; padding: .35rem .9rem; border: 1px solid var(--rule);
  border-radius: 999px; text-decoration: none; font-size: .9rem;
}
.toc a:hover { border-color: var(--red); }

/* ---------- reduced motion: everything visible, nothing moves ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  .reveal { opacity: 1; transform: none; }
  .draw path[pathLength], path.draw { stroke-dashoffset: 0; }
  .flip.flipped { transform: none; }
}

@media print {
  body::before, .site-header, .nav-toggle { display: none; }
  .featured { background: none; color: var(--ink); }
}
