/* ===== Font Faces (per Ogma Brand v2.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) ---
   Values mirror ogma/brand/ogma-tokens.css in the companies_design repository,
   which holds the brand kit (v3.0 since T041). The mark tokens belong to the
   v3.0 identity. The interface palette still dates from v2.0 (T036): a blue
   ramp derived in OKLab from #003399 by the kit's tools/derive-ramp.py. Whether
   to replace it is not decided. Token *names* here differ from the kit's
   (--bg-primary vs --bg). */
:root, [data-theme="light"] {
    /* Blue ramp — contrast on white / on #1A1A1A noted per step */
    --blue-900: #001243;   /* 17.99 /  1.03 */
    --blue-800: #001D60;   /* 15.62 /  1.11 */
    --blue-700: #00277A;   /* 13.37 /  1.30 */
    --blue-600: #002F90;   /* 11.61 /  1.50 */
    --blue-500: #003399;   /* 10.86 /  1.60 — EU Azure, the ramp anchor */
    --blue-400: #2D5DBC;   /*  6.17 /  2.82 — decorative; fails AA on dark */
    --blue-300: #6891DE;   /*  3.14 /  5.55 — the dark-theme accent */
    --blue-200: #A0BBEC;   /*  1.94 /  8.96 */
    --blue-100: #DFEAFE;   /*  1.21 / 14.37 */

    /* Brand mark (kit v3.0) — fixed by the identity. Cyan is 4.07:1 on white:
       enough for graphics, not for text or links. */
    --mark-ink: #16181B;
    --mark-cyan: #0087B8;

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

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

    /* Accent (blue-500 primary) */
    --accent: #003399;
    --accent-hover: #00277A;
    --accent-light: #DFEAFE;
    --accent-subtle: #A0BBEC;
    --on-accent: #FFFFFF;

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

    /* 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: #001243;
    --footer-text: #A0BBEC;
    --footer-heading: #FFFFFF;

    /* Semantic status — kept separate from the three brand colours by design.
       Every value clears 4.5:1 against its own ground; the v1.0 set did not
       (success 3.39, warning 3.72, error 3.93 on white). */
    --success: #008762;
    --error: #D24443;
    --warning: #A76708;
    --info: #0E7C86;

    --success-bg: #E4F5ED;
    --success-fg: #027B58;
    --warning-bg: #FBEEE1;
    --warning-fg: #9C5E00;
    --error-bg: #FFEBE9;
    --error-fg: #C23737;
    --info-bg: #E5F3F5;
    --info-fg: #057983;

    --focus-ring: 0 0 0 3px rgba(0,51,153,0.3);

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

    /* Header band. The phone menu opens directly below it. */
    --header-height: 72px;

    color-scheme: light;
}

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

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

    /* Brand mark on dark grounds (kit v3.0) */
    --mark-ink: #FFFFFF;
    --mark-cyan: #29C5F6;

    /* Accent — blue-300, not blue-400. v1.0 documented blue-400 as the dark
       primary but never implemented it; measured, it is 2.82:1 on #1A1A1A
       and fails AA. blue-300 is 5.55:1 on #1A1A1A and 5.07:1 on #222222. */
    --accent: #6891DE;
    --accent-hover: #A0BBEC;
    --accent-light: #0E2758;
    --accent-subtle: #1B3873;
    --on-accent: #1A1A1A;

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

    /* 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 status — v1.0 left these unmapped, so status colours rendered
       identically in both themes. The v1.0 light values live on here, where
       they measure correctly against #1A1A1A. */
    --success: #1D9E75;
    --error: #D85A56;
    --warning: #BA7517;
    --info: #428E96;

    --success-bg: #183026;
    --success-fg: #2DA77E;
    --warning-bg: #362615;
    --warning-fg: #C68129;
    --error-bg: #411F1C;
    --error-fg: #E86662;
    --info-bg: #1A2E30;
    --info-fg: #519DA5;

    --focus-ring: 0 0 0 3px rgba(104,145,222,0.35);

    color-scheme: dark;
}

/* ===== 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: var(--header-height);
}

.site-logo {
    display: flex;
    align-items: center;
    /* The kit's clear-space rule is one hub diameter on every side: 116 units
       in a mark file 400.26 units high, so 16px for the 56px mark. */
    gap: 16px;
    text-decoration: none;
}
.site-logo img { display: block; }

/* Split-logo layout: mark left, (wordmark / slogan stacked) right. Kit v3.0
   (T041): the mark is nearly square (378.63×400.26) and the wordmark has two
   lines, "OGMA" over "INTELLIGENCE" (483.32×138). The kit's minimum size for
   mark plus wordmark is 200px wide, so the sizes are: mark 56px (53 wide),
   gap 16, wordmark 38px (133 wide) = 202px. The text column is wordmark 38 +
   gap 6 + slogan 12 = 56px, the height of the mark. At 12px high the slogan
   is 222px wide, so it is shown from 992px up only (see Responsive). */
