:root {
    /* Light mode colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-container: #fefefe;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --shadow-light: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-medium: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --accent-color: #2d50b2;
    --accent-hover: #3bf3f6;
}

/* Dark mode colors */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #111827;
        --bg-secondary: #1f2937;
        --bg-container: #1f2937;
        --text-primary: #f9fafb;
        --text-secondary: #d1d5db;
        --border-color: #374151;
        --shadow-light: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 1px 2px 0 rgba(0, 0, 0, 0.2);
        --shadow-medium: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
        --accent-color: #3bf3f6;
        --accent-hover: #2d50b2;
    }
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Typography */
h1 {
    font-size: clamp(1.75rem, 2.5vw, 2.25rem);
    line-height: 1.2;
    margin-bottom: 1.75rem;
}

h2 {
    font-size: clamp(1.25rem, 2vw, 1.5rem);
    line-height: 1.3;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

h3 {
    font-size: clamp(1.125rem, 1.8vw, 1.25rem);
    line-height: 1.35;
    margin-top: 0.75rem;
    margin-bottom: 0.5rem;
}

p {
    margin-top: 0.75rem;
}

/* Let heading margins control spacing to avoid margin-collapsing surprises */
h1 + p,
h2 + p,
h3 + p {
    margin-top: 0;
}

ul, ol {
    margin-top: 0.75rem;
    padding-left: 1.25rem;
}

li + li {
    margin-top: 0.25rem;
}

/* Global link styles */
a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 700;
}

/* Header Styles */
header {
    background-color: var(--bg-container);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-light);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: all 0.3s ease;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    
    height: 4rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

/* Navigation */
nav ul {
    display: flex;
    list-style: none;
    gap: 2rem;
    padding-bottom: 0.7rem;
    align-items: baseline; /* vertically center items in the nav bar */
    
}

nav li {
    display: flex;
    align-items: baseline;
    
}

nav a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 700;
    transition: color 0.3s ease;
    padding: 0;                         /* avoid vertical padding skew */
    display: inline-flex;            /* ensure consistent baseline handling */
    align-items: center;             /* vertically center link text */
    line-height: 1;                  /* normalize text metrics */
}

nav a:hover {
    color: var(--accent-color);
}

/* Mobile menu toggle */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-primary);
    cursor: pointer;
}

/* Main Content */
main {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
    width: 100%;
}

.grid-two {
    display: grid;
    grid-template-columns: 1fr;
    
}

.container {
    background-color: var(--bg-container);
    border-radius: 0.75rem;
    box-shadow: var(--shadow-medium);
    padding: 2rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}

/* Increase spacing between sections inside containers */
.container section + section {
    margin-top: 2rem;
}

/* Improve spacing between text and following button */
.container p + p {
    margin-top: 1rem;
}

/* Buttons */
.button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    border-radius: 9999px;
    border: 1px solid var(--border-color);
    background: linear-gradient(180deg, rgba(255,255,255,0.9), rgba(255,255,255,0.7));
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease;
    box-shadow: var(--shadow-light);
    will-change: transform;
}

@media (prefers-color-scheme: dark) {
    .button {
        background: linear-gradient(180deg, rgba(31,41,55,0.9), rgba(17,24,39,0.9));
    }

    /* Dark mode: adjust icon strokes to dark accent color */
    a[href^="mailto:"]::before {
        background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%233bf3f6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M4 4h16v16H4z'/><path d='M22 6l-10 7L2 6'/></svg>");
    }

    a[href^="tel:"]::before {
        background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%233bf3f6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M22 16.92v3a2 2 0 0 1-2.18 2 19.8 19.8 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6A19.8 19.8 0 0 1 2.1 4.18 2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72c.12.89.3 1.76.54 2.6a2 2 0 0 1-.45 1.95L8.09 9.91a16 16 0 0 0 6 6l1.64-1.14a2 2 0 0 1 1.95-.24c.84 .24 1.71 .42 2.6 .54A2 2 0 0 1 22 16.92z'/></svg>");
    }
}

.button:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-medium);
}

