/* ==========================================================================
   Sitetwin — design tokens
   Technical / Swiss grid. Square corners, mono tags, pastel tiles,
   isometric blocks. Light + dark themes.
   ========================================================================== */

:root {
  color-scheme: light;

  /* Surfaces */
  --bg: #f4f4f1;
  --dot: rgb(10 12 10 / 0.11);
  --surface: #fcfcfa;
  --surface-2: #f3f4f0;
  --surface-3: #e9ebe6;

  /* Ink (text hierarchy) */
  --ink: #0b0c0b;
  --ink-2: #363935;
  --ink-3: #61655f;
  --ink-4: #b3b6af; /* unrevealed scroll text, decorative */

  --line: rgb(10 12 10 / 0.1);
  --line-strong: rgb(10 12 10 / 0.2);

  /* Pastel tiles (logo grid, cards) */
  --tile: #ebf2e8;
  --tile-blue: #d8e9fb;
  --tile-green: #cffcc3;
  --tile-pink: #f9d6f4;
  --tile-lav: #e0d7f6;
  --tile-peach: #fde7d1;

  /* Signal accent */
  --signal: #26ec72;
  --signal-ink: #062e14;
  --signal-text: #0d8a3e; /* signal colour that passes contrast on light bg */
  --highlight: #f6a6ec;

  /* Buttons */
  --btn: #0b0c0b;
  --btn-ink: #ffffff;
  --btn-2: #ffffff;
  --btn-2-ink: #0b0c0b;

  --danger: #d63a2a;

  /* Footer is always night */
  --foot-bg: #050605;
  --foot-ink: #f2f3ef;
  --foot-ink-2: #9a9e97;

  /* Isometric illustration */
  --iso-bg: #f6f7f3;
  --iso-line: rgb(10 12 10 / 0.11);
  --iso-floor: #f0f2ec;
  --iso-peach: #fbe4cb;
  --iso-orange: #f8cf98;
  --iso-pink: #f7c9f1;
  --iso-blue: #cddffa;
  --iso-lav: #cdbdf1;
  --iso-mint: #d9f8d6;
  --iso-gray: #e5e7e1;
  --iso-shadow: rgb(60 40 10 / 0.14);

  /* Block hues: top / left / right / ink-on-face */
  --amber-t: #fbe1c0;
  --amber-l: #f3bf5f;
  --amber-r: #b88b3f;
  --amber-i: #4a2f05;
  --pink-t: #fcdcf7;
  --pink-l: #ef9fe3;
  --pink-r: #a8619b;
  --pink-i: #4a1240;
  --blue-t: #dbe9fd;
  --blue-l: #8fb9f4;
  --blue-r: #4c74ae;
  --blue-i: #0e2a52;
  --green-t: #dcfddb;
  --green-l: #3cef7b;
  --green-r: #1f9a4b;
  --green-i: #05361a;
  --lav-t: #e7defb;
  --lav-l: #ab95ea;
  --lav-r: #5c489d;
  --lav-i: #22134f;
  --night-t: #4c3a63;
  --night-l: #2f1d47;
  --night-r: #1b0f2c;
  --night-i: #cfc2ea;
  --cell: rgb(255 255 255 / 0.9);
  --cell-dark: #0c0c0c;

  /* Type */
  --font-body: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "Cascadia Code", Menlo, monospace;

  --fs-hero: clamp(3rem, 7.4vw, 7.25rem);
  --fs-h2: clamp(2.25rem, 4.6vw, 4.25rem);
  --fs-h3: clamp(1.25rem, 0.8vw + 1rem, 1.6rem);
  --fs-lead: clamp(1.4rem, 2.6vw, 2.6rem);
  --fs-body: clamp(1rem, 0.15vw + 0.96rem, 1.0625rem);
  --fs-small: 0.9375rem;
  --fs-xs: 0.8125rem;
  --fs-label: 0.6875rem;

  /* Space */
  --s-1: 0.25rem;
  --s-2: 0.5rem;
  --s-3: 0.75rem;
  --s-4: 1rem;
  --s-5: 1.5rem;
  --s-6: 2rem;
  --s-7: 3rem;
  --s-8: 4.5rem;
  --s-9: 7rem;
  --s-10: 10rem;

  --gutter: clamp(0.75rem, 1.9vw, 1.75rem);
  --max: 1680px;

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.76, 0, 0.24, 1);
  --ease-back: cubic-bezier(0.34, 1.56, 0.64, 1);
  --t-micro: 150ms;
  --t-small: 250ms;
  --t-med: 400ms;
  --t-large: 700ms;
}

