/* CATherapy studio — shared layout and behaviour styles.
   Directions (css/dir-a.css, dir-b.css, dir-c.css) only change tokens and decoration. */

:root {
  --header-h: 64px;
  --maxw: 1120px;
  --gutter: 16px;
  --section-pad: 56px;

  /* tokens every direction overrides */
  --bg: #fdfbf0;
  --surface: #ffffff;
  --ink: #2a1d17;
  --ink-soft: #5c4a40;
  --heading: var(--ink);
  --accent: #b9513b;
  --accent-ink: #fffaf2;
  --accent-2: transparent;
  --accent-2-ink: var(--ink);
  --line: rgba(42, 29, 23, .18);
  --focus: #1a5fb4;
  --header-bg: rgba(253, 251, 240, .94);
  --font-head: system-ui, sans-serif;
  --font-body: system-ui, sans-serif;
  --head-weight: 700;
  --radius: 12px;
  --btn-radius: 999px;
  --card-radius: 10px;
  --card-shadow: 0 10px 24px rgba(0, 0, 0, .18);

  /* yarn thread */
  --thread-main: #b9513b;
  --thread-outline: #5e2318;
  --thread-ply: rgba(0, 0, 0, .28);
  --thread-sheen: rgba(255, 255, 255, .55);
  --thread-w: 6px;          /* main strand */
  --thread-ow: 2px;         /* outline thickness on each side */
}
@media (min-width: 700px)  { :root { --gutter: 32px; --section-pad: 72px; } }
@media (min-width: 1100px) { :root { --gutter: 48px; --section-pad: 88px; } }

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--header-h) + 8px); -webkit-text-size-adjust: 100%; }
html[data-motion="full"] { scroll-behavior: smooth; }
body {
  margin: 0;
  position: relative;               /* containing block for the thread layer */
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;                  /* 16px — Callee: smaller body text */
  line-height: 1.6;
  overflow-x: clip;                 /* safety net; layout itself never overflows */
}
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3 { font-family: var(--font-head); font-weight: var(--head-weight); color: var(--heading); line-height: 1.12; margin: 0 0 .5em; text-wrap: balance; }
h1 { font-size: clamp(1.9rem, 1.2rem + 2.4vw, 3rem); }
h2 { font-size: clamp(1.6rem, 1.1rem + 1.7vw, 2.4rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

.skip-link { position: absolute; left: 8px; top: -60px; z-index: 100; background: #fff; color: #000; padding: 8px 12px; border-radius: 6px; }
.skip-link:focus { top: 8px; }

.wrap { width: min(var(--maxw), 100% - 2 * var(--gutter)); margin-inline: auto; position: relative; z-index: 2; }

/* ---------------------------------------------------------------- thread */
.thread-layer { position: absolute; top: 0; left: 0; width: 100%; height: 0; overflow: hidden; pointer-events: none; z-index: 1; }
.thread-svg { display: block; width: 100%; height: 100%; overflow: hidden; }
.thread-svg path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.thread-outline { stroke: var(--thread-outline); stroke-width: calc(var(--thread-w) + 2 * var(--thread-ow)); }
.thread-main    { stroke: var(--thread-main); stroke-width: var(--thread-w); }
.thread-ply     { stroke: var(--thread-ply); stroke-width: calc(var(--thread-w) * .8); stroke-dasharray: 1.6 5.2; stroke-linecap: butt !important; }
.thread-sheen   { stroke: var(--thread-sheen); stroke-width: max(1px, calc(var(--thread-w) * .2)); transform: translate(-1px, -1.2px); }

/* ---------------------------------------------------------------- header */
.site-header { position: sticky; top: 0; z-index: 50; height: var(--header-h); background: var(--header-bg); backdrop-filter: none; border-bottom: 1px solid var(--line); }
.header-inner { height: 100%; display: flex; align-items: center; gap: 24px; }
.header-brand { flex: none; display: block; }
.header-brand img { height: 40px; width: auto; }
.site-nav { margin-left: auto; display: flex; align-items: center; gap: 28px; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 24px; }
.site-nav ul a { text-decoration: none; font-weight: 600; font-size: .95rem; padding: 6px 0; border-bottom: 2px solid transparent; }
.site-nav ul a:hover { border-bottom-color: currentColor; }
.menu-toggle { display: none; margin-left: auto; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border: 1.5px solid var(--line); border-radius: 8px; background: transparent; cursor: pointer; font-weight: 700; font-size: .9rem; }
.menu-toggle-bars, .menu-toggle-bars::before, .menu-toggle-bars::after { display: block; width: 16px; height: 2px; background: currentColor; border-radius: 2px; position: relative; }
.menu-toggle-bars::before, .menu-toggle-bars::after { content: ""; position: absolute; left: 0; }
.menu-toggle-bars::before { top: -5px; } .menu-toggle-bars::after { top: 5px; }

@media (max-width: 899px) {
  .menu-toggle { display: inline-flex; }
  .site-nav { display: none; position: absolute; top: var(--header-h); left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 12px; padding: 12px var(--gutter) 20px; background: var(--header-bg); border-bottom: 1px solid var(--line); }
  .nav-open .site-nav { display: flex; }
  .site-nav ul { flex-direction: column; gap: 0; }
  .site-nav ul a { display: block; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .header-brand img { height: 34px; }
}

/* ---------------------------------------------------------------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 24px; border-radius: var(--btn-radius); font-weight: 700; font-size: 1rem; line-height: 1.1; text-decoration: none; border: 2px solid transparent; cursor: pointer; white-space: nowrap; transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-secondary { background: var(--accent-2); color: var(--accent-2-ink); border-color: currentColor; }
.btn:hover { transform: translateY(-1px); }
.btn-small { min-height: 40px; padding: 0 16px; font-size: .9rem; }
.cta-row { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px 16px; }
.cta-primary { display: inline-flex; flex-direction: column; align-items: center; gap: 6px; }
.cta-note { font-size: .82rem; color: var(--ink-soft); height: 1.3em; white-space: nowrap; }

/* ---------------------------------------------------------------- sections */
main { display: block; }
.section { position: relative; padding-block: var(--section-pad); overflow-x: clip; }
.section-head { max-width: 640px; }
.section-head p { color: var(--ink-soft); }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .78rem; font-weight: 700; color: var(--ink-soft); margin-bottom: .6em; }
.prop { display: none; position: absolute; pointer-events: none; z-index: 0; }

/* hero */
.hero { padding-block: 24px 32px; min-height: min(calc(100svh - var(--header-h)), 900px); display: flex; align-items: center; }
.hero-backdrop { position: absolute; inset: 0; pointer-events: none; }
.hero-inner { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr); gap: 40px; align-items: center; }
.hero-wordmark { width: min(400px, 85%); height: auto; margin: 0 0 18px -6px; }
.hero h1 { max-width: 15em; }
.hero-line { font-size: 1.08rem; max-width: 32em; color: var(--ink-soft); margin-bottom: 26px; }
.hero-art { position: relative; margin: 0; }
.hero-art img { display: none; }
.hero-art .yarn { position: absolute; }
.box3d-stage, .meowple, .meowple-legend { display: none; }
/* 3D box geometry (shown by directions that use it): front = lid face, right = wordmark flap,
   top = banner flap; depth is the dieline flap depth, 622/1963 of the face. */
.box3d-stage { --d: calc(var(--s, 300px) * .3169); }
.box3d { position: absolute; left: calc(var(--s, 300px) * .1); top: calc(var(--s, 300px) * .16); width: var(--s, 300px); height: var(--s, 300px); transform-style: preserve-3d;
  transform: rotateX(calc(-9deg + var(--tilt-x, 0deg))) rotateY(calc(-25deg + var(--tilt-y, 0deg))); }
.box3d-face { position: absolute; overflow: hidden; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.box3d-face img { display: block; width: 100%; height: 100%; }
.box3d-front { left: 0; top: 0; width: var(--s, 300px); height: var(--s, 300px); transform: translateZ(calc(var(--d) / 2)); }
.box3d-right { top: 0; left: calc((var(--s, 300px) - var(--d)) / 2); width: var(--d); height: var(--s, 300px); transform: rotateY(90deg) translateZ(calc(var(--s, 300px) / 2)); }
.box3d-top { left: 0; top: calc((var(--s, 300px) - var(--d)) / 2); width: var(--s, 300px); height: var(--d); transform: rotateX(90deg) translateZ(calc(var(--s, 300px) / 2)); }
.box3d-shadow { position: absolute; left: 6%; right: 4%; bottom: 8%; height: 14%; border-radius: 50%; pointer-events: none;
  background: radial-gradient(closest-side, rgba(42, 29, 23, .55), rgba(42, 29, 23, .22) 55%, rgba(42, 29, 23, 0)); filter: blur(4px); transform: skewX(-18deg); }

@media (max-width: 899px) {
  .hero { min-height: 0; }
  .hero-inner { grid-template-columns: 1fr; gap: 28px; }
  .hero-wordmark { width: min(300px, 80%); }
}

/* what it is */
.what-grid { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.25fr); gap: 48px; align-items: center; }
.points { list-style: none; margin: 1.4em 0 0; padding: 0; display: grid; gap: 14px; }
.points li { padding-left: 34px; position: relative; color: var(--ink-soft); }
.points li strong { color: var(--ink); }
.points li::before { content: counter(list-item); position: absolute; left: 0; top: .1em; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: .78rem; font-weight: 800; background: var(--accent); color: var(--accent-ink); font-family: var(--font-body); }
.table-shot { margin: 0; }
.table-shot img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--radius); box-shadow: var(--card-shadow); }
.table-shot figcaption { font-size: .88rem; color: var(--ink-soft); margin-top: 10px; font-style: italic; }
/* live 3D setup slot (shown by Direction B; see css/dir-b.css and js/table-mount.js) */
.table-live, .table-hint { display: none; }
.facts { margin: 40px 0 0; font-weight: 700; letter-spacing: .02em; text-align: center; font-size: 1.02rem; }
.facts span { margin: 0 .5em; color: var(--accent); }
@media (max-width: 899px) { .what-grid { grid-template-columns: 1fr; gap: 28px; } }

