/*
 * Bootstrap theme for Imprimatur, in Colddiver's colors.
 *
 * 1. Fonts: Libre Franklin (SIL Open Font License, fonts/OFL-libre-franklin.txt), served from the
 *    site itself so no visitor's browser contacts an outside font service.
 * 2. Design tokens. Most changes to the look are edits to this block: Bootstrap 5.3 reads its
 *    colors, fonts and radii from these custom properties, so no Sass build is needed. The palette
 *    comes from the deep-water header photo of colddiver.com.
 * 3. Site chrome: header, footer, page head.
 * 4. Content: plain Markdown output (headings, paragraphs, lists, tables, figures) styled by
 *    element selectors inside .content, so pages never need classes.
 * 5. Components and layouts.
 */

/* 1. Fonts ------------------------------------------------------------------------------- */
@font-face {
    font-family: "Libre Franklin";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("../fonts/libre-franklin-latin-400-normal.woff2") format("woff2");
}
@font-face {
    font-family: "Libre Franklin";
    font-style: italic;
    font-weight: 400;
    font-display: swap;
    src: url("../fonts/libre-franklin-latin-400-italic.woff2") format("woff2");
}
@font-face {
    font-family: "Libre Franklin";
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url("../fonts/libre-franklin-latin-600-normal.woff2") format("woff2");
}
@font-face {
    font-family: "Libre Franklin";
    font-style: normal;
    font-weight: 800;
    font-display: swap;
    src: url("../fonts/libre-franklin-latin-800-normal.woff2") format("woff2");
}

/* 2. Tokens ------------------------------------------------------------------------------ */
:root,
[data-bs-theme="light"] {
    /* The water, from deepest to lightest. */
    --cd-abyss: #02182f;
    --cd-deep: #032341;
    --cd-current: #12548a;
    --cd-ocean: #0f64a9;
    --cd-highlight: #3f97ce;
    --cd-foam: #eaf3fa;

    --imp-accent: var(--cd-ocean);
    --imp-accent-rgb: 15, 100, 169;
    --imp-ink: #0b1f33;
    --imp-surface: var(--cd-foam);
    --imp-text-width: 44rem;
    --imp-shadow: 0 1px 2px rgba(2, 24, 47, .06), 0 8px 24px rgba(2, 24, 47, .08);

    --bs-primary: var(--imp-accent);
    --bs-primary-rgb: var(--imp-accent-rgb);
    --bs-body-color: #22313f;
    --bs-body-color-rgb: 34, 49, 63;
    --bs-emphasis-color: var(--imp-ink);
    --bs-heading-color: var(--imp-ink);
    --bs-secondary-color: rgba(34, 49, 63, .72);
    --bs-link-color: var(--cd-ocean);
    --bs-link-color-rgb: 15, 100, 169;
    --bs-link-hover-color: var(--cd-current);
    --bs-link-hover-color-rgb: 18, 84, 138;
    --bs-body-font-family: "Libre Franklin", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --bs-body-font-size: 1.0625rem;
    --bs-body-line-height: 1.7;
    --bs-border-radius: .5rem;
    --bs-border-radius-lg: .875rem;
    --bs-border-color: #dbe3ea;
}

[data-bs-theme="dark"] {
    --cd-abyss: #02182f;
    --cd-deep: #032341;
    --cd-current: #12548a;
    --cd-highlight: #3f97ce;

    --imp-accent: #3f97ce;
    --imp-accent-rgb: 63, 151, 206;
    --imp-ink: #eef4f9;
    --imp-surface: #0b2238;
    --imp-shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);

    --bs-primary: var(--imp-accent);
    --bs-primary-rgb: var(--imp-accent-rgb);
    --bs-body-bg: #061526;
    --bs-body-bg-rgb: 6, 21, 38;
    --bs-body-color: #c9d6e2;
    --bs-body-color-rgb: 201, 214, 226;
    --bs-emphasis-color: var(--imp-ink);
    --bs-heading-color: var(--imp-ink);
    --bs-secondary-color: rgba(201, 214, 226, .7);
    --bs-link-color: #6fb3e0;
    --bs-link-color-rgb: 111, 179, 224;
    --bs-link-hover-color: #a3d0ef;
    --bs-link-hover-color-rgb: 163, 208, 239;
    --bs-border-color: #1c3550;
    --bs-tertiary-bg: #0b2238;
}

