/*
 * Shared styles for the legal pages (privacy.html, terms.html, cookies.html).
 * Follows the light design of the other static pages (education, experience, projects, contact):
 * Inter, white page, light grey panels, centred header, link-row nav and a simple footer.
 * Light only, like those pages.
 */

:root {
    color-scheme: light;

    /* Palette: taken from the static reference pages */
    --color-bg: #ffffff;
    --color-heading: #111827;
    --color-text: #1f2937;
    --color-body: #374151;
    --color-secondary: #4b5563;
    --color-muted: #6b7280;
    --color-border: #e5e7eb;
    --color-border-soft: #f3f4f6;
    --color-panel: #f9fafb;
    --color-card: #fdfdfd;
    --color-accent: #3b82f6;      /* decorative only (card edge) */
    --color-link: #2563eb;        /* 5.2:1 on white; #3b82f6 is 3.7:1, too low for text */
    --color-link-hover: #1d4ed8;
    --color-focus: #2563eb;

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;

    --radius-sm: 6px;
    --radius-md: 8px;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.05);

    --measure: 44rem;             /* ~68 characters of body text */
}

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

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

@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

body {
    font-family: var(--font-sans);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
    overflow-wrap: break-word;
}

/* ---------- Skip link ---------- */

.skip-link {
    position: absolute;
    left: 16px;
    top: -100px;
    z-index: 10;
    padding: 10px 16px;
    background: var(--color-heading);
    color: #ffffff;
    border-radius: var(--radius-sm);
    font-weight: 600;
    text-decoration: none;
}

.skip-link:focus {
    top: 16px;
}

/* ---------- Focus ---------- */

a:focus-visible,
summary:focus-visible,
.table-wrap:focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ---------- Page frame (matches .container on the reference pages) ---------- */

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* ---------- Header ---------- */

.page-header {
    text-align: center;
    margin-bottom: 32px;
    padding-top: 30px;
}