/* cats: hover fan */
.fan { --card-w: 190px; --spread: 118px; --angle: 7deg; position: relative; height: calc(var(--card-w) * 1.4 + 90px); margin-top: 24px; }
.fan-card { position: absolute; left: calc(50% - var(--card-w) / 2); bottom: 16px; width: var(--card-w); aspect-ratio: 5 / 7; padding: 0; border: 0; background: none; cursor: pointer; border-radius: var(--card-radius);
  transform-origin: 50% 130%;
  transform: translateX(calc((var(--i) - var(--mid, 2.5)) * var(--spread))) translateY(calc(var(--d, 0) * 10px)) rotate(calc((var(--i) - var(--mid, 2.5)) * var(--angle)));
  transition: transform .35s cubic-bezier(.2, .8, .2, 1), box-shadow .35s ease; z-index: 1; }
.fan-card img { width: 100%; height: 100%; border-radius: var(--card-radius); box-shadow: var(--card-shadow); }
.fan-card.is-selected, .fan-card:focus-visible { z-index: 10;
  transform: translateX(calc((var(--i) - var(--mid, 2.5)) * var(--spread))) translateY(-44px) rotate(0deg) scale(1.08); }
@media (hover: hover) {
  .fan-card:hover { z-index: 10; transform: translateX(calc((var(--i) - var(--mid, 2.5)) * var(--spread))) translateY(-44px) rotate(0deg) scale(1.08); }
}
@media (max-width: 699px) { .fan { --card-w: 112px; --spread: 33px; --angle: 5deg; height: calc(var(--card-w) * 1.4 + 76px); } }

