/* ==============================
   FOIL Calculator — Global Styles
   ============================== */

/* ==============================
   CSS CUSTOM PROPERTIES
============================== */
:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #1a1a2e;
    --bg-card-hover: #1f1f35;
    --bg-input: #0f0f1a;
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-active: rgba(139, 92, 246, 0.4);
    --text-primary: #f1f1f7;
    --text-secondary: #9595b0;
    --text-muted: #5a5a78;
    --accent-violet: #8b5cf6;
    --accent-violet-light: #a78bfa;
    --accent-violet-glow: rgba(139, 92, 246, 0.15);
    --accent-blue: #3b82f6;
    --accent-cyan: #06b6d4;
    --accent-emerald: #10b981;
    --accent-amber: #f59e0b;
    --accent-rose: #f43f5e;
    --accent-pink: #ec4899;
    --foil-first: #8b5cf6;
    --foil-outer: #3b82f6;
    --foil-inner: #10b981;
    --foil-last: #f59e0b;
    --gradient-hero: linear-gradient(135deg, #8b5cf6 0%, #3b82f6 50%, #06b6d4 100%);
    --gradient-card: linear-gradient(135deg, rgba(139, 92, 246, 0.08) 0%, rgba(59, 130, 246, 0.04) 100%);
    --gradient-glow: radial-gradient(ellipse at 50% 0%, rgba(139, 92, 246, 0.12) 0%, transparent 60%);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 30px rgba(139, 92, 246, 0.2);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-smooth: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    color: var(--accent-violet-light);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-violet);
    text-decoration: underline;
}

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

code {
    font-family: 'JetBrains Mono', monospace;
    background: rgba(139, 92, 246, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.9em;
    color: var(--accent-violet-light);
}

/* ==============================
   BACKGROUND EFFECTS
============================== */
.bg-grid {
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
    z-index: 0;
}

.bg-glow-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    pointer-events: none;
    z-index: 0;
}

.bg-glow-orb.orb-1 {
    width: 500px;
    height: 500px;
    background: rgba(139, 92, 246, 0.08);
    top: -100px;
    left: -100px;
    animation: orbFloat 20s ease-in-out infinite;
}

.bg-glow-orb.orb-2 {
    width: 400px;
    height: 400px;
    background: rgba(59, 130, 246, 0.06);
    top: 40%;
    right: -150px;
    animation: orbFloat 25s ease-in-out infinite reverse;
}

.bg-glow-orb.orb-3 {
    width: 350px;
    height: 350px;
    background: rgba(6, 182, 212, 0.05);
    bottom: -100px;
    left: 30%;
    animation: orbFloat 22s ease-in-out infinite 5s;
}

@keyframes orbFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -30px) scale(1.05); }
    66% { transform: translate(-20px, 20px) scale(0.95); }
}

/* ==============================
   LAYOUT
============================== */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 24px;
    position: relative;
    z-index: 1;
}

.container-wide {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
    position: relative;
    z-index: 1;
}

/* ==============================
   HEADER / NAVIGATION
============================== */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10, 10, 15, 0.7);
    backdrop-filter: blur(20px) saturate(1.5);
    -webkit-backdrop-filter: blur(20px) saturate(1.5);
    border-bottom: 1px solid var(--border-subtle);
}

.header-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-primary);
    flex-shrink: 0;
}

.logo:hover {
    text-decoration: none;
    color: var(--text-primary);
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: var(--gradient-hero);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 14px;
    color: white;
    letter-spacing: -0.5px;
}

.logo-text {
    font-weight: 700;
    font-size: 18px;
    letter-spacing: -0.3px;
}

