/* ============================================================
   Cryptera motion layer: the living chip, the wordmark, Range tools,
   the podium, the solve moment, sliding tab indicators, page transitions.
   Everything that moves stops for prefers-reduced-motion.
   ============================================================ */
:root{--signals:url("../img/brand/signals-sand.svg?v=2");--signals-panel:url("../img/brand/signals-maroon.svg");
  --spring:cubic-bezier(.34,1.56,.64,1);}
body.dark{--signals:url("../img/brand/signals-ink.svg?v=2");}

/* ---------- the ground is never flat: traces with signals running along them ---------- */
.cr-app{position:relative;isolation:isolate;}
.cr-app::before{content:"";position:fixed;inset:0;z-index:-1;pointer-events:none;background:var(--signals) 0 0/600px;opacity:.55;}
.cr-app:has(.cr-home)::before,.cr-app:has(.cr-auth)::before{display:none;}

/* ---------- sidebar: chip + CrypteraCTF wordmark ---------- */
.cr-brand-row{display:flex;align-items:center;gap:12px;}
.cr-wordmark{font-family:var(--font-head);font-weight:700;font-size:24px;line-height:1;letter-spacing:-.01em;color:var(--on-chrome);direction:ltr;white-space:nowrap;}
.cr-brand:hover .cr-brand-row img{animation:crNudge .5s var(--spring);}
@keyframes crNudge{40%{transform:rotate(-6deg) scale(1.06);}}

/* ---------- the living chip ---------- */
.cr-chip-anim{overflow:visible;position:relative;display:inline-block;width:320px;aspect-ratio:1;flex:none;}
.cr-chip-anim > *{overflow:visible;position:absolute;inset:0;width:100%;height:100%;}
.cr-chip-anim path,.cr-chip-anim .ring{fill:none;stroke-width:84;stroke-linejoin:miter;}
.cr-chip-anim .ring{stroke-width:92;}
.cr-chip-base *{stroke:var(--cr-sand);stroke-dasharray:1 1;stroke-dashoffset:0;}
/* The drain EMPTIES the channels rather than repainting them: the base sand retracts and nothing takes its
   place, so chip-solid.png's transparent channel cut-outs show the page background through. The old ink layer
   covered the sand with the shield's own maroon instead, which is why a drained channel never looked clear.
   It is kept in the markup but not drawn, so this is one line to undo. */
.cr-chip-ink{display:none;}
.cr-chip-ink *{stroke:var(--cr-maroon);stroke-dasharray:1 1;stroke-dashoffset:1;}
.cr-chip-ink .tr{stroke-dashoffset:-1;}
.cr-chip-fill *{stroke:var(--cr-sand);stroke-dasharray:1 1;stroke-dashoffset:1;}
.cr-chip-nodes circle{fill:var(--cr-cream);transform-box:fill-box;transform-origin:center;}
@media(max-width:560px){.cr-home .cr-chip-anim{width:200px;}}
@keyframes crInkTr{0%{stroke-dashoffset:-1;}18%,100%{stroke-dashoffset:0;}}
@keyframes crInkRing{0%,14%{stroke-dashoffset:1;}26%,100%{stroke-dashoffset:0;}}
@keyframes crBaseTr{0%{stroke-dashoffset:0;}18%,68%{stroke-dashoffset:-1;}86%,100%{stroke-dashoffset:0;}}
@keyframes crBaseRing{0%,14%{stroke-dashoffset:0;}26%,44%{stroke-dashoffset:1;}60%,100%{stroke-dashoffset:0;}}
@keyframes crFillRing{0%,34%{stroke-dashoffset:1;}44%,100%{stroke-dashoffset:0;}}
@keyframes crFillTr{0%,42%{stroke-dashoffset:1;}68%,100%{stroke-dashoffset:0;}}
/* The node must never shrink while it is maroon: chip-solid.png has a cream contact disc burned in out to
   r~68 (groove starts at 71), so a smaller maroon disc leaves a cream halo around it - the 'glitchy' look
   on the way back. The circles are r=70 to cover that disc, and the maroon half holds scale(1). */
@keyframes crNodeBeat{0%,12%{fill:var(--cr-cream);transform:scale(1);}24%,34%{fill:var(--cr-maroon);transform:scale(1);}
  42%{fill:var(--cr-cream);transform:scale(1.08);}52%,100%{fill:var(--cr-cream);transform:scale(1);}}
