/* ===== Font Faces (per Ogma Brand v1.0) ===== */

/* Iosevka SS17 — headings, UI, buttons, brand name */
@font-face {
    font-family: 'Iosevka SS17';
    font-weight: 500;
    font-display: swap;
    src: url('fonts/IosevkaSS17-Medium.woff2') format('woff2');
}
@font-face {
    font-family: 'Iosevka SS17';
    font-weight: 400;
    font-display: swap;
    src: url('fonts/IosevkaSS17-Regular.woff2') format('woff2');
}
@font-face {
    font-family: 'Iosevka SS17';
    font-weight: 100;
    font-display: swap;
    src: url('fonts/IosevkaSS17-Thin.woff2') format('woff2');
}

/* Iosevka Etoile — body text, taglines, editorial */
@font-face {
    font-family: 'Iosevka Etoile';
    font-weight: 500;
    font-display: swap;
    src: url('fonts/IosevkaEtoile-Medium.woff2') format('woff2');
}
@font-face {
    font-family: 'Iosevka Etoile';
    font-weight: 300;
    font-display: swap;
    src: url('fonts/IosevkaEtoile-Light.woff2') format('woff2');
}
@font-face {
    font-family: 'Iosevka Etoile';
    font-weight: 200;
    font-display: swap;
    src: url('fonts/IosevkaEtoile-ExtraLight.woff2') format('woff2');
}

/* ===== OgIntel Theme System ===== */

/* --- Light Theme (default) — Ogma Brand v1.0 --- */
:root, [data-theme="light"] {
    /* Blue ramp */
    --blue-900: #042C53;
    --blue-800: #0C447C;
    --blue-700: #185FA5;
    --blue-600: #2874C0;
    --blue-500: #378ADD;
    --blue-400: #5AABEF;
    --blue-300: #85B7EB;
    --blue-200: #B5D4F4;
    --blue-100: #E6F1FB;

    /* Surfaces */
    --bg-primary: #FFFFFF;
    --bg-secondary: #F5F4F0;
    --bg-tertiary: #EEEDEA;
    --bg-card: #FFFFFF;

    /* Text */
    --text-primary: #1A1A1A;
    --text-secondary: #73726C;
    --text-muted: #9C9A92;

    /* Accent (blue-500 primary) */
    --accent: #378ADD;
    --accent-hover: #185FA5;
    --accent-light: #E6F1FB;
    --accent-subtle: #B5D4F4;

    /* Borders */
    --border: #D8D7D3;
    --border-light: #E5E4E0;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.1);

    /* Header / Footer */
    --header-bg: rgba(255,255,255,0.92);
    --footer-bg: #042C53;
    --footer-text: #B5D4F4;
    --footer-heading: #FFFFFF;

    /* Semantic */
    --success: #1D9E75;
    --error: #E24B4A;
    --warning: #BA7517;
    --info: #378ADD;
    --focus-ring: 0 0 0 3px rgba(55,138,221,0.3);

    /* Radii & transitions */
    --radius: 8px;
    --radius-lg: 12px;
    --transition: 0.25s cubic-bezier(0.4,0,0.2,1);
}

/* --- Dark Theme — Ogma Brand v1.0 --- */
[data-theme="dark"] {
    /* Surfaces */
    --bg-primary: #1A1A1A;
    --bg-secondary: #222222;
    --bg-tertiary: #2A2A2A;
    --bg-card: #222222;

    /* Text */
    --text-primary: #F0EFE8;
    --text-secondary: #9C9A92;
    --text-muted: #73726C;

    /* Accent (blue-400 for dark) */
    --accent: #5AABEF;
    --accent-hover: #85B7EB;
    --accent-light: #1A2A3A;
    --accent-subtle: #1E3448;

    /* Borders */
    --border: #333333;
    --border-light: #2A2A2A;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.4);

    /* Header / Footer */
    --header-bg: rgba(26,26,26,0.95);
    --footer-bg: #111111;
    --footer-text: #9C9A92;
    --footer-heading: #F0EFE8;

    /* Semantic */
    --success: #1D9E75;
    --error: #E24B4A;
    --warning: #BA7517;
    --focus-ring: 0 0 0 3px rgba(90,171,239,0.3);
}

/* ===== Base ===== */
*, *::before, *::after { box-sizing: border-box; }

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Iosevka Etoile', Georgia, serif;
    font-weight: 300;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    margin: 0;
    transition: background var(--transition), color var(--transition);
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition);
}
a:hover { color: var(--accent-hover); }

