/*
Theme Name: Savett
Theme URI: https://savett.site/
Author: Savett
Description: Custom dark theme for savett.site — a TikTok Downloader. Fast, mobile-first, accessible. No frameworks, system font stack, one amber accent.
Version: 1.0.4
Requires at least: 6.0
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: savett
*/

/* ============ Tokens ============ */
:root {
  --bg: #12101a;
  --bg-2: #191527;
  --surface: #211c30;
  --surface-2: #2a2340;
  --border: #332c49;
  --border-soft: #292240;
  --text: #e9ebef;
  --text-2: #c6cbd3;
  --muted: #98a1ac;
  --amber: #3ddc97;
  --amber-2: #7bf0bd;
  --amber-ink: #04120b;
  --amber-dim: rgba(61, 220, 151, 0.14);
  --ok: #3fb97f;
  --danger: #e5484d;
  --radius: 12px;
  --radius-sm: 8px;
  --max: 1080px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
}

/* ============ Base ============ */
*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, video { max-width: 100%; height: auto; }

a { color: var(--amber-2); text-decoration: none; }
a:hover, a:focus-visible { text-decoration: underline; }
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

h1, h2, h3, h4 {
  line-height: 1.25;
  margin: 0 0 0.6em;
  font-weight: 700;
  letter-spacing: -0.01em;
}
h1 { font-size: clamp(1.9rem, 5vw, 2.6rem); }
h2 { font-size: clamp(1.45rem, 3.4vw, 1.9rem); margin-top: 2.2em; }
h3 { font-size: 1.2rem; margin-top: 1.6em; }
p { margin: 0 0 1em; }
ul, ol { margin: 0 0 1em; padding-left: 1.3em; }
li { margin-bottom: 0.35em; }
strong { font-weight: 700; }
code, kbd {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.1em 0.35em;
}
hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2.4em 0;
}
blockquote {
  margin: 1.4em 0;
  padding: 0.6em 1em;
  border-left: 3px solid var(--amber);
  background: var(--surface);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* Screen-reader-only text */
.screen-reader-text {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.skip-link:focus {
  position: fixed;
  top: 8px; left: 8px;
  z-index: 100;
  background: var(--amber);
  color: var(--amber-ink);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  clip: auto;
  width: auto; height: auto;
  text-decoration: none;
}

/* ============ Layout ============ */
.wrap {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 18px;
}
.site-main { padding: 8px 0 48px; }
.page-body { padding-top: 28px; }

/* ============ Header ============ */
.site-header {
  background: var(--bg-2);
  border-bottom: 1px solid var(--border-soft);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 14px;
  padding-bottom: 14px;
}
.site-brand a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}
.site-brand a:hover { text-decoration: none; }
.site-brand .brand-wave { flex: 0 0 auto; display: inline-flex; align-items: flex-end; gap: 2px; height: 20px; }
.site-brand .brand-wave i {
  display: block;
  width: 3px;
  background: var(--amber);
  border-radius: 2px;
  height: 40%;
}
.site-brand .brand-wave i:nth-child(1) { height: 55%; }
.site-brand .brand-wave i:nth-child(2) { height: 95%; }
.site-brand .brand-wave i:nth-child(3) { height: 70%; }
.site-brand .brand-wave i:nth-child(4) { height: 100%; }
.site-brand .brand-wave i:nth-child(5) { height: 60%; }
.site-brand em { font-style: normal; color: var(--amber); }

.main-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.main-nav a {
  color: var(--text-2);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 6px 2px;
}
.main-nav a:hover,
.main-nav .current-menu-item > a,
.main-nav .current_page_item > a { color: var(--amber-2); text-decoration: none; }

/* Mobile menu toggle — hidden on desktop and without JS; shown on
   small screens only when JS is available (see header.php). */
.menu-toggle {
  display: none;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
}
.menu-toggle:hover { border-color: var(--amber); color: var(--amber-2); }
.menu-toggle-icon { display: inline-flex; flex-direction: column; gap: 4px; }
.menu-toggle-icon i {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.menu-toggle.is-open .menu-toggle-icon i:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.menu-toggle.is-open .menu-toggle-icon i:nth-child(2) { opacity: 0; }
.menu-toggle.is-open .menu-toggle-icon i:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ============ Ad slots (labelled placeholders, never buttons) ============ */
.ad-slot {
  display: block;
  margin: 18px auto;
  padding: 10px 12px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-align: center;
  min-height: 44px;
}
.ad-slot--leaderboard { max-width: 970px; min-height: 90px; }
.ad-slot--in-content { max-width: 728px; min-height: 90px; }
.ad-slot--footer { max-width: 970px; min-height: 90px; }

/* ============ Hero / converter ============ */
.hero {
  padding: 44px 0 8px;
  text-align: center;
}
.hero h1 { margin-bottom: 0.35em; }
.hero h1 em { font-style: normal; color: var(--amber); }
.hero .lede {
  max-width: 640px;
  margin: 0 auto 8px;
  color: var(--text-2);
  font-size: 1.06rem;
}

/* Waveform motif */
.waveform {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 44px;
  margin: 18px auto 6px;
}
.waveform i {
  display: block;
  width: 4px;
  border-radius: 3px;
  background: var(--amber);
  opacity: 0.85;
  height: 22%;
  animation: wave-idle 2.4s ease-in-out infinite;
}
.waveform i:nth-child(2n) { animation-delay: 0.25s; }
.waveform i:nth-child(3n) { animation-delay: 0.5s; }
.waveform i:nth-child(4n) { animation-delay: 0.75s; }
.waveform i:nth-child(5n) { animation-delay: 1s; }
@keyframes wave-idle {
  0%, 100% { height: 18%; }
  50% { height: 72%; }
}
.converter.is-converting .waveform i { animation-duration: 0.9s; }

/* Converter box */
.converter {
  max-width: 720px;
  margin: 22px auto 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 20px;
  text-align: left;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}
.converter label {
  display: block;
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 8px;
}
.converter-url-row { display: flex; gap: 10px; }
.converter input[type="url"],
.converter input[type="text"] {
  flex: 1;
  min-width: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  padding: 13px 14px;
}
.converter input[type="url"]:focus,
.converter input[type="text"]:focus {
  border-color: var(--amber);
  outline: 2px solid var(--amber);
  outline-offset: 1px;
}
.converter input::placeholder { color: var(--muted); }

.btn-paste {
  flex: 0 0 auto;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 13px 18px;
  cursor: pointer;
}
.btn-paste:hover { border-color: var(--amber); color: var(--amber-2); }

.format-pick { margin-top: 18px; }
.format-pick legend {
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0;
  margin-bottom: 8px;
}
.format-pick fieldset {
  border: 0;
  padding: 0;
  margin: 0 0 10px;
}
.format-pick .format-group-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.format-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.format-pills label {
  margin: 0;
  font-weight: 600;
  font-size: 0.92rem;
}
.format-pills input {
  position: absolute;
  opacity: 0;
  width: 1px; height: 1px;
}
.format-pills .pill {
  display: inline-block;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-2);
  color: var(--text-2);
  cursor: pointer;
}
.format-pills input:checked + .pill {
  background: var(--amber);
  border-color: var(--amber);
  color: var(--amber-ink);
}
.format-pills input:focus-visible + .pill {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}
.format-pills .pill:hover { border-color: var(--amber); }

.btn-convert {
  display: block;
  width: 100%;
  margin-top: 20px;
  padding: 15px 20px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--amber);
  color: var(--amber-ink);
  font: inherit;
  font-size: 1.08rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  cursor: pointer;
}
.btn-convert:hover { background: var(--amber-2); }
.btn-convert:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-convert:not(:disabled):hover { text-decoration: none; }

