/*
 * Shared styles for the standalone public pages (support, privacy policy).
 * They mirror the app shell and the @korfbal/design-tokens palette so the
 * pages feel like part of KorfConnect while staying plain HTML that works
 * without JavaScript and under an installed service worker.
 */
@import url('/fonts/inter-v4.1/fonts.css');

:root {
    color-scheme: light;
    --base: #f2f2f7;
    --surface: #ffffff;
    --surface-glow: #ececf1;
    --border: #e5e5ea;
    --border-strong: #d1d1d6;
    --text: #1c1c1e;
    --muted: #66666b;
    --subtle: #6a6a6f;
    --accent: #d97706;
    --accent-strong: #b45309;
    --link: #b45309;
    --highlight: #d977061a;
    --emerald: #10b981;
    --shadow-card: 0 8px 24px -16px rgba(0, 0, 0, 0.14);
    --shadow-soft: 0 4px 14px -10px rgba(0, 0, 0, 0.12);
    --radius-card: 1.75rem;
    --page-bg: none;
    --topbar: 2rem;
    --tabbar: 3rem;
    --hit: 2.75rem;
    --sidebar: 18rem;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}
html.dark {
    color-scheme: dark;
    --base: #1b1b1b;
    --surface: #202020;
    --surface-glow: #2b2b2b;
    --border: #2f2f2f;
    --border-strong: #3b3b3b;
    --text: #f5f4f0;
    --muted: #a3a3b2;
    --subtle: #9494a0;
    --accent: #f7c948;
    --accent-strong: #ffad1f;
    --link: #f7c948;
    --highlight: #ffd16633;
    --emerald: #48f5c4;
    --shadow-card: 0 30px 80px -40px rgba(0, 0, 0, 0.9);
    --shadow-soft: 0 20px 50px -35px rgba(0, 0, 0, 0.75);
    --page-bg: none;
}
/* Without JavaScript (or a stored preference) follow the system theme. */
@media (prefers-color-scheme: dark) {
    html:not([data-theme]) {
        color-scheme: dark;
        --base: #1b1b1b;
        --surface: #202020;
        --surface-glow: #2b2b2b;
        --border: #2f2f2f;
        --border-strong: #3b3b3b;
        --text: #f5f4f0;
        --muted: #a3a3b2;
        --subtle: #9494a0;
        --accent: #f7c948;
        --accent-strong: #ffad1f;
        --link: #f7c948;
        --highlight: #ffd16633;
        --emerald: #48f5c4;
        --shadow-card: 0 30px 80px -40px rgba(0, 0, 0, 0.9);
        --shadow-soft: 0 20px 50px -35px rgba(0, 0, 0, 0.75);
        --page-bg: none;
    }
}
@media (min-width: 1024px) {
    :root {
        --topbar: 3rem;
    }
}
@media (pointer: coarse) {
    :root {
        --hit: 3.25rem;
    }
}

* {
    box-sizing: border-box;
}
html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--topbar) + var(--safe-top) + 1rem);
    background-color: var(--base);
    background-image: var(--page-bg);
    background-repeat: no-repeat;
    color: var(--text);
    -webkit-text-size-adjust: 100%;
}
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}
body {
    margin: 0;
    min-height: 100dvh;
    font:
        1rem/1.65 'Inter',
        system-ui,
        -apple-system,
        'Segoe UI',
        sans-serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
a {
    color: var(--link);
    text-underline-offset: 0.2em;
    overflow-wrap: anywhere;
}
a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 0.5rem;
}
h1,
h2,
h3 {
    margin: 0;
    line-height: 1.2;
}
p {
    margin: 0.75rem 0;
}
ul {
    padding-left: 1.25rem;
}
li + li {
    margin-top: 0.5rem;
}
address {
    font-style: normal;
}
.muted {
    color: var(--muted);
}
svg.icon {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex: none;
}

/* Shell */
.shell {
    display: flex;
    min-height: 100dvh;
}
.sidebar {
    display: none;
}
.content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* Top navbar (matches TopNavbar) */
.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    height: calc(var(--topbar) + var(--safe-top));
    padding-top: var(--safe-top);
    border-bottom: 1px solid var(--border);
    background: var(--base);
}
.topbar-inner {
    position: relative;
    display: flex;
    align-items: center;
    height: var(--topbar);
    max-width: 56rem;
    margin: 0 auto;
    padding: 0 1rem;
}
.topbar-back {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: var(--topbar);
    color: var(--text);
    transition: opacity 120ms;
}
.topbar-back:hover {
    opacity: 0.7;
}
.topbar-title {
    position: absolute;
    inset-inline: 0;
    pointer-events: none;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    line-height: 1;
    color: var(--text);
}

