/* ==========================================================================
   CapMyVideo - Design Tokens
   ========================================================================== */

:root {
    /* Colors - Primary */
    --color-primary: #2563EB;
    --color-primary-hover: #1D4ED8;
    --color-primary-active: #1E40AF;
    --color-primary-subtle: #EFF6FF;

    /* Colors - Surface */
    --color-surface: #FFFFFF;
    --color-surface-secondary: #F8FAFC;
    --color-surface-tertiary: #F1F5F9;

    /* Colors - Text */
    --color-text-primary: #0F172A;
    --color-text-secondary: #64748B;
    --color-text-tertiary: #94A3B8;

    /* Colors - Border */
    --color-border: #E2E8F0;
    --color-border-strong: #CBD5E1;

    /* Colors - Semantic */
    --color-success: #16A34A;
    --color-success-subtle: #F0FDF4;
    --color-warning: #D97706;
    --color-warning-subtle: #FFFBEB;
    --color-error: #DC2626;
    --color-error-subtle: #FEF2F2;
    --color-focus-ring: #2563EB;

    /* Typography */
    --font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-mono: "SF Mono", "Fira Code", "Consolas", monospace;

    /* Type Scale */
    --type-h1-size: 32px;
    --type-h1-weight: 600;
    --type-h1-line-height: 1.25;
    --type-h1-letter-spacing: -0.02em;

    --type-h2-size: 24px;
    --type-h2-weight: 600;
    --type-h2-line-height: 1.3;
    --type-h2-letter-spacing: -0.015em;

    --type-h3-size: 18px;
    --type-h3-weight: 600;
    --type-h3-line-height: 1.4;
    --type-h3-letter-spacing: -0.01em;

    --type-body-size: 16px;
    --type-body-weight: 400;
    --type-body-line-height: 1.6;

    --type-body-sm-size: 14px;
    --type-body-sm-weight: 400;
    --type-body-sm-line-height: 1.5;

    --type-caption-size: 13px;
    --type-caption-weight: 500;
    --type-caption-line-height: 1.4;

    --type-button-size: 15px;
    --type-button-weight: 500;
    --type-button-line-height: 1;
    --type-button-letter-spacing: 0.01em;

    /* Spacing */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;
    --space-20: 80px;

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;

    /* Elevation */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);

    /* Sizing */
    --input-height: 48px;
    --button-height: 44px;
    --button-height-sm: 36px;
    --touch-target-min: 44px;
    --max-page-width: 1200px;
    --max-tool-width: 680px;
    --max-transcript-width: 680px;
    --max-prose-width: 640px;
}

/* Mobile overrides */
@media (max-width: 767px) {
    :root {
        --type-h1-size: 26px;
        --type-h2-size: 20px;
    }
}

/* ==========================================================================
   Reset & Base
   ========================================================================== */

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

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

body {
    font-family: var(--font-family);
    font-size: var(--type-body-size);
    font-weight: var(--type-body-weight);
    line-height: var(--type-body-line-height);
    color: var(--color-text-primary);
    background-color: var(--color-surface);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   Typography
   ========================================================================== */

h1 {
    font-size: var(--type-h1-size);
    font-weight: var(--type-h1-weight);
    line-height: var(--type-h1-line-height);
    letter-spacing: var(--type-h1-letter-spacing);
    color: var(--color-text-primary);
}

h2 {
    font-size: var(--type-h2-size);
    font-weight: var(--type-h2-weight);
    line-height: var(--type-h2-line-height);
    letter-spacing: var(--type-h2-letter-spacing);
    color: var(--color-text-primary);
}

h3 {
    font-size: var(--type-h3-size);
    font-weight: var(--type-h3-weight);
    line-height: var(--type-h3-line-height);
    letter-spacing: var(--type-h3-letter-spacing);
    color: var(--color-text-primary);
}

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

a:hover {
    color: var(--color-primary-hover);
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

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

.hidden {
    display: none !important;
}

/* Focus styles */
:focus {
    outline: none;
}

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

button:focus-visible,
a:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--color-focus-ring);
    outline-offset: 2px;
}

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

