/*
Theme Name: AML-REG Theme
Theme URI: https://aml-reg.eu
Description: Custom theme for AML-REG.EU — EU regulation cross-reference platform by Turn Advisory GmbH.
Version: 1.0.0
Author: Turn Advisory GmbH
Author URI: https://turn-advisory.com
Text Domain: aml-reg
*/

/* ─── Reset & Base ────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
}

:root {
    --color-primary: #0787d9;
    --color-primary-hover: #0575bb;
    --color-text: #1a1a1a;
    --color-text-light: #555;
    --color-text-muted: #888;
    --color-bg: #ffffff;
    --color-bg-light: #f8f9fa;
    --color-bg-dark: #1a1a1a;
    --color-border: #e2e5e8;
    --color-border-light: #f0f0f0;
    --color-success: #28a745;
    --color-warning: #ffc107;
    --color-draft: #e67e22;
    --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-heading: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', Consolas, Monaco, monospace;
    --sidebar-width: 300px;
    --header-height: 64px;
    --max-content: 860px;
    --radius: 6px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-body);
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color 0.15s ease;
}

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

img {
    max-width: 100%;
    height: auto;
}

/* ─── Typography ──────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.3;
    margin: 0 0 0.5em;
    color: var(--color-text);
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.15rem; }
h4 { font-size: 1rem; }

p {
    margin: 0 0 1em;
}

/* ─── Header ──────────────────────────────────────────── */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--color-bg-dark);
    color: #fff;
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 24px;
    box-shadow: var(--shadow-md);
}

.site-header .logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: #fff;
}

.site-header .logo img {
    height: 28px;
    width: auto;
}

.site-header .logo .site-name {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.site-header .logo .site-name .domain {
    color: var(--color-primary);
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-left: auto;
}

.header-nav a {
    color: rgba(255,255,255,0.8);
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.15s;
}

.header-nav a:hover {
    color: #fff;
}

.lang-switcher {
    display: flex;
    gap: 4px;
    margin-left: 8px;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: var(--radius);
    overflow: hidden;
}

.lang-switcher a {
    padding: 4px 10px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    color: rgba(255,255,255,0.6);
    transition: all 0.15s;
}

.lang-switcher a:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.lang-switcher a.active {
    background: var(--color-primary);
    color: #fff;
}

.header-auth a {
    font-size: 0.875rem;
}

.header-auth .btn-subscribe {
    background: var(--color-primary);
    color: #fff;
    padding: 6px 16px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.8rem;
    transition: background 0.15s;
}

.header-auth .btn-subscribe:hover {
    background: var(--color-primary-hover);
    color: #fff;
}

/* Mobile menu toggle */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px;
}

/* ─── Layout ──────────────────────────────────────────── */
.site-layout {
    display: flex;
    min-height: calc(100vh - var(--header-height));
}

.site-sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--color-bg-light);
    border-right: 1px solid var(--color-border);
    padding: 24px 0;
    overflow-y: auto;
    position: sticky;
    top: var(--header-height);
    height: calc(100vh - var(--header-height));
}

.site-content {
    flex: 1;
    min-width: 0;
    padding: 32px 40px;
}

.content-inner {
    max-width: var(--max-content);
}

/* ─── Sidebar Navigation ─────────────────────────────── */
.sidebar-section {
    margin-bottom: 24px;
}

.sidebar-section-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-muted);
    padding: 0 20px;
    margin-bottom: 8px;
}

.sidebar-nav {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar-nav li a {
    display: block;
    padding: 6px 20px;
    font-size: 0.875rem;
    color: var(--color-text-light);
    border-left: 3px solid transparent;
    transition: all 0.15s;
}

.sidebar-nav li a:hover {
    background: rgba(0,0,0,0.04);
    color: var(--color-text);
}

.sidebar-nav li a.active {
    border-left-color: var(--color-primary);
    color: var(--color-primary);
    font-weight: 600;
    background: rgba(7, 135, 217, 0.05);
}

.sidebar-nav li.chapter-heading {
    padding: 12px 20px 4px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
}

.sidebar-nav li.chapter-heading:first-child {
    padding-top: 0;
}

.sidebar-nav .sub-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav .sub-nav li a {
    padding-left: 32px;
    font-size: 0.825rem;
}

/* Sidebar document selector */
.sidebar-doc-select {
    padding: 0 16px 16px;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 16px;
}

.sidebar-doc-select select {
    width: 100%;
    padding: 8px 10px;
    font-size: 0.85rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: #fff;
    font-family: var(--font-body);
}

/* ─── Breadcrumbs ─────────────────────────────────────── */
.breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-bottom: 20px;
}

