/* ============================================================================
   BeginThings UI kit  ·  bt-ui.css
   ----------------------------------------------------------------------------
   Interaction patterns rebuilt natively on the BeginThings token set, so every
   component follows the existing light/dark themes instead of carrying its own
   palette. Drives entirely from tokens already defined on the homepage:
     --acc --acc2 --cyan --mint --orchid --grad --btngrad
     --bg --bg2 --panel --panel2 --line --line2 --text --muted --muted2
   No third-party CSS, no build step, no dependencies. Additive: nothing here
   overrides existing site rules, every class is namespaced `bt-`.
   Reduced-motion is respected throughout.
   ========================================================================= */

.bt-ui * { box-sizing: border-box; }

/* ── shared motion tokens ─────────────────────────────────────────────── */
:root{
  --bt-ease: cubic-bezier(.22,.61,.36,1);
  --bt-fast: 160ms;
  --bt-med: 260ms;
  --bt-r: 12px;
}

/* ══════════════════════════════════════════════════════════════════════
   1 · BUTTONS
   ══════════════════════════════════════════════════════════════════════ */

.bt-btn{
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 12px 22px;
  border: 0; border-radius: var(--bt-r);
  font: 600 14.5px/1 Inter, system-ui, -apple-system, sans-serif;
  letter-spacing: .01em;
  cursor: pointer; user-select: none;
  text-decoration: none; white-space: nowrap;
  transition: transform var(--bt-fast) var(--bt-ease),
              box-shadow var(--bt-med) var(--bt-ease),
              background-color var(--bt-med) var(--bt-ease),
              color var(--bt-med) var(--bt-ease),
              border-color var(--bt-med) var(--bt-ease);
}
.bt-btn:focus-visible{
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}
.bt-btn:active{ transform: translateY(1px) scale(.995); }
.bt-btn[disabled], .bt-btn[aria-disabled="true"]{
  opacity: .5; cursor: not-allowed; transform: none !important;
}

/* --- primary: the site gradient, with a light sweep on hover ---------- */
.bt-btn-primary{
  color: #fff;
  background: var(--btngrad);
  box-shadow: 0 6px 20px -8px color-mix(in srgb, var(--acc) 70%, transparent);
  overflow: hidden;
}
.bt-btn-primary::after{
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 20%,
              rgba(255,255,255,.28) 50%, transparent 80%);
  transform: translateX(-120%);
  transition: transform 620ms var(--bt-ease);
  pointer-events: none;
}
.bt-btn-primary:hover{
  transform: translateY(-2px);
  box-shadow: 0 12px 30px -8px color-mix(in srgb, var(--acc) 85%, transparent);
}
.bt-btn-primary:hover::after{ transform: translateX(120%); }

/* --- gradient outline: border is the gradient, fill stays transparent -- */
.bt-btn-outline{
  color: var(--text);
  background: transparent;
  border: 1px solid transparent;
  background-image:
    linear-gradient(var(--bg2), var(--bg2)),
    var(--grad);
  background-origin: border-box;
  background-clip: padding-box, border-box;
}
.bt-btn-outline:hover{
  transform: translateY(-2px);
  box-shadow: 0 10px 26px -12px color-mix(in srgb, var(--acc) 65%, transparent);
}

/* --- ghost: quiet until touched -------------------------------------- */
.bt-btn-ghost{
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--line);
}
.bt-btn-ghost:hover{
  color: var(--text);
  background: var(--panel2);
  border-color: var(--line2);
  transform: translateY(-1px);
}

/* --- icon-only ------------------------------------------------------- */
.bt-btn-icon{
  width: 42px; height: 42px; padding: 0;
  border-radius: 11px;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--line);
}
.bt-btn-icon:hover{ color: var(--acc2); border-color: var(--line2); transform: translateY(-1px); }
.bt-btn-icon svg{ width: 18px; height: 18px; }

.bt-btn-sm{ padding: 8px 14px; font-size: 13px; border-radius: 9px; }
.bt-btn-lg{ padding: 15px 30px; font-size: 16px; border-radius: 14px; }
.bt-btn-block{ display: flex; width: 100%; }

/* --- pending state: swaps the label for a spinner without resizing ---- */
.bt-btn.is-loading{ color: transparent !important; pointer-events: none; }
.bt-btn.is-loading::before{
  content: ""; position: absolute; inset: 0; margin: auto;
  width: 17px; height: 17px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.32);
  border-top-color: #fff;
  animation: bt-spin .62s linear infinite;
}
.bt-btn-ghost.is-loading::before,
.bt-btn-outline.is-loading::before{
  border-color: color-mix(in srgb, var(--acc) 30%, transparent);
  border-top-color: var(--acc2);
}

