/* ================================================================
   Design System — Singulario Apps
   ================================================================
   Font:    Inter (Google Fonts)
   Grid:    8px base unit
   Colors:  Refined blue primary with warm neutrals
   ================================================================ */

:root {
    /* Primary */
    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-primary-100: #dbeafe;

    /* Neutrals */
    --color-text: #1e293b;
    --color-text-secondary: #475569;
    --color-text-muted: #64748b;

    /* Surfaces */
    --color-bg: #ffffff;
    --color-bg-subtle: #f8fafc;
    --color-bg-muted: #f1f5f9;
    --color-border: #e2e8f0;

    /* Accent */
    --color-accent: #0ea5e9;

    /* Shadows */
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.06);
    --shadow-card-hover: 0 4px 8px rgba(0, 0, 0, 0.06), 0 12px 28px rgba(0, 0, 0, 0.1);

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

    /* Spacing (8px base) */
    --space-1: 0.25rem;   /* 4px */
    --space-2: 0.5rem;    /* 8px */
    --space-3: 0.75rem;   /* 12px */
    --space-4: 1rem;      /* 16px */
    --space-5: 1.25rem;   /* 20px */
    --space-6: 1.5rem;    /* 24px */
    --space-8: 2rem;      /* 32px */
    --space-10: 2.5rem;   /* 40px */
    --space-12: 3rem;     /* 48px */
    --space-16: 4rem;     /* 64px */

    /* Typography */
    --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Layout */
    --header-height: 64px;
    --container-max: 1080px;
    --container-narrow: 800px;
}


/* ================================================================
   Reset & Base
   ================================================================ */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--color-text);
    background-color: var(--color-bg);
    padding-top: var(--header-height);
}

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

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

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

ul {
    margin: 0 0 var(--space-4) 0;
    padding: 0 0 0 var(--space-6);
}

li {
    margin: var(--space-2) 0;
}

p {
    margin: 0 0 var(--space-4) 0;
}


/* ================================================================
   Typography
   ================================================================ */
h1, h2, h3, h4 {
    margin: 0;
    color: var(--color-text);
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.02em;
}

h1 {
    font-size: 2.75rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.15;
    margin-bottom: var(--space-6);
}

h2 {
    font-size: 1.5rem;
    margin-bottom: var(--space-3);
}

h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: var(--space-2);
}

h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: var(--space-2);
}


/* ================================================================
   Layout
   ================================================================ */
.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--space-6);
}

main {
    min-height: calc(100vh - 200px);
    padding: var(--space-12) 0;
}


/* ================================================================
   Header
   ================================================================ */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 0.75rem 0;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--color-border);
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-4);
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.logo a {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    color: var(--color-text);
    text-decoration: none;
    transition: opacity var(--transition-fast);
}

.logo a:hover {
    opacity: 0.8;
    text-decoration: none;
}

nav ul {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: var(--space-8);
}

nav a {
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 500;
    padding: var(--space-2) 0;
    transition: color var(--transition-fast);
}

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


/* ================================================================
   Footer
   ================================================================ */
footer {
    border-top: 1px solid var(--color-border);
    padding: var(--space-8) 0;
    background: var(--color-bg-subtle);
}

footer .container {
    display: flex;
    justify-content: center;
    align-items: center;
}

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

footer p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--color-text-muted);
}


/* ================================================================
   Hero
   ================================================================ */
.hero {
    text-align: center;
    margin-bottom: var(--space-8);
}

