/* The companions section (home/companions.js): a note you write in while your agents join it, drawn the way the
   app's companion plugin draws them. */
.companions { max-width: 1100px; margin: 64px auto 0; padding: 0 24px; }
.companions .window { background: var(--paper); transition: opacity 0.5s; }
.companions.fade .window { opacity: 0; }
.companions .window-bar span { font-size: 0.8rem; }

.note-head { display: flex; align-items: center; height: 44px; padding: 0 18px; border-bottom: 1px solid var(--edge); font-size: 0.8rem; color: var(--muted); }
.note-head .crumbs { margin-right: auto; }
.note-head .crumbs b { font-weight: 500; color: var(--fg); }
.presence { display: flex; align-items: center; height: 24px; }
.presence .face { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; margin-left: -6px; background: var(--c); color: #fff; font-size: 0.72rem; font-weight: 650; box-shadow: 0 0 0 2px var(--paper); animation: cpop 0.32s cubic-bezier(0.2, 0.9, 0.3, 1.25); }

.note-body { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 260px; grid-template-rows: auto 1fr; align-content: start; column-gap: 32px; height: 440px; padding: 34px 28px 0 52px; overflow: hidden; font-size: 1.04rem; line-height: 1.65; }
.note-body h3 { grid-column: 1; font-family: Inter, sans-serif; font-weight: 650; font-size: 1.7rem; letter-spacing: -0.02em; line-height: 1.2; margin-bottom: 0.9rem; }
.lines { grid-column: 1; }
.lines .line { min-height: 1.65em; }
.lines .gap { height: 0.9em; }
.lines .li { position: relative; padding-left: 24px; }
.lines .li::before { content: ""; position: absolute; left: 9px; top: 0.72em; width: 5px; height: 5px; border-radius: 50%; background: var(--bullet); }
.lines .todo::before { top: 0.36em; left: 3px; width: 13px; height: 13px; border-radius: 4px; background: none; border: 1.5px solid var(--faint); }
.lines .todo .date { color: var(--muted); font-size: 0.88em; }
.mention { border-radius: 5px; transition: background 0.2s, color 0.2s; }
/* Lit while its agent thinks on it, like the app's (cm-companion-asked). */
.mention.asked { background: color-mix(in srgb, var(--c) 26%, transparent); animation: cpulse 1.1s ease-in-out infinite; }
/* What an agent just wrote, lit in its tint, then fading (cm-companion-typed). */
.typed { background: color-mix(in srgb, var(--c) 24%, transparent); border-radius: 2px; animation: cfade 4s ease-in forwards; }
.mention.on { padding: 1px 4px; background: color-mix(in srgb, var(--c) 14%, transparent); color: color-mix(in srgb, var(--c) 78%, var(--fg)); font-weight: 550; }
.hl { border-radius: 3px; transition: background 0.4s; }
.hl.on { background: color-mix(in srgb, var(--c) 22%, transparent); }
.ghost { color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent); border-radius: 3px; padding: 0 2px; margin-left: 2px; transition: color 0.5s, background 1.2s; }
.ghost.taken { color: inherit; background: transparent; margin-left: 0; padding: 0; }
.caret { display: inline-block; width: 1.5px; height: 1.15em; margin-left: 1px; vertical-align: -0.2em; background: var(--fg); animation: cblink 1.05s steps(1) infinite; }

.margin { grid-column: 2; grid-row: 1 / span 2; position: relative; }
.mcard { position: absolute; left: 0; width: 100%; padding: 8px 10px 9px 15px; border-radius: 10px; border: 1px solid var(--edge); background: var(--raised); font-size: 0.82rem; line-height: 1.45; box-shadow: 0 8px 22px -8px rgba(var(--shade), 0.22); animation: cpop 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.25); transform-origin: top left; transition: opacity 0.4s, top 0.3s; }
.mcard::before { content: ""; position: absolute; left: 5px; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: var(--c); }
.mcard b { display: block; font-size: 0.74rem; font-weight: 650; color: color-mix(in srgb, var(--c) 72%, var(--fg)); margin-bottom: 2px; }
.mcard .accept { display: inline-flex; align-items: center; gap: 5px; height: 26px; margin-top: 7px; padding: 0 9px; border-radius: 7px; background: var(--c); color: #fff; font-size: 0.78rem; font-weight: 600; transition: transform 0.12s, filter 0.12s; }
.mcard .accept kbd { font: inherit; opacity: 0.72; }
.mcard .accept.press { transform: scale(0.94); filter: brightness(0.9); }
.mcard.gone { opacity: 0; }

/* Cursors: the app's arrow in the agent's tint, its name on a flag beside it while it works, dimmed when idle. */
.cursors { position: absolute; inset: 0; pointer-events: none; }
.ccursor { position: absolute; top: 0; left: 0; transition: transform 0.65s cubic-bezier(0.2, 0.85, 0.25, 1), opacity 0.3s; }
.ccursor.fast { transition: transform 0.09s linear, opacity 0.3s; }
.ccursor[data-state="idle"] { opacity: 0.55; }
.ccursor[data-state="idle"] .flag { opacity: 0; }
.ccursor.gone { opacity: 0; }
.ccursor svg { display: block; width: 20px; height: 20px; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35)); }
.ccursor path { fill: var(--c); stroke: #fff; stroke-width: 1.6; stroke-linejoin: round; }
.ccursor[data-state="thinking"] svg { animation: cbob 1.1s ease-in-out infinite; }
.ccursor .flag { position: absolute; top: 18px; left: 13px; display: flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; background: var(--c); color: #fff; font-size: 0.72rem; font-weight: 600; white-space: nowrap; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15); transition: opacity 0.3s; }
.ccursor .dots { display: none; gap: 2px; }
.ccursor[data-state="thinking"] .dots, .ccursor[data-state="reading"] .dots { display: inline-flex; }
.ccursor .dots i { width: 3px; height: 3px; border-radius: 9px; background: currentColor; animation: cdot 1s infinite ease-in-out; }
.ccursor .dots i:nth-child(2) { animation-delay: 0.15s; }
.ccursor .dots i:nth-child(3) { animation-delay: 0.3s; }

@keyframes cpop { from { opacity: 0; scale: 0.85; } }
@keyframes cblink { 50% { opacity: 0; } }
@keyframes cbob { 50% { transform: translate(1px, -3px) rotate(-6deg); } }
@keyframes cdot { 0%, 80%, 100% { opacity: 0.35; } 40% { opacity: 1; } }
@keyframes cfade { 0%, 40% {} 100% { background-color: transparent; } }
@keyframes cpulse { 50% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 28%, transparent); } }

/* No margin column on a phone: comments float under the line they're about. */
@media (max-width: 760px) {
  .companions { margin-top: 44px; padding: 0 16px; }
  .note-body { grid-template-columns: minmax(0, 1fr); height: 560px; padding: 22px 18px 0 26px; font-size: 0.92rem; }
  .note-body h3 { font-size: 1.4rem; }
  .margin { position: absolute; inset: 0; pointer-events: none; }
  .mcard { left: auto; right: 14px; width: min(250px, 80%); }
}
@media (prefers-reduced-motion: reduce) {
  .companions *, .companions .window { animation: none !important; transition: none !important; }
  .typed { background: none; }
}
