/* Basic reset and typography */
html, body {
    background: url('https://www.transparenttextures.com/patterns/cubes.png'), url('https://images.unsplash.com/photo-1464822759023-fed622ff2c3b?w=1920&q=80');
    background-size: auto, cover;
    background-position: top left, center;
    background-attachment: fixed, fixed;
    background-color: #fafafa;
    min-height: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.65;
}

/* Container layout */
.container {
    background: white;
    max-width: 840px;
    margin: 0 auto;
    min-height: 100%;
    display: grid;
    border-left: 1px solid #bae6fd;
    border-right: 1px solid #bae6fd;
    grid-template-rows: auto auto 1fr auto;
    box-shadow: 0 2px 16px rgba(2, 132, 199, 0.15);
    min-width: 708px;
    padding: 0 1.5rem 2rem;
}

/* Typography */
h1, h2, h3 {
    text-align: center;
    margin-top: 0;
    text-shadow: 1px 1px 0 white;
    color: #0c4a6e;
}

h1 {
    padding-top: 1rem;
    margin-bottom: 0.5rem;
    text-decoration: underline;
    text-decoration-color: #0284c7;
    text-decoration-thickness: 2px;
    text-underline-offset: 6px;
    letter-spacing: 0.06em;
}

h2 {
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
}

h3 {
    margin-top: 0.75rem;
    margin-bottom: 0.25rem;
}

h2 small {
    display: block;
}

h4, h5, h6 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

/* Paragraphs */
p {
    margin-top: 0;
    margin-bottom: 0.65rem;
    text-align: left;
    line-height: 1.65;
}

/* Links */
a {
    color: #0284c7;
    text-decoration: underline;
}

a:hover {
    color: #0c4a6e;
    text-decoration: none;
}

a:visited {
    color: #6366f1;
}

/* Lists */
ul, ol {
    margin-top: 0;
    margin-bottom: 0.5rem;
    padding-left: 0;
    font-size: 0.95rem;
    list-style: none;
}

ul li::before {
    content: '▶';
    color: #0284c7;
    font-size: 0.6rem;
    margin-right: 0.5rem;
    vertical-align: middle;
}

ol {
    list-style: decimal inside;
    padding-left: 0;
}

ol li::marker {
    color: #0284c7;
    font-weight: bold;
}

li {
    margin-bottom: 0.3rem;
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Blockquotes */
blockquote {
    margin: 1rem 0;
    padding: 0.5rem 1rem;
    border-left: 4px solid #ccc;
    background-color: #f9f9f9;
    font-style: italic;
}

/* Code */
code {
    font-family: Consolas, monospace;
    background-color: #e0f2fe;
    padding: 0.2rem 0.4rem;
    font-size: 0.85rem;
    color: black;
    white-space: nowrap;
}

pre {
    background-color: #f0f9ff;
    padding: 0.75rem 1rem;
    border: 1px solid #bae6fd;
    border-left: 3px solid #0284c7;
    overflow-x: auto;
    margin-top: 0;
    margin-bottom: 0.75rem;
    white-space: pre-wrap;
    font-size: 0.85rem;
    color: black;
}

pre code {
    background-color: transparent;
    padding: 0;
    white-space: pre-wrap;
    font-size: 0.85rem;
    color: black;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

th, td {
    border: 1px solid #ddd;
    padding: 0.5rem;
    text-align: left;
    vertical-align: top;
}

th {
    background-color: #e0f2fe;
    font-weight: bold;
    color: #0c4a6e;
}

td:first-child {
    white-space: nowrap;
}

tr:nth-child(even) {
    background-color: #f0f9ff;
}

/* Images */
img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1rem auto;
}

/* Horizontal rules */
hr {
    border: none;
    height: 1px;
    background-color: #ccc;
    margin: 1rem 0;
}

/* Strong and emphasis */
strong, b {
    font-weight: bold;
}

em, i {
    font-style: italic;
}

/* Footer */
footer {
    margin-top: 1rem;
    padding: 1rem;
    text-align: center;
    font-size: 0.9rem;
    color: #333;
}

/* PWA standalone mode — skip decorative background network requests */
@media (display-mode: standalone) {
    html, body {
        background: #fafafa;
    }
}

/* Mobile responsiveness */
@media (max-width: 700px) {
    .container {
        min-width: unset;
        padding: 0 1rem 1.5rem;
    }

    pre {
        max-width: 100%;
    }

    /* Reflow tables: each row becomes a stacked block */
    table, thead, tbody, th, td, tr {
        display: block;
    }

    thead tr {
        display: none;
    }

    tr {
        border: 2px solid #7dd3fc;
        margin-bottom: 1.25rem;
        border-radius: 2px;
    }

    td {
        border: none;
        border-bottom: 1px solid #ddd;
        padding: 0.5rem 0.6rem;
    }

    td:first-child {
        background-color: #e0f2fe;
        font-weight: bold;
        font-size: 0.9rem;
    }

    td:last-child {
        border-bottom: none;
    }
}