/* ==========================================================================
   Header
   ========================================================================== */

.site-header {
    background-color: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    height: 60px;
}

.header-container {
    max-width: var(--max-page-width);
    margin: 0 auto;
    padding: 0 var(--space-6);
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Wordmark */
.site-logo {
    font-size: 22px;
    font-weight: 600;
    text-decoration: none;
    display: flex;
    align-items: center;
}

.site-logo .logo-cap {
    color: var(--color-text-primary);
}

.site-logo .logo-my {
    color: var(--color-primary);
}

.site-logo .logo-video {
    color: var(--color-text-primary);
}

/* Navigation */
.site-nav {
    display: flex;
    align-items: center;
    gap: var(--space-8);
}

.nav-links {
    display: flex;
    gap: var(--space-8);
    list-style: none;
}

.nav-link {
    font-size: var(--type-body-sm-size);
    font-weight: 500;
    color: var(--color-text-secondary);
    text-decoration: none;
    transition: color 0.15s ease;
}

.nav-link:hover {
    color: var(--color-text-primary);
}

/* Mobile hamburger */
.hamburger-btn {
    display: none;
    width: 44px;
    height: 44px;
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

.hamburger-icon {
    width: 24px;
    height: 2px;
    background-color: var(--color-text-secondary);
    position: relative;
    transition: background-color 0.2s ease;
}

.hamburger-icon::before,
.hamburger-icon::after {
    content: '';
    position: absolute;
    width: 24px;
    height: 2px;
    background-color: var(--color-text-secondary);
    left: 0;
    transition: transform 0.2s ease;
}

.hamburger-icon::before {
    top: -7px;
}

.hamburger-icon::after {
    top: 7px;
}

/* Mobile nav panel */
.mobile-nav-panel {
    display: none;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background-color: var(--color-surface);
    box-shadow: var(--shadow-md);
    z-index: 100;
}

.mobile-nav-panel.open {
    display: block;
}

.mobile-nav-links {
    list-style: none;
    padding: var(--space-2) 0;
}

.mobile-nav-links .nav-link {
    display: block;
    padding: var(--space-3) var(--space-6);
    min-height: 48px;
    display: flex;
    align-items: center;
}

@media (max-width: 767px) {
    .header-container {
        padding: 0 var(--space-4);
    }

    .nav-links {
        display: none;
    }

    .hamburger-btn {
        display: flex;
    }
}

/* ==========================================================================
   Main Content
   ========================================================================== */

.site-main {
    flex: 1;
}

/* ==========================================================================
   Hero Section
   ========================================================================== */

.hero-section {
    padding: var(--space-16) var(--space-6) var(--space-12);
    text-align: center;
}

.hero-content {
    max-width: 1040px;
    margin: 0 auto;
}

#transcript-form,
.loading-state,
.no-transcript-alert,
.error-alert,
.trust-badges {
    max-width: var(--max-tool-width);
    margin-left: auto;
    margin-right: auto;
}

/* Trust chip */
.trust-chip {
    display: inline-block;
    background-color: var(--color-primary-subtle);
    color: var(--color-primary);
    font-size: var(--type-caption-size);
    font-weight: var(--type-caption-weight);
    padding: 6px 14px;
    border-radius: var(--radius-full);
    margin-bottom: var(--space-5);
}

/* Hero heading */
.hero-heading {
    max-width: 560px;
    margin: 0 auto var(--space-3);
}

/* Hero description */
.hero-description {
    font-size: var(--type-body-size);
    color: var(--color-text-secondary);
    max-width: 480px;
    margin: 0 auto var(--space-8);
}

@media (max-width: 767px) {
    .hero-section {
        padding: var(--space-12) var(--space-4) var(--space-10);
        text-align: left;
    }

    .hero-heading,
    .hero-description {
        margin-left: 0;
        margin-right: 0;
    }

    .trust-chip {
        margin-bottom: var(--space-4);
    }
}

/* ==========================================================================
   URL Input
   ========================================================================== */

.url-input-wrapper {
    position: relative;
    margin-bottom: var(--space-2);
}

.url-input {
    width: 100%;
    height: 52px;
    padding: 0 var(--space-12) 0 44px;
    font-family: var(--font-family);
    font-size: var(--type-body-size);
    color: var(--color-text-primary);
    background-color: var(--color-surface);
    border: 1.5px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

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

.url-input:focus {
    border-color: var(--color-primary);
    border-width: 2px;
    padding-left: 43px;
    padding-right: calc(var(--space-12) - 1px);
    box-shadow: 0 0 0 3px var(--color-primary-subtle);
}

.url-input.error {
    border-color: var(--color-error);
    box-shadow: 0 0 0 3px var(--color-error-subtle);
}

.url-input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--color-text-tertiary);
    pointer-events: none;
}

.url-clear-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    color: var(--color-text-tertiary);
    transition: color 0.15s ease;
}

