/* Simplified and Accessible CSS for Lab Assignments */

/* Base styles */
* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #fff;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    line-height: 1.3;
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    font-weight: bold;
}

h1 { font-size: 2em; }
h2 { font-size: 1.5em; }
h3 { font-size: 1.25em; }
h4 { font-size: 1.1em; }

p {
    margin: 1em 0;
}

/* Links */
a {
    color: #0050a0;  /* Enhanced contrast: 7.03:1 ratio (WCAG AAA) */
    text-decoration: underline;
    word-wrap: break-word;
}

a:hover, a:focus {
    color: #003d7a;  /* Darker on hover for better contrast */
    text-decoration: none;
}

/* Focus visible for keyboard navigation only */
a:focus-visible {
    outline: 2px solid #0050a0;
    outline-offset: 2px;
}

/* Remove focus outline for mouse clicks */
a:focus:not(:focus-visible) {
    outline: none;
}

/* External link indicator */
a[href^="http"]:not([href*="aholdengouveia.name"])::after,
a[href^="https"]:not([href*="aholdengouveia.name"])::after {
    content: " ↗";
    font-size: 0.8em;
    vertical-align: super;
    color: #0050a0;
    text-decoration: none;
}

a[href^="http"]:not([href*="aholdengouveia.name"]):hover::after,
a[href^="https"]:not([href*="aholdengouveia.name"]):hover::after {
    color: #003d7a;
}

/* Lists */
ol, ul {
    margin: 1em 0;
    padding-left: 2em;
}

li {
    margin: 0.5em 0;
}

/* Images and Figures */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

figure {
    margin: 2em 0;
    text-align: center;
}

figcaption {
    margin-top: 0.5em;
    font-style: italic;
    color: #666;
}

/* Tables */
.table-container {
    overflow-x: auto;
    margin: 2em 0;
}

table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #ddd;
    background-color: #fff;
}

caption {
    font-weight: bold;
    font-size: 1.1em;
    margin-bottom: 0.5em;
    padding: 0.5em;
    text-align: left;
    caption-side: top;
}

th, td {
    padding: 0.75em;
    text-align: left;
    border: 1px solid #ddd;
}

th {
    background-color: #f8f9fa;
    font-weight: bold;
    color: #333;
}

thead th {
    background-color: #e9ecef;
    border-bottom: 2px solid #adb5bd;
}

tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

tbody tr:hover {
    background-color: #e9ecef;
}

/* Code and monospace */
code, pre, .monospace {
    font-family: "Courier New", Courier, monospace;
    background-color: #f5f5f5;
    border-radius: 3px;
}

code {
    padding: 0.2em 0.4em;
}

pre {
    display: block;
    padding: 1em;
    overflow-x: auto;
    border: 1px solid #ddd;
}

pre code {
    background-color: transparent;
    padding: 0;
    border-radius: 0;
}

/* Author and metadata */
.author {
    text-align: center;
    margin: 1em 0;
}

/* Accessibility improvements */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border-width: 0;
}

/* Skip navigation link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #000;
    color: #fff;
    padding: 8px 16px;
    text-decoration: none;
    z-index: 100;
    border-radius: 0 0 4px 0;
}

.skip-link:focus-visible {
    top: 0;
    color: #fff;
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* Breadcrumb Navigation */
.breadcrumb-nav {
    margin: 1em 0;
    padding: 0.75em 0;
}

.breadcrumb {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    font-size: 0.9em;
}

.breadcrumb li {
    display: inline;
    margin: 0;
}

.breadcrumb li + li::before {
    content: "›";
    padding: 0 0.5em;
    color: #666;
}

.breadcrumb a {
    color: #0050a0;
    text-decoration: none;
}

.breadcrumb a:hover,
.breadcrumb a:focus {
    text-decoration: underline;
}

.breadcrumb li[aria-current="page"] {
    color: #666;
    font-weight: normal;
}

/* Table of Contents */
.toc {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 1.5em;
    margin: 2em 0;
}

.toc h2 {
    margin-top: 0;
    font-size: 1.25em;
    color: #333;
}

.toc ul {
    list-style-type: none;
    padding-left: 0;
    margin: 0.5em 0 0 0;
}