/* clients: flip cards */
.hint { font-size: .95rem; display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: baseline; }
.counter { display: inline-block; width: 11.5em; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.flip-row { list-style: none; margin: 28px 0 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 20px; }
.flip-row li { flex: 0 0 calc((100% - 4 * 20px) / 5); }
.flip-card { display: block; width: 100%; aspect-ratio: 5 / 7; padding: 0; border: 0; background: none; cursor: pointer; perspective: 1200px; border-radius: var(--card-radius); }
.flip-inner { position: relative; display: block; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .7s cubic-bezier(.3, .7, .2, 1); }
.flip-card[aria-pressed="true"] .flip-inner { transform: rotateY(180deg); }
.flip-face { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: var(--card-radius); box-shadow: var(--card-shadow); backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.flip-back { transform: rotateY(180deg); }
.flip-card:hover .flip-inner { translate: 0 -4px; }
@media (max-width: 699px) {
  .flip-row { gap: 12px; }
  .flip-row li { flex-basis: calc((100% - 2 * 12px) / 3); }
}

/* office: room tile pile */
.office-grid { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 40px; align-items: center; }
.spread-toggle { width: 13em; margin-top: 8px; }
.office-board { display: flex; justify-content: center; }
.room-pile { --tw: 190px; --th: calc(var(--tw) * .875); position: relative; display: block; width: calc(var(--tw) * 2.5); height: calc(var(--th) * 3.5); padding: 0; border: 0; background: none; cursor: pointer; border-radius: 16px; }
.room { position: absolute; left: 0; top: 0; width: var(--tw); height: var(--th); filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .22));
  transform: translate(calc(var(--tw) * .75 + var(--sx)), calc(var(--th) * 1.25 + var(--sy))) rotate(var(--rot));
  transition: transform .75s cubic-bezier(.2, .8, .2, 1);
  transition-delay: calc((2 - var(--r)) * 70ms + var(--c) * 40ms); }
