/* ============================================================
   topkit — digital marketplace
   Faithful implementation of topkit.dc.html (Claude Design)
   Zero dependencies. Design tokens + hover states + responsive.
   ============================================================ */

:root {
  --bg: #08080d;
  --panel: #0f0f16;
  --panel-2: #0c0c12;
  --panel-3: #12121a;
  --fg: #fff;
  --violet: #8b5cf6;
  --pink: #ec4899;
  --amber: #f59e0b;
  --cyan: #22d3ee;
  --green: #34d399;
  --grad: linear-gradient(92deg, #8b5cf6, #ec4899);
  --grad-tri: linear-gradient(92deg, #8b5cf6 0%, #ec4899 55%, #f59e0b 110%);
  --mono: ui-monospace, Menlo, Monaco, "SF Mono", monospace;
}

* { box-sizing: border-box; }

/* overflow-x: clip kills the sideways drift at the root without creating a
   scroll container (so position:sticky keeps working, unlike overflow:hidden). */
html { scroll-behavior: smooth; overflow-x: clip; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: 'Archivo', 'Noto Sans Armenian', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  max-width: 100%;
}

/* long Armenian compound words must never blow out a heading's box */
h1, h2, h3 { overflow-wrap: break-word; }

::selection { background: var(--violet); color: #fff; }

input { outline: none; }
input::placeholder { color: rgba(255, 255, 255, .3); }

button { font-family: inherit; }

/* Gradient text helper */
.grad-text {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Base transition for interactive elements */
.t {
  transition: transform .15s ease, background .18s ease,
              border-color .2s ease, color .15s ease, box-shadow .2s ease;
}

/* ---------- Hover states (ported from style-hover) ---------- */
.h-scale:hover  { transform: scale(1.04); }
.h-scale5:hover { transform: scale(1.05); }
.h-scale2:hover { transform: scale(1.02); }
.h-lift:hover   { transform: translateY(-2px); }
.h-bg:hover     { background: rgba(255, 255, 255, .1); }
.h-bg11:hover   { background: rgba(255, 255, 255, .11); }
.h-white:hover  { color: #fff; }
.h-card:hover   { border-color: rgba(255, 255, 255, .24); transform: translateY(-3px); }

/* No-transition utility so gradient glows don't animate on re-render */
.noglow { pointer-events: none; }

/* ---------- Live demo previews (real drops embedded as scaled iframes) ----------
   Trick: iframe rendered at N× the container size, scaled down by 1/N —
   the embedded page always lays out at desktop width and exactly fills
   its box, at any container size. */

/* Grid card thumbnail: 5× → non-interactive live poster */
.live-thumb {
  position: absolute; top: 0; left: 0;
  width: 500%; height: 500%;
  transform: scale(.2); transform-origin: 0 0;
  border: 0; pointer-events: none; background: #07070c;
}

/* Detail preview: 2.5× → fully interactive (scroll, hover, click) */
.live-frame {
  position: absolute; top: 0; left: 0;
  width: 250%; height: 250%;
  transform: scale(.4); transform-origin: 0 0;
  border: 0; background: #07070c;
}

/* Transformation AFTER frame: 3× → interactive live drop */
.after-live {
  position: absolute; top: 0; left: 0;
  width: 300%; height: 300%;
  transform: scale(.3334); transform-origin: 0 0;
  border: 0; background: #07070c;
}

/* Admin-uploaded phone preview loop — fills the card like a poster;
   taps pass through to the card (detail page has the real live page). */
.card-vid {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: top center; border: 0;
  pointer-events: none; background: #07070c;
  opacity: 0; transition: opacity .45s ease;
}
.card-vid.ld { opacity: 1; }

.live-badge {
  position: absolute; top: 12px; right: 12px;
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(52,211,153,.35); border-radius: 99px;
  padding: 4px 10px;
  font-family: var(--mono); font-size: 10px; letter-spacing: 1px;
  color: #34d399; pointer-events: none;
}

/* ---------- Auth (sign in / account) ---------- */
.account-menu {
  position: absolute; top: calc(100% + 10px); right: 0; width: 240px;
  background: #12121a; border: 1px solid rgba(255,255,255,.12); border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,.6); overflow: hidden; z-index: 60;
  opacity: 0; transform: translateY(-8px) scale(.98); transform-origin: top right;
  pointer-events: none; transition: opacity .22s ease, transform .22s ease;
}
.account-menu.open { opacity: 1; transform: none; pointer-events: auto; }

.tk-modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(5,5,9,.72);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center; padding: 24px;
  animation: tkFade .2s ease-out;
}
@keyframes tkFade { from { opacity: 0; } to { opacity: 1; } }
.tk-modal {
  width: 380px; max-width: 100%;
  background: #0f0f16; border: 1px solid rgba(255,255,255,.1); border-radius: 20px;
  padding: 30px; display: flex; flex-direction: column; gap: 16px;
  animation: tkPop .25s cubic-bezier(.22,1,.36,1);
}
@keyframes tkPop { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; } }
.tk-tab {
  flex: 1; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.1);
  color: rgba(255,255,255,.55); font-family: inherit; font-size: 13px; font-weight: 700;
  padding: 9px; border-radius: 99px; cursor: pointer; transition: all .15s;
}
.tk-tab.act { background: rgba(139,92,246,.16); border-color: rgba(139,92,246,.5); color: #fff; }
.tk-field { display: flex; flex-direction: column; gap: 6px; }
.tk-field label {
  font-family: var(--mono); font-size: 10px; letter-spacing: 1.5px;
  text-transform: uppercase; color: rgba(255,255,255,.35);
}
.tk-field input {
  background: #0c0c12; border: 1px solid rgba(255,255,255,.1); border-radius: 10px;
  padding: 12px 14px; font-family: inherit; font-size: 14px; color: #fff; outline: none;
}
.tk-field input:focus { border-color: rgba(139,92,246,.55); }

/* viral unlock steps */
.tk-step {
  display: flex; align-items: center; gap: 12px;
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.1);
  border-radius: 12px; padding: 12px 14px;
  font-size: 13.5px; font-weight: 600; color: #fff; text-decoration: none;
  transition: background .15s, border-color .15s;
}
.tk-step:hover { background: rgba(255,255,255,.08); border-color: rgba(139,92,246,.45); }
.tk-step .n {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  background: var(--grad); display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800;
}

/* ---------- Responsive ----------
   The site is built with inline styles, so mobile overrides use !important to
   win over them (a stylesheet !important beats an inline declaration). */

@media (max-width: 900px) {
  .nav          { padding: 14px 20px !important; gap: 12px !important; }
  .pad          { padding-left: 22px !important; padding-right: 22px !important; }
  .detail-grid  { grid-template-columns: 1fr !important; gap: 32px !important; }
  .builder-grid { grid-template-columns: 1fr !important; }
  .chat-panel   { border-right: none !important; border-bottom: 1px solid rgba(255,255,255,.07) !important; }
  .float-card   { display: none !important; }
  /* footer link row wraps instead of pushing the page wide */
  .footer-links { flex-wrap: wrap !important; gap: 14px 18px !important; justify-content: flex-start !important; }
}

@media (max-width: 620px) {
  .nav          { flex-wrap: wrap !important; padding: 12px 16px !important; }
  .nav-links    { display: none !important; }
  .pad          { padding-left: 16px !important; padding-right: 16px !important; }
  .hero         { padding-top: 64px !important; padding-left: 16px !important; padding-right: 16px !important; }
  /* fit the display headline to a narrow screen; long words may break */
  .hero h1      { font-size: clamp(32px, 11vw, 52px) !important; letter-spacing: -1px !important; }
  /* the decorative glows are big absolute blurs — shrink so they don't dominate */
  .noglow       { max-width: 78vw !important; }
  /* newsletter strip: stack heading over the form */
  .footer-newsletter { flex-direction: column !important; align-items: flex-start !important; gap: 12px !important; }
  .footer-newsletter form { width: 100% !important; }
  .footer-newsletter input { flex: 1 1 auto !important; min-width: 0 !important; }
}

@media (max-width: 420px) {
  /* trim the nav CTA so the top bar never overflows on the smallest phones */
  .nav .get-pro { padding: 8px 13px !important; font-size: 12.5px !important; }
}

/* Live previews load invisibly and fade in — no black boxes while the demo
   page inside the iframe boots. The shimmer sits behind grid thumbnails and
   is removed by the iframe's onload. */
.live-thumb, .live-frame { opacity: 0; transition: opacity .45s ease; }
.live-thumb.ld, .live-frame.ld { opacity: 1; }
/* The sweep animates transform (GPU-composited) — animating
   background-position repainted every card every frame on the CPU. Once a
   preview reveals, .off stops the shimmer entirely; it resumes if the
   preview is unmounted again. */
.thumb-shim {
  position: absolute; inset: 0; pointer-events: none; overflow: hidden;
  background: rgba(255, 255, 255, .02);
}
.thumb-shim::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.08) 50%, transparent 70%);
  transform: translateX(-100%);
  animation: tk-shim 1.2s linear infinite;
}
.thumb-shim.off::after { animation: none; display: none; }
@keyframes tk-shim { to { transform: translateX(100%); } }

