:root {
    /* Colors */
    --primary-red: #E30613;
    --dark-red: #8A030A;
    --bright-silver: #F0F2F5;
    --steel-grey: #8C929A;
    --deep-black: #000000;
    --dark-charcoal: #121418;
    --menu-glass: rgba(18, 20, 24, 0.7);
    --neon-glow: #FF3333;
    
    /* Typography */
    --font-heading-ar: 'Cairo', sans-serif;
    --font-heading-en: 'Rajdhani', sans-serif;
    --font-body-ar: 'IBM Plex Sans Arabic', sans-serif;
    --font-body-en: 'IBM Plex Sans', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--dark-charcoal);
    color: var(--bright-silver);
    font-family: var(--font-body-ar);
    line-height: 1.6;
    overflow-x: hidden;
}

/* LTR override for English, Spanish, Euskara */
body[dir="ltr"] {
    font-family: var(--font-body-en);
}
body[dir="ltr"] h1, body[dir="ltr"] h2, body[dir="ltr"] h3, body[dir="ltr"] .logo, body[dir="ltr"] .metallic-shine {
    font-family: var(--font-heading-en);
}

h1, h2, h3 {
    font-family: var(--font-heading-ar);
    font-weight: 700;
}

/* Glassmorphism Utilities */
.glass {
    background: var(--menu-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(140, 146, 154, 0.15);
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    padding: 1rem 0;
    transition: background 0.3s ease;
}

.nav-container {
    max-width: 100%;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1rem;
}

.logo {
    font-size: 2rem;
    font-weight: 900;
    letter-spacing: 2px;
}
.logo-iron { color: var(--bright-silver); }
.logo-five { color: var(--primary-red); }

.nav-links {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 2.5vw;
    margin: 0 1rem;
    flex-wrap: wrap; /* allow wrapping on super thin widths */
}

.nav-links a {
    color: var(--bright-silver);
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 600;
    position: relative;
    transition: color 0.3s ease;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0%;
    height: 2px;
    background-color: var(--primary-red);
    transition: width 0.3s ease;
    box-shadow: 0 0 5px var(--neon-glow);
}

.nav-links a:hover {
    color: var(--primary-red);
    text-shadow: 0 0 8px rgba(255, 51, 51, 0.4);
}

.nav-links a:hover::after {
    width: 100%;
}

select#lang-switch {
    background: var(--deep-black);
    color: var(--bright-silver);
    border: 1px solid var(--steel-grey);
    padding: 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    outline: none;
    transition: border-color 0.3s ease;
}

select#lang-switch:focus {
    border-color: var(--primary-red);
}

/* Hero Section */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
    padding-top: 5rem;
    overflow: hidden;
}

/* Hero Section Backgrounds */
.hero-nebula-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    background: 
        radial-gradient(circle at 10% 20%, rgba(227, 6, 19, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(227, 6, 19, 0.08) 0%, transparent 50%);
    animation: nebulaDrift 20s ease-in-out infinite alternate;
}

.hero-particles {
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    z-index: 0;
    background-image: 
        radial-gradient(1.5px 1.5px at 150px 150px, rgba(255, 255, 255, 0.8), transparent),
        radial-gradient(2px 2px at 300px 50px, rgba(227, 6, 19, 0.8), transparent),
        radial-gradient(1px 1px at 400px 200px, rgba(255, 255, 255, 0.6), transparent),
        radial-gradient(1.5px 1.5px at 100px 300px, rgba(227, 6, 19, 0.5), transparent),
        radial-gradient(2px 2px at 200px 400px, rgba(255, 255, 255, 0.5), transparent),
        radial-gradient(2.5px 2.5px at 50px 250px, rgba(227, 6, 19, 0.9), transparent),
        radial-gradient(1px 1px at 350px 350px, rgba(255, 255, 255, 0.7), transparent);
    background-repeat: repeat;
    background-size: 350px 350px;
    animation: starfieldDrift 90s linear infinite;
    opacity: 0.5;
}

.target-grid-bg {
    position: absolute;
    inset: 0;
    background-image: 
      linear-gradient(rgba(140, 146, 154, 0.05) 1px, transparent 1px),
      linear-gradient(90deg, rgba(140, 146, 154, 0.05) 1px, transparent 1px);
    background-size: 40px 40px;
    z-index: 1;
}

