/* Shared styles for every page that has the download box (homepage and platform pages). */
:root {
  --bg: #f7f9fb;
  --surface: #ffffff;
  --border: #e3e8ef;
  --ink: #0f172a;
  --ink-muted: #5b6b7f;
  --brand: #0e7490;
  --brand-dk: #0b5566;
  --navy: #102a43;
  --success: #15803d;
  --warn: #b45309;
  --focus: #2563eb;
  --sans: 'Inter', -apple-system, 'Segoe UI', system-ui, sans-serif;
  --serif: 'Source Serif 4', Georgia, serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  min-height: 100vh;
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 20px;
  -webkit-font-smoothing: antialiased;
}

main {
  width: 100%;
  max-width: 760px;
  display: flex;
  flex-direction: column;
  padding: 56px 0 60px;
}

a { color: var(--brand); }

/* Header used on platform pages */
.site-header {
  width: 100%;
  max-width: 760px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 18px 0 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 15px;
  color: var(--navy);
  text-decoration: none;
}

.brand-mark {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--brand);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.site-header nav { display: flex; gap: 16px; font-size: 14px; }
.site-header nav a { text-decoration: none; font-weight: 500; }

.tool-page main { padding-top: 24px; }

.crumbs {
  font-size: 13px;
  color: var(--ink-muted);
  margin: 0 0 14px;
}

.crumbs a { text-decoration: underline; text-underline-offset: 2px; }

.page-title {
  font-family: var(--serif);
  font-weight: 700;
  color: var(--navy);
  font-size: clamp(2rem, 6vw, 3rem);
  line-height: 1.08;
  letter-spacing: -0.015em;
  margin: 0 0 12px;
}

.page-sub {
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink-muted);
  margin: 0 0 24px;
  max-width: 62ch;
}

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

/* Download box */
form.tool { position: relative; }

.field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
  margin: 0 0 8px;
}

.field-row {
  display: flex;
  gap: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 10px;
  padding: 6px 6px 6px 18px;
  align-items: center;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.field-row:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(14, 116, 144, 0.14);
}

.field-row.error {
  border-color: var(--warn);
  box-shadow: 0 0 0 3px rgba(180, 83, 9, 0.12);
}

#url-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  padding: 15px 0;
  min-width: 0;
}

#url-input::placeholder { color: #94a3b8; }

button#submit-btn {
  background: var(--brand);
  color: #ffffff;
  border: none;
  border-radius: 7px;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.01em;
  padding: 15px 26px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  transition: background 0.2s, transform 0.1s;
}

button#submit-btn:hover:not(:disabled) { background: var(--brand-dk); }
button#submit-btn:active:not(:disabled) { transform: scale(0.98); }

button#submit-btn:disabled {
  background: #cbd5e1;
  color: #ffffff;
  cursor: not-allowed;
}

.arrow { transition: transform 0.2s; }
button#submit-btn:hover:not(:disabled) .arrow { transform: translateX(3px); }

.status-line {
  margin-top: 16px;
  font-size: 12.5px;
  min-height: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-line.idle { color: var(--ink-muted); }
.status-line.detect { color: var(--brand); }
.status-line.err { color: var(--warn); }
.status-line.busy { color: var(--brand); }

.spinner {
  width: 12px;
  height: 12px;
  border: 2px solid rgba(14, 116, 144, 0.25);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 1.4s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

.result-row[hidden] { display: none; }

.result-row {
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--success);
  background: var(--surface);
  border-radius: 10px;
  padding: 12px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
  animation: resultIn 0.3s ease;
}

@keyframes resultIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.result-thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 6px;
  background: #eef2f6;
  flex-shrink: 0;
}

.result-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.result-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-ready {
  font-size: 12px;
  font-weight: 500;
  color: var(--success);
}

/* Secondary to the main Download button: it saves the file once the video is ready. */
button.result-download {
  background: var(--success);
  color: #ffffff;
  border: none;
  border-radius: 7px;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.01em;
  padding: 13px 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.1s;
}

button.result-download:hover { background: #116632; }
button.result-download:active { transform: scale(0.98); }

.next-tools {
  margin: 12px 0 0;
  font-size: 13.5px;
  color: var(--ink-muted);
}

/* Content sections below the tool */
.content { margin-top: 16px; }

.content section {
  border-top: 1px solid var(--border);
  padding-top: 8px;
  margin-top: 32px;
}

.content h2 {
  font-family: var(--serif);
  font-size: 22px;
  color: var(--navy);
  margin: 24px 0 12px;
}

.content p, .content li {
  font-size: 15px;
  line-height: 1.7;
  color: var(--ink-muted);
}

.content p { margin: 0 0 14px; }
.content ul, .content ol { padding-left: 22px; margin: 0 0 14px; }
.content li { margin-bottom: 8px; }
.content strong { color: var(--ink); }

.content code {
  font-size: 13.5px;
  background: #eef2f6;
  color: var(--navy);
  border-radius: 4px;
  padding: 1px 6px;
}

.content details {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 10px;
}

.content summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--navy);
  font-size: 15px;
}

.content details p { margin: 10px 0 0; }

.link-grid {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
}

.content .link-grid li { margin: 0; }

.link-grid a {
  display: block;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 10px;
  padding: 12px 14px;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
}

.link-grid a:hover { border-color: var(--brand); }

footer {
  width: 100%;
  max-width: 760px;
  padding: 24px 0 32px;
  font-size: 13px;
  color: var(--ink-muted);
  border-top: 1px solid var(--border);
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

footer a { color: var(--brand); }

@media (max-width: 640px) {
  main { padding-top: 40px; }
  .tool-page main { padding-top: 16px; }
  .field-row { flex-direction: column; align-items: stretch; padding: 16px; }
  #url-input { padding: 8px 0; }
  button#submit-btn { justify-content: center; padding: 14px; }
  .result-row { flex-wrap: wrap; }
  button.result-download { width: 100%; justify-content: center; }
}

/* Ad slots: always well below the download box and its result card, never next to a button.
   A slot only shows once its AdSense ad unit ID is filled in (data-ad-slot), and it reserves the
   unit's full 300x250 size from the first paint so the ad causes no layout shift. */
.ad-slot {
  margin: 32px auto 0;
  width: 100%;
  max-width: 336px;
  min-height: 274px; /* label + 250px unit */
  text-align: center;
}

.ad-slot[data-ad-slot=""] { display: none; }

.ad-label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 0 0 6px;
}

.ad-slot ins.adsbygoogle {
  display: inline-block;
  width: 300px;
  height: 250px;
}