.breadcrumbs a {
    color: var(--color-text-muted);
}

.breadcrumbs a:hover {
    color: var(--color-primary);
}

.breadcrumbs .sep {
    margin: 0 4px;
}

/* ─── Content: Regulation Overview ────────────────────── */
.regulation-meta {
    background: var(--color-bg-light);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 20px 24px;
    margin-bottom: 32px;
}

.regulation-meta dl {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 8px 16px;
    margin: 0;
    font-size: 0.9rem;
}

.regulation-meta dt {
    font-weight: 600;
    color: var(--color-text-muted);
}

.regulation-meta dd {
    margin: 0;
}

.status-badge {
    display: inline-block;
    padding: 2px 10px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-radius: 12px;
}

.status-badge.final {
    background: rgba(40, 167, 69, 0.1);
    color: var(--color-success);
}

.status-badge.draft {
    background: rgba(230, 126, 34, 0.1);
    color: var(--color-draft);
}

.doc-stats {
    display: flex;
    gap: 32px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--color-border);
}

.doc-stat {
    text-align: center;
}

.doc-stat .stat-number {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--color-primary);
    line-height: 1;
}

.doc-stat .stat-label {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 4px;
}

/* Table of contents */
.toc-section {
    margin-bottom: 32px;
}

.toc-chapter {
    margin-bottom: 4px;
}

.toc-chapter-title {
    padding: 10px 16px;
    background: var(--color-bg-light);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background 0.15s;
}

.toc-chapter-title:hover {
    background: var(--color-border-light);
}

.toc-chapter-title .toggle-icon {
    font-size: 0.8rem;
    transition: transform 0.2s;
}

.toc-chapter.open .toggle-icon {
    transform: rotate(90deg);
}

.toc-articles {
    list-style: none;
    padding: 0;
    margin: 0;
    display: none;
}

.toc-chapter.open .toc-articles {
    display: block;
}

.toc-articles li a {
    display: block;
    padding: 8px 16px 8px 32px;
    font-size: 0.9rem;
    color: var(--color-text-light);
    border-left: 2px solid var(--color-border);
    transition: all 0.15s;
}

.toc-articles li a:hover {
    border-left-color: var(--color-primary);
    color: var(--color-primary);
    background: rgba(7, 135, 217, 0.03);
}

/* ─── Content: Article/Recital Pages ──────────────────── */
.article-header, .recital-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--color-border);
}

.article-header .article-number,
.recital-header .recital-number {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-primary);
    margin-bottom: 4px;
}

.article-header h1,
.recital-header h1 {
    margin-bottom: 0;
}

.article-chapter-ref {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-top: 8px;
}

.legal-text {
    font-size: 1rem;
    line-height: 1.85;
    color: var(--color-text);
}

.legal-text p {
    margin-bottom: 1.2em;
}

.legal-text ol, .legal-text ul {
    margin: 0 0 1em;
    padding-left: 2em;
}

.legal-text li {
    margin-bottom: 0.5em;
}

/* Article/Recital navigation */
.content-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--color-border);
}

.content-nav a {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 8px 16px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    transition: all 0.15s;
}

.content-nav a:hover {
    border-color: var(--color-primary);
    background: rgba(7, 135, 217, 0.03);
}

/* ─── Linkage Section ─────────────────────────────────── */
.linkages-section {
    margin-top: 40px;
    padding-top: 24px;
    border-top: 2px solid var(--color-border);
}

.linkages-section h2 {
    font-size: 1.15rem;
    margin-bottom: 16px;
}

.linkage-count {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    margin-bottom: 16px;
}

.linkage-item {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 12px;
    transition: border-color 0.15s;
}

