*, ::backdrop, ::file-selector-button, :after, :before {
    border: 0 solid;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font: inherit;
}

html {
    font-family: sans-serif;
    line-height: 1.5;
    accent-color: #000;
}

body {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    padding: 1rem;
}

a {
    color: inherit;
    text-decoration: none;
}

h1, .h1 { font-size: 2.25rem; font-weight: bold; text-wrap: balance; }
h2, .h2 { font-size: 1.5rem; font-weight: bold; text-wrap: balance; }
h3, .h3 { font-size: 1.25rem; font-weight: bold; }
h4, .h4 { font-size: 1rem; font-weight: bold; }

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

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

/* Header & Footer */

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

.site-name {
    font-size: 1.5rem;
    font-weight: 900;
    width: fit-content;
}

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

.search-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;

    & .input,
    & .input-filled,
    & .input-white {
        flex: 1;
    }
}

/* Inputs */

.input {
    border: 1px solid #ccc;
    border-radius: 0.75rem;
    padding: 0.5rem 0.75rem;

    &:focus-visible {
        border-color: #000;
        outline: none;
    }
}

.input-filled {
    background: #eee;
    border-radius: 0.75rem;
    padding: 0.5rem 0.75rem;

    &:focus-visible { outline: none; }
}

.input-white {
    background: white;
    border-radius: 0.75rem;
    padding: 0.5rem 0.75rem;

    &:focus-visible { outline: none; }
}

.textarea {
    border: 1px solid #ccc;
    border-radius: 0.75rem;
    padding: 0.5rem 0.75rem;
    resize: vertical;

    &:focus-visible {
        border-color: #000;
        outline: none;
    }
}

.select {
    border: 1px solid #ccc;
    border-radius: 0.75rem;
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 0.75rem center;
    appearance: none;

    &:focus-visible {
        border-color: #000;
        outline: none;
    }
}

.color-input {
    width: 3rem;
    height: 2rem;
    border: 1px solid #ccc;
    border-radius: 0.75rem;
    padding: 0.25rem;
    cursor: pointer;
}

.range { cursor: pointer; }

.file-input {
    cursor: pointer;

    &::file-selector-button {
        background: #eee;
        color: #000;
        border-radius: 0.75rem;
        padding: 0.5rem 0.75rem;
        cursor: pointer;
        line-height: 1.5;
        margin-right: 0.75rem;
    }
}

/* Forms */

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

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.fieldset {
    border: 1px solid #ccc;
    border-radius: 0.75rem;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.legend {
    font-weight: bold;
    padding: 0 0.5rem;
}

.radio-label,
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

/* Buttons */

.primary-button,
.secondary-button,
.outline-button,
.ghost-button,
.danger-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border-radius: 0.75rem;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    line-height: 1.5;
    text-decoration: none;

    &:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }
}

