/* Routing, agent, memory and the everyday tiles. The studio wall is in wall.css. */

.chip {
  height: 36px; padding: 0 15px; border-radius: 999px; border: 1px solid var(--line-2);
  font-size: 0.9rem; font-weight: 550; color: var(--mist);
  transition: color 0.2s, background-color 0.2s, border-color 0.2s;
}
.chip:hover { color: var(--frost); border-color: rgba(232, 238, 246, 0.4); }
.chip[aria-pressed="true"] { color: var(--night); background: var(--frost); border-color: var(--frost); }
.seg {
  display: inline-flex; gap: 4px; padding: 4px; border-radius: 14px;
  background: rgba(232, 238, 246, 0.04); border: 1px solid var(--line);
}
.seg button {
  display: grid; text-align: left; line-height: 1.25; padding: 8px 16px; border-radius: 10px;
  font-size: 0.95rem; font-weight: 620; color: var(--mist); transition: background-color 0.25s, color 0.25s;
}
.seg button span { font-size: 0.75rem; font-weight: 500; color: var(--fog); transition: color 0.25s; }
.seg button:hover { color: var(--frost); }
.seg button[aria-selected="true"] { background: rgba(232, 238, 246, 0.09); color: var(--frost); box-shadow: inset 0 0 0 1px var(--line-2); }
.seg button[aria-selected="true"] span { color: var(--copper-lite); }

/* A typing caret, shared by the routing answer and the agent terminal. */
.o-answer.typing::after, .al-cmd.typing code::after {
  content: ""; display: inline-block; width: 2px; height: 1em; margin-left: 2px; vertical-align: -2px;
  background: var(--copper-lite); animation: caret 0.9s steps(1) infinite;
}
@keyframes caret { 50% { opacity: 0; } }

