/* The Programming Expert - main styles */
:root {
    --color-bg: #f5f5f5;
    --color-header-bg: #1a1a2e;
    --color-header-text: #eee;
    --color-header-hover: #7bbfa2;
    --color-link: #2563eb;
    --color-link-hover: #1d4ed8;
    --color-text: #333;
    --color-card-bg: #fff;
    --color-border: #e5e7eb;
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: ui-monospace, "Cascadia Code", "Source Code Pro", monospace;
    --max-width: 1100px;
    --spacing: 1.5rem;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--color-text);
    background: var(--color-bg);
}

.skip-link {
    position: absolute;
    top: -3rem;
    left: 0;
    padding: 0.5rem 1rem;
    background: var(--color-header-bg);
    color: #fff;
    z-index: 100;
    transition: top 0.2s;
}
.skip-link:focus { top: 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

.site-header {
    background: var(--color-header-bg);
    color: var(--color-header-text);
    padding: 0.75rem 0;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--spacing);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}
.logo {
    font-weight: 700;
    font-size: 1.25rem;
    color: #fff;
    text-decoration: none;
}
.logo:hover { color: var(--color-header-hover); }

.nav-toggle {
    display: none;
    width: 2rem;
    height: 2rem;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.5);
    border-radius: 4px;
    cursor: pointer;
    color: #fff;
    font-size: 1.25rem;
    line-height: 1;
}
.main-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; align-items: center; }
.main-nav a {
    color: var(--color-header-text);
    text-decoration: none;
    padding: 0.35rem 0.5rem;
    border-radius: 4px;
}
.main-nav a:hover { color: var(--color-header-hover); }
.has-dropdown { position: relative; }
.has-dropdown .dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 160px;
    background: #16213e;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    padding: 0.5rem 0;
    list-style: none;
    margin: 0.25rem 0 0 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}
.has-dropdown:hover .dropdown,
.has-dropdown:focus-within .dropdown { opacity: 1; visibility: visible; }
.has-dropdown .dropdown a { display: block; padding: 0.5rem 1rem; white-space: nowrap; }

.main-content {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--spacing);
    min-height: 60vh;
}

