/* ═══════════════════════════════════════════════════════════════════════
   OpenAdam — Liquid Glass design system
   Light: #FFFAF1 warm cream · Dark: #181A18 deep charcoal
   Michelangelo × Aave glass × Apple liquid glass × atmospheric clouds
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Tokens ──────────────────────────────────────────────────────────── */
:root {
  --bg: #fffaf1;
  --bg-2: #f6efe3;
  --ink: #23211c;
  --ink-soft: rgba(35, 33, 28, 0.62);
  --accent: #b0793a;
  --accent-2: #d99a4e;

  --glass-bg: rgba(255, 255, 255, 0.42);
  --glass-border: rgba(255, 255, 255, 0.55);
  --glass-shadow: 0 8px 32px rgba(120, 90, 40, 0.10), inset 0 1px 0 rgba(255, 255, 255, 0.55);
  --glass-thin-bg: rgba(255, 255, 255, 0.26);
  --glass-thin-border: rgba(255, 255, 255, 0.38);

  --cloud-1: #ffe9c7; --cloud-2: #f8dfba; --cloud-3: #ffffff; --cloud-4: #e8ddcc;
  --chip-active-bg: rgba(176, 121, 58, 0.16);
  --danger: #a33a2a;
  --ok: #3c7a46;

  --radius: 20px;
  --radius-sm: 12px;
  --blur: blur(20px) saturate(1.5);
  --spring: cubic-bezier(0.34, 1.45, 0.42, 1);
  --ease: cubic-bezier(0.25, 0.7, 0.3, 1);
}
html[data-theme="dark"] {
  --bg: #181a18;
  --bg-2: #101210;
  --ink: #eceae4;
  --ink-soft: rgba(236, 234, 228, 0.6);
  --accent: #d99a4e;
  --accent-2: #eab873;

  --glass-bg: rgba(255, 255, 255, 0.06);
  --glass-border: rgba(255, 255, 255, 0.10);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.30), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  --glass-thin-bg: rgba(255, 255, 255, 0.04);
  --glass-thin-border: rgba(255, 255, 255, 0.08);

  --cloud-1: #22261f; --cloud-2: #191d1a; --cloud-3: #242118; --cloud-4: #14100c;
  --chip-active-bg: rgba(217, 154, 78, 0.22);
}

/* ── Base ────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
@font-face { /* optional local font — ships when assets/fonts is populated */
  font-family: 'InterVariable';
  src: url('../fonts/inter-latin-wght-normal.woff2') format('woff2-variations');
  font-weight: 100 900; font-display: swap;
}
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100svh;
  font-family: InterVariable, Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--ink); background: var(--bg);
  transition: background-color 0.7s var(--ease), color 0.5s var(--ease);
  overflow-x: hidden;
}
::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }
img, video { max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 200; padding: .5rem .9rem; border-radius: 999px; background: var(--glass-bg); backdrop-filter: var(--blur); }
.skip-link:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ── Atmospheric cloud background (weather, not screensaver) ─────────── */
.clouds { position: fixed; inset: -20%; z-index: -1; filter: blur(60px); pointer-events: none; }
.clouds i { position: absolute; display: block; border-radius: 50%; opacity: .8; will-change: transform; }
.clouds i:nth-child(1) { width: 65vmax; height: 48vmax; top: -12%;  left: -15%; background: radial-gradient(closest-side, var(--cloud-1), transparent 70%); animation: drift-a 36s ease-in-out infinite alternate; }
.clouds i:nth-child(2) { width: 55vmax; height: 42vmax; bottom: -18%; right: -12%; background: radial-gradient(closest-side, var(--cloud-2), transparent 70%); animation: drift-b 29s ease-in-out infinite alternate; }
.clouds i:nth-child(3) { width: 48vmax; height: 38vmax; top: 28%;    right: 8%;  background: radial-gradient(closest-side, var(--cloud-3), transparent 72%); opacity: .55; animation: drift-c 41s ease-in-out infinite alternate; }
.clouds i:nth-child(4) { width: 40vmax; height: 30vmax; bottom: 6%;  left: 14%;  background: radial-gradient(closest-side, var(--cloud-4), transparent 70%); opacity: .7; animation: drift-b 33s ease-in-out infinite alternate-reverse; }
@keyframes drift-a { from { transform: translate3d(-4%, -2%, 0) scale(1); } to { transform: translate3d(9%, 6%, 0) scale(1.12); } }
@keyframes drift-b { from { transform: translate3d(5%, 3%, 0) scale(1.05); } to { transform: translate3d(-8%, -6%, 0) scale(0.95); } }
@keyframes drift-c { from { transform: translate3d(0, 4%, 0) scale(0.98); } to { transform: translate3d(-6%, -5%, 0) scale(1.1); } }