/* Agent */
.agent-grid { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: clamp(36px, 6vw, 88px); align-items: center; }
.agent .chapter-head { margin-bottom: 0; }
.points { list-style: none; padding: 0; display: grid; gap: 20px; margin-top: 36px; }
.points li { display: grid; grid-template-columns: 42px 1fr; gap: 16px; align-items: start; }
.points svg {
  width: 42px; height: 42px; padding: 10px; border-radius: 12px; color: var(--copper-lite);
  border: 1px solid var(--line); background: rgba(232, 238, 246, 0.04);
}
.points h3 { font-size: 1.0625rem; margin-bottom: 2px; }
.points p { font-size: 0.95rem; color: var(--mist); }
.agent-win {
  overflow: hidden; border-radius: 18px; border: 1px solid var(--line-2); background: #070c17;
  box-shadow: 0 60px 140px -40px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.agent-bar { display: flex; align-items: center; gap: 14px; height: 46px; padding: 0 16px; border-bottom: 1px solid var(--line); background: rgba(232, 238, 246, 0.03); }
.agent-dots { display: flex; gap: 6px; }
.agent-dots i { width: 10px; height: 10px; border-radius: 50%; background: rgba(232, 238, 246, 0.14); }
.agent-title { font-size: 0.8125rem; font-weight: 600; color: var(--mist); }
.agent-state { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; font-size: 0.8125rem; font-weight: 600; color: var(--copper-lite); }
.agent-state i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 10px currentColor; animation: beat 1.4s ease-in-out infinite; }
.agent-state.done { color: var(--ok); }
.agent-state.done i { animation: none; }
@keyframes beat { 50% { opacity: 0.35; transform: scale(0.7); } }
.agent-task { display: grid; gap: 4px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.agent-task span { font-size: 0.75rem; font-weight: 600; color: var(--fog); }
.agent-task p { color: var(--frost); }
.agent-log {
  list-style: none; margin: 0; padding: 18px 20px; height: 440px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 11px; font-size: 0.875rem; scroll-behavior: smooth;
  scrollbar-width: thin; scrollbar-color: var(--line-2) transparent;
}
.al { display: flex; align-items: flex-start; gap: 10px; opacity: 0; transform: translateY(6px); transition: opacity 0.4s var(--ease), transform 0.5s var(--ease); }
.al.on { opacity: 1; transform: none; }
.al svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.al code { font-family: var(--mono); font-size: 0.8125rem; line-height: 1.55; word-break: break-word; }
.al-cmd { color: var(--frost); }
.al-prompt { font-family: var(--mono); font-size: 0.8125rem; color: var(--copper-lite); }
.al-err { color: var(--err); }
.al-ok { color: var(--ok); }
.al-note { color: var(--mist); }
.al-note svg { color: var(--copper-lite); }
.al-chart { display: block; padding: 12px 12px 4px; border-radius: 12px; border: 1px solid var(--line); background: rgba(232, 238, 246, 0.03); }
.al .agent-chart { width: 100%; height: auto; margin: 0; overflow: visible; }
.agent-chart .t { font-size: 11px; font-weight: 600; fill: var(--mist); }
.agent-chart line { stroke: var(--line-2); }
.agent-chart rect { fill: var(--glacier); transform-box: fill-box; transform-origin: 50% 100%; transform: scaleY(0); transition: transform 0.9s var(--ease) calc(var(--i) * 50ms); }
.al-chart.on rect { transform: none; }
.agent-chart rect:last-child { fill: var(--copper-lite); }
.agent-chart .labels text { font-size: 10px; fill: var(--fog); text-anchor: end; transform-box: fill-box; transform-origin: 100% 50%; transition: transform 0.7s var(--ease), fill 0.4s; }
.agent-chart:not(.fixed) .labels text { fill: #d98a8a; }
.agent-chart.fixed .labels text { transform: rotate(-45deg); }
.agent-file {
  display: flex; align-items: center; gap: 12px; width: 100%; max-width: 340px; padding: 12px 14px;
  border-radius: 12px; border: 1px solid rgba(240, 196, 143, 0.4); background: rgba(200, 144, 96, 0.09);
  box-shadow: 0 16px 40px -18px rgba(200, 144, 96, 0.7);
}
.agent-file svg { width: 22px; height: 22px; margin: 0; color: var(--copper-lite); }
.agent-file div { display: grid; flex: 1; }
.agent-file strong { font-size: 0.9rem; color: var(--frost); }
.agent-file span { font-size: 0.78rem; color: var(--mist); }
.al-file.on .agent-file { animation: pop 0.6s var(--ease); }
@keyframes pop { from { transform: scale(0.92); } }
.agent-foot { display: flex; justify-content: flex-end; min-height: 64px; padding: 12px 16px; border-top: 1px solid var(--line); }

/* Memory */
.memory { background: radial-gradient(50% 40% at 85% 60%, rgba(200, 144, 96, 0.07), transparent 70%); }
.memory-grid { display: grid; grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.25fr); gap: clamp(36px, 5vw, 72px); align-items: center; }
.memory .chapter-head { margin-bottom: 0; }
.memory-stage { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 60px; align-items: center; }
.recall { position: relative; z-index: 1; display: grid; gap: 10px; justify-items: start; }
.mem {
  padding: 9px 14px 10px; border-radius: 12px; border: 1px solid var(--line); background: rgba(10, 17, 31, 0.85);
  opacity: 0; transform: translateX(-12px);
  transition: opacity 0.6s var(--ease) calc(var(--i) * 90ms), transform 0.7s var(--ease) calc(var(--i) * 90ms), border-color 0.4s, background-color 0.4s, box-shadow 0.4s;
}
.mem:nth-child(3n + 2) { margin-left: 34px; }
.mem:nth-child(3n) { margin-left: 14px; }
.mem p { font-size: 0.9rem; font-weight: 580; line-height: 1.35; color: var(--frost); }
.mem span { font-size: 0.75rem; color: var(--fog); }
.memory-stage.on .mem { opacity: 1; transform: none; }
.memory-stage.on .mem.dim { opacity: 0.4; transition-delay: 0s; }
.mem.lit { border-color: rgba(240, 196, 143, 0.55); background: rgba(40, 30, 24, 0.9); box-shadow: 0 0 34px -8px rgba(200, 144, 96, 0.55); transition-delay: 0s; }
.mem.lit span { color: var(--copper-lite); }
.mem-lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.mem-lines path { fill: none; stroke: url(#mem-grad); stroke-width: 1.6; stroke-dasharray: 1; stroke-dashoffset: 1; }
.mem-lines.draw path { animation: draw 0.9s var(--ease) forwards; }
.mem-lines circle { fill: var(--copper-lite); }
@keyframes draw { to { stroke-dashoffset: 0; } }
.phone {
  position: relative; width: 290px; aspect-ratio: 290 / 600; padding: 11px; border-radius: 46px;
  background: linear-gradient(160deg, #1b2539, #0a0f1b);
  box-shadow: inset 0 0 0 1.5px rgba(232, 238, 246, 0.14), 0 0 0 7px #04070d, 0 0 0 8px rgba(232, 238, 246, 0.09), 0 70px 120px -30px rgba(0, 0, 0, 0.95);
}
.phone::before { content: ""; position: absolute; top: 22px; left: 50%; width: 88px; height: 25px; border-radius: 20px; background: #03050a; transform: translateX(-50%); z-index: 1; }
.phone-screen {
  height: 100%; overflow: hidden; border-radius: 36px; padding: 64px 12px 14px; display: flex; flex-direction: column; gap: 8px;
  background: radial-gradient(120% 60% at 50% 0%, rgba(78, 142, 184, 0.38), transparent 62%), radial-gradient(100% 60% at 80% 100%, rgba(200, 144, 96, 0.34), transparent 62%), #0b1322;
}
.phone-time { font-size: 3.7rem; font-weight: 600; font-stretch: 104%; line-height: 1; letter-spacing: -0.02em; text-align: center; }
.phone-date { margin-bottom: 20px; font-size: 0.85rem; color: var(--mist); text-align: center; }
.note {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 11px 13px; border-radius: 18px;
  background: rgba(232, 238, 246, 0.11); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  opacity: 0; transform: translateY(-16px) scale(0.97); cursor: default;
  transition: opacity 0.5s var(--ease), transform 0.7s var(--ease), background-color 0.4s, box-shadow 0.4s;
}
.no-js .note, .note.in { opacity: 1; transform: none; }
.note b { font-size: 0.75rem; font-weight: 650; }
.note span { font-size: 0.7rem; color: var(--mist); }
.note p { grid-column: 1 / -1; font-size: 0.82rem; line-height: 1.38; color: var(--frost); }
.note.lit { background: rgba(240, 196, 143, 0.2); box-shadow: 0 0 0 1px rgba(240, 196, 143, 0.5), 0 14px 34px -12px rgba(200, 144, 96, 0.6); }
.note:focus-visible { outline-offset: 2px; border-radius: 18px; }

@media (max-width: 1099px) {
  .memory-grid { grid-template-columns: minmax(0, 1fr); }
  .memory-stage { grid-template-columns: minmax(0, 1fr) 280px; }
}
@media (max-width: 699px) {
  .memory-stage { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .mem-lines { display: none; }
  .recall { display: flex; flex-wrap: wrap; gap: 8px; }
  .mem, .mem:nth-child(3n + 2), .mem:nth-child(3n) { margin-left: 0; }
  .phone { margin-inline: auto; width: min(290px, 86vw); }
}

/* Everyday tiles */
.bento { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px; }
.tile {
  --mx: 50%; --my: 0%;
  position: relative; grid-column: span 2; min-height: 236px; overflow: hidden; display: flex; flex-direction: column;
  padding: 28px; border-radius: var(--r-l); border: 1px solid var(--line);
  background: radial-gradient(420px circle at var(--mx) var(--my), rgba(240, 196, 143, 0.07), transparent 60%), linear-gradient(180deg, rgba(18, 29, 51, 0.6), rgba(10, 17, 31, 0.5));
  transition: border-color 0.3s;
}
.tile:hover { border-color: var(--line-2); }
.tile-docs, .tile-see { grid-column: span 3; min-height: 300px; }
.tile-bill { grid-column: span 6; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; column-gap: 32px; }
.tile > svg { width: 28px; height: 28px; margin-bottom: 18px; color: var(--copper-lite); }
.tile h3 { margin-bottom: 8px; }
.tile p { max-width: 30em; font-size: 0.95rem; color: var(--mist); }
.tile-bill > svg, .tile-bill h3, .tile-bill p { grid-column: 1; }
.tile-art { margin-top: auto; padding-top: 28px; }
.docs-art { position: relative; height: 110px; }
.docs-art i {
  position: absolute; bottom: 0; left: calc(var(--k) * 38px); width: 88px; height: 108px; border-radius: 8px;
  border: 1px solid var(--line-2); background: linear-gradient(180deg, #16223a, #0f182b);
  transform: rotate(calc((var(--k) - 1.5) * 5deg)); transform-origin: 50% 100%; transition: transform 0.6s var(--ease), left 0.6s var(--ease);
}
.docs-art i::before { content: ""; position: absolute; inset: 16px 14px auto; height: 44px; background: repeating-linear-gradient(180deg, rgba(172, 198, 226, 0.28) 0 3px, transparent 3px 11px); }
.docs-art i::after { content: ""; position: absolute; left: 14px; bottom: 14px; width: 30px; height: 22px; border-radius: 3px; background: linear-gradient(90deg, var(--glacier) 0 30%, transparent 30% 38%, var(--copper) 38% 68%, transparent 68% 76%, var(--glacier) 76%); opacity: 0.7; }
.docs-art i:nth-child(1) { --k: 0; } .docs-art i:nth-child(2) { --k: 1; } .docs-art i:nth-child(3) { --k: 2; } .docs-art i:nth-child(4) { --k: 3; }
.tile-docs:hover .docs-art i { left: calc(var(--k) * 64px); transform: rotate(calc((var(--k) - 1.5) * 2deg)); }
.wave-art {
  height: 110px; border-radius: 10px;
  background: repeating-linear-gradient(90deg, var(--glacier) 0 3px, transparent 3px 7px);
  -webkit-mask: radial-gradient(60% 50% at 30% 50%, #000 30%, transparent 72%), radial-gradient(40% 42% at 72% 50%, #000 20%, transparent 72%);
  mask: radial-gradient(60% 50% at 30% 50%, #000 30%, transparent 72%), radial-gradient(40% 42% at 72% 50%, #000 20%, transparent 72%);
  opacity: 0.75; animation: wave 3.2s ease-in-out infinite alternate;
}
@keyframes wave { to { transform: scaleY(0.72); opacity: 0.55; } }
.bill-art { grid-column: 2; grid-row: 1 / span 3; position: relative; height: 150px; padding: 0; margin: 0; }
.bill-art i {
  position: absolute; top: 20px; left: calc(10% + var(--k) * 15%); width: 96px; height: 116px; border-radius: 8px;
  border: 1px solid var(--line-2); background: linear-gradient(180deg, #16223a, #0f182b);
  transform: rotate(calc((var(--k) - 2) * 6deg)); transition: left 0.8s var(--ease), transform 0.8s var(--ease), opacity 0.6s;
}
.bill-art i::before { content: ""; position: absolute; inset: 16px 14px auto; height: 30px; background: repeating-linear-gradient(180deg, rgba(172, 198, 226, 0.25) 0 3px, transparent 3px 10px); }
.bill-art i:nth-child(1) { --k: 0; } .bill-art i:nth-child(2) { --k: 1; } .bill-art i:nth-child(3) { --k: 2; } .bill-art i:nth-child(4) { --k: 3; }
.bill-art i:nth-child(5) { --k: 4; border-color: rgba(240, 196, 143, 0.55); background: linear-gradient(180deg, #2a2119, #17130f); }
.bill-art i:nth-child(5)::after { content: "1"; position: absolute; right: 12px; bottom: 10px; font-size: 1.6rem; font-weight: 700; color: var(--copper-lite); }
.tile-bill:hover .bill-art i, .tile-bill.in .bill-art i { left: 42%; transform: rotate(0); }
.tile-bill:hover .bill-art i:not(:last-child), .tile-bill.in .bill-art i:not(:last-child) { opacity: 0; }

@media (max-width: 959px) {
  .agent-grid { grid-template-columns: minmax(0, 1fr); }
  .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile, .tile-docs, .tile-see { grid-column: span 1; }
  .tile-bill { grid-column: span 2; }
}
@media (max-width: 599px) {
  .bento { grid-template-columns: minmax(0, 1fr); }
  .tile, .tile-docs, .tile-see, .tile-bill { grid-column: span 1; }
  .tile-bill { grid-template-columns: minmax(0, 1fr); }
  .bill-art { grid-column: 1; grid-row: auto; }
  .agent-log { height: 400px; }
}
.tile-bill.in .bill-art i { transition-delay: 0.8s; }
@media (max-width: 599px) {
  .seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); width: 100%; }
  .seg button { padding: 8px 10px; font-size: 0.875rem; white-space: nowrap; }
  .seg button span { font-size: 0.7rem; }
  .mem { padding: 7px 11px 8px; }
  .mem p { font-size: 0.82rem; }
  .mem span { font-size: 0.7rem; }
}
