:root {
    --base-hue: 215; /* ink blue */
    --brand-color: hsl(
        var(--base-hue),
        80%,
        65%
    ); /* lighter blue - default link color */
    --highlight-color: hsl(calc(var(--base-hue) + 180), 84%, 40%);
    --action-color: hsl(
        var(--base-hue),
        70%,
        45%
    ); /* darker blue - hover color */

    /* Callout colors based on brand hue rotations */
    --tip-hue: calc(
        var(--base-hue) + 60
    ); /* 60° rotation for distinct but harmonious color */
    --tip-bg-color: hsl(var(--tip-hue), 45%, 95%);
    --tip-border-color: hsl(var(--tip-hue), 60%, 50%);
    --tip-text-color: hsl(var(--tip-hue), 60%, 40%);

    --info-hue: calc(var(--base-hue) - 30); /* analogous: 30° rotation */
    --info-bg-color: hsl(var(--info-hue), 45%, 95%);
    --info-border-color: hsl(var(--info-hue), 80%, 55%);
    --info-text-color: hsl(var(--info-hue), 80%, 45%);
}
body {
    font-family:
        -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
        sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}
/* https://stackoverflow.com/questions/2436749/how-to-add-multiple-font-files-for-the-same-font */
@font-face {
    font-family: "BerkeleyMono";
    src:
        url("../fonts/BerkeleyMono-Regular.woff2"),
        url("../fonts/BerkeleyMono-Regular.woff");
    font-weight: bold;
    font-style: italic, oblique;
}
@font-face {
    font-family: "BerkeleyMono";
    src:
        url("../fonts/BerkeleyMono-Italic.woff2"),
        url("../fonts/BerkeleyMono-Italic.woff");
    font-style: italic, oblique;
}
@font-face {
    font-family: "BerkeleyMono";
    src:
        url("../fonts/BerkeleyMono-Bold.woff2"),
        url("../fonts/BerkeleyMono-Bold.woff");
    font-weight: bold;
}
@font-face {
    font-family: "BerkeleyMono";
    src:
        url("../fonts/BerkeleyMono-Regular.woff2"),
        url("../fonts/BerkeleyMono-Regular.woff");
}
.container {
    max-width: 700px;
}

#nav {
    padding: 0.5rem 0.5rem;
    color: var(--brand-color);
}

nav a {
    padding: 0.1rem;
}

#nav a {
    color: var(--brand-color);
    text-decoration: none;
}

#nav a:hover {
    color: var(--action-color);
}

a {
    color: var(--brand-color);
    text-decoration: underline;
}

/* Remove underline from links in headings */
h1 a,
h2 a,
h3 a,
h4 a,
h5 a,
h6 a {
    text-decoration: none;
}

a:hover {
    color: var(--action-color);
    text-decoration: underline;
}

a.tag-btn:hover {
    background-color: var(--brand-color);
    color: white;
    filter: brightness(1);
}

.icon {
    width: 24px;
    height: 24px;
    margin-right: 5px;
}

#nav a #section {
    padding-right: 2rem;
}

#nav-border {
    border-bottom: 1px solid var(--brand-color);
}

strong {
    font-weight: 700;
}

#main {
    font-weight: 400;
    font-size: 1rem;
    margin-top: 1em;
    margin-bottom: 4em;
}

#main p {
    line-height: 1.7rem;
}

#main h1,
h2,
h3,
h4 {
    font-weight: 600;
    padding-bottom: 1rem;
    padding-top: 1.3rem;
}

/* Reduce top spacing for first h1 on pages */
#main > h1:first-child,
#main > header > h1:first-child {
    padding-top: 0.5rem;
}

h2 {
    font-size: 1.9rem;
}

#home-jumbotron {
    background-color: inherit;
    padding: 2rem 2rem;
    margin-bottom: 2rem;
}

/* Search form styling */
.form-inline #search-query {
    margin-right: 0.5rem;
}

.search-button {
    background-color: var(--action-color);
    color: white;
    border: 1px solid var(--action-color);
    padding: 0.375rem 1rem;
}

.search-button:hover {
    background-color: var(--brand-color);
    border-color: var(--brand-color);
    color: white;
}

header h1 {
    padding-bottom: 0.25rem;
    margin-bottom: 0;
}

.article-meta {
    margin-bottom: 1rem;
}

.article-meta time {
    display: block;
    margin-bottom: 0.5rem;
}

#main blockquote {
    font-weight: 300;
    font-style: italic;
    padding-left: 1rem;
    margin-left: 1rem;
    border-left: solid hsla(237, 0%, 90%, 1) 5px;
}

/* TIP and INFO blockquote styling */
#main blockquote.tip,
#main blockquote.info {
    font-style: normal;
    font-weight: 400;
    padding: 1rem 1rem 1rem 1rem;
    margin: 1.5rem 0;
    border-radius: 4px;
    position: relative;
}

#main blockquote.tip {
    background-color: var(--tip-bg-color);
    border-left: solid var(--tip-border-color) 5px;
}

#main blockquote.info {
    background-color: var(--info-bg-color);
    border-left: solid var(--info-border-color) 5px;
}

#main blockquote.tip::before,
#main blockquote.info::before {
    content: "";
    font-weight: 700;
    font-style: normal;
    font-size: 0.9rem;
    display: block;
    margin-bottom: 0.5rem;
    letter-spacing: 0.05em;
}

#main blockquote.tip::before {
    content: "💡 TIP";
    color: var(--tip-text-color);
}

