/* ==========================================================================
   base.css — Reset, Custom Properties, Typography
   ========================================================================== */

/* --- Custom Properties (Design Tokens) --- */
:root {
  /* Colors */
  --color-ink:              #1a1a2e;
  --color-ink-light:        #4a4a5a;
  --color-ink-muted:        #7a7a8a;
  --color-accent:           #8b5e3c;
  --color-accent-hover:     #6d4930;
  --color-surface:          #faf8f5;
  --color-surface-alt:      #f0ece6;
  --color-surface-elevated: #ffffff;
  --color-border:           #e0dbd3;
  --color-border-light:     #ebe7e0;
  --color-success:          #2d6a4f;
  --color-warning:          #b5651d;
  --color-danger:           #9b2226;
  --color-info:             #3a6ea5;

  /* Typography */
  --font-family:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display:   clamp(2.5rem, 5vw, 4rem);
  --font-h1:        clamp(2rem, 4vw, 3rem);
  --font-h2:        clamp(1.5rem, 3vw, 2.25rem);
  --font-h3:        clamp(1.25rem, 2.5vw, 1.75rem);
  --font-h4:        clamp(1.125rem, 2vw, 1.375rem);
  --font-h5:        1.125rem;
  --font-h6:        1rem;
  --font-body-lg:   1.125rem;
  --font-body:      1rem;
  --font-body-sm:   0.875rem;
  --font-caption:   0.8125rem;
  --font-label:     0.75rem;
  --leading-body:   1.6;
  --leading-heading: 1.2;

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

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

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.1);

  /* Transitions */
  --ease-default: cubic-bezier(0.4, 0, 0.2, 1);
  --duration-fast: 150ms;
  --duration-normal: 250ms;

  /* Z-index */
  --z-header: 100;
  --z-overlay: 200;
  --z-modal: 300;

  /* Layout */
  --container-max:     72rem;
  --container-narrow:  48rem;
  --container-padding: clamp(1rem, 4vw, 2rem);
}

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

html {
  -webkit-text-size-adjust: 100%;
  -moz-tab-size: 4;
  tab-size: 4;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms;
    animation-iteration-count: 1;
    transition-duration: 0.01ms;
    scroll-behavior: auto;
  }
}

body {
  font-family: var(--font-family);
  font-size: var(--font-body);
  line-height: var(--leading-body);
  color: var(--color-ink);
  background-color: var(--color-surface);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

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

a {
  color: var(--color-accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
  transition: color var(--duration-fast) var(--ease-default);
}

a:hover {
  color: var(--color-accent-hover);
}

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

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: var(--leading-heading);
  color: var(--color-ink);
}

h1 { font-size: var(--font-h1); }
h2 { font-size: var(--font-h2); }
h3 { font-size: var(--font-h3); }
h4 { font-size: var(--font-h4); }
h5 { font-size: var(--font-h5); }
h6 { font-size: var(--font-h6); }

p {
  max-width: 65ch;
}

strong {
  font-weight: 600;
}

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

blockquote {
  border-inline-start: 3px solid var(--color-accent);
  padding-inline-start: var(--space-6);
  color: var(--color-ink-light);
  font-style: italic;
}

hr {
  border: none;
  border-block-start: 1px solid var(--color-border-light);
  margin-block: var(--space-12);
}

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

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

:focus:not(:focus-visible) {
  outline: none;
}
