:root {
    --primary-color: #0f172a;
    /* Slate 900 */
    --secondary-color: #334155;
    /* Slate 700 */
    --accent-color: #2563eb;
    /* Blue 600 */
    --accent-hover: #1d4ed8;
    /* Blue 700 */
    --bg-color: #f8fafc;
    /* Slate 50 */
    --card-bg: #ffffff;
    --text-color: #1e293b;
    /* Slate 800 */
    --text-light: #64748b;
    /* Slate 500 */
    --border-color: #e2e8f0;
    /* Slate 200 */
    --success-color: #10b981;
    /* Emerald 500 */
    --font-main: 'Inter', system-ui, -apple-system, sans-serif;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-md: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --radius: 16px;
    --radius-sm: 8px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* Layout */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
}

header {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: transform 0.3s ease-in-out;
}

header.header-hidden {
    transform: translateY(-100%);
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
    letter-spacing: -0.025em;
}

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

.nav-links a {
    text-decoration: none;
    color: var(--text-light);
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--accent-color);
}

.nav-links a.active::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--accent-color);
    border-radius: 2px;
}

main {
    padding: 3rem 0;
    min-height: calc(100vh - 200px);
}

footer {
    padding: 4rem 0;
    border-top: 1px solid var(--border-color);
    background: white;
}

/* Typography */
h1,
h2,
h3,
h4 {
    color: var(--primary-color);
    letter-spacing: -0.025em;
    font-weight: 700;
}

h1 {
    font-size: 2.5rem;
    line-height: 1.2;
}

h2 {
    font-size: 1.875rem;
    line-height: 1.3;
}

/* Components */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    text-decoration: none;
    border: none;
}

.btn-primary {
    background-color: var(--accent-color);
    color: white;
    box-shadow: 0 4px 14px 0 rgba(37, 99, 235, 0.39);
}

.btn-primary:hover {
    background-color: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.23);
}

.btn-secondary {
    background-color: white;
    color: var(--secondary-color);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--bg-color);
    border-color: #cbd5e1;
}

/* Tool Components */
.checker-container,
.dimensions-container {
    background: var(--card-bg);
    padding: 3.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.controls {
    display: flex;
    gap: 1.25rem;
    justify-content: center;
    margin-bottom: 2rem;
}

.upload-container {
    max-width: 300px;
    margin: 0 auto 3rem;
    text-align: center;
    padding-top: 1rem;
}

.upload-input {
    display: none;
}

.visual-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 3rem;
}

.view-box {
    position: relative;
    background: #020617;
    border-radius: var(--radius);
    overflow: hidden;
    aspect-ratio: 4/5;
    box-shadow: var(--shadow-lg);
}

.view-box video,
.view-box canvas,
.view-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mirrored-view {
    transform: scaleX(-1);
}

.label-tag {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(15, 23, 42, 0.7);
    color: white;
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 0.8rem;
    font-weight: 600;
    backdrop-filter: blur(8px);
    z-index: 10;
}

.view-box.mirrored-view .label-tag {
    transform: scaleX(-1);
}

/* Article Styling */
.article-page {
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.article-content {
    padding: 4rem;
}

.article-content h1 {
    margin-bottom: 2rem;
}

.article-content h2 {
    margin-top: 3rem;
    margin-bottom: 1.5rem;
}

.article-content p {
    margin-bottom: 1.5rem;
    color: #334155;
    line-height: 1.8;
}

.lead {
    font-size: 1.25rem;
    color: var(--secondary-color);
    font-weight: 500;
}

/* Privacy Notice and Banners */
.privacy-notice {
    margin-top: 3rem;
    padding: 1.5rem 2rem;
    background: #eff6ff;
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--accent-color);
    color: #1e40af;
    text-align: left;
    font-size: 0.95rem;
}

/* Dimensions Overlays */
.viewer-wrapper {
    position: relative;
    max-width: 800px;
    margin: 2rem auto;
    border-radius: var(--radius);
    overflow: hidden;
    aspect-ratio: 4/3;
    background: #000;
    box-shadow: var(--shadow-lg);
    isolation: isolate;
    /* Create new stacking context */
}

.viewer-wrapper video,
.viewer-wrapper canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.overlay-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 10;
}

.overlay-container.active {
    opacity: 1;
}

.guide-line {
    position: absolute;
    background: rgba(37, 99, 235, 0.8);
    transition: all 0.2s ease;
}

