/* pty.party — marketing canvas. Palette mirrors Sources/ptyparty/Theme.swift. */
:root {
  --canvas: rgb(11, 13, 11);
  --dot: rgba(133, 153, 135, 0.38);
  --tile: rgb(14, 16, 14);
  --tile-bar: rgb(16, 18, 16);
  --inset: rgb(24, 26, 24);
  --border: rgba(140, 161, 143, 0.22);
  --divider: rgba(140, 161, 143, 0.12);
  --green: rgb(125, 227, 140);
  --green-dim: rgb(112, 153, 120);
  --green-wash: rgba(125, 227, 140, 0.10);
  --blue: rgb(92, 158, 245);
  --amber: rgb(245, 199, 84);
  --red: rgb(242, 115, 115);
  --text: rgb(222, 227, 222);
  --text-dim: rgb(140, 148, 140);
  --text-faint: rgb(102, 110, 102);
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  background: var(--canvas);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

/* ---- Viewport + infinite canvas ---------------------------------------- */
.viewport {
  position: fixed;
  inset: 0;
  overflow: hidden;
  cursor: default;
  background: var(--canvas);
}

/* Infinite dot grid: a fixed, viewport-filling layer whose background-position
   and size are driven by the camera (see applyCamera), so it pans and zooms
   with the world yet always covers the whole screen — no blank edges. */
.grid {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background-image: radial-gradient(var(--dot) 1.25px, transparent 1.25px);
  background-size: 40px 40px;
  background-position: 0 0;
  transition: background-position 1.5s cubic-bezier(0.65, 0, 0.2, 1),
              background-size 1.5s cubic-bezier(0.65, 0, 0.2, 1);
}
.grid.no-anim { transition: none; }

.world {
  position: absolute;
  top: 0; left: 0;
  width: 4200px;
  height: 1900px;
  z-index: 1;
  transform-origin: 0 0;
  transition: transform 1.5s cubic-bezier(0.65, 0, 0.2, 1);
}
.world.no-anim { transition: none; }

/* Connection lines live in world space, drawn ABOVE the tiles like the app's
   ConnectionOverlayView — so the endpoint "balls" sit on top at each port. */
.wires { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 20; }
.wires path { fill: none; stroke: var(--green); stroke-width: 2.5; opacity: 0.85; }
.wires .endpoint { fill: var(--green); }

/* ---- Tiles ------------------------------------------------------------- */
.tile {
  position: absolute;
  z-index: 5;
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.34, 1.3, 0.5, 1),
              box-shadow 0.4s ease, outline-color 0.3s ease;
}
.tile.show { opacity: 1; transform: scale(1); }

/* Terminal tile */
.terminal {
  font-family: var(--mono);
  border-radius: 10px;
  background: #000;
  border: 1px solid var(--border);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
/* Activity rings: inset colored ring, mirrors TerminalTileView.updateBorder */
.terminal.working { box-shadow: inset 0 0 0 3px rgba(92, 158, 245, 0.7), 0 18px 50px rgba(0,0,0,0.55); }
.terminal.asking  { box-shadow: inset 0 0 0 3px var(--amber), 0 18px 50px rgba(0,0,0,0.55); }
.terminal.focused { outline: 2px solid var(--green); outline-offset: 1px; }

.titlebar {
  height: 30px;
  flex: 0 0 30px;
  background: var(--tile-bar);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 12px;
  border-bottom: 1px solid var(--divider);
}
.lights { display: flex; gap: 8px; }
.lights i {
  width: 11px; height: 11px; border-radius: 50%;
  background: rgba(102, 110, 102, 0.7);
  transition: background 0.2s ease;
}
.terminal:hover .lights i:nth-child(1) { background: var(--red); }
.terminal:hover .lights i:nth-child(2) { background: var(--amber); }
.terminal:hover .lights i:nth-child(3) { background: var(--green); }

.title {
  grid-column: 2;
  font-size: 12px; font-weight: 500;
  color: var(--text);
  text-align: center;
  white-space: nowrap;
}
.status {
  grid-column: 3;
  justify-self: end;
  font-size: 11px; font-weight: 500;
  color: var(--text-dim);
  display: flex; align-items: center; gap: 5px;
  white-space: nowrap;
}
.status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-faint); }
.status.working .dot { background: var(--blue); box-shadow: 0 0 6px var(--blue); }
.status.asking  .dot { background: var(--amber); box-shadow: 0 0 6px var(--amber); animation: pulse 1.1s ease-in-out infinite; }
.status.working .label::after { content: "working"; }
.status.asking  .label::after { content: "needs you"; color: var(--amber); }
.status.idle    .label::after { content: "idle"; }

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

