/* =========================================
   ANALEMMA LABS - CORE STYLESHEET
   ========================================= */

:root {
    /* Light Theme Variables */
    --bg-primary: #fcfcfc;
    --bg-secondary: #f4f4f6;
    --text-primary: #1a1a1a;
    --text-secondary: #606065;
    --accent-color: #d49a36; /* Golden ratio accent */
    --border-color: #e5e5e5;
    --header-bg: rgba(252, 252, 252, 0.85);
    --card-bg: #ffffff;
    --transition-speed: 0.3s;
    --font-main: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --font-mono: 'Courier New', Courier, monospace;
    --color-scheme: light;
}

[data-theme="dark"] {
    /* Dark Theme Variables */
    --bg-primary: #0a0a0c;
    --bg-secondary: #121215;
    --text-primary: #f0f0f0;
    --text-secondary: #a0a0a0;
    --accent-color: #dfa849;
    --border-color: #1f1f24;
    --header-bg: rgba(10, 10, 12, 0.85);
    --card-bg: #141418;
    --color-scheme: dark;
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    max-width: 100%;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    color-scheme: var(--color-scheme, light);
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease;
    -webkit-font-smoothing: antialiased;
    max-width: 100%;
    overflow-x: hidden;
}

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

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

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

/* Typography */
h1, h2, h3 {
    font-weight: 300;
    letter-spacing: -0.01em;
}

h2 {
    font-size: 1.8rem;
    margin-bottom: 2rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    position: relative;
    display: inline-block;
}

h2::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 0;
    width: 30px;
    height: 1px;
    background-color: var(--accent-color);
}

/* Header & Navigation */
.main-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 3rem;
    background-color: var(--header-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    transition: background-color var(--transition-speed) ease, border-color var(--transition-speed) ease;
}

.logo-wrapper {
    display: flex;
    align-items: center;
}

.brand-logo {
    height: 38px;
    width: auto;
}

/* Desktop: stronger brand mark without changing header height or mobile sizing */
@media (min-width: 721px) {
    .brand-logo {
        height: 48px;
    }
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 2.5rem;
}

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

.main-nav ul li a {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 500;
    color: var(--text-secondary);
}

.main-nav ul li a:hover {
    color: var(--text-primary);
}

/* Theme Toggle Button */
#theme-toggle {
    background: none;
    border: 1px solid var(--border-color);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    transition: all var(--transition-speed) ease;
}

#theme-toggle:hover {
    border-color: var(--accent-color);
}

.toggle-icon {
    display: block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--text-primary);
    transition: background-color var(--transition-speed) ease;
}

/* Hero Section */
.hero-section {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 0 2rem;
    background: radial-gradient(circle at center, var(--bg-secondary) 0%, var(--bg-primary) 100%);
}

.hero-content {
    max-width: 800px;
}

.hero-content h1 {
    font-size: 3.5rem;
    margin-bottom: 1.5rem;
    line-height: 1.1;
}

.hero-content p {
    font-size: 1.15rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    max-width: 600px;
    margin: 0 auto;
}

/* Content Sections & Grid Layout */
.content-section {
    padding: 6rem 3rem;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-primary);
    transition: background-color var(--transition-speed) ease, border-color var(--transition-speed) ease;
}

.content-section:nth-of-type(even) {
    background-color: var(--bg-secondary);
}

.section-container {
    max-width: 1200px;
    margin: 0 auto;
}

.grid-layout {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
    margin-top: 1rem;
}

/* Card Component */
.card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 2.5rem;
    border-radius: 4px;
    transition: transform var(--transition-speed) ease, border-color var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
}

.card:hover {
    border-color: var(--accent-color);
    transform: translateY(-2px);
}

.card h3 {
    font-size: 1.4rem;
    margin-bottom: 1rem;
    font-weight: 400;
}

.card p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    text-align: justify;
}

/* Featured Experience */
.featured-card {
    padding: 3rem;
}

.featured-card__label {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--accent-color);
    margin-bottom: 1rem;
}

.featured-card p {
    max-width: 720px;
    line-height: 1.7;
}

.featured-card__actions {
    margin-top: 2rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.5rem;
}

.featured-card__link {
    color: var(--text-secondary);
    font-size: 0.9rem;
    letter-spacing: 0.05em;
    text-decoration: none;
    transition: color var(--transition-speed) ease;
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0.35rem 0;
    box-sizing: border-box;
}

