/* ==========================================================================
   CastorLogic Studio — Design System
   "Architects of the Digital Flow"
   
   Palette derived from logo: bronze gear badge, cyan digital blocks,
   dark gunmetal slate background.
   ========================================================================== */

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

/* ---------- Design Tokens ---------- */
:root {
    /* Bronze / Copper family */
    --bronze: #B87333;
    --bronze-light: #D4956B;
    --bronze-glow: rgba(184, 115, 51, 0.35);
    --bronze-dim: #8B5A2B;

    /* Cyan / Ice Blue family */
    --cyan: #4FC3F7;
    --cyan-dim: #2A7AB5;
    --cyan-glow: rgba(79, 195, 247, 0.25);
    --cyan-light: #81D4FA;

    /* Slate / Background family */
    --bg-deep: #12141A;
    --bg-base: #1A1D23;
    --bg-surface: #22262E;
    --bg-card: #282C35;
    --bg-card-hover: #2F3440;
    --border: #363B46;
    --border-light: #454B58;

    /* Text */
    --text-primary: #E8E0D8;
    --text-secondary: #A09890;
    --text-muted: #6B6460;
    --text-bright: #F5F0EB;

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;
    --space-4xl: 6rem;

    /* Layout */
    --max-width: 1100px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    /* Typography */
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', monospace;

    /* Transitions */
    --ease-out: cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

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

body {
    font-family: var(--font-body);
    color: var(--text-primary);
    background: var(--bg-deep);
    line-height: 1.7;
    overflow-x: hidden;
}

/* Subtle grain texture overlay */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 9999;
}

a {
    color: var(--cyan);
    text-decoration: none;
    transition: color 0.2s var(--ease-out);
}

a:hover {
    color: var(--cyan-light);
}

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

/* ---------- Typography ---------- */
h1,
h2,
h3,
h4 {
    font-weight: 600;
    line-height: 1.2;
    color: var(--text-bright);
}

h1 {
    font-size: clamp(2rem, 4vw, 3rem);
}

h2 {
    font-size: clamp(1.4rem, 3vw, 2rem);
}

h3 {
    font-size: clamp(1.1rem, 2vw, 1.35rem);
}

.mono {
    font-family: var(--font-mono);
}

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

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

/* ---------- Navigation ---------- */
.studio-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: var(--space-md) 0;
    background: rgba(18, 20, 26, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(54, 59, 70, 0.5);
    transition: background 0.3s var(--ease-out);
}

.nav-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--space-xl);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--bronze-light);
    letter-spacing: -0.02em;
}

.nav-brand img {
    width: 32px;
    height: 32px;
    border-radius: 6px;
}

.nav-links {
    display: flex;
    gap: var(--space-lg);
    list-style: none;
}

.nav-links a {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: color 0.2s;
    letter-spacing: 0.01em;
}

.nav-links a:hover {
    color: var(--bronze-light);
}

/* Mobile hamburger */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--space-sm);
}

.nav-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text-secondary);
    margin: 5px 0;
    transition: all 0.3s;
}

/* ---------- Hero Section ---------- */
.hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--space-4xl) var(--space-xl);
    position: relative;
    overflow: hidden;
}

/* Radial glow behind logo */
.hero::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -60%);
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--bronze-glow) 0%, transparent 70%);
    pointer-events: none;
    animation: heroGlow 8s ease-in-out infinite alternate;
}

@keyframes heroGlow {
    0% {
        opacity: 0.5;
        transform: translate(-50%, -60%) scale(1);
    }

    100% {
        opacity: 0.8;
        transform: translate(-50%, -60%) scale(1.15);
    }
}

.hero-logo {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    margin-bottom: var(--space-xl);
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 0 30px var(--bronze-glow));
    animation: logoFloat 6s ease-in-out infinite;
}

@keyframes logoFloat {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-8px);
    }
}

.hero-tagline {
    font-family: var(--font-mono);
    font-size: clamp(1rem, 2.5vw, 1.4rem);
    font-weight: 500;
    color: var(--bronze-light);
    margin-bottom: var(--space-md);
    position: relative;
    z-index: 1;
    letter-spacing: 0.03em;
}

.hero-subtitle {
    font-size: clamp(0.95rem, 1.5vw, 1.15rem);
    color: var(--text-secondary);
    max-width: 520px;
    position: relative;
    z-index: 1;
    line-height: 1.6;
}

.hero-swift-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    margin-top: var(--space-xl);
    padding: var(--space-xs) var(--space-md);
    border: 1px solid var(--border);
    border-radius: 100px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
    position: relative;
    z-index: 1;
    background: rgba(34, 38, 46, 0.6);
}

.hero-swift-badge .swift-icon {
    color: #F05138;
    font-weight: 700;
}

/* ---------- Philosophy Section ---------- */
.philosophy {
    background: var(--bg-base);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.section-label {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--bronze);
    margin-bottom: var(--space-sm);
}