.url-clear-btn:hover {
    color: var(--color-text-secondary);
}

.url-clear-btn.visible {
    display: flex;
}

.url-clear-btn svg {
    width: 18px;
    height: 18px;
}

/* URL input hints and status */
.url-hint {
    font-size: var(--type-caption-size);
    color: var(--color-text-tertiary);
    margin-top: var(--space-2);
    text-align: center;
}

.url-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    margin-top: var(--space-2);
    font-size: var(--type-body-sm-size);
    color: var(--color-primary);
}

.url-status.error {
    color: var(--color-error);
}

.submit-btn-wrapper {
    margin-top: var(--space-4);
    display: block;
    text-align: center;
}

@media (max-width: 767px) {
    .url-input {
        height: 48px;
    }

    .url-hint {
        text-align: left;
    }
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    height: var(--button-height);
    padding: 0 var(--space-6);
    font-family: var(--font-family);
    font-size: var(--type-button-size);
    font-weight: var(--type-button-weight);
    letter-spacing: var(--type-button-letter-spacing);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
    text-decoration: none;
    white-space: nowrap;
}

.btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Primary button */
.btn-primary {
    background-color: var(--color-primary);
    color: white;
}

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

.btn-primary:active {
    background-color: var(--color-primary-active);
}

.btn-primary:disabled {
    background-color: var(--color-surface-tertiary);
    color: var(--color-text-tertiary);
    cursor: not-allowed;
}

.btn-primary.loading {
    pointer-events: none;
}

/* Secondary button */
.btn-secondary {
    background-color: var(--color-surface);
    color: var(--color-text-primary);
    border: 1.5px solid var(--color-border-strong);
}

.btn-secondary:hover {
    background-color: var(--color-surface-secondary);
}

.btn-secondary:active {
    background-color: var(--color-surface-tertiary);
}

/* Small button */
.btn-sm {
    height: var(--button-height-sm);
    padding: 0 var(--space-4);
    font-size: var(--type-body-sm-size);
}

/* ==========================================================================
   Trust Badges
   ========================================================================== */

.trust-badges {
    display: flex;
    justify-content: center;
    gap: var(--space-12);
    margin-top: var(--space-10);
}

.trust-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.trust-badge-icon {
    width: 20px;
    height: 20px;
    color: var(--color-text-secondary);
    margin-bottom: var(--space-2);
}

.trust-badge-label {
    font-size: var(--type-body-sm-size);
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 2px;
}

.trust-badge-description {
    font-size: var(--type-caption-size);
    color: var(--color-text-secondary);
}

@media (max-width: 767px) {
    .trust-badges {
        gap: var(--space-6);
    }
}

