/*
Theme Name: Open TSA
Theme URI: https://open-tsa.eu
Author: Open TSA Project
Author URI: https://open-tsa.eu
Description: Official theme for open-tsa.eu — EU-style trust infrastructure website with documentation and blog support.
Version: 1.0.0
License: MIT
License URI: https://opensource.org/licenses/MIT
Text Domain: open-tsa
Tags: eu-style, documentation, blog, trust, open-source
*/

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
    --eu-blue:       #003399;
    --eu-blue-mid:   #0050CC;
    --eu-blue-light: #E8EEF8;
    --eu-blue-pale:  #F0F4FF;
    --eu-gold:       #FFCC00;
    --white:         #FFFFFF;
    --ink:           #1A1A2E;
    --ink-mid:       #3D3D5C;
    --ink-light:     #6B6B8A;
    --rule:          #D0D8EE;
    --green:         #1A7A3C;
    --green-bg:      #E8F5EE;
    --red:           #CC0000;
    --serif:         'Source Serif 4', Georgia, 'Times New Roman', serif;
    --mono:          'Source Code Pro', 'Courier New', monospace;
    --sans:          'Source Sans 3', system-ui, sans-serif;
    --max:           1140px;
    --docs-sidebar:  260px;
    --header-h:      64px;
    --radius:        4px;
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-h) + 1rem);
}

body {
    background: var(--white);
    color: var(--ink);
    font-family: var(--serif);
    font-size: 17px;
    line-height: 1.75;
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--eu-blue-mid); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ────────────────────────────────────────────────── */
.container {
    max-width: var(--max);
    margin: 0 auto;
    padding: 0 2rem;
}

.section {
    padding: 5rem 0;
    border-top: 1px solid var(--rule);
}

/* ── EU Stars ──────────────────────────────────────────────── */
.eu-stars { display: flex; gap: 3px; align-items: center; }
.eu-stars span { color: var(--eu-gold); font-size: 9px; line-height: 1; }

/* ── Skip link ─────────────────────────────────────────────── */
.skip-link {
    position: absolute;
    top: -999px;
    left: 1rem;
    background: var(--eu-blue);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0 0 4px 4px;
    font-family: var(--mono);
    font-size: 0.8rem;
    z-index: 9999;
}
.skip-link:focus { top: 0; }

/* ── Site Header ───────────────────────────────────────────── */
.site-header {
    position: sticky;
    top: 0;
    z-index: 200;
    background: var(--white);
    border-bottom: 3px solid var(--eu-blue);
    box-shadow: 0 2px 12px rgba(0,51,153,0.08);
}

.header-inner {
    display: flex;
    align-items: center;
    height: var(--header-h);
    gap: 2rem;
    justify-content: space-between;
}

.site-branding {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: var(--serif);
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--eu-blue);
    flex-shrink: 0;
}

.site-branding:hover { text-decoration: none; }

.header-badge {
    background: var(--eu-blue);
    color: var(--white);
    font-family: var(--mono);
    font-size: 0.6rem;
    padding: 2px 5px;
    border-radius: 2px;
    letter-spacing: 0.05em;
}

.main-navigation ul {
    display: flex;
    gap: 1.75rem;
    list-style: none;
    align-items: center;
}

.main-navigation a {
    color: var(--ink-mid);
    font-size: 0.88rem;
    font-family: var(--sans);
    transition: color 0.15s;
}

.main-navigation a:hover {
    color: var(--eu-blue);
    text-decoration: none;
}

.main-navigation .current-menu-item > a,
.main-navigation .current-page-ancestor > a {
    color: var(--eu-blue);
    font-weight: 600;
}

.header-donate {
    background: var(--eu-gold);
    color: var(--ink) !important;
    padding: 0.35rem 1rem;
    border-radius: var(--radius);
    font-weight: 600 !important;
    font-family: var(--mono) !important;
    font-size: 0.75rem !important;
    white-space: nowrap;
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--eu-blue);
}

/* ── Site Footer ───────────────────────────────────────────── */
.site-footer {
    background: var(--ink);
    color: rgba(255,255,255,0.7);
    padding: 3.5rem 0 2rem;
    margin-top: auto;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 3rem;
    margin-bottom: 2.5rem;
}

