/* Gideonskolen — hånd-skrevet CSS, ingen build-proces.
   Ret direkte i denne fil; browseren læser den som den er.

   Farver og skrifttyper følger gideonskolen.dk:
   marineblå #0A1F41, skolens grønne #56A308, sart grøn flade #EDFFE1,
   Rubik til overskrifter og Telex til brødtekst.

   Skrifterne ligger lokalt i /public/fonts (ikke hentet fra Google ved
   hvert sidevisning) — både af hensyn til GDPR og for at portalen virker
   uden internetforbindelse. */

@font-face {
    font-family: "Rubik";
    src: url("/fonts/rubik-latin.woff2") format("woff2");
    font-weight: 400 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Telex";
    src: url("/fonts/telex-latin.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

:root {
    /* Skolens farver */
    --navy: #0a1f41;
    --green: #56a308;        /* mærkefarven — streger, markeringer */
    --green-strong: #457f06; /* knapper og links (består AA på hvid) */
    --mint: #edffe1;         /* sart grøn flade, som på skolens forside */

    --bg: #f7f9fa;
    --surface: #ffffff;
    --surface-2: #f0f3f7;
    --ink: var(--navy);
    --ink-2: #2d3748;
    --muted: #5a6a82;
    --line: #e2e7ee;
    --accent: var(--green-strong);
    --accent-quiet: var(--green);
    --on-accent: #ffffff;

    --ok-bg: #edffe1;
    --ok-ink: #33630a;
    --err-bg: #fdeaed;
    --err-ink: #a3243c;
    --warn-bg: #fdf3e0;
    --warn-ink: #8a5c12;

    --logo-filter: none;
    --shadow: 0 1px 2px rgba(10, 31, 65, 0.06);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #071630;
        --surface: #0d2247;
        --surface-2: #143059;
        --ink: #e8eef6;
        --ink-2: #cbd8e8;
        --muted: #93a9c6;
        --line: #1e3459;
        --accent: #8cd44b;
        --accent-quiet: #8cd44b;
        --on-accent: #071630;
        --mint: #14301a;

        --ok-bg: #14301a;
        --ok-ink: #a5dd78;
        --err-bg: #3a1620;
        --err-ink: #f0a2b2;
        --warn-bg: #382a15;
        --warn-ink: #e8c07f;

        /* Logoet er sort tekst med grønne blade — usynligt på mørk bund.
           Her vises det som ren hvid version i stedet. */
        --logo-filter: brightness(0) invert(1);
        --shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
    }
}

:root[data-theme="dark"] {
    --bg: #071630;
    --surface: #0d2247;
    --surface-2: #143059;
    --ink: #e8eef6;
    --ink-2: #cbd8e8;
    --muted: #93a9c6;
    --line: #1e3459;
    --accent: #8cd44b;
    --accent-quiet: #8cd44b;
    --on-accent: #071630;
    --mint: #14301a;

    --ok-bg: #14301a;
    --ok-ink: #a5dd78;
    --err-bg: #3a1620;
    --err-ink: #f0a2b2;
    --warn-bg: #382a15;
    --warn-ink: #e8c07f;

    --logo-filter: brightness(0) invert(1);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink-2);
    font-family: "Telex", "Segoe UI", system-ui, sans-serif;
    font-size: 16.5px;
    line-height: 1.65;
    /* Grøn streg øverst — samme grønne som den bølgede streg i logoet. */
    border-top: 4px solid var(--green);
}

h1, h2, h3, .brand, .btn, .mainnav a, th, .crumb, label, strong, b {
    font-family: "Rubik", "Segoe UI", system-ui, sans-serif;
}

h1, h2, h3 { color: var(--ink); }

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

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

/* ---- Topbar ---- */

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

.topbar-inner {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0.85rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.75rem;
    flex-wrap: wrap;
}

.brand { display: flex; align-items: center; flex-shrink: 0; }

.brand img {
    height: 34px;
    width: auto;
    display: block;
    filter: var(--logo-filter);
}

.mainnav {
    display: flex;
    gap: 0.15rem;
    flex-wrap: wrap;
    flex: 1;
}

.mainnav a {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 500;
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
}

.mainnav a:hover { background: var(--surface-2); color: var(--ink); }

.mainnav a.active {
    color: var(--ink);
    font-weight: 600;
    box-shadow: inset 0 -2px 0 var(--green);
    border-radius: 6px 6px 0 0;
}

.userbox { display: flex; align-items: center; gap: 0.65rem; }
.username { font-size: 0.87rem; color: var(--muted); }

/* ---- Knapper ---- */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.42rem 0.95rem;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
    color: var(--ink);
    font-size: 0.89rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
}

.btn:hover { border-color: var(--green); color: var(--ink); }

.btn-primary,
.btn-ms {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--on-accent);
    font-weight: 600;
}

.btn-primary:hover,
.btn-ms:hover { background: var(--green); border-color: var(--green); color: var(--on-accent); }

.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); border-color: transparent; }

.btn-ms {
    font-size: 1rem;
    padding: 0.7rem 1.2rem;
    justify-content: center;
    width: 100%;
}
.btn-ms svg { background: #fff; padding: 2px; border-radius: 2px; }

/* ---- Layout ---- */

.container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 2.25rem 1.5rem 3.5rem;
}

.footer {
    max-width: 1080px;
    margin: 0 auto;
    padding: 1.5rem 1.5rem 2.5rem;
    color: var(--muted);
    font-size: 0.82rem;
    border-top: 1px solid var(--line);
}

/* ---- Flash-beskeder ---- */

