/* Look of the SSA service portal (RootFS/var/smartschank/html/index.html), shared by the
   start page and the documentation viewer. Theme via data-theme on <html>, stored under
   localStorage "portal.theme" like on the SSA, so the proxied web cash follows it. */

* {
    box-sizing: border-box;
}
:root {
    color-scheme: dark;
    --bg: #24282d;
    --card: #2e343b;
    --border: #3d444d;
    --border-strong: #4b5361;
    --text: #eee;
    --text-soft: #cfd8e0;
    --muted: #8fa3b5;
    --accent: #6fb0e8;
    --code: #24282d;
    --ok: #8fd694;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}
:root[data-theme="light"] {
    color-scheme: light;
    --bg: #eef1f4;
    --card: #ffffff;
    --border: #d5dbe2;
    --border-strong: #b7c0ca;
    --text: #1f262d;
    --text-soft: #3a4650;
    --muted: #5f6f7d;
    --accent: #1958b7;
    --code: #f3f5f8;
    --ok: #2e7d32;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Trebuchet MS', 'Lucida Grande', Verdana, Lucida, Geneva, Helvetica, Arial, sans-serif;
}
#page {
    max-width: 26em;
    margin: 0 auto;
    padding: 2em 1em 3em;
}
.topline {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5em 1em;
}
h1 {
    font-size: clamp(1.7em, 8vw, 2.2em);
    margin: 0;
}
.subtitle {
    color: var(--muted);
    margin: 0 0 1.5em 0;
}
h2 {
    display: flex;
    align-items: center;
    gap: 0.5em;
    font-size: 0.9em;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 0 0 0.5em 0;
}
h2 svg {
    width: 1.2em;
    height: 1.2em;
}
section {
    margin-top: 1.5em;
}
svg {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
a:focus-visible,
button:focus-visible,
.copy:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* language and theme switches, top right */
.switches {
    display: flex;
    gap: 0.5em;
}
#lang_toggle {
    display: flex;
    align-items: center;
    gap: 0.35em;
    height: 2.6em;
    margin-top: 0.3em;
    padding: 0 0.9em;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 1.3em;
    color: var(--muted);
    font-family: inherit;
    font-size: 0.85em;
    font-weight: bold;
    cursor: pointer;
    transition: border-color 0.15s;
}
#lang_toggle:hover {
    border-color: var(--muted);
}
#lang_toggle span {
    opacity: 0.45;
}
:root[data-lang="de"] #lang_toggle [data-lang="de"],
:root[data-lang="en"] #lang_toggle [data-lang="en"] {
    opacity: 1;
    color: var(--text);
}

/* round light / dark toggle */
#theme_toggle {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.6em;
    height: 2.6em;
    margin-top: 0.3em;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--muted);
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}
#theme_toggle:hover {
    color: var(--text);
    border-color: var(--muted);
}
#theme_toggle svg {
    width: 1.3em;
    height: 1.3em;
}
#theme_toggle .sun { display: none; }
#theme_toggle .moon { display: block; }
:root[data-theme="light"] #theme_toggle .sun { display: block; }
:root[data-theme="light"] #theme_toggle .moon { display: none; }