/* ── Glass primitives ────────────────────────────────────────────────── */
.glass {
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--glass-shadow);
}
.glass-thin {
  background: var(--glass-thin-bg);
  -webkit-backdrop-filter: blur(12px) saturate(1.3);
  backdrop-filter: blur(12px) saturate(1.3);
  border: 1px solid var(--glass-thin-border);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
html[data-theme="dark"] .glass-thin { box-shadow: 0 4px 18px rgba(0,0,0,.25), inset 0 1px 0 rgba(255,255,255,.05); }

/* ── Chrome ──────────────────────────────────────────────────────────── */
.topbar {
  position: fixed; top: 14px; left: 14px; right: 14px;
  z-index: 60; display: flex; align-items: center; justify-content: space-between; gap: .6rem;
  padding: .5rem .65rem .5rem 1.05rem; border-radius: 999px;
}
.brand { display: flex; align-items: center; gap: .55rem; text-decoration: none; }
.brand-mark {
  width: 22px; height: 22px; border-radius: 8px;
  background:
    radial-gradient(120% 120% at 20% 15%, rgba(255,255,255,.9), transparent 45%),
    linear-gradient(135deg, var(--accent-2), var(--accent));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5);
}
.brand-name { font-weight: 700; letter-spacing: .01em; }

/* Hamburger — part of the header; springs open into ✕ */
.menu-btn {
  width: 42px; height: 42px; border-radius: 999px;
  border: 1px solid var(--glass-thin-border); background: var(--glass-thin-bg);
  display: grid; place-content: center; gap: 4px; padding: 0;
  transition: background .25s, transform .4s var(--spring);
}
.menu-btn span {
  display: block; width: 17px; height: 2px; border-radius: 2px;
  background: currentColor; opacity: .9;
  transition: transform .45s var(--spring), opacity .3s;
}
.menu-btn:hover { transform: scale(1.07); background: var(--chip-active-bg); }
.menu-btn.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.menu-btn.open span:nth-child(2) { opacity: 0; transform: scaleX(.2); }
.menu-btn.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

main { max-width: 880px; margin: 0 auto; padding: clamp(96px, 16vh, 150px) 20px 90px; }

/* ── Hero + searchbar ────────────────────────────────────────────────── */
.hero { text-align: center; }
.hero-title { font-size: clamp(2rem, 5.6vw, 3.2rem); line-height: 1.08; margin: 0 0 .6rem; letter-spacing: -0.02em; }
.hero-accent {
  background: linear-gradient(100deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub { color: var(--ink-soft); margin: 0 auto 2.2rem; max-width: 46ch; }
.notice { display: inline-block; margin: 0 0 1.2rem; padding: .5rem 1rem; border-radius: 999px; font-size: .92rem; }

.searchbar { position: relative; overflow: hidden; padding: .55rem; border-radius: 26px; }
.search-inner { display: flex; align-items: center; gap: .55rem; }
.search-glyph { padding-left: .7rem; opacity: .75; }
#videoUrl {
  flex: 1; min-width: 0; border: 0; outline: none; background: transparent;
  color: inherit; font-size: clamp(1rem, 2.4vw, 1.12rem); padding: .85rem .2rem;
}
#videoUrl::placeholder { color: var(--ink-soft); }
.platform-chip {
  flex-shrink: 0; font-size: .78rem; font-weight: 600; padding: .28rem .68rem; border-radius: 999px;
  background: var(--chip-active-bg); border: 1px solid var(--glass-border); white-space: nowrap;
}
.input-actions { display: none; }
.input-actions.show { display: inline-flex; }
.icon-btn {
  border: 1px solid var(--glass-thin-border); background: transparent; border-radius: 12px;
  padding: .45rem .6rem; line-height: 1; transition: transform .25s var(--spring), background .25s;
}
.icon-btn:hover { transform: translateY(-1px) scale(1.04); background: var(--glass-thin-bg); }

.go-btn {
  position: relative; overflow: hidden; border: 1px solid var(--glass-border); border-radius: 16px;
  min-width: 92px; padding: .85rem 1.35rem; font-weight: 700; letter-spacing: .01em;
  color: #fff; text-decoration: none; display: inline-flex; align-items: center; justify-content: center;
  /* a small piece of the environment: the cloud gradient lives inside the button */
  background:
    linear-gradient(180deg, rgba(255,255,255,.28), rgba(255,255,255,0) 42%),
    linear-gradient(115deg, var(--cloud-1), var(--accent) 45%, var(--cloud-2));
  background-size: 100% 100%, 220% 220%;
  animation: go-drift 18s ease-in-out infinite alternate;
  box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 35%, transparent), inset 0 1px 0 rgba(255,255,255,.45);
  text-shadow: 0 1px 2px rgba(0,0,0,.18);
}
.go-btn:hover { filter: brightness(1.06); }
.go-btn:active { transform: scale(.985); }
.go-btn[disabled] { pointer-events: none; filter: saturate(.6) brightness(.95); }
.go-btn.standalone { margin-top: 1.4rem; }
@keyframes go-drift { from { background-position: 0 0, 0% 40%; } to { background-position: 0 0, 100% 60%; } }
.go-spinner { display: none; width: 1em; height: 1em; margin-left: .5rem; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.45); border-top-color: #fff; animation: spin .7s linear infinite; }
.go-btn.loading .go-spinner { display: inline-block; }
.go-btn.loading .go-label { opacity: .75; }
@keyframes spin { to { transform: rotate(360deg); } }