.hero {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
    padding: 3rem 2rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    text-align: center;
}
.hero h1 { margin: 0 0 0.5rem; font-size: clamp(1.5rem, 4vw, 2.25rem); }
.hero .tagline { font-size: 1.1rem; opacity: 0.95; margin: 0 0 1.5rem; }
.hero .cta { margin-top: 1.5rem; }
.hero .cta a {
    display: inline-block;
    background: var(--color-header-hover);
    color: #1a1a2e;
    padding: 0.6rem 1.25rem;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
}
.hero .cta a:hover { background: #8ed4b8; }

.intro-block { margin: 2rem 0; }
.intro-block h2 { margin: 0 0 1rem; font-size: 1.35rem; }
.intro-block p { margin: 0 0 1rem; }

.breadcrumb { margin-bottom: 1rem; font-size: 0.9rem; }
.breadcrumb ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.25rem 0.5rem; align-items: center; }
.breadcrumb li:not(:last-child)::after { content: '\203a'; margin-left: 0.5rem; color: #888; }
.breadcrumb a { color: var(--color-link); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb [aria-current="page"],
.breadcrumb li:last-child span { color: #666; }

.page-title { margin: 0 0 1rem; font-size: 1.75rem; }
.intro { margin-bottom: 2rem; font-size: 1.05rem; color: #555; }

.faq-page { margin-bottom: 2rem; }
.faq-lead {
    font-size: 1.1rem;
    line-height: 1.65;
    color: #444;
    margin: 0 0 2rem;
    padding: 1.25rem 1.5rem;
    background: var(--color-card-bg);
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--color-header-hover);
    border-radius: 8px;
}
.faq-answer { margin: 0; }
.faq-section {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--color-border);
}
.faq-section:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
.faq-section h2 {
    font-size: 1.25rem;
    margin: 0 0 0.75rem;
    color: var(--color-text);
}
.faq-section p { margin: 0 0 1rem; }
.faq-section p:last-child { margin-bottom: 0; }

.table-wrap { overflow-x: auto; margin: 1.25rem 0; }
.faq-table {
    width: 100%;
    min-width: 320px;
    border-collapse: collapse;
    font-size: 0.95rem;
    background: var(--color-card-bg);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    overflow: hidden;
}
.faq-table th,
.faq-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}
.faq-table thead th {
    background: #1a1a2e;
    color: #eee;
    font-weight: 600;
}
.faq-table tbody tr:last-child td { border-bottom: none; }
.faq-table tbody tr:nth-child(even) { background: #fafafa; }
.faq-table tbody tr:hover { background: #f0f9f6; }

.content-table {
    width: 100%;
    min-width: 320px;
    border-collapse: collapse;
    font-size: 0.95rem;
    background: var(--color-card-bg);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    overflow: hidden;
}
.content-table th,
.content-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}
.content-table thead th {
    background: #1a1a2e;
    color: #eee;
    font-weight: 600;
}
.content-table tbody tr:last-child td { border-bottom: none; }
.content-table tbody tr:nth-child(even) { background: #fafafa; }
.content-table tbody tr:hover { background: #f0f9f6; }
.content-table a { color: var(--color-link); text-decoration: none; }
.content-table a:hover { text-decoration: underline; }

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}
.card {
    background: var(--color-card-bg);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 1.25rem;
    transition: box-shadow 0.2s;
}
.card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.card h3 { margin: 0 0 0.5rem; font-size: 1.1rem; }
.card h3 a { color: inherit; text-decoration: none; }
.card h3 a:hover { color: var(--color-link); }
.card p { margin: 0; font-size: 0.95rem; color: #666; }

.snippet-block {
    background: #1e293b;
    color: #e2e8f0;
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1rem 0;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 1.5;
}
.snippet-block pre { margin: 0; }

.article-list { list-style: none; margin: 1rem 0; padding: 0; }
.article-list li { margin-bottom: 0.75rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--color-border); }
.article-list li:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.article-list a { color: var(--color-link); text-decoration: none; }
.article-list a:hover { text-decoration: underline; }

.faq-index-sections { margin: 0; }
.faq-index-section { margin-bottom: 2.5rem; }
.faq-index-section:last-child { margin-bottom: 0; }
.faq-index-section-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--color-border);
    color: var(--color-text, #1a1a2e);
}
.faq-index-section .article-list { margin: 0; }

.faq-links { margin: 2rem 0; padding-top: 1.5rem; border-top: 1px solid var(--color-border); }
.faq-links-title { font-size: 1.25rem; margin-bottom: 1rem; }
.faq-links-list { list-style: none; margin: 0; padding: 0; }
.faq-links-list li { margin-bottom: 0.75rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--color-border); }
.faq-links-list li:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.faq-links-list a { color: var(--color-link); text-decoration: none; }
.faq-links-list a:hover { text-decoration: underline; }

.lang-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
    margin: 2rem 0;
}
.lang-grid a {
    display: block;
    padding: 1rem;
    background: var(--color-card-bg);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    text-align: center;
    text-decoration: none;
    color: var(--color-text);
    font-weight: 500;
}
.lang-grid a:hover { border-color: var(--color-header-hover); background: #f0fdf4; }

.vitrina-cards { margin: 2.5rem 0; }
.vitrina-cards-title { margin: 0 0 1rem; font-size: 1.25rem; font-weight: 600; }
.vitrina-cards-inner {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
}
.vitrina-card { min-height: 120px; }
@media (max-width: 900px) {
    .vitrina-cards-inner { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
    .vitrina-cards-inner { grid-template-columns: 1fr; }
}

.site-footer {
    background: var(--color-header-bg);
    color: var(--color-header-text);
    padding: 1.5rem var(--spacing);
    margin-top: 3rem;
}
.footer-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.footer-nav a { color: var(--color-header-text); text-decoration: none; margin-left: 1rem; }
.footer-nav a:hover { color: var(--color-header-hover); }
.copyright { margin: 0; font-size: 0.9rem; opacity: 0.9; }

a { color: var(--color-link); }
a:hover { color: var(--color-link-hover); }

@media (max-width: 768px) {
    .nav-toggle { display: block; }
    .main-nav ul { display: none; flex-direction: column; width: 100%; }
    .main-nav.is-open ul { display: flex; }
    .has-dropdown .dropdown { position: static; opacity: 1; visibility: visible; box-shadow: none; background: transparent; padding-left: 1rem; margin-top: 0.25rem; }
    .hero { padding: 2rem 1rem; }
}