.logo-text span {
    background: var(--gradient-hero);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Desktop Navigation */
.nav-desktop {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-link {
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.nav-link:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
    text-decoration: none;
}

.nav-link.active {
    color: var(--accent-violet-light);
    background: rgba(139, 92, 246, 0.1);
}

/* Mobile Hamburger */
.nav-toggle {
    display: none;
    width: 44px;
    height: 44px;
    background: none;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.nav-toggle:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.12);
}

.nav-toggle .icon-close {
    display: none;
}

.nav-toggle[aria-expanded="true"] .icon-menu {
    display: none;
}

.nav-toggle[aria-expanded="true"] .icon-close {
    display: block;
}

/* Mobile Nav Panel */
.nav-mobile {
    display: none;
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 10, 15, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 99;
    padding: 24px;
    overflow-y: auto;
    animation: fadeIn 0.2s ease;
}

.nav-mobile.open {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.nav-mobile-link {
    display: block;
    padding: 16px 20px;
    font-size: 16px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    border-bottom: 1px solid var(--border-subtle);
    transition: all var(--transition-fast);
}

.nav-mobile-link:hover,
.nav-mobile-link.active {
    color: var(--accent-violet-light);
    text-decoration: none;
    padding-left: 28px;
}

@media (max-width: 768px) {
    .nav-desktop {
        display: none;
    }

    .nav-toggle {
        display: flex;
    }
}

/* ==============================
   HERO SECTION
============================== */
.hero {
    text-align: center;
    padding: 60px 0 40px;
    position: relative;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    height: 300px;
    background: radial-gradient(ellipse, rgba(139, 92, 246, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 100px;
    font-size: 13px;
    font-weight: 500;
    color: var(--accent-violet-light);
    margin-bottom: 24px;
    animation: fadeInDown 0.6s ease forwards;
}

.hero-badge .pulse-dot {
    width: 6px;
    height: 6px;
    background: var(--accent-emerald);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.5); }
}

.hero h1 {
    font-size: clamp(32px, 5vw, 52px);
    font-weight: 800;
    letter-spacing: -1.5px;
    line-height: 1.15;
    margin-bottom: 16px;
    animation: fadeInDown 0.6s ease 0.1s both;
}

.hero h1 .gradient-text {
    background: var(--gradient-hero);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    font-size: 17px;
    color: var(--text-secondary);
    max-width: 520px;
    margin: 0 auto;
    line-height: 1.7;
    animation: fadeInDown 0.6s ease 0.2s both;
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-16px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==============================
   PAGE HERO (for inner pages)
============================== */
.page-hero {
    text-align: center;
    padding: 60px 0 40px;
    position: relative;
}

.page-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    height: 250px;
    background: radial-gradient(ellipse, rgba(139, 92, 246, 0.08) 0%, transparent 70%);
    pointer-events: none;
}

.page-hero h1 {
    font-size: clamp(28px, 4vw, 44px);
    font-weight: 800;
    letter-spacing: -1px;
    line-height: 1.2;
    margin-bottom: 16px;
    animation: fadeInDown 0.6s ease 0.1s both;
}

.page-hero .subtitle {
    font-size: 17px;
    color: var(--text-secondary);
    max-width: 560px;
    margin: 0 auto;
    line-height: 1.7;
    animation: fadeInDown 0.6s ease 0.2s both;
}

/* ==============================
   BREADCRUMBS
============================== */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 20px 0 0;
    font-size: 13px;
    animation: fadeInDown 0.5s ease both;
}

.breadcrumbs a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.breadcrumbs a:hover {
    color: var(--accent-violet-light);
    text-decoration: none;
}

.breadcrumbs .separator {
    color: var(--text-muted);
    font-size: 11px;
}

.breadcrumbs .current {
    color: var(--text-secondary);
}

/* ==============================
   CALCULATOR CARD
============================== */
.calc-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 40px;
    margin-bottom: 32px;
    position: relative;
    overflow: hidden;
    animation: fadeInUp 0.6s ease 0.3s both;
    transition: border-color var(--transition-normal);
}

.calc-card:hover {
    border-color: rgba(139, 92, 246, 0.15);
}

.calc-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--gradient-glow);
    pointer-events: none;
}

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

.input-section {
    position: relative;
    z-index: 1;
}

.input-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.input-wrapper {
    position: relative;
    margin-bottom: 8px;
}

.input-wrapper .input-prefix {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
    font-size: 18px;
    pointer-events: none;
}

#expression-input {
    width: 100%;
    padding: 18px 20px;
    background: var(--bg-input);
    border: 2px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 20px;
    font-weight: 500;
    letter-spacing: 0.5px;
    outline: none;
    transition: all var(--transition-normal);
}

#expression-input::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

#expression-input:focus {
    border-color: var(--accent-violet);
    box-shadow: 0 0 0 4px var(--accent-violet-glow), var(--shadow-glow);
}

.input-hint {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.input-hint svg {
    flex-shrink: 0;
}

/* Quick Examples */
.quick-examples {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
    margin-bottom: 28px;
}

.quick-example-btn {
    padding: 6px 14px;
    background: rgba(139, 92, 246, 0.08);
    border: 1px solid rgba(139, 92, 246, 0.15);
    border-radius: 100px;
    color: var(--accent-violet-light);
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.quick-example-btn:hover {
    background: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.3);
    transform: translateY(-1px);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 12px;
}

.btn {
    padding: 14px 32px;
    border-radius: var(--radius-md);
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    border: none;
    outline: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    flex: 1;
    background: var(--gradient-hero);
    color: white;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.3);
    justify-content: center;
}

