/*
 * Shared design system, ported from SafeHaven.
 *
 * SafeHaven builds this with Tailwind 4 through Vite. This server has no npm
 * and the learner app must run with no network at all, so the same visual
 * language is written out by hand here: no build step, one file, and the fonts
 * are self-hosted rather than pulled from fonts.bunny.net, which would fail in
 * a school hall and is blocked by the Content-Security-Policy anyway.
 *
 * Loaded by both the learner survey and the coordinator backend. The learner
 * app then layers bigger touch targets on top: same language, different scale,
 * because one audience is a 14-year-old holding a tablet and the other is a
 * coordinator reading a dense table.
 */

/* --------------------------------------------------------------- fonts --- */

@font-face {
    font-family: 'Manrope';
    src: url('/fonts/Manrope-Variable.woff2') format('woff2-variations');
    font-weight: 200 800;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Sora';
    src: url('/fonts/Sora-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Sora';
    src: url('/fonts/Sora-SemiBold.woff2') format('woff2');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Sora';
    src: url('/fonts/Sora-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* --------------------------------------------------------------- tokens --- */

:root {
    --font-sans: 'Manrope', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-display: 'Sora', ui-sans-serif, system-ui, sans-serif;

    /* SafeHaven palette, unchanged */
    --ink: #102033;
    --ocean: #1d4ed8;
    --teal: #0f766e;
    --amber: #f59e0b;
    --sun: #f97316;
    /* --sun is a fill colour. As TEXT on white it measures 2.80:1, so warnings
       that are words rather than shapes use this darker tone instead. */
    --sun-text: #b45309;
    --mint: #dffaf4;
    --danger: #dc2626;

    --slate-50: #f8fafc;
    --slate-100: #f1f5f9;
    --slate-200: #e2e8f0;
    --slate-300: #cbd5e1;
    --slate-400: #94a3b8;
    --slate-500: #64748b;
    --slate-600: #475569;
    --slate-700: #334155;
    --slate-900: #0f172a;
    --slate-950: #020617;

    --radius-card: 2rem;
    --radius-panel: 1.75rem;
    --radius-soft: 1.2rem;
    --shadow-card: 0 16px 50px -26px rgba(15, 23, 42, 0.35);
    --shadow-lift: 0 18px 40px -24px rgba(2, 6, 23, 0.45);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background-color: var(--slate-100);
    color: var(--slate-900);
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    /* The two tinted corners are what make SafeHaven read as a product rather
       than a form. Teal top left, orange bottom right. */
    background-image:
        radial-gradient(circle at top left, rgba(15, 118, 110, 0.14), transparent 28rem),
        radial-gradient(circle at bottom right, rgba(249, 115, 22, 0.14), transparent 24rem);
    background-attachment: fixed;
}

/* Gradients cost more than they are worth on a tablet held in the sun, and
   SafeHaven flattens them on touch devices for the same reason. */
@media (pointer: coarse) {
    body {
        background-image: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
    }
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    color: var(--slate-950);
    letter-spacing: -0.01em;
}

a { color: var(--ocean); }

/* ------------------------------------------------------------ surfaces --- */

.shell-card {
    border-radius: var(--radius-card);
    border: 1px solid rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: var(--shadow-card);
    backdrop-filter: blur(6px);
}

.shell-panel {
    border-radius: var(--radius-panel);
    border: 1px solid rgba(226, 232, 240, 0.8);
    background: #fff;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.shell-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border-radius: 999px;
    border: 1px solid var(--slate-200);
    background: #fff;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--slate-700);
}

/* ------------------------------------------------------------- buttons --- */

.shell-button,
.shell-button-primary,
.shell-button-secondary,
/* Left out of this group originally, so the danger button rendered as a bare
   outlined link with none of the shared sizing. */
.shell-button-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 3rem;
    padding: 0 1.25rem;
    border-radius: 999px;
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: transform 140ms ease, background-color 140ms ease, border-color 140ms ease;
}

.shell-button-primary {
    background: var(--ink);
    color: #fff;
    border: 1px solid var(--ink);
    box-shadow: 0 10px 24px -14px rgba(12, 74, 110, 0.6);
}

.shell-button-primary:hover { transform: translateY(-2px); background: var(--slate-900); }

.shell-button-secondary {
    background: #fff;
    color: var(--slate-700);
    border: 1px solid var(--slate-300);
}

.shell-button-secondary:hover { transform: translateY(-2px); border-color: var(--slate-400); }

.shell-button-danger {
    background: #fff;
    color: var(--danger);
    border: 1px solid var(--danger);
}

.shell-button-danger:hover { transform: translateY(-2px); background: var(--danger); color: #fff; }

/* 2.4rem measured 38px tall, under the 44px minimum. */
.shell-button-small { min-height: 2.75rem; padding: 0 1rem; font-size: 0.85rem; }

button[disabled], .shell-button-primary[disabled] { opacity: 0.6; cursor: default; transform: none; }

@media (prefers-reduced-motion: reduce) {
    .shell-button,
    .shell-button-primary,
    .shell-button-secondary,
    .shell-button-danger { transition: none; }
    .shell-button-primary:hover,
    .shell-button-secondary:hover,
    .shell-button-danger:hover { transform: none; }
}

/* ------------------------------------------------------------- banners --- */

.status-banner {
    border-radius: var(--radius-soft);
    border: 1px solid var(--slate-200);
    background: #fff;
    padding: 0.9rem 1.15rem;
    font-size: 0.95rem;
}

.status-banner--ok { border-color: #a7f3d0; background: #ecfdf5; color: #065f46; }
.status-banner--warn { border-color: #fcd34d; background: #fffbeb; color: #92400e; }
.status-banner--danger { border-color: #fecaca; background: #fef2f2; color: #991b1b; }

/* ---------------------------------------------------------------- misc --- */

.eyebrow {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--slate-500);
    margin: 0;
}

.muted { color: var(--slate-600); }  /* slate-500 is 4.34:1 on the page ground */
.small { font-size: 0.875rem; }

:focus-visible {
    outline: 3px solid var(--ocean);
    outline-offset: 2px;
}

/* Two controls share the last cell of the codes table, and the delete form
   would otherwise take a line of its own. */
.code-actions { display: flex; gap: 0.5rem; justify-content: flex-end; align-items: center; flex-wrap: wrap; }
.inline-form { display: inline; margin: 0; }