.button:active {
    transform: translateY(0);
    box-shadow: var(--shadow-light);
}

.button-accent {
    border-color: transparent;
    background: linear-gradient(180deg, var(--accent-color), var(--accent-hover));
    color: #ffffff;
}

.button-accent:hover {
    filter: brightness(1.05);
}

.button .icon {
    width: 1.1rem;
    height: 1.1rem;
    display: inline-block;
    transition: transform 0.2s ease;
}

.button:hover .icon {
    transform: translateX(2px);
}

/* Iconified contact links without external assets */
a[href^="mailto:"]::before,
a[href^="tel:"]::before {
    content: "";
    display: inline-block;
    width: 1.1em;
    height: 1.1em;
    margin-right: 0.5rem;
    vertical-align: -0.125em;
    background-repeat: no-repeat;
    background-position: center;
    background-size: 100% 100%;
    background-color: var(--bg-container);
    border-radius: 0.25rem;
}

/* Email icon */
a[href^="mailto:"]::before {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%232d50b2' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M4 4h16v16H4z'/><path d='M22 6l-10 7L2 6'/></svg>");
}

/* Phone icon */
a[href^="tel:"]::before {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%232d50b2' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M22 16.92v3a2 2 0 0 1-2.18 2 19.8 19.8 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6A19.8 19.8 0 0 1 2.1 4.18 2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72c.12.89.3 1.76.54 2.6a2 2 0 0 1-.45 1.95L8.09 9.91a16 16 0 0 0 6 6l1.64-1.14a2 2 0 0 1 1.95-.24c.84 .24 1.71 .42 2.6 .54A2 2 0 0 1 22 16.92z'/></svg>");
}

/* Dark-mode overrides placed AFTER base icons to win the cascade */
@media (prefers-color-scheme: dark) {
    a[href^="mailto:"]::before {
        background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%233bf3f6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M4 4h16v16H4z'/><path d='M22 6l-10 7L2 6'/></svg>");
    }
    a[href^="tel:"]::before {
        background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%233bf3f6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M22 16.92v3a2 2 0 0 1-2.18 2 19.8 19.8 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6A19.8 19.8 0 0 1 2.1 4.18 2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72c.12.89.3 1.76.54 2.6a2 2 0 0 1-.45 1.95L8.09 9.91a16 16 0 0 0 6 6l1.64-1.14a2 2 0 0 1 1.95-.24c.84 .24 1.71 .42 2.6 .54A2 2 0 0 1 22 16.92z'/></svg>");
    }
}

/* Footer */
footer {
    background-color: var(--bg-container);
    border-top: 1px solid var(--border-color);
    box-shadow: var(--shadow-light);
    margin-top: auto;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    /* Mobile header - smaller and collapsible */
    .header-container {
        height: 3rem;
        padding: 0 1rem;
    }

    .logo {
        font-size: 1.25rem;
    }

    .menu-toggle {
        display: block;
    }

    nav {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: var(--bg-container);
        border-top: 1px solid var(--border-color);
        box-shadow: var(--shadow-medium);
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }

    nav.active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }

    nav ul {
        flex-direction: column;
        gap: 0;
        padding: 1rem;
        align-items: flex-end; /* Right-align the list items */
    }

    nav a {
        display: block;
        padding: 0.75rem 0;
        border-bottom: 1px solid var(--border-color);
        text-align: left; /* Keep text left-aligned within each item */
        min-width: 120px; /* Ensure consistent width for easier tapping */
    }

    nav a:last-child {
        border-bottom: none;
    }

    /* Auto-hide header on scroll down (mobile only) */
    header.hidden {
        transform: translateY(-100%);
    }

    /* Mobile main content */
    main {
        padding: 1rem;
    }

    .container {
        padding: 1.5rem;
        border-radius: 0.5rem;
    }

    /* Mobile course cards - show only buttons on smartphones */
    .courses-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        margin: 1rem 0;
    }

    .course-card {
        padding: 0;
        background: none;
        border: none;
        box-shadow: none;
        gap: 0;
    }

    .course-card h3,
    .course-card p {
        display: none;
    }

    .course-card .button {
        width: 100%;
        justify-content: center;
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }

    .course-card .button span {
        font-weight: 600;
    }

    /* Hide the arrow icon on mobile to save space */
    .course-card .button .icon {
        display: none;
    }

    /* Mobile: Show course name text, hide "Access Course" */
    .course-card .button .desktop-text {
        display: none;
    }

    .course-card .button .mobile-text {
        display: inline;
    }

     /* Mobile footer - smaller and collapsible */
    footer {
        transition: all 0.3s ease;
    }

    footer.hidden {
        transform: translateY(100%);
    }

    .footer-container {
        padding: 0.75rem;
        font-size: 0.75rem;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    /* Tablet styles */
    .header-container {
        padding: 0 1.5rem;
    }

    main {
        padding: 1.5rem;
    }
}