.primary-button { background: #000; color: white; }
.secondary-button { background: #eee; color: #000; }
.outline-button { background: transparent; color: #000; border: 1px solid #ccc; }
.ghost-button { background: transparent; color: #000; }
.danger-button { background: #dc2626; color: white; }

.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.75rem;
    cursor: pointer;
    text-decoration: none;

    & svg { width: 1.5rem; height: 1.5rem; }

    &.primary { background: #000; color: white; }
    &.secondary { background: #eee; color: #000; }
    &.outline { background: transparent; color: #000; border: 1px solid #ccc; }
    &.ghost { background: transparent; color: #000; }

    &:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }
}

.plain-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: #000;
    cursor: pointer;

    & svg { width: 1.5rem; height: 1.5rem; }

    &:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }
}

.button-group {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Navigation */

.nav {
    display: flex;
    column-gap: 1rem;
    row-gap: 0.5rem;
    flex-wrap: wrap;

    & a { color: #000; }

    &.bold a { font-weight: bold; }
}

.nav-vertical {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;

    & a { color: #000; }
}

.tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid #ccc;
    overflow-x: auto;
}

.tab {
    white-space: nowrap;
    padding: 0.5rem 1rem;
    color: #666;
    border-bottom: 2px solid transparent;

    &.active {
        color: #000;
        font-weight: bold;
        border-bottom-color: #000;
    }
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;

    & a { color: #666; }
}

.breadcrumb-separator { color: #ccc; }

.chip-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.chip { color: #666; }

/* Cards */

.card {
    border-radius: 1rem;
    padding: 1rem;
    background: #eee;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.card-footer {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
}

/* Pagination */

.pagination {
    display: flex;
    align-items: center;
    gap: 0.5rem;

    &.center { align-self: center; }
    &.end { align-self: flex-end; }
}

.pagination-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    height: 2.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.75rem;
    text-decoration: none;
    color: #000;
    cursor: pointer;

    &.active {
        background: #000;
        color: white;
    }
}

.pagination-dots {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    height: 2.5rem;
    color: #666;
}

/* Disclosure */

.disclosure {
    border: 1px solid #ccc;
    border-radius: 0.75rem;
    padding: 1rem;

    & summary {
        cursor: pointer;
        font-weight: bold;
        list-style: none;

        &::marker,
        &::-webkit-details-marker {
            display: none;
        }
    }

    &[open] summary {
        margin-bottom: 1rem;
    }
}

/* Alerts */

.alert {
    border-radius: 0.75rem;
    padding: 0.75rem 1rem;

    &.info { background: #eee; color: #000; }
    &.success { background: #dcfce7; color: #166534; }
    &.warning { background: #fef9c3; color: #854d0e; }
    &.error { background: #fee2e2; color: #991b1b; }
}

/* Badges */

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
    font-weight: bold;

    &.primary { background: #000; color: white; }
    &.secondary { background: #eee; color: #000; }
    &.success { background: #dcfce7; color: #166534; }
    &.warning { background: #fef9c3; color: #854d0e; }
    &.danger { background: #fee2e2; color: #991b1b; }
}

/* Tables */

.table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--color-border, #ccc);
    border-radius: 0.75rem;
}

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;

    & th,
    & td {
        border-bottom: 1px solid var(--color-border, #ccc);
        border-right: 1px solid var(--color-border, #ccc);
        padding: 0.5rem;
        text-align: left;
    }

    & th:last-child,
    & td:last-child {
        border-right: none;
    }

    & tbody tr:last-child td {
        border-bottom: none;
    }

    & th {
        font-weight: bold;
    }

    & .text-right { text-align: right; }
    & .text-center { text-align: center; }
}

/* Divider */

.divider {
    border: none;
    border-top: 1px solid #ccc;
}

/* Lists */

.list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding-left: 1.5rem;
}

.list-none {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    list-style: none;
}

/* Blockquote */

.blockquote {
    border-left: 3px solid #000;
    padding: 0.5rem 1rem;
    color: #666;
}

/* Code */

.code {
    font-family: monospace;
    font-size: 0.875rem;
    background: #eee;
    border-radius: 0.25rem;
    padding: 0.125rem 0.375rem;
}

.code-block {
    font-family: monospace;
    font-size: 0.875rem;
    background: #eee;
    border-radius: 0.75rem;
    padding: 1rem;
    overflow-x: auto;
    white-space: pre;
}

/* Empty State */

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

/* Avatar */

.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1rem;

    & img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    &.avatar-xs { width: 1.5rem; height: 1.5rem; font-size: 0.625rem; }
    &.avatar-sm { width: 2rem; height: 2rem; font-size: 0.75rem; }
    &.avatar-lg { width: 3.5rem; height: 3.5rem; font-size: 1.25rem; }
    &.avatar-xl { width: 5rem; height: 5rem; font-size: 1.75rem; }
}

.avatar-placeholder {
    background: #000;
    color: #fff;
    font-weight: bold;
}

/* Hero */

.hero {
    background: #000;
    color: white;
    padding: 2rem;
    border-radius: 1rem;
    text-align: center;
}
