/**
 * NEXA CMS – Frontend CSS
 * Public-facing website styles
 * GrischaMedia | https://grischamedia.ch
 */

/* ============================================================
   CSS CUSTOM PROPERTIES – GrischaMedia Dark Palette
   ============================================================ */
:root {
    --bg:           #14161a;
    --surface:      #1d2026;
    --surface2:     #252830;
    --border:       #2a2d35;
    --text:         #e4e4e7;
    --muted:        #71717a;
    --gold:         #b5924c;
    --gold-light:   #cead75;
    --gold-dim:     rgba(181, 146, 76, 0.15);
    --gold-glow:    rgba(181, 146, 76, 0.25);

    --radius-sm:    4px;
    --radius:       8px;
    --radius-lg:    12px;

    --sidebar-w:    250px;
    --content-max:  820px;
    --container-max: 1400px;

    --transition:   0.2s ease;
    --transition-md: 0.3s ease;

    --font:         'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono:    'Fira Code', 'Cascadia Code', 'Consolas', monospace;

    --shadow:       0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-md:    0 4px 16px rgba(0, 0, 0, 0.5);
    --shadow-lg:    0 8px 32px rgba(0, 0, 0, 0.6);
}

/* ============================================================
   MODERN RESET
   ============================================================ */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    tab-size: 4;
}

body {
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.7;
    color: var(--text);
    background-color: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img,
video,
svg {
    display: block;
    max-width: 100%;
    height: auto;
}

a {
    color: var(--gold-light);
    text-decoration: none;
    transition: color var(--transition);
}

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

ul,
ol {
    list-style: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

table {
    border-collapse: collapse;
    width: 100%;
}

hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 2rem 0;
}

/* ============================================================
   CONTAINER UTILITY
   ============================================================ */
.container {
    width: 100%;
    max-width: var(--container-max);
    margin-inline: auto;
    padding-inline: 1.5rem;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.4rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface2);
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
    text-decoration: none;
}

.btn:hover {
    background: var(--surface);
    border-color: var(--muted);
    color: var(--text);
}

.btn-primary {
    background: var(--gold);
    border-color: var(--gold);
    color: #0e0e0e;
    font-weight: 600;
}

.btn-primary:hover {
    background: var(--gold-light);
    border-color: var(--gold-light);
    color: #0e0e0e;
}

/* ============================================================
   SITE HEADER
   ============================================================ */
.nexa-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(20, 22, 26, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    transition: box-shadow var(--transition-md);
}

.nexa-header.scrolled {
    box-shadow: var(--shadow-md);
}

.nexa-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    padding-inline: 1.5rem;
    max-width: var(--container-max);
    margin-inline: auto;
}

/* Logo */
.nexa-header__logo {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    text-decoration: none;
}

.nexa-header__logo img {
    max-height: 36px;
    width: auto;
}

.nexa-header__logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
    transition: color var(--transition);
}

.nexa-header__logo-text span {
    color: var(--gold);
}

.nexa-header__logo:hover .nexa-header__logo-text {
    color: var(--gold-light);
}

/* ============================================================
   MAIN NAVIGATION
   ============================================================ */
.nexa-nav {
    display: flex;
    align-items: center;
}

.nexa-nav__list {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    list-style: none;
}

.nexa-nav__item {
    position: relative;
}

.nexa-nav__link {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 0.875rem;
    font-size: 0.925rem;
    font-weight: 500;
    color: var(--muted);
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: color var(--transition), background var(--transition);
    white-space: nowrap;
    position: relative;
}

.nexa-nav__link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    right: 50%;
    height: 2px;
    background: var(--gold);
    border-radius: 2px;
    transition: left var(--transition-md), right var(--transition-md);
}

.nexa-nav__link:hover {
    color: var(--text);
    background: var(--gold-dim);
}

.nexa-nav__link:hover::after,
.nexa-nav__link.active::after {
    left: 0.875rem;
    right: 0.875rem;
}

.nexa-nav__link.active {
    color: var(--gold-light);
    background: var(--gold-dim);
}

/* ============================================================
   HAMBURGER BUTTON
   ============================================================ */
.nexa-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    padding: 0;
    transition: border-color var(--transition), background var(--transition);
}