@media (max-width: 479px) {
    .trust-badges {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-4);
    }

    .trust-badge {
        flex-direction: row;
        gap: var(--space-3);
        text-align: left;
    }

    .trust-badge-icon {
        margin-bottom: 0;
    }

    .trust-badge-text {
        display: flex;
        flex-direction: column;
    }
}

/* ==========================================================================
   Loading State
   ========================================================================== */

.loading-state {
    padding: var(--space-10) 0;
    text-align: center;
    margin-top: var(--space-6);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--color-surface-tertiary);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto var(--space-4);
}

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

.loading-text {
    font-size: var(--type-h3-size);
    font-weight: var(--type-h3-weight);
    color: var(--color-text-primary);
    margin-bottom: var(--space-2);
}

.loading-subtext {
    font-size: var(--type-body-sm-size);
    color: var(--color-text-secondary);
}

/* Loading skeleton */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--color-surface-tertiary) 0%,
        var(--color-surface-secondary) 50%,
        var(--color-surface-tertiary) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.video-skeleton {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin-top: var(--space-6);
    justify-content: center;
}

.skeleton-thumbnail {
    width: 120px;
    height: 68px;
    border-radius: var(--radius-sm);
}

.skeleton-text {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.skeleton-line {
    height: 12px;
}

.skeleton-line-1 {
    width: 200px;
}

.skeleton-line-2 {
    width: 140px;
}

/* ==========================================================================
   Video Info Card
   ========================================================================== */

#result-section {
    margin-top: var(--space-6);
}

.result-layout {
    display: grid;
    grid-template-columns: minmax(0, var(--max-transcript-width)) 300px;
    align-items: start;
    justify-content: center;
    gap: var(--space-10);
}

.result-main {
    min-width: 0;
}

.video-info {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
    max-width: var(--max-transcript-width);
    margin-left: auto;
    margin-right: auto;
}

@media (max-width: 1099px) {
    .result-layout {
        grid-template-columns: minmax(0, var(--max-transcript-width));
    }
}

.video-thumbnail {
    width: 120px;
    height: 68px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background-color: var(--color-surface-tertiary);
    flex-shrink: 0;
}

.video-details {
    flex: 1;
    min-width: 0;
    text-align: left;
}

.video-title {
    font-size: var(--type-body-size);
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: var(--space-1);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.video-meta {
    font-size: var(--type-body-sm-size);
    color: var(--color-text-secondary);
}

@media (max-width: 767px) {
    .video-thumbnail {
        width: 96px;
        height: 54px;
    }
}

/* ==========================================================================
   Transcript Viewer
   ========================================================================== */

.transcript-section {
    max-width: var(--max-transcript-width);
    margin: 0 auto;
}

.transcript-container {
    background-color: var(--color-surface-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    text-align: left;
}

.transcript-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-4);
    padding-bottom: var(--space-4);
    margin-bottom: var(--space-4);
    border-bottom: 1px solid var(--color-border);
}

.transcript-title {
    font-size: var(--type-h3-size);
    font-weight: var(--type-h3-weight);
    color: var(--color-text-primary);
}

.transcript-meta {
    font-size: var(--type-caption-size);
    color: var(--color-text-secondary);
}

.transcript-body {
    padding: 0;
}

.transcript-text {
    font-size: var(--type-body-size);
    line-height: 1.65;
    color: var(--color-text-primary);
    text-align: left;
    white-space: pre-wrap;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.transcript-text p {
    margin-bottom: var(--space-4);
}

.transcript-text p:last-child {
    margin-bottom: 0;
}

/* Transcript actions */
.transcript-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    margin: 0 0 var(--space-5);
}

.transcript-actions:last-child {
    margin-bottom: 0;
    margin-top: var(--space-6);
    padding-top: var(--space-5);
    border-top: 1px solid var(--color-border);
}

/* Sticky action bar — visual duplicate of in-page actions */
.transcript-sticky-bar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 90;
    background-color: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
    padding: var(--space-2) var(--space-4);
    padding-top: max(var(--space-2), env(safe-area-inset-top));
}

