/* Reset & Base */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans SC', sans-serif;
    line-height: 1.6;
    color: #e0e0e0;
    background: #0f0f1a;
    min-height: 100vh;
    transition: background 0.3s, color 0.3s;
}

/* Dark mode variables (default) */
:root {
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-card: rgba(26, 26, 46, 0.8);
    --bg-glass: rgba(26, 26, 46, 0.6);
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0c0;
    --accent: #f0c040;
    --accent-hover: #ffd866;
    --accent-dark: #c8a030;
    --border: rgba(240, 192, 64, 0.2);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --gradient-bg: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    --gradient-banner: linear-gradient(135deg, #1a1a2e 0%, #0f3460 50%, #1a1a2e 100%);
    --gradient-card: linear-gradient(145deg, rgba(26, 26, 46, 0.9), rgba(15, 52, 96, 0.7));
    --radius: 16px;
    --radius-sm: 10px;
    --transition: 0.3s ease;
}

/* Light mode (optional, triggered by prefers-color-scheme) */
@media (prefers-color-scheme: light) {
    :root {
        --bg-primary: #f5f5fa;
        --bg-secondary: #ffffff;
        --bg-card: rgba(255, 255, 255, 0.85);
        --bg-glass: rgba(255, 255, 255, 0.6);
        --text-primary: #1a1a2e;
        --text-secondary: #4a4a5a;
        --accent: #c8a030;
        --accent-hover: #b8922a;
        --accent-dark: #a07820;
        --border: rgba(200, 160, 48, 0.3);
        --shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
        --gradient-bg: linear-gradient(135deg, #f0f0f5 0%, #e8e8f0 50%, #dcdce6 100%);
        --gradient-banner: linear-gradient(135deg, #f0e6d0 0%, #f5e6c8 50%, #f0d8b0 100%);
        --gradient-card: linear-gradient(145deg, rgba(255,255,255,0.95), rgba(240,230,208,0.7));
    }
    body { background: var(--bg-primary); color: var(--text-primary); }
}

/* Typography */
h1, h2, h3, h4 { font-weight: 700; line-height: 1.2; color: var(--text-primary); }
h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.5rem); margin-bottom: 1.5rem; }
h3 { font-size: 1.35rem; margin-bottom: 0.75rem; }
p { margin-bottom: 1rem; color: var(--text-secondary); }
a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover, a:focus { color: var(--accent-hover); }
ul, ol { padding-left: 1.5rem; margin-bottom: 1rem; }
li { margin-bottom: 0.5rem; color: var(--text-secondary); }
strong { color: var(--text-primary); }
address { font-style: normal; }

/* Layout */
header, main, footer { width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 1.5rem; }
section { padding: 4rem 0; }

/* Header & Navigation */
header {
    background: var(--bg-glass);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 0.75rem 1.5rem;
    transition: background var(--transition);
}
nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}
nav > div {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
nav > div a { display: flex; align-items: center; }
nav > div span { font-size: 1.4rem; font-weight: 700; color: var(--accent); letter-spacing: 1px; }
nav ul {
    display: flex;
    gap: 0.5rem;
    list-style: none;
    padding: 0;
    margin: 0;
    flex-wrap: wrap;
}
nav ul li a {
    display: block;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-weight: 500;
    transition: all var(--transition);
    position: relative;
}
nav ul li a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 60%;
    height: 2px;
    background: var(--accent);
    transition: transform var(--transition);
}
nav ul li a:hover::after,
nav ul li a:focus::after { transform: translateX(-50%) scaleX(1); }
nav ul li a:hover { color: var(--accent); background: rgba(240, 192, 64, 0.1); }

/* Hero Section */
#hero {
    background: var(--gradient-banner);
    border-radius: var(--radius);
    padding: 5rem 2rem;
    margin: 2rem 0;
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow);
}
#hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 50%, rgba(240,192,64,0.08) 0%, transparent 60%);
    animation: heroGlow 8s ease-in-out infinite alternate;
}
@keyframes heroGlow {
    0% { transform: translate(0, 0); }
    100% { transform: translate(10%, 10%); }
}
#hero > div { position: relative; z-index: 1; max-width: 800px; margin: 0 auto; }
#hero h1 { color: #ffffff; text-shadow: 0 2px 20px rgba(0,0,0,0.3); }
#hero p { color: rgba(255,255,255,0.85); font-size: 1.15rem; max-width: 600px; margin: 1.5rem auto; }
#hero div:last-child { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; margin-top: 2rem; }
#hero a[role="button"] {
    display: inline-block;
    padding: 0.85rem 2.5rem;
    border-radius: 50px;
    font-weight: 600;
    background: var(--accent);
    color: #1a1a2e;
    transition: all var(--transition);
    box-shadow: 0 4px 15px rgba(240,192,64,0.4);
}
#hero a[role="button"]:hover {
    background: var(--accent-hover);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(240,192,64,0.5);
}
#hero a[role="button"]:last-child {
    background: transparent;
    border: 2px solid var(--accent);
    color: var(--accent);
    box-shadow: none;
}
#hero a[role="button"]:last-child:hover {
    background: var(--accent);
    color: #1a1a2e;
}

/* Sections common */
section > h2 {
    position: relative;
    display: inline-block;
    padding-bottom: 0.75rem;
    margin-bottom: 2rem;
}
section > h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 4px;
    background: var(--accent);
    border-radius: 2px;
}

/* About */
#about {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 3rem 2rem;
    margin: 2rem 0;
}

/* Products */
#products > div {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}
#products article {
    background: var(--gradient-card);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    transition: all var(--transition);
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}
#products article::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s ease;
}
#products article:hover::before { transform: scaleX(1); }
#products article:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.5);
    border-color: var(--accent);
}
#products article h3 { color: var(--accent); }

