/* kis2tech site styles. Colors are tokens; dark mode follows the OS. */
:root {
  --bg: #f3f0e8;
  --ink: #141414;
  --muted: #5b5852;
  --line: rgba(20, 20, 20, .10);
  --panel: #fffdf8;
  --code-bg: #16161a;
  --code-ink: #ece9e1;
  /* one hue, three roles: primary, secondary (deep shade of the same hue), neutrals above */
  --primary: #c6f135;
  --secondary: #2c3a08;
  --on-primary: #141a04;
  --on-secondary: #c6f135;
  --brand: #4d6510;           /* readable shade of the hue on the current background (5:1+ incl. over the glow) */
  --on-accent: var(--on-primary);
  /* clock markers: solid bright green dots (hour, minute, seconds) */
  --dot: #7cc400;
  --accent: var(--primary);
  --blob-op: .55;
  /* type: Geist Mono for the voice (wordmark, headings, menus, code), Geist for longer reading */
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --display: var(--mono);
  --sans: "Geist", ui-sans-serif, system-ui, sans-serif;
  --mx: 0; --my: 0;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d0d10; --ink: #f1eee6; --muted: #b4b0a7; --line: rgba(255,255,255,.08);
    --panel: #17171c; --code-bg: #0a0a0d; --blob-op: .25; --brand: var(--primary);
    --dot: var(--primary);
  }
}
:root[data-theme="dark"] {
  --bg: #0d0d10; --ink: #f1eee6; --muted: #b4b0a7; --line: rgba(255,255,255,.08);
  --panel: #17171c; --code-bg: #0a0a0d; --blob-op: .25; --brand: var(--primary);
    --dot: var(--primary);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--display);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
button:focus-visible { outline: 2px dashed var(--ink); outline-offset: 4px; }
.mono { font-family: var(--mono); }

/* ---------- background ---------- */
.bg { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.blob {
  position: absolute; width: 46vmax; aspect-ratio: 1; border-radius: 50%;
  filter: blur(70px); opacity: var(--blob-op);
  transform: translate(calc(var(--mx) * var(--d, 20px)), calc(var(--my) * var(--d, 20px)));
  transition: transform .8s cubic-bezier(.2,.8,.2,1);
}
.blob::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: inherit; animation: drift 18s ease-in-out infinite alternate; }
.b1 { background: var(--primary); top: -18vmax; left: -12vmax; --d: 40px; }
.b2 { background: var(--secondary); bottom: -22vmax; right: -14vmax; --d: -50px; }
.b3 { background: var(--primary); top: 30%; left: 55%; width: 24vmax; --d: 70px; opacity: calc(var(--blob-op) * .7); }
@keyframes drift { to { transform: translate(6vmax, 4vmax) scale(1.15); } }
.grid {
  position: absolute; inset: 0;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(circle at 50% 45%, #000 0, transparent 70%);
}
.grain {
  position: absolute; inset: -50%; opacity: .08;
  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'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1.2s steps(4) infinite;
}
@keyframes grain { 50% { transform: translate(3%, -2%); } 100% { transform: translate(-2%, 3%); } }

/* ---------- stage ---------- */
.stage { position: relative; min-height: 100svh; min-height: max(100svh, 720px); overflow-x: clip; }
/* clip (not hidden): wide decorations like the tape never widen the page on phones (WCAG 1.4.10) */
.tag { position: absolute; top: 22px; left: 24px; margin: 0; font-size: 12px; letter-spacing: .08em; color: var(--muted); z-index: 3; }
.ver { color: var(--ink); border: 1px solid var(--line); padding: 2px 6px; border-radius: 99px; }

/* ---------- orbit ---------- */
.orbit-wrap {
  --size: min(64vmin, 600px);
  position: absolute; left: 50%; top: 43%;
  width: var(--size); aspect-ratio: 1;
  transform: translate(-50%, -50%);
  display: grid; place-items: center;
}
/* wider screens have room to spare: bigger clock + orbit */
@media (min-width: 1100px) {
  /* also capped by height so the orbiting buttons clear the tape on short screens (1280x720) */
  .orbit-wrap { --size: min(74vmin, 760px, calc(100svh - 220px)); top: 45%; }
}
.orbit-wrap::before, .orbit-wrap::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  border: 1px dashed color-mix(in srgb, var(--ink) 25%, transparent);
  animation: spin 90s linear infinite;
}
.orbit-wrap::after { inset: 14%; border-style: solid; border-color: var(--line); animation-direction: reverse; }
.wordmark { text-align: center; position: relative; z-index: 2; }

