/* ==========================================================================
   GLOBAL.CSS — Collabdays Bletchley-Park-2026
   Impressive, modern, clean — WCAG 2.1 AA compliant
   ========================================================================== */

/* 1. Fonts & Custom Properties
   -------------------------------------------------------------------------- */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Sans+Condensed:wght@600;700&family=IBM+Plex+Mono:wght@400&display=swap');

:root {
    /* Primary color with HSL components */
    --color-primary-hsl: 192, 85%, 41%;
    --color-primary: hsl(var(--color-primary-hsl));
    --color-primary-hover: hsl(192, 85%, 36%); /* Hardcoded darker */

    /* Secondary color with HSL components */
    --color-secondary-hsl: 192, 78%, 15%;
    --color-secondary: hsl(var(--color-secondary-hsl));
    --color-secondary-hover: hsl(192, 78%, 20%); /* Hardcoded darker */

    /* Backgrounds */
    --color-bg: hsl(45, 10%, 98%);
    --color-surface: hsl(0, 0%, 100%);
    --color-surface-alt: hsl(210, 10%, 95%);
    --color-surface-dark: hsl(210, 30%, 12%);

    /* Borders */
    --color-border: hsl(210, 5%, 85%);

    /* Text */
    --color-text: hsl(210, 10%, 20%);
    --color-text-muted: hsl(210, 5%, 40%);
    --color-text-inverse: hsl(0, 0%, 100%);
    --color-text-on-primary: hsl(0, 0%, 100%);
    --color-text-on-secondary: hsl(0, 0%, 100%);
    --color-text-on-surface-dark: hsl(0, 0%, 100%);

    /* Semantic colors */
    --color-success: hsl(120, 60%, 40%);
    --color-error: hsl(0, 70%, 50%);
    --color-overlay: hsla(0, 0%, 0%, 0.8);

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 3rem;
    --space-2xl: 5rem;

    /* Typography */
    --font-heading: 'IBM Plex Sans Condensed', system-ui, sans-serif;
    --font-body: 'IBM Plex Sans', system-ui, sans-serif;
    --font-mono: 'IBM Plex Mono', ui-monospace, monospace;

    --text-display: clamp(2.5rem, 5vw, 4rem);
    --text-h1: clamp(2rem, 4vw, 3rem);
    --text-h2: clamp(1.5rem, 3vw, 2rem);
    --text-h3: clamp(1.125rem, 2vw, 1.5rem);
    --text-body: 1rem;
    --text-small: 0.875rem;

    /* Borders & Shadows */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 16px;
    --radius-full: 9999px;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.16);

    /* Transitions */
    --transition-fast: 0.15s;
    --transition-base: 0.3s;
}

/* 2. Reset
   -------------------------------------------------------------------------- */

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

html {
    scroll-behavior: smooth;
}

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

/* 3. Typography
   -------------------------------------------------------------------------- */

h1, h2, h3, h4 {
    font-family: var(--font-heading);
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: var(--space-md);
    color: var(--color-text);
}

h1 {
    font-size: var(--text-h1);
    font-weight: 700;
}

h2 {
    font-size: var(--text-h2);
}

h3 {
    font-size: var(--text-h3);
}

h4 {
    font-size: 1.125rem;
    font-weight: 600;
}

p {
    margin-bottom: var(--space-md);
    line-height: 1.6;
}

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

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

code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    background-color: var(--color-surface-alt);
    padding: 0.1em 0.3em;
    border-radius: var(--radius-sm);
}

/* 4. Accessibility
   -------------------------------------------------------------------------- */

/* Skip link */
.skip-link {
    position: absolute;
    top: -100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-primary);
    color: var(--color-text-inverse);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    z-index: 9999;
    text-decoration: none;
    font-weight: 600;
    transition: top var(--transition-base) ease;
}

.skip-link:focus {
    top: var(--space-sm);
}

/* Focus styles */
:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

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

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* 5. Layout & GrapesJS Grid
   -------------------------------------------------------------------------- */

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-md);
}

.section {
    padding: var(--space-xl) 0;
}

.section + .section {
    border-top: 1px solid var(--color-border);
}

/* GrapesJS grid - simple gap approach */
.gjs-row {
    display: flex;
    justify-content: flex-start;
    align-items: stretch;
    flex-wrap: wrap;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.gjs-cell {
    min-height: 50px;
    flex-grow: 1;
    flex-basis: 100%;
}

@media (min-width: 768px) {
    .gjs-row {
        flex-wrap: nowrap;
    }
    .gjs-cell {
        flex-basis: 0;
    }
}

/* 6. Components
   -------------------------------------------------------------------------- */

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 var(--space-lg);
    height: 44px;
    border-radius: var(--radius-md);
    font-weight: 600;
    text-align: center;
    transition: all var(--transition-fast) ease;
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--color-primary);
    color: var(--color-text-inverse);
}