.featured-card__link:hover {
    color: var(--accent-color);
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 2.5rem;
    min-height: 44px;
    background-color: var(--text-primary);
    color: var(--bg-primary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: bold;
    font-size: 0.85rem;
    border-radius: 4px;
    transition: transform var(--transition-speed) ease;
    text-decoration: none;
}

.btn-primary:hover {
    transform: translateY(-2px);
    color: var(--bg-primary);
}

.product-title {
    font-size: clamp(2rem, 5vw, 3rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    font-weight: 600;
}

/* Product hero: wordmark carries the name; keep H1 for accessibility only */
/* Screen-reader-only utility (visually hidden, still announced/indexed). */
.visually-hidden,
.product-hero > .product-title {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.product-hero {
    position: relative;
}

.product-logotype-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 2rem;
    min-height: 72px;
    max-width: min(480px, 90vw);
}

.product-logotype {
    display: block;
    height: auto;
    max-height: 140px;
    width: auto;
    max-width: 100%;
}

.product-logotype--on-light {
    display: none;
}

html:not([data-theme="dark"]) .product-logotype--on-dark {
    display: none;
}

html:not([data-theme="dark"]) .product-logotype--on-light {
    display: block;
}

[data-theme="dark"] .product-logotype--on-light {
    display: none;
}

[data-theme="dark"] .product-logotype--on-dark {
    display: block;
}

.bento-item__label {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 1.25rem;
    text-align: center;
    font-size: 0.9rem;
    line-height: 1.35;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.bento-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    max-width: 1200px;
    margin: 4rem auto;
}

.bento-item {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    aspect-ratio: 16 / 9;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    transition: border-color var(--transition-speed) ease;
}

.bento-item:hover {
    border-color: var(--accent-color);
}

/* Footer */
.main-footer {
    background-color: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    padding: 3rem;
    transition: background-color var(--transition-speed) ease, border-color var(--transition-speed) ease;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.footer-legal {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.footer-legal p:last-child {
    margin-top: 0.2rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
}

.footer-links {
    display: flex;
    gap: 2rem;
}

.footer-links a {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

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

/* Responsive Design — tablet + product grids */
@media (max-width: 768px) {
    .bento-grid,
    .grid-layout,
    .product-grid,
    .cards-grid,
    .workflow-steps {
        grid-template-columns: 1fr !important;
    }

    .bento-grid > *,
    .grid-layout > *,
    .product-grid > *,
    .cards-grid > *,
    .workflow-steps > *,
    .bento-item {
        grid-column: auto !important;
        grid-row: auto !important;
        min-width: 0;
    }

    .content-section {
        padding: 4rem 1.5rem;
    }

    .footer-content {
        flex-direction: column;
        text-align: center;
    }

    .footer-links {
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.75rem 1.25rem;
    }

    .featured-card__link {
        min-height: 44px;
        padding: 0.65rem 0.25rem;
        box-sizing: border-box;
    }
}

/* Responsive Design — mobile phone */
@media (max-width: 720px) {
    .main-header {
        padding: 0.75rem 1rem;
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .logo-wrapper {
        justify-content: center;
        /* G: logo leads the hierarchy — a touch more breathing room */
        padding-bottom: 0.15rem;
    }

    .brand-logo {
        /* G: larger + crisper so the wordmark reads clearly on mobile */
        height: 42px;
    }

    .main-nav {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
        max-width: 100%;
        width: 100%;
        /* G: subtle divider sets nav below the logo in the hierarchy */
        border-top: 1px solid var(--border-color);
        padding-top: 0.5rem;
    }

    .main-nav ul {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.25rem 0.5rem;
        max-width: 100%;
        width: 100%;
    }

    .main-nav ul li {
        display: flex;
        justify-content: center;
    }

    .main-nav ul li a {
        width: 100%;
        justify-content: center;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        padding: 0.15rem 0.1rem;
        font-size: 0.68rem;
        letter-spacing: 0.06em;
        text-align: center;
    }

    .nav-controls {
        justify-content: center !important;
        gap: 1rem !important;
    }

    .lang-selector {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }

    .lang-selector a,
    .lang-selector span {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }

    #theme-toggle {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
    }

    .hero-section {
        min-height: auto;
        padding: 14rem 1.25rem 3rem;
        justify-content: flex-start;
    }

    .hero-content h1 {
        font-size: clamp(1.75rem, 8vw, 2.2rem);
    }

    .product-hero,
    .manifesto-hero {
        padding: 14rem 1.25rem 3rem !important;
    }

    .product-hero img[style*="height: 120px"] {
        height: auto !important;
        max-height: 72px !important;
        width: auto;
        max-width: min(100%, 280px);
    }

    .content-section[style*="padding-top: 10rem"] {
        padding-top: 14rem !important;
    }

    .product-hero h1:not(.product-title),
    .manifesto-hero h1 {
        font-size: clamp(1.75rem, 8vw, 2.5rem) !important;
    }

    .featured-card {
        padding: 2rem 1.5rem;
    }

    .footer-links a {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }

    .card {
        padding: 1.75rem;
    }
}

/* Landscape phone — compact hero offset when header stays single-row */
@media (max-height: 500px) and (min-width: 721px) {
    .hero-section {
        min-height: auto;
        padding: 7rem 1.5rem 2rem;
        justify-content: center;
    }

    .product-hero,
    .manifesto-hero {
        padding: 7rem 1.5rem 2rem !important;
    }

    .content-section[style*="padding-top: 10rem"] {
        padding-top: 7rem !important;
    }
}