/* ══════════════════════════════════════════════════════════════════════
   2 · INPUTS
   ══════════════════════════════════════════════════════════════════════ */

.bt-field{ position: relative; display: block; }

.bt-input{
  width: 100%;
  padding: 17px 14px 9px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--bt-r);
  font: 500 14.5px/1.3 Inter, system-ui, sans-serif;
  transition: border-color var(--bt-med) var(--bt-ease),
              box-shadow var(--bt-med) var(--bt-ease),
              background-color var(--bt-med) var(--bt-ease);
}
.bt-input::placeholder{ color: transparent; }   /* the floating label is the placeholder */
.bt-input:hover{ border-color: var(--line2); }
.bt-input:focus{
  outline: none;
  border-color: color-mix(in srgb, var(--acc) 70%, transparent);
  background: var(--panel2);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--acc) 18%, transparent);
}

/* label rides up on focus or once the field has content */
.bt-label{
  position: absolute; left: 15px; top: 15px;
  color: var(--muted2);
  font: 500 14.5px/1 Inter, system-ui, sans-serif;
  pointer-events: none;
  transform-origin: left top;
  transition: transform var(--bt-fast) var(--bt-ease),
              color var(--bt-fast) var(--bt-ease);
}
.bt-input:focus + .bt-label,
.bt-input:not(:placeholder-shown) + .bt-label{
  transform: translateY(-8px) scale(.76);
  color: var(--acc2);
}

.bt-textarea{ min-height: 128px; padding-top: 22px; resize: vertical; }

/* search variant with a leading icon */
.bt-search{ position: relative; display: flex; align-items: center; }
.bt-search svg{
  position: absolute; left: 13px; width: 17px; height: 17px;
  color: var(--muted2); pointer-events: none;
}
.bt-search .bt-input{ padding: 12px 14px 12px 40px; }

.bt-hint{ margin-top: 6px; color: var(--muted2); font: 500 12px Inter, sans-serif; }
.bt-input[aria-invalid="true"]{ border-color: var(--orchid); }
.bt-input[aria-invalid="true"]:focus{
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--orchid) 22%, transparent);
}

/* ══════════════════════════════════════════════════════════════════════
   3 · CARDS
   ══════════════════════════════════════════════════════════════════════ */

.bt-card{
  position: relative;
  padding: 22px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  transition: transform var(--bt-med) var(--bt-ease),
              box-shadow var(--bt-med) var(--bt-ease),
              border-color var(--bt-med) var(--bt-ease);
}
/* gradient hairline that fades in on hover, drawn with a mask so it stays
   a true 1px border at any radius */
.bt-card::before{
  content: ""; position: absolute; inset: 0;
  border-radius: inherit; padding: 1px;
  background: var(--grad);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0;
  transition: opacity var(--bt-med) var(--bt-ease);
  pointer-events: none;
}
.bt-card:hover{
  transform: translateY(-3px);
  box-shadow: 0 18px 40px -22px color-mix(in srgb, var(--acc) 80%, transparent);
}
.bt-card:hover::before{ opacity: 1; }

.bt-card-title{ margin: 0 0 6px; color: var(--text); font: 700 16px Inter, sans-serif; }
.bt-card-body{ margin: 0; color: var(--muted); font: 500 13.5px/1.55 Inter, sans-serif; }
.bt-card-ico{
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; margin-bottom: 13px;
  border-radius: 10px;
  background: var(--btngrad);
  color: #fff;
}
.bt-card-ico svg{ width: 19px; height: 19px; }

/* a card that is also a link should not lose the affordance */
a.bt-card{ display: block; text-decoration: none; }

/* ══════════════════════════════════════════════════════════════════════
   4 · LOADERS
   ══════════════════════════════════════════════════════════════════════ */

@keyframes bt-spin{ to{ transform: rotate(360deg); } }
@keyframes bt-shimmer{ to{ background-position: 200% 0; } }
@keyframes bt-pulse{ 0%,100%{ opacity:.35; transform:scale(.82);} 50%{ opacity:1; transform:scale(1);} }

.bt-spinner{
  width: 26px; height: 26px; border-radius: 50%;
  border: 2.5px solid color-mix(in srgb, var(--acc) 22%, transparent);
  border-top-color: var(--acc2);
  animation: bt-spin .68s linear infinite;
}
.bt-spinner-lg{ width: 40px; height: 40px; border-width: 3px; }

