/*
Theme Name: SerbAI
Theme URI:
Author: SerbAI
Author URI:
Description: A clean, minimal custom theme for SerbAI.
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: serbai
*/

/* ── Variables ──────────────────────────────────────────────────── */
:root {
    --ca:  #06B6D4;
    --cb:  #ffffff;
    --ct:  #0a0a0a;
    --ctr: rgba(10,10,10,0.48);
}

/* ── Reset ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; overflow-x: hidden; }

body.serbai-body {
    min-height: 100%;
    background: var(--cb);
    color: var(--ct);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    overflow-y: auto;
    overflow-x: hidden;
    max-width: 100vw;
}

/* ── Scanner canvas ─────────────────────────────────────────────── */
#serbai-canvas {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 0;
    display: block;
}

/* ── Language switcher ──────────────────────────────────────────── */
.lang-switcher {
    position: fixed;
    top: 1.5rem;
    right: 2rem;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 0.15rem;
}

.lang-btn {
    background: none;
    border: none;
    color: rgba(10,10,10,0.28);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    transition: color 0.2s;
    line-height: 1;
}
.lang-btn.active             { color: var(--ca); }
.lang-btn:hover:not(.active) { color: var(--ct); }

.lang-sep {
    color: rgba(10,10,10,0.14);
    font-size: 0.68rem;
    pointer-events: none;
}

/* ── Hero ───────────────────────────────────────────────────────── */
.hero-section {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    text-align: center;
    padding: 2rem 1.5rem;
}

.hero-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.6rem;
    max-width: 800px;
    width: 100%;
    will-change: transform;
}

/* ── Wordmark + glitch ──────────────────────────────────────────── */
.hero-wordmark {
    position: relative;
    display: inline-block;
    font-size: 0.72rem;
    letter-spacing: 0.5em;
    color: var(--ca);
    font-weight: 700;
    text-transform: none;
    transform-origin: center center;
    opacity: 0;
    animation: fadeUp 0.7s ease 0.1s both;
    will-change: transform;
}
.hero-wordmark::before,
.hero-wordmark::after {
    content: attr(data-text);
    position: absolute;
    inset: 0;
    opacity: 0;
}
.hero-wordmark::before {
    color: var(--ca);
    animation: glitchA 6s steps(1) infinite;
}
.hero-wordmark::after {
    color: #ef4444;
    animation: glitchB 6s steps(1) infinite;
}

/* ── Headline + cursor ──────────────────────────────────────────── */
.hero-headline {
    font-size: clamp(2rem, 5.5vw, 3.6rem);
    font-weight: 800;
    line-height: 1.13;
    color: var(--ct);
    letter-spacing: -0.025em;
    opacity: 0;
    animation: fadeUp 0.7s ease 0.35s both;
    min-height: 1.3em;
}
.hero-cursor {
    display: inline-block;
    color: var(--ca);
    font-weight: 300;
    margin-left: 2px;
    animation: blink 0.9s step-end infinite;
}

/* ── Subheading ─────────────────────────────────────────────────── */
.hero-sub {
    font-size: clamp(1rem, 2.2vw, 1.15rem);
    color: var(--ctr);
    line-height: 1.65;
    max-width: 560px;
    opacity: 0;
    animation: fadeUp 0.7s ease 0.55s both;
}

/* ── Access button ──────────────────────────────────────────────── */
.access-btn {
    margin-top: 0.4rem;
    background: var(--ca);
    color: #ffffff;
    border: none;
    border-radius: 9999px;
    padding: 1rem 2.6rem;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    cursor: pointer;
    opacity: 0;
    animation: fadeUp 0.7s ease 0.75s both,
               cyanPulse 3.2s ease-in-out 1.5s infinite;
    transition: transform 0.15s, opacity 0.25s;
    min-height: 48px;
    position: relative;
    z-index: 2;
}
.access-btn:hover                   { transform: scale(1.04); }
.access-btn.card-open               { opacity: 0 !important; pointer-events: none !important; animation: none !important; }

/* ════════════════════════════════════════════════════════════════
   ACCESS CARD — morphs from button
   ════════════════════════════════════════════════════════════════ */

/* Subtle backdrop — canvas & headline visible through it */
.card-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9;
    background: rgba(255,255,255,0.55);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
}
.card-backdrop.open {
    opacity: 1;
    pointer-events: all;
}