/* ---------- clock behind the logo ---------- */
.clock { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; overflow: visible; }
.hand {
  transform-box: view-box; transform-origin: 0 0; /* = the viewBox origin, the clock centre */
  transition: transform .35s cubic-bezier(.3,1.7,.5,1);
}
.hand.no-anim { transition: none; }
/* hour, minute, seconds: solid green dots on the ring, no outline, largest to smallest */
.hand circle { fill: var(--dot); stroke: none; }
.hand-s, .hand-ms { transition: none; } /* sweep: driven every frame */
:root[data-motion="off"] .hand-s, :root[data-motion="off"] .hand-ms { display: none; }
.wordmark h1 {
  font-size: clamp(52px, 10vmin, 124px); line-height: .9; margin: 0; font-weight: 700; letter-spacing: -.06em;
}
.two {
  /* the 2 is always filled in the brand shade; a small pop on hover */
  display: inline-block; color: var(--brand);
  -webkit-text-stroke: .04em var(--brand);
  margin: 0 .03em; transform: translateY(-.05em);
  transition: transform .5s cubic-bezier(.3,1.6,.5,1);
}
.wordmark h1:hover .two { transform: translateY(-.05em) scale(1.1); }
.lede { font-size: clamp(17px, 2.4vmin, 24px); margin: 14px 0 6px; }
.lede em { font-style: normal; color: var(--brand); font-weight: 500; }
.prompt { color: var(--muted); margin-right: .2em; }
/* blinking block cursor */
.cursor, #panel-title::after {
  display: inline-block; width: .55em; height: 1em; margin-left: .12em; vertical-align: -.12em;
  background: var(--brand); animation: blink 1.05s steps(1) infinite;
}
#panel-title::after { content: ""; width: .5em; height: .8em; vertical-align: -.02em; }
@keyframes blink { 50% { opacity: 0; } }
.hint { font-size: 11px; color: var(--muted); margin: 0; letter-spacing: .06em; }