.linkage-item:hover {
    border-color: var(--color-primary);
}

.linkage-item .linkage-ref {
    font-weight: 600;
    color: var(--color-primary);
    margin-bottom: 4px;
}

.linkage-item .linkage-ref a {
    color: inherit;
}

.linkage-item .linkage-preview {
    font-size: 0.9rem;
    color: var(--color-text-light);
    margin-bottom: 8px;
}

.linkage-item .linkage-comment {
    font-size: 0.9rem;
    padding: 12px 16px;
    background: var(--color-bg-light);
    border-left: 3px solid var(--color-primary);
    border-radius: 0 var(--radius) var(--radius) 0;
    margin-top: 8px;
}

/* ─── Paywall Teaser ──────────────────────────────────── */
.paywall-teaser {
    position: relative;
    margin-top: 40px;
    padding-top: 24px;
    border-top: 2px solid var(--color-border);
}

.paywall-blurred {
    filter: blur(4px);
    user-select: none;
    pointer-events: none;
    max-height: 200px;
    overflow: hidden;
    opacity: 0.5;
}

.paywall-overlay {
    position: relative;
    text-align: center;
    padding: 32px 24px;
    margin-top: -60px;
    background: linear-gradient(to bottom, rgba(255,255,255,0.7), rgba(255,255,255,1) 40%);
}

.paywall-overlay h3 {
    font-size: 1.2rem;
    margin-bottom: 8px;
}

.paywall-overlay p {
    color: var(--color-text-light);
    font-size: 0.95rem;
    margin-bottom: 16px;
}

.btn-cta {
    display: inline-block;
    background: var(--color-primary);
    color: #fff;
    padding: 12px 32px;
    border-radius: var(--radius);
    font-weight: 700;
    font-size: 0.95rem;
    transition: background 0.15s;
}

.btn-cta:hover {
    background: var(--color-primary-hover);
    color: #fff;
}

/* ─── Disclaimer Banner ───────────────────────────────── */
.disclaimer-banner {
    background: #fffbe6;
    border: 1px solid #f0e6b0;
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 24px;
    font-size: 0.8rem;
    line-height: 1.6;
    color: #665d1e;
}

.disclaimer-banner strong {
    display: block;
    margin-bottom: 4px;
    font-size: 0.85rem;
}

.disclaimer-toggle {
    background: none;
    border: none;
    color: var(--color-primary);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0;
    font-family: var(--font-body);
}

.disclaimer-full {
    display: none;
    margin-top: 8px;
}

.disclaimer-full.open {
    display: block;
}

/* ─── Linkage Matrix ──────────────────────────────────── */
.linkage-matrix-wrap {
    overflow-x: auto;
}

.linkage-matrix {
    border-collapse: collapse;
    font-size: 0.75rem;
    min-width: 100%;
}

.linkage-matrix th,
.linkage-matrix td {
    border: 1px solid var(--color-border);
    padding: 4px 6px;
    text-align: center;
    min-width: 36px;
}

.linkage-matrix th {
    background: var(--color-bg-light);
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 1;
}

.linkage-matrix th.row-header {
    text-align: left;
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--color-bg-light);
}

.linkage-matrix td.has-linkage {
    background: rgba(7, 135, 217, 0.15);
    cursor: pointer;
}

.linkage-matrix td.has-linkage:hover {
    background: rgba(7, 135, 217, 0.3);
}

/* ─── Homepage ────────────────────────────────────────── */
.home-hero {
    padding: 60px 40px;
    text-align: center;
    max-width: 720px;
    margin: 0 auto;
}

.home-hero h1 {
    font-size: 2rem;
    margin-bottom: 12px;
}

.home-hero p {
    font-size: 1.1rem;
    color: var(--color-text-light);
    line-height: 1.7;
}

.home-documents {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 24px;
    padding: 0 40px 60px;
    max-width: 1000px;
    margin: 0 auto;
}

.doc-card {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 24px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.doc-card:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-md);
}

.doc-card h3 {
    margin-bottom: 4px;
}

.doc-card h3 a {
    color: var(--color-text);
}

.doc-card h3 a:hover {
    color: var(--color-primary);
}

