/* ============================================
   PROJEKT FPGA SPARTAN-6 XC6SLX9
   Wspólne style dla wszystkich podstron
   ============================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg: #0d1117;
    --bg-alt: #161b22;
    --bg-card: #21262d;
    --border: #30363d;
    --text: #c9d1d9;
    --text-muted: #8b949e;
    --accent: #58a6ff;
    --accent-2: #f78166;
}

html { scroll-behavior: smooth; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
}

.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

/* HEADER */
header {
    background: linear-gradient(135deg, #0d1117 0%, #161b22 100%);
    border-bottom: 1px solid var(--border);
    padding: 60px 0 50px;
    text-align: center;
    position: relative;
}
header h1 { font-size: 2.2rem; margin-bottom: 12px; color: #fff; }
header .subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
    max-width: 700px;
    margin: 0 auto;
}
header .badges { margin-top: 22px; }
header .badges span {
    display: inline-block;
    background: var(--bg-card);
    color: var(--text);
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    margin: 4px;
    border: 1px solid var(--border);
}

/* PRZEŁĄCZNIK JĘZYKA */
.lang-switch {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 4px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 3px;
}
.lang-switch button {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 6px 12px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
}
.lang-switch button.active { background: var(--accent); color: #fff; }

/* NAWIGACJA */
nav {
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}
nav ul {
    list-style: none;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
}
nav ul li a {
    display: block;
    color: var(--text-muted);
    text-decoration: none;
    padding: 14px 18px;
    font-size: 0.9rem;
}
nav ul li a:hover { color: var(--accent); background: var(--bg-card); }

/* SEKCJE */
section { padding: 50px 0; }
section:nth-of-type(even) { background: var(--bg-alt); }
section h2 {
    font-size: 1.8rem;
    margin-bottom: 22px;
    color: #fff;
    border-bottom: 3px solid var(--accent);
    display: inline-block;
    padding-bottom: 6px;
}
section h3 { font-size: 1.1rem; margin: 22px 0 12px; color: #fff; }
section p { margin-bottom: 14px; }
section ul { margin-left: 22px; margin-bottom: 14px; }
section ul li { margin-bottom: 6px; }

/* KARTY */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
    margin-top: 22px;
}
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: 8px;
    padding: 20px;
}
.card h3 { margin-top: 0; font-size: 1.05rem; color: var(--accent); }
.card p { font-size: 0.92rem; color: var(--text-muted); margin-bottom: 0; }

/* TABELE */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: var(--bg-card);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
}
table th {
    background: var(--bg);
    color: #fff;
    padding: 12px;
    text-align: left;
    font-size: 0.9rem;
    border-bottom: 2px solid var(--border);
}
table td {
    padding: 11px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}
table tr:last-child td { border-bottom: none; }
table tr:hover { background: var(--bg); }

/* KOD */
code {
    background: var(--bg);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: "Consolas", "Monaco", monospace;
    font-size: 0.88em;
    color: var(--accent-2);
    border: 1px solid var(--border);
}
pre {
    background: var(--bg);
    color: var(--text);
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 14px 0;
    font-size: 0.88rem;
    line-height: 1.5;
    border: 1px solid var(--border);
}
pre code {
    background: none;
    color: inherit;
    padding: 0;
    border: none;
}

/* PRZYCISKI */
.btn {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    padding: 10px 22px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    margin: 6px 6px 6px 0;
    font-size: 0.9rem;
}
.btn-secondary {
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border);
}

/* GALERIA ZDJĘĆ */
.photo-gallery {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin: 25px 0;
}
.photo-gallery figure {
    margin: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}
.photo-gallery img {
    width: 100%;
    height: auto;
    display: block;
    aspect-ratio: 4 / 3;
    object-fit: contain;
    background: #000;
    cursor: zoom-in;
    transition: transform 0.2s;
}
.photo-gallery img:hover { transform: scale(1.02); }
.photo-gallery figcaption {
    padding: 10px 14px;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
    border-top: 1px solid var(--border);
}

/* GALERIA WIDEO */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    margin: 25px 0;
}
.video-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}
.video-item video,
.video-item iframe {
    width: 100%;
    height: auto;
    display: block;
    background: #000;
    aspect-ratio: 16 / 9;
    border: none;
}
.video-item figcaption {
    padding: 10px 14px;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
    border-top: 1px solid var(--border);
}