.section-heading {
    margin-bottom: var(--space-3xl);
}

.section-heading p {
    color: var(--text-secondary);
    max-width: 600px;
    margin-top: var(--space-sm);
    font-size: 1.05rem;
}

.pillars {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-xl);
}

.pillar-card {
    padding: var(--space-xl);
    border-radius: var(--radius-lg);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    transition: transform 0.3s var(--ease-out), border-color 0.3s, box-shadow 0.3s;
}

.pillar-card:hover {
    transform: translateY(-4px);
    border-color: var(--bronze-dim);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.pillar-icon {
    font-size: 1.6rem;
    margin-bottom: var(--space-md);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--bronze-glow), transparent);
    border: 1px solid var(--bronze-dim);
}

.pillar-card h3 {
    margin-bottom: var(--space-sm);
    font-size: 1.1rem;
}

.pillar-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* ---------- Products Section ---------- */
.products {
    position: relative;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-xl);
}

.product-card {
    padding: var(--space-xl) var(--space-xl) var(--space-lg);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    border: 1px solid var(--border);
    transition: all 0.3s var(--ease-out);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.product-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--bronze), var(--cyan));
    opacity: 0;
    transition: opacity 0.3s;
}

.product-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-light);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.3);
}

.product-card:hover::before {
    opacity: 1;
}

.product-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.product-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    flex-shrink: 0;
}

.product-header h3 {
    font-size: 1.2rem;
}

.product-header .product-tag {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--cyan);
    background: var(--cyan-glow);
    padding: 2px 8px;
    border-radius: 100px;
    margin-top: var(--space-xs);
    display: inline-block;
}

.product-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    flex-grow: 1;
}

.product-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    margin-top: var(--space-lg);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--bronze-light);
    transition: gap 0.2s var(--ease-out);
}

.product-link:hover {
    gap: var(--space-sm);
    color: var(--bronze);
}

/* Coming soon placeholder card */
.product-card.coming-soon {
    border-style: dashed;
    background: rgba(34, 38, 46, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.product-card.coming-soon .coming-label {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
}

.product-card.coming-soon .coming-label span {
    display: block;
    font-size: 1.5rem;
    margin-bottom: var(--space-sm);
    opacity: 0.5;
}

/* ---------- Open Source Section ---------- */
.opensource {
    background: var(--bg-base);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.opensource-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-xl);
}

.opensource-card {
    padding: var(--space-xl) var(--space-xl) var(--space-lg);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    border: 1px solid var(--border);
    transition: all 0.3s var(--ease-out);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.opensource-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--cyan), #8B5CF6);
    opacity: 0;
    transition: opacity 0.3s;
}

.opensource-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-light);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.3);
}

.opensource-card:hover::before {
    opacity: 1;
}

.opensource-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.github-icon {
    width: 44px;
    height: 44px;
    color: var(--text-secondary);
    flex-shrink: 0;
    padding: 6px;
    border-radius: var(--radius-sm);
    background: rgba(79, 195, 247, 0.08);
    border: 1px solid rgba(79, 195, 247, 0.15);
}

.opensource-header h3 {
    font-size: 1.2rem;
    font-family: var(--font-mono);
}

.opensource-tag {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 500;
    color: #8B5CF6;
    background: rgba(139, 92, 246, 0.15);
    padding: 2px 8px;
    border-radius: 100px;
    margin-top: var(--space-xs);
    display: inline-block;
}

.opensource-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
}

.opensource-tagline {
    font-weight: 500;
    color: var(--text-bright) !important;
    margin-bottom: var(--space-sm);
}

.opensource-features {
    list-style: none;
    margin: 0;
    padding: 0;
    flex-grow: 1;
}

.opensource-features li {
    font-size: 0.88rem;
    color: var(--text-secondary);
    padding: 4px 0;
    line-height: 1.5;
}

.opensource-features li strong {
    color: var(--cyan);
    font-weight: 600;
    font-family: var(--font-mono);
    font-size: 0.82rem;
}

.opensource-features code {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--bronze-light);
    background: rgba(184, 115, 51, 0.1);
    padding: 1px 5px;
    border-radius: 4px;
}

.opensource-stats {
    display: flex;
    gap: var(--space-lg);
    margin-top: var(--space-lg);
    padding: var(--space-md) 0;
    border-top: 1px solid var(--border);
}

.opensource-stats .stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.opensource-stats .stat-value {
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--cyan);
}

