/* =========================================================
   Reset, element defaults and utilities.
   Nothing here knows about the panel's layout — that is
   layout.css — or about any component — that is
   components.css.
   ========================================================= */

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

* {
    margin: 0;
    padding: 0;
}

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

body {
    font-family: var(--font-body);
    font-size: var(--fs-body);
    line-height: 1.55;
    color: var(--text-dark);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    min-height: 100vh;
}

h1,
h2,
h3,
h4,
h5 {
    font-family: var(--font-head);
    line-height: 1.2;
    font-weight: 600;
    letter-spacing: -.01em;
}

h1 {
    font-size: var(--fs-display);
}

h2 {
    font-size: var(--fs-h2);
}

h3 {
    font-size: var(--fs-h3);
}

a {
    color: var(--brand-blue);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

img,
svg,
video {
    display: block;
    max-width: 100%;
}

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

button {
    background: none;
    border: 0;
    cursor: pointer;
}

ul,
ol {
    list-style: none;
}

table {
    border-collapse: collapse;
    width: 100%;
}

/* Tabular figures everywhere a number sits in a column — misaligned digits
   are the fastest way to make a data table look untrustworthy. */
td,
th,
.num {
    font-variant-numeric: tabular-nums;
}

hr {
    border: 0;
    border-top: 1px solid var(--hairline);
}

/* ---------------------------------------------------------
   Focus. One ring, everywhere, never removed without a
   replacement. :focus-visible so a mouse click on a button
   does not draw it.
   --------------------------------------------------------- */
:focus-visible {
    outline: 2px solid var(--brand-blue);
    outline-offset: 2px;
    border-radius: var(--radius-xs);
}

/* ---------------------------------------------------------
   Scrollbars — thin, and tinted so they do not read as a
   browser artefact sitting on top of the design.
   --------------------------------------------------------- */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--hairline-strong) transparent;
}

*::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

*::-webkit-scrollbar-thumb {
    background: var(--hairline-strong);
    border: 3px solid transparent;
    background-clip: content-box;
    border-radius: var(--radius-full);
}

*::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
    background-clip: content-box;
}

/* ---------------------------------------------------------
   Utilities
   --------------------------------------------------------- */
.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;
}

.hidden {
    display: none !important;
}

.muted {
    color: var(--text-muted);
}

.mid {
    color: var(--text-mid);
}

/* A ghost button that deletes. Colouring it rather than making it a full
   danger button keeps the weight on the primary action beside it. */
.text-bad {
    color: var(--bad);
}

.eyebrow {
    font-size: var(--fs-xs);
    text-transform: uppercase;
    letter-spacing: .12em;
    font-weight: 600;
    color: var(--text-muted);
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.row {
    display: flex;
    align-items: center;
    gap: var(--s3);
}

.row-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s3);
}

.col {
    display: flex;
    flex-direction: column;
    gap: var(--s3);
}

.wrap {
    flex-wrap: wrap;
}

.grow {
    flex: 1;
}

.gap-1 { gap: var(--s1); }
.gap-2 { gap: var(--s2); }
.gap-4 { gap: var(--s4); }
.gap-6 { gap: var(--s6); }

.mt-2 { margin-top: var(--s2); }
.mt-4 { margin-top: var(--s4); }
.mt-6 { margin-top: var(--s6); }
.mb-2 { margin-bottom: var(--s2); }
.mb-4 { margin-bottom: var(--s4); }

.text-sm {
    font-size: var(--fs-sm);
}

.text-xs {
    font-size: var(--fs-xs);
}

.nowrap {
    white-space: nowrap;
}

/* Card entry animation. Applied by core/layout.js `stagger()` after a view
   renders; the delay is set inline per item. */
.anim-item {
    opacity: 0;
    transform: translateY(10px);
    animation: rise .42s var(--ease) forwards;
}

@keyframes rise {
    to {
        opacity: 1;
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .anim-item {
        animation: none;
        opacity: 1;
        transform: none;
    }
}

/* util.mark() wraps the matched substring of a search result. The browser
   default is a hard yellow that survives neither the brand nor dark mode. */
mark {
    background: color-mix(in srgb, var(--brand-red) 22%, transparent);
    color: inherit;
    border-radius: 3px;
    padding: 0 1px;
}