/* Page body */
.page {
    flex: 1;
    width: 100%;
    max-width: 56rem;
    margin: 0 auto;
    padding: 1.25rem 1rem calc(var(--tabbar) + var(--safe-bottom) + 2rem);
}
.eyebrow {
    margin: 0 0 0.5rem;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--accent);
}

/* Table of contents */
.toc {
    margin-bottom: 1.5rem;
}
.toc strong {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--accent);
}
.toc ol {
    list-style: none;
    margin: 0;
    padding: 0.25rem 0;
    border: 1px solid var(--border);
    border-radius: 1.25rem;
    background: var(--surface);
    box-shadow: var(--shadow-soft);
}
.toc li {
    margin: 0;
}
.toc li + li {
    border-top: 1px solid var(--border);
}
.toc a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    min-height: var(--hit);
    padding: 0.45rem 1rem;
    color: var(--text);
    font-size: 0.95rem;
    text-decoration: none;
}
.toc a::after {
    content: '';
    width: 0.45rem;
    height: 0.45rem;
    flex: none;
    border-right: 2px solid var(--subtle);
    border-bottom: 2px solid var(--subtle);
    transform: rotate(-45deg);
}
.toc a:hover {
    background: var(--highlight);
}

/* Sections rendered as app cards */
.sections section {
    margin-bottom: 1.5rem;
}
.sections h2 {
    margin: 0 0.25rem 0.6rem;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--accent);
}
.card {
    padding: 1.1rem 1.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    background: var(--surface);
    box-shadow: var(--shadow-card);
    overflow-wrap: anywhere;
}
.card > :first-child {
    margin-top: 0;
}
.card > :last-child {
    margin-bottom: 0;
}
.card h3 {
    margin: 1.25rem 0 0.25rem;
    font-size: 1rem;
    font-weight: 600;
}
.card h3:first-child {
    margin-top: 0;
}
.card table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}
.card th,
.card td {
    padding: 0.5rem 0.25rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}
.card th {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--subtle);
}
.contact {
    margin: 1rem 0;
    padding: 0.85rem 1rem;
    border-radius: 1.25rem;
    background: var(--surface-glow);
    border: 1px solid var(--border);
}

/* Footer */
.page-foot {
    padding: 0.5rem 0.25rem 0;
    font-size: 0.85rem;
    color: var(--subtle);
}
.page-foot nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1rem;
    margin-top: 0.35rem;
}

/* Bottom tab bar (matches TabBar) */
.tabbar {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 40;
    background: var(--surface);
    padding-bottom: var(--safe-bottom);
    border-top: 1px solid var(--border);
}
.tabbar-inner {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    height: var(--tabbar);
    max-width: 48rem;
    margin: 0 auto;
    padding: 0 1rem;
}
.tabbar a {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    transition: color 120ms;
}
.tabbar a:hover {
    color: var(--text);
}

/* Desktop shell (matches DesktopAppShell + SidebarNav) */
@media (min-width: 1024px) {
    .tabbar,
    .topbar-back {
        display: none;
    }
    .shell {
        height: 100dvh;
        overflow: hidden;
    }
    .sidebar {
        display: flex;
        flex-direction: column;
        width: var(--sidebar);
        height: 100%;
        padding: 0.75rem;
        border-right: 1px solid var(--border);
        background: color-mix(in srgb, var(--surface) 80%, transparent);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
    }
    .sidebar-brand {
        display: block;
        margin: 0.5rem 0.5rem 1rem;
        font-size: 0.75rem;
        font-weight: 600;
        letter-spacing: 0.35em;
        text-transform: uppercase;
        color: var(--subtle);
        text-decoration: none;
    }
    .sidebar nav {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
    .sidebar nav a {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        height: var(--hit);
        padding: 0 0.75rem;
        border-radius: 1rem;
        font-size: 0.875rem;
        font-weight: 500;
        color: var(--muted);
        text-decoration: none;
        transition: color 120ms;
    }
    .sidebar nav a:hover {
        color: var(--text);
    }
    .sidebar nav a[aria-current='page'] {
        background: var(--highlight);
        color: var(--accent);
    }
    .content {
        height: 100%;
        overflow-y: auto;
        overscroll-behavior: contain;
    }
    .topbar-inner {
        max-width: none;
        padding: 0 1.5rem;
    }
    .topbar-title {
        font-size: 0.875rem;
    }
    .page {
        max-width: 84rem;
        padding: 2rem 2rem 3rem;
        display: grid;
        grid-template-columns: minmax(0, 1fr) 17rem;
        grid-template-areas:
            'main toc'
            'foot foot';
        column-gap: 2rem;
        align-content: start;
    }
    .sections {
        grid-area: main;
        min-width: 0;
    }
    .toc {
        grid-area: toc;
        position: sticky;
        top: 0;
        align-self: start;
        margin-bottom: 0;
    }
    .page-foot {
        grid-area: foot;
    }
    .card {
        padding: 1.5rem 1.75rem;
    }
}
