/* =========================================================
   KeepSocial — Main Stylesheet
   Typography: Syne (display) + DM Mono (ui/code)
   Aesthetic: Dark-first, surgical minimalism with warm accents
   ========================================================= */

/* ── Variables ─────────────────────────────────────────── */
:root {
  --bg:          #0c0c0d;
  --bg2:         #111113;
  --bg3:         #18181b;
  --border:      rgba(255,255,255,0.08);
  --border-mid:  rgba(255,255,255,0.14);
  --text:        #f0ede8;
  --text-mid:    #8a8782;
  --text-dim:    #4a4845;
  --accent:      #e8c468;
  --accent-dim:  rgba(232,196,104,0.15);
  --accent-glow: rgba(232,196,104,0.35);
  --yt:          #ff3c3c;
  --ig:          #e1306c;
  --tw:          #1d9bf0;
  --fb:          #1877f2;
  --tt:          #010101;
  --pin:         #e60023;
  --radius:      14px;
  --radius-sm:   8px;
  --radius-pill: 100px;
  --font-display: 'Syne', sans-serif;
  --font-mono:    'DM Mono', monospace;
  --transition:   0.18s ease;
  --card-shadow:  0 0 0 1px var(--border), 0 24px 64px rgba(0,0,0,0.6);
}

[data-theme="light"] {
  --bg:          #f5f3ef;
  --bg2:         #eeece8;
  --bg3:         #e6e3de;
  --border:      rgba(0,0,0,0.09);
  --border-mid:  rgba(0,0,0,0.16);
  --text:        #1a1916;
  --text-mid:    #6b6660;
  --text-dim:    #a8a4a0;
  --accent:      #c49a20;
  --accent-dim:  rgba(196,154,32,0.12);
  --accent-glow: rgba(196,154,32,0.25);
  --card-shadow: 0 0 0 1px var(--border), 0 16px 48px rgba(0,0,0,0.1);
}

/* ── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-display);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  overflow-x: hidden;
}

/* ── Background grid ───────────────────────────────────── */
.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 0%, black 30%, transparent 100%);
}

/* ── Header ────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  max-width: 900px;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: transparent;
}

.logo {
  display: flex;
  align-items: center;
  gap: 2px;
  text-decoration: none;
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.logo-mark {
  width: 28px;
  height: 28px;
  background: var(--accent);
  color: var(--bg);
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 800;
  margin-right: 6px;
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  gap: 20px;
  margin-left: auto;
}

.nav-links a {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-mid);
  text-decoration: none;
  letter-spacing: 0.02em;
  transition: color var(--transition);
}

.nav-links a:hover { color: var(--text); }

.theme-toggle {
  background: none;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  padding: 6px;
  cursor: pointer;
  color: var(--text-mid);
  display: flex;
  align-items: center;
  transition: all var(--transition);
  flex-shrink: 0;
}

.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.theme-toggle svg { width: 15px; height: 15px; }

[data-theme="dark"] .icon-sun  { display: block; }
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="light"] .icon-sun  { display: none; }
[data-theme="light"] .icon-moon { display: block; }

/* ── Main layout ───────────────────────────────────────── */
.main-content {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 640px;
  padding: 0 20px 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 48px;
  flex: 1;
}

/* ── Hero ──────────────────────────────────────────────── */
.hero {
  text-align: center;
  padding-top: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  animation: fadeUp 0.5s ease both;
}

