/* ==========================================================================
   download-videos.online

   One stylesheet for the whole site. It used to live in a <style> block in
   includes/header.php, which forced the Content-Security-Policy to allow
   'unsafe-inline' for styles; keeping it here lets that be 'self'.

   Colours are tokens so the dark theme is a token swap rather than a second
   set of rules. The theme follows the operating system unless the visitor
   picks one, which assets/js/theme.js records on <html data-theme>.
   ========================================================================== */

/* --- Tokens --------------------------------------------------------------- */

:root {
    color-scheme: light;

    --bg: #f5f6fc;
    --bg-glow-1: rgba(99, 102, 241, 0.16);
    --bg-glow-2: rgba(168, 85, 247, 0.14);

    --surface: #ffffff;
    --surface-2: #f4f5fa;
    --surface-3: #eceef7;
    --border: #e3e5f0;
    --border-strong: #d2d5e6;

    --text: #171a2c;
    --text-muted: #5f6480;
    --text-faint: #878ca6;

    --brand: #5b5ff0;
    --brand-strong: #4a4ade;
    --brand-contrast: #ffffff;
    --brand-soft: rgba(91, 95, 240, 0.10);
    --brand-ring: rgba(91, 95, 240, 0.35);

    --accent: #9333ea;
    --success: #12874a;
    --success-soft: rgba(18, 135, 74, 0.10);
    --danger: #cf2b3f;
    --danger-soft: rgba(207, 43, 63, 0.09);
    --warn: #b4690e;
    --warn-soft: rgba(180, 105, 14, 0.11);
    --info: #1d6fd0;
    --info-soft: rgba(29, 111, 208, 0.10);

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 18px;
    --radius-pill: 999px;

    --shadow-sm: 0 1px 2px rgba(18, 20, 40, 0.06);
    --shadow: 0 4px 16px rgba(18, 20, 40, 0.07), 0 1px 3px rgba(18, 20, 40, 0.05);
    --shadow-lg: 0 18px 44px rgba(18, 20, 40, 0.13);

    --step: 4px;
    --gutter: 20px;
    --measure: 860px;

    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
        Arial, "Noto Sans", sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

    --ease: cubic-bezier(0.2, 0, 0.1, 1);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;

        --bg: #0b0c15;
        --bg-glow-1: rgba(99, 102, 241, 0.20);
        --bg-glow-2: rgba(168, 85, 247, 0.16);

        --surface: #151827;
        --surface-2: #1b1f31;
        --surface-3: #232740;
        --border: #292d45;
        --border-strong: #363b57;

        --text: #e9eaf6;
        --text-muted: #a2a7c4;
        --text-faint: #7d83a3;

        --brand: #868bff;
        --brand-strong: #a0a4ff;
        --brand-contrast: #0b0c15;
        --brand-soft: rgba(134, 139, 255, 0.14);
        --brand-ring: rgba(134, 139, 255, 0.45);

        --accent: #c084fc;
        --success: #4ade80;
        --success-soft: rgba(74, 222, 128, 0.13);
        --danger: #ff8086;
        --danger-soft: rgba(255, 128, 134, 0.13);
        --warn: #fbbf24;
        --warn-soft: rgba(251, 191, 36, 0.13);
        --info: #7dd3fc;
        --info-soft: rgba(125, 211, 252, 0.13);

        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
        --shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
        --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.55);
    }
}

:root[data-theme="dark"] {
    color-scheme: dark;

    --bg: #0b0c15;
    --bg-glow-1: rgba(99, 102, 241, 0.20);
    --bg-glow-2: rgba(168, 85, 247, 0.16);

    --surface: #151827;
    --surface-2: #1b1f31;
    --surface-3: #232740;
    --border: #292d45;
    --border-strong: #363b57;

    --text: #e9eaf6;
    --text-muted: #a2a7c4;
    --text-faint: #7d83a3;

    --brand: #868bff;
    --brand-strong: #a0a4ff;
    --brand-contrast: #0b0c15;
    --brand-soft: rgba(134, 139, 255, 0.14);
    --brand-ring: rgba(134, 139, 255, 0.45);

    --accent: #c084fc;
    --success: #4ade80;
    --success-soft: rgba(74, 222, 128, 0.13);
    --danger: #ff8086;
    --danger-soft: rgba(255, 128, 134, 0.13);
    --warn: #fbbf24;
    --warn-soft: rgba(251, 191, 36, 0.13);
    --info: #7dd3fc;
    --info-soft: rgba(125, 211, 252, 0.13);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.55);
}

