/* ============================================================
   thoughtworks.monster — corporate shell, feral center
   Palette + type per DESIGN.md. OKLCH throughout.
   ============================================================ */

:root {
  /* palette */
  --bg: oklch(0.115 0 0);
  --surface: oklch(0.17 0 0);
  --surface-raised: oklch(0.22 0 0);
  --ink: oklch(0.94 0.004 80);
  --muted: oklch(0.62 0.01 70);
  --primary: oklch(0.704 0.19 49);
  --primary-deep: oklch(0.55 0.17 40);
  --primary-deeper: oklch(0.42 0.13 38);
  --primary-bright: oklch(0.78 0.16 55);
  --accent: oklch(0.84 0.17 130);
  --line: oklch(0.30 0 0);

  /* type */
  --font-display: "Anybody", "Arial Black", sans-serif;
  --font-body: "Schibsted Grotesk", "Helvetica Neue", sans-serif;
  --font-mono: "Spline Sans Mono", "SF Mono", monospace;

  /* z-scale */
  --z-nav: 10;
  --z-cookie: 40;
  --z-puff: 20;

  /* motion */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);

  color-scheme: dark;
}

/* ---------- reset-ish ---------- */

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

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

h1, h2, h3 {
  text-wrap: balance;
  line-height: 1.1;
  margin: 0;
}

p {
  margin: 0;
}

a {
  color: inherit;
}

button {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

::selection {
  background: var(--primary);
  color: var(--bg);
}

.is-hidden {
  display: none !important;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: var(--z-cookie);
  background: var(--accent);
  color: var(--bg);
  padding: 0.5rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.skip-link:focus-visible {
  left: 0.5rem;
  top: 0.5rem;
}

/* ---------- shared ---------- */

main > section,
.footer-inner {
  max-width: 72rem;
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 5vw, 4rem);
}

.section-heading {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: clamp(1.5rem, 4vw, 2.5rem);
}

.tm {
  font-family: var(--font-mono);
  font-size: 0.45em;
  color: var(--muted);
  vertical-align: super;
  margin-left: 0.15em;
}

.fnref a {
  font-family: var(--font-mono);
  font-size: 0.62em;
  color: var(--primary-bright);
  text-decoration: underline dotted;
  text-underline-offset: 3px;
}

/* ---------- buttons ---------- */
.btn-primary {
  background: var(--primary);
  color: var(--bg);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  font-family: var(--font-mono);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-radius: 10px;
  border: 2px solid transparent;
  padding: 0.7rem 1.4rem;
  cursor: pointer;
  transition: transform 130ms var(--ease-out), background-color 130ms var(--ease-out),
    border-color 130ms var(--ease-out), color 130ms var(--ease-out);
}

.btn:active {
  transform: translateY(2px);
}

.btn-sm {
  padding: 0.45rem 0.95rem;
  font-size: 0.78rem;
  border-radius: 8px;
}
.btn-primary:hover {
  background: var(--primary-bright);
  color: var(--bg);
}

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
}

.btn-ghost:hover {
  color: var(--ink);
  border-color: var(--muted);
}

.btn-key {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
  min-width: 9.5rem;
}

.btn-key:hover {
  background: var(--surface-raised);
  border-color: var(--muted);
}

/* ---------- topbar ---------- */

.topbar {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 3vw, 2.5rem);
  max-width: 72rem;
  margin-inline: auto;
  padding: 1.1rem clamp(1.25rem, 5vw, 4rem);
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: var(--z-nav);
}

.wordmark {
  font-weight: 700;
  font-size: 1.05rem;
  text-decoration: none;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.wordmark-dot {
  color: var(--primary-bright);
}

.topnav {
  display: flex;
  gap: clamp(1rem, 2.5vw, 2rem);
  margin-left: auto;
}

.topnav a {
  font-size: 0.92rem;
  color: var(--muted);
  text-decoration: none;
  transition: color 130ms var(--ease-out);
}

.topnav a:hover {
  color: var(--ink);
}

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

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
  padding-top: clamp(3rem, 7vw, 5.5rem);
  padding-bottom: clamp(2rem, 5vw, 4rem);
}

.masthead {
  font-family: var(--font-display);
  font-stretch: 125%;
  font-weight: 900;
  font-size: clamp(2.6rem, 6.5vw, 5.6rem);
  line-height: 0.98;
  letter-spacing: -0.015em;
  text-transform: uppercase;
}

.masthead-monster {
  color: var(--primary);
}

.lede {
  margin-top: clamp(1.25rem, 3vw, 2rem);
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  line-height: 1.5;
  max-width: 34ch;
  color: var(--ink);
}

.proof-points {
  list-style: none;
  margin: clamp(1.25rem, 3vw, 2rem) 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--muted);
}

.proof-points li::before {
  content: "— ";
  color: var(--primary-bright);
}

/* ---------- the pen ---------- */

.pen-wrap {
  position: relative;
}

.pen {
  margin: 0;
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
}

