/*
 * A neutral frame, so the palette is the only color on the page. Geist type, elevation from gray surfaces rather than
 * shadows. Dark by default; light follows the system. Colors live only in these tokens, and --c1 to --c5 are the
 * palette on screen (app.js sets them).
 */
@property --angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}

:root {
  --background: #0a0a0a;
  --foreground: #ebebeb;
  --muted-foreground: #999999;
  --surface-1: #141414;
  --surface-2: #1a1a1a;
  --surface-3: #262626;
  --border: #212121;
  --primary: #ebebeb;
  --primary-foreground: #0a0a0a;
  --c1: #3a3a3a;
  --c2: #555555;
  --c3: #707070;
  --c4: #8c8c8c;
  --c5: #a8a8a8;
  --success: #1f9d55;
  --wrktr: #f3bc16;
  --wrktr-foreground: #000000;
  --radius: 0.875rem;
  --font-sans: "Geist", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

@media (prefers-color-scheme: light) {
  :root {
    --background: #ffffff;
    --foreground: #1a1a1a;
    --muted-foreground: #595959;
    --surface-1: #fafafa;
    --surface-2: #f4f4f4;
    --surface-3: #ebebeb;
    --border: #e5e5e5;
    --primary: #1a1a1a;
    --primary-foreground: #ffffff;
  }
}

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

html,
body {
  height: 100%;
  margin: 0;
}

body {
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 0.1em 0.45em;
  border-radius: 5px;
  border: 1px solid currentColor;
  opacity: 0.7;
}

/* Header and footer */

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  background: var(--background);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}

.mark {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  width: 26px;
  height: 22px;
}

.mark i {
  flex: 1;
  border-radius: 2px;
  transition:
    background-color 450ms var(--ease),
    height 450ms var(--ease);
}

.mark i:nth-child(1) {
  height: 55%;
  background: var(--c1);
}
.mark i:nth-child(2) {
  height: 100%;
  background: var(--c2);
}
.mark i:nth-child(3) {
  height: 70%;
  background: var(--c3);
}
.mark i:nth-child(4) {
  height: 88%;
  background: var(--c4);
}
.mark i:nth-child(5) {
  height: 45%;
  background: var(--c5);
}

.brand:hover .mark i:nth-child(odd) {
  height: 100%;
}