h1, h2, h3, h4, h5, h6 {
    font-family: 'Iosevka SS17', sans-serif;
    color: var(--text-primary);
    line-height: 1.3;
    margin-top: 0;
}

h1 { font-size: 2.5rem; font-weight: 500; }
h2 { font-size: 2rem; font-weight: 500; }
h3 { font-size: 1.5rem; font-weight: 500; }
h4 { font-size: 1.125rem; font-weight: 500; }

p { color: var(--text-secondary); margin-top: 0; }

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

/* ===== Layout ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.site-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.site-main {
    flex: 1;
}

/* ===== Header ===== */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--header-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.site-logo {
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}
.site-logo img { display: block; }

/* Split-logo layout: image left, (wordmark / tagline stacked) right.
   Heights are proportional to the original 580×100 canvas: at scale 0.28
   px/unit (matching the original height="28") the math yields 15/14/5.
   The 28-px canvas had whitespace inside it, so the math-true sizes
   render the visible logo smaller than the original looked. Heights
   scaled 2× so the rendered logo matches the user's intended size:
   image viewBox h=55 → 30px; wordmark h=50 → 28px; tagline h=18 → 10px.
   Tagline subsequently bumped 10 → 12 px (effective font ~8px) for
   legibility — the math-proportional 10px sat at ~6.7px rendered font
   size, which read too small at body distances. */
.logo-image    { height: 30px; width: auto; }
.logo-text     { display: flex; flex-direction: column; justify-content: center; gap: 2px; }
.logo-wordmark { height: 28px; width: auto; }
.logo-tagline  { height: 12px; width: auto; }

/* Theme-aware logo: show light logo by default, dark logo in dark theme */
[data-theme="light"] .logo-dark,
:root:not([data-theme="dark"]) .logo-dark { display: none; }
[data-theme="dark"] .logo-light { display: none; }
[data-theme="dark"] .logo-dark { display: block; }

.site-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.site-nav a {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-family: 'Iosevka SS17', sans-serif;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 400;
    letter-spacing: 0.5px;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
}
.site-nav a:hover {
    color: var(--accent);
    background: var(--accent-light);
}
.site-nav a.active {
    color: var(--accent);
    background: var(--accent-light);
    font-weight: 600;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.theme-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.4rem 0.6rem;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    transition: all var(--transition);
}
.theme-toggle:hover {
    border-color: var(--accent);
    background: var(--accent-light);
}
.theme-toggle:focus-visible {
    box-shadow: var(--focus-ring);
    outline: none;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.5rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    position: relative;
}

.hamburger, .hamburger::before, .hamburger::after {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 1px;
    transition: all 0.3s;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}
.hamburger { top: 50%; margin-top: -1px; }
.hamburger::before { content: ''; top: -6px; left: 0; transform: none; }
.hamburger::after { content: ''; top: 6px; left: 0; transform: none; }
.hamburger.open { background: transparent; }
.hamburger.open::before { top: 0; transform: rotate(45deg); }
.hamburger.open::after { top: 0; transform: rotate(-45deg); }

/* ===== Footer ===== */
.site-footer {
    background: var(--footer-bg);
    color: var(--footer-text);
    padding-top: 3rem;
    margin-top: 4rem;
}

.footer-inner {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
    padding-bottom: 2rem;
}