/* Services */
#services > div {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}
#services article {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    transition: all var(--transition);
    text-align: center;
}
#services article:hover {
    background: var(--bg-glass);
    transform: scale(1.02);
    border-color: var(--accent);
    box-shadow: 0 8px 30px rgba(240,192,64,0.15);
}

/* Features */
#features {
    background: var(--gradient-bg);
    border-radius: var(--radius);
    padding: 3rem 2rem;
    margin: 2rem 0;
}
#features ul {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    list-style: none;
    padding: 0;
}
#features li {
    background: var(--bg-card);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 1.25rem 1.5rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    transition: all var(--transition);
    color: var(--text-secondary);
}
#features li:hover {
    transform: translateX(6px);
    border-color: var(--accent);
    background: var(--bg-glass);
}
#features li strong { color: var(--accent); display: block; margin-bottom: 0.25rem; }

/* FAQ */
#faq > div {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
details {
    background: var(--bg-card);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1.5rem;
    transition: all var(--transition);
    cursor: pointer;
}
details:hover { border-color: var(--accent); }
details[open] { background: var(--bg-glass); border-color: var(--accent); }
summary {
    font-weight: 600;
    color: var(--text-primary);
    padding: 0.5rem 0;
    transition: color var(--transition);
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
summary::-webkit-details-marker { display: none; }
summary::after {
    content: '+';
    font-size: 1.5rem;
    color: var(--accent);
    transition: transform 0.3s;
}
details[open] summary::after { transform: rotate(45deg); }
details p { padding: 0.75rem 0 0.5rem; margin: 0; border-top: 1px solid var(--border); }

/* Howto */
#howto ol {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    list-style: none;
    padding: 0;
    counter-reset: step;
}
#howto li {
    background: var(--bg-card);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1.25rem;
    counter-increment: step;
    position: relative;
    padding-left: 3rem;
    transition: all var(--transition);
}
#howto li::before {
    content: counter(step);
    position: absolute;
    left: 1rem;
    top: 1.25rem;
    width: 28px;
    height: 28px;
    background: var(--accent);
    color: #1a1a2e;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}
#howto li:hover {
    transform: translateY(-3px);
    border-color: var(--accent);
    box-shadow: 0 6px 20px rgba(240,192,64,0.1);
}

/* Knowledge */
#knowledge > div {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}
#knowledge article {
    background: var(--gradient-card);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.75rem;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}
#knowledge article::after {
    content: '📖';
    position: absolute;
    bottom: -10px;
    right: -10px;
    font-size: 4rem;
    opacity: 0.05;
    pointer-events: none;
}
#knowledge article:hover {
    transform: translateY(-4px) scale(1.01);
    border-color: var(--accent);
    box-shadow: 0 10px 35px rgba(240,192,64,0.12);
}
#knowledge article h3 { color: var(--accent); }

/* Contact */
#contact {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 3rem 2rem;
    margin: 2rem 0;
}
#contact address p { margin-bottom: 0.75rem; }
#contact a[href^="mailto"], #contact a[href^="tel"] {
    color: var(--accent);
    font-weight: 500;
}

/* Footer */
footer {
    background: var(--bg-glass);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-top: 1px solid var(--border);
    padding: 2rem 1.5rem;
    text-align: center;
    margin-top: 2rem;
}
footer p { margin-bottom: 0.5rem; font-size: 0.9rem; }
footer nav { justify-content: center; gap: 1rem; margin-top: 0.75rem; }
footer nav a { color: var(--text-secondary); font-size: 0.9rem; }
footer nav a:hover { color: var(--accent); }

/* Animations on scroll (using Intersection Observer fallback with CSS) */
@media (prefers-reduced-motion: no-preference) {
    section { opacity: 0; transform: translateY(30px); animation: fadeUp 0.7s ease forwards; }
    section:nth-child(2) { animation-delay: 0.1s; }
    section:nth-child(3) { animation-delay: 0.2s; }
    section:nth-child(4) { animation-delay: 0.3s; }
    section:nth-child(5) { animation-delay: 0.4s; }
    section:nth-child(6) { animation-delay: 0.5s; }
    section:nth-child(7) { animation-delay: 0.6s; }
    section:nth-child(8) { animation-delay: 0.7s; }
    section:nth-child(9) { animation-delay: 0.8s; }
    section:nth-child(10) { animation-delay: 0.9s; }
}
@keyframes fadeUp {
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive */
@media (max-width: 768px) {
    header { padding: 0.5rem 1rem; }
    nav { flex-direction: column; align-items: flex-start; }
    nav ul { width: 100%; justify-content: center; gap: 0.25rem; }
    nav ul li a { padding: 0.4rem 0.75rem; font-size: 0.9rem; }
    #hero { padding: 3rem 1.5rem; }
    #hero h1 { font-size: 1.75rem; }
    #hero p { font-size: 1rem; }
    #products > div, #services > div, #knowledge > div { grid-template-columns: 1fr; }
    #features ul { grid-template-columns: 1fr; }
    #howto ol { grid-template-columns: 1fr; }
    section { padding: 2.5rem 0; }
    #about, #features, #contact { padding: 2rem 1.5rem; }
}
@media (max-width: 480px) {
    html { font-size: 14px; }
    header, main, footer { padding: 0 1rem; }
    nav ul li a { font-size: 0.8rem; padding: 0.3rem 0.5rem; }
    #hero a[role="button"] { padding: 0.7rem 1.5rem; font-size: 0.9rem; }
}

/* Accessibility */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
    section { opacity: 1; transform: none; animation: none; }
}

/* Smooth scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--accent-dark); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* Selection */
::selection { background: var(--accent); color: #1a1a2e; }