.footer-brand {
    font-family: var(--serif);
    font-size: 1.05rem;
    font-weight: 600;
    color: white;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.footer-tagline {
    font-size: 0.85rem;
    line-height: 1.7;
    max-width: 280px;
    opacity: 0.75;
}

.footer-col h4 {
    font-family: var(--mono);
    font-size: 0.65rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.35);
    margin-bottom: 1rem;
}

.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 0.5rem; }
.footer-col a { color: rgba(255,255,255,0.6); font-size: 0.85rem; }
.footer-col a:hover { color: white; text-decoration: none; }

.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--mono);
    font-size: 0.68rem;
    opacity: 0.4;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
    display: inline-block;
    padding: 0.7rem 1.5rem;
    border-radius: var(--radius);
    font-family: var(--mono);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
    border: none;
    text-align: center;
}

.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn-primary { background: var(--eu-blue); color: white; }
.btn-primary:hover { box-shadow: 0 4px 12px rgba(0,51,153,0.3); }
.btn-white { background: white; color: var(--eu-blue); }
.btn-white:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.btn-gold { background: var(--eu-gold); color: var(--ink); font-weight: 600; }
.btn-outline { background: transparent; color: var(--eu-blue); border: 1px solid var(--eu-blue); }

/* ── Section labels ────────────────────────────────────────── */
.section-label {
    font-family: var(--mono);
    font-size: 0.68rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--eu-blue);
    margin-bottom: 0.6rem;
    display: block;
}

/* ── Headings ──────────────────────────────────────────────── */
h1, h2, h3, h4 { font-family: var(--serif); line-height: 1.25; color: var(--ink); }
h1 { font-size: clamp(1.8rem, 4vw, 3rem); font-weight: 300; }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); font-weight: 300; margin-bottom: 1rem; }
h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.5rem; }
h4 { font-size: 0.95rem; font-weight: 600; }

/* ── Terminal / Code blocks ────────────────────────────────── */
.terminal {
    background: #0D1117;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.terminal-bar {
    background: #161B22;
    padding: 0.65rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 1px solid #30363D;
}