/* Terminal screen */
.screen {
  flex: 1 1 auto;
  padding: 12px 14px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text);
  overflow: hidden;
  white-space: pre-wrap;
  word-break: break-word;
}
.screen .ln { display: block; }
.screen .bullet { color: var(--green); }
.screen .tool { color: var(--text-dim); }
.screen .tool b { color: var(--green); font-weight: 600; }
.screen .dim { color: var(--text-dim); }
.screen .faint { color: var(--text-faint); }
.screen .amber { color: var(--amber); }
.screen .blue { color: var(--blue); }
.screen .ok { color: var(--green); }
.screen .path { color: var(--blue); }
.screen .spin { color: var(--amber); }

/* Claude composer box */
.composer {
  margin-top: 10px;
  border: 1px solid rgba(140, 161, 143, 0.35);
  border-radius: 8px;
  padding: 7px 10px;
  color: var(--text);
  display: flex; gap: 8px; align-items: baseline;
}
.composer .chev { color: var(--green); }
.caret {
  display: inline-block;
  width: 8px; height: 15px;
  background: var(--green);
  margin-left: 1px;
  transform: translateY(2px);
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 0%, 50% { opacity: 1; } 50.01%, 100% { opacity: 0; } }

/* A pending-choice menu (the "needs you" prompt) */
.menu { margin-top: 8px; }
.menu .opt { color: var(--text-dim); display: block; }
.menu .opt.sel { color: var(--text); }
.menu .opt.sel .arrow { color: var(--amber); }
.menu .arrow { color: transparent; }
.menu .footer { color: var(--text-faint); margin-top: 6px; font-size: 11px; }

/* ---- Log / checklist card --------------------------------------------- */
.log {
  font-family: var(--mono);
  border-radius: 14px;
  background: var(--tile);
  border: 1px solid var(--border);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.5);
  padding: 18px;
  z-index: 5;
}
.log-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.log-head .chev { color: var(--green); font-size: 16px; font-weight: 600; }
.log-head .name { color: var(--text); font-size: 14px; font-weight: 600; flex: 1; }
.log-head .tag { color: var(--text-dim); font-size: 11px; font-weight: 600; letter-spacing: 1.5px; }
.log hr { border: none; border-top: 1px solid var(--divider); margin: 8px 0 14px; }

.section { color: var(--text-dim); font-size: 11px; font-weight: 600; letter-spacing: 0.6px; text-transform: uppercase; margin: 4px 0 8px; }
.item { display: flex; align-items: center; gap: 12px; height: 30px; padding: 0 8px; border-radius: 8px; }
.item.active { background: var(--green-wash); box-shadow: inset 0 0 0 1px rgba(125, 227, 140, 0.55); }
.box { width: 20px; height: 20px; border-radius: 6px; background: var(--inset); border: 1.5px solid var(--text-faint); flex: 0 0 20px; position: relative; transition: all 0.25s ease; }
.item.active .box { border: 2px solid var(--green); }
.item.active .box::after { content: ""; position: absolute; inset: 4px; border-radius: 3px; background: var(--green); }
.item.done .box { background: var(--green); border-color: var(--green); }
.item.done .box::after {
  content: ""; position: absolute; left: 6px; top: 2.5px; width: 5px; height: 10px;
  border: solid #0e100e; border-width: 0 2px 2px 0; transform: rotate(42deg);
}
.item .label { font-size: 13px; color: var(--text); }
.item.done .label { color: var(--green-dim); text-decoration: line-through; }
.item.active .label { font-weight: 500; }

