/* ============================================
   MECHANICS LESSON — PREMIUM ANIMATION SYSTEM
   Orange/Amber Theme + Rich Micro-Interactions
   ============================================ */

/* ---------- Theme Color Overrides ---------- */
.gradient-text-mechanics {
    background: linear-gradient(135deg, #f97316, #fbbf24);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: textShimmer 3s ease-in-out infinite;
    background-size: 200% 100%;
}

.glow-card-mechanics {
    box-shadow: 0 0 30px rgba(249, 115, 22, 0.08), 0 0 60px rgba(251, 191, 36, 0.04);
    border-color: rgba(249, 115, 22, 0.15);
}

.stat-number {
    background: linear-gradient(135deg, #f97316, #fbbf24) !important;
}

/* ---------- Master Keyframes ---------- */
@keyframes textShimmer {

    0%,
    100% {
        background-position: 0% center;
    }

    50% {
        background-position: 100% center;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.85);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-8px);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

@keyframes pulseGlow {

    0%,
    100% {
        box-shadow: 0 0 20px rgba(249, 115, 22, 0.1), 0 4px 30px rgba(0, 0, 0, 0.3);
    }

    50% {
        box-shadow: 0 0 35px rgba(249, 115, 22, 0.2), 0 4px 30px rgba(0, 0, 0, 0.3);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }

    50% {
        opacity: 1;
        transform: scale(1.05);
    }

    70% {
        transform: scale(0.95);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes slideInStagger {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
        filter: blur(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

@keyframes spinSlow {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes shimmerLine {
    0% {
        left: -100%;
    }

    100% {
        left: 200%;
    }
}

@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---------- Section Scroll-Reveal ---------- */
.section {
    opacity: 0;
    transform: translateY(50px);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.section.visible {
    opacity: 1;
    transform: translateY(0);
}

.section.visible .section-header {
    animation: fadeInUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.1s both;
}

.section.visible .section-number {
    animation: bounceIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.15s both;
}

.section.visible .section-title {
    animation: fadeInUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.25s both;
}

.section.visible .section-desc {
    animation: fadeInUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.35s both;
}

.section.visible .text-content {
    animation: fadeInLeft 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.3s both;
}

.section.visible .sim-content {
    animation: fadeInRight 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.4s both;
}

.section.visible .info-card:nth-child(1) {
    animation: slideInStagger 0.6s ease 0.2s both;
}

.section.visible .info-card:nth-child(2) {
    animation: slideInStagger 0.6s ease 0.35s both;
}

.section.visible .info-card:nth-child(3) {
    animation: slideInStagger 0.6s ease 0.5s both;
}

.section.visible .info-card:nth-child(4) {
    animation: slideInStagger 0.6s ease 0.65s both;
}

.section.visible .formula-ref-card:nth-child(n) {
    animation: slideInStagger 0.5s ease calc(0.1s + 0.05s * var(--i, 0)) both;
}

.section.visible .comparison-table tbody tr:nth-child(1) {
    animation: fadeInUp 0.5s ease 0.3s both;
}

.section.visible .comparison-table tbody tr:nth-child(2) {
    animation: fadeInUp 0.5s ease 0.4s both;
}

.section.visible .comparison-table tbody tr:nth-child(3) {
    animation: fadeInUp 0.5s ease 0.5s both;
}

.section.visible .comparison-table tbody tr:nth-child(4) {
    animation: fadeInUp 0.5s ease 0.55s both;
}

.section.visible .comparison-table tbody tr:nth-child(5) {
    animation: fadeInUp 0.5s ease 0.6s both;
}

/* ---------- Hero Section ---------- */
.hero-section {
    opacity: 1 !important;
    transform: none !important;
}

.hero-badge {
    animation: fadeInUp 0.6s ease 0.1s both;
}

.hero-title {
    animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.3s both !important;
}

.hero-subtitle {
    animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.5s both;
}

.hero-stats {
    animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.7s both;
}

.hero-cta {
    animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.9s both;
}

.stat-card {
    animation: countUp 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.8s both;
}

.stat-card:nth-child(2) {
    animation-delay: 0.95s;
}

.stat-card:nth-child(3) {
    animation-delay: 1.1s;
}

/* ---------- Card Hover Effects ---------- */
.info-card {
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.4s ease, border-color 0.4s ease;
}

.info-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4), 0 0 30px rgba(249, 115, 22, 0.1);
}

.highlight-card {
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.4s ease, border-color 0.5s ease;
}

.highlight-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3), 0 0 25px rgba(249, 115, 22, 0.08);
    border-color: rgba(249, 115, 22, 0.3);
}

.highlight-icon {
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.highlight-card:hover .highlight-icon {
    transform: scale(1.15) rotate(5deg);
}

.formula-ref-card {
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.35s ease, border-color 0.35s ease, background 0.35s ease;
}

.formula-ref-card:hover {
    transform: translateY(-6px) scale(1.03);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.35), 0 0 20px rgba(249, 115, 22, 0.1);
    border-color: rgba(249, 115, 22, 0.3);
    background: rgba(255, 255, 255, 0.06);
}

.formula-ref-card:hover h4 {
    color: #f97316;
}

.formula-ref-card h4 {
    transition: color 0.3s ease;
}

.formula-highlight {
    transition: border-color 0.3s ease, background 0.3s ease;
    position: relative;
    overflow: hidden;
    display: block;
    width: 100%;
    text-align: center;
}

.formula-highlight::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.04), transparent);
    animation: shimmerLine 4s ease infinite;
    pointer-events: none;
}

/* ---------- Stat Card Hover ---------- */
.stat-card {
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.35s ease;
    cursor: default;
}

.stat-card:hover {
    transform: translateY(-5px) scale(1.08);
    box-shadow: 0 10px 30px rgba(249, 115, 22, 0.15);
}

/* ---------- Sim Box ---------- */
.sim-box {
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.4s ease;
    animation: pulseGlow 4s ease-in-out infinite;
}

.sim-box:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4), 0 0 40px rgba(249, 115, 22, 0.12);
}