.toc li {
    margin: 0.5em 0;
    padding-left: 1em;
    position: relative;
}

.toc li::before {
    content: "▸";
    position: absolute;
    left: 0;
    color: #0050a0;
}

.toc a {
    display: inline-block;
    padding: 0.25em 0;
}

/* Print styles */
@media print {
    body {
        max-width: 100%;
        padding: 0;
    }

    a {
        text-decoration: none;
        color: #000;
    }

    a[href]:after {
        content: " (" attr(href) ")";
    }
}

/* Mobile responsive */
@media (max-width: 600px) {
    body {
        padding: 10px;
    }

    h1 { font-size: 1.75em; }
    h2 { font-size: 1.5em; }
}

/* Respect user's motion preferences */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #1a1a1a;
        color: #e0e0e0;
    }

    a {
        color: #82baff;  /* 8.6:1 on #1a1a1a, 7.1:1 on #2a2a2a — passes WCAG AAA */
    }

    a:hover, a:focus {
        color: #8fb9ff;
    }

    a[href^="http"]:not([href*="aholdengouveia.name"])::after,
    a[href^="https"]:not([href*="aholdengouveia.name"])::after {
        color: #82baff;
    }

    a[href^="http"]:not([href*="aholdengouveia.name"]):hover::after,
    a[href^="https"]:not([href*="aholdengouveia.name"]):hover::after {
        color: #8fb9ff;
    }

    code, pre {
        background-color: #2a2a2a;
        color: #e0e0e0;
        border: 1px solid #444;
    }

    figcaption {
        color: #999;
    }

    table {
        border-color: #444;
        background-color: #1a1a1a;
    }

    th, td {
        border-color: #444;
    }

    th {
        background-color: #2a2a2a;
        color: #e0e0e0;
    }

    thead th {
        background-color: #333;
        border-bottom-color: #666;
    }

    tbody tr:nth-child(even) {
        background-color: #222;
    }

    tbody tr:hover {
        background-color: #2a2a2a;
    }

    .skip-link {
        background: #fff;
        color: #000;
    }

    .skip-link:focus-visible {
        outline: 2px solid #6ba3ff;
    }

    a:focus-visible {
        outline: 2px solid #82baff;
    }

    .toc {
        background-color: #2a2a2a;
        border-color: #444;
    }

    .toc h2 {
        color: #e0e0e0;
    }

    .toc li::before {
        color: #6ba3ff;
    }

    .breadcrumb a {
        color: #82baff;  /* Explicit override — inheriting #0050a0 gives only 2.2:1 on #1a1a1a */
    }

    .breadcrumb li + li::before {
        color: #999;
    }

    .breadcrumb li[aria-current="page"] {
        color: #aaaaaa;  /* #999 gives 6.1:1 on #1a1a1a; #aaa gives 7.5:1 */
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    body {
        color: #000;
        background-color: #fff;
    }

    a {
        color: #0000ee;
        text-decoration: underline;
        font-weight: bold;
    }

    a:hover {
        color: #0000ee;
        background-color: #ffff00;
    }

    a:focus-visible {
        color: #0000ee;
        background-color: #ffff00;
        outline: 3px solid #000;
        outline-offset: 2px;
    }

    a[href^="http"]:not([href*="aholdengouveia.name"])::after,
    a[href^="https"]:not([href*="aholdengouveia.name"])::after {
        color: #0000ee;
        font-weight: bold;
    }

    a[href^="http"]:not([href*="aholdengouveia.name"]):hover::after,
    a[href^="https"]:not([href*="aholdengouveia.name"]):hover::after {
        background-color: #ffff00;
    }

    code, pre {
        background-color: #fff;
        color: #000;
        border: 2px solid #000;
    }

    .skip-link {
        background: #000;
        color: #fff;
        border: 2px solid #fff;
    }

    .skip-link:focus-visible {
        outline: 3px solid #000;
        background: #fff;
        color: #000;
    }

    .breadcrumb li + li::before {
        color: #000;
        font-weight: bold;
    }

    .breadcrumb li[aria-current="page"] {
        color: #000;
        font-weight: bold;
    }
}
