/* =========================================================
   Finovocalc — design tokens
   Display: Space Grotesk / Body: Inter / Mono: IBM Plex Mono
   Palette: porcelain background, ink text, indigo + amber accents
   ========================================================= */

:root {
  --ink: #14161f;
  --ink-soft: #4a4d5e;
  --paper: #f6f7fb;
  --card: #ffffff;
  --border: #e4e6f0;
  --border-strong: #cfd2e4;
  --indigo: #5b57f2;
  --indigo-dark: #4541d1;
  --amber: #f5a623;
  --success: #1fae6b;
  --danger: #e0473f;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 9px;
  --shadow-card: 0 24px 60px -28px rgba(20, 22, 31, 0.28);
  --shadow-soft: 0 10px 30px -18px rgba(20, 22, 31, 0.2);
  --font-display: "Space Grotesk", "Inter", sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 24px;
}

img { max-width: 100%; display: block; }

a { color: var(--indigo-dark); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

:focus-visible {
  outline: 2px solid var(--indigo);
  outline-offset: 3px;
}

/* ---------- HEADER ---------- */
.site-header {
  border-bottom: 1px solid var(--border);
  background: rgba(246, 247, 251, 0.9);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 40;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  text-decoration: none;
  color: var(--ink);
}

.logo-mark {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--indigo), var(--amber));
  display: inline-block;
  position: relative;
}
.logo-mark::after {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 3px;
  background: var(--card);
}

.site-nav {
  display: flex;
  gap: 28px;
}
.site-nav a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.94rem;
  font-weight: 500;
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.site-nav a:hover,
.site-nav a.active {
  color: var(--ink);
  border-bottom-color: var(--indigo);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}
.nav-toggle span {
  width: 22px; height: 2px; background: var(--ink); border-radius: 2px;
}

/* ---------- HERO ---------- */
.hero {
  padding: 64px 0 40px;
  text-align: center;
  background:
    radial-gradient(600px 300px at 15% 0%, rgba(91,87,242,0.09), transparent 60%),
    radial-gradient(500px 260px at 90% 10%, rgba(245,166,35,0.10), transparent 60%);
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.4vw, 2.85rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 14px;
}

.subtitle {
  color: var(--ink-soft);
  font-size: 1.05rem;
  max-width: 560px;
  margin: 0 auto 40px;
  line-height: 1.6;
}

/* ---------- DOWNLOADER CARD ---------- */
.downloader-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  max-width: 620px;
  margin: 0 auto;
  padding: 32px;
  text-align: left;
}

.field-row { margin-bottom: 22px; }

.input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 6px 8px 6px 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
  background: var(--paper);
}
.input-wrap:focus-within {
  border-color: var(--indigo);
  box-shadow: 0 0 0 4px rgba(91, 87, 242, 0.12);
}

.input-icon {
  width: 20px; height: 20px; color: var(--ink-soft); flex-shrink: 0;
}

#tiktokUrl {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 1rem;
  font-family: var(--font-mono);
  padding: 12px 0;
  color: var(--ink);
  min-width: 0;
}
#tiktokUrl:focus { outline: none; }
#tiktokUrl::placeholder { color: #9297ab; font-family: var(--font-body); }

.paste-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--ink);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, transform 0.1s;
}
.paste-btn:hover { background: var(--indigo-dark); }
.paste-btn:active { transform: scale(0.97); }
.paste-btn svg { width: 16px; height: 16px; }

.field-status {
  margin: 8px 2px 0;
  font-size: 0.82rem;
  color: var(--success);
  font-family: var(--font-mono);
  min-height: 1em;
}

/* ---------- OPTIONS ---------- */
.options {
  border: none;
  padding: 0;
  margin: 0 0 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.options legend {
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
  padding: 0 0 10px;
}

.option-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
  position: relative;
}
.option-card:hover { border-color: var(--border-strong); background: var(--paper); }
.option-card input { position: absolute; opacity: 0; width: 0; height: 0; }

.option-card .option-icon {
  width: 34px; height: 34px; flex-shrink: 0;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  background: var(--paper);
  color: var(--ink-soft);
}
.option-card .option-icon svg { width: 18px; height: 18px; }

.option-copy { flex: 1; }
.option-title { display: block; font-weight: 600; margin-bottom: 3px; }
.option-desc { display: block; font-size: 0.87rem; color: var(--ink-soft); line-height: 1.5; }

.option-check {
  width: 20px; height: 20px; border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  flex-shrink: 0; margin-top: 2px;
  position: relative;
  transition: border-color 0.15s, background 0.15s;
}

.option-card:has(input:checked) {
  border-color: var(--indigo);
  background: rgba(91, 87, 242, 0.05);
}
.option-card:has(input:checked) .option-icon {
  background: var(--indigo);
  color: #fff;
}
.option-card:has(input:checked) .option-check {
  border-color: var(--indigo);
  background: var(--indigo);
}
.option-card:has(input:checked) .option-check::after {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: #fff;
}
.option-card:has(input:focus-visible) { outline: 2px solid var(--indigo); outline-offset: 2px; }

/* ---------- DOWNLOAD BUTTON ---------- */
.btn-download {
  width: 100%;
  border: none;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--indigo), var(--indigo-dark));
  color: #fff;
  font-size: 1.05rem;
  font-weight: 600;
  font-family: var(--font-display);
  padding: 16px;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: transform 0.1s, box-shadow 0.15s;
}
.btn-download:hover { box-shadow: 0 14px 34px -14px rgba(91,87,242,0.55); }
.btn-download:active { transform: scale(0.99); }
.btn-download:disabled { opacity: 0.75; cursor: progress; }

