:root {
    --bg-color: #080806;
    --text-color: #ffffff;
    --text-secondary: #cccccc;
    --text-muted: #888888;
    --accent-color: #ff6b00;
    --accent-hover: #ff8533;
    --border-color: #222222;
    --card-bg: #111111;
    --font-main: Arial, sans-serif;
    --header-bg: rgba(8, 8, 6, 0.95);
}

/* --- RESET & BASE STYLES --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-main);
    line-height: 1.6;
    font-size: 16px;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* --- TYPOGRAPHY --- */
h1, h2, h3, h4 {
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.2;
}

h1 {
    font-size: 2.5rem;
}

h2 {
    font-size: 2rem;
    margin-bottom: 2rem;
    color: #f2f2f2;
    border-bottom: 2px solid var(--accent-color);
    display: inline-block;
    padding-bottom: 0.5rem;
}

h3 {
    font-size: 1.5rem;
    color: var(--accent-color);
}

p {
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.3s ease;
}

ul {
    list-style: none;
}

/* --- LAYOUT UTILITIES --- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.section {
    padding: 80px 0;
}

.grid {
    display: grid;
    gap: 40px;
}

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

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

@media (min-width: 768px) {
    .grid-2 { grid-template-columns: 1fr 1fr; }
    .grid-3 { grid-template-columns: repeat(3, 1fr); }
    h1 { font-size: 3.5rem; }
}

/* --- HEADER --- */
header {
    padding: 20px 0;
    position: fixed;
    width: 100%;
    top: 0;
    background-color: var(--header-bg);
    backdrop-filter: blur(5px);
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo img {
    height: 40px;
    width: auto;
    display: block;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    letter-spacing: -1px;
}
.logo-text span { color: var(--accent-color); }

nav ul {
    display: none;
}

@media (min-width: 768px) {
    nav ul {
        display: flex;
        gap: 30px;
    }
    nav a {
        font-weight: bold; 
        font-size: 1.1rem; 
    }
    nav a:hover, nav a.active {
        color: var(--accent-color);
    }
}

/* --- FOOTER --- */
footer {
    padding: 50px 0;
    text-align: center;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

.social-links {
    margin-top: 20px;
}

.social-links a {
    margin: 0 10px;
    color: var(--text-muted);
}

.social-links a:hover {
    color: var(--accent-color);
}

/* --- LANGUAGE TOGGLE --- */
.lang-toggle {
    display: flex;
    gap: 8px;
    align-items: center;
}

.lang-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    background: transparent;
    border: 1px solid #333;
    border-radius: 4px;
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.lang-btn.active {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}

.lang-btn .flag {
    width: 18px;
    height: 12px;
    border-radius: 2px;
    display: inline-block;
    background-size: cover;
    background-position: center;
}

.flag-ru {
    background: linear-gradient(180deg, #fff 33.33%, #0039a6 33.33%, #0039a6 66.66%, #d52b1e 66.66%);
}

.flag-en {
    background: linear-gradient(180deg, #012169 0%, #012169 100%);
    position: relative;
}

.flag-en::before {
    content: '🇬🇧';
    font-size: 14px;
    position: absolute;
    top: -3px;
    left: 0;
}

.flag-mi {
    background: #cf0921;
    position: relative;
}

.flag-mi::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 4px;
    height: 100%;
    background: white;
}

.flag-mi::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 4px;
    background: white;
}

@media (max-width: 767px) {
    .lang-toggle {
        position: absolute;
        right: 20px;
        top: 50%;
        transform: translateY(-50%);
    }
    
    .lang-btn span:not(.flag) {
        display: none;
    }
    
    .lang-btn {
        padding: 6px 8px;
    }
    
    /* Mobile Nav Fix if needed */
    nav ul {
        display: none; /* Usually handled by hamburger, but keeping simple for now per existing code */
    }
}

/* --- BUTTONS --- */
.btn {
    display: inline-block;
    background-color: var(--accent-color);
    color: white;
    padding: 15px 30px;
    border-radius: 5px;
    font-weight: bold;
    margin-top: 20px;
    border: 1px solid var(--accent-color);
}

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

/* --- SHARED COMPONENTS --- */

/* Features / Concept Cards */
.card {
    background: var(--card-bg);
    padding: 30px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: transform 0.3s;
}

.card:hover {
    transform: translateY(-5px);
    border-color: #333;
}

.carrot-concept {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 40px;
}

.carrot-item {
    background: var(--card-bg);
    padding: 30px;
    border-left: 4px solid var(--accent-color);
}

/* Metrics Table */
.metrics-table-wrapper {
    overflow-x: auto;
    margin-top: 30px;
    background: var(--card-bg);
    padding: 20px;
    border-radius: 8px;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

th, td {
    text-align: left;
    padding: 12px 15px;
    border-bottom: 1px solid #333;
}

th {
    color: var(--accent-color);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.9rem;
}

td {
    font-size: 0.95rem;
    color: #ddd;
}

tr:last-child td {
    border-bottom: none;
}

/* Timeline */
.timeline {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
}

.timeline-item {
    padding: 20px;
    border-left: 2px solid #333;
    position: relative;
    margin-left: 20px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -9px;
    top: 28px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-color);
}

.timeline-date {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 5px;
}

/* Database Section */
.database-section {
    background: linear-gradient(180deg, #0c0c0a 0%, #080806 100%);
}

.form-link-container {
    text-align: center;
    margin: 30px 0 50px;
}

.form-link {
    display: inline-block;
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-hover) 100%);
    color: white;
    padding: 18px 40px;
    border-radius: 8px;
    font-weight: bold;
    font-size: 1.1rem;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 107, 0, 0.3);
}