.turnstile-slot { display: flex; justify-content: center; padding-top: .6rem; min-height: 0; }
.turnstile-slot:empty { display: none; }

.platform-pills { display: flex; flex-wrap: wrap; gap: .55rem; justify-content: center; margin-top: 1.5rem; }
.pill-tag {
  padding: .42rem 1rem; border-radius: 999px; text-decoration: none; font-size: .9rem; font-weight: 600;
  transition: transform .3s var(--spring), background .3s;
}
.pill-tag:hover { transform: translateY(-2px); background: var(--chip-active-bg); }
.pill-tag.ghost { background: transparent; border-style: dashed; opacity: .75; }
.pill-tag.active { background: var(--chip-active-bg); }

.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin-top: 3.4rem; }
.feature { padding: 1.3rem 1.4rem; }
.feature h3 { margin: 0 0 .45rem; font-size: 1.02rem; }
.feature p { margin: 0; color: var(--ink-soft); font-size: .93rem; line-height: 1.5; }

/* ── Sidebar trigger lives in the header now — no floating nav pill ──── */
.backdrop { position: fixed; inset: 0; z-index: 70; background: rgba(10, 10, 10, 0.32); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); opacity: 0; transition: opacity .35s var(--ease); }
.backdrop.show { opacity: 1; }

.sidebar {
  position: fixed; top: 14px; right: 14px; bottom: 14px; z-index: 90;
  width: min(320px, calc(100vw - 28px));
  display: flex; flex-direction: column; padding: 1.1rem;
  transform-origin: top right;
  transform: translateX(calc(100% + 30px)) scale(.94);
  opacity: 0;
  transition: transform .5s var(--spring), opacity .3s var(--ease);
  overflow-y: auto;
}
body.sidebar-open .sidebar { transform: translateX(0) scale(1); opacity: 1; }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.2rem; }
.sidebar-nav { display: flex; flex-direction: column; gap: .2rem; }
.sidebar-nav a {
  padding: .68rem .9rem; border-radius: 13px; text-decoration: none; font-weight: 600; font-size: .97rem;
  transition: background .25s, transform .3s var(--spring);
}
.sidebar-nav a:hover { background: var(--chip-active-bg); transform: translateX(3px); }
.sidebar-settings { margin-top: auto; padding-top: 1rem; display: flex; flex-direction: column; gap: .6rem; border-top: 1px solid var(--glass-thin-border); }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .35rem .4rem; font-size: .9rem; }
.setting-row input[type="checkbox"] { appearance: none; width: 42px; height: 24px; border-radius: 999px; background: var(--glass-thin-bg); border: 1px solid var(--glass-thin-border); position: relative; transition: background .3s; flex-shrink: 0; }
.setting-row input[type="checkbox"]::after { content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .35s var(--spring); }
.setting-row input[type="checkbox"]:checked { background: var(--accent); }
.setting-row input[type="checkbox"]:checked::after { transform: translateX(18px); }
.theme-toggle { padding: .6rem .9rem; border-radius: 13px; font-weight: 600; font-size: .9rem; text-align: center; }

