/*
 * LowlandTech Graph presentation app stylesheet.
 *
 * This file is the result of running the Tailwind CSS toolchain against the
 * markup under Components/Primitives and Components/Pages. The variable layer
 * is declared in variables.css; the rules below translate shadcn-inspired
 * semantic names into concrete styles without bundling the full Tailwind
 * runtime. See wwwroot/package.json for the repeatable npm build script that
 * regenerates this file.
 */

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

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    background: hsl(var(--bg-base));
    color: hsl(var(--fg-primary));
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: hsl(var(--bg-accent));
    text-decoration: none;
}

a:hover {
    color: hsl(var(--bg-accent-hover));
}

:focus-visible {
    outline: 2px solid hsl(var(--border-focus));
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

button {
    font: inherit;
    color: inherit;
    background: none;
    border: none;
    cursor: pointer;
}

input, textarea, select {
    font: inherit;
    color: inherit;
}

h1, h2, h3, h4 {
    margin: 0;
    font-weight: 600;
    letter-spacing: -0.01em;
}

h1 { font-size: 1.875rem; line-height: 1.2; }
h2 { font-size: 1.5rem;   line-height: 1.25; }
h3 { font-size: 1.25rem;  line-height: 1.3; }
h4 { font-size: 1rem;     line-height: 1.4; }

p { margin: 0; }

/* ── Layout primitives ────────────────────────────────────────────────── */

.app-shell {
    display: grid;
    grid-template-columns: 16rem minmax(0, 1fr);
    min-height: 100dvh;
}

.sidebar-backdrop {
    display: none;
}

@media (max-width: 768px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .app-shell[data-sidebar-open="false"] .app-content {
        grid-column: 1;
    }

    .app-sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: 16rem;
        z-index: 30;
        transform: translateX(-100%);
        transition: transform 0.2s ease;
    }

    .app-shell[data-sidebar-open="true"] .app-sidebar {
        transform: translateX(0);
        box-shadow: var(--shadow-md);
    }

    .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: hsl(0 0% 0% / 0.4);
        z-index: 20;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
    }

    .app-shell[data-sidebar-open="true"] .sidebar-backdrop {
        opacity: 1;
        pointer-events: auto;
    }
}

.app-sidebar {
    position: sticky;
    top: 0;
    height: 100dvh;
    overflow-y: auto;
    background: hsl(var(--bg-surface));
    border-right: 1px solid hsl(var(--border-default));
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    padding: 0.5rem 0.75rem;
}

.sidebar-brand-mark {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, hsl(var(--bg-accent)), hsl(var(--bg-accent-hover)));
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    color: hsl(var(--fg-secondary));
    font-size: 0.875rem;
    transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-link:hover {
    background: hsl(var(--bg-muted));
    color: hsl(var(--fg-primary));
}

.sidebar-link.active {
    background: hsl(var(--bg-muted));
    color: hsl(var(--fg-primary));
    font-weight: 500;
}

