/* Subscribe system — shared styles (email-as-backend notifications;
   design of record: notify/README.md). Loaded wherever subscribe
   buttons render: Frequently Updated posts (via _layouts/blog-post.html),
   the homepage and the blog index. Tokens are the site's own — the
   same variables on every page.

   The interaction model follows the YouTube pattern the owner asked
   for: a big high-contrast pill, a bell that RINGS (decaying swing
   from its top hinge, clapper following a beat behind, radiating
   arcs), and a clear flipped state once subscribed. */

/* ---------- the bar (card) ---------- */
.sub-bar{position:relative;border-radius:20px;padding:1.15rem 1.25rem 1.05rem;
  background:linear-gradient(180deg,rgba(255,138,23,.10),rgba(255,138,23,.03) 55%,rgba(255,255,255,.02));
  border:1px solid var(--line-hot,rgba(255,138,23,.45));
  box-shadow:0 0 0 1px rgba(0,0,0,.35),0 12px 34px rgba(0,0,0,.45),0 0 26px rgba(255,110,0,.13);
  margin:1.4rem 0}
.sub-bar::before{content:"";position:absolute;inset:0 0 auto 0;height:1px;border-radius:20px;
  background:linear-gradient(90deg,transparent,rgba(255,198,92,.75),transparent)}
