/* ================================================================
   MONOPTERYX — Global Styles
   ================================================================ */

/* ── Reset & Custom Properties ─────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    /* ── Light mode (default) ──────────────────────────────── */
    --bg-900: #f4f4f9;
    --bg-800: #ededf4;
    --bg-700: #e4e4ef;
    --bg-600: #dbdbe9;
    --surface: #ffffff;
    --border: rgba(0, 0, 0, 0.09);
    --text-primary: #111122;
    --text-secondary: #565670;
    --text-muted: #8888a2;
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --shadow-card: 0 20px 60px rgba(0, 0, 0, 0.10);
    /* ── Theme-dependent surface tokens ────────────────────── */
    --header-bg: rgba(244, 244, 249, 0.88);
    --border-hover: rgba(0, 0, 0, 0.18);
    --card-back-border: rgba(0, 0, 0, 0.08);
    --btn-card-bg: rgba(99, 102, 241, 0.10);
    --btn-card-bg-hover: rgba(99, 102, 241, 0.18);
    --btn-card-border: rgba(99, 102, 241, 0.22);
    --btn-card-color: #111122;
    --card-badge-bg: rgba(0, 0, 0, 0.06);
    --card-badge-border: rgba(0, 0, 0, 0.10);
    --hero-glow-color: rgba(99, 102, 241, 0.12);
    /* ── Structural (theme-independent) ────────────────────── */
    --card-h: 320px;
    --transition-flip: 0.65s cubic-bezier(0.4, 0, 0.2, 1);
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --radius-card: 20px;
}

/* ── Dark mode override ─────────────────────────────────────── */
html.dark {
    --bg-900: #0a0a0f;
    --bg-800: #111118;
    --bg-700: #18181f;
    --bg-600: #22222c;
    --surface: #1c1c26;
    --border: rgba(255, 255, 255, 0.08);
    --text-primary: #f1f1f5;
    --text-secondary: #9191a8;
    --text-muted: #5a5a72;
    --accent-hover: #818cf8;
    --shadow-card: 0 20px 60px rgba(0, 0, 0, 0.5);
    --header-bg: rgba(10, 10, 15, 0.85);
    --border-hover: rgba(255, 255, 255, 0.18);
    --card-back-border: rgba(255, 255, 255, 0.10);
    --btn-card-bg: rgba(255, 255, 255, 0.15);
    --btn-card-bg-hover: rgba(255, 255, 255, 0.25);
    --btn-card-border: rgba(255, 255, 255, 0.25);
    --btn-card-color: #ffffff;
    --card-badge-bg: rgba(255, 255, 255, 0.08);
    --card-badge-border: rgba(255, 255, 255, 0.14);
    --hero-glow-color: rgba(99, 102, 241, 0.18);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-900);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color 0.25s ease, color 0.25s ease;
}

/* ── Typography helpers ─────────────────────────────────────── */
.gradient-text {
    background: linear-gradient(135deg, #6366f1, #a855f7, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ── Layout ─────────────────────────────────────────────────── */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1.25rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    white-space: nowrap;
}

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

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.btn-outline {
    background: transparent;
    color: var(--text-primary);
    border-color: var(--border);
}

.btn-outline:hover {
    background: var(--bg-700);
    border-color: var(--border-hover);
}

.btn-lg {
    padding: 0.85rem 2rem;
    font-size: 1rem;
    border-radius: 10px;
}

.btn-card-primary {
    background: var(--btn-card-bg);
    color: var(--btn-card-color);
    border: 1px solid var(--btn-card-border);
    border-radius: 8px;
    padding: 0.6rem 1.4rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(8px);
}

.btn-card-primary:hover {
    background: var(--btn-card-bg-hover);
    transform: translateY(-1px);
}

/* ── Header ──────────────────────────────────────────────────── */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--header-bg);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    gap: 1rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.1rem;
}

.logo-icon {
    font-size: 1.4rem;
}

.logo-img {
    height: 144px;
    width: auto;
    display: block;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-link {
    padding: 0.4rem 0.8rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    border-radius: 6px;
    transition: color 0.2s;
}

.nav-link:hover {
    color: var(--text-primary);
}

/* ── Hero ────────────────────────────────────────────────────── */
.hero {
    position: relative;
    padding: 7rem 0 6rem;
    text-align: center;
    overflow: hidden;
}

.hero-glow {
    position: absolute;
    top: -200px;
    left: 50%;
    transform: translateX(-50%);
    width: 800px;
    height: 600px;
    background: radial-gradient(ellipse at center, var(--hero-glow-color) 0%, transparent 70%);
    pointer-events: none;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.9rem;
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 100px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #a5b4fc;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
}

.hero-title {
    font-size: clamp(2.5rem, 5vw, 4.5rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.03em;
    margin-bottom: 1.25rem;
}

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

/* ── Apps Section ────────────────────────────────────────────── */
.apps-section {
    padding: 5rem 0 8rem;
}

.section-title {
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.5rem;
}

.section-subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 3.5rem;
    font-size: 1rem;
}

/* ── Cards Grid ──────────────────────────────────────────────── */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

/* ── Flip Card ───────────────────────────────────────────────── */
.flip-card {
    perspective: 1200px;
    height: var(--card-h);
    cursor: pointer;
    border-radius: var(--radius-card);
}

.flip-card:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform var(--transition-flip);
    border-radius: var(--radius-card);
}