@media(prefers-reduced-motion:no-preference){
  .cr-chip-anim.is-on .cr-chip-base .tr{animation:crBaseTr var(--chip-loop,6s) var(--ease) infinite;}
  .cr-chip-anim.is-on .cr-chip-base .ring{animation:crBaseRing var(--chip-loop,6s) var(--ease) infinite;}
  .cr-chip-anim.is-on .cr-chip-ink .tr{animation:crInkTr var(--chip-loop,6s) var(--ease) infinite;}
  .cr-chip-anim.is-on .cr-chip-ink .ring{animation:crInkRing var(--chip-loop,6s) var(--ease) infinite;}
  .cr-chip-anim.is-on .cr-chip-fill .ring{animation:crFillRing var(--chip-loop,6s) var(--ease) infinite;}
  .cr-chip-anim.is-on .cr-chip-fill .tr{animation:crFillTr var(--chip-loop,6s) var(--ease) infinite;}
  .cr-chip-anim.is-on .cr-chip-nodes circle{animation:crNodeBeat var(--chip-loop,6s) var(--ease) infinite;}
  .cr-chip-anim.is-on .t2,.cr-chip-anim.is-on .t5,.cr-chip-anim.is-on .t8,.cr-chip-anim.is-on .r2,.cr-chip-anim.is-on .cr-chip-nodes circle:nth-child(2){animation-delay:.12s!important;}
  .cr-chip-anim.is-on .t3,.cr-chip-anim.is-on .t6,.cr-chip-anim.is-on .t9,.cr-chip-anim.is-on .r3,.cr-chip-anim.is-on .cr-chip-nodes circle:nth-child(3){animation-delay:.24s!important;}
  .cr-chip-anim.is-once *{animation-iteration-count:1!important;}
}

/* ---------- sliding indicators for tabs and segmented controls ---------- */
.cr-slide{position:relative;}
.cr-slide > .cr-ind{position:absolute;left:0;top:0;pointer-events:none;transition:transform .38s var(--spring),width .38s var(--spring),height .38s var(--spring);}
.nav-tabs.cr-slide > .cr-ind{top:auto;bottom:-1.5px;height:2px;background:var(--accent);}
.nav-tabs.cr-slide .nav-link.active{border-bottom-color:transparent;}
.cr-settings-nav.cr-slide > .cr-ind{border-radius:var(--radius-pill);background:var(--accent);z-index:0;}
.cr-settings-nav.cr-slide .nav-link{position:relative;z-index:1;background:transparent!important;transition:color .25s;}
.cr-settings-nav.cr-slide .nav-link.active{color:var(--on-accent)!important;}
.tab-pane.fade{transition:opacity .25s ease,transform .3s var(--ease);transform:translateY(6px);}
.tab-pane.fade.show{transform:none;}

/* ---------- The Range: tools ---------- */
.cr-range-tools{display:flex;flex-wrap:wrap;align-items:center;gap:12px 16px;margin:0 0 8px;padding:16px;border-radius:var(--radius-card);
  background:var(--surface);border:var(--rule) solid var(--line-2);animation:crRise .45s var(--ease) .05s both;}
.cr-search{position:relative;flex:1 1 240px;margin:0;}
.cr-search i{position:absolute;inset-inline-start:16px;top:50%;transform:translateY(-50%);color:var(--text-3);font-size:14px;pointer-events:none;}
.cr-search input{width:100%;height:44px;border-radius:var(--radius-pill);border:var(--rule) solid var(--field-line);background:var(--field);color:var(--text);
  padding-inline:42px 16px;font-family:var(--font-head);font-size:16px;transition:border-color .15s;}
.cr-search input:focus{outline:none;border-color:var(--accent);box-shadow:0 0 0 1px var(--accent);}
.cr-seg{display:inline-flex;padding:4px;border-radius:var(--radius-pill);background:var(--bg);border:var(--rule) solid var(--line-2);gap:2px;}
.cr-seg > .cr-ind{top:4px;bottom:4px;border-radius:var(--radius-pill);background:var(--accent);}
.cr-seg button{position:relative;z-index:1;border:0;background:transparent;color:var(--text-2);font-family:var(--font-mono);font-weight:700;font-size:12px;
  letter-spacing:.08em;text-transform:uppercase;padding:8px 14px;border-radius:var(--radius-pill);cursor:pointer;transition:color .2s;white-space:nowrap;}