.transcript-sticky-bar.is-visible {
    display: block;
}

.transcript-sticky-inner {
    max-width: var(--max-transcript-width);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
}

.transcript-sticky-label {
    font-size: var(--type-caption-size);
    font-weight: 600;
    color: var(--color-text-secondary);
    flex-shrink: 0;
}

.transcript-sticky-actions {
    display: flex;
    gap: var(--space-2);
    min-width: 0;
}

.transcript-sticky-actions .btn {
    min-height: var(--touch-target-min);
    height: var(--touch-target-min);
    padding: 0 var(--space-4);
}

@media (max-width: 767px) {
    .transcript-container {
        border-radius: var(--radius-md);
        padding: var(--space-4);
    }

    .transcript-actions {
        margin-bottom: var(--space-4);
    }

    .transcript-actions .btn {
        flex: 1 1 auto;
        min-width: 0;
    }

    .transcript-sticky-label {
        display: none;
    }

    .transcript-sticky-actions {
        width: 100%;
    }

    .transcript-sticky-actions .btn {
        flex: 1;
    }
}

@media (max-width: 479px) {
    .transcript-actions {
        flex-direction: column;
    }

    .transcript-actions .btn {
        width: 100%;
    }

    .transcript-sticky-bar {
        padding-left: max(var(--space-4), env(safe-area-inset-left));
        padding-right: max(var(--space-4), env(safe-area-inset-right));
    }

    .transcript-sticky-actions .btn {
        padding: 0 var(--space-3);
        font-size: var(--type-body-sm-size);
    }
}

/* ==========================================================================
   Error States
   ========================================================================== */

/* Inline error (below input) */
.inline-error {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    margin-top: var(--space-2);
    text-align: left;
}

.inline-error-icon {
    width: 16px;
    height: 16px;
    color: var(--color-error);
    flex-shrink: 0;
    margin-top: 2px;
}

.inline-error-content {
    flex: 1;
}

.inline-error-message {
    font-size: var(--type-body-sm-size);
    font-weight: 500;
    color: var(--color-error);
    margin-bottom: var(--space-1);
}

.inline-error-help {
    font-size: var(--type-body-sm-size);
    color: var(--color-text-secondary);
}

.inline-error-help code {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--color-text-secondary);
}

/* No transcript alert */
.no-transcript-alert {
    background-color: var(--color-warning-subtle);
    border: 1px solid #FDE68A;
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    max-width: var(--max-transcript-width);
    margin: var(--space-6) auto 0;
}

.no-transcript-alert-content {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
}

.no-transcript-alert-icon {
    width: 20px;
    height: 20px;
    color: var(--color-warning);
    flex-shrink: 0;
    margin-top: 2px;
}

.no-transcript-alert-text {
    flex: 1;
}

.no-transcript-alert-heading {
    font-size: var(--type-body-size);
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: var(--space-2);
}

.no-transcript-alert-body {
    font-size: var(--type-body-sm-size);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-4);
}

/* Generic error alert */
.error-alert {
    background-color: var(--color-error-subtle);
    border: 1px solid #FECACA;
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    max-width: var(--max-transcript-width);
    margin: var(--space-6) auto 0;
}

.error-alert-content {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
}

.error-alert-icon {
    width: 18px;
    height: 18px;
    color: var(--color-error);
    flex-shrink: 0;
    margin-top: 1px;
}

.error-alert-text {
    flex: 1;
}

.error-alert-heading {
    font-size: var(--type-body-size);
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: var(--space-1);
}

.error-alert-body {
    font-size: var(--type-body-sm-size);
    color: var(--color-text-secondary);
    margin-bottom: 0;
}

.error-alert-retry {
    margin-top: var(--space-3);
}

/* ==========================================================================
   Toast / Snackbar
   ========================================================================== */