.quality-note {
  margin: 14px 0 0;
  font-size: 0.88rem;
  color: var(--muted);
}
.quality-note strong { color: var(--text-2); }

.subtitle-option {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  margin-top: 14px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
}
.subtitle-option[hidden] { display: none; }
.subtitle-option input { accent-color: var(--amber); }
.subtitle-option-note {
  flex-basis: 100%;
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--muted);
}

/* Progress + result */
.converter-status { margin-top: 18px; }
.converter-status[hidden] { display: none; }
.progress-stages {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 0.9rem;
  color: var(--muted);
}
.progress-stages li::before { content: "○ "; }
.progress-stages li.is-active { color: var(--amber-2); font-weight: 700; }
.progress-stages li.is-active::before { content: "◐ "; }
.progress-stages li.is-done { color: var(--ok); }
.progress-stages li.is-done::before { content: "● "; }
.progress-bar {
  height: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--amber);
  border-radius: 999px;
  transition: width 0.4s ease;
}
.progress-bar.is-indeterminate i {
  width: 40%;
  animation: slide-indeterminate 1.4s ease-in-out infinite;
}
@keyframes slide-indeterminate {
  0% { margin-left: 0; }
  50% { margin-left: 60%; }
  100% { margin-left: 0; }
}
.status-message { margin: 10px 0 0; font-size: 0.95rem; }
.status-message.is-error { color: #ff9a9e; }
.status-message.is-ok { color: var(--ok); }

.convert-result { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 16px; }
.convert-result[hidden] { display: none; }
.result-card { display: flex; gap: 14px; align-items: flex-start; }
.result-thumb { flex: 0 0 120px; border-radius: var(--radius-sm); overflow: hidden; background: var(--bg); }
.result-thumb img { display: block; width: 120px; height: 68px; object-fit: cover; }
.result-thumb[hidden] { display: none; }
.result-meta { min-width: 0; }
.result-meta h3 { margin: 0 0 4px; font-size: 1.02rem; overflow-wrap: anywhere; }
.result-meta dl {
  display: flex; flex-wrap: wrap; gap: 2px 16px;
  margin: 0 0 12px; font-size: 0.9rem; color: var(--muted);
}
.result-meta dt { font-weight: 700; color: var(--text-2); }
.result-meta dd { margin: 0; }
.btn-download {
  display: inline-block;
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  background: var(--amber);
  color: var(--amber-ink);
  font-weight: 800;
  font-size: 1rem;
}
.btn-download:hover { background: var(--amber-2); text-decoration: none; }
.result-note { margin: 10px 0 0; font-size: 0.85rem; color: var(--muted); }
.result-subtitles { margin: 10px 0 0; font-size: 0.9rem; color: var(--text-2); }
.result-subtitles[hidden] { display: none; }
.result-subtitles a { font-weight: 700; }

/* ============ Sections ============ */
.section { padding: 18px 0; }
.section--intro { max-width: 760px; margin: 0 auto; }
.section--intro h2 { text-align: center; }

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: step;
}
.steps li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin: 0;
}
.steps li::before {
  counter-increment: step;
  content: counter(step);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--amber-dim);
  color: var(--amber-2);
  font-weight: 800;
  margin-bottom: 10px;
}
.steps h3 { margin: 0 0 6px; font-size: 1.05rem; }
.steps p { margin: 0; color: var(--text-2); font-size: 0.95rem; }