.cr-seg button[aria-pressed="true"]{color:var(--on-accent);}
.cr-seg button:focus-visible{outline:2px solid var(--accent);outline-offset:2px;}
.cr-chips{display:flex;flex-wrap:wrap;gap:8px;flex-basis:100%;}
.cr-chip{display:inline-flex;align-items:center;gap:8px;height:36px;padding:0 14px 0 10px;border-radius:var(--radius-pill);cursor:pointer;
  border:var(--rule) solid var(--line-2);background:transparent;color:var(--text);font-family:var(--font-head);font-weight:600;font-size:14px;
  transition:background-color .2s,color .2s,border-color .2s,transform .25s var(--spring);}
.cr-chip .cr-icon{width:18px;height:18px;}
.cr-chip:hover{border-color:var(--accent);transform:translateY(-2px);}
.cr-chip[aria-pressed="true"]{background:var(--accent);border-color:var(--accent);color:var(--on-accent);}
.cr-chip em{font-style:normal;font-family:var(--font-mono);font-size:11px;opacity:.75;}
.cr-count{margin-inline-start:auto;font-family:var(--font-mono);font-size:12px;font-weight:700;letter-spacing:.08em;color:var(--text-2);text-transform:uppercase;}
.cr-empty-filter{padding:48px 16px;text-align:center;color:var(--text-2);font-size:17px;}
.cr-out{display:none!important;}
/* category headers carry their glyph; cards carry it faintly, plus difficulty */
.category-header h3 .cr-cat-ico{width:26px;height:26px;flex:none;display:grid;place-items:center;border-radius:8px;background:var(--accent);color:var(--on-accent);}
.category-header h3 .cr-cat-ico .cr-icon{width:16px;height:16px;}
.challenge-button .cr-card-ico{position:absolute;inset-inline-end:12px;bottom:10px;width:44px;height:44px;opacity:.12;color:var(--accent);
  transition:transform .35s var(--spring),opacity .2s;pointer-events:none;}
.challenge-button:hover .cr-card-ico{transform:rotate(-8deg) scale(1.15);opacity:.28;}
.challenge-button.solved-challenge .cr-card-ico{color:var(--cr-sand);}
.challenge-button .cr-diff{order:3;align-self:flex-start;font-style:normal;font-family:var(--font-mono);font-weight:700;font-size:10px;letter-spacing:.12em;
  text-transform:uppercase;padding:3px 8px;border-radius:var(--radius-pill);border:var(--rule) solid currentColor;color:var(--text-2);}
.challenge-button .cr-diff i{display:inline-block;width:6px;height:6px;margin-inline-end:6px;border-radius:50%;background:currentColor;vertical-align:1px;}
.challenge-button .cr-diff[data-d="1"] i{opacity:.4;} .challenge-button .cr-diff[data-d="2"] i{opacity:.65;}
.challenge-button.solved-challenge .cr-diff{color:var(--cr-sand);}
/* a card that was just solved floods maroon from the corner */
.challenge-button.cr-just-solved{animation:crFlood .9s var(--ease) both;}
@keyframes crFlood{0%{clip-path:circle(0 at 100% 0);}100%{clip-path:circle(150% at 100% 0);}}

/* ---------- the solve moment ---------- */
.cr-captured{position:absolute;inset:0;z-index:30;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:16px;text-align:center;
  background:var(--cr-ink) var(--signals-panel) 0 0/600px;color:var(--cr-cream);animation:crFadeIn .25s ease both;cursor:pointer;overflow:hidden;}