.toast {
    position: fixed;
    bottom: var(--space-6);
    left: 50%;
    transform: translateX(-50%) translateY(calc(100% + var(--space-6)));
    background-color: var(--color-text-primary);
    color: white;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    max-width: 360px;
    z-index: 1000;
    opacity: 0;
    transition: transform 0.2s ease-out, opacity 0.2s ease-out;
}

.toast.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-icon {
    width: 16px;
    height: 16px;
    color: #4ADE80;
    flex-shrink: 0;
}

.toast-message {
    font-size: var(--type-body-sm-size);
    font-weight: 500;
}

.toast-dismiss {
    width: 44px;
    height: 44px;
    margin: calc(-1 * var(--space-3)) calc(-1 * var(--space-3)) calc(-1 * var(--space-3)) 0;
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.7);
}

.toast-dismiss:hover {
    color: white;
}

.toast-dismiss svg {
    width: 16px;
    height: 16px;
}

@media (max-width: 767px) {
    .toast {
        left: var(--space-4);
        right: var(--space-4);
        transform: translateX(0) translateY(calc(100% + var(--space-6)));
        max-width: none;
    }

    .toast.visible {
        transform: translateX(0) translateY(0);
    }
}

/* ==========================================================================
   Content Sections
   ========================================================================== */

.content-section {
    padding: var(--space-12) var(--space-6);
    max-width: 800px;
    margin: 0 auto;
}

.section-heading {
    margin-bottom: var(--space-6);
}

/* ==========================================================================
   How It Works Section
   ========================================================================== */

.how-it-works-steps {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
}

.how-it-works-step {
    display: flex;
    gap: var(--space-4);
    align-items: flex-start;
}

.step-number {
    width: 28px;
    height: 28px;
    background-color: var(--color-primary-subtle);
    color: var(--color-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--type-body-sm-size);
    font-weight: 600;
    flex-shrink: 0;
}

.step-content {
    flex: 1;
}

.step-title {
    font-size: var(--type-body-size);
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: var(--space-1);
}

.step-description {
    font-size: var(--type-body-sm-size);
    color: var(--color-text-secondary);
}

/* ==========================================================================
   Why Use Transcript Section
   ========================================================================== */

.benefits-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-6);
}

.benefit-item {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.benefit-icon {
    width: 24px;
    height: 24px;
    color: var(--color-primary);
}

.benefit-title {
    font-size: var(--type-body-size);
    font-weight: 600;
    color: var(--color-text-primary);
}

.benefit-description {
    font-size: var(--type-body-sm-size);
    color: var(--color-text-secondary);
}

/* ==========================================================================
   Transcript Use Cases
   ========================================================================== */

.use-cases-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-4);
}

