/* =========================================================
   X Downloader — design tokens
   Palette matched to x-downloader.com
   ========================================================= */
:root {
  /* brand */
  --blue:          #1D9BF0;
  --blue-hover:    #1A8CD8;
  --blue-dim:      rgba(29, 155, 240, .12);
  --warning:       #FFC409;
  --warning-hover: #E6B008;

  /* neutrals */
  --black:         #000000;
  --surface-dark:  #222428;
  --surface-deep:  #16181C;
  --light-gray:    #EFF3F4;
  --text-light:    #E7E9EA;
  --white:         #FFFFFF;
  --muted:         #71767B;

  /* washes */
  --wash-dark:     rgba(0, 0, 0, .05);
  --wash-light:    rgba(255, 255, 255, .05);
  --wash-light-2:  rgba(255, 255, 255, .2);
  --hairline:      rgba(0, 0, 0, .08);
  --hairline-lt:   rgba(255, 255, 255, .12);

  /* system */
  --font: Arial, Helvetica, sans-serif;
  --container: 1024px;
  --pill: 9999px;
  --card-radius: 25px;
}

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

/* author display rules must not defeat the hidden attribute */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--white);
  color: var(--black);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 16px;
}

.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;
}

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--blue); color: var(--white);
  padding: 10px 16px; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

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

/* =========================================================
   Buttons
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 0;
  border-radius: var(--pill);
  padding: 0 24px;
  height: 44px;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color .15s ease, color .15s ease, opacity .15s ease;
}
.btn:hover { text-decoration: none; }

.btn-primary { background: var(--blue); color: var(--white); }
.btn-primary:hover { background: var(--blue-hover); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; }

.btn-warning { background: var(--warning); color: var(--white); }
.btn-warning:hover { background: var(--warning-hover); }

.btn-clear { background: transparent; color: var(--blue); }
.btn-clear:hover { background: var(--blue-dim); }

/* =========================================================
   Header
   ========================================================= */
.site-header {
  background: var(--black);
  position: sticky;
  top: 0;
  z-index: 50;
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.logo { display: flex; align-items: center; gap: 9px; }
.logo:hover { text-decoration: none; }
.logo-mark {
  display: grid; place-items: center;
  width: 32px; height: 32px;
  border-radius: var(--pill);
  background: var(--white);
  color: var(--black);
}
.logo-text {
  font-size: 19px; font-weight: 700; letter-spacing: -.2px;
  color: var(--white);
}
.logo-text span { color: var(--blue); }

.nav-links {
  display: flex; align-items: center; gap: 4px;
  list-style: none; margin: 0; padding: 0;
}
.nav-links a {
  display: block;
  padding: 8px 14px;
  border-radius: var(--pill);
  color: var(--text-light);
  font-size: 14px; font-weight: 700;
}
.nav-links a:hover { background: var(--wash-light); text-decoration: none; }
.nav-links a.active { color: var(--blue); }

.nav-toggle {
  display: none;
  background: transparent; border: 0;
  padding: 8px; cursor: pointer;
}
.nav-toggle span {
  display: block; width: 22px; height: 2px;
  margin: 4px 0; border-radius: 2px;
  background: var(--text-light);
  transition: transform .2s ease, opacity .2s ease;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* =========================================================
   Hero / downloader
   ========================================================= */
.obsidian-bg { background: var(--black); }

.downloader { padding: 34px 0 30px; text-align: center; }

.downloader h1 {
  margin: 0 0 22px;
  font-size: 40px;
  font-weight: 700;
  line-height: 1.15;
  color: var(--text-light);
}
.h1-sub {
  display: block;
  margin-top: 8px;
  font-size: 17px;
  font-weight: 300;
  color: var(--muted);
}

.dl-form { max-width: 720px; margin-inline: auto; }

/* format switch */
.radio-switch {
  display: inline-flex;
  padding: 4px;
  margin-bottom: 15px;
  border-radius: var(--pill);
  background: var(--wash-light);
}
.radio-switch input { position: absolute; opacity: 0; pointer-events: none; }
.radio-switch .option {
  padding: 8px 20px;
  border-radius: var(--pill);
  color: var(--muted);
  font-size: 14px; font-weight: 700;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}
.radio-switch .option:hover { color: var(--text-light); }
.radio-switch input:checked + .option { background: var(--blue); color: var(--white); }
.radio-switch input:focus-visible + .option { outline: 2px solid var(--blue); outline-offset: 2px; }

/* input row */
.form-row { display: flex; gap: 15px; }

.form-input {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  height: 44px;
  padding: 0 6px 0 18px;
  border-radius: var(--pill);
  background: var(--wash-light);
  border: 1px solid var(--hairline-lt);
  transition: border-color .15s ease;
}
.form-input:focus-within { border-color: var(--blue); }

.form-input input {
  flex: 1;
  min-width: 0;
  height: 100%;
  background: transparent;
  border: 0;
  outline: none;
  color: var(--text-light);
  font-family: var(--font);
  font-size: 15px;
}
.form-input input::placeholder { color: var(--muted); }

.clipboard {
  flex: none;
  display: grid; place-items: center;
  width: 32px; height: 32px;
  border: 0; border-radius: 100px;
  background: var(--light-gray);
  color: var(--blue);
  cursor: pointer;
  transition: background-color .15s ease;
}
.clipboard:hover { background: var(--white); }
.clipboard svg { display: none; }
.clipboard svg.show { display: block; }

.form-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.chrome-only { height: 36px; padding: 0 16px; font-size: 13px; }

/* status + error */
.dl-status,
.dl-error { margin-top: 20px; color: var(--text-light); }

.dl-status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}
.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--wash-light-2);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2s; } }