.t-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.t-dot:nth-child(1) { background: #FF5F57; }
.t-dot:nth-child(2) { background: #FEBC2E; }
.t-dot:nth-child(3) { background: #28C840; }
.t-title { font-family: var(--mono); font-size: 0.7rem; color: #8B949E; margin: 0 auto; }

.terminal-body {
    padding: 1.25rem 1.5rem;
    font-family: var(--mono);
    font-size: 0.78rem;
    line-height: 1.9;
    color: #C9D1D9;
    overflow-x: auto;
}

.t-comment { color: #8B949E; }
.t-cmd { color: #79C0FF; }
.t-url { color: #FFA657; }
.t-ok { color: #56D364; font-weight: 600; }
.t-prompt { color: #56D364; user-select: none; }

/* Inline code */
code {
    font-family: var(--mono);
    font-size: 0.85em;
    background: var(--eu-blue-pale);
    color: var(--eu-blue);
    padding: 0.1em 0.35em;
    border-radius: 2px;
}

pre {
    background: #0D1117;
    color: #C9D1D9;
    padding: 1.25rem 1.5rem;
    border-radius: 6px;
    overflow-x: auto;
    font-family: var(--mono);
    font-size: 0.82rem;
    line-height: 1.8;
    margin: 1.5rem 0;
}

pre code {
    background: none;
    color: inherit;
    padding: 0;
    font-size: inherit;
}

/* ── Live dot ───────────────────────────────────────────────── */
.live-dot {
    width: 8px;
    height: 8px;
    background: #28C840;
    border-radius: 50%;
    animation: pulse 2s infinite;
    flex-shrink: 0;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.75); }
}

/* ── Tags / Badges ─────────────────────────────────────────── */
.tag {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 2px;
    font-family: var(--mono);
    font-size: 0.65rem;
    letter-spacing: 0.04em;
    font-weight: 500;
}

.tag-live    { background: var(--green-bg); color: var(--green); }
.tag-soon    { background: #FFF8E1; color: #B06000; }
.tag-future  { background: var(--eu-blue-pale); color: var(--eu-blue); }
.tag-new     { background: var(--eu-blue); color: white; }

/* ── Cards ─────────────────────────────────────────────────── */
.card {
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    padding: 1.75rem;
    transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
    background: white;
}

.card:hover {
    border-color: var(--eu-blue-mid);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,51,153,0.08);
}

/* ── Docs layout ────────────────────────────────────────────── */
.docs-layout {
    display: grid;
    grid-template-columns: var(--docs-sidebar) 1fr;
    gap: 0;
    min-height: calc(100vh - var(--header-h));
    align-items: start;
}

.docs-sidebar {
    border-right: 1px solid var(--rule);
    padding: 2rem 1.5rem;
    position: sticky;
    top: var(--header-h);
    max-height: calc(100vh - var(--header-h));
    overflow-y: auto;
    background: var(--eu-blue-pale);
}

.docs-sidebar-title {
    font-family: var(--mono);
    font-size: 0.65rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-light);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--rule);
}

.docs-nav ul { list-style: none; }
.docs-nav li { margin-bottom: 0.15rem; }

.docs-nav a {
    display: block;
    padding: 0.35rem 0.75rem;
    border-radius: 3px;
    color: var(--ink-mid);
    font-size: 0.85rem;
    transition: background 0.15s, color 0.15s;
}

.docs-nav a:hover {
    background: var(--eu-blue-light);
    color: var(--eu-blue);
    text-decoration: none;
}

.docs-nav .current-menu-item > a,
.docs-nav a.active {
    background: var(--eu-blue);
    color: white;
    font-weight: 500;
}

.docs-nav .nav-section {
    font-family: var(--mono);
    font-size: 0.65rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-light);
    padding: 1rem 0.75rem 0.25rem;
}

.docs-content {
    padding: 3rem 3.5rem;
    max-width: 760px;
}

/* Docs typography */
.docs-content h1 { margin-bottom: 0.5rem; }
.docs-content h2 { margin-top: 2.5rem; margin-bottom: 0.75rem; padding-top: 2.5rem; border-top: 1px solid var(--rule); }
.docs-content h2:first-of-type { border-top: none; padding-top: 0; }
.docs-content h3 { margin-top: 1.75rem; margin-bottom: 0.5rem; }
.docs-content p { color: var(--ink-mid); margin-bottom: 1.25rem; }
.docs-content ul, .docs-content ol { color: var(--ink-mid); padding-left: 1.5rem; margin-bottom: 1.25rem; }
.docs-content li { margin-bottom: 0.4rem; }

.docs-breadcrumb {
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--ink-light);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.docs-breadcrumb a { color: var(--eu-blue); }
.docs-breadcrumb span { opacity: 0.4; }

.docs-meta {
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--ink-light);
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--rule);
    display: flex;
    gap: 1.5rem;
}

/* Info / Warning boxes */
.docs-note, .docs-warning, .docs-tip {
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    margin: 1.5rem 0;
    font-size: 0.9rem;
}

.docs-note    { background: var(--eu-blue-pale); border-left: 4px solid var(--eu-blue); }
.docs-warning { background: #FFF8E1; border-left: 4px solid var(--eu-gold); }
.docs-tip     { background: var(--green-bg); border-left: 4px solid var(--green); }

/* Doc prev/next nav */
.docs-pagination {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--rule);
}

.docs-pag-item {
    padding: 1rem 1.25rem;
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    transition: border-color 0.2s;
}

.docs-pag-item:hover { border-color: var(--eu-blue); text-decoration: none; }
.docs-pag-label { font-family: var(--mono); font-size: 0.65rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-light); display: block; margin-bottom: 0.25rem; }
.docs-pag-title { font-size: 0.9rem; color: var(--eu-blue); font-weight: 500; }
.docs-pag-item.next { text-align: right; }

/* ── Blog layout ────────────────────────────────────────────── */
.blog-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 3rem;
    padding: 3rem 0;
}

.post-card {
    border-bottom: 1px solid var(--rule);
    padding-bottom: 2.5rem;
    margin-bottom: 2.5rem;
}

.post-card:last-child { border-bottom: none; }