/* ---------- mobile fixes ---------- */

/* Armenian headline words are long — the desktop clamp floor (52px) overflows
   phones. Tighter type below 560px keeps the hierarchy intact. */
@media (max-width: 560px) {
  .hero-h1 { font-size: clamp(26px, 8.6vw, 42px) !important; letter-spacing: -1.2px !important; line-height: 1.02 !important; }
}

/* Live previews stay scrollable on touch — the sideways drift is fixed at the
   source instead: same-origin demo documents get overflow-x:hidden injected
   on load, so only vertical scrolling is possible inside a preview. */
@media (max-width: 760px) {
  .after-live, .live-frame, .live-mount iframe { touch-action: pan-y; }
}

/* Phones embed much smaller preview documents. A grid card at 500% is a
   ~2000px-wide document — WebKit backing stores scale with document size and
   iOS killed the tab the moment two of them mounted. Quarter the area: the
   page inside lays out at tablet width, still a real live desktop-style page. */
@media (max-width: 760px) {
  /* stay ABOVE the demos' ~900px responsive breakpoints on EVERY phone
     width (Android cards are ~340px wide — 250% fell back under 900px
     there and previews went blank), while staying far below the ~2000px
     documents that killed the tab. .after-live/.live-frame keep their
     base 300%/250% for the same reason. */
  .live-thumb  { width: 300%; height: 300%; transform: scale(.3334); }
}