.room-pile.is-spread .room {
  transform: translate(calc(var(--c) * var(--tw) * .75), calc((var(--r) + var(--o, 0)) * var(--th))) rotate(0deg);
  transition-delay: calc(var(--r) * 60ms + var(--c) * 40ms); }
@media (max-width: 899px) { .office-grid { grid-template-columns: 1fr; gap: 20px; } }
@media (max-width: 699px) { .room-pile { --tw: 128px; } }

/* how it plays */
.how-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 48px; align-items: center; }
.how-intro { color: var(--ink-soft); margin: 0; }
.how-outro strong { color: var(--ink); }
.steps { list-style: none; margin: 1em 0 1.6em; padding: 0; display: grid; gap: 18px; }
.steps li { display: grid; grid-template-columns: 44px 1fr; gap: 14px; align-items: start; }
.steps p { margin: 0; padding-top: 8px; color: var(--ink-soft); }
.steps strong { color: var(--ink); }
.step-n { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; font-family: var(--font-head); font-weight: 800; font-size: 1.2rem; background: var(--accent); color: var(--accent-ink); }
.how-art { position: relative; margin: 0; }
.how-art img { display: none; }
@media (max-width: 899px) { .how-grid { grid-template-columns: 1fr; gap: 24px; } }

/* creators */
.people { list-style: none; margin: 8px 0 32px; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; }
.person img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; object-position: 50% 25%; border-radius: var(--radius); margin-bottom: 14px; box-shadow: var(--card-shadow); }
.person h3 { margin: 0 0 2px; }
.person p { margin: 0; }
.person .role { color: var(--ink-soft); font-size: .95rem; }
.person .handle { font-weight: 700; font-size: .92rem; color: var(--ink-soft); }
.creators-copy { max-width: 46em; color: var(--ink-soft); }
@media (max-width: 699px) {
  .people { grid-template-columns: 1fr; gap: 20px; }
  .person { display: grid; grid-template-columns: 104px 1fr; grid-template-rows: 1fr auto auto auto 1fr; column-gap: 16px; }
  .person img { margin: 0; aspect-ratio: 1; grid-column: 1; grid-row: 1 / 6; }
  .person h3, .person p { grid-column: 2; }
  .person h3 { grid-row: 2; } .person .role { grid-row: 3; } .person .handle { grid-row: 4; }
}

/* follow / contact */
.follow-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 56px; align-items: start; }
.follow-main .cta-primary { align-items: flex-start; }
.signup { margin-top: 28px; }
.signup-intro { color: var(--ink-soft); }
.fields { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 12px; align-items: end; }
.fields label span { display: block; font-size: .85rem; font-weight: 700; margin-bottom: 4px; }
.fields input { width: 100%; height: 48px; padding: 0 14px; font: inherit; color: var(--ink); background: var(--surface); border: 1.5px solid var(--line); border-radius: 10px; }
.form-status { height: 1.6em; margin: 10px 0 0; font-weight: 700; font-size: .95rem; }
.contact h3 { margin-bottom: .4em; }
.contact a { font-weight: 700; overflow-wrap: anywhere; }
.socials { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
@media (max-width: 899px) { .follow-grid { grid-template-columns: 1fr; gap: 32px; } }
@media (max-width: 599px) { .fields { grid-template-columns: 1fr; } .fields .btn { width: 100%; } .form-status { height: 3.2em; } }

/* footer */
.site-footer { position: relative; z-index: 2; padding: 56px 0 40px; font-size: .88rem; color: var(--ink-soft); text-align: center; }
.site-footer p { margin: 0; }

/* ---------------------------------------------------------------- reveals */
html.js[data-motion="full"]:not([data-capture]) [data-reveal] { opacity: 0; transform: translateY(18px); transition: opacity .7s ease, transform .7s cubic-bezier(.2, .8, .2, 1); }
html.js[data-motion="full"]:not([data-capture]) [data-reveal].is-in { opacity: 1; transform: none; }

/* ---------------------------------------------------------------- reduced motion */
html[data-motion="reduce"] *, html[data-motion="reduce"] *::before, html[data-motion="reduce"] *::after {
  transition: none !important; animation: none !important; scroll-behavior: auto !important;
}

@media print {
  .thread-layer, .site-header, .menu-toggle { display: none !important; }
  [data-reveal] { opacity: 1 !important; transform: none !important; }
}
