:root {
    --bg-color: #09090b;
    --card-bg: rgba(24, 24, 27, 0.6);
    --card-border: rgba(255, 255, 255, 0.08);
    --accent-primary: #ef4444;
    --accent-secondary: #f43f5e;
    --accent-glow: rgba(239, 68, 68, 0.2);
    --text-main: #f4f4f5;
    --text-muted: #a1a1aa;
    --sidebar-width: 280px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
    overflow-x: hidden;
    width: 100%;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    background-image:
        radial-gradient(at 0% 0%, rgba(239, 68, 68, 0.1) 0px, transparent 40%),
        radial-gradient(at 100% 100%, rgba(244, 63, 94, 0.08) 0px, transparent 40%),
        radial-gradient(at 50% 50%, rgba(18, 18, 18, 0.5) 0px, transparent 100%);
    background-attachment: fixed;
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    min-height: 100vh;
}

img {
    max-width: 100%;
    height: auto;
}

/* Header Navigation */
nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(9, 9, 11, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--card-border);
    height: 70px;
    display: flex;
    align-items: center;
}

.nav-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 1.4rem;
    text-decoration: none;
    color: var(--text-main);
}

.logo svg {
    width: 32px;
    height: 32px;
    fill: var(--accent-primary);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    list-style: none;
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
}

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

/* Language Switcher Styling */
.lang-switch {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    padding: 0.25rem 0.5rem;
    border-radius: 8px;
}

.lang-switch a {
    color: var(--text-muted);
    text-decoration: none;
    transition: var(--transition);
}

.lang-switch a:hover {
    color: var(--text-main);
}

.lang-switch a.active {
    color: var(--accent-secondary);
}

.lang-switch-divider {
    color: rgba(255, 255, 255, 0.15);
}

/* Hero / Downloader Section */
.hero {
    max-width: 1200px;
    margin: 0 auto;
    padding: 4rem 1.5rem 2rem 1.5rem;
    text-align: center;
}

h1 {
    font-family: 'Outfit', sans-serif;
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, var(--text-main) 50%, var(--accent-secondary) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.75rem;
    padding: 0.05em 0;
}

.hero p {
    color: var(--text-muted);
    font-size: clamp(0.95rem, 2vw, 1.15rem);
    max-width: 600px;
    margin: 0 auto 2.5rem auto;
    font-weight: 300;
}

.downloader-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 2.25rem;
    box-shadow: 0 12px 40px -15px rgba(0, 0, 0, 0.7);
    max-width: 800px;
    margin: 0 auto;
}

.input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@media (min-width: 640px) {
    .input-wrapper {
        flex-direction: row;
    }
}

.input-group {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
}

.input-group svg {
    position: absolute;
    left: 1.25rem;
    width: 20px;
    height: 20px;
    stroke: var(--text-muted);
    pointer-events: none;
    transition: var(--transition);
}

input[type="text"] {
    width: 100%;
    background: rgba(9, 9, 11, 0.85);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 1rem 1rem 1rem 3.2rem;
    color: var(--text-main);
    font-size: 1.05rem;
    outline: none;
    transition: var(--transition);
}

input[type="text"]:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

input[type="text"]:focus + svg {
    stroke: var(--accent-primary);
}

.btn-fetch {
    background: linear-gradient(135deg, var(--accent-primary) 0%, #b91c1c 100%);
    border: none;
    border-radius: 14px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    padding: 1rem 2rem;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-fetch:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5);
}

.btn-fetch:active {
    transform: translateY(0);
}

/* Error Message */
.error-message {
    color: var(--accent-secondary);
    font-size: 0.9rem;
    margin-top: 0.75rem;
    display: none;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
}

.error-message svg {
    width: 16px;
    height: 16px;
}

/* Welcome state */
.results-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    border: 2px dashed var(--card-border);
    border-radius: 20px;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
    max-width: 800px;
    margin: 2rem auto 0 auto;
}

.results-welcome svg {
    width: 56px;
    height: 56px;
    stroke: var(--text-muted);
    margin-bottom: 1.25rem;
    opacity: 0.6;
}

/* Results Area */
.results-grid {
    display: none;
    grid-template-columns: 1fr;
    gap: 2rem;
    max-width: 800px;
    margin: 2rem auto 0 auto;
}

@media (min-width: 640px) {
    .results-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.thumbnail-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

.thumbnail-card:hover {
    border-color: rgba(239, 68, 68, 0.25);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6);
    transform: translateY(-3px);
}

.thumbnail-preview-container {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    background: #0f0f12;
    overflow: hidden;
}

.thumbnail-preview {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.thumbnail-card:hover .thumbnail-preview {
    transform: scale(1.03);
}

.thumbnail-details {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: auto;
}

.thumbnail-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.thumbnail-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
}

