/* cozan look for MudBlazor. Colours and type come from Theme/CozanTheme.cs (MudBlazor's palette) and
   css/tokens.css (the cozan tokens, for what the palette has no slot for). This file covers what MudTheme can't:
   flat buttons, card shape, focus rings, the nav and a few cozan-only pieces (eyebrow, service accents, mono).
   Brand rules: cozan.co.za-astro-site/design-system/README.md. */

:root {
    color-scheme: light;
}
[data-theme="dark"] {
    color-scheme: dark;
}

body {
    -webkit-text-size-adjust: 100%;
}

/* Plain links in copy; MudBlazor's own links and buttons keep their colours. */
a:not([class]) {
    color: var(--action);
    text-underline-offset: 3px;
}
a:not([class]):hover {
    color: var(--action-hover);
}

/* Every focusable element shows a 2px solid focus ring with 2px offset. Never remove it. */
:focus-visible,
.mud-button-root:focus-visible,
.mud-nav-link:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}
/* FocusOnNavigate moves focus to the page's h1 for screen readers; it needs no ring. */
h1:focus {
    outline: none;
}

/* Long unbroken words (domains) wrap instead of overflowing on phones. */
.mud-typography-h1,
.mud-typography-h2,
.mud-typography-h3,
.mud-typography-h4 {
    overflow-wrap: anywhere;
}
@media (max-width: 767.98px) {
    .mud-typography-h1 {
        font-size: 40px;
        line-height: 44px;
    }
    .mud-typography-h2 {
        font-size: 32px;
        line-height: 38px;
    }
}

.mono,
code {
    font-family: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
    font-weight: 500;
}
code {
    font-size: 0.9em;
    color: inherit;
}

.cz-measure {
    max-width: 68ch;
}

/* ---------- Buttons: flat, no ripple, cozan sizes ---------- */

.mud-button-root .mud-ripple,
.mud-ripple:after {
    display: none;
}
.mud-button-filled,
.mud-button-filled:hover,
.mud-button-filled:active,
.mud-button-filled:focus-visible {
    box-shadow: none;
}
.mud-button-root {
    transition:
        background-color var(--dur-fast) var(--ease-out),
        border-color var(--dur-fast) var(--ease-out),
        color var(--dur-fast) var(--ease-out);
}
.mud-button-filled { padding: 12px 24px; }
.mud-button-outlined { padding: 11px 23px; }
.mud-button-filled-size-small { padding: 8px 16px; font-size: 15px; line-height: 20px; }
.mud-button-outlined-size-small { padding: 7px 15px; font-size: 15px; line-height: 20px; }
.mud-button-filled-size-large { padding: 16px 32px; font-size: 18px; }
.mud-button-outlined-size-large { padding: 15px 31px; font-size: 18px; }

/* Secondary button: surface fill, border-strong outline, ink label; the outline turns ink on hover. */
.mud-button-outlined.mud-button-outlined-default {
    background: var(--surface);
    border-color: var(--border-strong);
}
.mud-button-outlined.mud-button-outlined-default:hover {
    background: var(--surface);
    border-color: var(--ink);
}

/* Forward-moving buttons: put CozanIcons.Arrow in EndIcon and it nudges on hover. */
.mud-button-root .mud-button-icon-end {
    transition: transform var(--dur-move) var(--ease-out);
}
.mud-button-root:hover .mud-button-icon-end {
    transform: translateX(3px);
}

/* ---------- Cards: border plus shadow-sm, radius-lg ---------- */

.mud-card,
.mud-paper.cz-card {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.mud-card.mud-paper-outlined,
.mud-paper-outlined.cz-card {
    border-color: var(--border);
    box-shadow: var(--shadow-sm);
}
.mud-card-content.mud-card-content-padding {
    padding: var(--space-6);
}
.mud-card-header.mud-card-header-padding {
    padding: var(--space-6) var(--space-6) 0;
}
.mud-card-actions.mud-card-actions-padding {
    padding: 0 var(--space-6) var(--space-6);
    gap: var(--space-3);
}

/* Only cards you can act on lift, to shadow-md plus a 2px rise. */
.cz-card-action {
    transition:
        box-shadow var(--dur-fast) var(--ease-out),
        transform var(--dur-move) var(--ease-out);
}
.cz-card-action:hover {
    box-shadow: var(--shadow-md) !important;
    transform: translateY(-2px);
}
@media (hover: none), (prefers-reduced-motion: reduce) {
    .cz-card-action:hover {
        transform: none;
    }
}

/* Service accent: a 4px top rule. Never a coloured left border. */
.cz-accent::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 4px;
    background: var(--cz-accent, var(--brand-rose));
}
.cz-accent-rose { --cz-accent: var(--brand-rose); }
.cz-accent-workspace { --cz-accent: var(--workspace-blue); }
.cz-accent-web { --cz-accent: var(--web-amber); }
.cz-accent-security { --cz-accent: var(--security-green); }
.cz-accent-insight { --cz-accent: var(--insight-violet); }

/* ---------- Badges: MudChip with Class="cz-badge" is the small mono tag ---------- */

