:root {
    --primary-color: #2c3e50;
    --secondary-color: #34495e;
    --accent-color: #3498db;
    --bg-color: #f8f9fa;
    --card-bg: #ffffff;
    --text-color: #2d3436;
    --text-light: #636e72;
    --border-color: #dfe6e9;
    --success-color: #27ae60;
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius: 12px;
}

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

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

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

header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
    letter-spacing: -0.5px;
}

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

.nav-links a {
    text-decoration: none;
    color: var(--text-light);
    font-weight: 500;
    transition: color 0.2s;
}

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

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

footer {
    padding: 3rem 0;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-light);
    background: var(--card-bg);
}

/* Tool Component */
.checker-container {
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
}

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

.btn {
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    font-size: 1rem;
}

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

.btn-primary:hover {
    background-color: #2980b9;
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: #f1f2f6;
    color: var(--text-color);
}

.btn-secondary:hover {
    background-color: #dfe4ea;
}

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

.view-box {
    position: relative;
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
    aspect-ratio: 4/5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.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;
    bottom: 15px;
    left: 15px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    backdrop-filter: blur(4px);
    z-index: 10;
    /* Prevent label from mirroring */
    transform-origin: left;
}

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

/* Article Styling */
.article-page {
    max-width: 800px;
    margin: 0 auto;
    background: var(--card-bg);
    padding: 4rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.article-content h1 {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
}

.article-content h2 {
    font-size: 1.8rem;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    color: var(--secondary-color);
}

.article-content p {
    margin-bottom: 1.2rem;
    font-size: 1.1rem;
    color: var(--text-color);
}

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

/* Dropzone styling */
.upload-input {
    display: none;
}

/* Dimensions Page Styles */
.dimensions-container {
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
}

.viewer-wrapper {
    position: relative;
    max-width: 800px;
    margin: 2rem auto;
    border-radius: var(--radius);
    overflow: hidden;
    aspect-ratio: 4/3;
    background: #000;
}

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

.overlay-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
}

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

.guide-line {
    position: absolute;
    background: rgba(52, 152, 219, 0.5);
}

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

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

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

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

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

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

.center-line {
    left: 50%;
    width: 2px;
    background: rgba(231, 76, 60, 0.6);
}

.golden-ratio-mask {
    width: 60%;
    height: 80%;
    border: 2px dashed rgba(255, 255, 255, 0.4);
    border-radius: 50% / 60% 60% 40% 40%;
}

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

.overlay-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.overlay-btn.active {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

/* Responsive Design & Mobile Optimization */
@media (max-width: 992px) {
    .container {
        padding: 0 15px;
    }
}

@media (max-width: 768px) {
    header {
        padding: 1rem 0;
    }

    nav {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-links {
        gap: 1rem;
        font-size: 0.9rem;
        flex-wrap: wrap;
        justify-content: center;
    }

    .hero-section img {
        max-height: 250px;
    }

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

    h1 {
        font-size: 1.8rem;
    }

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

    .btn,
    .overlay-btn {
        width: 100%;
        padding: 1rem;
        /* Better touch target */
    }

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

    .view-box {
        aspect-ratio: 1/1;
        /* Square views on mobile often look better */
    }

    .viewer-wrapper {
        aspect-ratio: 3/4;
        /* Portrait orientation for mobile cameras */
    }

    .article-content h1 {
        font-size: 2rem;
    }

    .article-content h2 {
        font-size: 1.5rem;
    }
}

/* Touch-specific improvements */
@media (pointer: coarse) {

    .btn,
    .overlay-btn,
    .nav-links a {
        min-height: 44px;
        /* Apple/Google recommended touch size */
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .nav-links {
        background: #f1f2f6;
        padding: 0.5rem;
        border-radius: 8px;
        width: 100%;
    }
}

/* Landscape Mode Fix for Mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .hero-section {
        display: none;
    }

    .viewer-wrapper {
        max-height: 70vh;
    }
}