/* ==========================================================
   Tikabo.az — design tokens
   ========================================================== */
:root {
  --font-display: "Space Grotesk", "Inter", sans-serif;
  --font-body: "Inter", sans-serif;
  --font-mono: "JetBrains Mono", monospace;

  --accent-cyan: #2de2e6;
  --accent-pink: #ff2d6f;

  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;

  --max-w: 760px;
}

.theme-dark {
  --bg: #0b0b10;
  --bg-elevated: #15151d;
  --bg-elevated-2: #1c1c26;
  --text: #ececf2;
  --muted: #8d8da3;
  --border: rgba(255, 255, 255, 0.09);
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

.theme-light {
  --bg: #f5f4f1;
  --bg-elevated: #ffffff;
  --bg-elevated-2: #ececea;
  --text: #14141c;
  --muted: #64646f;
  --border: rgba(0, 0, 0, 0.09);
  --shadow: 0 20px 50px rgba(20, 20, 28, 0.09);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  transition: background 0.35s ease, color 0.35s ease;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

.wrap {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 20px;
}

a { color: inherit; text-decoration: none; }

/* subtle grain so the flat dark bg doesn't feel like a template default */
.noise-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ==========================================================
   Header
   ========================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(10px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  padding-bottom: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  object-fit: cover;
}

.brand-name {
  position: relative;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}

/* signature glitch: RGB-split on hover, echoing TikTok's own chromatic identity */
.brand-name::before,
.brand-name::after {
  content: attr(data-text);
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  opacity: 0;
  pointer-events: none;
}
.brand-name::before {
  color: var(--accent-cyan);
  transform: translate(0, 0);
}
.brand-name::after {
  color: var(--accent-pink);
  transform: translate(0, 0);
}
.brand:hover .brand-name::before {
  opacity: 0.75;
  animation: glitch-shift 0.5s steps(2, end) infinite;
}
.brand:hover .brand-name::after {
  opacity: 0.75;
  animation: glitch-shift-rev 0.5s steps(2, end) infinite;
}
@keyframes glitch-shift {
  0% { transform: translate(0, 0); }
  50% { transform: translate(1.5px, -1px); }
  100% { transform: translate(-1px, 1px); }
}
@keyframes glitch-shift-rev {
  0% { transform: translate(0, 0); }
  50% { transform: translate(-1.5px, 1px); }
  100% { transform: translate(1px, -1px); }
}

.theme-toggle {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.2s ease;
}
.theme-toggle:hover { border-color: var(--accent-cyan); }
.theme-toggle:active { transform: scale(0.92); }

/* ==========================================================
   Hero
   ========================================================== */
.main-wrap { padding-top: 64px; padding-bottom: 80px; }

.hero { text-align: center; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  color: var(--accent-pink);
  margin: 0 0 18px;
}

.platform-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  margin: 0 auto 26px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.platform-tab {
  display: flex;
  align-items: center;
  gap: 7px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.86rem;
  padding: 9px 18px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}
.platform-tab:hover { color: var(--text); }
.platform-tab.is-active {
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-pink));
  color: #0b0b10;
}

.headline {
  font-family: var(--font-display);
  font-size: clamp(2rem, 6vw, 3.1rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin: 0 0 18px;
  font-weight: 700;
}

.accent-text {
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-pink));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.subhead {
  color: var(--muted);
  font-size: 1rem;
  max-width: 480px;
  margin: 0 auto 36px;
  line-height: 1.55;
}

.download-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 560px;
  margin: 0 auto;
}

.input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 4px 6px 4px 16px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.input-row:focus-within {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-cyan) 20%, transparent);
}
.input-icon { font-size: 1rem; opacity: 0.7; }

#urlInput {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.92rem;
  padding: 14px 4px;
  min-width: 0;
}
#urlInput::placeholder { color: var(--muted); }

.btn-primary {
  border: none;
  cursor: pointer;
  padding: 15px 22px;
  border-radius: var(--radius-md);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  color: #0b0b10;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-pink));
  transition: transform 0.15s ease, opacity 0.2s ease;
}
.btn-primary:hover { transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.error-msg {
  color: var(--accent-pink);
  font-size: 0.88rem;
  margin-top: 16px;
  font-family: var(--font-mono);
}

/* ==========================================================
   Loading state
   ========================================================== */
.loading-box {
  margin: 30px auto 0;
  max-width: 560px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  padding: 22px;
  position: relative;
  overflow: hidden;
}
.scanline {
  position: absolute;
  top: 0; left: -40%;
  width: 40%; height: 100%;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent-cyan) 25%, transparent), transparent);
  animation: scan 1.3s linear infinite;
}
@keyframes scan {
  0% { left: -40%; }
  100% { left: 100%; }
}
.loading-text {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: var(--muted);
  position: relative;
  z-index: 1;
}
.dots span { animation: blink 1.4s infinite; opacity: 0; }
.dots span:nth-child(2) { animation-delay: 0.2s; }
.dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 100% { opacity: 0; } 50% { opacity: 1; } }

/* ==========================================================
   Result card
   ========================================================== */
.result-card[hidden] { display: none; }

.result-card {
  margin: 30px auto 0;
  max-width: 560px;
  display: flex;
  gap: 16px;
  align-items: center;
  text-align: left;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow);
}
.result-thumb {
  width: 84px;
  height: 84px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-elevated-2);
}
.result-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.result-info { flex: 1; min-width: 0; }
.result-title {
  margin: 0 0 4px;
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.result-author {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.82rem;
  font-family: var(--font-mono);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--text);
  color: var(--bg);
  font-weight: 600;
  font-size: 0.86rem;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  transition: opacity 0.2s ease;
}
.btn-secondary:hover { opacity: 0.85; }

/* ==========================================================
   Steps
   ========================================================== */
.steps {
  margin-top: 90px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.step {
  border-top: 1px solid var(--border);
  padding-top: 16px;
}
.step-num {
  font-family: var(--font-mono);
  color: var(--accent-cyan);
  font-size: 0.8rem;
}
.step h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  margin: 8px 0 6px;
}
.step p {
  color: var(--muted);
  font-size: 0.87rem;
  line-height: 1.5;
  margin: 0;
}

/* ==========================================================
   Footer
   ========================================================== */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 26px 0 40px;
}
.footer-inner p {
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
  line-height: 1.6;
  margin: 0;
}

/* ==========================================================
   Focus visibility & motion
   ========================================================== */
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* ==========================================================
   Responsive
   ========================================================== */
@media (min-width: 560px) {
  .download-form { flex-direction: row; }
  .btn-primary { flex-shrink: 0; }
}

@media (max-width: 640px) {
  .steps { grid-template-columns: 1fr; gap: 20px; }
  .main-wrap { padding-top: 44px; }
  .result-card { flex-direction: column; text-align: center; }
  .result-title { white-space: normal; }
}