.nexa-hamburger:hover {
    background: var(--surface2);
    border-color: var(--muted);
}

.nexa-hamburger__line {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: transform var(--transition-md), opacity var(--transition-md);
    transform-origin: center;
}

.nexa-hamburger.is-open .nexa-hamburger__line:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.nexa-hamburger.is-open .nexa-hamburger__line:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.nexa-hamburger.is-open .nexa-hamburger__line:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ============================================================
   MOBILE MENU
   ============================================================ */
.nexa-mobile-menu {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99;
    pointer-events: none;
}

.nexa-mobile-menu__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    opacity: 0;
    transition: opacity var(--transition-md);
}

.nexa-mobile-menu__panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(320px, 85vw);
    background: var(--surface);
    border-left: 1px solid var(--border);
    transform: translateX(100%);
    transition: transform var(--transition-md);
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nexa-mobile-menu__close {
    align-self: flex-end;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--muted);
    font-size: 1.25rem;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-bottom: 1rem;
    transition: color var(--transition), border-color var(--transition);
}

.nexa-mobile-menu__close:hover {
    color: var(--text);
    border-color: var(--muted);
}

.nexa-mobile-menu__nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.nexa-mobile-menu__link {
    display: block;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    color: var(--muted);
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: color var(--transition), background var(--transition), border-color var(--transition);
}

.nexa-mobile-menu__link:hover {
    color: var(--text);
    background: var(--surface2);
    border-left-color: var(--gold);
}

.nexa-mobile-menu__link.active {
    color: var(--gold-light);
    background: var(--gold-dim);
    border-left-color: var(--gold);
}

.nexa-mobile-menu.is-open {
    display: block;
    pointer-events: all;
}

.nexa-mobile-menu.is-open .nexa-mobile-menu__overlay {
    opacity: 1;
}

.nexa-mobile-menu.is-open .nexa-mobile-menu__panel {
    transform: translateX(0);
}

/* ============================================================
   PAGE TITLE / BREADCRUMBS AREA
   ============================================================ */
.nexa-page-title-area {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 1.5rem 0;
}

.nexa-page-title-area__inner {
    max-width: var(--container-max);
    margin-inline: auto;
    padding-inline: 1.5rem;
}

.nexa-page-title-area__heading {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin-bottom: 0.5rem;
}

.nexa-breadcrumbs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    font-size: 0.85rem;
    color: var(--muted);
}

.nexa-breadcrumbs a {
    color: var(--muted);
    text-decoration: none;
    transition: color var(--transition);
}

.nexa-breadcrumbs a:hover {
    color: var(--gold-light);
}

.nexa-breadcrumbs__sep {
    color: var(--border);
}

.nexa-breadcrumbs__current {
    color: var(--gold-light);
}

/* ============================================================
   MAIN LAYOUT – 3-COLUMN GRID
   ============================================================ */
.nexa-main {
    max-width: var(--container-max);
    margin-inline: auto;
    padding-inline: 1.5rem;
    padding-top: 2rem;
    padding-bottom: 3rem;
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr var(--sidebar-w);
    grid-template-areas: "sidebar-left content sidebar-right";
    gap: 2rem;
    align-items: start;
}

/* Full-width (no sidebars) */
.nexa-main--no-sidebars {
    grid-template-columns: 1fr;
    grid-template-areas: "content";
}

/* Left sidebar only */
.nexa-main--left-only {
    grid-template-columns: var(--sidebar-w) 1fr;
    grid-template-areas: "sidebar-left content";
}

/* Right sidebar only */
.nexa-main--right-only {
    grid-template-columns: 1fr var(--sidebar-w);
    grid-template-areas: "content sidebar-right";
}

/* ============================================================
   CONTENT AREA
   ============================================================ */
.nexa-content {
    grid-area: content;
    min-width: 0;
}

