/*
 * Open Charging Technology — Whitepapers
 * Design tokens adopted from open.charging.technology (MetrologicalCBORValidator).
 */

:root {
    --bg:            #f6f8fa;
    --panel:         #ffffff;
    --panel-inset:   #f6f8fa;
    --border:        #d8dee4;
    --border-soft:   #e7ecf0;
    --text:          #1f2328;
    --muted:         #59636e;
    --accent:        #0e7490;
    --accent-soft:   #e0f2f7;
    --focus:         #0e749055;

    --mono:  ui-monospace, "Cascadia Code", "Cascadia Mono", Consolas, "Liberation Mono", Menlo, monospace;
    --sans:  system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg:            #0d1117;
        --panel:         #161b22;
        --panel-inset:   #0d1117;
        --border:        #30363d;
        --border-soft:   #21262d;
        --text:          #e6edf3;
        --muted:         #9198a1;
        --accent:        #4dd0e1;
        --accent-soft:   #0b3a44;
        --focus:         #4dd0e155;
    }
}

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

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

body {
    margin:      0;
    padding:     2.5rem 1rem 4rem;
    background:  var(--bg);
    color:       var(--text);
    font-family: var(--sans);
    font-size:   16px;
    line-height: 1.65;
    -webkit-text-size-adjust: 100%;
}

header {
    max-width: 52rem;
    margin:    0 auto 0.75rem;
    padding:   0 0.25rem;
    font-size: 0.85rem;
}

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

header a:hover {
    color: var(--accent);
}

main {
    max-width:     52rem;
    margin:        0 auto;
    padding:       2.75rem 3rem 3.25rem;
    background:    var(--panel);
    border:        1px solid var(--border);
    border-radius: 10px;
}

@media (max-width: 640px) {
    body { padding: 1rem 0 2rem; }
    main { padding: 1.5rem 1.25rem; border-radius: 0; border-left: none; border-right: none; }
}

::selection { background: var(--accent-soft); }

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

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

h1, h2, h3, h4, h5, h6 {
    line-height:    1.3;
    letter-spacing: -0.02em;
    margin:         2rem 0 0.75rem;
    scroll-margin-top: 1rem;
}

h1 {
    font-size:      2rem;
    margin-top:     0;
    padding-bottom: 0.5rem;
    border-bottom:  1px solid var(--border);
}

h2 {
    font-size:      1.45rem;
    padding-bottom: 0.3rem;
    border-bottom:  1px solid var(--border-soft);
}

h3 { font-size: 1.15rem; }
h4 { font-size: 1rem; }
h5, h6 { font-size: 0.92rem; color: var(--muted); }

p { margin: 0 0 1rem; }

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

a:hover { text-decoration: underline; }

strong { font-weight: 600; }

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

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

ul, ol { margin: 0 0 1rem; padding-left: 1.75rem; }

li { margin: 0.25rem 0; }

li > ul, li > ol { margin-bottom: 0; }

/* Markdig task lists */
li.task-list-item { list-style: none; margin-left: -1.5rem; }
li.task-list-item input { margin-right: 0.5rem; accent-color: var(--accent); }

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

code, pre, kbd {
    font-family: var(--mono);
}

code {
    font-size:     0.9em;
    background:    var(--panel-inset);
    border:        1px solid var(--border-soft);
    border-radius: 4px;
    padding:       0.1em 0.35em;
}

pre {
    background:    var(--panel-inset);
    border:        1px solid var(--border);
    border-radius: 8px;
    padding:       1rem 1.25rem;
    margin:        0 0 1rem;
    overflow-x:    auto;
    line-height:   1.5;
}

pre code {
    background: none;
    border:     none;
    padding:    0;
    font-size:  0.85rem;
}

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

table {
    border-collapse: collapse;
    display:         block;
    max-width:       100%;
    overflow-x:      auto;
    margin:          0 0 1rem;
    font-size:       0.92rem;
}

th, td {
    border:  1px solid var(--border);
    padding: 0.45rem 0.8rem;
    text-align: left;
    vertical-align: top;
}

th {
    background:  var(--panel-inset);
    font-weight: 600;
}

tbody tr:nth-child(even) { background: var(--panel-inset); }

/* ---- Quotes, images, footnotes ------------------------------------------- */

blockquote {
    margin:      0 0 1rem;
    padding:     0.25rem 0 0.25rem 1rem;
    border-left: 3px solid var(--accent);
    color:       var(--muted);
}

blockquote > :last-child { margin-bottom: 0; }

img {
    max-width:     100%;
    height:        auto;
    border-radius: 6px;
}

.footnotes {
    margin-top: 2.5rem;
    font-size:  0.85rem;
    color:      var(--muted);
}

.footnotes hr {
    margin: 0 0 1rem;
}

/* ---- Print --------------------------------------------------------------- */

@media print {

    body {
        background: #ffffff;
        color:      #000000;
        padding:    0;
    }

    header { display: none; }

    main {
        max-width: none;
        border:    none;
        padding:   0;
    }

    a { color: inherit; text-decoration: underline; }

    pre, code { border-color: #cccccc; }

}
