/* CipherSpy - Design System
   Adapted from Future Folio template (licensed)
   ============================================= */

/* Fonts - Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter+Tight:wght@400;700;800&family=Roboto+Mono:wght@400;600&display=swap');

/* Custom Fonts */
@font-face {
    font-family: 'Squiver';
    src: url('../assets/fonts/squiver.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* =============================================
   CSS Custom Properties
   ============================================= */
:root {
    /* Wordmark Font */
    --font-wordmark: 'Squiver', var(--font-display);

    /* Colors - Dark Theme */
    --color-bg: #000;
    --color-bg-raised: #141414;
    --color-bg-elevated: #292929;

    --color-text: #fff;
    --color-text-muted: #a3a3a3;
    --color-text-subtle: #525252;

    --color-border: #3d3d3d;
    --color-border-subtle: #292929;

    /* Accent - Cyan (can swap to orange-red #f20 for alternate) */
    --color-accent: #0df;
    --color-accent-alpha: #00ddff5c;

    /* Typography */
    --font-display: 'Inter Tight', 'Inter', system-ui, sans-serif;
    --font-mono: 'Roboto Mono', ui-monospace, monospace;

    /* Type Scale */
    --text-hero: clamp(64px, 12vw, 152px);
    --text-headline: clamp(48px, 8vw, 64px);
    --text-title: clamp(32px, 5vw, 48px);
    --text-body: 20px;
    --text-small: 14px;

    /* Letter Spacing */
    --tracking-tight: -0.04em;
    --tracking-normal: 0;
    --tracking-wide: 0.02em;

    /* Line Heights */
    --leading-none: 1;
    --leading-tight: 1.1;
    --leading-normal: 1.4;
    --leading-relaxed: 1.6;

    /* Spacing */
    --space-xs: 8px;
    --space-sm: 16px;
    --space-md: 24px;
    --space-lg: 40px;
    --space-xl: 64px;
    --space-2xl: 120px;

    /* Layout */
    --container-max: 1200px;
    --container-padding: clamp(24px, 5vw, 40px);

    /* Animation */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --duration-fast: 150ms;
    --duration-normal: 300ms;
    --duration-slow: 500ms;
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    min-height: 100vh;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-mono);
    font-size: var(--text-body);
    line-height: var(--leading-relaxed);
}

/* =============================================
   Typography
   ============================================= */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: var(--tracking-tight);
    line-height: var(--leading-none);
}

h1, .text-hero {
    font-size: var(--text-hero);
}

h2, .text-headline {
    font-size: var(--text-headline);
}

h3, .text-title {
    font-size: var(--text-title);
    font-weight: 700;
}

p {
    color: var(--color-text-muted);
}

.text-mono {
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
}

/* Wordmark - CipherSpy logo text */
.wordmark {
    font-family: var(--font-wordmark);
    font-weight: normal;
    text-transform: none;
    letter-spacing: normal;
}

/* Glitch Effect */
.glitch {
    position: relative;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--color-bg);
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
}

.glitch::before {
    left: 2px;
    text-shadow: -2px 0 var(--color-accent);
    animation: glitch-1 3s infinite linear alternate-reverse;
    clip-path: inset(40% 0 61% 0);
}

.glitch::after {
    left: -2px;
    text-shadow: 2px 0 #f20;
    animation: glitch-2 2s infinite linear alternate-reverse;
    clip-path: inset(92% 0 1% 0);
}

@keyframes glitch-1 {
    0% { clip-path: inset(40% 0 61% 0); }
    10% { clip-path: inset(92% 0 1% 0); transform: translate(-2px); }
    20% { clip-path: inset(43% 0 1% 0); transform: translate(2px); }
    30% { clip-path: inset(25% 0 58% 0); transform: translate(-1px); }
    40% { clip-path: inset(54% 0 7% 0); transform: translate(1px); }
    50% { clip-path: inset(58% 0 43% 0); transform: translate(-2px); }
    60% { clip-path: inset(15% 0 70% 0); transform: translate(2px); }
    70% { clip-path: inset(80% 0 5% 0); transform: translate(-1px); }
    80% { clip-path: inset(35% 0 50% 0); transform: translate(1px); }
    90% { clip-path: inset(70% 0 15% 0); transform: translate(-2px); }
    100% { clip-path: inset(5% 0 85% 0); transform: translate(2px); }
}

