/*
 * Ditaro website — single stylesheet.
 *
 * Constraints:
 *   - No external font, library, analytics, or asset references.
 *   - No JavaScript anywhere on the site.
 *   - Works offline; the same files ship in the application bundle.
 *
 * Brand colours come from packaging/ditaro.svg:
 *   --teal:  #0F5663
 *   --cream: #F4ECDA
 */

:root {
    --teal:        #0F5663;
    --teal-deep:   #0a3d47;
    --teal-soft:   #d6e7ea;
    --cream:       #F4ECDA;
    --bg:          #ffffff;
    --bg-subtle:   #faf7f0;
    --fg:          #1a1a1a;
    --fg-muted:    #5a5a5a;
    --rule:        #e6e2d4;
    --link:        var(--teal);
    --link-hover:  var(--teal-deep);
    --code-bg:     #f4f1e8;
    --code-fg:     #2a2a2a;

    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
                 "Liberation Mono", monospace;

    --measure: 38rem;
    --frame:   60rem;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg:        #0b1417;
        --bg-subtle: #11201f;
        --fg:        #e8eadf;
        --fg-muted:  #a5a89c;
        --rule:      #1f3033;
        --link:      #7fc8d6;
        --link-hover:#a8e0ec;
        --code-bg:   #14282b;
        --code-fg:   #e8eadf;
        --teal-soft: #1d3a40;
    }
}

* { box-sizing: border-box; }

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--fg);
    font-family: var(--font-sans);
    font-size: 17px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a {
    color: var(--link);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}
a:hover, a:focus { color: var(--link-hover); }

a.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--teal);
    color: #fff;
    padding: 0.5rem 1rem;
    z-index: 100;
}
a.skip-link:focus { left: 0; }

/* --- Header ---------------------------------------------------------- */

.site-header {
    border-bottom: 1px solid var(--rule);
    background: var(--bg);
}
.site-header__inner {
    max-width: var(--frame);
    margin: 0 auto;
    padding: 0.9rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--fg);
    text-decoration: none;
}
.brand img {
    width: 28px;
    height: 28px;
    display: block;
}
.brand:hover { color: var(--teal); }

.site-nav {
    margin-left: auto;
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
}
.site-nav a {
    color: var(--fg-muted);
    text-decoration: none;
    font-size: 0.95rem;
}
.site-nav a:hover,
.site-nav a[aria-current="page"] {
    color: var(--fg);
}
.site-nav a[aria-current="page"] {
    text-decoration: underline;
    text-underline-offset: 4px;
}

/* --- Main / Topic ---------------------------------------------------- */

main {
    max-width: var(--frame);
    margin: 0 auto;
    padding: 2.5rem 1.25rem 3rem;
}

.topic {
    max-width: var(--measure);
}
.topic.wide { max-width: var(--frame); }

h1, h2, h3, h4 {
    font-weight: 600;
    line-height: 1.25;
    color: var(--fg);
    margin: 2rem 0 0.75rem;
}
h1 { font-size: 2.25rem; margin-top: 0; letter-spacing: -0.01em; }
h2 { font-size: 1.4rem;  margin-top: 2.5rem; }
h3 { font-size: 1.1rem;  margin-top: 1.75rem; }

p { margin: 0 0 1rem; }
ul, ol { padding-left: 1.4rem; margin: 0 0 1rem; }
li { margin-bottom: 0.35rem; }
li > ul, li > ol { margin-top: 0.35rem; }

hr {
    border: 0;
    border-top: 1px solid var(--rule);
    margin: 2.5rem 0;
}

/* DITA-flavoured: shortdesc renders below the h1 as a lede. */
.shortdesc {
    font-size: 1.15rem;
    color: var(--fg-muted);
    margin: -0.25rem 0 1.5rem;
}

code, kbd, samp {
    font-family: var(--font-mono);
    font-size: 0.92em;
    background: var(--code-bg);
    color: var(--code-fg);
    padding: 0.1em 0.35em;
    border-radius: 3px;
}

pre {
    font-family: var(--font-mono);
    background: var(--code-bg);
    color: var(--code-fg);
    padding: 0.9rem 1rem;
    border-radius: 4px;
    overflow-x: auto;
    line-height: 1.5;
    font-size: 0.92rem;
}
pre code { background: transparent; padding: 0; border-radius: 0; }

blockquote {
    border-left: 3px solid var(--teal);
    margin: 1rem 0;
    padding: 0.25rem 1rem;
    color: var(--fg-muted);
    background: var(--bg-subtle);
}

/* --- Hero ------------------------------------------------------------ */

.hero {
    padding: 3rem 0 1rem;
}
.hero h1 {
    font-size: 2.75rem;
    letter-spacing: -0.02em;
}
.hero .lede {
    font-size: 1.2rem;
    color: var(--fg-muted);
    max-width: var(--measure);
    margin: 0.75rem 0 1.5rem;
}
.hero .cta {
    display: inline-block;
    background: var(--teal);
    color: var(--cream);
    padding: 0.7rem 1.4rem;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 500;
}
.hero .cta:hover { background: var(--teal-deep); color: #fff; }
.hero .cta-secondary {
    display: inline-block;
    margin-left: 0.75rem;
    color: var(--fg-muted);
    text-decoration: none;
    font-size: 0.95rem;
}
.hero .cta-secondary:hover { color: var(--link); text-decoration: underline; }

/* --- Feature grid (CSS grid, no JS) ---------------------------------- */

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
    gap: 1.25rem;
    margin: 1.5rem 0 2.5rem;
}
.grid > section {
    border: 1px solid var(--rule);
    border-radius: 4px;
    padding: 1rem 1.1rem;
    background: var(--bg-subtle);
}
.grid h3 {
    margin: 0 0 0.4rem;
    font-size: 1rem;
}
.grid p {
    margin: 0;
    font-size: 0.95rem;
    color: var(--fg-muted);
}

/* --- Download table -------------------------------------------------- */

.muted {
    color: var(--fg-muted);
    font-size: 0.95rem;
}

.downloads {
    border-collapse: collapse;
    width: 100%;
    margin: 1rem 0 2rem;
}
.downloads th, .downloads td {
    text-align: left;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--rule);
    vertical-align: top;
}
.downloads th {
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--fg-muted);
}
.downloads code { font-size: 0.85rem; }
.downloads a { word-break: break-all; }

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

.site-footer {
    border-top: 1px solid var(--rule);
    background: var(--bg-subtle);
    color: var(--fg-muted);
    font-size: 0.9rem;
    margin-top: 3rem;
}
.site-footer__inner {
    max-width: var(--frame);
    margin: 0 auto;
    padding: 1.5rem 1.25rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 1.5rem;
    align-items: center;
}
.site-footer a {
    color: var(--fg-muted);
    text-decoration: none;
}
.site-footer a:hover { color: var(--link); text-decoration: underline; }
.site-footer__legal {
    margin-left: auto;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* --- Narrow screens -------------------------------------------------- */

@media (max-width: 540px) {
    .site-header__inner { flex-wrap: wrap; gap: 0.5rem 1rem; }
    .site-nav { margin-left: 0; gap: 0.75rem 1rem; }
    main { padding: 1.75rem 1rem 2rem; }
    .hero { padding: 1.5rem 0 0.5rem; }
    .hero h1 { font-size: 2rem; }
    h1 { font-size: 1.75rem; }
    .site-footer__legal { margin-left: 0; }
}