/* info cards */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.3em 1em;
    box-shadow: var(--shadow);
}
.card table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95em;
}
.card th {
    padding: 0.55em 0 0.35em;
    border-bottom: 1px solid var(--border-strong);
    color: var(--muted);
    font-size: 0.8em;
    font-weight: normal;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.card th:last-child {
    text-align: right;
}
.card td {
    padding: 0.45em 0;
    border-bottom: 1px solid var(--border);
}
.card tr:last-child td {
    border-bottom: none;
}
.card td:first-child {
    color: var(--muted);
    padding-right: 2em;
    white-space: nowrap;
}
.card td:last-child {
    text-align: right;
    font-weight: bold;
}
.card.split {
    display: flex;
    flex-wrap: wrap;
    gap: 0 2.5em;
}
.card.split table {
    flex: 1 1 14em;
    align-self: flex-start;
}

/* intro: what this is and how to try it */
.intro {
    padding: 0.9em 1.2em;
    line-height: 1.5;
}
.intro p {
    margin: 0 0 0.6em;
}
.steps {
    margin: 0;
    padding-left: 1.4em;
    color: var(--text-soft);
}
.steps li {
    margin: 0.3em 0;
}
.steps b {
    color: var(--text);
}
p.lead {
    margin: 0 0 0.9em;
    color: var(--text-soft);
    font-size: 0.92em;
    line-height: 1.45;
}
h3 {
    display: flex;
    align-items: center;
    gap: 0.5em;
    font-size: 1.15em;
    margin: 0 0 0.4em;
}
h3 svg {
    width: 1.2em;
    height: 1.2em;
    color: var(--muted);
}

/* base url below the tiles, one click copies */
.card.url {
    margin-top: 0.6em;
    padding: 0.6em 1em;
    font-size: 0.85em;
}
.card.url span {
    display: block;
    color: var(--muted);
    margin-bottom: 0.2em;
}
.copy {
    cursor: pointer;
    font-family: Consolas, 'Courier New', monospace;
    color: var(--text-soft);
    overflow-wrap: anywhere;
}
.copy:hover {
    color: var(--text);
    text-decoration: underline dotted;
}
.copy.copied {
    color: var(--ok);
}

/* tool tiles, always icon + title + hint */
.tiles {
    display: flex;
    flex-direction: column;
    gap: 0.6em;
}
.tiles .pair {
    display: flex;
    gap: 0.6em;
}
.tiles .pair > a {
    flex: 1;
}
.tiles a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 5em;
    padding: 0.7em 0.5em;
    background: #2175bc;
    color: #fff;
    font-weight: bold;
    text-decoration: none;
    border-radius: 8px;
    box-shadow: var(--shadow);
    transition: background 0.15s, transform 0.15s;
}
.tiles a:hover {
    background: #2b86d4;
    transform: translateY(-1px);
}
.tiles a:active {
    transform: translateY(0);
}
.tiles a small {
    font-weight: normal;
    font-size: 0.75em;
    color: #cfe3f5;
    margin-top: 0.2em;
}
.tiles a svg {
    width: 1.7em;
    height: 1.7em;
    margin-bottom: 0.35em;
    stroke-width: 1.7;
}
.tiles a.big {
    min-height: 7.5em;
    font-size: 1.05em;
    background: linear-gradient(160deg, #2b86d4, #1958b7);
}
.tiles a.big:hover {
    background: linear-gradient(160deg, #3a95e3, #1f63c9);
}
.tiles a.big svg {
    width: 2.2em;
    height: 2.2em;
}
/* documentation tiles are set apart from the tools */
.tiles a.doc {
    background: linear-gradient(160deg, #1f9a8f, #157570);
}
.tiles a.doc:hover {
    background: linear-gradient(160deg, #26ab9f, #1a857f);
}
.tiles a.doc small {
    color: #cdeeea;
}

/* file downloads: a row, not a tile, so they read as "take this with you" */
.tiles a.file {
    flex-direction: row;
    justify-content: flex-start;
    gap: 0.8em;
    min-height: 0;
    padding: 0.7em 1em;
    text-align: left;
    background: transparent;
    border: 1px dashed var(--border-strong);
    box-shadow: none;
    color: var(--text-soft);
}
.tiles a.file:hover {
    background: var(--card);
    border-color: var(--muted);
    color: var(--text);
}
.tiles a.file svg {
    flex: none;
    margin: 0;
    width: 1.5em;
    height: 1.5em;
}
.tiles a.file small {
    display: block;
    color: var(--muted);
}

/* the demonstrator: a helper section, set apart from the interfaces */
.helper {
    margin-top: 2.5em;
    padding-top: 1.5em;
    border-top: 1px solid var(--border);
}
.helper .steps {
    margin: 0 0 1em;
}
.helper .card.url {
    margin: 0.6em 0 0;
}
.helper h3.sub {
    margin-top: 1.5em;
}
p.note {
    margin: 0.8em 0 0;
    color: var(--muted);
    font-size: 0.8em;
}

/* groups side by side on wide screens. Each group is a subgrid over the same six rows
   (title, text, documentation, demo tools, .rest, base url), so both columns line up. */
.groups {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0 2em;
}
.groups .group {
    display: grid;
    grid-row: span 6;
    grid-template-rows: subgrid;
    row-gap: 0.6em;
    margin-top: 1.5em;
}
.groups .group > h3,
.groups .group > p.lead,
.groups .group .card.url {
    margin: 0;
}
.groups .group > p.lead {
    margin-bottom: 0.3em;
}
.groups .group .tiles {
    display: contents;
}

@media (min-width: 60em) {
    #page {
        max-width: 56em;
    }
    .groups {
        grid-template-columns: 1fr 1fr;
        column-gap: 2em;
    }
}