.flash {
    padding: 0.75rem 1.1rem;
    border-radius: 8px;
    margin-bottom: 1.35rem;
    font-size: 0.93rem;
}

.flash-ok { background: var(--ok-bg); color: var(--ok-ink); }
.flash-error { background: var(--err-bg); color: var(--err-ink); }
.flash-warn { background: var(--warn-bg); color: var(--warn-ink); }

.errorlist { margin: 0; padding-left: 1.2rem; }

/* ---- Login ---- */

.login-wrap { display: flex; justify-content: center; padding: 8vh 0 0; }

.login-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 2.5rem 2.5rem 2.25rem;
    max-width: 420px;
    width: 100%;
    text-align: center;
    box-shadow: 0 2px 20px rgba(10, 31, 65, 0.07);
}

.login-logo {
    height: 44px;
    width: auto;
    margin-bottom: 1.5rem;
    filter: var(--logo-filter);
}

.login-card h1 { margin: 0 0 0.6rem; font-size: 1.3rem; font-weight: 500; }
.login-card .muted { margin-bottom: 1.75rem; font-size: 0.95rem; }
.login-card .flash { text-align: left; }

/* ---- Sider ---- */

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.page-head h1 {
    margin: 0;
    font-size: 1.85rem;
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: -0.015em;
    text-wrap: balance;
}

.crumb { margin: 0 0 0.35rem; font-size: 0.78rem; }

.crumb a {
    color: var(--accent);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    font-weight: 600;
}
.crumb a:hover { text-decoration: underline; }

.meta {
    margin-top: 2.75rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.82rem;
}

.muted { color: var(--muted); }

/* ---- Forsidens sektionkort ---- */

.section-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(235px, 1fr));
    gap: 1.1rem;
    margin-top: 2.25rem;
}

.section-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 1.2rem 1.35rem;
    box-shadow: var(--shadow);
}

.section-card h2 { margin: 0 0 0.7rem; font-size: 1.02rem; font-weight: 600; }
.section-card h2 a { color: var(--ink); text-decoration: none; }
.section-card h2 a:hover { color: var(--accent); }

.page-list { list-style: none; margin: 0; padding: 0; }
.page-list li { padding: 0.24rem 0; font-size: 0.92rem; }
.page-list a { text-decoration: none; }
.page-list a:hover { text-decoration: underline; }

.page-list-lg li {
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 1rem;
}

/* ---- Renderet markdown ---- */

.prose { max-width: 68ch; }

.prose h2 {
    font-size: 1.32rem;
    font-weight: 500;
    margin: 2.25rem 0 0.65rem;
    letter-spacing: -0.01em;
}

.prose h3 { font-size: 1.07rem; font-weight: 600; margin: 1.6rem 0 0.4rem; }
.prose p, .prose ul, .prose ol { margin: 0 0 1.1rem; }
.prose li { margin-bottom: 0.35rem; }
.prose li::marker { color: var(--green); }

.prose blockquote {
    margin: 0 0 1.25rem;
    padding: 0.9rem 1.2rem;
    border-left: 4px solid var(--green);
    background: var(--mint);
    border-radius: 0 8px 8px 0;
    color: var(--ink-2);
}
.prose blockquote p { margin: 0; }

.prose table {
    border-collapse: collapse;
    width: 100%;
    margin: 0 0 1.35rem;
    font-size: 0.93rem;
    background: var(--surface);
}

.prose th, .prose td {
    border: 1px solid var(--line);
    padding: 0.5rem 0.8rem;
    text-align: left;
}

.prose thead th {
    background: var(--surface-2);
    color: var(--ink);
    font-weight: 600;
}

.prose code {
    background: var(--surface-2);
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    font-size: 0.88em;
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
}

.prose pre {
    background: var(--surface-2);
    padding: 0.9rem 1.1rem;
    border-radius: 8px;
    overflow-x: auto;
}
.prose pre code { background: none; padding: 0; }

.prose .heading-permalink {
    opacity: 0;
    text-decoration: none;
    margin-left: 0.4rem;
    font-size: 0.8em;
    color: var(--green);
}
.prose h2:hover .heading-permalink,
.prose h3:hover .heading-permalink { opacity: 1; }

.deadlink {
    border-bottom: 1px dashed var(--muted);
    color: var(--muted);
    cursor: help;
}

/* ---- Formularer ---- */

.page-form { max-width: 68ch; }

.field { margin-bottom: 1.15rem; }
.field-row { display: flex; gap: 1rem; }
.field-row .field { flex: 1; }
.field-narrow { max-width: 165px; }

.field label {
    display: block;
    font-size: 0.83rem;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 0.35rem;
}

.field input, .field select, .field textarea {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
    color: var(--ink-2);
    font-family: inherit;
    font-size: 0.95rem;
}

.field input:focus, .field select:focus, .field textarea:focus {
    outline: 2px solid var(--green);
    outline-offset: 1px;
    border-color: var(--green);
}

.mono {
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 0.88rem !important;
    line-height: 1.6;
}

.hint { font-size: 0.8rem; color: var(--muted); margin: 0.4rem 0 0; }

.form-actions { display: flex; gap: 0.75rem; margin-top: 1.6rem; }

@media (max-width: 640px) {
    .topbar-inner { gap: 0.85rem; padding: 0.75rem 1.1rem; }
    .brand img { height: 28px; }
    .container { padding: 1.75rem 1.1rem 3rem; }
    .field-row { flex-direction: column; }
    .field-narrow { max-width: none; }
    .page-head { flex-direction: column; }
}
