/* SyncMySubs — shared styles. Kept small and inlinable-friendly for fast first
   paint. No web fonts (system stack), no layout shift, reserved ad space. */

:root {
  --bg: #0f1420;
  --surface: #171e2e;
  --surface-2: #1e2740;
  --border: #2a3552;
  --text: #e8ecf5;
  --muted: #9aa7c2;
  --accent: #4f9cff;
  --accent-hover: #6cb0ff;
  --accent-ink: #05101f;
  --danger: #ff6b6b;
  --ok: #4fd18b;
  --radius: 10px;
  --maxw: 860px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-2: #eef2f9;
    --border: #d7deec;
    --text: #16203a;
    --muted: #566388;
    --accent: #1a6dff;
    --accent-hover: #0a58e0;
    --accent-ink: #ffffff;
  }
}

* { box-sizing: border-box; }

/* The [hidden] attribute must win even when an element sets its own display. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 17px;
}

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

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

/* ---- header / nav ---- */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 10;
}
.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  padding-top: 12px;
  padding-bottom: 12px;
}
.brand {
  font-weight: 700;
  font-size: 20px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand .logo { color: var(--accent); }
.site-nav {
  display: flex;
  gap: 4px 6px;
  flex-wrap: wrap;
  margin-left: auto;
}
.site-nav a {
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
}
.site-nav a:hover { background: var(--surface-2); text-decoration: none; }
.site-nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); }

/* ---- hero / headings ---- */
main { padding: 26px 0 56px; }
h1 { font-size: 30px; line-height: 1.25; margin: 0 0 10px; }
h2 { font-size: 22px; margin: 34px 0 12px; }
.lead { font-size: 18px; color: var(--muted); margin: 0 0 6px; max-width: 62ch; }
.explainer { color: var(--muted); max-width: 66ch; }
.explainer p { margin: 0 0 12px; }

/* ---- tool card ---- */
.tool {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin: 24px 0;
}

/* ---- drop zone ---- */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 30px 20px;
  text-align: center;
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone:focus-visible { border-color: var(--accent); outline: none; }
.dropzone.dragover { border-color: var(--accent); background: rgba(79,156,255,.08); }
.dropzone strong { color: var(--text); }
.dropzone .hint { color: var(--muted); font-size: 15px; margin-top: 6px; }
.dropzone input[type="file"] { display: none; }

.paste-area {
  width: 100%;
  min-height: 90px;
  margin-top: 14px;
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  resize: vertical;
}
.paste-area:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---- controls ---- */
.controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin: 18px 0; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 14px; color: var(--muted); font-weight: 600; }
.field input, .field select {
  padding: 9px 11px;
  font-size: 16px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-width: 140px;
}
.field input:focus-visible, .field select:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}

button {
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  padding: 9px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
button:hover { border-color: var(--accent); }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button:disabled { opacity: .5; cursor: not-allowed; }
.nudge-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.nudge-row button { min-width: 62px; }

/* ---- preview ---- */
.preview { margin-top: 18px; }
.preview h3 { font-size: 15px; color: var(--muted); margin: 0 0 8px; text-transform: uppercase; letter-spacing: .04em; }
.cue-list { display: flex; flex-direction: column; gap: 8px; }
.cue {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  padding: 8px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
}
.cue .n { color: var(--muted); font-variant-numeric: tabular-nums; }
.cue .time { font-family: var(--mono); font-size: 12px; color: var(--accent); }
.cue .body { white-space: pre-wrap; word-break: break-word; }

.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; align-items: center; }
.status { color: var(--muted); font-size: 14px; min-height: 1.2em; }
.status.error { color: var(--danger); }
.status.ok { color: var(--ok); }

.empty { color: var(--muted); font-style: italic; }

/* ---- unified homepage tool ---- */
.callout {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 14px;
  margin: 0 0 16px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: rgba(79, 156, 255, .10);
  color: var(--text);
  font-weight: 500;
}
.callout span { flex: 1 1 220px; }
.op-picker { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 6px; }
.op-controls { margin: 6px 0 0; }
.op-note { color: var(--muted); font-size: 14px; margin: 8px 0 0; max-width: 66ch; }
.field-label { font-size: 14px; color: var(--muted); font-weight: 600; }

/* ---- cards grid (home) ---- */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
  margin: 16px 0 22px;
}
.tool-card {
  display: block;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.tool-card:hover,
.tool-card:focus-visible {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, .22);
  text-decoration: none;
  outline: none;
}
@media (prefers-reduced-motion: reduce) {
  .tool-card { transition: border-color .15s ease; }
  .tool-card:hover, .tool-card:focus-visible { transform: none; }
}
.tool-card h3 { margin: 0 0 6px; font-size: 17px; }
.tool-card p { margin: 0; color: var(--muted); font-size: 14px; }

/* ---- FAQ ---- */
.faq { margin-top: 30px; }
.faq details {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 14px;
  margin-bottom: 10px;
  background: var(--surface);
}
.faq summary { cursor: pointer; font-weight: 600; padding: 10px 0; }
.faq details p { color: var(--muted); margin: 0 0 12px; }

/* ---- ad slot: reserved to avoid CLS ---- */
.ad-slot {
  margin: 34px 0 10px;
  min-height: 110px;         /* reserved so lazy-loaded ad shifts nothing */
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  overflow: hidden;
}
.ad-slot[data-loaded="true"] { color: transparent; }

/* Homepage: ad sits between the tool and the explanatory copy, so it needs
   generous, symmetric spacing to read as a calm divider rather than a banner. */
.ad-slot--divider { margin: 40px 0; }

/* ---- footer ---- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 26px 0;
  color: var(--muted);
  font-size: 14px;
}
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center; justify-content: space-between; }
.site-footer nav { display: flex; gap: 14px; flex-wrap: wrap; }
.site-footer a { color: var(--muted); }
.kofi { font-weight: 600; color: var(--text); }

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

@media (max-width: 560px) {
  body { font-size: 16px; }
  h1 { font-size: 25px; }
  .site-header .wrap { padding-top: 10px; padding-bottom: 10px; }
  .brand { font-size: 18px; }
}