.orbit { position: absolute; inset: 0; } /* pills sit still at five evenly spaced points */
.orbit-item {
  position: absolute; left: 50%; top: 50%;
  transform: rotate(var(--a)) translateX(calc(var(--size) / 2)) rotate(calc(-1 * var(--a)));
  width: 0; height: 0;
}
.orbit-item button {
  position: absolute; left: 0; top: 0; translate: -50% -50%;
  white-space: nowrap; font-weight: 500; font-size: clamp(13px, 1.7vmin, 16px);
  padding: 10px 16px; border-radius: 99px;
  background: var(--panel); border: 1px solid var(--line);
  box-shadow: 0 6px 24px -10px rgba(0,0,0,.35);
  transition: background .25s, color .25s, scale .35s cubic-bezier(.3,1.6,.5,1);
}
.orbit-item button:hover, .orbit-item button:focus-visible { background: var(--ink); color: var(--bg); scale: 1.15; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- vertical rail ---------- */
.rail {
  position: absolute; right: 18px; top: 42%; transform: translateY(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 6px; z-index: 3;
}
.rail-label { writing-mode: vertical-rl; font-size: 10px; letter-spacing: .3em; color: var(--muted); text-transform: uppercase; margin-bottom: 8px; }
.rail button {
  writing-mode: vertical-rl; transform: rotate(180deg);
  font-size: 15px; padding: 12px 6px; border-radius: 99px;
  position: relative; transition: color .2s, translate .35s cubic-bezier(.3,1.6,.5,1), background .2s;
}
.rail button b { font-family: var(--mono); font-size: 10px; font-weight: 400; color: var(--muted); margin-bottom: 6px; }
.rail button:hover, .rail button:focus-visible { background: var(--ink); color: var(--bg); translate: -8px 0; }
.rail button:hover b { color: var(--bg); }

/* ---------- tape ---------- */
.tape {
  position: absolute; left: -10vw; right: -10vw; bottom: 4%;
  background: var(--primary); color: var(--on-primary);
  rotate: -4deg; z-index: 2; overflow: hidden;
  border-block: 2px solid var(--on-accent);
  box-shadow: 0 16px 40px -18px rgba(0,0,0,.5);
}
.track { display: flex; width: max-content; animation: tape 28s linear infinite; }
.tape:hover .track, .tape:focus-within .track { animation-play-state: paused; }
.run { display: flex; align-items: center; }
.run button {
  font-size: clamp(22px, 3.2vw, 40px); font-weight: 700; letter-spacing: -.02em;
  padding: 12px 22px; text-transform: uppercase; transition: background .2s, color .2s;
}
.run button:hover, .run button:focus-visible { background: var(--on-primary); color: var(--primary); }
.run i { font-style: normal; font-size: 22px; }
@keyframes tape { to { transform: translateX(-50%); } }

/* ---------- badge ---------- */
.badge {
  position: absolute; right: 8%; bottom: 17%; z-index: 4;
  width: 150px; aspect-ratio: 1; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--ink); color: var(--bg);
  transition: scale .4s cubic-bezier(.3,1.6,.5,1);
}
.badge svg { position: absolute; inset: 0; width: 100%; height: 100%; animation: spin 14s linear infinite; }
.badge text { font-family: var(--mono); font-size: 15px; letter-spacing: .12em; text-transform: uppercase; fill: currentColor; }
.badge-core {
  width: 56px; height: 56px; border-radius: 50%; background: var(--primary); color: var(--on-primary);
  display: grid; place-items: center; font-size: 26px; transition: transform .4s;
}
.badge:hover { scale: 1.08; }
.badge:hover svg { animation-duration: 4s; }
.badge:hover .badge-core { transform: rotate(-45deg); }

/* in-between widths: tuck the badge in so the orbit path never touches it */
@media (min-width: 761px) and (max-width: 1099px) {
  .badge { width: 128px; right: 3%; bottom: 13%; }
}

/* ---------- dialog ---------- */
dialog {
  width: min(860px, calc(100vw - 32px));
  max-height: calc(100svh - 32px);
  padding: 0; border: 0; border-radius: 28px;
  background: var(--panel); color: var(--ink);
  box-shadow: 0 40px 120px -30px rgba(0,0,0,.6);
  overflow: auto; overscroll-behavior: contain;
  border-top: 10px solid var(--accent);
}
dialog::backdrop { background: color-mix(in srgb, var(--bg) 55%, transparent); backdrop-filter: blur(8px); }
dialog.closing::backdrop { opacity: 0; transition: opacity .3s; }
.panel-inner { padding: clamp(20px, 4vw, 44px); }
.panel-top { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); letter-spacing: .1em; }
.close {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); font-size: 16px;
  transition: rotate .35s, background .2s, color .2s;
}
.close:hover { rotate: 90deg; background: var(--ink); color: var(--bg); }
#panel-title {
  font-size: clamp(40px, 7vw, 84px); line-height: .95; letter-spacing: -.055em; margin: 16px 0 14px; font-weight: 700;
}
#panel-title em { font-style: normal; color: var(--brand); }
#panel-title mark { background: var(--accent); color: var(--on-accent); padding: 0 .12em; border-radius: .12em; }
.blurb { font-family: var(--sans); font-size: clamp(16px, 2vw, 20px); line-height: 1.5; max-width: 60ch; margin: 0 0 16px; }
.points { list-style: none; padding: 0; margin: 0 0 22px; display: flex; flex-wrap: wrap; gap: 8px; }
.points li { font-size: 13px; padding: 6px 12px; border-radius: 99px; border: 1px solid var(--line); }
.code { margin: 0; border-radius: 18px; overflow: hidden; background: var(--code-bg); color: var(--code-ink); }
.code figcaption {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: #9a968e; border-bottom: 1px solid rgba(255,255,255,.08);
}
.copy { font-family: var(--mono); font-size: 11px; color: #ece9e1; padding: 4px 10px; border-radius: 99px; border: 1px solid rgba(255,255,255,.16); letter-spacing: .08em; text-transform: uppercase; }
.copy:hover { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.code pre { margin: 0; padding: 18px 20px 22px; overflow-x: auto; font-family: var(--mono); font-size: 14px; line-height: 1.65; }
.code pre:focus-visible { outline: 2px dashed var(--accent); outline-offset: -4px; }
.code pre .ln { display: block; opacity: 0; animation: typein .6s forwards; }
@keyframes typein { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: none; } }
.tk-kw { color: #c6f135; }
.tk-str { color: #e4f7a6; }
.tk-com { color: #8b8f81; font-style: italic; }
.tk-num { color: #9fbf3a; }
.tk-fn { color: #ffffff; font-weight: 600; }

/* contact: show-email button, Turnstile box, revealed address */
.mail { display: grid; gap: 14px; margin: 0 0 22px; }
.mail-out { display: grid; gap: 10px; }
.mail-out[hidden] { display: none; }
.mail-addr { margin: 0; font-size: clamp(20px, 4vw, 32px); font-weight: 700; letter-spacing: -.03em; color: var(--brand); overflow-wrap: anywhere; }
.mail-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.mail .send {
  background: var(--ink); color: var(--bg); font-weight: 700;
  padding: 12px 22px; border-radius: 99px; transition: scale .3s cubic-bezier(.3,1.6,.5,1);
}
.mail .send:hover { scale: 1.06; }
.mail .send:disabled { opacity: .55; cursor: progress; scale: 1; }
.ts-box:empty { display: none; }
.mail [hidden] { display: none; }
.form-status[data-kind="err"] { color: var(--ink); text-decoration: underline wavy var(--brand); text-underline-offset: 4px; }
.mail-open { color: var(--ink); text-underline-offset: 4px; }
.mail-open:hover { color: var(--brand); }
.form-status { margin: 0; font-size: 12px; color: var(--muted); }
.form-status[data-kind="ok"] { color: var(--brand); }

/* ---------- small screens: stack, keep things non-horizontal where it's fun ---------- */
@media (max-width: 760px) {
  .stage { min-height: auto; display: flex; flex-direction: column; align-items: center; padding: 72px 16px 48px; gap: 48px; }
  .tag { left: 16px; top: 18px; }
  .orbit-wrap { --size: min(74vw, 360px); position: relative; left: auto; top: auto; transform: none; margin: 40px 0; }
  .wordmark h1 { font-size: clamp(30px, 8.5vw, 48px); }
  .lede { font-size: 13px; max-width: 40vw; margin-inline: auto; }
  .hint { display: none; }
  .rail { position: relative; right: auto; top: auto; transform: none; flex-direction: row; align-items: flex-end; }
  .rail-label { margin: 0 8px 0 0; }
  .rail button:hover, .rail button:focus-visible { translate: 0 -8px; }
  .tape { position: relative; left: auto; right: auto; bottom: auto; width: 120vw; margin-inline: -10vw; }
  .badge { position: relative; right: auto; bottom: auto; width: 130px; }
}

/* ---------- viewer settings ---------- */
.prefs { position: fixed; top: 16px; right: 20px; z-index: 20; display: flex; gap: 6px; }
.prefs button {
  font-size: 12px; padding: 6px 11px; min-height: 28px; border-radius: 99px;
  border: 1px solid var(--line); color: var(--ink);
  background: color-mix(in srgb, var(--panel) 85%, transparent); backdrop-filter: blur(6px);
}
.prefs button:hover { border-color: var(--ink); }
.prefs .val { color: var(--brand); font-weight: 700; margin-left: 2px; }
.prefs button[aria-pressed="false"] .val { color: var(--muted); }
:root[data-keys="off"] .keys-hint { display: none; }

/* motion off: freeze every animation where it is (nothing jumps), show code immediately */
:root[data-motion="off"] *, :root[data-motion="off"] *::before, :root[data-motion="off"] *::after {
  animation-play-state: paused !important;
}
:root[data-motion="off"] .code pre .ln { animation: none; opacity: 1; }
:root[data-motion="off"] .cursor, :root[data-motion="off"] #panel-title::after { animation: none; }

@media (max-width: 760px) {
  .tag-extra { display: none; }
  .prefs { top: 14px; right: 16px; }
  .prefs button { font-size: 11px; padding: 5px 9px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0s !important; animation-iteration-count: 1 !important; transition-duration: 0s !important; }
  .code pre .ln { opacity: 1; }
}
