/* ============================================================
   AXE v0.4.1-dev
   Semantic-first. Classless defaults.
   Write plain HTML. It looks good.

   Author: David M. Anderson
   Built with AI assistance (Claude, Anthropic)
   ============================================================ */

/* Framework version. Bump on each axe release and keep it in sync with
   calendar.css / calendar.js. Audit a deployment with
   `curl <site>/axe/axe.css | head`, or read --axe-version in devtools. */
:root {
    --axe-version: "0.4.1-dev";
}


/* --- Reset ----------------------------------------------- */

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    scroll-padding-top: 64px;
}


/* --- Base ------------------------------------------------- */

body {
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: var(--line-height, 1.7);
    color: var(--color-text);
    background: var(--color-bg);
    transition: background 0.2s ease, color 0.2s ease;
}

img {
    display: block;
    max-width: 100%;
    height: auto;
}


/* --- Navigation ------------------------------------------- */

nav {
    background: var(--color-nav-bg);
    position: sticky;
    top: 0;
    z-index: 100;
}

nav ul {
    list-style: none;
    display: flex;
    align-items: center;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1rem;
    height: 54px;
    gap: 0;
    overflow-x: auto;
}

nav ul li {
    color: var(--color-nav-text);
}

nav ul li a {
    display: block;
    color: var(--color-nav-text);
    text-decoration: none;
    padding: 0.4rem 0.875rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    opacity: 0.88;
    transition: background 0.15s, opacity 0.15s;
}

nav ul li a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--color-nav-text);
    text-decoration: none;
    opacity: 1;
}


/* --- Layout ----------------------------------------------- */

main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

article {
    max-width: 860px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
    background: var(--color-surface);
    box-shadow: var(--shadow);
}

/* Section separators are document-flow furniture — scoped to articles
   so page-level <main><section> layouts (full-width landing pages)
   don't inherit doc-style dividers. */
article section {
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 1px solid var(--color-border);
}

article section:first-child,
article header + section {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}


/* --- Card Grid -------------------------------------------- */

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.25rem;
}

.grid > article, .grid > a {
    max-width: none;
    margin: 0;
    padding: 1.5rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.grid > a {
    display: block;
    text-decoration: none;
    color: inherit;
}

.grid > article:hover, .grid > a:hover {
    border-color: var(--color-accent);
    box-shadow: var(--shadow-md);
    text-decoration: none;
}

/* Header spacing is document-flow furniture — scoped to article so
   site-chrome <header> (sticky nav bars) can sit flush against the
   hero or first section below it. */
article header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--color-border);
}


/* --- Typography ------------------------------------------- */

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    line-height: 1.2;
    color: var(--color-text);
    margin-top: 1.75em;
    margin-bottom: 0.4em;
}

h1 { font-size: 1.65rem; font-weight: 700; }
h2 { font-size: 1.3rem;  font-weight: 600; }
h3 { font-size: 1.2rem;  font-weight: 600; }
h4 { font-size: 1rem;    font-weight: 600; }
h5 { font-size: 0.9rem;  font-weight: 600; }
h6 { font-size: 0.85rem; font-weight: 600; color: var(--color-text-muted); }

h1:first-child,
h2:first-child,
h3:first-child { margin-top: 0; }

p {
    margin-bottom: 1rem;
}

p:last-child { margin-bottom: 0; }

a {
    color: var(--color-accent);
    text-decoration: none;
}

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

strong { font-weight: 700; }
em     { font-style: italic; }