.sim-label {
    transition: color 0.3s ease, letter-spacing 0.3s ease;
}

.sim-box:hover .sim-label {
    color: #f97316 !important;
    letter-spacing: 0.5px;
}

/* ---------- Button Animations ---------- */
.sim-btn {
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease, background 0.3s ease, letter-spacing 0.3s ease;
    position: relative;
    overflow: hidden;
}

.sim-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    transform: translate(-50%, -50%);
    transition: width 0.5s ease, height 0.5s ease;
}

.sim-btn:hover::after {
    width: 300px;
    height: 300px;
}

.sim-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 25px rgba(249, 115, 22, 0.25);
    letter-spacing: 0.5px;
}

.sim-btn:active {
    transform: translateY(0) scale(0.97);
    transition-duration: 0.1s;
}

.hero-cta {
    position: relative;
    overflow: hidden;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.4s ease;
}

.hero-cta::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    transition: left 0.6s ease;
}

.hero-cta:hover::before {
    left: 100%;
}

.hero-cta:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 12px 35px rgba(249, 115, 22, 0.3);
}

/* ---------- Nav Link Animations ---------- */
.nav-link {
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

.nav-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: linear-gradient(135deg, #f97316, #fbbf24);
    border-radius: 0 3px 3px 0;
    transition: height 0.3s ease;
}

.nav-link:hover::before,
.nav-link.active::before {
    height: 60%;
}

.nav-link:hover {
    transform: translateX(4px);
    background: rgba(249, 115, 22, 0.08);
    color: #f97316;
}

.nav-link.active {
    background: rgba(249, 115, 22, 0.12) !important;
    color: #f97316 !important;
}

.nav-icon {
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.nav-link:hover .nav-icon {
    transform: scale(1.25) rotate(-5deg);
}

/* ---------- Section Number ---------- */
.section-number {
    transition: box-shadow 0.3s ease, transform 0.3s ease;
    color: #f97316 !important;
    background: rgba(249, 115, 22, 0.1) !important;
}

.section-number:hover {
    box-shadow: 0 0 20px rgba(249, 115, 22, 0.2);
    transform: scale(1.1);
}

/* ---------- Table Animations ---------- */
.comparison-table tbody tr {
    transition: background 0.3s ease, transform 0.2s ease;
}

.comparison-table tbody tr:hover {
    background: rgba(249, 115, 22, 0.05);
    transform: scale(1.01);
}

/* ---------- Card Icon ---------- */
.card-icon {
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.info-card:hover .card-icon {
    transform: rotate(15deg) scale(1.15);
}

/* ---------- List Animations ---------- */
.styled-list li {
    transition: transform 0.3s ease, padding-left 0.3s ease;
}

.styled-list li:hover {
    transform: translateX(6px);
}

/* ---------- Tag Hover ---------- */
.tag {
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
}

.tag:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(249, 115, 22, 0.2);
}

/* ---------- Slider Styling ---------- */
.styled-slider::-webkit-slider-runnable-track {
    background: linear-gradient(90deg, #f97316, #fbbf24) !important;
}

.styled-slider::-webkit-slider-thumb {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.styled-slider::-webkit-slider-thumb:hover {
    transform: scale(1.3);
    box-shadow: 0 0 12px rgba(249, 115, 22, 0.4);
}

/* ---------- Readout Hover ---------- */
.sim-readout {
    transition: background 0.3s ease, color 0.3s ease;
}

.sim-readout:hover {
    background: rgba(249, 115, 22, 0.08);
    color: #f97316;
}

/* ---------- Progress Bar ---------- */
.progress-bar {
    background: linear-gradient(90deg, #f97316, #fbbf24) !important;
    box-shadow: 0 0 12px rgba(249, 115, 22, 0.5);
}

/* ---------- Hero Orbital Decoration ---------- */
.hero-section::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 5%;
    width: 200px;
    height: 200px;
    border: 1px solid rgba(249, 115, 22, 0.08);
    border-radius: 50%;
    animation: spinSlow 20s linear infinite;
    pointer-events: none;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 50%;
    right: 5%;
    width: 130px;
    height: 130px;
    border: 1px dashed rgba(251, 191, 36, 0.06);
    border-radius: 50%;
    animation: spinSlow 14s linear infinite reverse;
    pointer-events: none;
    margin-top: 35px;
    margin-right: 35px;
}

/* ---------- Footer ---------- */
.lesson-footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, #f97316, #fbbf24, transparent);
    animation: shimmerLine 6s ease infinite;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #f97316, #fbbf24);
    border-radius: 3px;
}

::selection {
    background: rgba(249, 115, 22, 0.3);
    color: #fff;
}

/* ---------- Formula Reference Grid ---------- */
.formula-ref-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
}

.formula-box {
    background: rgba(0, 0, 0, 0.25);
    border-radius: var(--radius-sm);
    padding: 14px 18px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
    color: var(--accent-cyan);
    margin: 8px 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* ---------- Canvas Sizing ---------- */
.sim-box canvas {
    width: 100%;
    max-width: 100%;
    height: auto;
    aspect-ratio: 420 / 380;
    border-radius: var(--radius-md);
    background: rgba(0, 0, 0, 0.3);
    display: block;
    cursor: pointer;
}

/* ---------- Sim Content Alignment ---------- */
.sim-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.content-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: start;
}

/* ---------- Table Wrapper ---------- */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    margin-top: 16px;
}

.table-wrapper .comparison-table {
    margin: 0;
    border-radius: 0;
}

/* ---------- Content Card ---------- */
.content-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 20px;
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.content-card h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.content-card p {
    color: var(--text-secondary);
    font-size: 0.92rem;
    margin-bottom: 8px;
    line-height: 1.7;
}

/* When content-card is also a highlight-card, override to column layout */
.content-card.highlight-card {
    flex-direction: column;
    gap: 16px;
}

/* ---------- Concept Block Spacing ---------- */
.concept-block {
    margin-bottom: 0;
}

.concept-block+.concept-block {
    margin-top: 0;
}

.highlight-card>div:last-child {
    flex: 1;
    min-width: 0;
}

/* ---------- Highlight Card ---------- */
.highlight-card {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.highlight-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: var(--radius-md);
    font-size: 1.3rem;
}

.highlight-card h3 {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.highlight-card p {
    font-size: 0.88rem;
    color: var(--text-secondary);
}

/* ---------- Styled List ---------- */
.styled-list {
    list-style: none;
    padding: 0;
}

.styled-list li {
    position: relative;
    padding-left: 20px;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 0.92rem;
}

.styled-list li::before {
    content: '▸';
    position: absolute;
    left: 0;
    color: #f97316;
    font-weight: bold;
}

/* ---------- Sim Slider Label ---------- */
.sim-slider-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
    .content-split {
        grid-template-columns: 1fr;
    }

    .info-grid.three-col {
        grid-template-columns: repeat(2, 1fr);
    }

    .formula-ref-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .mobile-header {
        display: flex !important;
    }

    .main-content {
        margin-left: 0 !important;
    }

    .section {
        padding: 80px 20px 40px;
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 0.95rem;
    }

    .hero-stats {
        flex-direction: column;
        align-items: center;
    }

    .info-grid.three-col,
    .info-grid.two-col {
        grid-template-columns: 1fr;
    }

    .formula-ref-grid {
        grid-template-columns: 1fr;
    }

    .sidebar-overlay.active {
        display: block;
    }
}