.logo-image    { height: 56px; width: auto; }
.logo-text     { display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 6px; }
.logo-wordmark { height: 38px; 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;
}

/* Text on the accent must follow the accent. In dark theme --accent is
   --blue-300 #6891DE, where white measures 3.14:1 and fails AA; --on-accent
   flips to #1A1A1A there, which measures 5.55:1. Hardcoding #ffffff here was
   invisible while both themes shared one accent. */
.btn-primary {
    background: var(--accent);
    color: var(--on-accent);
}
.btn-primary:hover {
    background: var(--accent-hover);
    color: var(--on-accent);
}

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

/* ===== 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;
}
/* The placeholder stands in for the image until the page is interactive.
   Same box as the image (280 x 80 plus the border, narrower on a very small
   screen), so nothing moves when the image arrives. */
.captcha-placeholder {
    box-sizing: content-box;
    width: 280px;
    max-width: 100%;
    aspect-ratio: 7 / 2;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--bg-muted);
}
.captcha-image-row img {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    user-select: none;
    -webkit-user-drag: none;
}
.captcha-refresh {
    background: none;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0.35rem 0.6rem;
    line-height: 1;
    color: var(--text-secondary);
    transition: background 0.2s, color 0.2s;
}
.captcha-refresh:hover {
    background: var(--bg-muted);
    color: var(--text-primary);
}
.captcha-input-row {
    max-width: 280px;
}
.captcha-input-row label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
    display: block;
}

/* ===== Alert ===== */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}
/* Grounds and text come from the semantic token pairs, which are themed and
   contrast-checked. The v1.0 rules mixed rgba() literals (#22863A, #D32F2F,
   #C89600) with token text colours, so the ground and the text were drawn
   from different palettes and only the text ever followed the theme. */
.alert-success {
    background: var(--success-bg);
    color: var(--success-fg);
    border: 1px solid var(--success);
}
.alert-error {
    background: var(--error-bg);
    color: var(--error-fg);
    border: 1px solid var(--error);
}
.alert-warning {
    background: var(--warning-bg);
    color: var(--warning-fg);
    border: 1px solid var(--warning);
}
.alert-info {
    background: var(--info-bg);
    color: var(--info-fg);
    border: 1px solid var(--info);
}

/* ===== Plain list =====
   A short vertical list of statements, centred as a block with the text
   left-aligned (home page, "What we do not do"). */
.plain-list {
    max-width: 640px;
    margin: 0 auto;
    padding-left: 1.25rem;
    color: var(--text-secondary);
    font-size: 1.05rem;
}

.plain-list li + li {
    margin-top: 0.6rem;
}

/* A short list inside a card, between two paragraphs. */
.card-list {
    margin: 0 0 1rem;
    padding-left: 1.25rem;
    color: var(--text-secondary);
}

.card-list li + li {
    margin-top: 0.25rem;
}

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

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

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

/* ===== Responsive ===== */
/* The slogan is wider than the wordmark. Below 992px it would crowd the
   navigation, and at phone width it does not fit beside the two buttons.
   Two classes, and placed after the theme rules, so that it also overrides
   `[data-theme="dark"] .logo-dark { display: block }`. */
@media (max-width: 991px) {
    .site-logo .logo-tagline { display: none; }
}

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

    .site-nav {
        display: none;
        position: absolute;
        top: var(--header-height);
        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;
    }
}

/* ===== Service detail pages: card links and FAQ ===== */
.card-link {
    display: inline-block;
    margin-top: 1rem;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
}

.card-link:hover,
.card-link:focus-visible {
    color: var(--accent-hover);
    text-decoration: underline;
}

.faq {
    margin-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.faq details {
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
}

.faq summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--text-primary);
    list-style-position: outside;
}

.faq summary:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
    border-radius: var(--radius);
}

.faq details > p {
    margin: 0.75rem 0 0;
    color: var(--text-secondary);
}

/* ===== Breadcrumbs (service detail pages) ===== */
.breadcrumbs {
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.breadcrumbs a {
    color: var(--accent);
    text-decoration: none;
}

.breadcrumbs a:hover,
.breadcrumbs a:focus-visible {
    text-decoration: underline;
}

.breadcrumbs > span[aria-hidden] {
    margin: 0 0.35rem;
}

/* Staff enquiry pages */
.enquiry-office { overflow-wrap: anywhere; }
.enquiry-office table { width: 100%; border-collapse: collapse; margin-block: 1rem; }
.enquiry-office th, .enquiry-office td {
    text-align: start;
    vertical-align: top;
    padding: .5rem;
    border-bottom: 1px solid var(--border);
}
.enquiry-office dt { margin-top: .75rem; font-weight: bold; }
.enquiry-office dd { margin-inline-start: 0; }
.enquiry-office .enquiry-message { white-space: pre-wrap; }
.enquiry-office nav { display: flex; gap: 1rem; }
.enquiry-office form { margin-block: 1rem; }