small {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

mark {
    background: color-mix(in srgb, var(--color-highlight, var(--color-accent)) 35%, transparent);
    color: inherit;
    padding: 0.1em 0.25em;
    border-radius: calc(var(--radius) * 0.4);
}

abbr[title] {
    text-decoration: underline dotted;
    cursor: help;
}

sub, sup {
    font-size: 0.75em;
    line-height: 0;
    position: relative;
    vertical-align: baseline;
}

sup { top: -0.5em; }
sub { bottom: -0.25em; }

address {
    font-style: normal;
    color: var(--color-text-muted);
    margin-bottom: 1rem;
}


/* --- Blockquote ------------------------------------------- */

blockquote {
    border-left: 4px solid var(--color-accent);
    padding: 1rem 1.25rem;
    margin: 1.5rem 0;
    color: var(--color-text-muted);
    font-size: 1.05rem;
}

blockquote footer {
    background: none;
    border-top: none;
    text-align: left;
    padding: 0.5rem 0 0;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

blockquote footer::before {
    content: "\2014\00a0";
}


/* --- Lists ------------------------------------------------ */

ul, ol {
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

li { margin-bottom: 0.25rem; }

dl {
    margin-bottom: 1rem;
}

dt {
    font-weight: 600;
    margin-top: 0.75rem;
}

dt:first-child { margin-top: 0; }

dd {
    margin-left: 1.5rem;
    color: var(--color-text-muted);
}


/* --- Figure ----------------------------------------------- */

figure {
    margin: 1.5rem 0;
}

figure img {
    border-radius: var(--radius);
}

figcaption {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-top: 0.5rem;
    text-align: center;
}


/* --- Aside / Callout -------------------------------------- */

aside {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--color-accent);
    border-radius: 0 var(--radius) var(--radius) 0;
    padding: 1rem 1.25rem;
    margin: 1.5rem 0;
    box-shadow: var(--shadow);
    color: var(--color-text-muted);
    font-size: 0.925rem;
}


/* --- Details / Disclosure --------------------------------- */

details {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    background: var(--color-surface);
}

details[open] {
    padding-bottom: 1rem;
}

summary {
    padding: 0.75rem 1rem;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

summary::before {
    content: "\25b6";
    font-size: 0.65em;
    transition: transform 0.15s;
}

details[open] summary::before {
    transform: rotate(90deg);
}

summary::-webkit-details-marker { display: none; }

details > :not(summary) {
    padding: 0 1rem;
}


/* --- Horizontal Rule -------------------------------------- */

hr {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: 2rem 0;
}


/* --- Code ------------------------------------------------- */

code {
    font-family: var(--font-mono);
    font-size: 0.875em;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    padding: 0.1em 0.35em;
    border-radius: calc(var(--radius) * 0.6);
}

pre {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    overflow-x: auto;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}

pre code {
    background: none;
    border: none;
    padding: 0;
    font-size: 1em;
}

kbd {
    font-family: var(--font-mono);
    font-size: 0.85em;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-bottom-width: 2px;
    padding: 0.1em 0.4em;
    border-radius: calc(var(--radius) * 0.6);
}

samp {
    font-family: var(--font-mono);
    font-size: 0.875em;
}


/* --- Tables ----------------------------------------------- */

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

th {
    text-align: left;
    font-weight: 600;
    padding: 0.6rem 0.875rem;
    background: var(--color-bg);
    border-bottom: 2px solid var(--color-border);
    color: var(--color-text);
}

td {
    padding: 0.55rem 0.875rem;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text);
}

tr:last-child td { border-bottom: none; }

caption {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    text-align: left;
    margin-bottom: 0.5rem;
}


/* --- Forms ------------------------------------------------ */

input, textarea, select {
    font-family: inherit;
    font-size: 1rem;
    color: var(--color-text);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 0.5rem 0.75rem;
    width: 100%;
    transition: border-color 0.15s;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--color-accent);
}

textarea {
    resize: vertical;
    min-height: 6rem;
}

label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

fieldset {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

legend {
    font-weight: 600;
    padding: 0 0.5rem;
    font-size: 0.95rem;
}

button, input[type="submit"], input[type="reset"] {
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-surface);
    background: var(--color-accent);
    border: none;
    border-radius: var(--radius);
    padding: 0.5rem 1.25rem;
    cursor: pointer;
    transition: opacity 0.15s;
    width: auto;
}

button:hover, input[type="submit"]:hover, input[type="reset"]:hover {
    background: var(--color-accent-hover);
}


/* --- Footer ----------------------------------------------- */

footer {
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    text-align: center;
    padding: 1.5rem;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}


/* --- Theme Toggle ----------------------------------------- */

.theme-toggle {
    background: none;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 0.3rem 0.55rem;
    cursor: pointer;
    color: var(--color-text-muted);
    font-size: 0.85rem;
    line-height: 1;
    transition: border-color 0.15s, color 0.15s;
    width: auto;
}

.theme-toggle:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
}

/* In the nav, the toggle uses the nav palette, not the body palette. */
nav .theme-toggle {
    color: var(--color-nav-text);
    border-color: var(--color-nav-text);
}

nav .theme-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--color-nav-text);
    border-color: var(--color-nav-text);
}

.nav-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}


/* --- Desktop ---------------------------------------------- */

@media (min-width: 601px) {
    main, article {
        padding: 2.5rem 1.5rem;
    }

    h1 { font-size: 2rem; }
    h2 { font-size: 1.5rem; }

    nav ul {
        padding: 0 1.5rem;
        gap: 0.125rem;
        overflow-x: visible;
    }
}

/* Tables scroll horizontally on small screens */
article table {
    display: block;
    overflow-x: auto;
}
