/* ============================================
   BASE STYLES - Reset and foundational elements
   ============================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-primary);
  font-size: var(--text-base);
  line-height: var(--line-height-normal);
  color: var(--color-slate-100);
  background: linear-gradient(135deg, #fafbfc 0%, #f3f4f6 100%);
  transition: all var(--transition-base);
}

body.dark-mode {
  background: linear-gradient(135deg, #1A202C 0%, #151A24 100%);
  color: var(--color-slate-100);
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  margin-bottom: var(--space-6);
  color: var(--color-slate-900);
}

body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3,
body.dark-mode h4,
body.dark-mode h5,
body.dark-mode h6 {
  color: var(--color-white);
}

h1 {
  font-size: var(--text-5xl);
  letter-spacing: var(--letter-spacing-tight);
}

h2 {
  font-size: var(--text-4xl);
  letter-spacing: var(--letter-spacing-tight);
}

h3 {
  font-size: var(--text-3xl);
}

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

h5 {
  font-size: var(--text-xl);
}

h6 {
  font-size: var(--text-lg);
}

/* Paragraphs and text */
p {
  margin-bottom: var(--space-4);
  line-height: var(--line-height-relaxed);
}

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

strong, b {
  font-weight: var(--font-weight-bold);
}

em, i {
  font-style: italic;
}

code {
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: var(--text-sm);
  background-color: var(--color-slate-100);
  color: var(--color-slate-800);
  padding: var(--space-2);
  border-radius: var(--radius-md);
}

body.dark-mode code {
  background-color: var(--color-slate-800);
  color: var(--color-slate-100);
}

pre {
  background-color: var(--color-slate-900);
  color: var(--color-slate-100);
  padding: var(--space-6);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  margin-bottom: var(--space-6);
}

pre code {
  background: none;
  color: inherit;
  padding: 0;
}

/* Links */
a {
  color: var(--color-primary-dark);
  text-decoration: none;
  transition: all var(--transition-fast);
  outline: none;
}

a:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

a:focus-visible {
  outline: 2px solid var(--color-primary-light);
  outline-offset: 3px;
}

body.dark-mode a {
  color: var(--color-primary-light);
}

body.dark-mode a:hover {
  color: var(--color-primary);
}

/* Lists */
ul, ol {
  margin-left: var(--space-6);
  margin-bottom: var(--space-6);
}

li {
  margin-bottom: var(--space-2);
}

dl {
  margin-bottom: var(--space-6);
}

dt {
  font-weight: var(--font-weight-semibold);
  margin-top: var(--space-4);
}

dd {
  margin-left: var(--space-6);
  margin-bottom: var(--space-4);
}

/* Images */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

img[loading="lazy"] {
  background-color: var(--color-slate-100);
}

body.dark-mode img[loading="lazy"] {
  background-color: var(--color-slate-800);
}

/* Tables */
table {
  width: 100%;
  margin-bottom: var(--space-6);
  border-collapse: collapse;
  background-color: var(--slate-950);
}

body.dark-mode table {
  background-color: var(--slate-900);
}

thead {
  background-color: var(--color-slate-100);
}

body.dark-mode thead {
  background-color: var(--color-slate-800);
}

th, td {
  padding: var(--space-4);
  text-align: left;
  border-bottom: 1px solid var(--color-slate-200);
}

body.dark-mode th,
body.dark-mode td {
  border-bottom-color: var(--color-slate-700);
}

th {
  font-weight: var(--font-weight-semibold);
}

/* Forms */
label {
  display: block;
  margin-bottom: var(--space-2);
  font-weight: var(--font-weight-medium);
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  line-height: var(--line-height-normal);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="tel"],
textarea,
select {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-4);
  border: 1px solid rgba(212, 175, 55, 0.15);
  border-radius: var(--radius-xl);
  background-color: rgba(255, 255, 255, 0.92);
  color: var(--color-slate-900);
  transition: border-color var(--transition-base), box-shadow var(--transition-base), background-color var(--transition-base);
  box-shadow: inset 0 1px 2px rgba(26, 32, 44, 0.05);
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="tel"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.16);
  background-color: rgba(255, 255, 255, 1);
}

body.dark-mode input[type="text"],
body.dark-mode input[type="email"],
body.dark-mode input[type="password"],
body.dark-mode input[type="number"],
body.dark-mode input[type="date"],
body.dark-mode input[type="tel"],
body.dark-mode textarea,
body.dark-mode select {
  background-color: var(--color-slate-800);
  color: var(--color-slate-100);
  border-color: var(--color-slate-700);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.16);
}

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

/* Buttons */
button,
.btn {
  font-family: inherit;
  font-size: inherit;
  font-weight: var(--font-weight-semibold);
  cursor: pointer;
  border: none;
  border-radius: var(--radius-lg);
  transition: all var(--transition-fast);
  text-align: center;
}

button:focus-visible,
.btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

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

/* Blockquote */
blockquote {
  border-left: 4px solid rgba(212, 175, 55, 0.85);
  margin: var(--space-6) 0;
  padding: var(--space-6);
  font-size: var(--text-lg);
  font-style: italic;
  background: rgba(212, 175, 55, 0.08);
  color: var(--color-slate-700);
  border-radius: var(--radius-lg);
}

body.dark-mode blockquote {
  background: rgba(255, 211, 118, 0.08);
  border-left-color: var(--color-primary-light);
  color: var(--color-slate-200);
}

/* Horizontal Rule */
hr {
  border: none;
  border-top: 1px solid var(--color-slate-200);
  margin: var(--space-12) 0;
}

body.dark-mode hr {
  border-top-color: var(--color-slate-700);
}

/* Utilities */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-4);
  padding-right: var(--space-4);
}

@media (max-width: 640px) {
  .container {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
  }

  h1 {
    font-size: var(--text-3xl);
  }

  h2 {
    font-size: var(--text-2xl);
  }

  h3 {
    font-size: var(--text-xl);
  }
}

/* Print styles */
@media print {
  * {
    background: transparent !important;
    color: black !important;
    text-shadow: none !important;
  }

  a, a:visited {
    text-decoration: underline;
  }

  a[href]:after {
    content: " (" attr(href) ")";
  }

  img {
    max-width: 100% !important;
  }
}