.guide-v {
    width: 2px;
    height: 100%;
    top: 0;
}

.guide-h {
    height: 2px;
    width: 100%;
    left: 0;
}

.center-line {
    left: 50%;
    width: 3px;
    background: rgba(239, 44, 44, 0.9);
    height: 100%;
    transform: translateX(-50%);
}

/* Rule of Thirds Positioning */
.thirds:nth-child(1),
.thirds:nth-child(2) {
    width: 100%;
    height: 2px;
}

.thirds:nth-child(3),
.thirds:nth-child(4) {
    width: 2px;
    height: 100%;
}

#overlay-thirds .guide-h:nth-child(1) {
    top: 33.33%;
}

#overlay-thirds .guide-h:nth-child(2) {
    top: 66.66%;
}

#overlay-thirds .guide-v:nth-child(3) {
    left: 33.33%;
}

#overlay-thirds .guide-v:nth-child(4) {
    left: 66.66%;
}

.golden-ratio-mask {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 65%;
    height: 85%;
    border: 3px dashed rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    box-shadow: 0 0 0 1000px rgba(0, 0, 0, 0.2);
}

.controls-overlay {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    margin-top: 1.5rem;
}

.overlay-btn {
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: white;
    color: var(--secondary-color);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

.overlay-btn:hover {
    background: var(--bg-color);
    border-color: #cbd5e1;
    transform: translateY(-1px);
}

.overlay-btn.active {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

#capture-btn {
    background: var(--success-color);
    color: white;
    border: none;
}

#capture-btn:hover {
    filter: brightness(1.05);
    transform: translateY(-1px);
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 21px;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 1001;
    padding: 0;
}

.mobile-menu-btn span {
    width: 100%;
    height: 3px;
    background-color: var(--primary-color);
    border-radius: 3px;
    transition: all 0.3s ease-in-out;
}

/* Mobile Menu Active State */
.mobile-menu-btn.active span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}

.mobile-menu-btn.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-btn.active span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

body.no-scroll {
    overflow: hidden;
}

/* Tool Components */
.tool-container {
    position: relative;
    width: 100%;
    max-width: 800px;
    margin: 0 auto 2rem;
    border-radius: var(--radius);
    overflow: hidden;
    background: #000;
    box-shadow: var(--shadow-lg);
}

.tool-container video,
.tool-container canvas {
    width: 100%;
    height: auto;
    display: block;
}

/* Responsive */
@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }

    .nav-links {
        display: none;
        /* Hidden by default on mobile */
        position: fixed;
        top: 0;
        right: 0;
        width: 100%;
        height: 100vh;
        background-color: rgba(255, 255, 255, 0.98);
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
        gap: 2rem;
        z-index: 1000;
        transition: transform 0.3s ease-in-out;
        padding-top: 80px;
        overflow-y: auto;
        padding-bottom: 2rem;
    }

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

    .nav-links a {
        font-size: 1.5rem;
        color: var(--primary-color);
    }

    .mobile-menu-btn {
        display: flex;
    }

    .checker-container,
    .article-content,
    .dimensions-container {
        padding: 2rem 1.5rem;
    }

    .visual-comparison {
        grid-template-columns: 1fr;
    }

    .controls {
        flex-direction: column;
        width: 100%;
    }

    .btn {
        width: 100%;
    }

    /* Overlay Buttons on Mobile */
    .controls-overlay {
        gap: 0.5rem;
    }

    .overlay-btn {
        flex: 1 1 45%;
        padding: 0.8rem;
        font-size: 0.9rem;
    }
}

/* Micro-animations */
article:hover {
    transform: translateY(-2px);
    transition: transform 0.2s ease;
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.text-dark {
    color: var(--text-color);
}

/* Face Flip Controls */
.face-flip-controls {
    flex-direction: column;
    gap: 1.5rem;
}

.button-group {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.settings-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    background: #fafafa;
    padding: 1rem;
    border-radius: 8px;
}

.speed-label {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-top: 0.5rem;
}

.speed-slider {
    width: 100%;
    max-width: 200px;
}

.text-dark {
    color: var(--text-color);
}

.text-light {
    color: var(--text-light);
}

/* Responsive */
@media (max-width: 768px) {
    /* ... existing styles ... */

    .button-group {
        flex-direction: column;
        width: 100%;
    }

    .settings-group {
        width: 100%;
    }

    .speed-slider {
        max-width: 100%;
    }
}