.mud-chip.cz-badge {
    height: auto;
    margin: 0;
    padding: 3px var(--space-2);
    border-radius: var(--radius-sm);
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    font-size: 12px;
    line-height: 16px;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.mud-chip.cz-badge.mud-chip-color-default {
    background: var(--surface-muted);
    color: var(--ink-muted);
    border: 1px solid var(--border);
}

/* ---------- Alerts: tint, no border ---------- */

.mud-alert {
    border-radius: var(--radius-md);
    font-size: 16px;
    line-height: 24px;
}
.mud-alert-text-normal {
    background: var(--surface-muted);
    border: 1px solid var(--border);
}
.mud-alert-text-success { background: var(--security-green-soft); }
.mud-alert-text-warning { background: var(--web-amber-soft); }
.mud-alert-text-error { background: var(--danger-soft); }
.mud-alert-text-info { background: var(--workspace-blue-soft); }

/* ---------- Tables ---------- */

.mud-table.mud-paper-outlined {
    border-radius: var(--radius-lg);
    border-color: var(--border);
    overflow: hidden;
}
.mud-table-root .mud-table-head .mud-table-cell,
.mud-simple-table table thead th {
    font-size: 14px;
    line-height: 20px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-muted);
    background: var(--surface-muted);
}
.mud-table-root .mud-table-body .mud-table-cell,
.mud-simple-table table tbody td {
    font-size: 16px;
    line-height: 24px;
}
.mud-table-cell.num {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
/* Dashboard: the row of the account chosen in the nav switcher. */
.mud-table-root .mud-table-body tr.cz-row-selected .mud-table-cell {
    background: var(--brand-rose-soft);
    font-weight: 600;
}
.mud-table-root .mud-table-body tr.cz-row-selected .mud-table-cell:first-child {
    box-shadow: inset 3px 0 0 var(--action);
}

/* ---------- Forms ---------- */

/* Field layout: one column on phones, two from 640px, space-5 between fields. */
.cz-form-grid {
    display: grid;
    gap: var(--space-5);
    align-items: start;
}
@media (min-width: 640px) {
    .cz-form-grid.two {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
/* The contact form: a readable line length, not the full container. */
.cz-contact {
    max-width: 640px;
}
/* Hints at the site's size: 14px, ink-muted. */
.mud-input-helper-text {
    font-size: 14px;
    line-height: 20px;
    font-weight: 500;
    letter-spacing: normal;
}

/* ---------- App shell ---------- */

.cz-appbar {
    border-bottom: 1px solid var(--border);
}
.cz-appbar .mud-toolbar {
    gap: var(--space-2);
}
.cz-brand {
    display: inline-flex;
    padding-block: var(--space-2);
    margin-inline: var(--space-2) var(--space-4);
}

.cz-drawer {
    border-right: 1px solid var(--border);
}
/* Account menu: the avatar in the app bar opens it. */
.cz-avatar-btn {
    display: inline-flex;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: none;
    cursor: pointer;
}
.cz-account-menu {
    width: 260px;
}
.cz-account-menu__who {
    padding: var(--space-4);
    min-width: 0;
}

/* Drawer: the nav on top, the signed-in user and Sign out pinned to the bottom. */
.cz-drawer__body {
    display: flex;
    flex-direction: column;
    min-height: 100%;
}
.cz-drawer__body .cz-nav {
    flex: 1;
}
.cz-drawer__account {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    padding: var(--space-4) var(--space-3);
    border-top: 1px solid var(--border);
}
.cz-drawer__user {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding-inline: var(--space-3);
    min-width: 0;
}
.cz-drawer__who {
    min-width: 0;
}
.cz-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* Sign out in the drawer and the account menu: styled like a nav link. */
.mud-button-root.cz-signout-item {
    justify-content: flex-start;
    padding: var(--space-2) var(--space-3);
    font-size: 16px;
    color: var(--ink-muted);
}
.mud-button-root.cz-signout-item:hover {
    color: var(--ink);
    background: var(--surface-muted);
}

.cz-nav {
    padding: var(--space-4) var(--space-3);
}
.cz-nav .mud-nav-link {
    margin-bottom: var(--space-1);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    font-size: 16px;
    line-height: 24px;
    font-weight: 600;
    color: var(--ink-muted);
}
.cz-nav .mud-nav-link:hover:not(.mud-nav-link-disabled) {
    color: var(--ink);
    background: var(--surface-muted);
}
.cz-nav .mud-nav-link.active:not(.mud-nav-link-disabled) {
    color: var(--action);
    background: var(--brand-rose-soft);
    border-inline-end: 0;
}
.cz-nav .mud-nav-link .mud-nav-link-icon {
    color: inherit;
}

.cz-main {
    padding-block: var(--space-7) var(--space-8);
}
@media (max-width: 767.98px) {
    .cz-main {
        padding-block: var(--space-6) var(--space-7);
    }
}

.cz-avatar {
    background: var(--brand-rose-soft) !important;
    color: var(--action) !important;
    font-weight: 700;
}

.cz-page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-5);
    margin-bottom: var(--space-6);
}
.cz-page-header__text {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    min-width: 0;
}

/* ---------- Blazor error UI ---------- */

#blazor-error-ui {
    display: none;
    position: fixed;
    inset: auto 0 0;
    z-index: 2000;
    padding: var(--space-3) var(--space-8) var(--space-3) var(--space-5);
    background: var(--danger-soft);
    color: var(--danger);
    font-weight: 600;
    border-top: 1px solid var(--danger);
    box-shadow: var(--shadow-md);
}
#blazor-error-ui .reload {
    margin-left: var(--space-3);
    color: inherit;
}
#blazor-error-ui .dismiss {
    position: absolute;
    right: var(--space-4);
    top: var(--space-3);
    cursor: pointer;
}

.blazor-error-boundary {
    padding: var(--space-4);
    border-radius: var(--radius-md);
    background: var(--danger-soft);
    color: var(--danger);
    font-weight: 600;
}
.blazor-error-boundary::after {
    content: "Something went wrong on this part of the page.";
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}

/* Account switcher at the top of the nav, aligned with the nav links' inset. */
.cz-account-select {
    padding: 8px 16px 4px;
}
