/* Base color variables */
:root {
    --primary-color: #005A9C;
    --secondary-color: #007bff;
    --background-color: #f8f9fa;
    --card-background: #ffffff;
    --text-color: #212529;
    --light-text-color: #6c757d;
    --border-color: #dee2e6;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --font-family: 'Lato', sans-serif;
    --header-bg: #ffffff;
    --footer-bg: #e9ecef;
}

[data-theme="dark"] {
    --primary-color: #4d94ff;
    --secondary-color: #6fa8ff;
    --background-color: #121212;
    --card-background: #1e1e1e;
    --text-color: #e0e0e0;
    --light-text-color: #b0b0b0;
    --border-color: #2d2d2d;
    --shadow-color: rgba(255, 255, 255, 0.05);
    --header-bg: #1a1a1a;
    --footer-bg: #1a1a1a;
    color-scheme: dark;
}

/* Prevent horizontal overflow on mobile */
html {
    overflow-x: hidden;
}

*, *::before, *::after {
    box-sizing: border-box;
}

/* General styles */
body {
    font-family: var(--font-family);
    color: var(--text-color);
    background-color: var(--background-color);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: color 0.3s ease, background-color 0.3s ease;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

main {
    flex-grow: 1;
}

a {
    color: var(--secondary-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

/* Header */
header {
    background-color: var(--header-bg);
    padding: 12px 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: background-color 0.3s ease;
}

.header-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
}

.logo img {
    margin-right: 10px;
}

.logo h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0;
    transition: color 0.3s ease;
}

/* Header right: lang switcher + theme toggle */
.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-lang-switcher {
    display: flex;
    gap: 0.3rem;
}

.header-lang-switcher a {
    padding: 4px 10px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--light-text-color);
    transition: color 0.2s ease;
}

.header-lang-switcher a.active {
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
}

.header-lang-switcher a:hover { color: var(--primary-color); text-decoration: none; }

/* Theme toggle button */
.theme-switch {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: background-color 0.3s ease, transform 0.2s ease;
    flex-shrink: 0;
}
.theme-switch:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 3px;
}

.theme-switch:hover {
    background-color: #004b83;
    transform: scale(1.05);
}

[data-theme="dark"] .theme-switch { background-color: var(--primary-color); }
[data-theme="dark"] .theme-switch:hover { background-color: #3a7ad9; }

/* Logo icon (replaces img) */
.logo-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.4rem;
    margin-right: 12px;
    flex-shrink: 0;
    transition: background 0.3s ease;
}

/* Hero section */
.hero {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 80px 0;
    text-align: center;
    margin-bottom: 50px;
}

[data-theme="dark"] .hero {
    background: linear-gradient(135deg, #0d1b2e, #1e3a58);
}

.hero h2 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 20px;
}

.hero p {
    font-size: 1.3rem;
    max-width: 750px;
    margin: 0 auto;
    opacity: 0.95;
}

/* Tools section */
.tools {
    padding: 0 0 60px;
}

.tools h2 {
    text-align: center;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 40px;
    color: var(--primary-color);
    transition: color 0.3s ease;
}

/* Tools grid — 2 columns, horizontal cards */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    max-width: 960px;
    margin: 0 auto;
}

/* Horizontal card: icon | text | arrow */
.tool-card {
    background-color: var(--card-background);
    border-radius: 12px;
    padding: 20px 22px;
    box-shadow: 0 2px 8px var(--shadow-color);
    border: 1px solid var(--border-color);
    text-decoration: none;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 18px;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.3s ease, border-color 0.2s ease;
}

.tool-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px var(--shadow-color);
    border-color: var(--primary-color);
    text-decoration: none;
}

.tool-icon {
    background-color: var(--primary-color);
    color: white;
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    transition: background-color 0.3s ease;
}

.tool-card-body {
    flex: 1;
    min-width: 0;
}

.tool-card h3 {
    font-size: 1rem;
    margin: 0 0 4px;
    color: var(--primary-color);
    font-weight: 700;
    transition: color 0.3s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tool-card p {
    margin: 0;
    color: var(--light-text-color);
    font-size: 0.85rem;
    line-height: 1.5;
    transition: color 0.3s ease;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tool-card-arrow {
    color: var(--border-color);
    font-size: 0.9rem;
    flex-shrink: 0;
    transition: color 0.2s ease, transform 0.2s ease;
}

.tool-card:hover .tool-card-arrow {
    color: var(--primary-color);
    transform: translateX(3px);
}

/* Footer */
footer {
    background-color: var(--footer-bg);
    color: var(--light-text-color);
    text-align: center;
    padding: 25px 0;
    margin-top: 40px;
    border-top: 1px solid var(--border-color);
    font-size: 0.9rem;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

footer p { margin: 0; }

/* Responsive */
@media (max-width: 900px) {
    .tools-grid {
        grid-template-columns: 1fr;
        max-width: 500px;
        gap: 25px;
    }
}

@media (max-width: 768px) {
    .hero { padding: 60px 0; }
    .hero h2 { font-size: 2rem; }
    .hero p { font-size: 1.1rem; }
    .tools h2 { font-size: 1.8rem; }
    .tool-card { padding: 25px; }
    .logo h1 { font-size: 1.5rem; }
}

@media (max-width: 480px) {
    .hero h2 { font-size: 1.8rem; }
    .hero p { font-size: 1rem; }
    .tool-card h3 { font-size: 1.2rem; }
    .logo img { width: 30px; height: 30px; }
    .logo h1 { font-size: 1.3rem; }
    .header-lang-switcher a { padding: 3px 7px; font-size: 0.8rem; }
    .theme-switch { width: 44px; height: 44px; font-size: 1rem; }
}

/* Skip link */
.skip-link {
    position: absolute;
    top: -50px;
    left: 1rem;
    background: var(--primary-color);
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 0 0 4px 4px;
    text-decoration: none;
    font-weight: 700;
    z-index: 9999;
    transition: top 0.2s ease;
}
.skip-link:focus-visible { top: 0; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
    html { scroll-behavior: auto !important; }
}
