/* =========================================================
   NISULKA TOOLS — GLOBAL STYLES
   ========================================================= */

/* =========================
   Reset
   ========================= */

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
    scroll-padding-top: calc(var(--site-header-height, 76px) + 12px);
}

body {
    margin: 0;
    padding: 0;

    min-height: 100vh;

    background: var(--bg-body);
    color: var(--text-primary);

    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: 1.6;

    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body,
button,
input,
textarea,
select {
    font-family: var(--font-family);
}

/* =========================
   Selection
   ========================= */

::selection {
    background: var(--brand-primary);
    color: var(--text-on-primary);
}

/* =========================
   Images & Media
   ========================= */

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

img {
    height: auto;
}

iframe {
    max-width: 100%;
    border: 0;
}

/* =========================
   Links
   ========================= */

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

a:hover {
    color: var(--brand-primary);
}

/* =========================
   Headings
   ========================= */

h1,
h2,
h3,
h4,
h5,
h6 {
    margin-top: 0;
    margin-bottom: 0.75rem;

    color: var(--text-primary);

    font-weight: 700;
    line-height: 1.25;
}

h1 {
    font-size: clamp(
        2rem,
        5vw,
        var(--font-size-4xl)
    );
}

h2 {
    font-size: clamp(
        1.5rem,
        4vw,
        var(--font-size-3xl)
    );
}

h3 {
    font-size: clamp(
        1.25rem,
        3vw,
        var(--font-size-2xl)
    );
}

h4 {
    font-size: var(--font-size-xl);
}

/* =========================
   Paragraphs
   ========================= */

p {
    margin-top: 0;
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

p:last-child {
    margin-bottom: 0;
}

/* =========================
   Lists
   ========================= */

ul,
ol {
    margin-top: 0;
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

/* =========================
   Buttons
   ========================= */

button,
input,
textarea,
select {
    font-size: inherit;
}

button {
    border: 0;
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

/* =========================
   Form Elements
   ========================= */

input,
textarea,
select {
    width: 100%;

    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);

    background: var(--bg-surface);
    color: var(--text-primary);

    padding: 0.75rem 0.875rem;

    outline: none;

    transition:
        border-color var(--transition-fast),
        box-shadow var(--transition-fast),
        background var(--transition-fast);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
}

input:hover,
textarea:hover,
select:hover {
    border-color: var(--border-color-hover);
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--brand-primary);

    box-shadow:
        0 0 0 3px
        color-mix(
            in srgb,
            var(--brand-primary) 15%,
            transparent
        );
}

textarea {
    min-height: 120px;
    resize: vertical;
}

/* =========================
   Container
   ========================= */

.container {
    width: min(
        100% - (var(--page-padding) * 2),
        var(--container-width)
    );

    margin-inline: auto;
}

/* =========================
   Page Sections
   ========================= */

.section {
    padding-block: 3rem;
}

.section-header {
    margin-bottom: 2rem;
}

.section-title {
    margin-bottom: 0.5rem;
}

.section-description {
    max-width: 700px;
    color: var(--text-secondary);
}

/* =========================
   Utility Classes
   ========================= */

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

.text-left {
    text-align: left;
}

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

.hidden {
    display: none !important;
}

.visually-hidden {
    position: absolute;

    width: 1px;
    height: 1px;

    padding: 0;
    margin: -1px;

    overflow: hidden;

    clip: rect(0, 0, 0, 0);

    white-space: nowrap;

    border: 0;
}

/* =========================
   Accessibility
   ========================= */

:focus-visible {
    outline: 3px solid
        color-mix(
            in srgb,
            var(--brand-primary) 40%,
            transparent
        );

    outline-offset: 3px;
}

/* =========================
   Horizontal Rule
   ========================= */

hr {
    border: 0;
    border-top: 1px solid var(--border-color);
    margin: 2rem 0;
}

/* =========================
   Code
   ========================= */

code,
pre {
    font-family:
        ui-monospace,
        SFMono-Regular,
        Menlo,
        Monaco,
        Consolas,
        "Liberation Mono",
        "Courier New",
        monospace;
}

code {
    padding: 0.15rem 0.35rem;

    border-radius: var(--radius-sm);

    background: var(--bg-surface-tertiary);
    color: var(--text-primary);

    font-size: 0.9em;
}

pre {
    overflow-x: auto;

    padding: 1rem;

    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);

    background: var(--bg-surface-secondary);
}

/* =========================
   Tables
   ========================= */

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

th,
td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
}

/* =========================
   Loading
   ========================= */

.loading {
    pointer-events: none;
    opacity: 0.65;
}

/* =========================
   Responsive
   ========================= */

@media (min-width: 640px) {
    :root {
        --page-padding: 24px;
    }

    .section {
        padding-block: 4rem;
    }
}

@media (min-width: 1024px) {
    :root {
        --page-padding: 32px;
    }

    .section {
        padding-block: 5rem;
    }
}

/* =========================
   Reduced Motion
   ========================= */

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