.log-foot { display: flex; align-items: center; gap: 14px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--divider); }
.log-foot .count { color: var(--green); font-size: 12px; font-weight: 600; }
.log-foot .track { flex: 1; height: 6px; border-radius: 3px; background: var(--inset); overflow: hidden; }
.log-foot .fill { height: 100%; width: 0; background: var(--green); border-radius: 3px; transition: width 0.5s ease; }

/* ---- Image tile -------------------------------------------------------- */
.image-tile { border-radius: 10px; padding: 9px; z-index: 5; }
.image-tile img { display: block; width: 100%; height: 100%; border-radius: 8px; border: 1px solid var(--border); }
.image-tile.linked img { border-color: rgba(125, 227, 140, 0.5); }

/* ---- Browser preview tile --------------------------------------------- */
.browser {
  font-family: var(--mono);
  border-radius: 10px; overflow: hidden; background: var(--tile);
  border: 1px solid var(--border); box-shadow: 0 16px 44px rgba(0, 0, 0, 0.5);
  display: flex; flex-direction: column; z-index: 5;
}
.browser .chrome { height: 32px; flex: 0 0 32px; background: var(--tile-bar); display: flex; align-items: center; gap: 8px; padding: 0 12px; border-bottom: 1px solid var(--divider); }
.browser .chrome .dots { display: flex; gap: 7px; }
.browser .chrome .dots i { width: 10px; height: 10px; border-radius: 50%; background: rgba(102,110,102,0.7); }
.browser .chrome .url { flex: 1; height: 18px; background: var(--inset); border-radius: 9px; font-size: 10.5px; color: var(--text-dim); display: flex; align-items: center; padding: 0 10px; }
.browser .page { flex: 1; overflow: hidden; position: relative; background: #14171b; }

/* mini cat landing page rendered inside the browser */
.catsite { position: absolute; inset: 0; font-family: var(--sans); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: #f4f1fb; background: radial-gradient(120% 90% at 50% 0%, #241c33, #120f1a); gap: 10px; opacity: 0; transition: opacity 0.6s ease; }
.catsite.show { opacity: 1; }
.catsite img { width: 96px; height: 96px; border-radius: 16px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); }
.catsite h1 { font-size: 20px; font-weight: 700; letter-spacing: -0.3px; }
.catsite p { font-size: 11px; color: #b6acd0; max-width: 250px; }
.catsite .adopt { margin-top: 4px; font-size: 11px; font-weight: 600; color: #0e100e; background: var(--green); padding: 6px 16px; border-radius: 999px; }
.catsite .strip { display: flex; gap: 6px; margin-top: 4px; }
.catsite .strip span { width: 26px; height: 26px; border-radius: 7px; }
.catsite .strip span:nth-child(1) { background: linear-gradient(160deg, #7de28c, #5fe0c8); }
.catsite .strip span:nth-child(2) { background: linear-gradient(160deg, #5c9ef5, #9b7bff); }
.catsite .strip span:nth-child(3) { background: linear-gradient(160deg, #ef6ea0, #f5c754); }
.catsite .strip span:nth-child(4) { background: linear-gradient(160deg, #f5c754, #7de28c); }

/* ---- Edge glow (off-screen activity cue) ------------------------------ */
.edge-glow {
  position: fixed; top: 0; bottom: 0; right: 0; width: 240px;
  pointer-events: none; z-index: 40; opacity: 0;
  background: radial-gradient(60% 42% at 100% 50%,
    rgba(245, 199, 84, 0.55), rgba(245, 199, 84, 0.16) 45%, transparent 72%);
  transition: opacity 0.9s ease;
}
.edge-glow.on { opacity: 1; animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }

/* ---- Marketing chrome -------------------------------------------------- */
/* Header pill — mirrors Sources/ptyparty/SessionBadgeView.swift metrics:
   height 46, radius 14, hPad 14, icon 28, icon→word gap 12, element gap 9. */
.badge {
  position: fixed; top: 22px; left: 26px; z-index: 60;
  display: flex; align-items: center;
  height: 46px; padding: 0 14px;
  background: var(--tile);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.32);
  font-family: var(--mono);
  white-space: nowrap;
}
.badge .glyph { width: 28px; height: 28px; display: block; margin-right: 12px; }
.badge .word  { font-size: 15px; font-weight: 700; color: var(--text); }
.badge .slash { font-size: 15px; font-weight: 500; color: var(--green); margin-left: 9px; }
.badge .sess  { font-size: 14px; font-weight: 500; color: var(--text-dim); margin-left: 9px; }
.badge .host  { font-size: 12px; font-weight: 500; color: var(--text-dim); margin-left: 9px; }
.badge .chev  { font-size: 10px; font-weight: 600; color: var(--text-dim); margin-left: 9px; }

.cta {
  position: fixed; top: 20px; right: 26px; z-index: 60;
  display: flex; gap: 10px; align-items: center;
}
.cta a {
  font-size: 12.5px; color: var(--text); text-decoration: none;
  padding: 8px 15px; border-radius: 8px; border: 1px solid var(--border);
  background: rgba(20, 22, 20, 0.6); backdrop-filter: blur(6px);
  transition: border-color 0.2s ease, color 0.2s ease;
}
.cta a:hover { border-color: var(--green); color: var(--green); }
.cta a.primary { background: var(--green); color: #0e100e; border-color: var(--green); font-weight: 600; }
.cta a.primary:hover { color: #0e100e; filter: brightness(1.08); }

.lower {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 55;
  padding: 88px 0 76px; text-align: center; pointer-events: none;
  background: linear-gradient(to top, rgba(11,13,11,0.92), transparent);
}
.lower .headline {
  font-size: clamp(20px, 3.4vw, 40px); font-weight: 700; letter-spacing: -0.6px;
  color: var(--text); margin-bottom: 10px;
}
.lower .headline .accent { color: var(--green); }
.lower .caption {
  font-size: clamp(12px, 1.5vw, 15px); color: var(--text-dim);
  min-height: 1.4em; transition: opacity 0.4s ease;
  max-width: 680px; margin: 0 auto;
}
.lower .caption.swap { opacity: 0; }

/* progress + replay */
.controls { position: fixed; left: 50%; transform: translateX(-50%); bottom: 16px; z-index: 60; display: flex; align-items: center; gap: 12px; pointer-events: auto; }
.track-bar { width: 200px; height: 3px; background: rgba(140,161,143,0.2); border-radius: 2px; overflow: hidden; }
.track-bar .bar { height: 100%; width: 0; background: var(--green); transition: width 0.4s linear; }
.replay {
  font-size: 11.5px; color: var(--text-dim); background: none; border: none; cursor: pointer;
  font-family: var(--sans); display: flex; align-items: center; gap: 6px;
}
.replay:hover { color: var(--green); }

@media (prefers-reduced-motion: reduce) {
  .world { transition: none; }
  .status.asking .dot, .edge-glow.on { animation: none; }
}

/* ---- Mobile: trim the header to logo + wordmark, shrink the CTA --------- */
@media (max-width: 640px) {
  .badge {
    top: 14px; left: 14px; height: 40px; padding: 0 12px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.32);
  }
  .badge .glyph { width: 24px; height: 24px; margin-right: 9px; }
  .badge .word { font-size: 14px; }
  /* drop the "/ session ▾  Local ▾" segment — keep just the logo + wordmark */
  .badge .slash, .badge .sess, .badge .host, .badge .chev { display: none; }

  .cta { top: 16px; right: 14px; gap: 8px; }
  .cta a { padding: 7px 11px; font-size: 12px; }
  .dl-rest { display: none; }

  .lower { padding: 70px 0 64px; }
  .lower .headline { letter-spacing: -0.4px; }
  .controls { bottom: 12px; }
  .track-bar { width: 150px; }
}
