/* Pipsly: base styles and shared components (load after tokens.css).
   Each site's own stylesheet adds its layout on top. */

/* ---------- reset ---------- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:root { accent-color: #FFFFFF; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { touch-action: manipulation; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

/* ---------- text helpers ---------- */
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-sm); }
.pos { color: var(--good); } .neg { color: var(--bad); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.eyebrow { font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .12em; color: var(--accent); }

/* ---------- buttons ----------
   Press: scales to --press and lightens (an overlay's opacity), eases back over --t-fast.
   Size is set per site with --btn-h / --btn-py / --btn-px / --btn-fs. */
.btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: var(--btn-h, 44px); padding: var(--btn-py, 10px) var(--btn-px, 14px); border-radius: var(--r-btn);
  border: 1px solid var(--line-2); background: var(--surface-2); font-weight: 600; font-size: var(--btn-fs, 14px); text-decoration: none;
  transition: transform var(--t-fast) var(--ease-out), opacity var(--t-fast) var(--ease-out); }
.btn::before { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: rgba(255, 255, 255, .06); opacity: 0; transition: opacity var(--t-fast) var(--ease-out); }
@media (hover: hover) { .btn:hover::before { opacity: .6; } }
.btn:active { transform: scale(var(--press)); transition-duration: 60ms; }
.btn:active::before { opacity: 1; transition-duration: 0s; }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn.prime { background: linear-gradient(180deg, var(--accent), var(--accent-2)); color: var(--accent-ink); border-color: transparent;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .9), 0 8px 24px rgba(0, 0, 0, .35); }
.btn.prime::before { background: rgba(255, 255, 255, .18); }
.btn.ghost { background: transparent; color: var(--fg-2); }
.btn.outline { background: transparent; border-color: rgba(201, 204, 209, .55); color: var(--accent); }
.btn.danger-o { border-color: rgba(233, 234, 236, .5); color: var(--danger); }
.btn.block { display: flex; width: 100%; }
.btn-sm { --btn-h: 44px; --btn-py: 8px; --btn-px: 14px; --btn-fs: 14px; }
/* Premium motion, monochrome (looks only: nothing here changes what a button does or when).
   - prime: a chrome glint sweeps across now and then, and on hover; pressing lights it from the touch point
   - ghost / outline: a chrome edge that turns slowly on hover (desktop)
   Reduced motion: all of it is off. */
