/* Aesir NS product site, built on Athena UI (vendor/athena-ui-js, 2.15.0).
   Athena's rules are in the cascade layer "athena"; everything here is unlayered, so it wins.
   The Aesir colours are an Athena theme: the --athena-* tokens for data-theme="aesir".
   Without JavaScript the page follows the system (prefers-color-scheme); with it, theme-boot.js
   puts data-mode on <html> and the switch in the header can choose light or dark.
   Colours of Odin's Aesir theme: #000099, #71797E, #FFA500, white, black.
   White on #000099 14.4:1; #FFA500 on black 10.6:1; #565d61 on white 6.7:1. */

/* ---------------------------------------------------------------- theme */
:root[data-theme="aesir"] {
    color-scheme: light;
    --athena-bg: #ffffff;               /* cards, tiles */
    --athena-fg: #000000;
    --athena-muted: #565d61;
    --athena-border: #71797e;
    --athena-line: #c3c7ca;
    --athena-field-border: #767c80;
    --athena-surface: #e6e8ea;
    --athena-surface-alt: #f0f1f3;      /* the page */
    --athena-hover: #e6e6f5;
    --athena-overlay: rgb(0 0 0 / 45%);
    --athena-accent: #000099;
    --athena-accent-fg: #ffffff;
    --athena-focus: #000099;
    --athena-danger: #a8231b;
    --athena-success: #1d6b3a;
    --athena-warning: #6b4200;
    --athena-info: #000099;
    --athena-info-fg: #fff; --athena-success-fg: #fff; --athena-warning-fg: #fff; --athena-danger-fg: #fff;
    --athena-shadow: 0 1px 2px rgb(0 0 0 / 8%), 0 4px 16px rgb(0 0 0 / 6%);
    --athena-radius: 10px;
    --athena-radius-control: 8px;
    --site-header-bg: #000099;
    --site-header-fg: #ffffff;
    --site-header-accent: #ffa500;
    --site-code-bg: #0d0d17;
    --site-code-fg: #e6e8ea;
}

:root[data-theme="aesir"][data-mode="dark"] {
    color-scheme: dark;
    --athena-bg: #0d0d17;
    --athena-fg: #ffffff;
    --athena-muted: #a9b0b5;
    --athena-border: #71797e;
    --athena-line: #2d3040;
    --athena-field-border: #8a9095;
    --athena-surface: #181826;
    --athena-surface-alt: #000000;
    --athena-hover: #1d1d33;
    --athena-accent: #ffa500;
    --athena-accent-fg: #000000;
    --athena-focus: #ffa500;
    --athena-danger: #ff8a80;
    --athena-success: #6fd29a;
    --athena-warning: #ffc766;
    --athena-info: #8c99ff;
    --athena-info-fg: #000; --athena-success-fg: #000; --athena-warning-fg: #000; --athena-danger-fg: #000;
    --athena-shadow: none;
    --site-code-bg: #05050c;
}

/* The same dark colours without JavaScript (no data-mode on <html>) on a dark system */
@media (prefers-color-scheme: dark) {
    :root[data-theme="aesir"]:not([data-mode]) {
        color-scheme: dark;
        --athena-bg: #0d0d17;
        --athena-fg: #ffffff;
        --athena-muted: #a9b0b5;
        --athena-border: #71797e;
        --athena-line: #2d3040;
        --athena-field-border: #8a9095;
        --athena-surface: #181826;
        --athena-surface-alt: #000000;
        --athena-hover: #1d1d33;
        --athena-accent: #ffa500;
        --athena-accent-fg: #000000;
        --athena-focus: #ffa500;
        --athena-danger: #ff8a80;
        --athena-success: #6fd29a;
        --athena-warning: #ffc766;
        --athena-info: #8c99ff;
        --athena-info-fg: #000; --athena-success-fg: #000; --athena-warning-fg: #000; --athena-danger-fg: #000;
        --athena-shadow: none;
        --site-code-bg: #05050c;
    }
}

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

@media (prefers-reduced-motion: no-preference) {
    html { scroll-behavior: smooth; }
}

body {
    margin: 0;
    background: var(--athena-surface-alt);
    color: var(--athena-fg);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    overflow-wrap: break-word;
}

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

/* not on .athena-button: an unlayered "a" rule would beat Athena's (layered) button colours */
a:where(:not(.athena-button)) { color: var(--athena-accent); text-underline-offset: 0.18em; }
a:where(:not(.athena-button)):hover { text-decoration-thickness: 2px; }

:focus-visible {
    outline: 3px solid var(--athena-focus);
    outline-offset: 3px;
}

h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5em; text-wrap: balance; }
h1 { font-size: clamp(2rem, 1.4rem + 3vw, 3.25rem); letter-spacing: -0.02em; }
h2 { font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2.1rem); letter-spacing: -0.01em; }
h3 { font-size: 1.125rem; }
p { margin: 0 0 1em; }