/* --- Base ----------------------------------------------------------------- */

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

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text);
    background-color: var(--bg);
    /* Two soft pools of colour instead of the old full-bleed gradient, so
       long pages do not sit on a saturated field. */
    background-image:
        radial-gradient(60rem 30rem at 12% -8%, var(--bg-glow-1), transparent 60%),
        radial-gradient(48rem 26rem at 92% 4%, var(--bg-glow-2), transparent 62%);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
    margin: 0;
    line-height: 1.25;
    letter-spacing: -0.015em;
    font-weight: 650;
}

p {
    margin: 0;
}

a {
    color: var(--brand);
    text-decoration: none;
}

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

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

:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

:focus:not(:focus-visible) {
    outline: none;
}

main {
    padding: calc(var(--step) * 12) var(--gutter) calc(var(--step) * 16);
    min-height: calc(100vh - 220px);
}

/* --- Navigation ----------------------------------------------------------- */

.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: color-mix(in srgb, var(--surface) 82%, transparent);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--border);
}

.nav-container {
    max-width: 1140px;
    margin: 0 auto;
    padding: calc(var(--step) * 3) var(--gutter);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: calc(var(--step) * 3);
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: calc(var(--step) * 2);
    font-size: 17px;
    font-weight: 650;
    letter-spacing: -0.01em;
    color: var(--text);
}

.logo:hover {
    color: var(--text);
}