.compare-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.compare-table th, .compare-table td {
  border: 1px solid var(--border);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}
.compare-table th { background: var(--surface); }
.compare-table tr:nth-child(even) td { background: var(--bg-2); }
.table-scroll { overflow-x: auto; }

.trust-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.trust-grid li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin: 0;
}
.trust-grid h3 { margin: 0 0 6px; font-size: 1.05rem; }
.trust-grid p { margin: 0; color: var(--text-2); font-size: 0.95rem; }

/* FAQ */
.faq-list { max-width: 760px; margin: 0 auto; }
.faq-list details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 10px;
}
.faq-list summary {
  font-weight: 700;
  cursor: pointer;
  font-size: 1.02rem;
}
.faq-list summary::marker { color: var(--amber); }
.faq-list details p { margin: 10px 0 0; color: var(--text-2); }

/* Breadcrumbs */
.breadcrumbs { font-size: 0.88rem; color: var(--muted); margin-bottom: 10px; }
.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--amber-2); }
.breadcrumbs [aria-current="page"] { color: var(--text-2); }

/* Page content */
.entry-header h1 { margin-bottom: 0.4em; }
.entry-content a { overflow-wrap: anywhere; }
.entry-content img { border-radius: var(--radius-sm); }
.entry-content table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.entry-content th, .entry-content td {
  border: 1px solid var(--border);
  padding: 9px 11px;
  text-align: left;
  vertical-align: top;
}
.entry-content th { background: var(--surface); }

/* ============ Footer ============ */
.site-footer {
  background: var(--bg-2);
  border-top: 1px solid var(--border-soft);
  padding: 30px 0 26px;
  color: var(--muted);
  font-size: 0.92rem;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  justify-content: space-between;
  align-items: flex-start;
}
.footer-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.footer-nav a { color: var(--text-2); }
.footer-note { margin: 18px 0 0; max-width: 720px; font-size: 0.85rem; }
.site-info { margin: 14px 0 0; font-size: 0.85rem; }

/* ============ Responsive ============ */
@media (max-width: 760px) {
  body { font-size: 16px; }
  .header-inner { flex-wrap: wrap; gap: 8px 12px; }
  /* Mobile menu: toggle shown only with JS; nav hidden until opened.
     Without JS the toggle stays hidden and the menu stays visible. */
  .js .menu-toggle { display: inline-flex; }
  .main-nav { flex-basis: 100%; }
  .js .main-nav { display: none; }
  .js .main-nav.is-open { display: block; }
  .main-nav.is-open ul { flex-direction: column; gap: 0; }
  .main-nav.is-open li { border-top: 1px solid var(--border-soft); }
  .main-nav.is-open li:first-child { border-top: 0; }
  /* 44px minimum tap targets on mobile. */
  .main-nav a { display: flex; align-items: center; min-height: 44px; padding: 10px 4px; }
  .footer-nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 10px 4px; }
  /* Bare tables pasted into page content scroll instead of squeezing. */
  .entry-content table {
    display: block;
    overflow-x: auto;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
  }
  .hero { padding-top: 30px; }
  .converter { padding: 18px 14px; }
  .converter-url-row { flex-direction: column; }
  .btn-convert { font-size: 1.02rem; }
  .steps, .trust-grid { grid-template-columns: 1fr; }
  .result-card { flex-direction: column; }
  .result-thumb img { width: 100%; height: auto; }
  .ad-slot--leaderboard, .ad-slot--in-content, .ad-slot--footer { min-height: 60px; }
}

/* ============ Reduced motion ============ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .waveform i,
  .progress-bar.is-indeterminate i { animation: none; }
  .menu-toggle-icon i { transition: none; }
  .waveform i { height: 45%; }
  .progress-bar i { transition: none; }
}

/* ============ Print ============ */
@media print {
  body { background: #fff; color: #111; }
  .site-header, .site-footer, .ad-slot, .converter, .waveform { display: none; }
}