/* Buttons take the accent (Bootstrap compiles button colors, so they are set here). */
.btn-primary {
    --bs-btn-bg: var(--imp-accent);
    --bs-btn-border-color: var(--imp-accent);
    --bs-btn-hover-bg: color-mix(in srgb, var(--imp-accent) 85%, #000);
    --bs-btn-hover-border-color: color-mix(in srgb, var(--imp-accent) 85%, #000);
    --bs-btn-active-bg: color-mix(in srgb, var(--imp-accent) 75%, #000);
    --bs-btn-active-border-color: color-mix(in srgb, var(--imp-accent) 75%, #000);
    --bs-btn-font-weight: 600;
}
.btn-outline-primary {
    --bs-btn-color: var(--imp-accent);
    --bs-btn-border-color: var(--imp-accent);
    --bs-btn-hover-bg: var(--imp-accent);
    --bs-btn-hover-border-color: var(--imp-accent);
    --bs-btn-active-bg: var(--imp-accent);
    --bs-btn-font-weight: 600;
}
.btn-lg { --bs-btn-padding-x: 1.4rem; }
/* A button for something not available yet (::button[…]{disabled}): greyed out, not a link,
   with a "Coming soon" badge in the button's own color. */
.btn-unavailable {
    opacity: .7;
    cursor: default;
    pointer-events: none;
    box-shadow: none;
}
.btn-badge {
    margin-left: .5rem;
    vertical-align: .1em;
    font-size: .7em;
    font-weight: 600;
    letter-spacing: .02em;
    text-transform: uppercase;
    color: inherit;
    background: color-mix(in srgb, currentColor 20%, transparent);
}

/* 3. Site chrome ------------------------------------------------------------------------- */
.skip-link {
    position: absolute;
    top: .5rem;
    left: .5rem;
    z-index: 1100;
    padding: .5rem 1rem;
    background: var(--bs-body-bg);
    border-radius: var(--bs-border-radius);
}

:focus-visible {
    outline: 3px solid rgba(var(--imp-accent-rgb), .55);
    outline-offset: 2px;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
.site-main { flex: 1 0 auto; }

.site-header {
    background: linear-gradient(180deg, var(--cd-abyss), var(--cd-deep));
    border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.site-header .navbar { --bs-navbar-padding-y: .9rem; }
.site-header .nav-link {
    --bs-nav-link-font-weight: 600;
    --bs-navbar-color: rgba(255, 255, 255, .78);
    --bs-navbar-hover-color: #fff;
    --bs-navbar-active-color: #fff;
    font-size: .95rem;
    letter-spacing: .01em;
}
.site-header .nav-link.active {
    box-shadow: inset 0 -2px 0 var(--cd-highlight);
}
.site-brand {
    color: #fff;
    font-weight: 800;
    font-size: 1.2rem;
    letter-spacing: -.01em;
    text-decoration: none;
}
.site-brand:hover { color: #fff; opacity: .9; }

.site-footer {
    margin-top: 5rem;
    padding: 3rem 0 2rem;
    background: var(--cd-abyss);
    color: rgba(255, 255, 255, .72);
}
.site-footer .nav-link { color: rgba(255, 255, 255, .72); padding: .25rem .75rem; }
.site-footer .nav-link:hover { color: #fff; }
.footer-tagline { max-width: 28rem; }
.footer-legal {
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, .08);
    font-size: .875rem;
    color: rgba(255, 255, 255, .5);
}

.preview-banner { font-size: .9rem; }

/* Page head: title and breadcrumbs. */
.page-head { padding: 3rem 0 1.5rem; }
.page-title {
    font-weight: 800;
    font-size: clamp(2rem, 1.4rem + 2.2vw, 3rem);
    letter-spacing: -.025em;
    line-height: 1.15;
    margin: 0;
}
.breadcrumb { font-size: .875rem; --bs-breadcrumb-margin-bottom: .75rem; }

.layout-default .page-head,
.layout-default .content,
.layout-default .subpages {
    max-width: var(--imp-text-width);
}

/* 4. Content ----------------------------------------------------------------------------- */
.content { font-size: 1.0625rem; }
.content h2,
.content h3,
.content h4 {
    letter-spacing: -.015em;
    line-height: 1.3;
}
.content h2 { margin-top: 3rem; margin-bottom: 1rem; font-weight: 800; font-size: 1.75rem; }
.content h3 { margin-top: 2.25rem; margin-bottom: .75rem; font-weight: 600; font-size: 1.35rem; }
.content h4 { margin-top: 1.75rem; margin-bottom: .5rem; font-weight: 600; font-size: 1.1rem; }
.content > :first-child { margin-top: 0; }
.content h2 a,
.content h3 a { text-decoration: none; }
.content a { text-underline-offset: .18em; text-decoration-thickness: 1px; }
.content strong { font-weight: 600; color: var(--bs-emphasis-color); }
.content li { margin-bottom: .35rem; }
.content hr { margin: 3rem 0; opacity: .15; }
.content blockquote {
    border-left: 3px solid var(--imp-accent);
    padding: .25rem 0 .25rem 1.25rem;
    color: var(--bs-secondary-color);
    font-size: 1.1rem;
}
.content code {
    color: inherit;
    background: var(--imp-surface);
    padding: .1em .35em;
    border-radius: .3rem;
    font-size: .9em;
}
.content pre {
    background: var(--imp-surface);
    padding: 1rem 1.25rem;
    border-radius: var(--bs-border-radius);
}
.content pre code { padding: 0; background: none; }
.content table {
    width: 100%;
    margin: 2rem 0;
    border-collapse: collapse;
    font-size: .95rem;
}
.content th,
.content td {
    padding: .6rem .75rem;
    border-bottom: 1px solid var(--bs-border-color);
    text-align: left;
    vertical-align: top;
}
.content thead th { border-bottom-width: 2px; font-weight: 600; color: var(--bs-emphasis-color); }

/* <picture> only chooses the file (WebP or the fallback); the <img> inside is laid out as if
   it stood alone, so every rule below keeps working. */
picture { display: contents; }

/* Images in the text: never wider than the column, never taller than most of a screen, never
   stretched beyond their own size, centered, with a soft frame for screenshots. */
.content-figure {
    display: block;
    margin: 2.25rem auto;
    text-align: center;
}
.content-figure img {
    max-width: 100%;
    max-height: min(78vh, 760px);
    width: auto;
    height: auto;
    border-radius: var(--bs-border-radius);
    box-shadow: var(--imp-shadow);
}
.content-figure .figure-caption {
    margin-top: .75rem;
    font-size: .9rem;
    color: var(--bs-secondary-color);
}
.content img { max-width: 100%; height: auto; }

/* 5. Components and layouts -------------------------------------------------------------- */
/* Landing layout: text stays at reading width, heroes, cards and galleries go wider. The
   list of subpages (outside .content, after it) is part of the text column too: the landing
   layout has no container, so without this it would span the whole window. */
.layout-landing .content > :not(:where(.hero, .cards, .gallery)),
.layout-landing .subpages {
    max-width: var(--imp-text-width);
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
}
.layout-landing .content > .cards,
.layout-landing .content > .gallery {
    max-width: 1140px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
}
.layout-landing .content > .cards { margin-top: 2.5rem; margin-bottom: 3rem; }
.layout-landing .subpages { margin-bottom: 3rem; }
/* Lists keep their indent inside the column (as on the default layout), so the bullets don't
   hang outside it, off the screen's edge on a phone. */
.layout-landing .content > :is(ul, ol) { padding-left: calc(1rem + 2rem); }

/* Hero, split or plain. */
/* flow-root keeps the row's negative top margin (Bootstrap gutters) inside the hero. Without it
   the margin collapses through the hero and, when the hero opens the page (landing layout),
   pulls the page up over the bottom of the header. */
.hero { background: var(--imp-surface); margin-bottom: 2.5rem; display: flow-root; }
.hero-dark { background: linear-gradient(160deg, var(--cd-abyss), var(--cd-current)); color: #e6eef5; }
.hero-light { background: transparent; }
.hero-text h1 {
    font-size: clamp(2.25rem, 1.5rem + 3vw, 3.75rem);
    font-weight: 800;
    letter-spacing: -.03em;
    line-height: 1.08;
    margin-bottom: 1rem;
}
.hero-text p { font-size: 1.2rem; max-width: 36rem; }
.hero-text > :last-child { margin-bottom: 0; }
.hero-image { width: 100%; height: auto; }
/* The app icon (:::hero{icon=…}): small, above the title, iOS-style rounded corners. */
.hero-icon {
    display: block;
    width: 96px;
    height: 96px;
    max-width: none;
    object-fit: cover;
    border-radius: 22.5%;
    box-shadow: 0 2px 12px rgba(2, 24, 47, .2), 0 0 0 1px rgba(2, 24, 47, .06);
    margin-bottom: 1.25rem;
}
.hero-text.text-center .hero-icon { margin-left: auto; margin-right: auto; }
@media (max-width: 575.98px) {
    .hero-icon { width: 80px; height: 80px; margin-bottom: 1rem; }
}

/* The product page (docs/agent-api.md): hero, then "## Features" with cards, "## Screenshots"
   with a gallery, requirements, privacy. A heading right before cards or a gallery sits as close
   to them as to text: the grid's own negative top margin (its gutter) takes back the space its
   first row adds. !important, to override the grid's my-4 utility. */
.content > h2 + :is(.cards, .gallery) { margin-top: calc(-1 * var(--bs-gutter-y)) !important; }

/* Hero, cover: the photo fills it, text over a gradient that keeps it readable. */
.hero-cover {
    position: relative;
    isolation: isolate;
    display: flex;
    align-items: flex-end;
    min-height: clamp(22rem, 58vh, 38rem);
    background: var(--cd-abyss);
    color: #fff;
    overflow: hidden;
}
.hero-cover .hero-cover-image {
    position: absolute;
    inset: 0;
    z-index: -2;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
}
.hero-cover::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(180deg, rgba(2, 24, 47, .1) 0%, rgba(2, 24, 47, .35) 45%, rgba(2, 24, 47, .88) 100%);
}
.hero-cover-body { padding-top: 6rem; padding-bottom: 3.5rem; }
.hero-cover .hero-text h1 { color: #fff; text-shadow: 0 2px 24px rgba(0, 0, 0, .35); }
.hero-cover .hero-text p { color: rgba(255, 255, 255, .86); }

/* Cards. */
.content-card {
    border-color: var(--bs-border-color);
    box-shadow: var(--imp-shadow);
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.content-card .card-body { padding: 1.5rem; }
/* margin-top: the card's title is an h3 inside .content, which would otherwise take the text's
   heading margin and leave a gap at the top of the card. */
.content-card .card-title { font-weight: 800; letter-spacing: -.01em; margin-top: 0; margin-bottom: .5rem; }
.content-card .card-title a { color: inherit; text-decoration: none; }
.content-card .card-text { color: var(--bs-secondary-color); }
.content-card .card-text > :last-child { margin-bottom: 0; }
.card-linked:hover {
    transform: translateY(-2px);
    border-color: rgba(var(--imp-accent-rgb), .45);
}
.card-linked:hover .card-title { color: var(--imp-accent); }
.content-card .card-img-top { aspect-ratio: 16 / 9; object-fit: cover; }
.content-card .card-icon {
    display: block;
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 22%;
    box-shadow: 0 2px 10px rgba(2, 24, 47, .18);
    margin-bottom: 1.1rem;
}

/* Gallery. */
.gallery-image {
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    border: 1px solid var(--bs-border-color);
    transition: transform .15s ease;
}
.gallery-link:hover .gallery-image { transform: scale(1.015); }

/* Callouts. */
.callout { border: 0; border-left: 4px solid currentColor; }
.callout-icon { margin-top: .2rem; fill: currentColor; }
.callout-body > :last-child { margin-bottom: 0; }

/* Subpage cards at the bottom of a section. */
.subpages { padding-top: 1rem; }
.subpage-card { box-shadow: var(--imp-shadow); transition: border-color .15s; }
.subpage-card:hover { border-color: var(--imp-accent); }
.subpage-card .card-title { color: var(--bs-emphasis-color); font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* Contact form: the honeypot field is off screen and hidden from assistive technology. */
.contact-form { max-width: 40rem; }
.contact-form-hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.contact-form fieldset { min-width: 0; }