@keyframes nebulaDrift {
    0%   { transform: scale(1) rotate(0deg); }
    100% { transform: scale(1.1) rotate(2deg); }
}

@keyframes starfieldDrift {
    0%   { transform: translateY(0) translateX(0); }
    100% { transform: translateY(-350px) translateX(-150px); }
}

.hero-content {
    z-index: 2;
    max-width: 800px;
    padding: 0 2rem;
}

.metallic-shine {
    font-size: 4.5rem;
    background: linear-gradient(90deg, #8C929A 0%, #ffffff 50%, #8C929A 100%);
    background-size: 200% auto;
    color: transparent;
    -webkit-background-clip: text;
    background-clip: text;
    animation: shine 4s linear infinite;
    margin-bottom: 1rem;
    line-height: 1.2;
}

@keyframes shine {
    to { background-position: 200% center; }
}

.hero p {
    font-size: 1.3rem;
    color: var(--steel-grey);
    margin-bottom: 3rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Buttons */
.cta-pulse {
    background-color: var(--primary-red);
    color: white;
    border: none;
    padding: 1.2rem 3rem;
    font-size: 1.2rem;
    font-weight: bold;
    border-radius: 6px;
    cursor: pointer;
    box-shadow: 0 0 20px rgba(227, 6, 19, 0.5);
    transition: all 0.3s ease;
    font-family: inherit;
}

.cta-pulse:hover {
    box-shadow: 0 0 30px var(--neon-glow);
    transform: translateY(-2px);
    background-color: #f70d1a;
}

.btn-outline {
    background: transparent;
    color: var(--bright-silver);
    border: 1px solid var(--steel-grey);
    padding: 0.6rem 2rem;
    font-size: 1rem;
    font-family: inherit;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 4px;
}

.btn-outline:hover {
    border-color: var(--primary-red);
    color: var(--primary-red);
    box-shadow: 0 0 10px rgba(227, 6, 19, 0.3);
}

/* Simulators Section */
.simulators-section {
    padding: 6rem 0;
    width: 100%;
    position: relative;
    z-index: 2;
    box-sizing: border-box;
}

/* Inner content wrapper for proper centering */
.simulators-section > .section-header-block,
.simulators-section > .sim-grid,
.simulators-section > .cnc-tools-showcase,
.simulators-section > .nav-container,
.simulators-section > .standards-header,
.simulators-section > .gdt-part-container {
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 2rem;
    padding-right: 2rem;
    box-sizing: border-box;
}

.section-title {
    font-size: 2.8rem;
    text-align: center;
    margin-bottom: 4rem;
    color: var(--bright-silver);
}

.sim-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2.5rem;
}

.sim-card {
    flex: 1 1 320px;
    max-width: 400px;
    padding: 2.5rem;
    border-radius: 12px;
    border: 1px solid rgba(140, 146, 154, 0.15);
    text-align: center;
    transition: all 0.4s ease;
    background: linear-gradient(145deg, rgba(26,29,36,1) 0%, rgba(18,20,24,1) 100%);
    display: flex;
    flex-direction: column;
}

.sim-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.6), 0 0 20px rgba(227, 6, 19, 0.15);
    border-color: rgba(227, 6, 19, 0.4);
}

.sim-icon {
    font-size: 3.5rem;
    margin-bottom: 1.5rem;
    filter: grayscale(100%);
    transition: filter 0.4s ease;
}

.sim-card:hover .sim-icon {
    filter: grayscale(0%);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.sim-card h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--bright-silver);
}

.sim-card p {
    color: var(--steel-grey);
    margin-bottom: 2rem;
    font-size: 1rem;
    flex-grow: 1;
}

.card-action {
    margin-top: auto;
}

/* ═══════════════════════════════════════════════════════
   IRONFIVE PORTAL SPLASH SCREEN
═══════════════════════════════════════════════════════ */
#portal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: radial-gradient(circle at center, #111318 0%, #000000 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.portal-bg-grid {
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, 0.1) 1px, transparent 1px);
    background-size: 30px 30px;
    z-index: 0;
    animation: particleDrift 60s linear infinite;
    opacity: 0.6;
}