.name {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.modes {
  display: flex;
  padding: 3px;
  gap: 2px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.modes button {
  border: 0;
  background: none;
  padding: 6px 12px;
  border-radius: 999px;
  color: var(--muted-foreground);
  font-weight: 500;
  transition:
    background-color 150ms,
    color 150ms;
}

.modes button:hover {
  color: var(--foreground);
}

.modes button[aria-checked="true"] {
  background: var(--surface-3);
  color: var(--foreground);
}

.share,
.generate {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  font-weight: 600;
  transition:
    background-color 150ms,
    transform 150ms var(--ease);
}

.share {
  border: 1px solid var(--border);
  background: transparent;
}

.share:hover {
  background: var(--surface-2);
}

.generate {
  border: 0;
  background: var(--primary);
  color: var(--primary-foreground);
}

.generate:hover {
  filter: brightness(1.06);
}

.generate:active,
.share:active {
  transform: scale(0.97);
}

.foot {
  font-size: 12.5px;
  color: var(--muted-foreground);
}

/* "Shipped by agents on wrktr": a pill whose border is the palette on screen, slowly turning */

.built {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 14px 0 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  background:
    linear-gradient(var(--background), var(--background)) padding-box,
    conic-gradient(from var(--angle), var(--c1), var(--c2), var(--c3), var(--c4), var(--c5), var(--c1)) border-box;
  color: var(--muted-foreground);
  font-size: 12.5px;
  animation: turn 6s linear infinite;
  transition: color 150ms;
}

.built:hover {
  color: var(--foreground);
  animation-duration: 2s;
}

.built strong {
  color: var(--foreground);
  font-weight: 600;
}

.wrktr {
  width: 16px;
  height: 16px;
}

@keyframes turn {
  to {
    --angle: 360deg;
  }
}

/* How this app was made: a card over a blurred page */

.about {
  width: min(460px, calc(100vw - 32px));
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  background: var(--surface-1);
  color: var(--foreground);
  opacity: 0;
  transform: translateY(8px) scale(0.98);
  transition:
    opacity 200ms,
    transform 250ms var(--ease),
    overlay 250ms allow-discrete,
    display 250ms allow-discrete;
}

.about:popover-open {
  opacity: 1;
  transform: none;
}

@starting-style {
  .about:popover-open {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
}

.about::backdrop {
  background: rgb(0 0 0 / 0.35);
  backdrop-filter: blur(6px);
}

.close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--muted-foreground);
  font-size: 20px;
  line-height: 1;
}

.close:hover {
  background: var(--surface-3);
  color: var(--foreground);
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  color: var(--foreground);
  text-decoration: none;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.logo svg {
  width: 26px;
  height: 26px;
}

.logo em {
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--muted-foreground);
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
}

.about h2 {
  margin: 0;
  font-size: 26px;
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 650;
}

.lede {
  margin: 12px 0 0;
  line-height: 1.55;
  color: var(--muted-foreground);
}

/* The loop: a dot runs round push, checks, review and feedback twice, then out through main, dev and prod */

.loop {
  display: block;
  width: 100%;
  height: auto;
  margin-top: 22px;
  overflow: visible;
  font-family: var(--font-mono);
  font-size: 11px;
}

.loop .track,
.loop .exit,
.loop .arrow {
  fill: none;
  stroke: var(--surface-3);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.loop .exit,
.loop .arrow {
  stroke: var(--muted-foreground);
  stroke-dasharray: 3 5;
}

.loop .arrow {
  stroke-dasharray: none;
}

.loop .comet {
  fill: var(--foreground);
  filter: drop-shadow(0 0 6px var(--foreground));
}

.loop .stop circle {
  fill: var(--c);
  stroke: var(--surface-1);
  stroke-width: 3;
}

.loop text {
  fill: var(--muted-foreground);
  text-anchor: middle;
}

.loop .note {
  font-size: 10px;
}

/* main, dev and prod light up in turn as the dot reaches them (the <animate> in each), until the run starts over */
.loop .env rect {
  fill: var(--surface-3);
}

.loop .env .lit {
  fill: var(--success);
}

.loop .env text {
  fill: var(--foreground);
  font-weight: 600;
}

.actions {
  display: flex;
  gap: 8px;
  margin-top: 26px;
}

.actions a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 16px;
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
  transition:
    background-color 150ms,
    transform 150ms var(--ease);
}

.actions .primary {
  background: var(--primary);
  color: var(--primary-foreground);
}

.actions .secondary {
  border: 1px solid var(--border);
  color: var(--foreground);
}

.actions .secondary:hover {
  background: var(--surface-2);
}

.actions a:active {
  transform: scale(0.97);
}

/* The palette: five full-bleed swatches, side by side */

.palette {
  display: flex;
  min-height: 0;
  margin: 0 20px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-1);
}

.swatch {
  position: relative;
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 4px;
  padding: 24px 22px;
  margin: 0;
  transition:
    background-color 450ms var(--ease),
    color 450ms var(--ease),
    flex-grow 300ms var(--ease);
}

.swatch:hover {
  flex-grow: 1.35;
}

.hex {
  font-family: var(--font-mono);
  font-size: clamp(16px, 1.6vw, 22px);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.oklch {
  font-family: var(--font-mono);
  font-size: 11.5px;
  opacity: 0.7;
}

.index {
  position: absolute;
  top: 20px;
  left: 22px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  opacity: 0.55;
}

/* A short confirmation, bottom center */

.toast {
  position: fixed;
  left: 50%;
  bottom: 64px;
  margin: 0;
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--foreground);
  color: var(--background);
  font-weight: 500;
  transform: translate(-50%, 8px);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 200ms,
    transform 200ms var(--ease);
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Narrow screens: the swatches stack, and the controls wrap under the brand */

@media (max-width: 760px) {
  .bar {
    flex-wrap: wrap;
    padding: 12px 16px;
  }
  .controls {
    width: 100%;
    flex-wrap: wrap;
  }
  .modes {
    width: 100%;
    overflow-x: auto;
  }
  .modes button {
    flex: 1;
    padding: 6px 8px;
  }
  .generate {
    margin-left: auto;
  }
  .hint {
    display: none;
  }
  .foot {
    justify-content: center;
  }
  .palette {
    flex-direction: column;
    margin: 0 16px;
  }
  .swatch {
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
    padding: 14px 16px;
  }
  .swatch:hover {
    flex-grow: 1;
  }
  .index {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0ms !important;
    animation: none !important;
  }
  .loop .comet {
    display: none;
  }
  .loop .env .lit {
    opacity: 1;
  }
}