.btn-primary:hover {
    box-shadow: 0 6px 30px rgba(139, 92, 246, 0.45);
    transform: translateY(-2px);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(139, 92, 246, 0.3);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.12);
}

.btn-icon {
    width: 48px;
    height: 48px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

/* ==============================
   ERROR STATE
============================== */
.error-message {
    display: none;
    padding: 12px 16px;
    background: rgba(244, 63, 94, 0.1);
    border: 1px solid rgba(244, 63, 94, 0.2);
    border-radius: var(--radius-sm);
    color: var(--accent-rose);
    font-size: 14px;
    font-weight: 500;
    margin-top: 16px;
    align-items: center;
    gap: 8px;
}

.error-message.visible {
    display: flex;
}

/* ==============================
   RESULTS SECTION
============================== */
.results-section {
    display: none;
    animation: fadeInUp 0.5s ease both;
}

.results-section.visible {
    display: block;
}

/* Final Answer Card */
.answer-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 32px 40px;
    margin-bottom: 24px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.answer-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--gradient-glow);
    pointer-events: none;
}

.answer-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--accent-violet-light);
    margin-bottom: 12px;
}

.answer-expression {
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(22px, 4vw, 32px);
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.5px;
    position: relative;
    z-index: 1;
}

.answer-actions {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
    position: relative;
    z-index: 1;
}

.copy-btn {
    padding: 8px 16px;
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 100px;
    color: var(--accent-violet-light);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all var(--transition-fast);
    font-family: 'Inter', sans-serif;
}

.copy-btn:hover {
    background: rgba(139, 92, 246, 0.2);
}

.copy-btn.copied {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.3);
    color: var(--accent-emerald);
}

/* Steps Card */
.steps-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 32px 40px;
    margin-bottom: 24px;
}