.portal-bg-glow {
    position: absolute;
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, rgba(227, 6, 19, 0.12) 0%, transparent 60%);
    z-index: 0;
    border-radius: 50%;
    animation: portalAmbientGlow 4s ease-in-out infinite alternate;
}

.portal-scanlines {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 50%, rgba(0, 0, 0, 0.3) 51%);
    background-size: 100% 4px;
    z-index: 3;
    pointer-events: none;
    opacity: 0.5;
}

@keyframes particleDrift {
    0%   { background-position: 0px 0px; }
    100% { background-position: 300px 300px; }
}

@keyframes portalAmbientGlow {
    0%   { transform: scale(0.95); opacity: 0.4; filter: blur(5px); }
    100% { transform: scale(1.15); opacity: 0.8; filter: blur(15px); }
}

#portal-overlay.portal-exit {
    animation: portalExit 0.9s cubic-bezier(0.55, 0, 1, 0.45) forwards;
    pointer-events: none;
}

@keyframes portalExit {
    0%   { opacity: 1; transform: scale(1);    filter: brightness(1); }
    30%  { opacity: 1; transform: scale(1.04); filter: brightness(1.8); }
    100% { opacity: 0; transform: scale(1.12); filter: brightness(0); }
}

.portal-video-full {
    width: auto;
    height: auto;
    max-width: 320px;
    z-index: 1;
    filter: drop-shadow(0 0 15px rgba(227, 6, 19, 0.4));
    animation: portalLogoPulse 2s ease-in-out infinite;
}

@keyframes portalLogoPulse {
    0%, 100% { transform: scale(1); filter: drop-shadow(0 0 15px rgba(227, 6, 19, 0.4)); }
    50% { transform: scale(1.05); filter: drop-shadow(0 0 25px rgba(227, 6, 19, 0.8)); }
}

.portal-skip-btn {
    position: absolute;
    bottom: 40px;
    right: 40px;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.55);
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 0.82rem;
    letter-spacing: 2px;
    padding: 10px 22px;
    border-radius: 4px;
    cursor: pointer;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.25s ease;
    backdrop-filter: blur(4px);
}

.portal-skip-btn:hover {
    color: #fff;
    background: rgba(227, 6, 19, 0.3);
    border-color: rgba(227, 6, 19, 0.6);
    box-shadow: 0 0 16px rgba(227, 6, 19, 0.3);
}

/* ═══════════════════════════════════════════════════════
   HERO — IRONFIVE ANIMATED GIF LOGO
═══════════════════════════════════════════════════════ */
.hero-logo-wrap {
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: center;
}

.hero-logo-gif {
    max-height: 200px;
    width: auto;
    mix-blend-mode: screen;
    filter: none;
    animation: logoFloat 4s ease-in-out infinite;
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0px); }
    50%       { transform: translateY(-8px); }
}

/* ═══════════════════════════════════════════════════════
   CNC TOOLS & CALCULATORS SECTION
═══════════════════════════════════════════════════════ */
.cnc-tools-section {
    background: linear-gradient(180deg, transparent 0%, rgba(227, 6, 19, 0.03) 50%, transparent 100%);
}

.section-subtitle {
    text-align: center;
    color: var(--steel-grey);
    font-size: 1.1rem;
    margin-top: -2.5rem;
    margin-bottom: 3rem;
    max-width: 650px;
    margin-left: auto;
    margin-right: auto;
}

.cnc-tools-showcase {
    background: linear-gradient(145deg, rgba(26,29,36,0.9) 0%, rgba(18,20,24,0.95) 100%);
    border: 1px solid rgba(140, 146, 154, 0.15);
    border-radius: 20px;
    padding: 3rem;
    position: relative;
    overflow: hidden;
}

.cnc-tools-showcase::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary-red), transparent);
    opacity: 0.6;
}

/* Category pills row */
.tools-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-bottom: 2.5rem;
}

.tools-cat-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 100px;
    padding: 8px 18px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--steel-grey);
    transition: all 0.3s ease;
    cursor: default;
}