#main blockquote.info::before {
    content: "ℹ️ INFO";
    color: var(--info-text-color);
}

#main blockquote.tip p,
#main blockquote.info p {
    margin: 0;
}

.font-125 {
    font-size: 125%;
}

.tag-btn {
    margin-bottom: 0.5rem;
    margin-right: 0.5rem;
    text-decoration: none;
    background-color: hsl(var(--base-hue), 30%, 95%);
    border-color: hsl(var(--base-hue), 30%, 85%);
}

.btn {
    text-decoration: none;
}

.btn:hover {
    text-decoration: none;
}

img {
    max-width: 100%;
}

.summary {
    color: hsla(237, 0%, 25%, 1);
    font-size: 0.9rem;
}

#abstract {
    border-radius: 10px;
    background-color: hsla(237, 0%, 90%, 1);
    padding: 1rem 1.2rem;
    margin-bottom: 1rem;
}

aside.toc ul > li {
    list-style-type: none;
    padding-left: 1.5rem;
}
aside.toc ul {
    padding-left: 0;
}

figure img {
    /*box-shadow: 0rem 0rem 1rem hsl(0, 0%, 80%);*/
    display: block;
    margin-left: auto;
    margin-right: auto;
}

figcaption h4 {
    font-size: 1.1rem;
    text-align: center;
    font-style: italic;
    padding-top: 1.5em;
    padding-bottom: 2em;
}

article ol,
article ul {
    margin-left: 0.5rem;
    padding-left: 1.6rem;
}

article ol li,
article ul li {
    padding-top: 0.6rem;
    margin-left: 0;
    padding-left: 0;
}

code,
pre {
    font-family: "BerkeleyMono", monospace;
}

pre {
    overflow-x: auto;
    max-width: 100%;
    font-size: 0.9em;
    /* Force scrollbar to always be visible */
    scrollbar-width: thin; /* Firefox */
    -webkit-overflow-scrolling: touch; /* iOS momentum scrolling */
}

/* Force scrollbar visibility on WebKit browsers (Safari, Chrome) */
pre::-webkit-scrollbar {
    height: 12px;
    -webkit-appearance: none;
}

pre::-webkit-scrollbar-track {
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

pre::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
}

pre::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 0, 0, 0.5);
}

code {
    color: var(--highlight-color);
}

.highlight {
    overflow-x: auto;
    max-width: 100%;
    /* Force scrollbar to always be visible */
    scrollbar-width: thin; /* Firefox */
}

/* Force scrollbar visibility on .highlight for WebKit browsers */
.highlight::-webkit-scrollbar {
    height: 12px;
    -webkit-appearance: none;
}

.highlight::-webkit-scrollbar-track {
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

.highlight::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
}

.highlight::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 0, 0, 0.5);
}

.highlight code {
    font-size: 1em;
}

p code {
    font-size: 0.95em;
}

article > dl > dd {
    padding-left: 2rem;
}

code.has-jax {
    -webkit-font-smoothing: antialiased;
    background: inherit !important;
    border: none !important;
    font-size: 100%;
}

article table {
    margin: 2rem 0 2rem 0;
    padding: 2rem;
    border: 2px solid hsl(0, 0%, 40%);
}

article table td,
article table th {
    padding: 0.2rem 1rem;
    border: 1px solid hsl(0, 0%, 80%);
}

article table th {
    text-align: center;
}
/* Footer styling */
footer {
    margin-top: 4rem;
    padding: 2rem 0;
    border-top: 1px solid var(--brand-color);
}

.footer-links nav {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 2rem;
}

.footer-links a {
    color: var(--brand-color);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    padding: 0.5rem;
}

.footer-links a:hover {
    color: var(--action-color);
}

.footer-links .icon {
    width: 20px;
    height: 20px;
    margin-right: 0.5rem;
}

@media print {
    .no-print {
        display: none;
    }
}

/* Accessibility improvements */

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

/* Skip to main content link */
.skip-to-main {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--brand-color);
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    z-index: 100;
    border-radius: 0 0 4px 0;
}

.skip-to-main:focus {
    top: 0;
    color: white;
    outline: 3px solid var(--action-color);
    outline-offset: 2px;
}

/* Improved focus states for keyboard navigation */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid var(--action-color);
    outline-offset: 2px;
}

/* Remove focus outline for mouse users but keep for keyboard */
a:focus:not(:focus-visible),
button:focus:not(:focus-visible),
input:focus:not(:focus-visible) {
    outline: none;
}

/* Ensure sufficient color contrast for tag buttons */
.tag-btn:focus-visible,
.btn:focus-visible {
    outline: 3px solid var(--action-color);
    outline-offset: 2px;
}

/* Improve nav icon accessibility */
nav a:focus-visible {
    outline: 3px solid var(--action-color);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Content type badge styling */
.badge.badge-secondary {
    background-color: var(--brand-color);
    color: white;
    vertical-align: baseline;
    position: relative;
    top: -0.15em;
    margin-right: 0.5rem;
}

/* Home page horizontal rule spacing */
#main hr {
    margin-top: 2rem;
    margin-bottom: 2rem;
}

/* D2 diagram styling */
figure.d2-diagram {
    margin: 2rem 0;
}

figure.d2-diagram img {
    max-width: 100%;
    height: auto;
    width: 70%; /* Default scale for diagrams (can be overridden with width parameter) */
}

figure.d2-diagram figcaption {
    font-size: 0.9rem;
    text-align: center;
    font-style: italic;
    padding-top: 0.5rem;
}