.steps-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.steps-title {
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.steps-title .icon-circle {
    width: 32px;
    height: 32px;
    background: var(--gradient-hero);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* FOIL Visual Grid */
.foil-visual {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 28px;
}

.foil-step {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    transition: all var(--transition-normal);
    animation: slideInLeft 0.4s ease both;
}

.foil-step:nth-child(1) { animation-delay: 0.1s; }
.foil-step:nth-child(2) { animation-delay: 0.2s; }
.foil-step:nth-child(3) { animation-delay: 0.3s; }
.foil-step:nth-child(4) { animation-delay: 0.4s; }

.foil-step:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.1);
    transform: translateX(4px);
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

.foil-step-badge {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 16px;
    color: white;
    flex-shrink: 0;
    letter-spacing: -0.3px;
}

.foil-step-badge.first { background: linear-gradient(135deg, var(--foil-first), #a78bfa); }
.foil-step-badge.outer { background: linear-gradient(135deg, var(--foil-outer), #60a5fa); }
.foil-step-badge.inner { background: linear-gradient(135deg, var(--foil-inner), #34d399); }
.foil-step-badge.last { background: linear-gradient(135deg, var(--foil-last), #fbbf24); }

.foil-step-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.foil-step-label {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-secondary);
    min-width: 50px;
}

.foil-step-calc {
    font-family: 'JetBrains Mono', monospace;
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    flex: 1;
    text-align: center;
}

.foil-step-result {
    font-family: 'JetBrains Mono', monospace;
    font-size: 18px;
    font-weight: 700;
    min-width: 80px;
    text-align: right;
}

.foil-step-result.first-color { color: var(--foil-first); }
.foil-step-result.outer-color { color: var(--foil-outer); }
.foil-step-result.inner-color { color: var(--foil-inner); }
.foil-step-result.last-color { color: var(--foil-last); }

/* Combine Step */
.combine-section {
    border-top: 1px solid var(--border-subtle);
    padding-top: 24px;
}

.combine-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.combine-expression {
    font-family: 'JetBrains Mono', monospace;
    font-size: 16px;
    color: var(--text-secondary);
    padding: 14px 20px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    line-height: 1.8;
}

.combine-expression .term-first { color: var(--foil-first); font-weight: 600; }
.combine-expression .term-outer { color: var(--foil-outer); font-weight: 600; }
.combine-expression .term-inner { color: var(--foil-inner); font-weight: 600; }
.combine-expression .term-last { color: var(--foil-last); font-weight: 600; }

.combine-arrow {
    text-align: center;
    padding: 12px 0;
    color: var(--text-muted);
}

.combine-final {
    font-family: 'JetBrains Mono', monospace;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    padding: 14px 20px;
    background: rgba(139, 92, 246, 0.06);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(139, 92, 246, 0.15);
    text-align: center;
}

/* ==============================
   FOIL VISUAL DIAGRAM
============================== */
.diagram-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 32px 40px;
    margin-bottom: 24px;
    text-align: center;
}

.diagram-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.diagram-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.diagram-binomials {
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(24px, 4vw, 36px);
    font-weight: 700;
    position: relative;
    display: flex;
    align-items: center;
    gap: 4px;
}

.diagram-binomials .paren {
    color: var(--text-muted);
    font-weight: 400;
}

.diagram-binomials .term {
    position: relative;
    padding: 4px 6px;
    cursor: default;
    transition: all var(--transition-fast);
}

.diagram-binomials .term:hover {
    transform: scale(1.1);
}

.diagram-binomials .term.t-a { color: var(--foil-first); }
.diagram-binomials .term.t-b { color: var(--foil-last); }
.diagram-binomials .term.t-c { color: var(--foil-outer); }
.diagram-binomials .term.t-d { color: var(--foil-inner); }

/* Arc Labels */
.arc-labels {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.arc-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.arc-label .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.arc-label.lbl-first .dot { background: var(--foil-first); }
.arc-label.lbl-outer .dot { background: var(--foil-outer); }
.arc-label.lbl-inner .dot { background: var(--foil-inner); }
.arc-label.lbl-last .dot { background: var(--foil-last); }

.arc-label.lbl-first { color: var(--foil-first); }
.arc-label.lbl-outer { color: var(--foil-outer); }
.arc-label.lbl-inner { color: var(--foil-inner); }
.arc-label.lbl-last { color: var(--foil-last); }

/* ==============================
   HOW IT WORKS SECTION
============================== */
.how-it-works {
    margin: 48px 0;
}

.section-header {
    text-align: center;
    margin-bottom: 40px;
}

.section-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-violet-light);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 16px;
}

.section-header h2 {
    font-size: clamp(24px, 3.5vw, 36px);
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 12px;
}

.section-header p {
    font-size: 16px;
    color: var(--text-secondary);
    max-width: 500px;
    margin: 0 auto;
    line-height: 1.7;
}

.steps-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.step-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 32px 24px;
    text-align: center;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.step-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-hero);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.step-card:hover {
    border-color: rgba(139, 92, 246, 0.2);
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

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

.step-number {
    width: 48px;
    height: 48px;
    background: var(--gradient-hero);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 20px;
    color: white;
    margin: 0 auto 20px;
}

.step-card h3 {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 10px;
    letter-spacing: -0.3px;
}

.step-card p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

@media (max-width: 768px) {
    .steps-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

/* ==============================
   INFO SECTION
============================== */
.info-section {
    margin-top: 48px;
    margin-bottom: 48px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.info-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 28px;
    transition: all var(--transition-normal);
}

.info-card:hover {
    border-color: rgba(139, 92, 246, 0.15);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.info-card-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    font-size: 20px;
}

.info-card-icon.violet { background: rgba(139, 92, 246, 0.12); }
.info-card-icon.blue { background: rgba(59, 130, 246, 0.12); }
.info-card-icon.cyan { background: rgba(6, 182, 212, 0.12); }
.info-card-icon.emerald { background: rgba(16, 185, 129, 0.12); }

.info-card h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.3px;
}

.info-card p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* What is FOIL Section */
.what-is-foil {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 40px;
}

.what-is-foil h2 {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 16px;
    letter-spacing: -0.5px;
}

.what-is-foil p {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 16px;
}

.foil-acronym-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin: 24px 0;
}

.foil-acronym-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
}

.foil-acronym-item .letter {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 16px;
    color: white;
    flex-shrink: 0;
}

.foil-acronym-item:nth-child(1) .letter { background: linear-gradient(135deg, var(--foil-first), #a78bfa); }
.foil-acronym-item:nth-child(2) .letter { background: linear-gradient(135deg, var(--foil-outer), #60a5fa); }
.foil-acronym-item:nth-child(3) .letter { background: linear-gradient(135deg, var(--foil-inner), #34d399); }
.foil-acronym-item:nth-child(4) .letter { background: linear-gradient(135deg, var(--foil-last), #fbbf24); }

.foil-acronym-item .desc {
    font-size: 14px;
    font-weight: 600;
}

.foil-acronym-item .desc span {
    display: block;
    font-weight: 400;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.formula-box {
    margin: 24px 0;
    padding: 20px 24px;
    background: rgba(139, 92, 246, 0.06);
    border: 1px solid rgba(139, 92, 246, 0.15);
    border-radius: var(--radius-md);
    text-align: center;
}

.formula-box .formula {
    font-family: 'JetBrains Mono', monospace;
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 1px;
}

.formula-box .formula-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 8px;
}

/* ==============================
   FAQ SECTION
============================== */
.faq-section {
    margin: 48px 0;
}

.faq-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.faq-item {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: border-color var(--transition-normal);
}

.faq-item:hover {
    border-color: rgba(139, 92, 246, 0.15);
}

.faq-question {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 24px;
    background: none;
    border: none;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: color var(--transition-fast);
}

.faq-question:hover {
    color: var(--accent-violet-light);
}

.faq-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    color: var(--text-muted);
    transition: transform var(--transition-normal);
}

.faq-item.open .faq-icon {
    transform: rotate(45deg);
    color: var(--accent-violet-light);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s ease;
}

.faq-item.open .faq-answer {
    max-height: 500px;
}

.faq-answer-inner {
    padding: 0 24px 20px;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.8;
}

/* ==============================
   FOOTER
============================== */
.footer {
    border-top: 1px solid var(--border-subtle);
    padding: 60px 0 40px;
    margin-top: 48px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

.footer-brand {
    max-width: 280px;
}

.footer-brand .logo {
    margin-bottom: 16px;
}

.footer-brand p {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.7;
}

.footer-social {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.social-link {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    transition: all var(--transition-fast);
}

.social-link:hover {
    background: rgba(139, 92, 246, 0.1);
    border-color: rgba(139, 92, 246, 0.2);
    color: var(--accent-violet-light);
    transform: translateY(-2px);
    text-decoration: none;
}

.footer-col h4 {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-primary);
    margin-bottom: 16px;
}

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

.footer-col li {
    margin-bottom: 10px;
}

.footer-col a {
    font-size: 14px;
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.footer-col a:hover {
    color: var(--accent-violet-light);
    text-decoration: none;
}

.footer-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 24px;
    border-top: 1px solid var(--border-subtle);
    font-size: 13px;
    color: var(--text-muted);
}

.footer-bottom-links {
    display: flex;
    gap: 24px;
}

.footer-bottom-links a {
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: none;
}

.footer-bottom-links a:hover {
    color: var(--accent-violet-light);
    text-decoration: none;
}

@media (max-width: 768px) {
    .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 32px;
    }

    .footer-brand {
        grid-column: 1 / -1;
        max-width: 100%;
    }

    .footer-bottom {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }
}

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

/* ==============================
   CONTENT PAGES (About, Terms, Privacy)
============================== */
.content-page {
    padding-bottom: 60px;
}

.content-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 48px;
    animation: fadeInUp 0.5s ease both;
}

.content-card h2 {
    font-size: 22px;
    font-weight: 700;
    margin: 32px 0 16px;
    letter-spacing: -0.3px;
    color: var(--text-primary);
}

.content-card h2:first-child {
    margin-top: 0;
}

.content-card h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 24px 0 12px;
    color: var(--text-primary);
}

.content-card p {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 16px;
}

.content-card ul, .content-card ol {
    margin: 12px 0 20px 24px;
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.8;
}

.content-card li {
    margin-bottom: 8px;
}

.content-card strong {
    color: var(--text-primary);
}

.last-updated {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-subtle);
}

/* ==============================
   CONTACT FORM
============================== */
.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.form-input {
    padding: 14px 18px;
    background: var(--bg-input);
    border: 2px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    outline: none;
    transition: all var(--transition-normal);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-input:focus {
    border-color: var(--accent-violet);
    box-shadow: 0 0 0 4px var(--accent-violet-glow);
}

textarea.form-input {
    resize: vertical;
    min-height: 140px;
    font-family: 'Inter', sans-serif;
}

.form-status {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    display: none;
}

.form-status.success {
    display: block;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: var(--accent-emerald);
}

.form-status.error {
    display: block;
    background: rgba(244, 63, 94, 0.1);
    border: 1px solid rgba(244, 63, 94, 0.2);
    color: var(--accent-rose);
}

.contact-info-cards {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.contact-info-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 24px;
    transition: all var(--transition-normal);
}

.contact-info-card:hover {
    border-color: rgba(139, 92, 246, 0.15);
}

.contact-info-card .card-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: rgba(139, 92, 246, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    color: var(--accent-violet-light);
}

.contact-info-card h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 6px;
}

.contact-info-card p {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.6;
}

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

    .content-card {
        padding: 28px;
    }
}

/* ==============================
   BLOG CARDS
============================== */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.blog-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-normal);
    display: flex;
    flex-direction: column;
}

.blog-card:hover {
    border-color: rgba(139, 92, 246, 0.2);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.blog-card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: var(--gradient-card);
}

.blog-card-image-placeholder {
    width: 100%;
    height: 200px;
    background: var(--gradient-card);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    color: rgba(139, 92, 246, 0.3);
    border-bottom: 1px solid var(--border-subtle);
}

.blog-card-body {
    padding: 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.blog-card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    font-size: 12px;
    color: var(--text-muted);
}

.blog-card-category {
    padding: 3px 10px;
    background: rgba(139, 92, 246, 0.1);
    border-radius: 100px;
    color: var(--accent-violet-light);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.blog-card h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 10px;
    letter-spacing: -0.3px;
    line-height: 1.3;
}

.blog-card h3 a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.blog-card h3 a:hover {
    color: var(--accent-violet-light);
    text-decoration: none;
}

.blog-card p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    flex: 1;
}

.blog-card-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 16px;
    font-size: 14px;
    font-weight: 600;
    color: var(--accent-violet-light);
    text-decoration: none;
    transition: gap var(--transition-fast);
}

.blog-card-cta:hover {
    gap: 10px;
    text-decoration: none;
}

/* Blog Post Article */
.article-hero {
    margin-bottom: 32px;
}

.article-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    font-size: 13px;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.article-meta .divider {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--text-muted);
}

.article-content {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 48px;
}

.article-content h2 {
    font-size: 22px;
    font-weight: 700;
    margin: 32px 0 16px;
    letter-spacing: -0.3px;
}

.article-content h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 24px 0 12px;
}

.article-content p {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 16px;
}

.article-content ul, .article-content ol {
    margin: 12px 0 20px 24px;
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.8;
}

.article-content li {
    margin-bottom: 8px;
}

.article-content strong {
    color: var(--text-primary);
}

.article-content blockquote {
    margin: 24px 0;
    padding: 20px 24px;
    background: rgba(139, 92, 246, 0.06);
    border-left: 3px solid var(--accent-violet);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-style: italic;
    color: var(--text-secondary);
}

@media (max-width: 640px) {
    .article-content {
        padding: 24px;
    }
}

/* ==============================
   SITEMAP PAGE
============================== */
.sitemap-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}