/* Typography inside content */
.nexa-content h1,
.nexa-content h2,
.nexa-content h3,
.nexa-content h4,
.nexa-content h5,
.nexa-content h6 {
    color: var(--text);
    line-height: 1.3;
    letter-spacing: -0.01em;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.nexa-content h1 { font-size: 2rem; font-weight: 700; margin-top: 0; }
.nexa-content h2 { font-size: 1.5rem; }
.nexa-content h3 { font-size: 1.25rem; }
.nexa-content h4 { font-size: 1.1rem; }
.nexa-content h5 { font-size: 1rem; }
.nexa-content h6 { font-size: 0.9rem; color: var(--muted); }

.nexa-content p {
    margin-bottom: 1.25rem;
    color: var(--text);
}

.nexa-content a {
    color: var(--gold-light);
    text-decoration: underline;
    text-decoration-color: transparent;
    text-underline-offset: 3px;
    transition: color var(--transition), text-decoration-color var(--transition);
}

.nexa-content a:hover {
    color: var(--gold);
    text-decoration-color: var(--gold);
}

.nexa-content ul,
.nexa-content ol {
    margin-bottom: 1.25rem;
    padding-left: 1.5rem;
}

.nexa-content ul {
    list-style: disc;
}

.nexa-content ol {
    list-style: decimal;
}

.nexa-content li {
    margin-bottom: 0.4rem;
    color: var(--text);
}

.nexa-content li::marker {
    color: var(--gold);
}

.nexa-content blockquote {
    border-left: 4px solid var(--gold);
    margin: 1.5rem 0;
    padding: 1rem 1.25rem;
    background: var(--surface);
    border-radius: 0 var(--radius) var(--radius) 0;
    color: var(--muted);
    font-style: italic;
}

.nexa-content blockquote p {
    margin-bottom: 0;
    color: inherit;
}

.nexa-content code {
    font-family: var(--font-mono);
    font-size: 0.875em;
    background: var(--surface2);
    color: var(--gold-light);
    padding: 0.2em 0.45em;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.nexa-content pre {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    overflow-x: auto;
    margin: 1.5rem 0;
    font-size: 0.9rem;
    line-height: 1.6;
}

.nexa-content pre code {
    background: transparent;
    border: none;
    padding: 0;
    color: var(--text);
    font-size: inherit;
}

.nexa-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.9rem;
}

.nexa-content table thead {
    background: var(--surface2);
}

.nexa-content table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
}

.nexa-content table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

.nexa-content table tr:hover td {
    background: var(--surface);
}

.nexa-content img {
    border-radius: var(--radius);
    max-width: 100%;
    height: auto;
    margin: 1rem 0;
}

.nexa-content hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 2rem 0;
}

/* External link icon */
.nexa-content a[target="_blank"]::after {
    content: ' ↗';
    font-size: 0.75em;
    opacity: 0.6;
    vertical-align: super;
}

/* ============================================================
   SIDEBARS
   ============================================================ */
.nexa-sidebar-left {
    grid-area: sidebar-left;
    min-width: 0;
}

.nexa-sidebar-right {
    grid-area: sidebar-right;
    min-width: 0;
}

/* Sidebar navigation */
.nexa-sidebar-nav {
    margin-top: 1rem;
}

.nexa-sidebar-nav__title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin-bottom: 0.5rem;
    padding: 0 0.75rem;
}

.nexa-sidebar-nav__list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nexa-sidebar-nav__link {
    display: block;
    padding: 0.5rem 0.75rem;
    color: var(--muted);
    font-size: 0.9rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: color var(--transition), background var(--transition), border-color var(--transition);
}

.nexa-sidebar-nav__link:hover {
    color: var(--text);
    background: var(--surface2);
    border-left-color: var(--gold);
}

.nexa-sidebar-nav__link.active {
    color: var(--gold-light);
    background: var(--gold-dim);
    border-left-color: var(--gold);
    font-weight: 500;
}

/* ============================================================
   SIDEBAR BOXES
   ============================================================ */
.nexa-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 1.25rem;
    transition: border-color var(--transition);
}

.nexa-box:hover {
    border-color: rgba(181, 146, 76, 0.3);
}

.nexa-box__title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
    letter-spacing: 0.02em;
    border-bottom: 1px solid var(--border);
    border-left: 3px solid var(--gold);
    background: var(--surface2);
}

.nexa-box__content {
    padding: 1rem;
    font-size: 0.9rem;
    color: var(--muted);
    line-height: 1.6;
}

.nexa-box__content a {
    color: var(--gold-light);
}