/* ---------- Dark theme ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #090a09;
    --dot: rgb(255 255 255 / 0.075);
    --surface: #101210;
    --surface-2: #161916;
    --surface-3: #1e221e;
    --ink: #f1f2ee;
    --ink-2: #c4c7c0;
    --ink-3: #8f938b;
    --ink-4: #3f433d;
    --line: rgb(255 255 255 / 0.09);
    --line-strong: rgb(255 255 255 / 0.17);
    --tile: #141a14;
    --tile-blue: #111c29;
    --tile-green: #13301a;
    --tile-pink: #2a1527;
    --tile-lav: #1c172e;
    --tile-peach: #2a1e11;
    --signal-text: #3ff58a;
    --highlight: #b9479f;
    --btn: #f1f2ee;
    --btn-ink: #0b0c0b;
    --btn-2: #1a1d1a;
    --btn-2-ink: #f1f2ee;
    --danger: #ff6b5b;
    --foot-bg: #000000;
    --iso-bg: #0e100e;
    --iso-line: rgb(255 255 255 / 0.07);
    --iso-floor: #121512;
    --iso-peach: #33261a;
    --iso-orange: #4d3615;
    --iso-pink: #3a1c36;
    --iso-blue: #172740;
    --iso-lav: #282046;
    --iso-mint: #15301c;
    --iso-gray: #1a1d1a;
    --iso-shadow: rgb(0 0 0 / 0.45);
    --amber-t: #b48a4a;
    --amber-l: #e0a948;
    --amber-r: #6f5020;
    --pink-t: #b56fa8;
    --pink-l: #d982cb;
    --pink-r: #6a335f;
    --blue-t: #6f93c6;
    --blue-l: #5f93df;
    --blue-r: #2a4670;
    --green-t: #3fb36b;
    --green-l: #2be06d;
    --green-r: #12602e;
    --lav-t: #8a78c7;
    --lav-l: #8c74d9;
    --lav-r: #3b2c70;
    --cell: rgb(255 255 255 / 0.82);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #090a09;
  --dot: rgb(255 255 255 / 0.075);
  --surface: #101210;
  --surface-2: #161916;
  --surface-3: #1e221e;
  --ink: #f1f2ee;
  --ink-2: #c4c7c0;
  --ink-3: #8f938b;
  --ink-4: #3f433d;
  --line: rgb(255 255 255 / 0.09);
  --line-strong: rgb(255 255 255 / 0.17);
  --tile: #141a14;
  --tile-blue: #111c29;
  --tile-green: #13301a;
  --tile-pink: #2a1527;
  --tile-lav: #1c172e;
  --tile-peach: #2a1e11;
  --signal-text: #3ff58a;
  --highlight: #b9479f;
  --btn: #f1f2ee;
  --btn-ink: #0b0c0b;
  --btn-2: #1a1d1a;
  --btn-2-ink: #f1f2ee;
  --danger: #ff6b5b;
  --foot-bg: #000000;
  --iso-bg: #0e100e;
  --iso-line: rgb(255 255 255 / 0.07);
  --iso-floor: #121512;
  --iso-peach: #33261a;
  --iso-orange: #4d3615;
  --iso-pink: #3a1c36;
  --iso-blue: #172740;
  --iso-lav: #282046;
  --iso-mint: #15301c;
  --iso-gray: #1a1d1a;
  --iso-shadow: rgb(0 0 0 / 0.45);
  --amber-t: #b48a4a;
  --amber-l: #e0a948;
  --amber-r: #6f5020;
  --pink-t: #b56fa8;
  --pink-l: #d982cb;
  --pink-r: #6a335f;
  --blue-t: #6f93c6;
  --blue-l: #5f93df;
  --blue-r: #2a4670;
  --green-t: #3fb36b;
  --green-l: #2be06d;
  --green-r: #12602e;
  --lav-t: #8a78c7;
  --lav-l: #8c74d9;
  --lav-r: #3b2c70;
  --cell: rgb(255 255 255 / 0.82);
}

/* ---------- Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 72px;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  background-color: var(--bg);
  background-image: radial-gradient(var(--dot) 0.7px, transparent 0.9px);
  background-size: 4px 4px;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.5;
  letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  transition: background-color var(--t-med), color var(--t-med);
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
}

::selection {
  background: var(--signal);
  color: var(--signal-ink);
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: var(--s-4);
  top: -100px;
  z-index: 100;
  background: var(--btn);
  color: var(--btn-ink);
  padding: var(--s-3) var(--s-4);
}

.skip-link:focus {
  top: var(--s-4);
}

/* ---------- Primitives ---------- */
.mono {
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
}