.btn-primary:hover {
    background-color: var(--color-primary-hover);
    color: var(--color-text-inverse);
}

.btn-outline {
    background-color: transparent;
    color: var(--color-primary);
    border: 1px solid var(--color-primary);
}

.btn-outline:hover {
    background-color: var(--color-primary-hover);
    color: var(--color-text-inverse);
}

.btn-small {
    height: 36px;
    padding: 0 var(--space-md);
    font-size: 0.875rem;
}

/* Cards */
.card {
    background-color: var(--color-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: var(--space-lg);
    transition: transform var(--transition-fast) ease, box-shadow var(--transition-fast) ease;
}

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

/* Inputs */
input,
textarea,
select {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    height: 44px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: var(--text-body);
    transition: border-color var(--transition-fast) ease;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px hsla(var(--color-primary-hsl), 0.2);
}

textarea {
    min-height: 120px;
    resize: vertical;
}

label {
    display: block;
    margin-bottom: var(--space-xs);
    font-weight: 500;
}

/* 7. Utilities
   -------------------------------------------------------------------------- */

/* Text alignment */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* Text colors */
.text-primary { color: var(--color-primary); }
.text-muted { color: var(--color-text-muted); }

/* Spacing */
.mt-xs { margin-top: var(--space-xs); }
.mb-xs { margin-bottom: var(--space-xs); }
.mt-sm { margin-top: var(--space-sm); }
.mb-sm { margin-bottom: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mb-md { margin-bottom: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-lg { margin-bottom: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mb-xl { margin-bottom: var(--space-xl); }
.mt-2xl { margin-top: var(--space-2xl); }
.mb-2xl { margin-bottom: var(--space-2xl); }

/* Section color utilities */
.section-primary {
    background-color: var(--color-primary);
    color: var(--color-text-on-primary);
}

.section-primary h1,
.section-primary h2,
.section-primary h3,
.section-primary h4,
.section-primary p,
.section-primary span,
.section-primary li {
    color: inherit;
}

.section-primary a:not(.btn) {
    color: inherit;
    text-decoration: underline;
}

.section-primary .btn-primary {
    background-color: var(--color-text-on-primary);
    color: var(--color-primary);
}

.section-primary .btn-outline {
    border-color: var(--color-text-on-primary);
    color: var(--color-text-on-primary);
}

.section-primary .btn-outline:hover {
    background-color: var(--color-text-on-primary);
    color: var(--color-primary);
}

.section-secondary {
    background-color: var(--color-secondary);
    color: var(--color-text-on-secondary);
}

.section-secondary h1,
.section-secondary h2,
.section-secondary h3,
.section-secondary h4,
.section-secondary p,
.section-secondary span,
.section-secondary li {
    color: inherit;
}

.section-secondary a:not(.btn) {
    color: inherit;
    text-decoration: underline;
}

.section-secondary .btn-primary {
    background-color: var(--color-text-on-secondary);
    color: var(--color-secondary);
}

.section-dark {
    background-color: var(--color-surface-dark);
    color: var(--color-text-on-surface-dark);
}

.section-dark h1,
.section-dark h2,
.section-dark h3,
.section-dark h4,
.section-dark p,
.section-dark span,
.section-dark li {
    color: inherit;
}

.section-dark a:not(.btn) {
    color: inherit;
    text-decoration: underline;
}

.section-dark .btn-primary {
    background-color: var(--color-text-on-surface-dark);
    color: var(--color-surface-dark);
}

.section-dark .btn-outline {
    border-color: var(--color-text-on-surface-dark);
    color: var(--color-text-on-surface-dark);
}

.section-dark .btn-outline:hover {
    background-color: var(--color-text-on-surface-dark);
    color: var(--color-surface-dark);
}

.section-light {
    background-color: var(--color-surface-alt);
    color: var(--color-text);
}

/* 8. Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1023px) {
    .container {
        padding: 0 var(--space-sm);
    }

    .section {
        padding: var(--space-lg) 0;
    }
}

@media (max-width: 767px) {
    .container {
        padding: 0 var(--space-xs);
    }

    .section {
        padding: var(--space-md) 0;
    }

    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    .btn {
        width: 100%;
    }
}