.hero h1 {
    text-align: center;
    background: linear-gradient(135deg, var(--color-text) 0%, var(--color-text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    font-size: 1.125rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    color: var(--color-text-secondary);
    line-height: 1.7;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--color-text-secondary);
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.7;
}


/* ================================================================
   Buttons
   ================================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: var(--space-2);
    padding: 0.625rem 1.75rem;
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--transition-base);
    min-width: 160px;
    background: var(--color-primary);
    color: white;
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2), 0 4px 12px rgba(37, 99, 235, 0.15);
}

.btn:hover {
    background: var(--color-primary-hover);
    text-decoration: none;
    color: white;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.25), 0 8px 20px rgba(37, 99, 235, 0.2);
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2);
}

.button-group {
    display: flex;
    gap: var(--space-6);
    justify-content: center;
    flex-wrap: wrap;
    margin: var(--space-10) 0 var(--space-4) 0;
}


/* ================================================================
   Content Areas
   ================================================================ */
.content-centered {
    max-width: var(--container-narrow);
    margin: 0 auto;
    text-align: center;
}

.content-centered p {
    color: var(--color-text-secondary);
    font-size: 1.0625rem;
    line-height: 1.7;
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: var(--space-4);
}

.content-centered .trust-line {
    font-weight: 600;
    color: var(--color-text);
    font-size: 1.125rem;
    margin-top: var(--space-4);
}

.content {
    max-width: var(--container-narrow);
    margin: 0 auto;
}

/* Markdown document styles */
.content h2 {
    text-align: left;
    margin-top: var(--space-10);
    margin-bottom: var(--space-4);
}

.content h3 {
    font-size: 1.2rem;
    text-align: left;
    margin-top: var(--space-8);
    margin-bottom: var(--space-3);
}

.content p {
    margin-bottom: var(--space-4);
    line-height: 1.7;
}

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

.content li {
    margin-bottom: var(--space-2);
    line-height: 1.7;
}

.content li:last-child {
    margin-bottom: 0;
}


/* ================================================================
   Section Styles
   ================================================================ */
section {
    scroll-margin-top: calc(var(--header-height) + var(--space-4));
}


/* ================================================================
   App Screenshot
   ================================================================ */
.app-screenshot {
    text-align: center;
    margin-top: var(--space-12);
    margin-bottom: var(--space-8);
}

.app-screenshot img {
    max-width: 400px;
    height: auto;
    border-radius: var(--radius-xl);
    box-shadow:
        0 8px 16px rgba(0, 0, 0, 0.08),
        0 24px 48px rgba(0, 0, 0, 0.12);
    margin: 0 auto;
}

.app-screenshot img.screenshot-lg {
    max-width: 600px;
}


/* ================================================================
   Store Badges
   ================================================================ */
.store-badge {
    display: inline-block;
    transition: transform var(--transition-base), opacity var(--transition-base);
    border-radius: var(--radius-sm);
}

.store-badge:hover {
    transform: translateY(-3px);
    opacity: 0.9;
}

.store-badge img {
    height: 52px;
    width: auto;
    display: block;
}


/* ================================================================
   Page Links (Privacy, Terms)
   ================================================================ */
.page-links {
    margin-top: var(--space-10);
    font-size: 0.9375rem;
}

.page-links a {
    color: var(--color-text-muted);
    transition: color var(--transition-fast);
}

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

.page-links .separator {
    margin: 0 var(--space-3);
    color: var(--color-border);
}


/* ================================================================
   Trademark Notice
   ================================================================ */
.trademark-notice {
    text-align: center;
    max-width: 600px;
    margin: var(--space-6) auto 0 auto;
    padding-top: var(--space-4);
}

p.smaller, .smaller p, .smaller li {
    font-size: 0.8125rem;
}


/* ================================================================
   Utility Classes
   ================================================================ */
.text-muted {
    color: var(--color-text-muted);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 1px, 1px);
    white-space: nowrap;
    border: 0;
}


/* ================================================================
   Projects Grid (Index Page)
   ================================================================ */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-5);
    max-width: 720px;
    margin: 0 auto;
}

.project-card {
    display: flex;
    align-items: center;
    gap: var(--space-5);
    background: var(--color-bg);
    padding: var(--space-6);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-card);
    text-decoration: none;
    color: inherit;
    transition:
        box-shadow var(--transition-base),
        transform var(--transition-base),
        border-color var(--transition-base);
}

.project-card:hover {
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-2px);
    border-color: var(--color-primary-100);
    text-decoration: none;
}

.project-icon {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    flex-shrink: 0;
}

.project-info {
    flex: 1;
    min-width: 0;
}

