/* ==========================================================================
   TOWEMADE - BASE STYLES
   Version: 3.0
   Description: Reset, typography, and base element styles
   Date: 2025-01-XX
   ========================================================================== */

/* === CSS RESET === */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family-base);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  overflow-x: hidden;
}

/* === TYPOGRAPHY === */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-family-headings);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  color: var(--text-primary);
  margin-bottom: var(--spacing-4);
}

h1 {
  font-size: var(--font-size-4xl);
  font-weight: var(--font-weight-extrabold);
}

h2 {
  font-size: var(--font-size-3xl);
}

h3 {
  font-size: var(--font-size-2xl);
}

h4 {
  font-size: var(--font-size-xl);
}

h5 {
  font-size: var(--font-size-lg);
}

h6 {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
}

p {
  margin-bottom: var(--spacing-4);
  line-height: var(--line-height-relaxed);
}

a {
  color: var(--text-link);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--text-link-hover);
  text-decoration: underline;
}

a:focus-visible {
  outline: 2px solid var(--border-color-focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* === LISTS === */
ul, ol {
  padding-left: var(--spacing-6);
  margin-bottom: var(--spacing-4);
}

li {
  margin-bottom: var(--spacing-2);
  line-height: var(--line-height-relaxed);
}

/* === CODE & PRE === */
code {
  font-family: var(--font-family-monospace);
  font-size: var(--font-size-sm);
  padding: var(--spacing-1) var(--spacing-2);
  background-color: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  color: var(--color-danger);
}

pre {
  font-family: var(--font-family-monospace);
  font-size: var(--font-size-sm);
  padding: var(--spacing-4);
  background-color: var(--bg-tertiary);
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin-bottom: var(--spacing-4);
}

pre code {
  background: transparent;
  padding: 0;
  color: inherit;
}

/* === IMAGES === */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* === HORIZONTAL RULE === */
hr {
  border: 0;
  border-top: 1px solid var(--divider-color);
  margin: var(--spacing-6) 0;
}

/* === BUTTONS (BASE) === */
button {
  font-family: var(--font-family-base);
  cursor: pointer;
  border: none;
  background: transparent;
  transition: all var(--transition-base);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

button:focus-visible {
  outline: 2px solid var(--border-color-focus);
  outline-offset: 2px;
}

/* === FORM ELEMENTS (BASE) === */
input, textarea, select {
  font-family: var(--font-family-base);
  font-size: var(--font-size-base);
  color: var(--text-primary);
  background-color: var(--bg-primary);
}

input:focus, textarea:focus, select:focus {
  outline: none;
}

/* === ACCESSIBILITY === */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--color-primary);
  color: var(--text-inverse);
  padding: var(--spacing-2) var(--spacing-4);
  text-decoration: none;
  border-radius: var(--radius-md);
  z-index: var(--z-index-tooltip);
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: var(--spacing-2);
}

/* === SELECTION === */
::selection {
  background-color: var(--color-primary-lighter);
  color: var(--text-primary);
}

/* === SCROLLBAR (WEBKIT) === */
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--color-gray-400);
  border-radius: var(--radius-lg);
  border: 3px solid var(--bg-secondary);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-gray-500);
}

/* === FOCUS VISIBLE POLYFILL === */
[data-whatintent='mouse'] *:focus,
[data-whatintent='touch'] *:focus {
  outline: none;
}