/* BLOK KODU */
.code-block {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    margin: 20px 0;
}
.code-block .code-header {
    background: var(--bg-card);
    padding: 8px 14px;
    font-size: 0.8rem;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    font-family: "Consolas", "Monaco", monospace;
}
.code-block pre {
    margin: 0;
    border: none;
    border-radius: 0;
    padding: 16px;
}

/* PLACEHOLDER */
.photo-placeholder {
    background: var(--bg-card);
    border: 2px dashed var(--border);
    border-radius: 8px;
    padding: 60px 20px;
    text-align: center;
    color: var(--text-muted);
    margin: 20px 0;
}

/* STOPKA */
footer {
    background: var(--bg-alt);
    border-top: 1px solid var(--border);
    padding: 30px 0;
    text-align: center;
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-top: 20px;
}
footer a { color: var(--accent); text-decoration: none; }

/* ============================================
   MODAL — wyskakujące okno z opisem komendy
   ============================================ */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    overflow-y: auto;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 30px;
    max-width: 700px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7);
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 1.8rem;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--accent);
}

.modal-content h3 {
    color: var(--accent);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
    font-size: 1.2rem;
}

.modal-content p {
    margin-bottom: 12px;
}

.modal-content strong {
    color: #fff;
}

/* Wiersze tabeli komend i rejestrów — klikalne */
#commands table tr[onclick],
#internal-registers table tr[onclick] {
    cursor: pointer;
    transition: background 0.15s;
}

#commands table tr[onclick]:hover,
#internal-registers table tr[onclick]:hover {
    background: var(--bg-alt);
}

/* Wymuszenie identycznego tła dla sekcji rejestrów i komend */
#internal-registers,
#commands {
    background: var(--bg-alt);
}

/* RESPONSYWNOŚĆ */
@media (max-width: 700px) {
    .lang-switch { position: static; margin: 0 auto 20px; display: inline-flex; }
    header h1 { font-size: 1.6rem; }
    section h2 { font-size: 1.4rem; }
    nav ul li a { padding: 10px 12px; font-size: 0.85rem; }
    .photo-gallery { grid-template-columns: 1fr; }
    .modal-content { padding: 20px; max-height: 90vh; }
}

/* PRZEŁĄCZNIK JĘZYKA — logika */
.lang-pl, .lang-en { display: none; }
body[data-lang="pl"] .lang-pl { display: block; }
body[data-lang="en"] .lang-en { display: block; }
span.lang-pl, span.lang-en { display: none; }
body[data-lang="pl"] span.lang-pl { display: inline; }
body[data-lang="en"] span.lang-en { display: inline; }
li.lang-pl, li.lang-en { display: none; }
body[data-lang="pl"] li.lang-pl { display: list-item; }
body[data-lang="en"] li.lang-en { display: list-item; }
td.lang-pl, td.lang-en, th.lang-pl, th.lang-en { display: none; }
body[data-lang="pl"] td.lang-pl, body[data-lang="pl"] th.lang-pl { display: table-cell; }
body[data-lang="en"] td.lang-en, body[data-lang="en"] th.lang-en { display: table-cell; }
/* ============================================
   LINKI DO GITHUBA — sekcja download
   ============================================ */
.download-links {
    display: block;
    margin: 40px 0 20px;
    padding: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: 8px;
}

.download-links h3 {
    color: #fff;
    margin-bottom: 16px;
    font-size: 1.1rem;
}

.download-links p {
    margin-bottom: 10px;
}

/* Wszystkie stany linku — jasny błękit */
.download-links a,
.download-links a:link,
.download-links a:visited {
    color: #79c0ff !important;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.download-links a:hover,
.download-links a:focus {
    color: #a5d6ff !important;
    text-decoration: underline;
}

.download-links a:active {
    color: #cae8ff !important;
}

.download-links a::before {
    content: "→ ";
    color: #f78166;
}
/* Google Translate — poprawa wyglądu */
.goog-te-banner-frame { display: none !important; }
body { top: 0 !important; }
.goog-te-gadget { font-family: inherit !important; font-size: 0.85rem !important; }
.goog-te-gadget-simple {
    background: var(--bg-card) !important;
    border: 1px solid var(--border) !important;
    border-radius: 6px !important;
    padding: 4px 8px !important;
}
.goog-te-gadget-simple .goog-te-menu-value { color: var(--text) !important; }
.goog-te-gadget-icon { display: none !important; }