.pen-stripes {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    -45deg,
    transparent 0 22px,
    oklch(0.704 0.19 49 / 0.045) 22px 44px
  );
}

.monster {
  display: block;
  width: min(100%, 30rem);
  margin-inline: auto;
  padding: clamp(0.75rem, 2vw, 1.5rem);
}

.monster-hit {
  position: absolute;
  inset: 0 0 2.6rem 0;
  background: transparent;
  border: 0;
  cursor: pointer;
  border-radius: 20px;
}

.pen-caption {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  padding: 0.6rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.pen-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  margin-left: auto;
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* floating reaction glyphs (hearts, crumbs) */

.puff {
  position: absolute;
  z-index: var(--z-puff);
  pointer-events: none;
  font-size: 1.15rem;
  animation: rise 900ms var(--ease-out) forwards;
}

@keyframes rise {
  from {
    opacity: 1;
    transform: translate(-50%, 0) scale(0.7) rotate(var(--spin, 0deg));
  }
  to {
    opacity: 0;
    transform: translate(-50%, -84px) scale(1.25) rotate(var(--spin, 0deg));
  }
}

/* ---------- monster svg ---------- */

.m-tail,
.m-horn,
.m-arm,
.m-foot {
  fill: var(--primary-deep);
}

.m-tail {
  transform-origin: 96px 220px;
  animation: sway 4.2s ease-in-out infinite alternate;
}

@keyframes sway {
  from { transform: rotate(-3deg); }
  to { transform: rotate(4deg); }
}

#monster-root {
  transform-origin: 160px 272px;
  animation: breathe 4s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.016); }
}

.m-body {
  fill: var(--primary);
}

.m-belly {
  fill: var(--accent);
  opacity: 0.92;
}

.m-stitch path {
  stroke: oklch(0.45 0.13 130);
  stroke-width: 2.5;
  stroke-linecap: round;
}

.m-strap {
  stroke: var(--line);
  stroke-width: 4;
  fill: none;
}

.m-badge rect {
  fill: var(--surface-raised);
  stroke: var(--line);
}

.m-badge text {
  font-family: var(--font-mono);
  font-size: 7.5px;
  fill: var(--muted);
}

.m-sclera {
  fill: var(--ink);
}

.m-iris {
  fill: var(--primary-deep);
}

.m-pupil {
  fill: oklch(0.15 0 0);
}

.m-sparkle {
  fill: var(--ink);
}

#iris-group {
  will-change: transform;
}

.m-lid {
  fill: var(--primary);
  transform-origin: 160px 122px;
  transform: scaleY(0);
  transition: transform 110ms var(--ease-out);
}

.monster.is-blinking .m-lid {
  transform: scaleY(1);
}

.m-cheek {
  fill: var(--primary-bright);
  opacity: 0.65;
}

.m-mouth {
  fill: none;
  stroke: oklch(0.18 0 0);
  stroke-width: 3.5;
  stroke-linecap: round;
}

.m-mouth-cavity {
  fill: oklch(0.28 0.07 30);
}

.m-tooth {
  fill: var(--ink);
}

/* reactions */

.monster.is-pet #monster-root {
  animation: squish 520ms var(--ease-out);
}

@keyframes squish {
  0% { transform: scale(1, 1); }
  30% { transform: scale(1.09, 0.88); }
  60% { transform: scale(0.96, 1.05); }
  100% { transform: scale(1, 1); }
}

.monster.is-lunge #monster-root {
  animation: lunge 480ms var(--ease-out);
}

@keyframes lunge {
  0% { transform: translate(0, 0); }
  35% { transform: translate(0, 26px) scale(1.05, 0.94); }
  60% { transform: translate(0, -8px) scale(0.98, 1.03); }
  100% { transform: translate(0, 0); }
}

.scan-ring {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 210 531;
  opacity: 0;
  transform-origin: 160px 160px;
  transition: opacity 200ms var(--ease-out);
}

.monster.is-scanning .scan-ring {
  opacity: 0.9;
  animation: sweep 1.3s linear infinite;
}

@keyframes sweep {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ---------- control deck ---------- */

.deck {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  padding: clamp(1.5rem, 4vw, 2.5rem);
}

.deck-title {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin-bottom: 1.25rem;
}

.controls-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.status-line {
  margin-top: 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--primary-bright);
  min-height: 2.6em;
  max-width: 52ch;
}

.telemetry {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  border-left: 1px solid var(--line);
  padding-left: clamp(1.5rem, 4vw, 3rem);
}

.tele-row {
  display: grid;
  grid-template-columns: minmax(7.5rem, max-content) 1fr auto;
  align-items: center;
  gap: 0.9rem;
}

.tele-row dt {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.tele-row dd {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.tele-num {
  min-width: 4.2rem;
  text-align: right;
}

.meter {
  position: relative;
  height: 12px;
  border-radius: 3px;
  background: var(--surface-raised);
  overflow: hidden;
}

.meter span {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--primary);
  transition: width 420ms var(--ease-out);
}

.meter span.meter-green {
  background: var(--accent);
}

.meter::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    90deg,
    transparent 0 7px,
    var(--bg) 7px 9px
  );
}