.hero-eyebrow {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.platform-pill {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid;
}

.platform-pill.yt  { color: var(--yt);  border-color: rgba(255,60,60,0.3);   background: rgba(255,60,60,0.07); }
.platform-pill.ig  { color: var(--ig);  border-color: rgba(225,48,108,0.3);  background: rgba(225,48,108,0.07); }
.platform-pill.tw  { color: var(--tw);  border-color: rgba(29,155,240,0.3);  background: rgba(29,155,240,0.07); }
.platform-pill.fb  { color: var(--fb);  border-color: rgba(24,119,242,0.3);  background: rgba(24,119,242,0.07); }
.platform-pill.tt  { color: #555;       border-color: rgba(0,0,0,0.2);       background: rgba(0,0,0,0.05); }
.platform-pill.pin { color: var(--pin); border-color: rgba(230,0,35,0.3);    background: rgba(230,0,35,0.07); }
[data-theme="dark"] .platform-pill.tt { color: #ccc; border-color: rgba(255,255,255,0.2); background: rgba(255,255,255,0.05); }

.hero-title {
  font-size: clamp(3rem, 10vw, 5.5rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 0.95;
  color: var(--text);
}

.hero-title em {
  font-style: normal;
  color: var(--accent);
  position: relative;
}

.hero-sub {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-mid);
  letter-spacing: 0.03em;
}

/* ── Download card ─────────────────────────────────────── */
.card-wrap {
  width: 100%;
  animation: fadeUp 0.55s 0.1s ease both;
}

.download-card {
  background: var(--bg2);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: border-color var(--transition);
}

.download-card:focus-within {
  border-color: var(--accent);
  box-shadow: var(--card-shadow), 0 0 0 3px var(--accent-dim);
}

/* ── URL input row ─────────────────────────────────────── */
.input-row {
  display: flex;
  gap: 10px;
}

.url-field-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  gap: 10px;
  transition: border-color var(--transition);
}

.url-field-wrap:focus-within { border-color: var(--border-mid); }

.url-icon {
  flex-shrink: 0;
  color: var(--text-dim);
  display: flex;
}

.url-icon svg { width: 16px; height: 16px; }

.url-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-family: var(--font-mono);
  font-size: 0.84rem;
  color: var(--text);
  padding: 13px 0;
  min-width: 0;
  caret-color: var(--accent);
}

.url-input::placeholder { color: var(--text-dim); }

.clear-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-dim);
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  transition: color var(--transition);
  flex-shrink: 0;
}

.clear-btn:hover { color: var(--text); }
.clear-btn svg { width: 14px; height: 14px; }

.fetch-btn {
  padding: 0 20px;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
  min-height: 46px;
}

.fetch-btn:hover { background: #f0ce78; transform: translateY(-1px); }
.fetch-btn:active { transform: translateY(0); }
.fetch-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ── Error banner ──────────────────────────────────────── */
.error-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,60,60,0.1);
  border: 1px solid rgba(255,60,60,0.25);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: #ff7070;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  animation: slideDown 0.2s ease;
}

.error-banner svg { width: 15px; height: 15px; flex-shrink: 0; }

/* ── Media preview ─────────────────────────────────────── */
.media-preview {
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: slideDown 0.25s ease;
}

.preview-inner {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.preview-thumb-wrap {
  position: relative;
  flex-shrink: 0;
  width: 100px;
  height: 64px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg3);
}

.preview-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-duration {
  position: absolute;
  bottom: 4px;
  right: 5px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 500;
  background: rgba(0,0,0,0.75);
  color: #fff;
  padding: 1px 5px;
  border-radius: 3px;
}

