/* Blixtflow – teamchattens sida. Bygger på ai.css (rubrik, fakta, kort, steg, frågor) men har egen rörelse:
   en teamchatt som pratar av sig själv, en mening som tänds ord för ord (team.js sätter .is-lit),
   ett före/efter-reglage (--pos) och en skrivruta där @ och # blir taggar medan man skriver. */

/* ==========================================================================
   1. Hjälten
   ========================================================================== */
.tcp-hero {
  position: relative; isolation: isolate; overflow: clip;
  padding: calc(var(--header-h) + env(safe-area-inset-top) + 26px) 0 calc(var(--sheet-r) + 60px);
  color: #fff; background: var(--natt);
}
.tcp-hero__grid { display: grid; gap: 46px; align-items: center; }
@media (min-width: 1024px) { .tcp-hero__grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 56px; } }
.tcp-live { position: relative; padding: 20px 0 40px; }
.tcp-live__glow { position: absolute; inset: 10% 5%; border-radius: 50%; background: radial-gradient(closest-side, rgba(155, 93, 229, .5), transparent); filter: blur(10px); }
.motion .tcp-live { animation: chp-rise 1.3s .3s var(--ease-out) backwards; }
.tcp-win {
  position: relative; display: grid; grid-template-columns: 170px minmax(0, 1fr); height: 470px; overflow: hidden; border-radius: 22px; color: var(--ink); background: #fff;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .12), 0 70px 110px -50px rgba(0, 0, 0, .95), 0 40px 120px -40px rgba(155, 93, 229, .7);
}
.tcp-side { display: grid; align-content: start; gap: 3px; padding: 16px 10px; color: rgba(255, 255, 255, .75); background: var(--natt); }
.tcp-side__h { margin: 10px 8px 4px; font-size: .66rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--ton); }
.tcp-side__h:first-child { margin-top: 0; }
.tcp-side__ch, .tcp-side__dm { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 9px; font-size: .8rem; font-weight: 600; }
.tcp-side__ch.is-on { color: var(--natt); background: var(--gnista); }
.tcp-side__ch b { margin-left: auto; display: grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; font-size: .62rem; color: #fff; background: #D6363F; }
.tcp-av { position: relative; display: grid; flex: none; place-items: center; width: 24px; height: 24px; border-radius: 50%; font-size: .66rem; font-weight: 800; color: #fff; background: var(--c); }
.tcp-av--lg { width: 36px; height: 36px; font-size: .8rem; }
.tcp-dot { position: absolute; right: -2px; bottom: -2px; width: 9px; height: 9px; border-radius: 50%; box-shadow: 0 0 0 2px var(--natt); background: #16A34A; }
.tcp-dot--busy { background: #F59E0B; }
.tcp-dot--away { background: #9CA3AF; }
.tcp-main { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-width: 0; }
.tcp-main__head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.tcp-main__head b { font-size: 1rem; }
.tcp-stack { display: flex; }
.tcp-stack .tcp-av { margin-left: -7px; box-shadow: 0 0 0 2px #fff; }
.tcp-msgs { display: flex; flex-direction: column; justify-content: flex-end; gap: 14px; overflow: hidden; padding: 16px 18px; }
.tcp-msg { display: flex; align-items: flex-start; gap: 11px; }
.tcp-msg__b { display: grid; gap: 2px; min-width: 0; font-size: .88rem; line-height: 1.45; }
.tcp-msg__meta { display: flex; align-items: baseline; gap: 8px; }
.tcp-msg__meta b { font-size: .85rem; }
.tcp-msg__meta small { font-size: .7rem; color: var(--muted); }
.tcp-file { display: grid; grid-template-columns: 56px auto; align-items: center; gap: 10px; width: max-content; max-width: 100%; margin-top: 6px; padding: 6px 12px 6px 6px; border-radius: 12px; font-size: .78rem; font-weight: 650; background: var(--ljus); box-shadow: inset 0 0 0 1px var(--line); }
.tcp-file i { height: 40px; border-radius: 8px; background: linear-gradient(135deg, #C8A8F2, #7E45C9); }
.tcp-file span { display: inline-flex; align-items: center; gap: 6px; }
.tcp-file .ic { width: 14px; height: 14px; color: var(--primar-ink); }
.tcp-typing { display: flex; align-items: center; gap: 10px; }
.tcp-dots { display: inline-flex; gap: 3px; padding: 9px 11px; border-radius: 12px; background: var(--line-2); }
.tcp-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--primar); }
.motion .tcp-dots i { animation: fm-dot 1s ease-in-out infinite; }
.tcp-dots i:nth-child(2) { animation-delay: .15s !important; }
.tcp-dots i:nth-child(3) { animation-delay: .3s !important; }
.tcp-input { display: flex; align-items: center; gap: 10px; margin: 0 14px 14px; padding: 9px 9px 9px 16px; border-radius: 14px; font-size: .84rem; color: var(--muted); background: var(--ljus); box-shadow: inset 0 0 0 1px var(--line); }
.tcp-input span { flex: 1; }
.tcp-input i { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; color: #fff; background: var(--primar-ink); }
.tcp-input .ic { width: 15px; height: 15px; }
/* Samtalet spelas upp om och om igen (12 s) */
.motion .tcp-msgs .tcp-msg { animation: tcp-msg 12s var(--ease-out) infinite both; animation-delay: calc(var(--i) * 1.4s); }
.motion .tcp-msgs .tcp-typing { animation: tcp-typing 12s infinite both; }
.tcp-toast {
  position: absolute; right: -10px; top: 0; z-index: 3; display: flex; align-items: center; gap: 10px; padding: 10px 16px 10px 10px; border-radius: 16px;
  color: var(--ink); background: #fff; box-shadow: 0 24px 50px -18px rgba(0, 0, 0, .75);
}
.tcp-toast span { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; color: var(--natt); background: var(--gnista); }
.tcp-toast .ic { width: 18px; height: 18px; }
.motion .tcp-toast { animation: tcp-toast 12s var(--spring) infinite both; }
.motion .tcp-toast .ic { animation: shake 12s ease-in-out infinite; animation-delay: 4.6s; }
.tcp-bx { position: absolute; left: -60px; bottom: -6px; z-index: 3; width: 130px; }
@media (max-width: 1023px) { .tcp-bx { left: auto; right: -6px; bottom: -40px; width: 110px; } }
@media (max-width: 599px) {
  .tcp-win { grid-template-columns: minmax(0, 1fr); height: 440px; }
  .tcp-side { display: none; }
  .tcp-toast { right: 0; top: -14px; font-size: .85rem; }
}

/* ==========================================================================
   2. Meningen som tänds ord för ord
   ========================================================================== */
.tcp-say { position: relative; z-index: 1; margin-top: calc(var(--sheet-r) * -1); border-radius: var(--sheet-r) var(--sheet-r) 0 0; background: var(--natt-3); }
.tcp-say__sticky { display: grid; place-items: center; min-height: 70vh; padding: clamp(80px, 10vw, 140px) 0; }
.tcp-say.is-pinned { height: 220vh; }
.tcp-say.is-pinned .tcp-say__sticky { position: sticky; top: 0; height: 100vh; height: 100svh; min-height: 0; padding: 0; }
.tcp-say__text { max-width: 1100px; font-size: clamp(2rem, 1.2rem + 3.6vw, 4.6rem); font-weight: 800; letter-spacing: -.04em; line-height: 1.08; text-wrap: balance; }
.tcp-w { color: #fff; transition: color .4s, text-shadow .4s; }
.tcp-say.is-pinned .tcp-w { color: rgba(200, 168, 242, .18); }
.tcp-say.is-pinned .tcp-w.is-lit { color: #fff; }
.tcp-say.is-pinned .tcp-w.is-hot { color: var(--gnista); text-shadow: 0 0 40px rgba(242, 250, 163, .45); }

/* ==========================================================================
   4. Före och efter
   ========================================================================== */
.tcp-ba { background: linear-gradient(180deg, var(--natt), #321147); }
.tcp-cmp { position: relative; height: 460px; overflow: hidden; border-radius: 30px; box-shadow: 0 0 0 1px rgba(200, 168, 242, .2), 0 60px 100px -40px rgba(0, 0, 0, .9); user-select: none; }
.tcp-cmp__side { position: absolute; inset: 0; padding: 26px; }
.tcp-cmp__before { background: repeating-linear-gradient(45deg, #2a1236 0 18px, #2d1339 18px 36px); }
.tcp-cmp__after { display: grid; place-items: center end; padding-right: 5%; background: radial-gradient(80% 80% at 70% 30%, #5b2a80, #3A1650); clip-path: inset(0 0 0 var(--pos)); }
.tcp-cmp__label { position: absolute; left: 22px; top: 20px; z-index: 2; padding: 6px 13px; border-radius: 999px; font-size: .8rem; font-weight: 800; color: #fff; background: rgba(214, 54, 63, .85); }
.tcp-cmp__label--after { left: auto; right: 22px; color: var(--natt); background: var(--gnista); }
.tcp-mess { position: absolute; inset: 0; }
.tcp-note { position: absolute; max-width: 240px; padding: 14px 16px; font-size: .9rem; font-weight: 650; line-height: 1.35; color: var(--ink); box-shadow: 0 16px 30px -12px rgba(0, 0, 0, .6); }
.tcp-note--1 { left: 6%; top: 18%; background: #fff; border-radius: 12px; rotate: -5deg; }
.tcp-note--2 { left: 30%; top: 46%; color: #fff; background: #1D4ED8; border-radius: 18px 18px 18px 4px; rotate: 4deg; }
.tcp-note--3 { left: 8%; top: 64%; background: #FEF08A; border-radius: 2px; rotate: -8deg; }
.tcp-note--4 { left: 44%; top: 14%; background: #E9D5FF; border-radius: 12px; rotate: 6deg; }
.tcp-note--5 { left: 58%; top: 70%; color: #fff; background: #BE185D; border-radius: 999px; rotate: -3deg; }
.motion .tcp-note { animation: tcp-jitter 3.4s ease-in-out infinite; animation-delay: calc(var(--j, 0) * -.7s); }
.tcp-note--2 { --j: 1; } .tcp-note--3 { --j: 2; } .tcp-note--4 { --j: 3; } .tcp-note--5 { --j: 4; }
.tcp-clean { width: min(420px, 44%); padding: 18px; border-radius: 22px; color: var(--ink); background: #fff; box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .8); }
.tcp-clean__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding-bottom: 12px; margin-bottom: 14px; border-bottom: 1px solid var(--line-2); }
.tcp-ticket { padding: 4px 10px; border-radius: 8px; font-size: .74rem; font-style: normal; font-weight: 700; color: #fff; background: var(--natt); }
.tcp-msg--static { margin-bottom: 12px; }
.tcp-clean__note { display: flex; align-items: center; gap: 8px; margin-top: 6px; padding: 10px 12px; border-radius: 12px; font-size: .85rem; font-weight: 650; color: var(--ok); background: var(--ok-soft); }
.tcp-clean__note .ic { width: 16px; height: 16px; stroke-width: 3; }
.tcp-cmp__line { position: absolute; top: 0; bottom: 0; left: var(--pos); z-index: 3; width: 3px; margin-left: -1.5px; background: var(--gnista); box-shadow: 0 0 20px rgba(242, 250, 163, .7); pointer-events: none; }
.tcp-cmp__line i { position: absolute; left: 50%; top: 50%; display: flex; align-items: center; justify-content: center; width: 54px; height: 54px; border-radius: 50%; translate: -50% -50%; color: var(--natt); background: var(--gnista); box-shadow: 0 10px 30px -6px rgba(0, 0, 0, .6); }
.tcp-cmp__line .ic { width: 18px; height: 18px; stroke-width: 2.6; }
.tcp-cmp__line .ic:first-child { transform: rotate(90deg); margin-right: -4px; }
.tcp-cmp__line .ic:last-child { transform: rotate(-90deg); margin-left: -4px; }
.tcp-cmp__range { position: absolute; inset: 0; z-index: 4; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; }
.tcp-cmp:focus-within .tcp-cmp__line i { box-shadow: 0 0 0 4px #fff, 0 10px 30px -6px rgba(0, 0, 0, .6); }
@media (max-width: 699px) {
  .tcp-cmp { height: 520px; }
  .tcp-cmp__after { place-items: end center; padding: 70px 14px 20px; }
  .tcp-clean { width: 100%; }
  .tcp-note { max-width: 170px; padding: 10px 12px; font-size: .8rem; }
  .tcp-note--2 { left: 18%; top: 38%; } .tcp-note--4 { left: 40%; top: 20%; } .tcp-note--5 { left: 40%; top: 82%; }
}

/* ==========================================================================
   5. Skrivrutan
   ========================================================================== */
.tcp-type__grid { display: grid; gap: 40px; align-items: center; }
@media (min-width: 1000px) { .tcp-type__grid { grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 64px; } }
.tcp-hints { display: grid; gap: 10px; margin-top: 24px; }
.tcp-hints li { display: flex; align-items: center; gap: 12px; font-weight: 650; }
.tcp-hints .fm-at, .tcp-hints .fm-ref { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border-radius: 11px; font-size: 1.1rem; text-decoration: none; }
.tcp-composer { overflow: hidden; border-radius: 28px; background: #fff; box-shadow: 0 0 0 1px var(--line), 0 60px 110px -40px rgba(44, 14, 61, .5); }
.tcp-composer__log { display: flex; flex-direction: column; justify-content: flex-end; gap: 12px; min-height: 230px; max-height: 300px; overflow-y: auto; padding: 20px; background: var(--ljus); }
.tcp-composer__log .tcp-msg { animation: bub-in .45s var(--ease-out) both; }
.tcp-composer__box { padding: 16px; border-top: 1px solid var(--line-2); }
.tcp-field { position: relative; }
.tcp-field input, .tcp-field__mirror { width: 100%; min-height: 54px; margin: 0; padding: 14px 16px; border-radius: 16px; font: inherit; font-size: 1.05rem; line-height: 1.5; letter-spacing: normal; white-space: pre; overflow: hidden; }
.tcp-field input { position: relative; z-index: 1; border: 1.5px solid #DDD0EC; color: transparent; caret-color: var(--ink); background: transparent; }
.tcp-field input::placeholder { color: #8C7F99; }
.tcp-field input:focus { outline: none; border-color: var(--primar-ink); box-shadow: 0 0 0 4px rgba(155, 93, 229, .2); }
.tcp-field__mirror { position: absolute; inset: 0; border: 1.5px solid transparent; color: var(--ink); background: var(--ljus); }
.tcp-field__mirror .fm-at, .tcp-field__mirror .fm-ref { padding: 0; border-radius: 4px; box-shadow: 0 0 0 2px var(--gnista); }
.tcp-field__mirror .fm-ref { box-shadow: 0 0 0 2px var(--soft); }
.tcp-composer__foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
.tcp-sample { display: inline-flex; align-items: center; gap: 7px; padding: 8px 13px; border: 0; border-radius: 999px; cursor: pointer; font-size: .84rem; font-weight: 650; color: var(--primar-ink); background: var(--soft); }
.tcp-sample .ic { width: 15px; height: 15px; }
.tcp-send { display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border: 0; border-radius: 12px; cursor: pointer; font-size: .92rem; font-weight: 700; color: #fff; background: var(--primar-ink); transition: transform .3s var(--spring); }
.tcp-send:hover { transform: translateY(-2px); }
.tcp-send .ic { width: 16px; height: 16px; }
.tcp-detect { display: flex; flex-wrap: wrap; gap: 8px; min-height: 34px; margin-top: 12px; }
.tcp-detect span { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px; font-size: .8rem; font-weight: 700; animation: pop-in .35s var(--spring) both; }
.tcp-detect .is-at { color: var(--natt); background: var(--gnista); }
.tcp-detect .is-hash { color: #fff; background: var(--primar-ink); }
.tcp-detect .ic { width: 14px; height: 14px; }

/* ==========================================================================
   6. Status
   ========================================================================== */
.tcp-status { padding-top: 0; }
.tcp-board { display: grid; gap: 24px; align-items: center; padding: 28px; border-radius: 32px; background: #fff; box-shadow: 0 0 0 1px var(--line), var(--shadow-2); }
.tcp-me { display: grid; justify-items: center; gap: 12px; text-align: center; }
.tcp-me__av { --sc: #16A34A; display: grid; place-items: center; width: 110px; height: 110px; border-radius: 50%; font-size: 1.2rem; font-weight: 800; color: #fff; background: radial-gradient(circle at 35% 30%, #6b33a0, var(--natt)); box-shadow: 0 0 0 6px #fff, 0 0 0 11px var(--sc), 0 20px 50px -10px var(--sc); transition: box-shadow .5s var(--ease-out); }
.motion .tcp-me__av.is-bump { animation: bump .5s var(--spring); }
.tcp-me__label { font-size: 1.15rem; font-weight: 800; }
.tcp-opts { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.tcp-opt { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border: 0; border-radius: 999px; cursor: pointer; font-size: .88rem; font-weight: 650; color: var(--ink); background: var(--ljus); box-shadow: inset 0 0 0 1px var(--line); transition: background-color .2s, color .2s, transform .3s var(--spring); }
.tcp-opt i { width: 10px; height: 10px; border-radius: 50%; background: var(--oc); }
.tcp-opt:hover { transform: translateY(-2px); }
.tcp-opt[aria-pressed="true"] { color: #fff; background: var(--natt); box-shadow: none; }
.tcp-team { display: grid; gap: 10px; }
.tcp-team li { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 18px; background: var(--ljus); }
.tcp-team b { display: block; font-size: .98rem; }
.tcp-team small { display: inline-flex; align-items: center; gap: 6px; font-size: .84rem; color: var(--muted); }
.tcp-team small i { width: 9px; height: 9px; border-radius: 50%; }
.tcp-ring { position: absolute; inset: -4px; border-radius: 50%; box-shadow: 0 0 0 2.5px var(--sc); }
.motion .tcp-team li:nth-child(odd) .tcp-ring { animation: tcp-pulse 2.4s ease-out infinite; }
.reveal-on .tcp-board .tcp-team li { opacity: 0; transform: translateX(20px); }
.reveal-on .tcp-board.is-in .tcp-team li { opacity: 1; transform: none; transition: opacity .5s, transform .7s var(--spring); transition-delay: calc(.2s + var(--i) * 100ms); }
@media (min-width: 900px) { .tcp-board { grid-template-columns: 1fr 1fr; gap: 48px; padding: 44px; } }

/* ==========================================================================
   7. Funktioner och integritet
   ========================================================================== */
.tcp-feats { padding-top: 0; padding-bottom: calc(clamp(76px, 10vw, 136px) + var(--sheet-r)); }
.tcp-private { display: flex; align-items: center; gap: 20px; margin-top: 30px; padding: 26px 28px; border-radius: 26px; color: #fff; background: radial-gradient(120% 140% at 100% 0%, #5b2a80, var(--natt) 60%); box-shadow: var(--shadow-2); }
.tcp-private__ic { display: grid; flex: none; place-items: center; width: 60px; height: 60px; border-radius: 20px; color: var(--natt); background: var(--gnista); }
.tcp-private__ic .ic { width: 28px; height: 28px; }
.tcp-private h3 { font-size: 1.3rem; font-weight: 800; }
.tcp-private p { margin-top: 4px; color: var(--on-dark-muted); }
.tcp-go { padding-bottom: calc(clamp(76px, 10vw, 136px) + var(--sheet-r)); }

@keyframes tcp-msg { 0% { opacity: 0; transform: translateY(16px) scale(.97); } 4%, 88% { opacity: 1; transform: none; } 96%, 100% { opacity: 0; transform: translateY(-8px); } }
@keyframes tcp-typing { 0%, 44% { opacity: 0; } 48%, 84% { opacity: 1; } 88%, 100% { opacity: 0; } }
@keyframes tcp-toast { 0%, 36% { opacity: 0; transform: translateY(-16px) scale(.9); } 40%, 86% { opacity: 1; transform: none; } 92%, 100% { opacity: 0; transform: translateY(-10px); } }
@keyframes tcp-jitter { 0%, 100% { translate: 0 0; } 50% { translate: 3px -5px; } }
@keyframes tcp-pulse { 0% { box-shadow: 0 0 0 2.5px var(--sc); } 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 2.5px var(--sc); } }
