/* Black + glass. One loud thing: the glow behind the paste box, which takes the
   color of the link you paste (TikTok purple, Instagram pink, YouTube red).
   Everything else stays quiet. */

@font-face {
  font-family: "Archivo";
  src: url("/static/fonts/archivo.woff2") format("woff2-variations"),
       url("/static/fonts/archivo.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #000;
  --text: #f4f4f6;
  --muted: #a5a5af;
  --faint: #73737d;
  --line: rgba(255, 255, 255, .12);
  --error: #ff9494;
  --accent: #ffffff;            /* glow, highlights, focus */
  --accent-rgb: 255, 255, 255;
  --ink: #f4f4f6;               /* main buttons */
  --ink-text: #000;
  --panel-radius: 28px;
  --control-radius: 16px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}
html[data-platform="tiktok"]    { --accent: #b26bff; --accent-rgb: 178, 107, 255; --ink: #7c3aed; --ink-text: #fff; }
html[data-platform="instagram"] { --accent: #ff4d94; --accent-rgb: 255, 77, 148;  --ink: #d6246e; --ink-text: #fff; }
html[data-platform="youtube"]   { --accent: #ff3b3b; --accent-rgb: 255, 59, 59;   --ink: #d90a14; --ink-text: #fff; }

* { box-sizing: border-box; }

html {
  background: var(--bg);
  color: var(--text);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  font-family: "Archivo", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.5;
  font-stretch: 100%;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

/* ---------------------------------------------------------------- the glow */
.glow {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.g {
  position: absolute;
  left: 50%;
  top: 40%;
  width: 150vmax;
  height: 150vmax;
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity .8s var(--ease);
}
.g-idle {
  background:
    radial-gradient(24% 18% at 50% 50%, rgba(255, 255, 255, .13), transparent 70%),
    radial-gradient(16% 12% at 58% 57%, rgba(150, 160, 255, .09), transparent 70%);
}
.g-tiktok {
  background:
    radial-gradient(26% 20% at 46% 48%, rgba(168, 85, 247, .74), transparent 70%),
    radial-gradient(20% 16% at 59% 57%, rgba(76, 52, 245, .58), transparent 72%);
}
.g-instagram {
  background:
    radial-gradient(26% 20% at 46% 48%, rgba(255, 61, 143, .70), transparent 70%),
    radial-gradient(18% 15% at 60% 58%, rgba(255, 140, 64, .48), transparent 72%);
}
.g-youtube {
  background:
    radial-gradient(26% 20% at 47% 48%, rgba(255, 40, 40, .70), transparent 70%),
    radial-gradient(18% 15% at 58% 57%, rgba(150, 0, 20, .62), transparent 72%);
}
html[data-platform=""] .g-idle,
html[data-platform="tiktok"] .g-tiktok,
html[data-platform="instagram"] .g-instagram,
html[data-platform="youtube"] .g-youtube { opacity: 1; }

@keyframes breathe {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50%      { transform: translate(-50%, -50%) scale(1.07); }
}
html[data-busy] .g { animation: breathe 2.6s var(--ease) infinite; }

html[data-theme="black"] .glow { display: none; }

/* ---------------------------------------------------------------- header */
.top {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 72rem;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: max(18px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) 0 max(20px, env(safe-area-inset-left));
}
.mark {
  font-stretch: 125%;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -.01em;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.look {
  flex: none;
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .05);
}
.look button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 6px 12px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.look button[aria-pressed="true"] { background: rgba(255, 255, 255, .14); color: var(--text); }

/* ---------------------------------------------------------------- main column */
.wrap {
  position: relative;
  z-index: 1;
  flex: 1;
  width: 100%;
  max-width: 34rem;
  margin: 0 auto;
  padding: 0 max(20px, env(safe-area-inset-right)) 40px max(20px, env(safe-area-inset-left));
}
.hero {
  padding: clamp(40px, 9vh, 96px) 0 28px;
  text-align: center;
}
h1 {
  margin: 0;
  font-stretch: 125%;
  font-weight: 800;
  font-size: clamp(2.05rem, 8.6vw, 3.6rem);
  line-height: 1.02;
  letter-spacing: -.025em;
  text-wrap: balance;
}
@media (min-width: 760px) {
  .hero { margin: 0 -8rem; }        /* the headline gets more room than the paste box */
}
.lede {
  margin: 16px auto 0;
  max-width: 26rem;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.45;
  text-wrap: pretty;
}

/* ---------------------------------------------------------------- glass */
.glass {
  border: 1px solid rgba(255, 255, 255, .13);
  background: linear-gradient(180deg, rgba(255, 255, 255, .09), rgba(255, 255, 255, .035));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12);
  -webkit-backdrop-filter: blur(26px) saturate(150%);
  backdrop-filter: blur(26px) saturate(150%);
  transition: box-shadow .6s var(--ease);
}
html[data-theme="black"] .glass {
  background: #000;
  border-color: rgba(255, 255, 255, .14);
  box-shadow: inset 0 1px 0 rgba(var(--accent-rgb), .6);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

/* ---------------------------------------------------------------- paste box */
.panel {
  margin: 0;
  padding: 14px;
  border-radius: var(--panel-radius);
}
.field { position: relative; }
.field input {
  width: 100%;
  height: 58px;
  padding: 0 96px 0 18px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: var(--control-radius);
  background: rgba(0, 0, 0, .38);
  color: var(--text);
  font: inherit;
  font-size: 17px;               /* 16px+ keeps iPhone from zooming in */
  outline: none;
  transition: border-color .3s, box-shadow .3s;
}
html[data-theme="black"] .field input { background: rgba(255, 255, 255, .05); }
.field input::placeholder { color: var(--faint); opacity: 1; }
.field input:focus {
  border-color: rgba(var(--accent-rgb), .7);
  box-shadow: 0 0 0 4px rgba(var(--accent-rgb), .18);
}
.chip {
  position: absolute;
  top: 50%;
  right: 8px;
  height: 40px;
  padding: 0 14px;
  transform: translateY(-50%);
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 12px;
  background: rgba(255, 255, 255, .08);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.chip[hidden] { display: none; }

/* main buttons: Get video, Save to Photos, Download */
.go,
.save {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 58px;
  border: 0;
  border-radius: var(--control-radius);
  background: var(--ink);
  color: var(--ink-text);
  font: inherit;
  font-stretch: 112%;
  font-weight: 700;
  font-size: 17px;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color .5s var(--ease), color .5s var(--ease), transform .15s;
}
.go { margin-top: 10px; }
.go:active,
.save:active { transform: scale(.985); }
.go[aria-busy="true"],
.save[aria-busy="true"] { cursor: progress; }
.save[aria-disabled="true"] { cursor: default; }
.go-fill,
.save-fill {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, .26);
  transform: scaleX(var(--p, 0));
  transform-origin: left center;
  transition: transform .35s var(--ease);
}
html[data-platform=""] .go-fill,
html[data-platform=""] .save-fill { background: rgba(0, 0, 0, .14); }
.go-label,
.save-label {
  position: relative;
  font-variant-numeric: tabular-nums;
}

.works {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin: 14px 0 2px;
  color: var(--faint);
  font-size: 13px;
  font-weight: 600;
}
.works span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: color .4s;
}
.works span::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: .55;
}
html[data-platform="tiktok"] .works [data-p="tiktok"],
html[data-platform="instagram"] .works [data-p="instagram"] { color: var(--accent); }
html[data-platform="tiktok"] .works [data-p="tiktok"]::before,
html[data-platform="instagram"] .works [data-p="instagram"]::before {
  opacity: 1;
  box-shadow: 0 0 10px rgba(var(--accent-rgb), .9);
}

.status {
  margin: 12px 6px 2px;
  color: var(--muted);
  font-size: 15px;
  text-align: center;
  text-wrap: pretty;
}
.status:empty { display: none; }
.status.error { color: var(--error); }

/* ---------------------------------------------------------------- results */
.results {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}
.results[hidden] { display: none; }
.item {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 14px;
  padding: 12px;
  border-radius: 24px;
}
.thumb {
  position: relative;
  width: 76px;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  border-radius: 14px;
  background: rgba(255, 255, 255, .06);
}
.thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.dur {
  position: absolute;
  right: 6px;
  bottom: 6px;
  padding: 1px 6px;
  border-radius: 7px;
  background: rgba(0, 0, 0, .62);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 2px;
}
.who {
  margin: 0;
  overflow: hidden;
  font-weight: 700;
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.title {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
  overflow-wrap: anywhere;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}
.facts {
  margin: auto 0 0;
  color: var(--faint);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.actions {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
}
.hint {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}
.hint:empty { display: none; }
.hint strong { color: var(--text); }
.alt {
  justify-self: center;
  padding: 4px 6px;
  color: var(--muted);
  font-size: 14px;
  text-underline-offset: 3px;
}

/* ---------------------------------------------------------------- how it works */
.how { margin-top: 56px; }
.how h2 {
  margin: 0 0 16px;
  font-stretch: 125%;
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -.01em;
}
.how ol {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}
.how li {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 12px;
  color: var(--muted);
  font-size: 16px;
  counter-increment: step;
}
.how li::before {
  content: counter(step);
  color: var(--accent);
  font-stretch: 125%;
  font-weight: 800;
  font-size: 22px;
  line-height: 1.1;
  transition: color .5s;
}
.how strong { color: var(--text); font-weight: 650; }

/* ---------------------------------------------------------------- footer + text pages */
.foot {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 34rem;
  margin: 0 auto;
  padding: 28px max(20px, env(safe-area-inset-right)) max(28px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  color: var(--faint);
  font-size: 13px;
  line-height: 1.55;
  text-align: center;
}
.foot p { margin: 0; }
.foot nav {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 12px;
}
.foot a { color: var(--muted); text-underline-offset: 3px; }

.doc {
  position: relative;
  z-index: 1;
  flex: 1;
  width: 100%;
  max-width: 40rem;
  margin: 0 auto;
  padding: 40px max(20px, env(safe-area-inset-right)) 40px max(20px, env(safe-area-inset-left));
}
.doc h1 { font-size: clamp(1.9rem, 7vw, 2.6rem); text-align: left; }
.doc h2 {
  margin: 32px 0 8px;
  font-stretch: 112%;
  font-weight: 750;
  font-size: 19px;
}
.doc p,
.doc li { color: var(--muted); }
.doc .updated { color: var(--faint); font-size: 14px; }
.doc a { color: var(--text); text-underline-offset: 3px; }

/* ---------------------------------------------------------------- utilities */
:focus-visible {
  outline: 2px solid rgba(var(--accent-rgb), .9);
  outline-offset: 3px;
}
.field input:focus-visible { outline: none; }
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  html[data-busy] .g { animation: none; }
  .g, .glass, .go, .save, .go-fill, .save-fill, .works span, .how li::before { transition: none; }
}