.platform-badge {
  position: absolute;
  top: 4px;
  left: 5px;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.platform-badge.yt  { background: var(--yt);  color: #fff; }
.platform-badge.ig  { background: var(--ig);  color: #fff; }
.platform-badge.tw  { background: var(--tw);  color: #fff; }
.platform-badge.facebook  { background: var(--fb);  color: #fff; }
.platform-badge.tiktok    { background: #010101;    color: #fff; }
.platform-badge.pinterest { background: var(--pin); color: #fff; }

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

.preview-title {
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.preview-channel {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-mid);
}

/* ── Options row ───────────────────────────────────────── */
.options-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.option-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 120px;
}

.option-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--text-mid);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.toggle-group {
  display: flex;
  gap: 4px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
}

.toggle-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 7px 10px;
  border: none;
  border-radius: 5px;
  background: none;
  color: var(--text-mid);
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.toggle-btn svg { width: 13px; height: 13px; }
.toggle-btn:hover { color: var(--text); }

.toggle-btn.active {
  background: var(--accent);
  color: var(--bg);
}

.select-wrap {
  position: relative;
}

.custom-select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 8px 32px 8px 12px;
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition);
}

.custom-select:focus { border-color: var(--accent); }

.select-arrow {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 13px;
  height: 13px;
  color: var(--text-mid);
  pointer-events: none;
}

/* ── Download button ───────────────────────────────────── */
.download-btn {
  width: 100%;
  padding: 14px;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all var(--transition);
}

.download-btn svg { width: 17px; height: 17px; }
.download-btn:hover { background: #f0ce78; transform: translateY(-1px); box-shadow: 0 8px 24px var(--accent-glow); }
.download-btn:active { transform: translateY(0); box-shadow: none; }
.download-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

/* ── Status row ────────────────────────────────────────── */
.status-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.status-bar-wrap {
  height: 3px;
  background: var(--bg3);
  border-radius: 3px;
  overflow: hidden;
}

.status-bar {
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.5s ease;
}

.status-bar.indeterminate {
  width: 40%;
  animation: barSlide 1.2s ease-in-out infinite;
}

.status-text {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-mid);
  text-align: center;
}

/* ── Platforms section ─────────────────────────────────── */
.platforms-section {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  animation: fadeUp 0.6s 0.2s ease both;
}

.platforms-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.platform-chips {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.platform-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-mid);
  transition: all var(--transition);
}

.platform-chip:hover {
  border-color: var(--border-mid);
  color: var(--text);
}

.chip-icon { width: 16px; height: 16px; }
.yt-color  { color: var(--yt); }
.ig-color  { color: var(--ig); }
.tw-color  { color: var(--tw); }
.fb-color  { color: var(--fb); }
.tt-color  { color: #555; }
[data-theme="dark"] .tt-color { color: #ccc; }
.pin-color { color: var(--pin); }

/* ── Footer ────────────────────────────────────────────── */
.site-footer {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 900px;
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-dim);
  gap: 12px;
  flex-wrap: wrap;
}

.footer-links {
  display: flex;
  gap: 16px;
}

.footer-links a {
  color: var(--text-dim);
  text-decoration: none;
  transition: color var(--transition);
}

.footer-links a:hover { color: var(--text-mid); }

/* ── Spinner ───────────────────────────────────────────── */
.spin {
  width: 16px;
  height: 16px;
  animation: spin 0.8s linear infinite;
}

/* ── Animations ────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

@keyframes barSlide {
  0%   { margin-left: -40%; }
  100% { margin-left: 100%; }
}

/* ── Utility ───────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Mobile ────────────────────────────────────────────── */
@media (max-width: 560px) {
  .hero-title { font-size: 3.2rem; }
  .input-row { flex-direction: column; }
  .fetch-btn { width: 100%; justify-content: center; padding: 14px; }
  .options-row { flex-direction: column; }
  .option-group { min-width: auto; }
  .nav-links { display: none; }
  .site-footer { flex-direction: column; align-items: flex-start; gap: 8px; }
}

/* ── Cookie hint ────────────────────────────────────────── */
.cookie-hint {
  background: rgba(232,196,104,0.08);
  border: 1px solid rgba(232,196,104,0.3);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  animation: slideDown 0.25s ease;
}

.cookie-hint-header {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.cookie-hint-header svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.cookie-steps {
  list-style: decimal;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.cookie-steps li {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--text-mid);
  line-height: 1.5;
}

.cookie-steps em {
  color: var(--text);
  font-style: normal;
  font-weight: 500;
}

.cookie-steps code {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
  color: var(--accent);
  font-size: 0.72rem;
}