.access-card {
    position: fixed;
    top: 50%;
    left: 50%;
    /* start scaled to zero at button origin (set via JS) */
    transform: translate(-50%, -50%) scale(0);
    transform-origin: 50% calc(50% + 120px); /* fallback; overridden by JS */
    z-index: 10;
    display: none;
    width: min(420px, 94vw);
    background: #ffffff;
    border: 1.5px solid rgba(6,182,212,0.35);
    border-radius: 22px;
    box-shadow:
        0 0 0 6px rgba(6,182,212,0.09),
        0 24px 64px rgba(0,0,0,0.09);
    padding: 2.4rem 2.1rem 2rem;
    overflow: hidden;
    transition:
        transform 0.44s cubic-bezier(0.34, 1.46, 0.64, 1),
        opacity   0.3s ease;
    opacity: 0;
}
.access-card.open {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

/* Close button */
.card-close {
    position: absolute;
    top: 1.1rem;
    right: 1.3rem;
    background: none;
    border: none;
    color: rgba(10,10,10,0.22);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    transition: color 0.2s, transform 0.2s;
    padding: 0.2rem 0.4rem;
}
.card-close:hover { color: var(--ct); transform: scale(1.1); }

/* Panel wrapper */
.card-panel { display: flex; flex-direction: column; }
.card-panel[hidden] { display: none; }

/* Stagger children on reveal */
.card-panel > * {
    opacity: 0;
}

/* Title */
.card-title {
    font-size: 1.18rem;
    font-weight: 800;
    color: var(--ca);
    margin-bottom: 1.6rem;
    line-height: 1.25;
    letter-spacing: -0.01em;
}
.card-title .sep { color: rgba(6,182,212,0.4); font-weight: 400; margin: 0 0.3em; }
.card-title em   { font-style: normal; color: rgba(6,182,212,0.55); font-weight: 600; }

/* Inputs — bottom border only */
.card-input {
    display: block;
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 1.5px solid rgba(10,10,10,0.14);
    border-radius: 0;
    padding: 0.78rem 0;
    color: var(--ct);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
    min-height: 48px;
    margin-bottom: 0.85rem;
}
.card-input:focus        { border-bottom-color: var(--ca); }
.card-input::placeholder { color: rgba(10,10,10,0.28); }

/* Submit */
.card-submit {
    display: block;
    width: 100%;
    background: var(--ca);
    color: #ffffff;
    border: none;
    border-radius: 11px;
    padding: 0.95rem 1rem;
    font-size: 0.83rem;
    font-weight: 800;
    letter-spacing: 0.07em;
    cursor: pointer;
    min-height: 48px;
    margin-top: 0.2rem;
    animation: cyanPulse 3s ease-in-out 0.8s infinite;
    transition: opacity 0.2s;
}
.card-submit:hover    { opacity: 0.88; }
.card-submit:disabled { opacity: 0.4; cursor: not-allowed; animation: none; }

/* Link row */
.card-link-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.9rem;
    flex-wrap: wrap;
    gap: 0.4rem;
}
.card-link-row.centered { justify-content: center; }

.card-link {
    background: none;
    border: none;
    color: rgba(10,10,10,0.38);
    font-size: 0.77rem;
    cursor: pointer;
    transition: color 0.2s;
    padding: 0;
    text-align: left;
    line-height: 1.5;
}
.card-link:hover { color: var(--ca); }

/* Message */
.card-msg {
    font-size: 0.77rem;
    text-align: center;
    min-height: 1.1em;
    margin-top: 0.8rem;
    color: rgba(10,10,10,0.4);
}
.card-msg.err { color: #dc2626; }
.card-msg.ok  { color: #16a34a; }

/* ── Keyframes ──────────────────────────────────────────────────── */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0);    }
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0; }
}

@keyframes cyanPulse {
    0%,  100% { box-shadow: 0 0  0   0   rgba(6,182,212,0);    }
    50%        { box-shadow: 0 0 28px 10px rgba(6,182,212,0.32); }
}

@keyframes glitchA {
    0%, 87%    { opacity: 0; transform: none; clip-path: none; }
    88%        { opacity: 0.7; transform: translate(-3px, 0);
                 clip-path: polygon(0 20%, 100% 20%, 100% 45%, 0 45%); }
    89%        { opacity: 0;   transform: none; clip-path: none; }
    90%        { opacity: 0.6; transform: translate(2px, 0);
                 clip-path: polygon(0 60%, 100% 60%, 100% 80%, 0 80%); }
    91%, 100%  { opacity: 0;   transform: none; clip-path: none; }
}

@keyframes glitchB {
    0%, 87%    { opacity: 0; transform: none; clip-path: none; }
    88%        { opacity: 0.5; transform: translate(3px, 0);
                 clip-path: polygon(0 55%, 100% 55%, 100% 75%, 0 75%); }
    89%        { opacity: 0;   transform: none; clip-path: none; }
    90%        { opacity: 0.5; transform: translate(-2px, 0);
                 clip-path: polygon(0 15%, 100% 15%, 100% 35%, 0 35%); }
    91%, 100%  { opacity: 0;   transform: none; clip-path: none; }
}

@keyframes cardItemIn {
    from { opacity: 0; transform: translateY(11px); }
    to   { opacity: 1; transform: translateY(0);    }
}

/* ── Admin bar ──────────────────────────────────────────────────── */
#wpadminbar { z-index: 300 !important; }

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 600px) {
    /* ── Language switcher — larger tap targets ── */
    .lang-switcher { top: 0.75rem; right: 0.75rem; gap: 0; }
    .lang-btn {
        min-width:  44px;
        min-height: 44px;
        padding: 0.5rem 0.55rem;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* ── Hero ── */
    .hero-section { padding: 1.5rem 1rem; }
    .hero-headline { letter-spacing: -0.015em; }
    .hero-sub { font-size: 0.93rem; }

    /* ── Access button ── */
    .access-btn { min-width: min(300px, 85vw); }

    /* ── Access card — fits viewport, scrolls internally ── */
    .access-card {
        width: min(420px, 90vw);
        padding: 1.8rem 1.25rem 1.5rem;
        max-height: 88dvh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* 1rem prevents iOS auto-zoom on input focus */
    .card-input { font-size: 1rem; }

    /* ── Card link tap targets ── */
    .card-link {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }
    .card-link-row { flex-direction: column; align-items: flex-start; gap: 0.3rem; }
    .card-link-row.centered { align-items: center; }
}

@media (max-width: 400px) {
    .hero-wordmark { letter-spacing: 0.3em; font-size: 0.66rem; }
    .access-card   { width: 94vw; }
    .card-title    { font-size: 1.05rem; }
}