@property --pp-ang { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
@property --pp-g { syntax: '<percentage>'; inherits: false; initial-value: 160%; }
/* the glint is the top background layer: above the chrome, under the label */
.btn.prime { background: linear-gradient(105deg, transparent 36%, rgba(70, 74, 82, .5) 43%, #fff 48.5%, #fff 50%, rgba(70, 74, 82, .42) 56%, transparent 63%)
    var(--pp-g) 0 / 260% 100% no-repeat, linear-gradient(180deg, var(--accent), var(--accent-2)); }
/* (a button that already moves, like the app's sign-in button with its own sweep, keeps its own) */
.btn.prime:not(.af-go) { animation: pp-glint 7.5s var(--ease-in-out) 1.6s infinite; }
@media (hover: hover) { .btn.prime:not(.af-go):hover { animation: pp-glint-now .9s var(--ease-out) both; } }
.btn.prime::before { background: radial-gradient(circle at var(--pp-x, 50%) var(--pp-y, 50%), rgba(255, 255, 255, .55), rgba(255, 255, 255, .12) 45%, transparent 75%); }
@keyframes pp-glint { 0%, 78% { --pp-g: 160%; } 100% { --pp-g: -60%; } }
@keyframes pp-glint-now { from { --pp-g: 160%; } to { --pp-g: -60%; } }
@media (hover: hover) {
  .btn.ghost::after, .btn.outline::after { content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; pointer-events: none;
    background: conic-gradient(from var(--pp-ang), transparent 0 55%, rgba(233, 234, 236, .9) 70%, transparent 85%);
    -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(--t-base) var(--ease-out); }
  .btn.ghost:hover::after, .btn.outline:hover::after { opacity: 1; animation: pp-edge 2.4s linear infinite; }
}
@keyframes pp-edge { to { --pp-ang: 360deg; } }
@media (prefers-reduced-motion: reduce) {
  .btn.prime { animation: none !important; }
  .btn.ghost::after, .btn.outline::after { animation: none !important; display: none; }
}
/* Sending: a chrome ring that breathes (opacity only). */
.busy::after { content: ""; position: absolute; inset: -1px; border-radius: inherit; border: 1px solid var(--accent-2);
  pointer-events: none; animation: pp-busy 1s var(--ease-in-out) infinite; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: var(--card-pad, var(--s4)); }

/* ---------- chips (filters) ---------- */
.chip { flex: none; min-height: 44px; padding: 8px 14px; border-radius: var(--r-pill); border: 1px solid var(--line-2); background: var(--surface);
  color: var(--fg-2); font-size: 14px; font-weight: 500; transition: transform var(--t-fast) var(--ease-out); }
.chip:active { transform: scale(var(--press)); }
.chip[aria-pressed="true"] { border-color: rgba(201, 204, 209, .6); color: var(--accent); background: rgba(255, 255, 255, .06); }

/* ---------- segmented control: one pill slides between options ---------- */
.seg { --i: 0; --n: 2; position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 3px;
  background: var(--bg-sunk); border: 1px solid var(--line); border-radius: var(--r-btn); }
.seg3 { --n: 3; } .seg4 { --n: 4; } .seg5 { --n: 5; } .seg6 { --n: 6; }
.seg-pill { position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc((100% - 6px) / var(--n)); border-radius: 8px;
  background: var(--surface-2); border: 1px solid var(--line-2);
  transform: translateX(calc(var(--i) * 100%)); transition: transform var(--t-slow) var(--ease-out), opacity var(--t-base) var(--ease-out); }
.seg.none .seg-pill { opacity: 0; }
.seg button { position: relative; z-index: 1; min-height: 40px; border: 0; background: none; color: var(--muted); font-weight: 600; font-size: 13px;
  transition: transform var(--t-fast) var(--ease-out); }
.seg button:active { transform: scale(var(--press)); transition-duration: 60ms; }
.seg button.on { color: var(--accent); }
/* touch screens: every segment is a full 44 px target */
@media (pointer: coarse) { .seg button { min-height: 44px; } }

/* ---------- loading skeletons ---------- */
.skel { position: relative; overflow: hidden; color: transparent !important; border-radius: 6px; background: var(--surface-2); }
.skel-list { display: flex; flex-direction: column; gap: var(--s2); }
.skel-row { position: relative; overflow: hidden; height: 64px; border-radius: var(--r-card); background: var(--surface); border: 1px solid var(--line); }
.skel::after, .skel-row::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .055), transparent); animation: pp-shimmer 1.4s var(--ease-in-out) infinite; }

/* ---------- scroll entrances: fade + rise, once (js adds .on) ---------- */
.js .reveal { opacity: 0; transform: translate3d(var(--reveal-x, 0px), var(--rise), 0);
  transition: opacity var(--t-reveal) var(--ease-out), transform var(--t-reveal) var(--ease-out);
  transition-delay: calc(var(--d, 0) * var(--stagger)); }
.js .reveal.on { opacity: 1; transform: none; }

/* ---------- keyframes ---------- */
@keyframes pp-rise { from { opacity: 0; transform: translate3d(0, var(--rise), 0); } }
@keyframes pp-rise-sm { from { opacity: 0; transform: translate3d(0, var(--rise-sm), 0); } }
@keyframes pp-fade { from { opacity: 0; } }
@keyframes pp-shimmer { to { transform: translateX(100%); } }
@keyframes pp-spin { to { transform: rotate(360deg); } }
@keyframes pp-ping { from { transform: scale(1); opacity: .55; } 70%, to { transform: scale(2.8); opacity: 0; } }
@keyframes pp-busy { 50% { opacity: .15; } }

/* ---------- reduce motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .skel::after, .skel-row::after, .busy::after { animation: none; }
  .js .reveal { transition-property: opacity; }
}

/* ---------- text motion (shared/js/pp-text.js) ----------
   Words rise through a mask in turn; with a mouse they also come into focus. Transform and opacity
   only on phones, so it stays smooth. Reduced motion: shown at once. */
.pt-w { display: inline-block; overflow: hidden; vertical-align: top; padding: 0 .06em .12em 0; margin: 0 -.06em -.12em 0; }
.pt-i { display: inline-block; transform: translate3d(0, 108%, 0); opacity: 0;
  transition: transform .85s var(--ease-out), opacity .5s var(--ease-out), filter .85s var(--ease-out); transition-delay: calc(var(--pt, 0) * 55ms); }
.pt-blur .pt-i { filter: blur(5px); }
.pt-in .pt-i { transform: none; opacity: 1; filter: none; }
@media (prefers-reduced-motion: reduce) { .pt-i { transform: none; opacity: 1; filter: none; transition: none; } }