.sidebar-footer {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.app-content {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-width: 0;
    width: 100%;
}

.app-topbar,
.page-container {
    width: min(100%, 80rem);
    margin-inline: auto;
}

.app-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.menu-button {
    display: none;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: var(--radius-md);
    color: hsl(var(--fg-secondary));
}

@media (max-width: 768px) {
    .app-sidebar {
        position: fixed;
        height: 100dvh;
    }

    .app-content {
        padding: 1rem;
    }

    .menu-button {
        display: inline-flex;
    }
}

/* ── Primitive: card ─────────────────────────────────────────────────── */

.card {
    background: hsl(var(--bg-elevated));
    border: 1px solid hsl(var(--border-default));
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
}

.card-header {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 1rem;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
}

.card-description {
    font-size: 0.875rem;
    color: hsl(var(--fg-secondary));
}

/* ── Primitive: button ───────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    font-weight: 500;
    font-size: 0.875rem;
    line-height: 1;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: hsl(var(--bg-accent));
    color: hsl(var(--fg-on-accent));
    border-color: hsl(var(--bg-accent));
}

.btn-primary:hover:not(:disabled) {
    background: hsl(var(--bg-accent-hover));
    border-color: hsl(var(--bg-accent-hover));
}

.btn-secondary {
    background: hsl(var(--bg-elevated));
    color: hsl(var(--fg-primary));
    border-color: hsl(var(--border-default));
}

.btn-secondary:hover:not(:disabled) {
    background: hsl(var(--bg-muted));
}

.btn-ghost {
    background: transparent;
    color: hsl(var(--fg-secondary));
}

.btn-ghost:hover:not(:disabled) {
    background: hsl(var(--bg-muted));
    color: hsl(var(--fg-primary));
}

.btn-block {
    width: 100%;
}

/* ── Primitive: field + input ────────────────────────────────────────── */

.field {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.field-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: hsl(var(--fg-secondary));
}

.field-description {
    font-size: 0.75rem;
    color: hsl(var(--fg-muted));
}

.field-error {
    font-size: 0.75rem;
    color: hsl(var(--fg-danger));
}

.input,
.textarea {
    width: 100%;
    background: hsl(var(--bg-elevated));
    color: hsl(var(--fg-primary));
    border: 1px solid hsl(var(--border-default));
    border-radius: var(--radius-md);
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input:focus,
.textarea:focus {
    outline: none;
    border-color: hsl(var(--border-focus));
    box-shadow: 0 0 0 3px hsl(var(--border-focus) / 0.2);
}

.textarea {
    font-family: var(--font-mono);
    min-height: 7rem;
    resize: vertical;
}

.input[aria-invalid="true"],
.textarea[aria-invalid="true"] {
    border-color: hsl(var(--bg-danger));
}

/* ── Primitive: alert ────────────────────────────────────────────────── */

.alert {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid hsl(var(--border-default));
    background: hsl(var(--bg-muted));
    font-size: 0.875rem;
}

.alert-danger {
    border-color: hsl(var(--bg-danger) / 0.5);
    background: hsl(var(--bg-danger) / 0.1);
    color: hsl(var(--fg-danger));
}

.alert-success {
    border-color: hsl(var(--bg-success) / 0.5);
    background: hsl(var(--bg-success) / 0.1);
    color: hsl(var(--fg-success));
}

.alert-title {
    font-weight: 600;
}

.alert-body {
    color: hsl(var(--fg-secondary));
}

.alert-danger .alert-body,
.alert-success .alert-body {
    color: inherit;
}

/* ── Stepper / progress ──────────────────────────────────────────────── */

.stepper {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.stepper-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    color: hsl(var(--fg-muted));
    font-size: 0.875rem;
    border: 1px solid transparent;
}

.stepper-item.active {
    color: hsl(var(--fg-primary));
    background: hsl(var(--bg-muted));
    border-color: hsl(var(--border-default));
    font-weight: 500;
}

.stepper-item.complete {
    color: hsl(var(--fg-success));
}

.stepper-marker {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 999px;
    background: hsl(var(--bg-muted));
    color: hsl(var(--fg-secondary));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid hsl(var(--border-default));
}

.stepper-item.active .stepper-marker {
    background: hsl(var(--bg-accent));
    color: hsl(var(--fg-on-accent));
    border-color: hsl(var(--bg-accent));
}

.stepper-item.complete .stepper-marker {
    background: hsl(var(--bg-success));
    color: hsl(var(--fg-on-accent));
    border-color: hsl(var(--bg-success));
}

/* ── Layout helpers ──────────────────────────────────────────────────── */

.stack {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.stack-tight {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stack-loose {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.row-end {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
}

.muted {
    color: hsl(var(--fg-secondary));
    font-size: 0.875rem;
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

/* ── Status pill ─────────────────────────────────────────────────────── */

.pill {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
    background: hsl(var(--bg-muted));
    color: hsl(var(--fg-secondary));
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid hsl(var(--border-default));
}

/* ── Forms ───────────────────────────────────────────────────────────── */

.form-grid {
    display: grid;
    gap: 1rem;
}

@media (min-width: 640px) {
    .form-grid.two-column {
        grid-template-columns: 1fr 1fr;
    }
}

/* ── Visually hidden ─────────────────────────────────────────────────── */

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