@keyframes glitch-2 {
    0% { clip-path: inset(25% 0 58% 0); }
    10% { clip-path: inset(54% 0 7% 0); transform: translate(2px); }
    20% { clip-path: inset(58% 0 43% 0); transform: translate(-2px); }
    30% { clip-path: inset(40% 0 61% 0); transform: translate(1px); }
    40% { clip-path: inset(92% 0 1% 0); transform: translate(-1px); }
    50% { clip-path: inset(43% 0 1% 0); transform: translate(2px); }
    60% { clip-path: inset(85% 0 5% 0); transform: translate(-2px); }
    70% { clip-path: inset(10% 0 75% 0); transform: translate(1px); }
    80% { clip-path: inset(60% 0 20% 0); transform: translate(-1px); }
    90% { clip-path: inset(30% 0 55% 0); transform: translate(2px); }
    100% { clip-path: inset(75% 0 10% 0); transform: translate(-2px); }
}

/* =============================================
   Links & Buttons
   ============================================= */
a {
    color: var(--color-accent);
    text-decoration: none;
    transition: color var(--duration-fast) var(--ease-out);
}

a:hover {
    text-decoration: underline;
    text-underline-offset: 4px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-sm) var(--space-md);
    font-family: var(--font-mono);
    font-size: var(--text-small);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-text);
    cursor: pointer;
    transition: all var(--duration-normal) var(--ease-out);
}

.btn:hover {
    background: var(--color-text);
    color: var(--color-bg);
    text-decoration: none;
}

.btn-accent {
    border-color: var(--color-accent);
    color: var(--color-accent);
}

.btn-accent:hover {
    background: var(--color-accent);
    color: var(--color-bg);
}

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

.section {
    padding: var(--space-2xl) 0;
}

.grid {
    display: grid;
    gap: var(--space-lg);
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

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

/* =============================================
   Hero / Coming Soon
   ============================================= */
/* MeshNet Background */
.mesh-bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
}

/* Hero Background */
.hero-bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
}

.hero-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.15;
    filter: grayscale(50%);
}

.hero-bg-grain {
    position: absolute;
    inset: 0;
    opacity: 0.4;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    animation: hero-grain 0.5s steps(10) infinite;
}

@keyframes hero-grain {
    0%, 100% { transform: translate(0, 0); }
    20% { transform: translate(-2%, -4%); }
    40% { transform: translate(4%, 2%); }
    60% { transform: translate(-3%, 5%); }
    80% { transform: translate(5%, -3%); }
}

/* Hero gradient overlay for text readability */
.hero-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, transparent 0%, var(--color-bg) 70%);
}

.hero {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    text-align: center;
    padding: var(--space-lg);
    padding-bottom: 15vh; /* Shift content upward */
}

.hero h1 {
    font-size: clamp(64px, 14vw, 120px);
    margin-bottom: var(--space-xl);
}

.description {
    font-family: var(--font-mono);
    font-size: 18px;
    line-height: 1.7;
    max-width: 520px;
    text-align: center;
    color: var(--color-text-muted);
    margin-bottom: var(--space-md);
}

.description strong {
    color: var(--color-text);
    font-weight: 600;
}

.description em {
    color: var(--color-accent);
    font-style: normal;
}

.tagline {
    font-family: var(--font-mono);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
    color: var(--color-text-subtle);
}

.hero-nav {
    margin-top: var(--space-xl);
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    justify-content: center;
}

/* Logo placeholder */
.logo {
    width: 120px;
    height: 120px;
    margin-bottom: var(--space-lg);
    /* Replace with actual logo */
}

/* =============================================
   Audio Toggle
   ============================================= */
.audio-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--color-bg-raised);
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
    font-size: 20px;
    cursor: pointer;
    z-index: 100;
    transition: all var(--duration-normal) var(--ease-out);
}

.audio-toggle:hover {
    background: var(--color-bg-elevated);
    color: var(--color-text);
}

.audio-toggle.playing {
    color: var(--color-accent);
    border-color: var(--color-accent);
}

.audio-toggle.playing .audio-icon {
    animation: pulse 1s ease-in-out infinite;
}

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

/* =============================================
   Utilities
   ============================================= */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-accent { color: var(--color-accent); }
.text-muted { color: var(--color-text-muted); }
.text-subtle { color: var(--color-text-subtle); }

.uppercase { text-transform: uppercase; }
.lowercase { text-transform: lowercase; }

.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }

.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

/* =============================================
   Animations
   ============================================= */
@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-in {
    animation: fade-in-up var(--duration-slow) var(--ease-out) forwards;
}

.delay-1 { animation-delay: 100ms; }
.delay-2 { animation-delay: 200ms; }
.delay-3 { animation-delay: 300ms; }
.delay-4 { animation-delay: 400ms; }

/* =============================================
   Glow Effects (Cyberpunk)
   ============================================= */
.glow {
    text-shadow: 0 0 20px var(--color-accent-alpha);
}

.glow-box {
    box-shadow: 0 0 40px var(--color-accent-alpha);
}