.flip-card.flipped .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
    position: absolute;
    inset: 0;
    border-radius: var(--radius-card);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.75rem;
    gap: 0.6rem;
}

/* ── Card Front ──────────────────────────────────────────────── */
.flip-card-front {
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-card);
    text-align: center;
}

.flip-card-front::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--card-color), transparent);
    border-radius: var(--radius-card) var(--radius-card) 0 0;
}

.card-glow {
    position: absolute;
    top: -80px;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 200px;
    background: radial-gradient(ellipse at center, var(--card-color) 0%, transparent 70%);
    opacity: 0.12;
    pointer-events: none;
    transition: opacity 0.3s;
}

.flip-card:hover .card-glow {
    opacity: 0.22;
}

.card-icon {
    font-size: 2.5rem;
    line-height: 1;
    margin-bottom: 0.25rem;
}

.card-name {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
}

.card-tagline {
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-align: center;
}

.card-hint {
    color: var(--text-muted);
    font-size: 0.78rem;
    position: absolute;
    bottom: 1.25rem;
    letter-spacing: 0.02em;
    transition: color 0.2s;
}

.flip-card:hover .card-hint {
    color: var(--text-secondary);
}

/* ── Card Back ───────────────────────────────────────────────── */
.flip-card-back {
    transform: rotateY(180deg);
    background: linear-gradient(135deg, var(--bg-700) 0%, var(--surface) 100%);
    border: 1px solid var(--card-back-border);
    box-shadow: var(--shadow-card);
    text-align: center;
    gap: 0;
}

.flip-card-back::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--card-color), transparent);
    border-radius: var(--radius-card) var(--radius-card) 0 0;
}

.card-badge {
    display: inline-flex;
    padding: 0.2rem 0.7rem;
    background: var(--card-badge-bg);
    border: 1px solid var(--card-badge-border);
    border-radius: 100px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.flip-card-back .card-name {
    font-size: 1.2rem;
    margin-bottom: 0.75rem;
}

.card-description {
    color: var(--text-secondary);
    font-size: 0.825rem;
    line-height: 1.65;
    margin-bottom: 1.5rem;
    flex: 1;
    display: flex;
    align-items: center;
}

.card-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
}

.card-hint--back {
    position: static;
    font-size: 0.73rem;
}

/* ── Footer ──────────────────────────────────────────────────── */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 2rem 0;
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.footer-copy {
    color: var(--text-muted);
    font-size: 0.83rem;
}

.footer-copy a {
    color: var(--text-secondary);
    text-decoration: none;
}

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

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

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

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

/* ── Theme Toggle ───────────────────────────────────────────── */
.theme-toggle {
    padding: 0.4rem 0.55rem;
    min-width: 36px;
    justify-content: center;
    font-size: 1rem;
    line-height: 1;
}

/* ── About Modal ────────────────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.modal-overlay.active {
    display: flex;
}

.modal-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.35);
    max-width: 720px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 2.5rem;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 1.1rem;
    right: 1.25rem;
    background: none;
    border: none;
    font-size: 1.6rem;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s;
    padding: 0.2rem 0.4rem;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-images {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    margin-bottom: 2rem;
}

.modal-photo {
    width: 160px;
    height: 160px;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid var(--accent);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.25);
    flex-shrink: 0;
}

.modal-logo-img {
    height: 120px;
    width: auto;
    object-fit: contain;
    flex-shrink: 0;
}

.modal-bio {
    margin-bottom: 1.75rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.7;
}

.modal-bio strong {
    color: var(--text-primary);
}

.modal-bio ul {
    margin: 0.75rem 0 0 1.25rem;
}

.modal-bio ul li {
    margin-bottom: 0.3rem;
}

.modal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.modal-table tr {
    border-top: 1px solid var(--border);
}

.modal-table td {
    padding: 0.6rem 0.5rem;
    vertical-align: top;
}

.modal-table td:first-child {
    color: var(--text-muted);
    white-space: nowrap;
    padding-right: 1.5rem;
    width: 40%;
}

.modal-table td:last-child {
    color: var(--text-primary);
    font-weight: 500;
}

.modal-table a {
    color: var(--accent);
    text-decoration: none;
}

.modal-table a:hover {
    text-decoration: underline;
}

@media (max-width: 600px) {
    .modal-images {
        flex-direction: column;
        align-items: center;
    }

    .modal-photo {
        width: 120px;
        height: 120px;
    }

    .modal-logo-img {
        height: 80px;
    }

    .modal-box {
        padding: 1.5rem;
    }
}

/* ── Inquiries Modal / Contact Form ─────────────────────────── */
.modal-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.35rem;
}

.modal-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0 0 1.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-group input,
.form-group textarea,
.form-group select {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    padding: 0.65rem 0.85rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    width: 100%;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.form-group textarea {
    resize: vertical;
    min-height: 110px;
}

.btn-full {
    width: 100%;
    justify-content: center;
    margin-top: 0.25rem;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.form-result {
    font-size: 0.875rem;
    margin-top: 0.75rem;
    min-height: 1.2em;
    text-align: center;
}

.form-result--ok {
    color: #22c55e;
}

.form-result--err {
    color: #ef4444;
}

@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 900px) {
    .cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .cards-grid {
        grid-template-columns: 1fr;
    }

    :root {
        --card-h: 280px;
    }

    .site-nav .btn-outline,
    .site-nav .nav-link:not(:last-child) {
        display: none;
    }

    .hero {
        padding: 4rem 0 3rem;
    }
}