.footer-col h4 {
    font-family: 'Iosevka SS17', sans-serif;
    color: var(--footer-heading);
    margin-bottom: 1rem;
    font-size: 0.95rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.footer-col p {
    color: var(--footer-text);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.footer-col nav {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.footer-col nav a {
    color: var(--footer-text);
    font-size: 0.875rem;
    transition: color var(--transition);
}
.footer-col nav a:hover { color: #ffffff; }

.footer-col a {
    color: var(--footer-text);
}
.footer-col a:hover { color: #ffffff; }

.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding: 1.25rem 0;
    text-align: center;
}
.footer-bottom p {
    color: var(--footer-text);
    font-size: 0.8rem;
    margin: 0;
}

/* ===== Page Sections ===== */
.page-hero {
    padding: 5rem 0 4rem;
    text-align: center;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.page-hero h1 {
    margin-bottom: 1rem;
    font-size: 2.75rem;
    letter-spacing: -0.03em;
    outline: none;
}

.page-hero .lead {
    font-size: 1.2rem;
    color: var(--text-secondary);
    max-width: 640px;
    margin: 0 auto;
}

.section {
    padding: 4rem 0;
}

.section-alt {
    background: var(--bg-secondary);
}

.section-title {
    text-align: center;
    margin-bottom: 3rem;
}

.section-title h2 {
    margin-bottom: 0.75rem;
}

.section-title p {
    max-width: 600px;
    margin: 0 auto;
}

/* ===== Cards ===== */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    transition: all var(--transition);
}
.card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--accent);
}

.card h3 {
    margin-bottom: 0.75rem;
    font-size: 1.25rem;
}

.card .card-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
    display: block;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.75rem;
    border-radius: var(--radius);
    font-family: 'Iosevka SS17', sans-serif;
    font-weight: 500;
    font-size: 0.95rem;
    letter-spacing: 1px;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    line-height: 1.4;
}
.btn:focus-visible {
    box-shadow: var(--focus-ring);
    outline: none;
}

.btn-primary {
    background: var(--accent);
    color: #ffffff;
}
.btn-primary:hover {
    background: var(--accent-hover);
    color: #ffffff;
}

.btn-outline {
    background: transparent;
    color: var(--accent);
    border: 2px solid var(--accent);
}
.btn-outline:hover {
    background: var(--accent);
    color: #ffffff;
}

/* ===== Forms ===== */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-family: 'Iosevka SS17', sans-serif;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 0.7rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Iosevka Etoile', Georgia, serif;
    font-weight: 300;
    font-size: 0.95rem;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus {
    border-color: var(--accent);
    box-shadow: var(--focus-ring);
    outline: none;
}

textarea.form-control {
    min-height: 140px;
    resize: vertical;
}

.validation-message {
    color: var(--error);
    font-size: 0.825rem;
    margin-top: 0.25rem;
}

.valid.modified:not([type=checkbox]) {
    border-color: var(--success);
}

.invalid {
    border-color: var(--error);
}

/* Honeypot */
.hp-field { position: absolute; left: -9999px; opacity: 0; height: 0; }

/* ===== CAPTCHA Widget ===== */
.captcha-widget {
    margin: 0.75rem 0;
}
.captcha-image-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}
.captcha-image-row img {
    border: 1px solid var(--color-border, #ddd);
    border-radius: var(--radius, 6px);
    user-select: none;
    -webkit-user-drag: none;
}
.captcha-refresh {
    background: none;
    border: 1px solid var(--color-border, #ddd);
    border-radius: var(--radius, 6px);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0.35rem 0.6rem;
    line-height: 1;
    color: var(--text-secondary, #555);
    transition: background 0.2s, color 0.2s;
}
.captcha-refresh:hover {
    background: var(--bg-muted, #f0f0f0);
    color: var(--text-primary, #222);
}
.captcha-input-row {
    max-width: 280px;
}
.captcha-input-row label {
    font-size: 0.85rem;
    color: var(--text-secondary, #555);
    margin-bottom: 0.25rem;
    display: block;
}

/* ===== Alert ===== */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}
.alert-success {
    background: rgba(34,134,58,0.1);
    color: var(--success);
    border: 1px solid rgba(34,134,58,0.2);
}
.alert-error {
    background: rgba(211,47,47,0.1);
    color: var(--error);
    border: 1px solid rgba(211,47,47,0.2);
}
.alert-warning {
    background: rgba(200,150,0,0.1);
    color: #8a6d00;
    border: 1px solid rgba(200,150,0,0.25);
}
[data-theme="dark"] .alert-warning {
    color: #e2c045;
}

/* ===== Utility ===== */
.text-center { text-align: center; }
.text-accent { color: var(--accent); }
.mt-2 { margin-top: 2rem; }
.mb-2 { margin-bottom: 2rem; }

/* ===== Blazor Error ===== */
.blazor-error-boundary {
    background: var(--error);
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
    border-radius: var(--radius);
}
.blazor-error-boundary::after {
    content: "An error has occurred.";
}

#blazor-error-ui {
    background: var(--error);
    color: white;
    padding: 0.75rem 1.5rem;
    position: fixed;
    bottom: 0;
    width: 100%;
    z-index: 9999;
    text-align: center;
    display: none;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .mobile-menu-btn { display: block; }

    .site-nav {
        display: none;
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        background: var(--bg-primary);
        border-bottom: 1px solid var(--border);
        flex-direction: column;
        padding: 1rem;
        box-shadow: var(--shadow-lg);
    }
    .site-nav.open { display: flex; }

    .page-hero { padding: 3rem 0 2.5rem; }
    .page-hero h1 { font-size: 2rem; }

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

    h1 { font-size: 2rem; }
    h2 { font-size: 1.5rem; }
}

@media (max-width: 480px) {
    .footer-inner {
        grid-template-columns: 1fr;
    }
    .card-grid {
        grid-template-columns: 1fr;
    }
}