/* Phone previews run script-free for stability; this hands the full demo
   (JS, video, WebGL) to one deliberate tap — a single hot page at a time.
   Desktop previews already run full JS, so the button only shows on phones. */
.golive {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%);
  z-index: 3; border: 0; border-radius: 99px; padding: 10px 18px;
  background: var(--grad); color: #fff; font-family: inherit; font-size: 13px;
  font-weight: 800; cursor: pointer; box-shadow: 0 10px 30px rgba(0,0,0,.45);
  display: none;
}
@media (max-width: 760px) {
  .golive { display: inline-flex; }
}

/* ---------- live-preview virtualization ---------- */

/* Mount points fill their thumb container; iframes are injected/removed by
   an IntersectionObserver so only previews near the viewport hold a live
   page in memory. */
.live-mount { position: absolute; inset: 0; overflow: hidden; }
.live-mount iframe { opacity: 0; transition: opacity .45s ease; }
.live-mount iframe.ld { opacity: 1; }

/* Hero headline hierarchy on phones: the first line drops to a supporting
   size so the gradient action words carry the weight (long Armenian words
   otherwise read as one undifferentiated wall of caps). */
@media (max-width: 560px) {
  .hero-h1 .h1a {
    display: block;
    font-size: .55em;
    letter-spacing: -.8px;
    line-height: 1.1;
    margin-bottom: .18em;
    opacity: .96;
  }
}

/* The decorative blur(70px) glow layers are expensive to composite on
   phones — the dark gradient background carries the mood without them.
   The hero headline's drop-shadow is a plain filter: (not backdrop-filter),
   so it needs its own kill — the only live filter above the fold. */
@media (max-width: 760px) {
  .noglow { display: none !important; }
  .hero-h1 * { filter: none !important; }
}

/* iOS Safari allocates a compositing layer per backdrop-filter; dozens of
   frosted elements exhaust GPU memory and contribute to tab crashes. Phones
   drop the blur — the translucent rgba() backgrounds still read as glass. */
@media (max-width: 760px) {
  * { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
}

/* ---------- immersive detail preview (phones) ----------
   Desktop shows the live template as a 16/10 strip beside the buy panel. Once
   the grid stacks on a phone that strip reads as a cramped thumbnail — so the
   template, the thing actually worth showing, gets a tall near-device-height
   frame with a gradient glow ring and a slide-in reveal. The live iframe fills
   it (it's already absolute inset:0), so it simply shows far more of the real
   page. Desktop keeps its inline aspect-ratio — these rules only fire ≤760px. */
@media (max-width: 760px) {
  .detail-preview { gap: 12px !important; }
  .detail-tabs { position: relative; z-index: 2; }
  .detail-panel {
    aspect-ratio: auto !important;
    height: 68vh !important;
    min-height: 400px !important;
    border-radius: 22px !important;
    animation: tk-preview-in .55s cubic-bezier(.22, 1, .36, 1) both;
  }
  /* Style drops render flowing spec content (palette/type/spacing/guidelines),
     not a live template — forcing it into the fixed-height immersive box above
     clips/crams that content, so it's exempt and left free to grow. */
  .detail-panel.is-style {
    height: auto !important;
    min-height: 0 !important;
    animation: none !important;
  }
  /* the glow ring is what turns "a box with a page in it" into a hero — a
     violet→pink halo lifted off the dark page, only on the live preview. */
  .detail-panel.is-live {
    border-color: rgba(139, 92, 246, .4) !important;
    box-shadow:
      0 0 0 1px rgba(139, 92, 246, .28),
      0 26px 80px -22px rgba(139, 92, 246, .55),
      0 12px 46px -20px rgba(236, 72, 153, .42);
  }
  /* bigger, glowing live CTA — a real thumb target, not a desktop-sized pill */
  .golive {
    bottom: 18px; padding: 14px 26px; font-size: 15px;
    box-shadow: 0 16px 44px rgba(139, 92, 246, .5);
  }
  .live-badge { top: 16px; font-size: 11px; padding: 6px 12px; }
}
@keyframes tk-preview-in {
  from { opacity: 0; transform: translateY(18px) scale(.985); }
  to   { opacity: 1; transform: none; }
}