code, pre {
    font-family: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 0.92em;
}

:not(pre) > code {
    background: var(--athena-surface);
    padding: 0.1em 0.35em;
    border-radius: 4px;
}

.wrap {
    width: min(100% - 2rem, 1160px);
    margin-inline: auto;
}

.skip-link {
    position: absolute;
    left: 1rem;
    top: -10rem;
    z-index: 10;
}
.skip-link:focus { top: 1rem; }

/* ---------------------------------------------------------------- header */
.site-header {
    background: var(--site-header-bg);
    color: var(--site-header-fg);
}

.site-header .wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 1.5rem;
    padding-block: 0.5rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    min-height: 44px;
    margin-right: auto;
    color: inherit;
    font-weight: 700;
    font-size: 1.15rem;
    text-decoration: none;
}
.brand img { width: 36px; height: 36px; }

.site-nav ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.site-nav a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 0.75rem;
    border-radius: 6px;
    color: inherit;
    text-decoration: none;
}
.site-nav a:hover { background: rgb(255 255 255 / 12%); }

/* The light / dark switch (made by js/site.js; without JavaScript it is not there) */
.site-mode.athena-button {
    min-height: 40px;
    background: transparent;
    color: var(--site-header-fg);
    border-color: rgb(255 255 255 / 60%);
}
.site-mode.athena-button:hover { background: rgb(255 255 255 / 12%); filter: none; }
.site-mode.athena-button[aria-pressed="true"] { background: rgb(255 255 255 / 18%); border-color: var(--site-header-accent); }
.site-mode svg { width: 18px; height: 18px; }

.site-header :focus-visible { outline-color: var(--site-header-accent); }

/* Phones: the switch is an icon on the row of the name (its text stays its accessible name), the menu below */
@media (max-width: 720px) {
    .site-nav { order: 2; flex-basis: 100%; }
    .site-mode.athena-button { padding: 0; width: 44px; height: 44px; justify-content: center; }
    .site-mode-text {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }
}

@media (max-width: 480px) {
    .site-nav ul { gap: 0; margin-inline: -0.5rem; }
    .site-nav a { padding: 0 0.5rem; }
}

/* ---------------------------------------------------------------- hero */
.hero { padding-block: clamp(2.5rem, 6vw, 5rem) clamp(2rem, 5vw, 3.5rem); }

.hero .wrap {
    display: grid;
    gap: clamp(2rem, 4vw, 3rem);
    grid-template-columns: minmax(0, 1fr);
    align-items: center;
}

@media (min-width: 960px) {
    .hero .wrap { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); }
}

.eyebrow {
    color: var(--athena-muted);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
}

.lead {
    font-size: clamp(1.075rem, 1rem + 0.4vw, 1.25rem);
    color: var(--athena-muted);
    max-width: 68ch;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.actions .athena-button {
    font-weight: 600;
    text-decoration: none;
    border-width: 2px;
}
.actions .athena-button:hover { text-decoration: underline; }
.actions .button-secondary {
    background: transparent;
    color: var(--athena-accent);
    border-color: var(--athena-accent);
}

.facts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1.5rem 0 0;
    padding: 0;
    list-style: none;
}
.facts .badge { font-size: 0.85rem; font-weight: 600; padding: 0.3rem 0.75rem; }

.shot {
    margin: 0;
    border: 1px solid var(--athena-line);
    border-radius: var(--athena-radius);
    overflow: hidden;
    background: var(--athena-bg);
    box-shadow: var(--athena-shadow);
}

/* At a glance: Athena stats */
.glance {
    --grid-columns: 4;
    --grid-gap: 1rem;
    margin: 0;
    padding: 0;
    list-style: none;
}
.glance .stat { height: 100%; }
.glance .stat-value { line-height: 1.15; color: var(--athena-accent); }
@media (max-width: 480px) {
    .glance .stat-value { font-size: 1.35rem; }
    .glance .stat { padding: 12px; }
}

/* ---------------------------------------------------------------- sections */
.section { padding-block: clamp(2.5rem, 6vw, 4.5rem); }
.section.alt { background: var(--athena-bg); border-block: 1px solid var(--athena-line); }
.section.alt .card, .section.alt .stat { background: var(--athena-surface-alt); }
.section-intro { max-width: 68ch; color: var(--athena-muted); margin-bottom: 2rem; }

.athena-grid.features { --grid-columns: 4; --grid-gap: 1rem; margin: 0; padding: 0; list-style: none; }
.athena-grid.modules { --grid-columns: 4; --grid-gap: 1rem; margin: 0; padding: 0; list-style: none; }
.athena-grid.gallery { --grid-columns: 2; --grid-gap: 1.5rem; }