.tools-cat-pill:hover {
    border-color: rgba(227, 6, 19, 0.4);
    color: var(--bright-silver);
    background: rgba(227, 6, 19, 0.06);
}

.tools-cat-icon {
    font-style: normal;
    font-size: 1rem;
}

/* Tool preview mini cards */
.tools-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2.5rem;
}

.tool-preview-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 1.2rem;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s ease;
}

.tool-preview-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(227, 6, 19, 0.25);
    transform: translateX(-4px);
}

body[dir="ltr"] .tool-preview-card:hover {
    transform: translateX(4px);
}

.tp-icon {
    font-size: 1.6rem;
    min-width: 36px;
    text-align: center;
    filter: drop-shadow(0 0 6px currentColor);
    opacity: 0.85;
}

.tp-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--bright-silver);
    line-height: 1.3;
}

/* Launch button */
.cnc-launch-wrap {
    text-align: center;
}

.cnc-launch-btn {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: var(--primary-red);
    color: white;
    text-decoration: none;
    padding: 1rem 2.5rem;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    box-shadow: 0 0 24px rgba(227, 6, 19, 0.4);
    font-family: inherit;
}

.cnc-launch-btn:hover {
    background: #f70d1a;
    box-shadow: 0 0 40px rgba(227, 6, 19, 0.65);
    transform: translateY(-3px);
    color: white;
}

.cnc-launch-btn svg {
    transition: transform 0.3s ease;
}

.cnc-launch-btn:hover svg {
    transform: translateX(5px);
}

.cnc-tool-count {
    margin-top: 1rem;
    color: var(--steel-grey);
    font-size: 0.9rem;
}

/* ═══════════════════════════════════════════════════════
   NAVBAR LOGO — VIDEO VERSION
═══════════════════════════════════════════════════════ */
.logo-img-btn {
    flex-shrink: 0;
    line-height: 0;
}

.logo-img-btn video {
    height: 46px;
    width: auto;
    display: block;
    border-radius: 4px;
    filter: drop-shadow(0 0 6px rgba(227, 6, 19, 0.5));
    transition: filter 0.3s ease;
}

.logo-img-btn:hover video {
    filter: drop-shadow(0 0 14px rgba(227, 6, 19, 0.9));
}

/* ═══════════════════════════════════════════════════════
   SCROLL-REVEAL ANIMATIONS
═══════════════════════════════════════════════════════ */

/* Base hidden state — applied by JS on page elements */
.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: opacity, transform;
}

.reveal.from-left {
    transform: translateX(-50px);
}

.reveal.from-right {
    transform: translateX(50px);
}

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

/* Stagger delay helpers */
.reveal-delay-1 { transition-delay: 0.10s; }
.reveal-delay-2 { transition-delay: 0.20s; }
.reveal-delay-3 { transition-delay: 0.30s; }
.reveal-delay-4 { transition-delay: 0.40s; }
.reveal-delay-5 { transition-delay: 0.50s; }
.reveal-delay-6 { transition-delay: 0.60s; }

/* Section divider accent */
.section-divider {
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(227, 6, 19, 0.5) 30%,
        rgba(227, 6, 19, 0.5) 70%,
        transparent 100%);
    margin: 0;
    position: relative;
}

.section-divider::before {
    content: '';
    position: absolute;
    left: 50%; top: -3px;
    transform: translateX(-50%);
    width: 60px; height: 7px;
    background: var(--primary-red);
    border-radius: 4px;
    box-shadow: 0 0 16px rgba(227, 6, 19, 0.8);
}

/* Section icon pulse ring on hover */
.section-icon-wrap {
    transition: box-shadow 0.35s ease, transform 0.35s ease;
}

.section-icon-wrap:hover,
.section-header-block:hover .section-icon-wrap {
    transform: scale(1.1);
    box-shadow: 0 0 22px rgba(239, 68, 68, 0.4);
}

/* Active nav link highlight */
.nav-links a.nav-active {
    color: var(--primary-red);
}
.nav-links a.nav-active::after {
    width: 100%;
}

/* Smooth scroll */
html {
    scroll-behavior: smooth;
}