.thumbnail-resolution {
    font-size: 0.75rem;
    background: rgba(255, 255, 255, 0.08);
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    color: var(--text-muted);
    font-weight: 500;
}

.thumbnail-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.btn-action {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    color: var(--text-main);
    padding: 0.6rem 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    text-decoration: none;
}

.btn-action:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-action.primary {
    background: var(--accent-primary);
    border: none;
}

.btn-action.primary:hover {
    background: var(--accent-secondary);
}

/* Divider */
.divider {
    width: 100%;
    height: 1px;
    background: var(--card-border);
    margin: 4rem 0;
}

/* Content Portal (Layout) */
.portal-layout {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 3rem;
}

@media (min-width: 1024px) {
    .portal-layout {
        grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    }
}

/* Sticky Sidebar */
.sidebar {
    display: none;
}

@media (min-width: 1024px) {
    .sidebar {
        display: block;
        position: sticky;
        top: 100px;
        height: calc(100vh - 140px);
        overflow-y: auto;
        scrollbar-width: none;
    }

    .sidebar::-webkit-scrollbar {
        display: none;
    }
}

.sidebar-title {
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
}

.sidebar-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    border-left: 1px solid rgba(255, 255, 255, 0.05);
    padding-left: 0.25rem;
}

.sidebar-links a {
    display: block;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.88rem;
    padding: 0.4rem 0.75rem;
    border-radius: 8px;
    transition: var(--transition);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-links a:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.03);
}

.sidebar-links a.active {
    color: var(--accent-secondary);
    background: rgba(239, 68, 68, 0.05);
    font-weight: 600;
}

/* Mobile TOC Dropdown */
.mobile-toc {
    display: block;
    margin-bottom: 2rem;
}

@media (min-width: 1024px) {
    .mobile-toc {
        display: none;
    }
}

.mobile-toc select {
    width: 100%;
    background: #18181b;
    border: 1px solid var(--card-border);
    border-radius: 12px;
    color: var(--text-main);
    padding: 0.8rem 1rem;
    font-size: 0.95rem;
    font-weight: 500;
    outline: none;
}

/* Main Content Styling */
.main-content {
    display: flex;
    flex-direction: column;
    gap: 4.5rem;
    min-width: 0;
}

.blog-post {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 4.5rem;
}

.blog-post:last-of-type {
    border-bottom: none;
}

.post-tag {
    display: inline-block;
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.25rem 0.75rem;
    border-radius: 100px;
    margin-bottom: 1rem;
}

h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.85rem;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.02em;
    color: var(--text-main);
    margin-bottom: 1.25rem;
}

h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.35rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--text-main);
    margin-top: 2rem;
    margin-bottom: 0.75rem;
}

p {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
    line-height: 1.7;
}

strong {
    color: var(--text-main);
}

/* Custom Content Lists and Grids */
.step-timeline {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin: 2rem 0;
    border-left: 2px solid rgba(255, 255, 255, 0.05);
    padding-left: 1.5rem;
}

.step-item {
    position: relative;
}

.step-item::before {
    content: '';
    position: absolute;
    left: calc(-1.5rem - 6px);
    top: 6px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent-primary);
    box-shadow: 0 0 10px var(--accent-primary);
}

.step-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.35rem;
}

/* Color psychology grids */
.color-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
    margin: 2rem 0;
}

@media (min-width: 640px) {
    .color-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.color-card {
    background: rgba(24, 24, 27, 0.4);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.color-badge {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    flex-shrink: 0;
    margin-top: 0.15rem;
}

.color-name {
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--text-main);
    margin-bottom: 0.25rem;
}

/* Standardized Premium Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    background: rgba(24, 24, 27, 0.3);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    overflow: hidden;
}

th, td {
    padding: 1rem 1.25rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

th {
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-main);
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

td {
    color: var(--text-muted);
    font-size: 0.95rem;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.01);
}

/* Collapsible FAQ */
details {
    background: rgba(24, 24, 27, 0.4);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    margin-bottom: 1rem;
    overflow: hidden;
    transition: var(--transition);
}

details[open] {
    border-color: rgba(239, 68, 68, 0.2);
}

summary {
    padding: 1.25rem;
    font-weight: 600;
    color: var(--text-main);
    cursor: pointer;
    outline: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    list-style: none;
}

summary::-webkit-details-marker {
    display: none;
}

summary::after {
    content: '+';
    font-family: monospace;
    font-size: 1.2rem;
    color: var(--text-muted);
    transition: var(--transition);
}

details[open] summary::after {
    content: '−';
    color: var(--accent-secondary);
}

.faq-answer {
    padding: 0 1.25rem 1.25rem 1.25rem;
    color: var(--text-muted);
    border-top: 1px solid rgba(255, 255, 255, 0.03);
    font-size: 0.95rem;
}

/* Toast Alert */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #18181b;
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 0.75rem 1.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
    color: var(--text-main);
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
    z-index: 1000;
}

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