.doc-card .doc-card-type {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-primary);
    margin-bottom: 8px;
}

.doc-card .doc-card-desc {
    font-size: 0.9rem;
    color: var(--color-text-light);
    margin-bottom: 12px;
}

.doc-card .doc-card-stats {
    display: flex;
    gap: 16px;
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

/* ─── Ad Placeholders ─────────────────────────────────── */
.ad-slot {
    display: none; /* Hidden until Phase 2 */
}

.ad-slot.active {
    display: block;
    text-align: center;
    padding: 12px;
    background: var(--color-bg-light);
    border: 1px dashed var(--color-border);
    border-radius: var(--radius);
    margin: 20px 0;
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

/* ─── Footer ──────────────────────────────────────────── */
.site-footer {
    background: var(--color-bg-dark);
    color: rgba(255,255,255,0.6);
    padding: 40px 24px;
    font-size: 0.85rem;
    line-height: 1.8;
}

.footer-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 40px;
}

.footer-section h4 {
    color: #fff;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}

.footer-section a {
    color: rgba(255,255,255,0.6);
}

.footer-section a:hover {
    color: #fff;
}

.footer-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-section ul li {
    margin-bottom: 6px;
}

.footer-bottom {
    max-width: 1100px;
    margin: 24px auto 0;
    padding-top: 24px;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 0.8rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-bottom a {
    color: rgba(255,255,255,0.5);
}

/* ─── Login / Subscribe Pages ─────────────────────────── */
.auth-page {
    max-width: 420px;
    margin: 60px auto;
    padding: 0 20px;
}

.auth-page h1 {
    text-align: center;
    margin-bottom: 24px;
}

.auth-form .form-group {
    margin-bottom: 16px;
}

.auth-form label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.auth-form input[type="text"],
.auth-form input[type="email"],
.auth-form input[type="password"] {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.95rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-family: var(--font-body);
    transition: border-color 0.15s;
}

.auth-form input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(7, 135, 217, 0.1);
}

.auth-form .btn-submit {
    width: 100%;
    padding: 12px;
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    font-family: var(--font-body);
    transition: background 0.15s;
}

.auth-form .btn-submit:hover {
    background: var(--color-primary-hover);
}

/* ─── Recital List ────────────────────────────────────── */
.recital-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.recital-list-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--color-border-light);
}

.recital-list-item a {
    display: flex;
    gap: 12px;
    color: var(--color-text);
}

.recital-list-item a:hover {
    color: var(--color-primary);
}

.recital-list-item .recital-num {
    font-weight: 700;
    color: var(--color-primary);
    min-width: 32px;
}

.recital-list-item .recital-excerpt {
    font-size: 0.9rem;
    color: var(--color-text-light);
}

/* ─── Language Notice ─────────────────────────────────── */
.lang-notice {
    background: rgba(7, 135, 217, 0.06);
    border: 1px solid rgba(7, 135, 217, 0.15);
    border-radius: var(--radius);
    padding: 12px 16px;
    font-size: 0.875rem;
    color: var(--color-text-light);
    margin-bottom: 24px;
}

/* ─── Responsive ──────────────────────────────────────── */
@media (max-width: 1024px) {
    .site-sidebar {
        position: fixed;
        left: -100%;
        top: var(--header-height);
        z-index: 90;
        transition: left 0.3s ease;
        box-shadow: var(--shadow-md);
    }

    .site-sidebar.open {
        left: 0;
    }

    .menu-toggle {
        display: block;
    }

    .site-content {
        padding: 24px 20px;
    }

    .footer-inner {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .home-documents {
        grid-template-columns: 1fr;
        padding: 0 20px 40px;
    }
}

@media (max-width: 640px) {
    .header-nav {
        gap: 12px;
    }

    .header-nav .nav-link {
        display: none;
    }

    .home-hero {
        padding: 40px 20px;
    }

    .home-hero h1 {
        font-size: 1.5rem;
    }

    .regulation-meta dl {
        grid-template-columns: 1fr;
    }

    .content-nav {
        flex-direction: column;
        gap: 12px;
    }

    .content-nav a {
        width: 100%;
        justify-content: center;
    }
}