.sitemap-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 28px;
}

.sitemap-card h2 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--accent-violet-light);
}

.sitemap-card ul {
    list-style: none;
}

.sitemap-card li {
    margin-bottom: 8px;
}

.sitemap-card a {
    font-size: 14px;
    color: var(--text-secondary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all var(--transition-fast);
}

.sitemap-card a:hover {
    color: var(--accent-violet-light);
    padding-left: 4px;
    text-decoration: none;
}

/* ==============================
   RESPONSIVE
============================== */
@media (max-width: 640px) {
    .calc-card {
        padding: 24px;
        border-radius: var(--radius-lg);
    }

    .steps-card, .diagram-card, .answer-card {
        padding: 24px;
        border-radius: var(--radius-lg);
    }

    .what-is-foil {
        padding: 24px;
    }

    .action-buttons {
        flex-direction: column;
    }

    .foil-step {
        flex-wrap: wrap;
        gap: 10px;
    }

    .foil-step-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .foil-step-result {
        text-align: left;
    }

    .foil-acronym-list {
        grid-template-columns: 1fr;
    }

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

/* ==============================
   SCROLL ANIMATION UTILITY
============================== */
.fade-in-view {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in-view.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Keyboard shortcut hint */
.kbd {
    display: inline-block;
    padding: 2px 6px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--text-muted);
}

/* ==============================
   LOADING ANIMATION
============================== */
.calc-loading {
    display: none;
    justify-content: center;
    align-items: center;
    padding: 40px 0;
}

.calc-loading.visible {
    display: flex;
}

.loading-dots {
    display: flex;
    gap: 6px;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-violet);
    animation: loadingBounce 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes loadingBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}