.form-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 0, 0.5);
}

/* Logo Carousel */
.logo-carousel-container {
    margin: 50px 0;
    overflow: hidden;
    position: relative;
}

.logo-carousel-row {
    display: flex;
    gap: 40px;
    align-items: center;
    margin-bottom: 30px;
    will-change: transform;
}

.logo-carousel-row:nth-child(1) {
    animation: scroll-left 30s linear infinite;
}

.logo-carousel-row:nth-child(2) {
    animation: scroll-right 24s linear infinite;
}

.logo-carousel-row:nth-child(3) {
    animation: scroll-left 13s linear infinite;
}

@keyframes scroll-left {
    0% { transform: translateX(0); }
    100% { transform: translateX(calc(-180px * 20 - 40px * 20)); }
}

@keyframes scroll-right {
    0% { transform: translateX(calc(-180px * 20 - 40px * 20)); }
    100% { transform: translateX(0); }
}

/* Generic Variable Scrolling (Used in database.html specific impl, but keeping generic here if needed) */
/* database.html uses variable scrolling with JS calculated duration/distance. 
   accelerator.html uses fixed keyframes. 
   I will include the fixed keyframes above. 
   For database.html specific variable scrolling, I might need to keep it there OR add the generic keyframes here.
*/
@keyframes scroll-variable-left {
    0% { transform: translateX(0); }
    100% { transform: translateX(var(--scroll-distance)); }
}

@keyframes scroll-variable-right {
    0% { transform: translateX(var(--scroll-distance)); }
    100% { transform: translateX(0); }
}

.logo-item {
    flex-shrink: 0;
    width: 180px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    padding: 8px;
    transition: all 0.3s ease;
}

.logo-item:hover {
    transform: scale(1.05);
}

.logo-item img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    filter: grayscale(100%) brightness(1.2);
    transition: filter 0.3s ease;
}

.logo-item:hover img {
    filter: grayscale(0%) brightness(1);
}

.benefits-list {
    max-width: 800px;
    margin: 40px auto 0;
    text-align: left;
}

.benefits-list li {
    margin-bottom: 15px;
    padding-left: 30px;
    position: relative;
    color: #ddd;
    line-height: 1.8;
}

.benefits-list li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--accent-color);
    font-size: 1.5rem;
    line-height: 1.4;
}

/* Nav Cards */
.nav-cards {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 40px;
    margin-bottom: 30px;
    flex-wrap: nowrap;
}

.nav-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #333;
    padding: 15px 20px;
    border-radius: 8px;
    text-align: center;
    flex: 1;
    min-width: 160px;
    max-width: 250px;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
}

.nav-card:hover {
    border-color: var(--accent-color);
    transform: translateY(-3px);
    background: rgba(255, 255, 255, 0.1);
}

.nav-title {
    font-weight: bold;
    font-size: 1.1rem;
    color: #fff;
    margin-bottom: 5px;
    white-space: nowrap;
}

.nav-subtitle {
    font-size: 0.85rem;
    color: var(--accent-color);
    font-family: monospace;
}

/* Article Cards */
.article-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 25px;
    transition: transform 0.3s, border-color 0.3s;
    display: flex;
    flex-direction: column;
    height: 100%;
    text-decoration: none;
    color: var(--text-color);
}

.article-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent-color);
}

.article-date {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.article-title {
    font-size: 1.4rem;
    font-weight: bold;
    margin-bottom: 10px;
    color: #fff;
    line-height: 1.3;
}

.article-preview {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
    flex-grow: 1;
}

.article-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #333;
    padding-top: 15px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.view-counter {
    display: flex;
    align-items: center;
    gap: 5px;
}

.view-icon {
    width: 16px;
    height: 16px;
    fill: var(--accent-color);
}

@media (max-width: 768px) {
    .nav-cards { 
        justify-content: flex-start; 
        overflow-x: auto; 
        padding: 10px 20px;
        margin-left: -20px;
        margin-right: -20px;
        -webkit-overflow-scrolling: touch;
    }
    .nav-card { 
        flex: 0 0 180px; 
    }
}