.page-header h1 {
    font-size: 2.5rem;
    line-height: 1.2;
    color: var(--color-heading);
    margin-bottom: 12px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.intro {
    font-size: 1.1rem;
    color: var(--color-muted);
    max-width: 40rem;
    margin: 0 auto 10px;
}

.updated {
    font-size: 0.95rem;
    color: var(--color-muted);
}

.updated strong {
    color: var(--color-secondary);
    font-weight: 600;
}

/* ---------- Main navigation (same as the reference pages) ---------- */

.site-nav {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.site-nav a {
    color: var(--color-secondary);
    text-decoration: none;
    padding: 8px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 500;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

.site-nav a:hover {
    color: var(--color-heading);
    background: var(--color-border-soft);
    border-color: var(--color-border);
}

/* ---------- Document area ---------- */

.doc {
    max-width: var(--measure);
    margin: 0 auto;
}

/* Switcher between the three legal documents */
.doc-switcher {
    margin-bottom: 32px;
}

.doc-switcher ul {
    display: flex;
    justify-content: center;
    gap: 4px;
    list-style: none;
    padding: 4px;
    background: var(--color-panel);
    border: 1px solid var(--color-border-soft);
    border-radius: var(--radius-md);
}

.doc-switcher li {
    flex: 1 1 0;
}

.doc-switcher a {
    display: block;
    text-align: center;
    padding: 8px 12px;
    color: var(--color-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

.doc-switcher a:hover {
    color: var(--color-heading);
    background: var(--color-bg);
}

.doc-switcher a[aria-current="page"] {
    color: var(--color-heading);
    background: var(--color-bg);
    border-color: var(--color-border);
    box-shadow: var(--shadow-sm);
    font-weight: 600;
}

/* "In short" summary: the card style of .education-item */
.summary {
    background: var(--color-card);
    border-left: 3px solid var(--color-accent);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    box-shadow: var(--shadow-card);
    padding: 22px 26px;
    margin-bottom: 24px;
}

.summary h2 {
    font-size: 1.125rem;
    color: var(--color-heading);
    font-weight: 600;
    margin-bottom: 10px;
    border: 0;
    padding: 0;
}

.summary ul {
    padding-left: 1.25rem;
}

.summary li {
    font-size: 1.0625rem;
    line-height: 1.65;
    color: var(--color-body);
    margin-bottom: 6px;
}

.summary li:last-child {
    margin-bottom: 0;
}

/* Table of contents: the grey panel of .main-nav / .contact-section */
.toc {
    background: var(--color-panel);
    border: 1px solid var(--color-border-soft);
    border-radius: var(--radius-md);
    margin-bottom: 40px;
}

.toc summary {
    padding: 14px 20px;
    font-weight: 600;
    color: var(--color-heading);
    cursor: pointer;
}

.toc ol {
    padding: 0 20px 16px 2.5rem;
    columns: 2;
    column-gap: 2rem;
}

.toc li {
    break-inside: avoid;
    padding: 3px 0;
    color: var(--color-muted);
    font-size: 0.95rem;
}

.toc a {
    color: var(--color-secondary);
    text-decoration: none;
}

.toc a:hover {
    color: var(--color-heading);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* ---------- Sections and prose ---------- */

.prose section {
    margin-bottom: 44px;
    scroll-margin-top: 16px;
}

.prose h2 {
    font-size: 1.625rem;
    line-height: 1.3;
    color: var(--color-heading);
    font-weight: 600;
    margin-bottom: 18px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--color-border-soft);
}

.prose h3 {
    font-size: 1.15rem;
    line-height: 1.4;
    color: var(--color-heading);
    font-weight: 600;
    margin: 26px 0 8px;
}

.prose p,
.prose li {
    font-size: 1.0625rem;
    line-height: 1.7;
    color: var(--color-body);
}

.prose p {
    margin-bottom: 16px;
}

.prose ul,
.prose ol {
    padding-left: 1.4rem;
    margin-bottom: 16px;
}

.prose li {
    margin-bottom: 8px;
}

.prose strong {
    color: var(--color-heading);
    font-weight: 600;
}

.prose a {
    color: var(--color-link);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

.prose a:hover {
    color: var(--color-link-hover);
    text-decoration-thickness: 2px;
}

.prose code {
    font-family: var(--font-mono);
    font-size: 0.875em;
    background: var(--color-border-soft);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: 1px 5px;
    color: var(--color-heading);
    overflow-wrap: anywhere;
}

/* A plain grey panel for side notes (e.g. regulator details) */
.note {
    background: var(--color-panel);
    border: 1px solid var(--color-border-soft);
    border-radius: var(--radius-md);
    padding: 18px 22px;
    margin-bottom: 16px;
}

.note p:last-child,
.note ul:last-child {
    margin-bottom: 0;
}

.contact-list {
    list-style: none;
    padding-left: 0 !important;
}

/* ---------- Tables (stacked into cards on narrow screens) ---------- */

.table-wrap {
    margin: 8px 0 20px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
    line-height: 1.55;
}

.data-table caption {
    caption-side: top;
    text-align: left;
    font-weight: 600;
    color: var(--color-heading);
    padding-bottom: 10px;
    font-size: 1rem;
}

.data-table th,
.data-table td {
    text-align: left;
    vertical-align: top;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    color: var(--color-body);
}

.data-table thead th {
    background: var(--color-panel);
    color: var(--color-heading);
    font-weight: 600;
    font-size: 0.875rem;
}

.data-table tbody th {
    font-weight: 600;
    color: var(--color-heading);
}

.data-table td p,
.data-table td li {
    font-size: inherit;
    line-height: inherit;
}

.tag {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 1px 8px;
    border-radius: 12px;
    border: 1px solid var(--color-border);
    background: var(--color-border-soft);
    color: var(--color-body);
    white-space: nowrap;
}

.tag--consent {
    background: #fef3c7;   /* badge colours from education.html */
    border-color: #fde68a;
    color: #92400e;
}

/* ---------- Footer (matches the reference footer) ---------- */

.site-footer {
    text-align: center;
    margin-top: 50px;
    padding-top: 25px;
    border-top: 1px solid var(--color-border-soft);
    color: var(--color-muted);
    font-size: 0.9rem;
}

.site-footer a {
    color: var(--color-secondary);
    text-decoration: none;
    font-weight: 500;
}

.site-footer a:hover {
    color: var(--color-heading);
    text-decoration: underline;
}

.site-footer a[aria-current="page"] {
    color: var(--color-heading);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.footer-legal {
    margin-top: 8px;
    font-size: 0.85rem;
}

.footer-legal ul {
    display: inline;
    list-style: none;
}

.footer-legal li {
    display: inline;
}

.footer-legal li + li::before {
    content: "|";
    margin: 0 0.5rem;
    color: #9ca3af;
}

/* ---------- Narrow screens ---------- */

@media (max-width: 768px) {
    .container {
        padding: 24px 16px;
    }

    .page-header {
        padding-top: 12px;
        margin-bottom: 24px;
    }

    .page-header h1 {
        font-size: 2rem;
    }

    .site-nav {
        gap: 6px;
        margin-bottom: 28px;
    }

    .site-nav a {
        padding: 6px 12px;
    }

    .toc ol {
        columns: 1;
    }

    .prose h2 {
        font-size: 1.4rem;
    }

    .summary {
        padding: 18px 18px 18px 20px;
    }
}

@media (max-width: 720px) {
    /* Each row becomes a small card; the column name is shown before each value. */
    .data-table,
    .data-table tbody,
    .data-table tr,
    .data-table td,
    .data-table tbody th {
        display: block;
        width: 100%;
    }

    .data-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    .data-table caption {
        display: block;
    }

    .data-table tr {
        border: 1px solid var(--color-border);
        border-radius: var(--radius-md);
        background: var(--color-card);
        padding: 12px 14px;
        margin-bottom: 12px;
    }

    .data-table th,
    .data-table td {
        border: 0;
        padding: 4px 0;
    }

    .data-table tbody th {
        font-size: 1rem;
        padding-bottom: 6px;
    }

    .data-table td::before {
        content: attr(data-label);
        display: block;
        font-size: 0.75rem;
        font-weight: 600;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        color: var(--color-muted);
    }
}

/* ---------- Motion ---------- */

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

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

@media print {
    @page {
        margin: 18mm 16mm;
    }

    body {
        font-size: 11pt;
        color: #000000;
        background: #ffffff;
    }

    .skip-link,
    .site-nav,
    .doc-switcher,
    .toc {
        display: none !important;
    }

    .container {
        max-width: none;
        padding: 0;
    }

    .doc {
        max-width: none;
    }

    .page-header {
        padding-top: 0;
        text-align: left;
    }

    .intro {
        margin-left: 0;
    }

    .prose p,
    .prose li,
    .summary li,
    .data-table th,
    .data-table td {
        color: #000000;
        font-size: 10.5pt;
    }

    .summary {
        box-shadow: none;
        border: 1px solid #999999;
        border-left: 3px solid #000000;
    }

    .prose a {
        color: #000000;
    }

    .prose a[href^="http"]::after {
        content: " (" attr(href) ")";
        font-size: 9pt;
        word-break: break-all;
    }

    .prose h2,
    .prose h3 {
        break-after: avoid;
    }

    .data-table tr,
    .summary,
    .note {
        break-inside: avoid;
    }

    .site-footer {
        margin-top: 24pt;
    }
}

/* ---------- Small additions ---------- */

.summary a {
    color: var(--color-link);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.summary a:hover {
    color: var(--color-link-hover);
}

.summary strong {
    color: var(--color-heading);
    font-weight: 600;
}

/* The skip link moves focus to <main tabindex="-1">; don't draw a ring around the whole page. */
main:focus {
    outline: none;
}

/* Cookie table: give storage key names room so they don't break mid-word on desktop. */
@media (min-width: 721px) {
    .cookie-table thead th:nth-child(1) { width: 28%; }
    .cookie-table thead th:nth-child(2) { width: 16%; }
    .cookie-table thead th:nth-child(4) { width: 17%; }
    .cookie-table thead th:nth-child(5) { width: 11%; }

    .cookie-table code {
        font-size: 0.82em;
    }
}