/* three-dot, for inline "thinking" states */
.bt-dots{ display: inline-flex; gap: 5px; align-items: center; }
.bt-dots i{
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--acc2); display: block;
  animation: bt-pulse 1.05s ease-in-out infinite;
}
.bt-dots i:nth-child(2){ animation-delay: .16s; }
.bt-dots i:nth-child(3){ animation-delay: .32s; }

/* skeleton: shape-of-content placeholder while data loads */
.bt-skel{
  border-radius: 8px;
  background: linear-gradient(90deg,
      var(--panel) 25%, var(--panel2) 37%, var(--panel) 63%);
  background-size: 200% 100%;
  animation: bt-shimmer 1.3s linear infinite;
}
.bt-skel-line{ height: 11px; margin-bottom: 9px; }
.bt-skel-line:last-child{ width: 62%; margin-bottom: 0; }
.bt-skel-title{ height: 15px; width: 46%; margin-bottom: 13px; }

/* determinate progress */
.bt-progress{
  height: 6px; border-radius: 99px; overflow: hidden;
  background: var(--panel2);
}
.bt-progress > span{
  display: block; height: 100%; border-radius: inherit;
  background: var(--btngrad);
  transition: width var(--bt-med) var(--bt-ease);
}

/* ══════════════════════════════════════════════════════════════════════
   5 · TOOLTIPS
   ══════════════════════════════════════════════════════════════════════ */

.bt-tip{ position: relative; display: inline-flex; }
.bt-tip > .bt-tip-body{
  position: absolute; bottom: calc(100% + 9px); left: 50%;
  transform: translate(-50%, 4px);
  padding: 7px 11px;
  border-radius: 8px;
  background: var(--bg2);
  border: 1px solid var(--line2);
  color: var(--text);
  font: 600 12px/1.35 Inter, sans-serif;
  white-space: nowrap;
  opacity: 0; visibility: hidden;
  box-shadow: 0 10px 26px -12px rgba(0,0,0,.7);
  transition: opacity var(--bt-fast) var(--bt-ease),
              transform var(--bt-fast) var(--bt-ease),
              visibility var(--bt-fast);
  z-index: 40;
}
.bt-tip > .bt-tip-body::after{      /* the little arrow */
  content: ""; position: absolute; top: 100%; left: 50%;
  margin-left: -5px;
  border: 5px solid transparent;
  border-top-color: var(--line2);
}
.bt-tip:hover > .bt-tip-body,
.bt-tip:focus-within > .bt-tip-body{
  opacity: 1; visibility: visible; transform: translate(-50%, 0);
}

/* ══════════════════════════════════════════════════════════════════════
   6 · TOGGLE
   ══════════════════════════════════════════════════════════════════════ */

.bt-switch{ position: relative; display: inline-block; width: 46px; height: 26px; }
.bt-switch input{ position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.bt-switch span{
  position: absolute; inset: 0; border-radius: 99px;
  background: var(--panel2);
  border: 1px solid var(--line);
  transition: background var(--bt-med) var(--bt-ease), border-color var(--bt-med) var(--bt-ease);
  pointer-events: none;
}
.bt-switch span::before{
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--muted);
  transition: transform var(--bt-med) var(--bt-ease), background var(--bt-med) var(--bt-ease);
}
.bt-switch input:checked + span{ background: var(--btngrad); border-color: transparent; }
.bt-switch input:checked + span::before{ transform: translateX(20px); background: #fff; }
.bt-switch input:focus-visible + span{ outline: 2px solid var(--cyan); outline-offset: 3px; }

/* ══════════════════════════════════════════════════════════════════════
   7 · MOTION SAFETY
   ══════════════════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce){
  .bt-btn, .bt-card, .bt-input, .bt-label, .bt-tip > .bt-tip-body,
  .bt-switch span, .bt-switch span::before, .bt-progress > span{
    transition: none !important;
  }
  .bt-btn-primary::after{ display: none; }
  .bt-spinner, .bt-dots i, .bt-skel, .bt-btn.is-loading::before{ animation: none !important; }
  .bt-skel{ background: var(--panel2); }
}

/* coarse pointers get slightly larger targets */
@media (pointer: coarse){
  .bt-btn{ padding: 14px 24px; }
  .bt-btn-icon{ width: 46px; height: 46px; }
}