.use-case-item {
    padding: var(--space-5);
    background-color: var(--color-surface-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
}

.use-case-title {
    font-size: var(--type-body-size);
    margin-bottom: var(--space-2);
}

.use-case-description {
    font-size: var(--type-body-sm-size);
    color: var(--color-text-secondary);
}

@media (max-width: 767px) {
    .benefits-grid,
    .use-cases-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   FAQ Section
   ========================================================================== */

.faq-section {
    max-width: 800px;
    margin: 0 auto;
    padding: var(--space-12) var(--space-6);
}

.faq-list {
    border-top: 1px solid var(--color-border);
}

.faq-item {
    border-bottom: 1px solid var(--color-border);
}

.faq-question {
    width: 100%;
    padding: var(--space-5) 0;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-4);
    text-align: left;
    min-height: 48px;
}

.faq-question-text {
    font-size: var(--type-body-size);
    font-weight: 500;
    color: var(--color-text-primary);
}

.faq-chevron {
    width: 18px;
    height: 18px;
    color: var(--color-text-secondary);
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.faq-item.open .faq-chevron {
    transform: rotate(180deg);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.2s ease;
}

.faq-answer-content {
    padding-bottom: var(--space-5);
    max-width: var(--max-prose-width);
}

.faq-answer-content p {
    font-size: var(--type-body-size);
    color: var(--color-text-secondary);
    line-height: var(--type-body-line-height);
}

.faq-answer-content a {
    color: var(--color-primary);
}

.faq-answer-content a:hover {
    text-decoration: underline;
}

/* ==========================================================================
   Ad Containers
   ========================================================================== */

.ad-container {
    max-width: 728px;
    margin: var(--space-12) auto;
    text-align: center;
}

.homepage-ad {
    margin-top: var(--space-10);
    margin-bottom: 0;
}

.trust-badges.hidden + .homepage-ad {
    display: none;
}

.transcript-bottom-ad {
    margin-top: var(--space-12);
    margin-bottom: 0;
}

.transcript-rail-ad {
    width: 300px;
    margin: 0;
    position: sticky;
    top: var(--space-6);
}

.ad-label {
    font-size: var(--type-caption-size);
    font-weight: var(--type-caption-weight);
    color: var(--color-text-tertiary);
    margin-bottom: var(--space-3);
    text-align: center;
}

.ad-slot {
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.transcript-rail-ad .ad-slot {
    min-height: 600px;
}

.adsbygoogle {
    width: 100%;
}

.ad-placeholder {
    width: 100%;
    min-height: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-tertiary);
    background-color: var(--color-surface-secondary);
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-sm);
    font-size: var(--type-caption-size);
}

@media (max-width: 767px) {
    .ad-container {
        max-width: 320px;
        margin: var(--space-10) auto;
    }

    .ad-slot {
        min-height: 100px;
    }
}

@media (max-width: 1099px) {
    .transcript-rail-ad {
        display: none;
    }
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
    background-color: var(--color-surface-secondary);
    border-top: 1px solid var(--color-border);
    padding: var(--space-16) var(--space-6) var(--space-8);
    margin-top: auto;
}

.footer-container {
    max-width: var(--max-page-width);
    margin: 0 auto;
}

.footer-main {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-8);
}

.footer-brand {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.footer-logo {
    font-size: 22px;
    font-weight: 600;
    text-decoration: none;
    display: flex;
}

.footer-logo .logo-cap {
    color: var(--color-text-primary);
}

.footer-logo .logo-my {
    color: var(--color-primary);
}

.footer-logo .logo-video {
    color: var(--color-text-primary);
}

.footer-tagline {
    font-size: var(--type-body-sm-size);
    color: var(--color-text-secondary);
}

.footer-links-col h4 {
    font-size: var(--type-body-sm-size);
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: var(--space-4);
}

.footer-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.footer-links a {
    font-size: var(--type-body-sm-size);
    color: var(--color-text-secondary);
    text-decoration: none;
    transition: color 0.15s ease;
}

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

.footer-bottom {
    border-top: 1px solid var(--color-border);
    padding-top: var(--space-6);
}

.footer-copyright,
.footer-disclosure {
    font-size: var(--type-caption-size);
    color: var(--color-text-tertiary);
}

.footer-disclosure {
    margin-top: var(--space-2);
    max-width: 42rem;
    line-height: 1.5;
}

.footer-cookie-btn {
    appearance: none;
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    font-size: var(--type-body-sm-size);
    color: var(--color-text-secondary);
    cursor: pointer;
    text-align: left;
    text-decoration: none;
    transition: color 0.15s ease;
}

.footer-cookie-btn:hover {
    color: var(--color-primary);
}

@media (max-width: 767px) {
    .site-footer {
        padding: var(--space-10) var(--space-4) var(--space-6);
    }

    .footer-main {
        flex-direction: column;
        gap: var(--space-8);
    }

    .footer-links-col {
        width: 100%;
    }

    .footer-links {
        flex-direction: row;
        flex-wrap: wrap;
        gap: var(--space-4);
    }
}

/* ==========================================================================
   Page Content (Legal Pages, About, etc.)
   ========================================================================== */

.page-content {
    max-width: 700px;
    margin: 0 auto;
    padding: var(--space-12) var(--space-6);
}

.page-content h1 {
    margin-bottom: var(--space-6);
}

.page-content h2 {
    margin-top: var(--space-8);
    margin-bottom: var(--space-4);
}

.page-content h3 {
    margin-top: var(--space-6);
    margin-bottom: var(--space-3);
}

.page-content p {
    margin-bottom: var(--space-4);
    color: var(--color-text-primary);
}

.page-content ul,
.page-content ol {
    margin-bottom: var(--space-4);
    padding-left: var(--space-6);
}

.page-content li {
    margin-bottom: var(--space-2);
}

.page-content a {
    color: var(--color-primary);
}

.page-content a:hover {
    text-decoration: underline;
}

.last-updated {
    font-size: var(--type-body-sm-size);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-8);
}