.sub-bar-head{display:flex;gap:.9rem;align-items:flex-start;margin-bottom:.95rem}
.sub-badge{flex:0 0 auto;width:46px;height:46px;border-radius:14px;display:grid;place-items:center;
  background:var(--grad,linear-gradient(100deg,#ff4d00,#ff8617 45%,#ffc65c));color:#180a00;
  box-shadow:0 6px 18px rgba(255,110,0,.35)}
.sub-badge svg{width:26px;height:26px}
.sub-bar-title{font-family:var(--disp,"Space Grotesk",sans-serif);font-weight:700;font-size:1.16rem;
  line-height:1.15;letter-spacing:-.01em;color:var(--txt,#eceef3);margin:0}
.sub-bar-sub{font-size:.9rem;line-height:1.45;color:var(--mut,#757c8c);margin:.24rem 0 0;max-width:56ch}

/* title-area placement (every blog post, first child of .page-hd,
   above the kicker): just the button + its status line */
.page-hd-sub{display:flex;flex-wrap:wrap;align-items:center;gap:.55rem .8rem;margin:0 0 20px}

/* compact variant (the FU template banner): no card, one row.
   inline-flex so the button group and the "?" chip flow in a
   single row — the chip directly right of the button. */
.sub-bar--compact{position:relative;display:inline-flex;flex-wrap:wrap;align-items:center;gap:.45rem;
  background:none;border:0;box-shadow:none;padding:0;margin:0;border-radius:0}
.sub-bar--compact .sub-btns{display:inline-flex;flex-wrap:nowrap}
.sub-bar--compact::before{display:none}
.sub-bar--compact .sub-btn{padding:.55rem .9rem}
.sub-bar--compact .sub-btn-eyebrow{display:none}
/* status messages are TOASTS: fixed at the top right of the
   viewport, never in flow, so they can never push a layout around
   — on any subscribe bar (banner, title area, homepage). No close
   button: they fade after a few seconds (subscribe.js); errors stay. */
[data-sub-bar] .sub-status{position:fixed;top:84px;right:14px;z-index:1200;display:flex;align-items:center;gap:.55rem;
  background:#14161c;border:1px solid var(--line-hot,rgba(255,138,23,.45));border-radius:10px;
  padding:.5rem .7rem;font-size:.8rem;line-height:1.4;text-align:left;color:var(--txt,#eceef3);
  max-width:min(320px,86vw);box-shadow:0 12px 34px rgba(0,0,0,.55)}
/* busy toast: a spinner just taller than the text, on its left */
[data-sub-bar] .sub-status.is-busy::before{content:"";flex:none;width:1.15em;height:1.15em;border-radius:50%;
  border:2px solid rgba(255,176,58,.25);border-top-color:var(--amber,#ffb03a);
  animation:subSpin .7s linear infinite}
@keyframes subSpin{to{transform:rotate(360deg)}}
[data-sub-bar] .sub-status:empty{display:none}

/* ---------- the buttons ---------- */
.sub-btns{display:flex;flex-wrap:wrap;gap:.6rem}
.sub-btn{position:relative;display:inline-flex;align-items:center;gap:.6rem;cursor:pointer;
  border-radius:999px;padding:.72rem 1.15rem;line-height:1;text-align:left;
  font-family:var(--disp,"Space Grotesk",sans-serif);
  border:1px solid var(--line-hot,rgba(255,138,23,.45));color:var(--txt,#eceef3);
  background:rgba(255,255,255,.03);transition:transform .15s ease,filter .15s ease,background .2s ease}
.sub-btn:hover{transform:translateY(-1px);filter:brightness(1.12)}
.sub-btn:active{transform:translateY(0) scale(.985)}
.sub-btn--primary{background:var(--grad,linear-gradient(100deg,#ff4d00,#ff8617 45%,#ffc65c));
  color:#180a00;border-color:transparent;box-shadow:0 8px 22px rgba(255,110,0,.35)}
.sub-btn-copy{display:flex;flex-direction:column;gap:.16rem}
.sub-btn-eyebrow{font-family:var(--mono,"JetBrains Mono",monospace);font-size:.6rem;font-weight:700;
  letter-spacing:.14em;text-transform:uppercase;opacity:.72}
.sub-btn-label{font-weight:700;font-size:1.04rem;letter-spacing:.01em;white-space:nowrap;line-height:1.1}
.sub-btn .bell{flex:0 0 auto;width:21px;height:21px}
.bell-wrap{position:relative;display:inline-flex;flex:none}
/* subscribed proof: a little green check badge over the bell's
   bottom-right corner, popping in on the flip */
.bell-check{position:absolute;right:-6px;bottom:-5px;width:13px;height:13px;
  opacity:0;transform:scale(.3);pointer-events:none;
  transition:opacity .25s ease,transform .35s cubic-bezier(.34,1.56,.64,1)}
.sub-btn.is-subscribed .bell-check{opacity:1;transform:scale(1)}

/* attention halo on the primary button */
.sub-btn--primary::after{content:"";position:absolute;inset:-2px;border-radius:999px;
  border:2px solid rgba(255,150,40,.55);opacity:0;pointer-events:none;
  animation:sub-halo 3.4s ease-out infinite}
@keyframes sub-halo{0%{opacity:0;transform:scale(.98)}18%{opacity:.75}55%{opacity:0;transform:scale(1.13)}100%{opacity:0}}

/* the "?" beside Watch: a small round chip with a tooltip bubble
   (hover/focus on desktop, tap-toggle on touch via subscribe.js) */
.tip-wrap{position:relative;display:inline-flex}
.q-tip{width:21px;height:21px;border-radius:50%;border:1px solid var(--line-hot,rgba(255,138,23,.45));
  background:rgba(255,255,255,.04);color:var(--amber,#ffb03a);font-family:var(--mono,monospace);
  font-size:.72rem;font-weight:700;line-height:1;cursor:pointer;padding:0}
.q-tip:hover,.tip-wrap.open .q-tip{background:rgba(255,138,23,.16)}
.q-tip-bubble{position:absolute;top:calc(100% + 9px);left:50%;transform:translateX(-50%) translateY(-3px);
  width:max-content;max-width:min(260px,80vw);background:#14161c;color:var(--txt,#eceef3);
  border:1px solid var(--line-hot,rgba(255,138,23,.45));border-radius:10px;padding:.55rem .7rem;
  font-size:.78rem;line-height:1.45;text-align:left;z-index:60;opacity:0;visibility:hidden;
  transition:opacity .18s ease,transform .18s ease,visibility .18s;pointer-events:none;
  box-shadow:0 10px 30px rgba(0,0,0,.5)}
.tip-wrap:hover .q-tip-bubble,.tip-wrap:focus-within .q-tip-bubble,.tip-wrap.open .q-tip-bubble{
  opacity:1;visibility:visible;transform:translateX(-50%) translateY(0)}
@media (max-width:640px){
  .q-tip-bubble{left:auto;right:-8px;transform:translateY(-3px)}
  .tip-wrap:hover .q-tip-bubble,.tip-wrap:focus-within .q-tip-bubble,.tip-wrap.open .q-tip-bubble{transform:translateY(0)}
}

/* the WATCH concept (post-level): an eye, not a bell — so the two
   subscriptions never look like the same button twice. Idle: calm.
   Watching: the iris opens WIDE and the eye blinks, alive. */
.sub-btn--watch .eye{width:23px;height:23px;flex:none}
.eye-blink,.eye-iris{transform-box:fill-box;transform-origin:center}
.eye-iris{transition:transform .45s cubic-bezier(.34,1.56,.64,1)}
.sub-btn--watch:hover .eye-iris{transform:scale(1.14)}
.sub-btn--watch.is-subscribed .eye-iris{transform:scale(1.3)}
.sub-btn--watch.is-subscribed .eye-blink{animation:eyeBlink 4.8s ease-in-out infinite}
@keyframes eyeBlink{0%,91%,100%{transform:scaleY(1)}94.5%{transform:scaleY(.05)}98%{transform:scaleY(1)}}

/* subscribed state — flipped, calm, bell filled */
.sub-btn.is-subscribed{background:rgba(255,255,255,.05);color:var(--mut,#757c8c);
  border-color:var(--line,rgba(255,255,255,.12));box-shadow:none}
.sub-btn.is-subscribed::after{display:none}
.sub-btn.is-subscribed .sub-btn-label{color:var(--txt,#eceef3)}
.sub-btn.is-subscribed .bell-body{fill:var(--amber,#ffb03a)}
.sub-btn.is-subscribed .bell-clapper{fill:var(--amber,#ffb03a)}

.sub-status{flex-basis:100%;font-size:.83rem;line-height:1.45;color:var(--mut,#757c8c);
  margin:.65rem 0 0;min-height:0}
.sub-status:empty{margin:0}

/* ---------- the bell ---------- */
.bell{overflow:visible}
.bell-swing{transform-box:fill-box;transform-origin:50% 0}
.bell-clapper{transform-box:fill-box;transform-origin:50% 0}
.bell-wave{fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;opacity:0;
  transform-box:fill-box;transform-origin:50% 50%}

/* ring on hover (short), ring on demand (.ringing, set by JS) */
.sub-btn:hover .bell-swing,.sub-btn.ringing .bell-swing,.sub-badge.ringing .bell-swing{
  animation:sub-ring 1.05s cubic-bezier(.36,.07,.19,.97) both}
.sub-btn:hover .bell-clapper,.sub-btn.ringing .bell-clapper,.sub-badge.ringing .bell-clapper{
  animation:sub-clapper 1.05s cubic-bezier(.36,.07,.19,.97) .05s both}
.sub-btn:hover .bell-wave,.sub-btn.ringing .bell-wave,.sub-badge.ringing .bell-wave{
  animation:sub-wave .8s ease-out .08s both}
.sub-btn:hover .bell-wave.w2,.sub-btn.ringing .bell-wave.w2,.sub-badge.ringing .bell-wave.w2{
  animation-delay:.2s}

/* decaying pendulum swing — the decay is what reads as "ringing" */
@keyframes sub-ring{
  0%{transform:rotate(0deg)}12%{transform:rotate(24deg)}26%{transform:rotate(-19deg)}
  40%{transform:rotate(13deg)}54%{transform:rotate(-9deg)}68%{transform:rotate(5deg)}
  82%{transform:rotate(-2.5deg)}100%{transform:rotate(0deg)}}
@keyframes sub-clapper{
  0%{transform:translateX(0)}12%{transform:translateX(-2.6px)}26%{transform:translateX(2.6px)}
  40%{transform:translateX(-1.8px)}54%{transform:translateX(1.8px)}68%{transform:translateX(-1px)}
  82%{transform:translateX(.6px)}100%{transform:translateX(0)}}
@keyframes sub-wave{0%{opacity:0;transform:scale(.55)}30%{opacity:.95}100%{opacity:0;transform:scale(1.25)}}

/* idle attention ring on primary buttons: a short ring every ~9 s,
   baked into a long keyframe cycle (pure CSS, no JS timer) */
.sub-btn--primary .bell-swing{animation:sub-idle 9s ease-in-out infinite}
.sub-btn--primary .bell-wave{animation:sub-idle-wave 9s ease-out infinite}
.sub-btn--primary:hover .bell-swing,.sub-btn--primary.ringing .bell-swing{animation:sub-ring 1.05s cubic-bezier(.36,.07,.19,.97) both}
.sub-btn--primary.is-subscribed .bell-swing,.sub-btn--primary.is-subscribed .bell-wave{animation:none}
@keyframes sub-idle{
  0%,100%{transform:rotate(0deg)}1.5%{transform:rotate(21deg)}3.5%{transform:rotate(-16deg)}
  5.5%{transform:rotate(10deg)}7.5%{transform:rotate(-6deg)}9.5%{transform:rotate(2.5deg)}
  11%,99%{transform:rotate(0deg)}}
@keyframes sub-idle-wave{
  0%,100%{opacity:0;transform:scale(.55)}2%{opacity:.9}10%{opacity:0;transform:scale(1.2)}
  11%,99%{opacity:0}}

/* Mobile: the bar centers itself and the buttons go full-width,
   stacked — side-by-side pills squeeze into mush on a phone.
   (Desktop keeps the left-aligned row.) The compact banner bar is
   exempt: it lives inside the banner's own wrapping flex row. */
@media (max-width:640px){
  .sub-bar{padding:1.05rem 1rem .95rem}
  .sub-bar-head{flex-direction:column;align-items:center;text-align:center}
  .sub-bar-sub{margin-left:auto;margin-right:auto}
  .sub-bar:not(.sub-bar--compact) .sub-btns{flex-direction:column;align-items:stretch}
  .sub-bar:not(.sub-bar--compact) .sub-btn{justify-content:center}
}

@media (prefers-reduced-motion:reduce){
  .bell-swing,.bell-clapper,.bell-wave,.sub-btn--primary::after,[data-sub-bar] .sub-status.is-busy::before{animation:none!important}
  .sub-btn{transition:none}
}