.btn-state {
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.btn-state svg { width: 20px; height: 20px; }

.spinner {
  width: 18px; height: 18px;
  border: 2.5px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* signature element: waveform, nods to "vocal" in Finovocalc,
   active only while a download is being prepared */
.waveform {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 22px;
  margin-top: 16px;
  opacity: 0;
  transition: opacity 0.2s;
}
.waveform.active { opacity: 1; }
.waveform span {
  width: 3px;
  border-radius: 2px;
  background: var(--amber);
  height: 20%;
  animation: wave 0.9s ease-in-out infinite;
}
.waveform span:nth-child(1) { animation-delay: 0s; }
.waveform span:nth-child(2) { animation-delay: 0.08s; }
.waveform span:nth-child(3) { animation-delay: 0.16s; }
.waveform span:nth-child(4) { animation-delay: 0.24s; }
.waveform span:nth-child(5) { animation-delay: 0.32s; }
.waveform span:nth-child(6) { animation-delay: 0.24s; }
.waveform span:nth-child(7) { animation-delay: 0.16s; }
.waveform span:nth-child(8) { animation-delay: 0.08s; }
@keyframes wave {
  0%, 100% { height: 20%; }
  50% { height: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .waveform span { animation: none; height: 60%; }
  .spinner { animation-duration: 1.4s; }
}

.inline-error {
  margin: 16px 0 0;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: rgba(224, 71, 63, 0.08);
  border: 1px solid rgba(224, 71, 63, 0.25);
  color: #a3312b;
  font-size: 0.9rem;
}

.legal-note {
  margin: 20px 0 0;
  font-size: 0.8rem;
  color: var(--ink-soft);
  text-align: center;
}

/* ---------- TOAST ---------- */
.toast {
  max-width: 620px;
  margin: 18px auto 0;
  display: flex;
  align-items: center;
  gap: 12px;
  background: #f0faf5;
  border: 1px solid rgba(31, 174, 107, 0.3);
  color: #146b46;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  font-size: 0.92rem;
  animation: rise 0.25s ease;
}
.toast-check {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--success); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; flex-shrink: 0;
}
.toast-sub { display: block; color: #2f7d5c; font-size: 0.85rem; margin-top: 2px; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- AD SLOTS ---------- */
.ad-slot {
  margin: 28px auto;
  min-height: 90px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9297ab;
  font-size: 0.78rem;
}
.ad-label { text-transform: uppercase; letter-spacing: 0.08em; }

/* ---------- SECTIONS ---------- */
.section { padding: 56px 0; }
.section-alt { background: var(--card); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }

.section h2 {
  font-family: var(--font-display);
  font-size: 1.7rem;
  margin: 0 0 20px;
  text-align: center;
}

.section-lead {
  text-align: center;
  color: var(--ink-soft);
  max-width: 560px;
  margin: -6px auto 28px;
}

.steps {
  list-style: none;
  padding: 0;
  margin: 0 auto;
  max-width: 620px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.steps li {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
}
.step-num {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--ink); color: #fff;
  font-family: var(--font-mono); font-size: 0.85rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
}
.feature-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  background: var(--paper);
}
.feature-card h3 {
  font-family: var(--font-display);
  margin: 0 0 8px;
  font-size: 1.05rem;
}
.feature-card p { margin: 0; color: var(--ink-soft); font-size: 0.9rem; line-height: 1.55; }

.faq-list {
  max-width: 680px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.faq-list details {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  background: var(--card);
}
.faq-list summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
}
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list p { color: var(--ink-soft); margin: 10px 0 0; font-size: 0.92rem; line-height: 1.55; }

.disclaimer-strip {
  text-align: center;
  font-size: 0.82rem;
  color: var(--ink-soft);
  padding: 20px 24px 0;
}

/* ---------- FOOTER ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--card);
  padding: 44px 0 20px;
  margin-top: 40px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 24px;
}
.footer-logo { margin-bottom: 10px; }
.footer-grid p { color: var(--ink-soft); font-size: 0.88rem; margin: 0; }
.footer-grid h3 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  margin: 0 0 12px;
}
.footer-grid a {
  display: block;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.9rem;
  margin-bottom: 8px;
}
.footer-grid a:hover { color: var(--indigo); }

.copyright {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  color: var(--ink-soft);
  font-size: 0.8rem;
}

/* ---------- SIMPLE PAGES (legal / static) ---------- */
.page-content {
  max-width: 760px;
  margin: 0 auto;
  padding: 56px 24px 80px;
  line-height: 1.7;
}
.page-content h1 {
  font-family: var(--font-display);
  font-size: 2rem;
  margin-bottom: 6px;
}
.page-content .updated { color: var(--ink-soft); font-size: 0.85rem; margin-bottom: 32px; }
.page-content h2 { font-family: var(--font-display); font-size: 1.25rem; margin-top: 36px; }
.page-content ul { padding-left: 20px; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 760px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  .site-nav {
    position: absolute;
    top: 68px; left: 0; right: 0;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 10px 24px 18px;
    gap: 4px;
    display: none;
  }
  .site-nav.open { display: flex; }
  .nav-toggle { display: flex; }

  .downloader-card { padding: 22px; border-radius: var(--radius-md); }
  .input-wrap { flex-wrap: wrap; }
  #tiktokUrl { width: 100%; order: 1; }
  .paste-btn { order: 2; margin: 6px 0 4px auto; }
  .footer-grid { grid-template-columns: 1fr; }
}