.project-info h2 {
    font-size: 1.0625rem;
    font-weight: 700;
    margin: 0 0 var(--space-1) 0;
    text-align: left;
    color: var(--color-text);
}

.project-info p {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    margin: 0;
    line-height: 1.5;
}


/* ================================================================
   Contact Page
   ================================================================ */
.contact-card {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-10);
    margin: var(--space-10) auto;
    max-width: 480px;
    box-shadow: var(--shadow-card);
    text-align: center;
}

.contact-card h2 {
    margin-bottom: var(--space-2);
}

.contact-card p {
    color: var(--color-text-muted);
    margin-bottom: var(--space-6);
}


/* ================================================================
   404 Error Page
   ================================================================ */
.error-page {
    text-align: center;
    padding: var(--space-16) 0;
}

.error-code {
    font-size: 8rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.04em;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: var(--space-4);
}

.error-message {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: var(--space-2);
}

.error-description {
    font-size: 1.0625rem;
    color: var(--color-text-muted);
    margin-bottom: var(--space-8);
}


/* ================================================================
   Hamburger Menu
   ================================================================ */
.hamburger {
    display: none;
    font-size: 1.75rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--space-1) var(--space-2);
    line-height: 1;
    color: var(--color-text);
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

.hamburger:hover {
    background: var(--color-bg-muted);
}

.hamburger img {
    display: block;
    width: 24px;
    height: 24px;
}

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


/* ================================================================
   Responsive — Tablet (max 768px)
   ================================================================ */
@media (max-width: 768px) {
    :root {
        --header-height: 56px;
    }

    header .container {
        gap: 0;
    }

    .hamburger {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        margin-left: auto;
    }

    #main-nav {
        width: 100%;
        order: 3;
        overflow: hidden;
        max-height: 0;
        opacity: 0;
        transform: translateY(-8px);
        transition:
            max-height 250ms ease,
            opacity 200ms ease,
            transform 200ms ease;
    }

    #main-nav.open {
        max-height: 400px;
        opacity: 1;
        transform: translateY(0);
    }

    #main-nav ul {
        justify-content: flex-start;
        align-items: flex-start;
        gap: var(--space-2);
        flex-direction: column;
        padding-left: 0;
        padding-top: var(--space-2);
        padding-bottom: var(--space-4);
    }

    #main-nav li {
        margin: var(--space-1) 0;
        list-style: none;
    }

    main {
        padding: var(--space-8) 0;
    }

    h1 {
        font-size: 2rem;
        margin-bottom: var(--space-4);
    }

    h2 { font-size: 1.25rem; }
    h3 { font-size: 1rem; }

    .hero p,
    .hero-subtitle {
        font-size: 1rem;
    }

    .projects-grid {
        grid-template-columns: 1fr;
        max-width: 480px;
    }

    .project-card {
        padding: var(--space-5);
    }

    .content-centered p {
        font-size: 1rem;
    }

    .app-screenshot {
        margin-top: var(--space-8);
        margin-bottom: var(--space-6);
    }

    .app-screenshot img {
        width: 100%;
        max-width: 100%;
        border-radius: var(--radius-lg);
    }

    .button-group {
        margin: var(--space-8) 0 var(--space-4) 0;
    }

    .error-code {
        font-size: 5rem;
    }

    .error-message {
        font-size: 1.25rem;
    }

    .contact-card {
        padding: var(--space-8);
        margin: var(--space-8) auto;
    }
}


/* ================================================================
   Responsive — Small Mobile (max 480px)
   ================================================================ */
@media (max-width: 480px) {
    .container {
        padding: 0 var(--space-4);
    }

    h1 {
        font-size: 1.75rem;
    }

    .project-card {
        gap: var(--space-4);
        padding: var(--space-4);
    }

    .project-icon {
        width: 52px;
        height: 52px;
    }

    .store-badge img {
        height: 44px;
    }

    .error-code {
        font-size: 4rem;
    }

    .contact-card {
        padding: var(--space-6);
    }

    .contact-card .btn {
        font-size: 0.875rem;
        min-width: auto;
        padding: 0.625rem 1.25rem;
    }
}


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