/* ── Result page ─────────────────────────────────────────────────────── */
.result-card { max-width: 760px; margin: 0 auto; padding: clamp(1rem, 3vw, 1.8rem); }
.result-head { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; margin-bottom: .8rem; }
.platform-badge, .meta-chip {
  font-size: .76rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: .3rem .7rem; border-radius: 999px; background: var(--chip-active-bg); border: 1px solid var(--glass-thin-border);
}
.meta-chip { font-weight: 600; text-transform: none; letter-spacing: 0; }
.result-title { font-size: clamp(1.15rem, 3vw, 1.55rem); margin: 0 0 1.1rem; line-height: 1.25; letter-spacing: -0.01em; }
.player-mount {
  margin: 0 0 1.2rem; border-radius: 16px; overflow: hidden; background: rgba(0,0,0,.55);
  aspect-ratio: 16 / 9; box-shadow: inset 0 0 0 1px var(--glass-thin-border);
}
.player-mount.gallery-mode { aspect-ratio: auto; }
.player-mount img.gallery-img { width: 100%; display: block; border-radius: 16px; margin-bottom: .6rem; }
.actions-title { font-size: .82rem; text-transform: uppercase; letter-spacing: .09em; color: var(--ink-soft); margin: 1.2rem 0 .55rem; }
.chip-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.dl-chip { background: var(--chip-active-bg); }
.source-line { margin: 1.4rem 0 0; }
.expired { text-align: center; padding: 3rem 1.6rem; }
.expired-title { margin: 0 0 .6rem; }

.bottom-pill {
  position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); translate: -50% 0;
  z-index: 60; display: flex; align-items: center; gap: .2rem; padding: .3rem .45rem; border-radius: 999px;
  animation: bob 4s ease-in-out infinite;
}
@keyframes bob { 0%,100% { margin-top: 0; } 50% { margin-top: -6px; } }
.bp-action { border: 0; background: transparent; padding: .5rem .9rem; border-radius: 999px; font-weight: 700; font-size: .88rem; text-decoration: none; transition: background .25s; white-space: nowrap; }
.bp-action:hover { background: var(--chip-active-bg); }
.bp-divider { width: 1px; height: 18px; background: var(--glass-thin-border); }

/* ── Static pages ────────────────────────────────────────────────────── */
.page-card { max-width: 720px; margin: 0 auto; padding: clamp(1.4rem, 4vw, 2.4rem); }
.page-card h1 { margin-top: 0; letter-spacing: -0.01em; }
.prose p { line-height: 1.65; color: color-mix(in srgb, var(--ink) 88%, transparent); }
.prose li { line-height: 1.6; margin: .35rem 0; }
.prose code { background: var(--chip-active-bg); padding: .1rem .4rem; border-radius: 6px; font-size: .88em; }
.supported-row { display: flex; justify-content: space-between; gap: 1rem; padding: .85rem 1.1rem; margin: .6rem 0; border-radius: 16px; }
.supported-name { font-weight: 700; }
.supported-domains { color: var(--ink-soft); font-size: .88rem; text-align: right; }
.muted { color: var(--ink-soft); } .small { font-size: .86rem; }
.foot { text-align: center; padding: 2rem 1rem 5rem; color: var(--ink-soft); font-size: .85rem; }
.foot a { color: inherit; }

/* ── Toasts (never alert()) ──────────────────────────────────────────── */
.toasts { position: fixed; bottom: max(84px, calc(env(safe-area-inset-bottom) + 70px)); left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: .5rem; width: min(420px, calc(100vw - 32px)); pointer-events: none; }
.toast {
  padding: .8rem 1.1rem; border-radius: 15px; font-size: .93rem; line-height: 1.4; font-weight: 500;
  background: var(--glass-bg); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border); box-shadow: var(--glass-shadow);
  opacity: 0; transform: translateY(12px) scale(.97);
  transition: opacity .35s var(--ease), transform .45s var(--spring);
}
.toast.show { opacity: 1; transform: translateY(0) scale(1); }
.toast.error { border-color: color-mix(in srgb, var(--danger) 55%, transparent); }
.toast.ok { border-color: color-mix(in srgb, var(--ok) 55%, transparent); }

/* ── Responsive & motion prefs ───────────────────────────────────────── */
@media (max-width: 640px) {
  .topbar { top: 10px; left: 10px; right: 10px; padding-left: .85rem; }
  .menu-btn { width: 38px; height: 38px; gap: 3px; }
  .menu-btn span { width: 15px; }
  .go-btn { min-width: 74px; padding: .8rem 1rem; }
  /* Compact action pill on phones */
  .bottom-pill { width: auto; max-width: calc(100% - 20px); justify-content: center; bottom: max(12px, env(safe-area-inset-bottom)); }
  .bp-action { padding: .42rem .72rem; font-size: .8rem; }
  .bp-divider { height: 15px; }
  main { padding-inline: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001s !important; animation-iteration-count: 1 !important; transition-duration: 0.001s !important; }
}