@media (max-width: 1100px) {
    .athena-grid.features, .athena-grid.modules, .glance { --grid-columns: 2; }
}

/* Athena makes every grid one column under 768 px; two tiles still fit on a phone */
@media (max-width: 768px) {
    .athena-grid.glance { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.card { display: flex; flex-direction: column; }
.card .card-body { padding: 1.25rem; flex: 1; }
.card .card-title { font-size: 1.125rem; margin-bottom: 0.35rem; }
.card .card-body p { margin: 0; color: var(--athena-muted); }
.card .card-footer { padding: 0.5rem 1.25rem; }
.card .card-footer a { font-weight: 600; }

/* Screenshots */
.gallery figure { margin: 0; }
.gallery .card-image { border-bottom: 1px solid var(--athena-line); }
.gallery figcaption { color: var(--athena-muted); font-size: 0.95rem; padding: 0.75rem 1rem; }

.phone-row {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: minmax(0, 1fr);
    align-items: center;
    margin-top: 2rem;
}
.phone-row .shot { max-width: 260px; }

@media (min-width: 720px) {
    .phone-row { grid-template-columns: 260px minmax(0, 1fr); }
}

/* Install */
.install {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 26rem), 1fr));
}

.code-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}
.code-head .card-title { margin: 0; }

pre {
    margin: 1rem 0 0;
    padding: 1rem;
    background: var(--site-code-bg);
    color: var(--site-code-fg);
    border-radius: 8px;
    line-height: 1.5;
    white-space: pre-wrap;        /* long commands wrap: nothing scrolls out of sight */
    overflow-wrap: anywhere;
}

.needs { margin-top: 1.5rem; }
.needs .athena-table-wrapper { overflow-x: auto; }
.needs .athena-table { width: 100%; }
.needs .athena-table th { text-align: left; white-space: nowrap; width: 1%; }
.needs .athena-table th, .needs .athena-table td { padding: 0.6rem 0.9rem; vertical-align: top; }
.needs .athena-table tbody tr:nth-child(even) { background: transparent; }

/* ---------------------------------------------------------------- footer */
.site-footer {
    padding-block: 2rem;
    color: var(--athena-muted);
    font-size: 0.95rem;
    border-top: 1px solid var(--athena-line);
}
.site-footer .wrap {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.5rem 2rem;
}
.site-footer p { margin: 0; }

/* Touch screens: 44 x 44 px for everything a finger presses (Athena 2.15.0 does not do it yet) */
@media (pointer: coarse) {
    .athena-button, .site-mode.athena-button { min-height: 44px; min-width: 44px; }
    .card-footer a, .site-footer a { display: inline-flex; align-items: center; min-height: 44px; }
}

@media print {
    .site-header, .skip-link, .actions, .copy-button { display: none; }
    body { background: #fff; color: #000; }
    .section.alt { background: none; }
}

/* ---------------------------------------------------------------- module pages (odin.html, njord.html, freya.html, bragi.html) */
.site-nav a[aria-current="page"] { background: rgb(255 255 255 / 16%); text-decoration: underline; text-underline-offset: 0.3em; }

.crumbs { padding-top: 1rem; }
.crumbs ol { display: flex; flex-wrap: wrap; gap: 0.25rem 0.5rem; margin: 0; padding: 0; list-style: none; font-size: 0.95rem; color: var(--athena-muted); }
.crumbs li { display: flex; align-items: center; min-height: 44px; }
.crumbs li + li::before { content: "/"; margin-right: 0.5rem; color: var(--athena-muted); }
.crumbs a { display: inline-flex; align-items: center; min-height: 44px; }
.module-hero { padding-top: clamp(1rem, 3vw, 2rem); }

.glance-card .card-title { font-size: 1.1rem; margin: 0 0 0.5rem; }
.glance-card .athena-table { width: 100%; }
.glance-card .athena-table th { text-align: left; white-space: nowrap; width: 1%; }
.glance-card .athena-table th, .glance-card .athena-table td { padding: 0.55rem 0.8rem; }
.glance-card .athena-table tbody tr:nth-child(even) { background: transparent; }

.code-stack { display: grid; gap: 1.5rem; }
pre.code-example { white-space: pre; overflow-x: auto; overflow-wrap: normal; font-size: 0.88rem; }
pre.code-example:focus-visible { outline: var(--athena-focus-width, 2px) solid var(--athena-focus); outline-offset: 2px; }
.code-note { margin: 0.75rem 0 0; color: var(--athena-muted); font-size: 0.95rem; }

.athena-table.versions { width: 100%; }
.athena-table.versions th, .athena-table.versions td { padding: 0.55rem 0.8rem; text-align: left; white-space: nowrap; }

.module-links { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; }
.install-link { margin: 0 0 1.5rem; }