.logo-mark {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    font-size: 15px;
    background: linear-gradient(135deg, var(--brand), var(--accent));
    box-shadow: var(--shadow-sm);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: calc(var(--step) * 2);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: calc(var(--step));
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-links a {
    display: block;
    padding: calc(var(--step) * 2) calc(var(--step) * 3);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 550;
    color: var(--text-muted);
    transition: background-color 0.18s var(--ease), color 0.18s var(--ease);
}

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

.nav-links a.active {
    background: var(--brand-soft);
    color: var(--brand);
}

.icon-btn {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    padding: 0;
    font-size: 15px;
    line-height: 1;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background-color 0.18s var(--ease), color 0.18s var(--ease),
        border-color 0.18s var(--ease);
}

.icon-btn:hover {
    background: var(--surface-2);
    color: var(--text);
    border-color: var(--border-strong);
}

.menu-toggle {
    display: none;
}

/* --- Cards and shells ----------------------------------------------------- */

.container {
    max-width: var(--measure);
    margin: 0 auto;
    padding: calc(var(--step) * 8);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.container > h1 {
    font-size: clamp(24px, 3.4vw, 30px);
}

.subtitle {
    margin-top: calc(var(--step) * 2);
    color: var(--text-muted);
    font-size: 15px;
}

/* --- Home page ------------------------------------------------------------ */

.hero {
    max-width: 680px;
    margin: 0 auto calc(var(--step) * 14);
    text-align: center;
}

.hero h1 {
    font-size: clamp(32px, 6vw, 52px);
    letter-spacing: -0.03em;
    background: linear-gradient(120deg, var(--text) 30%, var(--brand) 75%, var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hero p {
    margin-top: calc(var(--step) * 4);
    font-size: clamp(16px, 2vw, 19px);
    color: var(--text-muted);
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
    gap: calc(var(--step) * 5);
    max-width: 1000px;
    margin: 0 auto;
}

.tool-card {
    --card-accent: var(--brand);

    position: relative;
    display: flex;
    flex-direction: column;
    gap: calc(var(--step) * 2);
    padding: calc(var(--step) * 7);
    overflow: hidden;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: transform 0.22s var(--ease), box-shadow 0.22s var(--ease),
        border-color 0.22s var(--ease);
}

/* A hairline of the platform's own colour along the top edge. */
.tool-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 3px;
    background: var(--card-accent);
    opacity: 0.85;
}

.tool-card:hover {
    transform: translateY(-3px);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-lg);
    color: var(--text);
}

.tool-card--youtube  { --card-accent: #ef3d3d; }
.tool-card--instagram { --card-accent: #d6318f; }
.tool-card--tiktok   { --card-accent: #14b8c4; }

.tool-icon {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    margin-bottom: calc(var(--step));
    font-size: 24px;
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--card-accent) 14%, transparent);
}

.tool-card h2 {
    font-size: 19px;
}

.tool-card p {
    color: var(--text-muted);
    font-size: 14.5px;
}

.tool-badge {
    align-self: flex-start;
    margin-top: auto;
    padding: calc(var(--step)) calc(var(--step) * 3);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--success);
    background: var(--success-soft);
    border-radius: var(--radius-pill);
}

.tool-badge.coming-soon {
    color: var(--warn);
    background: var(--warn-soft);
}

.features {
    max-width: 1000px;
    margin: calc(var(--step) * 14) auto 0;
    padding: calc(var(--step) * 8);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.features h2 {
    margin-bottom: calc(var(--step) * 6);
    font-size: 20px;
    text-align: center;
}

.features-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: calc(var(--step) * 6);
}

.feature-item {
    text-align: center;
}

.feature-icon {
    font-size: 26px;
    margin-bottom: calc(var(--step) * 2);
}

.feature-item h3 {
    font-size: 15px;
    margin-bottom: calc(var(--step));
}

.feature-item p {
    font-size: 13.5px;
    color: var(--text-muted);
}

/* --- Form ----------------------------------------------------------------- */

.input-group {
    display: flex;
    gap: calc(var(--step) * 2);
    margin-top: calc(var(--step) * 7);
}

input[type="text"] {
    flex: 1;
    min-width: 0;
    padding: calc(var(--step) * 3) calc(var(--step) * 4);
    font: inherit;
    font-size: 15px;
    color: var(--text);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease),
        background-color 0.18s var(--ease);
}

input[type="text"]::placeholder {
    color: var(--text-faint);
}

input[type="text"]:focus {
    outline: none;
    background: var(--surface);
    border-color: var(--brand);
    box-shadow: 0 0 0 4px var(--brand-ring);
}

.btn-primary {
    flex-shrink: 0;
    padding: calc(var(--step) * 3) calc(var(--step) * 6);
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    color: var(--brand-contrast);
    background: var(--brand);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background-color 0.18s var(--ease), transform 0.18s var(--ease);
}

.btn-primary:hover:not(:disabled) {
    background: var(--brand-strong);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(1px);
}

.btn-primary:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* --- Feedback ------------------------------------------------------------- */

.loading {
    display: none;
    padding: calc(var(--step) * 8) 0 calc(var(--step) * 4);
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

.spinner {
    width: 30px;
    height: 30px;
    margin: 0 auto calc(var(--step) * 3);
    border: 3px solid var(--surface-3);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

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

.error {
    display: none;
    margin-top: calc(var(--step) * 5);
    padding: calc(var(--step) * 4);
    font-size: 14.5px;
    color: var(--danger);
    background: var(--danger-soft);
    border: 1px solid color-mix(in srgb, var(--danger) 26%, transparent);
    border-radius: var(--radius);
}

.error-hint {
    display: block;
    margin-top: calc(var(--step) * 2);
    color: var(--text-muted);
    font-size: 13px;
}

.download-notice {
    display: none;
    margin-top: calc(var(--step) * 5);
    padding: calc(var(--step) * 3) calc(var(--step) * 4);
    font-size: 13.5px;
    color: var(--text-muted);
    background: var(--info-soft);
    border-left: 3px solid var(--info);
    border-radius: var(--radius-sm);
}

.tip {
    margin-top: calc(var(--step) * 5);
    padding: calc(var(--step) * 3) calc(var(--step) * 4);
    font-size: 13.5px;
    line-height: 1.65;
    color: var(--text-muted);
    background: var(--info-soft);
    border-left: 3px solid var(--info);
    border-radius: var(--radius-sm);
}

.tip--warn {
    background: var(--warn-soft);
    border-left-color: var(--warn);
}

.tip strong {
    color: var(--text);
}

.tip ul {
    margin: calc(var(--step) * 2) 0 0;
    padding-left: calc(var(--step) * 5);
}

.tip code,
.tip .url {
    font-family: var(--font-mono);
    font-size: 12.5px;
    word-break: break-all;
}

/* --- Results -------------------------------------------------------------- */

.video-info {
    display: none;
    margin-top: calc(var(--step) * 8);
    padding-top: calc(var(--step) * 8);
    border-top: 1px solid var(--border);
}

.thumbnail {
    width: 100%;
    margin-bottom: calc(var(--step) * 5);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.video-title {
    font-size: 18px;
    font-weight: 620;
    line-height: 1.35;
    letter-spacing: -0.01em;
}

.video-meta {
    margin-top: calc(var(--step) * 2);
    font-size: 13.5px;
    color: var(--text-muted);
}

.formats-title {
    margin: calc(var(--step) * 7) 0 calc(var(--step) * 3);
    font-size: 12px;
    font-weight: 650;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-faint);
}

.format-list {
    display: flex;
    flex-direction: column;
    gap: calc(var(--step) * 2);
}

.format-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: calc(var(--step) * 4);
    padding: calc(var(--step) * 3) calc(var(--step) * 4);
    background: var(--surface-2);
    border: 1px solid transparent;
    border-radius: var(--radius);
    transition: background-color 0.18s var(--ease), border-color 0.18s var(--ease);
}

.format-item:hover {
    background: var(--surface-3);
    border-color: var(--border);
}

.format-info {
    min-width: 0;
}

.format-quality {
    font-size: 15px;
    font-weight: 600;
}

.format-details {
    margin-top: 2px;
    font-size: 12.5px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.download-btn {
    flex-shrink: 0;
    padding: calc(var(--step) * 2) calc(var(--step) * 4);
    font-size: 13.5px;
    font-weight: 600;
    color: var(--brand);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background-color 0.18s var(--ease), color 0.18s var(--ease),
        border-color 0.18s var(--ease);
}

.download-btn:hover {
    color: var(--brand-contrast);
    background: var(--brand);
    border-color: var(--brand);
}

.download-btn.is-disabled {
    pointer-events: none;
    opacity: 0.45;
}

/* --- Progress ------------------------------------------------------------- */

.progress-panel {
    display: none;
    margin-top: calc(var(--step) * 6);
    padding: calc(var(--step) * 4) calc(var(--step) * 5);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.progress-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: calc(var(--step) * 3);
    font-size: 14px;
    font-weight: 550;
}

.progress-percent {
    font-weight: 650;
    color: var(--brand);
    font-variant-numeric: tabular-nums;
}

.progress-track {
    height: 8px;
    margin: calc(var(--step) * 3) 0 calc(var(--step) * 2);
    background: var(--surface-3);
    border-radius: var(--radius-pill);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 0;
    border-radius: var(--radius-pill);
    background: linear-gradient(90deg, var(--brand), var(--accent));
    transition: width 0.4s var(--ease), background 0.3s var(--ease);
}

.progress-bar.done {
    background: var(--success);
}

.progress-bar.failed {
    background: var(--danger);
}

.progress-foot {
    min-height: 17px;
    font-size: 12.5px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

/* --- Footer --------------------------------------------------------------- */

.site-footer {
    padding: calc(var(--step) * 10) var(--gutter) calc(var(--step) * 12);
    border-top: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface) 55%, transparent);
}

.footer-inner {
    max-width: 1140px;
    margin: 0 auto;
}

.legal {
    padding: calc(var(--step) * 5) calc(var(--step) * 6);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.legal h3 {
    margin-bottom: calc(var(--step) * 3);
    font-size: 15px;
    color: var(--warn);
}

.legal p {
    font-size: 13.5px;
    line-height: 1.65;
    color: var(--text-muted);
}

.legal p + p {
    margin-top: calc(var(--step) * 2);
}

.legal strong {
    color: var(--text);
}

.footer-meta {
    margin-top: calc(var(--step) * 6);
    text-align: center;
    font-size: 13px;
    color: var(--text-faint);
}

.footer-meta p + p {
    margin-top: calc(var(--step));
}

/* --- Responsive ----------------------------------------------------------- */

@media (max-width: 768px) {
    :root {
        --gutter: 16px;
    }

    .menu-toggle {
        display: grid;
    }

    .nav-links {
        position: absolute;
        top: calc(100% + 1px);
        left: 0;
        right: 0;
        display: none;
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
        padding: calc(var(--step) * 2) var(--gutter) calc(var(--step) * 4);
        background: var(--surface);
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow);
    }

    .nav-links.active {
        display: flex;
    }

    .container {
        padding: calc(var(--step) * 5);
    }

    .input-group {
        flex-direction: column;
    }

    .format-item {
        align-items: flex-start;
        flex-direction: column;
        gap: calc(var(--step) * 3);
    }

    .download-btn {
        width: 100%;
        text-align: center;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .tool-card:hover {
        transform: none;
    }
}