.nexa-box__content a:hover {
    color: var(--gold);
}

.nexa-box__content p:last-child {
    margin-bottom: 0;
}

/* ============================================================
   FOOTER
   ============================================================ */
.nexa-footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    margin-top: auto;
}

.nexa-footer__main {
    max-width: var(--container-max);
    margin-inline: auto;
    padding: 3rem 1.5rem 2rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
}

.nexa-footer__col-title {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--gold);
    margin-bottom: 1rem;
}

.nexa-footer__nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nexa-footer__nav-link {
    font-size: 0.9rem;
    color: var(--muted);
    text-decoration: none;
    transition: color var(--transition);
}

.nexa-footer__nav-link:hover {
    color: var(--gold-light);
}

.nexa-footer__bottom {
    border-top: 1px solid var(--border);
    max-width: var(--container-max);
    margin-inline: auto;
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--muted);
}

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

.nexa-footer__credit {
    color: var(--border);
    font-size: 0.75rem;
    transition: color var(--transition);
}

.nexa-footer__credit:hover {
    color: var(--muted);
}

.nexa-footer__credit a {
    color: inherit;
    text-decoration: none;
}

.nexa-footer__credit a:hover {
    color: var(--gold-light);
}

/* ============================================================
   ERROR STATES
   ============================================================ */
.cms-error {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius);
    color: #f87171;
    font-size: 0.9rem;
}

/* ============================================================
   RESPONSIVE – 1200px: Reduce sidebar width
   ============================================================ */
@media (max-width: 1200px) {
    :root {
        --sidebar-w: 220px;
    }
}

/* ============================================================
   RESPONSIVE – 1024px: Hide sidebars, single column
   ============================================================ */
@media (max-width: 1024px) {
    .nexa-main {
        grid-template-columns: 1fr;
        grid-template-areas:
            "content"
            "sidebar-left"
            "sidebar-right";
        gap: 1.5rem;
    }

    .nexa-main--left-only,
    .nexa-main--right-only,
    .nexa-main--no-sidebars {
        grid-template-columns: 1fr;
        grid-template-areas: "content";
    }

    .nexa-sidebar-left,
    .nexa-sidebar-right {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 1rem;
    }

    .nexa-box {
        margin-bottom: 0;
    }
}

/* ============================================================
   RESPONSIVE – 768px: Mobile header and stacked layout
   ============================================================ */
@media (max-width: 768px) {
    .nexa-nav {
        display: none;
    }

    .nexa-hamburger {
        display: flex;
    }

    .nexa-main {
        padding-inline: 1rem;
        padding-top: 1.5rem;
        padding-bottom: 2rem;
        gap: 1.25rem;
    }

    .nexa-sidebar-left,
    .nexa-sidebar-right {
        grid-template-columns: 1fr;
    }

    .nexa-page-title-area__heading {
        font-size: 1.4rem;
    }

    .nexa-footer__main {
        padding: 2rem 1rem 1.5rem;
        grid-template-columns: 1fr 1fr;
    }

    .nexa-footer__bottom {
        flex-direction: column;
        align-items: flex-start;
        padding: 1rem;
    }

    .nexa-content h1 { font-size: 1.6rem; }
    .nexa-content h2 { font-size: 1.3rem; }
    .nexa-content h3 { font-size: 1.1rem; }

    .container {
        padding-inline: 1rem;
    }
}

/* ============================================================
   RESPONSIVE – 480px: Small phones
   ============================================================ */
@media (max-width: 480px) {
    .nexa-footer__main {
        grid-template-columns: 1fr;
    }

    .nexa-header__inner {
        padding-inline: 1rem;
    }
}

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
    .nexa-header,
    .nexa-sidebar-left,
    .nexa-sidebar-right,
    .nexa-footer,
    .nexa-hamburger,
    .nexa-mobile-menu {
        display: none !important;
    }

    .nexa-main {
        display: block;
        padding: 0;
    }

    body {
        background: white;
        color: black;
    }

    .nexa-content a {
        color: black;
        text-decoration: underline;
    }
}

/* ============================================================
   SCROLL-TO-TOP / MISC UTILITIES
   ============================================================ */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.text-muted { color: var(--muted); }
.text-gold  { color: var(--gold); }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
