/* Extranet Home: gleiches Design wie der Dienstplan, mobile-first, ohne Framework. Farben nach www.pfimi-sg.ch */

@font-face {
    font-family: "Montserrat";
    src: url("../fonts/montserrat-latin.woff2") format("woff2");
    font-weight: 400 700;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Farben ---------- */
:root {
    --bg: #f4f1ec;
    --surface: #ffffff;
    --text: #1e1d1c;
    --muted: #5f5f5f;
    --line: #e3ddd5;
    --accent: #6c7c4a;
    --accent-ink: #ffffff;
    --accent-soft: #eaeedd;
    --bar: #1e1d1c;
    --bar-ink: #ffffff;
    --focus: #2b6cb0;
    --shadow: 0 1px 2px rgba(30, 29, 28, .08), 0 4px 14px rgba(30, 29, 28, .06);
    --radius: 14px;
    color-scheme: light;
}

:root[data-theme="dark"] {
    --bg: #141413;
    --surface: #222221;
    --text: #ececea;
    --muted: #a9a9a3;
    --line: #353431;
    --accent: #9db36f;
    --accent-ink: #1e1d1c;
    --accent-soft: #2b3220;
    --focus: #7db3ee;
    --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 4px 14px rgba(0, 0, 0, .35);
    color-scheme: dark;
}

/* Ohne JavaScript: Systemeinstellung */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        --bg: #141413; --surface: #222221; --text: #ececea; --muted: #a9a9a3;
        --line: #353431; --accent: #9db36f; --accent-ink: #1e1d1c; --accent-soft: #2b3220;
        --focus: #7db3ee; color-scheme: dark;
    }
}

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

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 400 1rem/1.5 "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

a { color: var(--accent); }
img { max-width: 100%; height: auto; display: block; }

svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
    border-radius: 6px;
}

.visually-hidden {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip {
    position: absolute; left: .5rem; top: -4rem; z-index: 100;
    padding: .6rem 1rem; background: var(--accent); color: var(--accent-ink);
    border-radius: 8px; text-decoration: none; font-weight: 600;
}
.skip:focus { top: .5rem; }

/* ---------- Geruest (Mobile) ---------- */
.sidebar { display: none; }

.topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; gap: .75rem;
    min-height: 60px; padding: .5rem 1rem;
    background: var(--bar); color: var(--bar-ink);
}
.topbar .brand-m { display: flex; align-items: center; color: inherit; text-decoration: none; font-weight: 700; }
.topbar .brand-m img { height: 34px; width: auto; }
.tools { margin-left: auto; display: flex; gap: .4rem; }

/* Reiter fuer die Seiten (nur Mobile-Layout) */
.tabs {
    position: sticky; top: 60px; z-index: 15;
    display: flex; gap: .2rem; justify-content: space-between; overflow-x: auto;
    padding: .45rem 1rem; background: var(--surface); border-bottom: 1px solid var(--line);
    scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
    display: inline-flex; align-items: center; gap: .45rem; min-height: 44px;
    padding: .4rem .7rem; border-radius: 999px;
    color: var(--text); text-decoration: none; font-weight: 600; font-size: .86rem; white-space: nowrap;
}
.tabs a svg { width: 17px; height: 17px; flex: none; }
.tabs a[aria-current="page"] { background: var(--accent); color: var(--accent-ink); }

main {
    max-width: 760px; margin: 0 auto; padding: 1.25rem 1rem 3rem;
}
main > h1 { margin: .25rem 0 .5rem; font-size: 1.6rem; line-height: 1.2; }
.lead { margin: 0 0 1.25rem; color: var(--muted); }

/* ---------- Werkzeug-Knoepfe mit Tooltip ---------- */
.tool {
    position: relative;
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; padding: 0;
    background: transparent; color: inherit; cursor: pointer;
    border: 1px solid transparent; border-radius: 10px;
}
.tool:hover { background: rgba(255, 255, 255, .14); }
.tool svg { width: 22px; height: 22px; }

.tool::after {
    content: attr(data-tip);
    position: absolute; right: 0; top: calc(100% + 8px);
    padding: .4rem .65rem; border-radius: 8px;
    background: #000; color: #fff; font-size: .78rem; font-weight: 500; line-height: 1.3;
    white-space: nowrap; pointer-events: none;
    opacity: 0; transform: translateY(-4px);
    transition: opacity .15s, transform .15s;
}
.tool:hover::after, .tool:focus-visible::after { opacity: 1; transform: none; }

.ic-to-desktop, .ic-to-mobile, .ic-to-dark, .ic-to-light { display: none; }
:root[data-layout="mobile"]  .ic-to-desktop { display: block; }
:root[data-layout="desktop"] .ic-to-mobile  { display: block; }
:root[data-theme="light"]    .ic-to-dark    { display: block; }
:root[data-theme="dark"]     .ic-to-light   { display: block; }
:root:not([data-layout])     .ic-to-desktop { display: block; }
:root:not([data-theme])      .ic-to-dark    { display: block; }