.opensource-stats .stat-label {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

.opensource-card.coming-soon {
    border-style: dashed;
    background: rgba(34, 38, 46, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.opensource-card.coming-soon .coming-label {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
}

.opensource-card.coming-soon .coming-label span {
    display: block;
    font-size: 1.5rem;
    margin-bottom: var(--space-sm);
    opacity: 0.5;
    color: var(--cyan-dim);
}

/* ---------- Blog / News Section ---------- */
.blog {
    background: var(--bg-base);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-xl);
}

.blog-card {
    padding: var(--space-xl);
    border-radius: var(--radius-lg);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    transition: all 0.3s var(--ease-out);
}

.blog-card:hover {
    border-color: var(--border-light);
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.blog-date {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--bronze);
    margin-bottom: var(--space-sm);
}

.blog-card h3 {
    font-size: 1.05rem;
    margin-bottom: var(--space-sm);
}

.blog-card h3 a {
    color: var(--text-bright);
    transition: color 0.2s;
}

.blog-card h3 a:hover {
    color: var(--bronze-light);
}

.blog-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
}

/* ---------- Footer ---------- */
.studio-footer {
    padding: var(--space-3xl) 0 var(--space-xl);
    border-top: 1px solid var(--border);
}

.footer-inner {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 1fr;
    gap: var(--space-2xl);
}

.footer-brand {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.footer-brand img {
    width: 40px;
    height: 40px;
    border-radius: 8px;
}

.footer-brand p {
    color: var(--text-muted);
    font-size: 0.85rem;
    max-width: 280px;
    line-height: 1.6;
}

.footer-column h4 {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--bronze);
    margin-bottom: var(--space-md);
    font-weight: 600;
}

.footer-column ul {
    list-style: none;
}

.footer-column li {
    margin-bottom: var(--space-sm);
}

.footer-column a {
    font-size: 0.9rem;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.footer-column a:hover {
    color: var(--text-bright);
}

.footer-bottom {
    margin-top: var(--space-2xl);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.footer-bottom a {
    color: var(--text-muted);
}

.footer-bottom a:hover {
    color: var(--bronze-light);
}

/* ---------- Scroll Reveal Animation ---------- */
.reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger children */
.reveal-stagger>.reveal:nth-child(1) {
    transition-delay: 0.1s;
}

.reveal-stagger>.reveal:nth-child(2) {
    transition-delay: 0.2s;
}

.reveal-stagger>.reveal:nth-child(3) {
    transition-delay: 0.3s;
}

.reveal-stagger>.reveal:nth-child(4) {
    transition-delay: 0.4s;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .pillars {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }

    .footer-inner {
        grid-template-columns: 1fr 1fr;
        gap: var(--space-xl);
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        padding: var(--space-lg) var(--space-xl);
        background: rgba(18, 20, 26, 0.95);
        backdrop-filter: blur(20px);
        border-bottom: 1px solid var(--border);
    }

    .nav-links.open {
        display: flex;
    }

    .nav-toggle {
        display: block;
    }

    .hero {
        min-height: 80vh;
    }

    .hero-logo {
        width: 150px;
        height: 150px;
    }

    .products-grid {
        grid-template-columns: 1fr;
    }

    .opensource-grid {
        grid-template-columns: 1fr;
    }

    .blog-grid {
        grid-template-columns: 1fr;
    }

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

@media (max-width: 480px) {
    .footer-inner {
        grid-template-columns: 1fr;
    }

    .footer-bottom {
        flex-direction: column;
        gap: var(--space-sm);
        text-align: center;
    }

    .container {
        padding: 0 var(--space-md);
    }
}

/* ---------- Large Screens (16" laptops and up) ---------- */
@media (min-width: 1200px) {
    :root {
        --max-width: 1200px;
    }

    /* Nav — larger brand mark */
    .nav-brand {
        font-size: 1.2rem;
    }

    .nav-brand img {
        width: 38px;
        height: 38px;
    }

    .nav-links a {
        font-size: 0.95rem;
    }

    /* Hero — scale up for impactful presence */
    .hero-logo {
        width: 280px;
        height: 280px;
    }

    .hero::before {
        width: 800px;
        height: 800px;
    }

    .hero-tagline {
        font-size: 1.75rem;
        letter-spacing: 0.04em;
    }

    .hero-subtitle {
        font-size: 1.25rem;
        max-width: 620px;
    }

    .hero-swift-badge {
        font-size: 0.9rem;
        padding: var(--space-sm) var(--space-lg);
    }

    /* Section headings — larger on big screens */
    h2 {
        font-size: 2.2rem;
    }

    .section-heading p {
        font-size: 1.15rem;
    }

    /* Pillar cards */
    .pillar-card h3 {
        font-size: 1.2rem;
    }

    .pillar-card p {
        font-size: 1rem;
    }

    /* Product cards */
    .product-header h3 {
        font-size: 1.3rem;
    }

    .product-card p {
        font-size: 1rem;
    }
}

/* ---------- Language Switcher ---------- */
.lang-switch {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    padding: 0.25rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    opacity: 0.6;
    transition: opacity 0.2s, border-color 0.2s;
}

.lang-switch:hover {
    opacity: 1;
    border-color: var(--bronze-light);
}