/* ============================================
   Base Design System
   Reset · Tokens · Typography · Layout · Utilities
   ============================================ */

/* --- Reset --- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    min-height: 100vh;
    line-height: 1.5;
}

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

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

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

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

ul, ol {
    list-style: none;
}

/* --- Design Tokens --- */
:root {
    /* Gray scale */
    --color-gray-50:  #fafafa;
    --color-gray-100: #f5f5f5;
    --color-gray-200: #e5e5e5;
    --color-gray-300: #d4d4d4;
    --color-gray-400: #a3a3a3;
    --color-gray-500: #737373;
    --color-gray-600: #525252;
    --color-gray-700: #404040;
    --color-gray-800: #262626;
    --color-gray-900: #171717;
    --color-white:    #ffffff;
    --color-black:    #0a0a0a;

    /* Semantic colors */
    --color-bg:              var(--color-gray-100);
    --color-surface:         var(--color-white);
    --color-text:            var(--color-gray-900);
    --color-text-secondary:  var(--color-gray-600);
    --color-text-tertiary:   var(--color-gray-500);
    --color-border:          var(--color-gray-200);
    --color-accent:          var(--color-black);
    --color-accent-hover:    var(--color-gray-800);
    --color-accent-subtle:   var(--color-gray-100);

    /* Typography */
    --font-sans: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

    --text-xs:   clamp(0.75rem, 0.7rem + 0.25vw, 0.8125rem);
    --text-sm:   clamp(0.875rem, 0.825rem + 0.25vw, 0.9375rem);
    --text-base: clamp(0.9375rem, 0.875rem + 0.25vw, 1rem);
    --text-lg:   clamp(1.0625rem, 1rem + 0.375vw, 1.125rem);
    --text-xl:   clamp(1.1875rem, 1.1rem + 0.5vw, 1.3125rem);
    --text-2xl:  clamp(1.5rem, 1.25rem + 1vw, 1.875rem);
    --text-3xl:  clamp(1.875rem, 1.5rem + 1.5vw, 2.625rem);

    --weight-normal:   400;
    --weight-medium:   500;
    --weight-semibold: 600;

    --leading-tight:  1.25;
    --leading-normal: 1.5;
    --leading-relaxed: 1.625;

    --tracking-tight: -0.025em;
    --tracking-normal: 0;

    /* Spacing */
    --space-1:  0.25rem;
    --space-2:  0.5rem;
    --space-3:  0.75rem;
    --space-4:  1rem;
    --space-5:  1.25rem;
    --space-6:  1.5rem;
    --space-8:  2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;
    --space-20: 5rem;
    --space-24: 6rem;
    --space-32: 8rem;

    /* Radii */
    --radius-sm:   4px;
    --radius-md:   8px;
    --radius-lg:   12px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --shadow-fancy:
        0 0 0 1px rgba(0, 0, 0, 0.03),
        0 1px 1px rgba(0, 0, 0, 0.04),
        0 2px 4px rgba(0, 0, 0, 0.04),
        0 4px 8px rgba(0, 0, 0, 0.04),
        0 8px 16px rgba(0, 0, 0, 0.04),
        0 16px 32px rgba(0, 0, 0, 0.04);

    /* Transitions */
    --ease: cubic-bezier(.4, 0, .2, 1);
    --duration-fast: 150ms;
    --duration-base: 250ms;
    --duration-slow: 400ms;
    --transition-fast: var(--duration-fast) var(--ease);
    --transition-base: var(--duration-base) var(--ease);
    --transition-slow: var(--duration-slow) var(--ease);

    /* Borders */
    --border-dashed: 1px dashed var(--color-gray-200);
    --border-solid:  1px solid var(--color-border);
}

/* --- Base Typography --- */
body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    font-weight: var(--weight-normal);
    color: var(--color-text);
    background-color: var(--color-bg);
    line-height: var(--leading-normal);
}

h1, h2, h3, h4 {
    line-height: var(--leading-tight);
    letter-spacing: var(--tracking-tight);
    font-weight: var(--weight-semibold);
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }

p {
    line-height: var(--leading-relaxed);
    color: var(--color-text-secondary);
}

/* --- Layout --- */
.container {
    width: 100%;
    max-width: 1100px;
    margin-inline: auto;
    padding-inline: var(--space-6);
}

.container--narrow {
    max-width: 680px;
}

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

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

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

::selection {
    background-color: var(--color-accent);
    color: var(--color-white);
}

:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}