.cr-captured.is-out{animation:crOut .35s ease forwards;}
@keyframes crOut{to{opacity:0;transform:scale(1.02);}}
.cr-captured .cr-chip-anim{width:170px;--chip-loop:2.2s;animation:crChipIn .6s var(--spring) both;}
@keyframes crChipIn{from{transform:scale(.4) rotate(-12deg);opacity:0;}}
.cr-captured .lbl{font-family:var(--font-mono);font-weight:700;font-size:12px;letter-spacing:.22em;text-transform:uppercase;color:var(--cr-sand);}
.cr-captured .ttl{font-family:var(--font-head);font-weight:700;font-size:clamp(32px,6vw,52px);line-height:1;letter-spacing:-.01em;color:var(--cr-cream);direction:ltr;}
.cr-captured .pts{font-family:var(--font-mono);font-weight:700;font-size:22px;color:var(--cr-sand);animation:crRise .5s var(--ease) .5s both;}
.cr-captured .ray{position:absolute;left:50%;top:50%;width:46vmax;height:4px;margin-top:-2px;transform-origin:0 50%;background:var(--cr-sand);opacity:.0;
  animation:crRay .9s var(--ease) both;}
.cr-captured .ray::after{content:"";position:absolute;right:0;top:50%;width:14px;height:14px;margin-top:-7px;border-radius:50%;background:var(--cr-sand);}
@keyframes crRay{0%{opacity:.9;clip-path:inset(0 100% 0 18%);}70%{opacity:.9;}100%{opacity:0;clip-path:inset(0 0 0 60%);}}
.cr-captured .hint{position:absolute;bottom:16px;font-family:var(--font-mono);font-size:11px;letter-spacing:.12em;text-transform:uppercase;color:var(--cr-ink-40);}

/* ---------- scoreboard: podium, stickers, the hacker on top ---------- */
.cr-podium{display:grid;grid-template-columns:1fr 1.15fr 1fr;align-items:end;gap:10px;margin-top:8px;}
.cr-pod{display:flex;flex-direction:column;align-items:center;gap:8px;min-width:0;text-align:center;text-decoration:none!important;color:var(--text)!important;}
.cr-pod .who{display:grid;place-items:center;width:52px;height:52px;border-radius:var(--radius-panel);background:var(--accent);color:var(--on-accent);
  font-family:var(--font-mono);font-weight:700;font-size:16px;position:relative;}
