/*
 * Draconis platform primitives: shared building blocks used across components.
 * Text roles, containers, buttons and surfaces. Uses platform tokens only.
 * Styles that belong to one component stay in that component's scoped .razor.css file.
 */

/* ---- Text roles ---- */
.text-display {
    font-family: var(--font-heading);
    font-size: var(--text-4xl);
    font-weight: var(--weight-bold);
    line-height: var(--line-tight);
    letter-spacing: var(--tracking-heading);
    text-wrap: balance;
}

.text-lead {
    font-size: var(--text-lg);
    color: var(--color-text-muted);
    max-width: var(--layout-prose-width);
}

.text-label {
    font-size: var(--text-sm);
    font-weight: var(--weight-bold);
    line-height: 1.3;
    color: var(--color-text);
}

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

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

/* ---- Containers ---- */
.container {
    width: 100%;
    max-width: var(--layout-max-width);
    margin-inline: auto;
    padding-inline: var(--layout-gutter);
}

.container--narrow {
    max-width: var(--layout-narrow-width);
}

.container--prose {
    max-width: calc(var(--layout-prose-width) + 2 * var(--layout-gutter));
}

.section {
    padding-block: var(--space-7);
}

@media (min-width: 48rem) {
    .section {
        padding-block: var(--space-8);
    }
}

/* Vertical rhythm between direct children. */
.stack > * + * {
    margin-top: var(--space-4);
}

.stack--loose > * + * {
    margin-top: var(--space-6);
}

/* ---- Buttons ----
   Works on <a> and <button>. Every size meets the 2.75rem touch target. */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: var(--button-height-md);
    padding: 0 var(--button-padding-md);
    border: var(--border-width) solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--color-text);
    font-family: var(--font-body);
    font-size: var(--text-base);
    font-weight: var(--weight-bold);
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}

.button--sm {
    min-height: var(--button-height-sm);
    padding: 0 var(--button-padding-sm);
    font-size: var(--text-sm);
}

.button--lg {
    min-height: var(--button-height-lg);
    padding: 0 var(--button-padding-lg);
    font-size: var(--text-lg);
}

.button--block {
    display: flex;
    width: 100%;
}

/* Primary: the one main action in a view. */
.button--primary {
    background: var(--color-accent);
    color: var(--color-on-accent);
}

.button--primary:hover {
    background: var(--color-accent-hover);
    color: var(--color-on-accent);
}

.button--primary:active {
    background: var(--color-accent-strong);
    color: var(--color-on-accent-strong);
}

/* Secondary: a supporting action beside a primary one. */
.button--secondary {
    border-color: var(--color-border-control);
    color: var(--color-text);
}

.button--secondary:hover {
    border-color: var(--color-accent);
    background: var(--color-surface-raised);
    color: var(--color-text);
}

.button--secondary:active {
    background: var(--color-surface);
}

/* Tertiary: a low-emphasis action that reads as text. */
.button--tertiary {
    padding-inline: var(--space-2);
    color: var(--color-text);
    text-decoration: underline;
    text-decoration-color: var(--color-accent);
    text-decoration-thickness: var(--rule-width);
    text-underline-offset: 0.3em;
}

.button--tertiary:hover {
    color: var(--color-link);
}

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

/* Disabled, for <button disabled> and for links marked aria-disabled="true". */
.button:disabled,
.button[aria-disabled="true"] {
    border-color: var(--color-border);
    background: var(--color-surface-raised);
    color: var(--color-text-muted);
    text-decoration: none;
    cursor: not-allowed;
}

.button[aria-disabled="true"] {
    pointer-events: none;
}

/* ---- Surfaces and cards ----
   Depth is shown by a lighter surface and a border, not by blur or heavy shadow. */
.surface {
    background: var(--color-surface);
    border: var(--border-width) solid var(--color-border);
    border-radius: var(--radius-md);
}

.surface--raised {
    background: var(--color-surface-raised);
    border-color: var(--color-border-strong);
}

.card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding: var(--space-5);
    background: var(--color-surface);
    border: var(--border-width) solid var(--color-border);
    border-radius: var(--radius-md);
}

.card__title {
    font-family: var(--font-heading);
    font-size: var(--text-xl);
    font-weight: var(--weight-bold);
    line-height: var(--line-heading);
    letter-spacing: var(--tracking-heading);
}

.card__meta {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
}

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

/* A responsive grid of cards: one column on phones, sharing the row evenly on wider screens. */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr));
    gap: var(--space-4);
}

/* A card that carries extra weight: an ember rule down its leading edge. */
.card--accent {
    border-left: var(--rule-width) solid var(--color-accent);
}

/* A card that is one link. Put .card__link on the anchor inside the title;
   the whole card becomes the click target and shows the focus ring. */
.card--interactive:hover {
    background: var(--color-surface-raised);
    border-color: var(--color-border-strong);
}

.card--interactive.card--accent:hover {
    border-left-color: var(--color-accent-hover);
}

.card__link {
    color: inherit;
    text-decoration: none;
}

.card__link::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
}

.card__link:focus-visible {
    outline: none;
}

.card--interactive:has(.card__link:focus-visible) {
    outline: var(--rule-width) solid var(--color-focus);
    outline-offset: 2px;
}

/* ---- Marked list ----
   A plain list of short statements, each led by an ember dash. */
.marked-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    max-width: var(--layout-prose-width);
}

.marked-list > li {
    position: relative;
    padding-left: var(--space-5);
}

.marked-list > li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.75em;
    width: 0.5rem;
    height: var(--rule-width);
    background: var(--color-accent);
}