/* ---------- Kacheln ---------- */
.group { margin: 1.5rem 0 .6rem; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

.tiles { display: grid; gap: .85rem; grid-template-columns: 1fr; }

.tile {
    position: relative;
    display: flex; align-items: flex-start; gap: .95rem;
    padding: 1rem 2.4rem 1rem 1rem; min-height: 88px;
    background: var(--surface); color: var(--text); text-decoration: none;
    border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
    transition: transform .15s, border-color .15s, box-shadow .15s;
}
.tile:hover { transform: translateY(-2px); border-color: var(--accent); }

.tile .ico {
    flex: none; display: grid; place-items: center;
    width: 52px; height: 52px; border-radius: 12px;
    background: var(--accent-soft); color: var(--accent);
}
.tile .ico svg { width: 26px; height: 26px; }

.tile .body { min-width: 0; }
.tile .body strong { display: block; font-size: 1.02rem; line-height: 1.25; margin-bottom: .2rem; overflow-wrap: anywhere; }
.tile .body span { display: block; color: var(--muted); font-size: .88rem; line-height: 1.4; }

.tile .body span.meta { margin-top: .35rem; font-size: .76rem; font-weight: 600; letter-spacing: .03em; color: var(--accent); }

.tile .ext { position: absolute; top: .85rem; right: .85rem; width: 16px; height: 16px; color: var(--muted); }

/* ---------- Textseiten ---------- */
.prose { max-width: 68ch; }
.prose h2 { margin: 1.75rem 0 .5rem; font-size: 1.15rem; }
.prose > h2:first-child { margin-top: .5rem; }
.prose p { margin: .5rem 0; }
.prose-list { margin: .5rem 0; padding-left: 1.2rem; }
.prose-list li { margin: .4rem 0; }
.prose .tiles { margin-top: .5rem; max-width: none; }

.notice {
    padding: .8rem 1rem; border-radius: 10px;
    background: var(--accent-soft); border-left: 4px solid var(--accent);
}

.btn {
    display: inline-flex; align-items: center; gap: .55rem; min-height: 46px;
    padding: .6rem 1.2rem; border-radius: 10px;
    background: var(--accent); color: var(--accent-ink); text-decoration: none; font-weight: 600;
}
.btn svg { width: 20px; height: 20px; }
.btn:hover { filter: brightness(1.08); }

footer { max-width: 760px; margin: 0 auto; padding: 0 1rem 2rem; color: var(--muted); font-size: .8rem; }
footer a { color: inherit; }

/* ---------- Desktop-Layout mit linker Navigation ---------- */
:root[data-layout="desktop"] .shell {
    display: grid; grid-template-columns: 280px minmax(0, 1fr); min-height: 100vh;
}

:root[data-layout="desktop"] .sidebar {
    display: flex; flex-direction: column; gap: 1.25rem;
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
    padding: 1.5rem 1rem; background: var(--bar); color: var(--bar-ink);
}
.sidebar .brand { color: inherit; text-decoration: none; font-weight: 700; }
.sidebar .brand img { width: 170px; }
.sidebar nav { display: grid; gap: 1.25rem; }
.sidebar h2 { margin: 0 0 .4rem .6rem; font-size: .7rem; letter-spacing: .09em; text-transform: uppercase; color: rgba(255, 255, 255, .55); }
.sidebar ul { margin: 0; padding: 0; list-style: none; display: grid; gap: .15rem; }
.sidebar a {
    display: flex; gap: .65rem; align-items: center;
    padding: .55rem .6rem; border-radius: 8px;
    color: rgba(255, 255, 255, .85); text-decoration: none; font-size: .9rem;
}
.sidebar a svg { width: 18px; height: 18px; flex: none; }
.sidebar a:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.sidebar a[aria-current="page"] { background: var(--accent); color: var(--accent-ink); font-weight: 600; }

:root[data-layout="desktop"] .tabs { display: none; }
:root[data-layout="desktop"] .topbar {
    background: var(--bg); color: var(--text);
    border-bottom: 1px solid var(--line); backdrop-filter: blur(6px);
}
:root[data-layout="desktop"] .topbar .brand-m { display: none; }
:root[data-layout="desktop"] .tool:hover { background: rgba(127, 127, 127, .16); }
:root[data-layout="desktop"] main { margin: 0 auto; padding: 1.75rem 2rem 3rem; max-width: 1000px; }
:root[data-layout="desktop"] main > h1 { font-size: 2rem; }
:root[data-layout="desktop"] footer { padding-left: 2rem; max-width: 1000px; }
:root[data-layout="desktop"] .content { min-width: 0; }

/* Kacheln: mehr Spalten, wenn Platz ist */
@media (min-width: 640px) {
    .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1200px) {
    :root[data-layout="desktop"] .tiles:not(.tiles-list) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    :root[data-layout="desktop"] main { max-width: 1160px; }
}
.tiles-list { grid-template-columns: 1fr !important; }

@media (min-width: 761px) {
    :root[data-layout="mobile"] main { padding-top: 2rem; }
}

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

@media print {
    .topbar, .sidebar, .tabs, .tools, .skip { display: none !important; }
    :root { --bg: #fff; --surface: #fff; --text: #000; }
    .tile { box-shadow: none; break-inside: avoid; }
}

/* Anleitungen: Bildschirmfotos */
.shot { margin: 1rem 0; }
.shot img { display: block; max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); }
.shot figcaption { margin-top: .4rem; font-size: .85rem; color: var(--muted); }
.prose-list li::marker { color: var(--accent); font-weight: 700; }