.post-meta {
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--ink-light);
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.post-category {
    background: var(--eu-blue-pale);
    color: var(--eu-blue);
    padding: 0.15rem 0.5rem;
    border-radius: 2px;
    font-size: 0.65rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.post-card h2 {
    font-size: 1.4rem;
    margin-bottom: 0.75rem;
    border: none;
    padding: 0;
}

.post-card h2 a { color: var(--ink); }
.post-card h2 a:hover { color: var(--eu-blue); text-decoration: none; }

.post-excerpt { color: var(--ink-mid); font-size: 0.95rem; margin-bottom: 1rem; }

.read-more {
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--eu-blue);
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

/* Single post */
.post-header { padding: 3rem 0 2rem; border-bottom: 1px solid var(--rule); margin-bottom: 2.5rem; }
.post-body { max-width: 700px; }
.post-body p { color: var(--ink-mid); margin-bottom: 1.25rem; line-height: 1.8; }
.post-body h2 { margin-top: 2rem; }
.post-body h3 { margin-top: 1.5rem; }
.post-body ul, .post-body ol { color: var(--ink-mid); padding-left: 1.5rem; margin-bottom: 1.25rem; }
.post-body li { margin-bottom: 0.4rem; }

/* Blog sidebar */
.blog-sidebar { padding-top: 0; }
.sidebar-widget { margin-bottom: 2.5rem; }
.sidebar-widget h3 { font-size: 0.85rem; font-family: var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-light); margin-bottom: 1rem; border-bottom: 1px solid var(--rule); padding-bottom: 0.5rem; }
.sidebar-widget ul { list-style: none; }
.sidebar-widget li { padding: 0.4rem 0; border-bottom: 1px solid var(--rule); font-size: 0.88rem; }
.sidebar-widget li:last-child { border-bottom: none; }
.sidebar-widget a { color: var(--ink-mid); }
.sidebar-widget a:hover { color: var(--eu-blue); text-decoration: none; }

/* ── Table of contents ──────────────────────────────────────── */
.toc {
    background: var(--eu-blue-pale);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 2rem;
    font-size: 0.88rem;
}

.toc-title {
    font-family: var(--mono);
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-light);
    margin-bottom: 0.75rem;
}

.toc ul { list-style: none; padding-left: 0; }
.toc li { margin-bottom: 0.3rem; }
.toc a { color: var(--eu-blue); font-size: 0.85rem; }

/* ── Search ─────────────────────────────────────────────────── */
.search-form {
    display: flex;
    gap: 0;
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    overflow: hidden;
}

.search-field {
    flex: 1;
    padding: 0.6rem 1rem;
    border: none;
    font-family: var(--mono);
    font-size: 0.85rem;
    background: white;
    outline: none;
    color: var(--ink);
}

.search-submit {
    background: var(--eu-blue);
    color: white;
    border: none;
    padding: 0.6rem 1rem;
    cursor: pointer;
    font-family: var(--mono);
    font-size: 0.78rem;
}

/* ── Donate block ───────────────────────────────────────────── */
.donate-block {
    background: var(--eu-blue);
    color: white;
    padding: 4rem 0;
    text-align: center;
}

.donate-block h2 { color: white; margin-bottom: 0.75rem; }
.donate-block p { opacity: 0.85; max-width: 520px; margin: 0 auto 2rem; font-size: 1.05rem; }

.donate-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .docs-layout { grid-template-columns: 220px 1fr; }
    .docs-content { padding: 2.5rem 2rem; }
    .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
    body { font-size: 16px; }
    .docs-layout { grid-template-columns: 1fr; }
    .docs-sidebar { position: static; max-height: none; border-right: none; border-bottom: 1px solid var(--rule); }
    .docs-content { padding: 2rem 1.5rem; }
    .blog-layout { grid-template-columns: 1fr; }
    .footer-grid { grid-template-columns: 1fr; gap: 2rem; }
    .footer-bottom { flex-direction: column; text-align: center; }
    .nav-toggle { display: block; }
    .main-navigation { display: none; }
    .main-navigation.open { display: block; position: absolute; top: var(--header-h); left: 0; right: 0; background: white; border-bottom: 2px solid var(--eu-blue); padding: 1rem 2rem; box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
    .main-navigation.open ul { flex-direction: column; gap: 0; }
    .main-navigation.open li { border-bottom: 1px solid var(--rule); }
    .main-navigation.open a { display: block; padding: 0.75rem 0; }
    .container { padding: 0 1.25rem; }
    .docs-pagination { grid-template-columns: 1fr; }
}