/* Cookie table */
.cookie-table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--space-4) 0;
    font-size: var(--type-body-sm-size);
}

.cookie-table th,
.cookie-table td {
    padding: var(--space-3);
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

.cookie-table th {
    background-color: var(--color-surface-secondary);
    font-weight: 500;
}

.contact-email {
    font-size: var(--type-body-size);
    padding: var(--space-4) var(--space-6);
    background-color: var(--color-surface-secondary);
    border-radius: var(--radius-md);
    display: inline-block;
}

/* Error pages */
.error-page {
    text-align: center;
    padding: var(--space-16) var(--space-6);
}

.error-page h1 {
    margin-bottom: var(--space-4);
}

.error-page p {
    color: var(--color-text-secondary);
    margin-bottom: var(--space-6);
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */

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

.text-left {
    text-align: left;
}

.mb-0 {
    margin-bottom: 0;
}

.mb-4 {
    margin-bottom: var(--space-4);
}

.mb-8 {
    margin-bottom: var(--space-8);
}

.mt-4 {
    margin-top: var(--space-4);
}

.mt-8 {
    margin-top: var(--space-8);
}

/* ==========================================================================
   Animations
   ========================================================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

.animate-fade-in {
    animation: fadeIn 0.3s ease-out;
}

.animate-slide-up {
    animation: slideUp 0.3s ease-out;
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .site-header,
    .site-footer,
    .ad-container,
    .transcript-rail-ad,
    .transcript-actions,
    .transcript-sticky-bar,
    .toast,
    .url-input-wrapper,
    .trust-badges,
    .trust-chip,
    .submit-btn-wrapper {
        display: none !important;
    }

    .transcript-container {
        max-height: none;
        box-shadow: none;
        border: 1px solid #ccc;
    }

    body {
        background: white;
    }
}

/* Optional analytics consent */
.cookie-settings {
    background: transparent;
    border: 0;
    color: inherit;
    cursor: pointer;
    text-decoration: underline;
    font: inherit;
}
.cookie-settings:focus-visible,
.analytics-consent button:focus-visible,
.analytics-consent a:focus-visible {
    outline: 3px solid #2563eb;
    outline-offset: 3px;
}
.analytics-consent[hidden] { display: none; }
.analytics-consent {
    position: fixed;
    z-index: 1000;
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    max-width: 720px;
    margin: 0 auto;
    padding: 1.25rem;
    background: #fff;
    color: #172033;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, .2);
}
.analytics-consent p { margin: 0 0 1rem; line-height: 1.5; }
.analytics-consent-actions { display: flex; flex-wrap: wrap; gap: .75rem; }
.analytics-consent button {
    cursor: pointer;
    border: 1px solid #1d4ed8;
    border-radius: 6px;
    padding: .6rem 1rem;
    font: inherit;
}
#reject-analytics { background: #fff; color: #1d4ed8; }
#accept-analytics { background: #1d4ed8; color: #fff; }
@media print { .analytics-consent, .cookie-settings { display: none !important; } }