@media (min-width: 1025px) {
    .grid-two {
        grid-template-columns: 1fr 1fr;
        gap: 0rem 2rem; /* row-gap column-gap: smaller vertical, larger horizontal */
    }
}

/* Desktop-only tweaks */
@media (min-width: 769px) {
    nav a {
        height: 4rem; /* match header container height for vertical centering */
    }
}

/* Utility classes */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Course cards grid for teaching portal */
.courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
    padding: 0 1rem;
}

.course-card {
    background-color: var(--bg-container);
    border-radius: 0.75rem;
    box-shadow: var(--shadow-medium);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Course-specific background colors - very light */
.course-card:nth-child(1) {
    background-color: #f8f0fa; /* Very light purple */
}

.course-card:nth-child(2) {
    background-color: #f5f5f5; /* Very light gray */
}

.course-card:nth-child(3) {
    background-color: #fef8f8; /* Very light red */
}

.course-card:nth-child(4) {
    background-color: #f8fbff; /* Very light blue  */
}

.course-card:nth-child(5) {
    background-color: #fef8f8; /* Very light red */
}

.course-card:nth-child(6) {
    background-color: #fef8f8; /* Very light red */
}

/* WPV courses - very light gray */
.courses-grid:nth-of-type(2) .course-card {
    background-color: #f5f5f5; /* Very light gray */
}

/* Dark mode course card colors */
@media (prefers-color-scheme: dark) {
    .course-card:nth-child(1) {
        background-color: #1a1a1a; /* Very dark red tint */
    }

    .course-card:nth-child(2) {
        background-color: #1a1a1a; /* Very dark purple tint */
    }

    .course-card:nth-child(3),
    .course-card:nth-child(4),
    .course-card:nth-child(5),
    .course-card:nth-child(6) {
        background-color: #1a1a1a; /* Very dark blue tint for IBW courses */
    }

    .courses-grid:nth-of-type(2) .course-card {
        background-color: #1a1a1a; /* Very dark gray tint */
    }
}

.course-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.course-card h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent-color);
    margin: 0;
    line-height: 1.2;
}

.course-card p {
    color: var(--text-secondary);
    margin: 0;
    flex-grow: 1;
    line-height: 1.4;
}

.course-card .button {
    margin-top: auto;
    justify-self: flex-end;
}

/* Default mobile styles - show course name, hide "Access Course" */
.course-card .button .desktop-text {
    display: none;
}

.course-card .button .mobile-text {
    display: inline;
}

/* Desktop: Show "Access Course" text, hide course name */
@media (min-width: 769px) {
    .course-card .button .desktop-text {
        display: inline;
    }

    .course-card .button .mobile-text {
        display: none;
    }
}

/* Impressum-specific heading numbering - simplified approach */
.impressum {
    counter-reset: h2-counter;
}

.impressum h2 {
    counter-increment: h2-counter;
    counter-reset: h3-counter;
}

.impressum h2::before {
    content: counter(h2-counter) ". ";
    color: var(--text-primary);
    font-weight: 700;
}

.impressum h3 {
    counter-increment: h3-counter;
}

.impressum h3::before {
    content: counter(h2-counter) "." counter(h3-counter) " ";
    color: var(--text-primary);
    font-weight: 700;
}