.toast svg {
    width: 18px;
    height: 18px;
    stroke: #22c55e;
}

/* Footer */
footer {
    border-top: 1px solid var(--card-border);
    background: #09090b;
    padding: 4rem 1.5rem 2rem 1.5rem;
    margin-top: 6rem;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr;
    gap: 3rem;
}

@media (min-width: 768px) {
    .footer-container {
        grid-template-columns: 2fr 1fr;
    }
}

.footer-brand h4 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--text-main);
}

.footer-brand p {
    font-size: 0.9rem;
    max-width: 450px;
    margin-bottom: 0;
}

.footer-links {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.footer-links h5 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.footer-links ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.88rem;
    transition: var(--transition);
}

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

.footer-copyright {
    max-width: 1200px;
    margin: 3rem auto 0 auto;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 1.5rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* Typography word-wrap safety */
h1, h2, h3, h4, h5, h6, p, li, a, span, td, th {
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: normal;
}

/* Responsive Table Container */
.table-container {
    width: 100%;
    overflow-x: auto;
    margin: 2rem 0;
    border: 1px solid var(--card-border);
    border-radius: 14px;
    background: rgba(24, 24, 27, 0.3);
    scrollbar-width: thin;
}

.table-container table {
    margin: 0;
    border: none;
    min-width: 500px;
}

/* Responsive overrides for mobile */
@media (max-width: 640px) {
    nav {
        height: auto;
        padding: 0.75rem 0;
    }
    .nav-container {
        flex-direction: column;
        gap: 0.5rem;
        align-items: center;
        padding: 0 1rem;
    }
    .nav-links {
        gap: 1rem;
    }
    .nav-links li:nth-child(n+3) {
        display: none; /* Hide legal pages in mobile header, they are in footer */
    }
    .hero {
        padding: 2rem 1rem 1rem 1rem;
    }
    .hero p {
        margin-bottom: 1.5rem;
    }
    .downloader-card {
        padding: 1.25rem 1rem;
        border-radius: 18px;
    }
    input[type="text"] {
        padding: 0.85rem 1rem 0.85rem 2.8rem;
        font-size: 0.95rem;
    }
    .input-group svg {
        left: 1rem;
        width: 16px;
        height: 16px;
    }
    .btn-fetch {
        padding: 0.85rem 1.5rem;
        font-size: 0.95rem;
    }
    .results-welcome {
        padding: 2rem 1rem;
        margin: 1.5rem auto 0 auto;
    }
    .results-grid {
        margin: 1.5rem auto 0 auto;
        gap: 1.25rem;
    }
    .portal-layout {
        padding: 0 1rem;
        gap: 2rem;
    }
    .main-content {
        gap: 3rem;
    }
    .blog-post {
        padding-bottom: 3rem;
    }
    h2 {
        font-size: 1.5rem;
    }
    h3 {
        font-size: 1.2rem;
    }
    summary {
        padding: 1rem;
        font-size: 0.95rem;
    }
    .faq-answer {
        padding: 0 1rem 1rem 1rem;
        font-size: 0.9rem;
    }
    .color-grid {
        gap: 0.75rem;
    }
    .color-card {
        padding: 1rem;
    }

    /* Stackable Tables on Mobile */
    .table-container {
        border: none;
        background: transparent;
        overflow-x: visible;
        margin: 1.5rem 0;
    }
    .table-container table {
        min-width: 0;
    }
    table, thead, tbody, th, td, tr {
        display: block;
    }
    thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    tr {
        border: 1px solid var(--card-border);
        border-radius: 16px;
        margin-bottom: 1.25rem;
        background: rgba(24, 24, 27, 0.3);
        padding: 0.5rem 0;
    }
    td {
        border: none;
        padding: 0.75rem 1rem;
        text-align: left;
        border-bottom: 1px solid rgba(255, 255, 255, 0.04);
        display: block;
    }
    td:last-child {
        border-bottom: none;
    }
    td::before {
        content: attr(data-label);
        display: block;
        font-size: 0.75rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: var(--accent-secondary);
        margin-bottom: 0.25rem;
    }
}

/* Language Switcher Dropdown Styling */
.lang-switch-container {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.lang-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: rgba(24, 24, 27, 0.8);
    border: 1px solid var(--card-border);
    color: var(--text-main);
    padding: 0.35rem 2rem 0.35rem 0.75rem;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    outline: none;
    transition: var(--transition);
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%23a1a1aa' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3E%3C/svg%3E");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.25rem;
}

.lang-select:hover {
    border-color: rgba(255, 255, 255, 0.2);
    background-color: rgba(24, 24, 27, 1);
}

.lang-select:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