.dl-error p { margin: 0 0 12px; font-size: 14px; color: var(--warning); }

/* =========================================================
   Result panel
   ========================================================= */
.result { padding: 0 0 40px; }
.result-inner {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  padding-top: 4px;
  text-align: left;
}
.video {
  flex: none;
  width: 300px;
  max-width: 300px;
  overflow: hidden;
  border-radius: 16px;
  background: var(--surface-deep);
}
.video img { width: 100%; aspect-ratio: 1; object-fit: cover; }

.result-meta { flex: 1; min-width: 0; }
.result-author { margin: 0; color: var(--blue); font-size: 14px; font-weight: 700; }
.result-title {
  margin: 4px 0 20px;
  color: var(--text-light);
  font-size: 17px;
}
.chip-label {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.quality { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.quality button {
  border: 0;
  border-radius: 20px;
  padding: 8px 16px;
  background: var(--wash-light-2);
  color: var(--light-gray);
  font-family: var(--font);
  font-size: 13px; font-weight: 700;
  cursor: pointer;
  transition: background-color .15s ease;
}
.quality button:hover { background: rgba(255, 255, 255, .3); }
.quality button.selected { background: var(--blue); color: var(--light-gray); }

.result-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* =========================================================
   Content sections
   ========================================================= */
.article.box { padding: 40px 0; border-bottom: 1px solid var(--hairline); }

.article h2 {
  margin: 0 0 16px;
  font-size: 22px;
  font-weight: 300;
  line-height: 1.35;
  color: var(--black);
}
.article p { margin: 0 0 14px; max-width: 68ch; }
.article p:last-child { margin-bottom: 0; }

/* dark variant */
.article.dark {
  background: var(--black);
  border-bottom-color: transparent;
  color: var(--text-light);
  padding: 40px 0;
}
.article.dark h2 { color: var(--light-gray); }
.article.dark h3 { color: var(--white); }
.article.dark p { color: var(--muted); }

/* intro pills */
.pill-list {
  display: flex; flex-wrap: wrap; gap: 8px;
  list-style: none; margin: 20px 0 0; padding: 0;
}
.pill-list li {
  padding: 10px 15px;
  border-radius: var(--card-radius);
  background: var(--wash-dark);
  font-size: 13px; font-weight: 700;
}

/* features */
.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  list-style: none;
  margin: 24px 0 0;
  padding: 0;
}
.feature-card {
  padding: 22px;
  border-radius: var(--card-radius);
  background: var(--wash-dark);
}
.feature-num {
  display: grid; place-items: center;
  width: 30px; height: 30px;
  margin-bottom: 12px;
  border-radius: var(--pill);
  background: var(--blue);
  color: var(--white);
  font-size: 14px; font-weight: 700;
}
.feature-card h3 { margin: 0 0 8px; font-size: 16px; font-weight: 700; }
.feature-card p { margin: 0; font-size: 14px; color: #536471; }

/* steps (dark) */
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  list-style: none;
  margin: 24px 0 0;
  padding: 0;
  counter-reset: step;
}
.steps li {
  padding: 22px;
  border-radius: var(--card-radius);
  background: var(--wash-light);
}
.step-num {
  display: grid; place-items: center;
  width: 30px; height: 30px;
  margin-bottom: 12px;
  border-radius: var(--pill);
  background: var(--wash-light-2);
  color: var(--white);
  font-size: 14px; font-weight: 700;
}
.steps h3 { margin: 0 0 8px; font-size: 16px; font-weight: 700; }
.steps p { margin: 0; font-size: 14px; }
.steps em { color: var(--text-light); font-style: normal; font-weight: 700; }

/* stats */
.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 24px;
}
.stat {
  padding: 18px;
  border-radius: var(--card-radius);
  background: var(--light-gray);
  text-align: center;
}
.stat strong { display: block; font-size: 20px; color: var(--blue); }
.stat span { font-size: 13px; color: #536471; }

/* FAQ */
.faq { margin-top: 20px; display: grid; gap: 10px; }
.faq details {
  border-radius: var(--card-radius);
  background: var(--wash-dark);
  padding: 4px 6px;
}
.faq summary {
  padding: 12px 44px 12px 16px;
  position: relative;
  list-style: none;
  cursor: pointer;
  font-size: 15px; font-weight: 700;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "";
  position: absolute;
  right: 18px; top: 50%;
  width: 8px; height: 8px;
  margin-top: -6px;
  border-right: 2px solid var(--blue);
  border-bottom: 2px solid var(--blue);
  transform: rotate(45deg);
  transition: transform .2s ease;
}
.faq details[open] summary::after { transform: rotate(-135deg); margin-top: -2px; }
.faq details p {
  margin: 0;
  padding: 0 16px 14px;
  font-size: 14px;
  color: #536471;
}

/* blog */
.blog-title { font-size: 24px !important; font-weight: 700 !important; }
.blog-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 22px;
}
.blog-card {
  border-radius: var(--card-radius);
  overflow: hidden;
  background: var(--wash-dark);
}
.blog-thumb {
  height: 130px;
  background: linear-gradient(135deg, var(--blue) 0%, var(--surface-dark) 100%);
}
.blog-card h3 {
  margin: 16px 16px 8px;
  font-size: 16px;
  font-weight: 700;
}
.blog-card h3 a { color: var(--blue); }
.blog-card p { margin: 0 16px 18px; font-size: 14px; color: #536471; }

/* =========================================================
   Footer
   ========================================================= */
.site-footer {
  background: var(--surface-dark);
  color: var(--muted);
  padding: 32px 0 20px;
  font-size: 14px;
}

.socials { display: flex; gap: 10px; margin-bottom: 28px; }
.btn-share {
  display: grid; place-items: center;
  width: 34px; height: 34px;
  border-radius: 100px;
  color: var(--white);
  transition: opacity .15s ease;
}
.btn-share:hover { opacity: .8; text-decoration: none; }
.btn-share.github      { background: #333333; }
.btn-share.youtube     { background: #FF0000; }
.btn-share.wordpress   { background: #21759B; }
.btn-share.trustpilot  { background: #00B67A; }
.btn-share.producthunt { background: #DA552F; }

.footer-cols {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 200px));
  gap: 24px;
  padding-bottom: 26px;
  border-bottom: 1px solid var(--hairline-lt);
}
.footer-cols h4 {
  margin: 0 0 10px;
  color: var(--white);
  font-size: 14px;
  font-weight: 700;
}
.footer-cols ul { list-style: none; margin: 0; padding: 0; }
.footer-cols li { margin-bottom: 6px; }
.footer-cols a { color: var(--muted); }
.footer-cols a:hover { color: var(--blue); }

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 18px;
  font-size: 13px;
}
.footer-bottom p { margin: 0; }
.langs { display: flex; gap: 14px; flex-wrap: wrap; }
.langs a { color: var(--muted); }
.langs a:hover { color: var(--blue); }

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 860px) {
  .features,
  .steps,
  .stat-row,
  .blog-grid { grid-template-columns: 1fr 1fr; }
  .result-inner { flex-direction: column; align-items: stretch; }
  .video { width: 100%; max-width: 100%; }
  .video img { aspect-ratio: 16 / 9; }
}

@media (max-width: 720px) {
  .nav-toggle { display: block; }
  .nav { flex-wrap: wrap; }
  .nav-links {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding-bottom: 12px;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 12px 14px; border-radius: 10px; }

  .downloader h1 { font-size: 28px; }
  .h1-sub { font-size: 15px; }

  .radio-switch { width: 100%; justify-content: space-between; overflow-x: auto; }
  .radio-switch .option { padding: 8px 14px; font-size: 13px; }

  /* stacked: flex:1 would resolve against the block axis and squash the pill */
  .form-row { flex-direction: column; }
  .form-input { flex: none; width: 100%; }
  .btn-primary { width: 100%; }

  .features,
  .steps,
  .stat-row,
  .blog-grid { grid-template-columns: 1fr; }

  .footer-cols { grid-template-columns: 1fr 1fr; }
  .footer-bottom { flex-direction: column; align-items: flex-start; }
}