/* Black mono tag:  ":: OUR PRODUCTS" */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  padding: 0.3rem 0.55rem;
  background: var(--btn);
  color: var(--btn-ink);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.2;
}

.tag::before {
  content: "::";
  opacity: 0.6;
  letter-spacing: 0;
}

.tag--soft {
  background: var(--surface-3);
  color: var(--ink);
}

.label {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  font-size: 1.1875rem;
  letter-spacing: -0.04em;
}

.logo-mark {
  width: 20px;
  height: 20px;
  flex: none;
}

.logo-mark .t-a {
  fill: currentColor;
}

.logo-mark .t-b {
  fill: var(--signal);
  transform-origin: 14px 14px;
  transition: transform var(--t-med) var(--ease-back);
}

.logo:hover .logo-mark .t-b {
  transform: rotate(90deg);
}

/* Buttons: square, black, with a play-triangle */
.btn {
  --b-bg: var(--btn);
  --b-fg: var(--btn-ink);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  height: 40px;
  padding: 0 0.85rem;
  background: var(--b-bg);
  color: var(--b-fg);
  font-size: var(--fs-small);
  font-weight: 500;
  letter-spacing: -0.015em;
  white-space: nowrap;
  transition: background-color var(--t-small) var(--ease-out), color var(--t-small), box-shadow var(--t-small);
}

.btn .tri {
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 4px 0 4px 5px;
  border-color: transparent transparent transparent currentColor;
  transition: transform var(--t-small) var(--ease-out);
}

.btn--ghost {
  --b-bg: var(--btn-2);
  --b-fg: var(--btn-2-ink);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

.btn--plain {
  --b-bg: transparent;
  --b-fg: var(--ink);
  padding-left: 0.5rem;
}

.btn--signal {
  --b-bg: var(--signal);
  --b-fg: var(--signal-ink);
}

.btn--lg {
  height: 48px;
  padding: 0 1rem;
  font-size: 1rem;
}

.btn--wide {
  min-width: 220px;
}

@media (hover: hover) {
  .btn:hover .tri {
    transform: translateX(3px);
  }
  .btn:not(.btn--ghost):not(.btn--plain):not(.btn--signal):hover {
    --b-bg: color-mix(in srgb, var(--btn) 82%, var(--signal));
  }
  .btn--ghost:hover {
    box-shadow: inset 0 0 0 1px var(--ink);
  }
}

/* Theme toggle */
.theme-toggle {
  position: relative;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line-strong);
  transition: box-shadow var(--t-small), background-color var(--t-small);
}

.theme-toggle:hover {
  box-shadow: inset 0 0 0 1px var(--ink);
}

.theme-toggle svg {
  width: 16px;
  height: 16px;
  transition: transform var(--t-med) var(--ease-back), opacity var(--t-small);
}

.theme-toggle .moon {
  position: absolute;
}

.theme-toggle .sun {
  opacity: 1;
}

.theme-toggle .moon {
  opacity: 0;
  transform: rotate(-60deg) scale(0.6);
}

:root[data-theme="dark"] .theme-toggle .sun {
  opacity: 0;
  transform: rotate(60deg) scale(0.6);
}

:root[data-theme="dark"] .theme-toggle .moon {
  opacity: 1;
  transform: none;
}

/* Reveal on scroll (enhancement; content visible without JS) */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--t-large) var(--ease-out), transform var(--t-large) var(--ease-out);
  transition-delay: calc(var(--d, 0) * 70ms);
}

.js [data-reveal].is-in {
  opacity: 1;
  transform: none;
}

/* Isometric engine output */
.iso {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.iso text {
  font-family: var(--font-mono);
}

.iso .iso-sans {
  font-family: var(--font-body);
  letter-spacing: -0.03em;
}

.iso-box {
  transition: transform var(--t-med) var(--ease-out), opacity var(--t-med);
}

.iso-box.is-dim {
  opacity: 0.35;
}

.iso.is-dropping .iso-box {
  animation: iso-drop 900ms var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 110ms);
}

@keyframes iso-drop {
  0% {
    opacity: 0;
    transform: translateY(-60px);
  }
  60% {
    opacity: 1;
  }
}

.iso .iso-tile {
  transition: fill 600ms var(--ease-out);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    transition-delay: 0ms !important;
  }
  .js [data-reveal] {
    opacity: 1;
    transform: none;
  }
}