.cr-pod.p1 .who{width:68px;height:68px;background:var(--cr-maroon);color:var(--cr-sand);}
body.dark .cr-pod.p1 .who{background:var(--cr-sand);color:var(--cr-maroon);}
.cr-pod.p1 .who .cr-icon{width:42px;height:42px;}
.cr-pod .crown{position:absolute;top:-18px;left:50%;width:26px;height:26px;margin-left:-13px;color:var(--accent);animation:crBob 2.4s ease-in-out infinite;}
@keyframes crBob{50%{transform:translateY(-4px) rotate(-6deg);}}
.cr-pod .nm{font-weight:700;font-size:14px;max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.cr-pod .bar{width:100%;border-radius:12px 12px 4px 4px;display:flex;flex-direction:column;align-items:center;justify-content:flex-start;gap:2px;padding-top:10px;
  background:var(--surface-2);border:var(--rule) solid var(--line-2);transform-origin:bottom;animation:crGrow .8s var(--spring) both;}
.cr-pod.p1 .bar{height:120px;background:var(--cr-maroon);border-color:var(--cr-maroon);color:var(--cr-sand);animation-delay:.35s;}
.cr-pod.p2 .bar{height:88px;animation-delay:.2s;} .cr-pod.p3 .bar{height:66px;animation-delay:.5s;}
.cr-pod .bar b{font-family:var(--font-mono);font-size:22px;line-height:1;}
.cr-pod .bar span{font-family:var(--font-mono);font-size:12px;font-weight:700;opacity:.85;}
@keyframes crGrow{from{transform:scaleY(0);}}
.cr-pod > :not(.bar){animation:crRise .5s var(--ease) both;}
.cr-pod.p1 > :not(.bar){animation-delay:.75s;} .cr-pod.p2 > :not(.bar){animation-delay:.6s;} .cr-pod.p3 > :not(.bar){animation-delay:.9s;}

/* die-cut stickers: a cream keyline, a small tilt, they slap on */
.cr-sticker{display:inline-flex;align-items:center;gap:6px;padding:4px 10px 4px 8px;border-radius:8px;font-family:var(--font-mono);font-weight:700;font-size:10px;
  letter-spacing:.1em;text-transform:uppercase;line-height:1.2;white-space:nowrap;vertical-align:2px;margin-inline-start:10px;
  outline:2px solid var(--cr-cream);outline-offset:-1px;transform:rotate(-4deg);animation:crSlap .55s var(--spring) both;}
.cr-sticker .cr-icon{width:14px;height:14px;}
.cr-sticker.s1{background:var(--cr-maroon);color:var(--cr-sand);}
.cr-sticker.s2{background:var(--cr-sand);color:var(--cr-maroon);outline-color:var(--cr-maroon);transform:rotate(3deg);}
.cr-sticker.s3{background:var(--cr-ink);color:var(--cr-cream);outline-color:var(--cr-sand);transform:rotate(-2deg);}
@keyframes crSlap{0%{opacity:0;transform:scale(1.8) rotate(-18deg);}60%{opacity:1;}}
.cr-sticker:hover{animation:crWiggle .5s ease;}
@keyframes crWiggle{25%{transform:rotate(4deg) scale(1.06);}75%{transform:rotate(-6deg) scale(1.06);}}
#scoreboard tr.cr-r1 td,#scoreboard tr.cr-r1 th{background:color-mix(in srgb,var(--cr-maroon) 10%,transparent);}
body.dark #scoreboard tr.cr-r1 td,body.dark #scoreboard tr.cr-r1 th{background:color-mix(in srgb,var(--cr-sand) 8%,transparent);}
.cr-hacker{display:inline-grid;place-items:center;width:30px;height:30px;border-radius:8px;margin-inline-end:10px;vertical-align:middle;
  background:var(--cr-maroon);color:var(--cr-sand);}
body.dark .cr-hacker{background:var(--cr-sand);color:var(--cr-maroon);}
.cr-hacker .cr-icon{width:20px;height:20px;}
#scoreboard tr.cr-r1 .cr-place{animation:crBeat 2.4s ease-in-out infinite;}
@keyframes crBeat{0%,70%,100%{transform:scale(1);}80%{transform:scale(1.15);}}

/* ---------- Discord note on register ---------- */
.cr-discord-note{display:flex;align-items:center;gap:12px;margin:-4px 0 20px;padding:12px 14px;border-radius:var(--radius-panel);
  background:var(--bg);border:var(--rule) dashed var(--line);font-size:15px;line-height:1.35;}
.cr-discord-note i{font-size:22px;color:var(--accent);flex:none;}
.cr-discord-note a{font-weight:700;}

/* ---------- page transitions (Chrome, Edge, Safari 18) ---------- */
@view-transition{navigation:auto;}
.cr-sidebar{view-transition-name:cr-nav;}
.cr-topbar{view-transition-name:cr-top;}
@media(prefers-reduced-motion:no-preference){
  ::view-transition-old(root){animation:crVtOut .22s ease both;}
  ::view-transition-new(root){animation:crVtIn .38s var(--ease) both;}
}
@keyframes crVtOut{to{opacity:0;transform:translateY(-8px);}}
@keyframes crVtIn{from{opacity:0;transform:translateY(14px);}}

/* buttons press like they mean it */
.btn,.cr-act,.cr-chip,.cr-seg button{transition:background-color .15s,border-color .15s,color .15s,transform .3s var(--spring);}
.btn:active,.cr-act:active,.cr-chip:active{transform:scale(.96)!important;}


/* the home chip: centred, its three side lines run out to the panel's edge and drain/fill with it */
.cr-logo-row{justify-content:center;}
.cr-home-panel{overflow:hidden;}
/* side lines: only on the home chip, in the accent (maroon on light, sand on dark); they drain to the panel and refill */
.cr-chip-anim .t4,.cr-chip-anim .t5,.cr-chip-anim .t6,.cr-chip-anim .t7,.cr-chip-anim .t8,.cr-chip-anim .t9{display:none;stroke-width:48;}
.cr-logo-row .cr-chip-anim :is(.t4,.t5,.t6,.t7,.t8,.t9){display:inline;}
.cr-chip-base :is(.t4,.t5,.t6,.t7,.t8,.t9),.cr-chip-fill :is(.t4,.t5,.t6,.t7,.t8,.t9){stroke:var(--accent);}
.cr-chip-ink :is(.t4,.t5,.t6,.t7,.t8,.t9){stroke:var(--bg);stroke-width:72;}