/* ---------- ledger ---------- */

.ledger,
.insights {
  margin-top: clamp(4.5rem, 10vw, 7.5rem);
}

.ledger-list,
.insights-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.ledger-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.8fr) auto;
  gap: clamp(1rem, 3vw, 2.5rem);
  align-items: baseline;
  padding: clamp(1.25rem, 3vw, 1.75rem) 0.5rem;
  border-bottom: 1px solid var(--line);
  transition: background-color 150ms var(--ease-out);
}

.ledger-row:hover {
  background: var(--surface);
}

.ledger-row h3 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.ledger-row:hover h3 {
  color: var(--primary-bright);
}

.ledger-row p {
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 58ch;
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  color: var(--bg);
  background: var(--accent);
  border-radius: 4px;
  padding: 0.2em 0.55em;
  white-space: nowrap;
}

/* ---------- insights ---------- */

.insight-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: clamp(1rem, 3vw, 2.5rem);
  align-items: baseline;
  padding: clamp(1.1rem, 3vw, 1.5rem) 0.5rem;
  border-bottom: 1px solid var(--line);
}

.insight-row time {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
}

.insight-link {
  font-size: 1.05rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--ink);
}

.insight-link:hover {
  color: var(--primary-bright);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.read-min {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
}

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

.footer {
  margin-top: clamp(4.5rem, 10vw, 7.5rem);
}

.footnotes {
  max-width: 72rem;
  margin-inline: auto;
  padding: 0 clamp(1.25rem, 5vw, 4rem) 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 2rem;
}

.footer-fine {
  max-width: 72rem;
  margin-inline: auto;
  padding: 0 clamp(1.25rem, 5vw, 4rem) 2.5rem;
}

.footer-fine p {
  font-size: 0.78rem;
  line-height: 1.7;
  color: var(--muted);
  max-width: 100ch;
}

.footer-bar {
  background: var(--primary-deeper);
  color: var(--ink);
}

.footer-bar-inner {
  max-width: 72rem;
  margin-inline: auto;
  padding: 1.1rem clamp(1.25rem, 5vw, 4rem);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 2rem;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.74rem;
}

.colophon {
  opacity: 0.9;
}

.egg-link {
  color: var(--ink);
  text-decoration: underline dotted;
  text-underline-offset: 3px;
  opacity: 0.85;
}

.egg-link:hover {
  opacity: 1;
}

/* easter egg: aesthetic override */

body.egg-mode {
  --primary: oklch(0.72 0.19 145);
  --primary-deep: oklch(0.55 0.16 150);
  --primary-deeper: oklch(0.42 0.12 148);
  --primary-bright: oklch(0.82 0.17 140);
}

/* ---------- cookie banner ---------- */

.cookie-banner {
  position: fixed;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  width: min(92vw, 640px);
  z-index: var(--z-cookie);
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.9rem;
  box-shadow: 0 12px 40px oklch(0 0 0 / 0.5);
}

.cookie-copy {
  flex: 1 1 20rem;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--ink);
}

.cookie-actions {
  display: flex;
  gap: 0.6rem;
}

/* ---------- entrance choreography ---------- */

@media (prefers-reduced-motion: no-preference) {
  .masthead,
  .lede,
  .proof-points {
    animation: rise-in 700ms var(--ease-out) backwards;
  }

  .lede { animation-delay: 140ms; }
  .proof-points { animation-delay: 240ms; }

  .pen-wrap {
    animation: rise-in 800ms var(--ease-out) 200ms backwards;
  }

  .deck {
    animation: rise-in 700ms var(--ease-out) 380ms backwards;
  }
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(26px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .m-tail,
  #monster-root,
  .pen-status-dot {
    animation: none !important;
  }

  .monster.is-blinking .m-lid {
    transform: scaleY(1);
  }

  .meter span {
    transition: none;
  }
}

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

@media (max-width: 960px) {
  .hero {
    grid-template-columns: 1fr;
    padding-top: 2.5rem;
  }

  .pen-wrap {
    order: -1;
  }

  .deck {
    grid-template-columns: 1fr;
  }

  .telemetry {
    border-left: 0;
    padding-left: 0;
    border-top: 1px solid var(--line);
    padding-top: 1.5rem;
  }

  .ledger-row {
    grid-template-columns: 1fr auto;
  }

  .ledger-row p {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .topnav {
    display: none;
  }

  .topbar {
    justify-content: space-between;
  }

  .controls-row .btn-key {
    flex: 1 1 100%;
  }

  .tele-row {
    grid-template-columns: 1fr auto;
  }

  .tele-row .meter {
    grid-column: 1 / -1;
    order: 3;
  }

  .insight-row {
    grid-template-columns: 1fr auto;
  }

  .insight-row time {
    grid-column: 1 / -1;
  }

  .footer-bar-inner {
    flex-direction: column;
    align-items: flex-start;
  }
}
