/**
 * Base Styles
 *
 * Typography, element defaults, and utility classes.
 * Applies Lemonal theme tokens from variables.css.
 */

/* ========================================
   DOCUMENT DEFAULTS
   ======================================== */

html {
  font-size: 100%; /* 16px base */
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--font-normal);
  line-height: var(--leading-relaxed);
  color: var(--color-text-secondary);
  background-color: var(--color-bg-primary);
}

/* ========================================
   TYPOGRAPHY — HEADINGS
   ======================================== */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: var(--font-bold);
  color: var(--color-text-primary);
  letter-spacing: var(--tracking-tight);
}

h1 {
  font-size: var(--text-5xl);
  line-height: var(--leading-none);
  margin-bottom: var(--space-6);
}

h2 {
  font-size: var(--text-4xl);
  line-height: var(--leading-tight);
  margin-bottom: var(--space-5);
}

h3 {
  font-size: var(--text-3xl);
  line-height: var(--leading-tight);
  margin-bottom: var(--space-4);
}

h4 {
  font-size: var(--text-2xl);
  font-weight: var(--font-semibold);
  margin-bottom: var(--space-3);
}

h5 {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  margin-bottom: var(--space-3);
}

h6 {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  margin-bottom: var(--space-2);
}

/* ========================================
   TYPOGRAPHY — BODY TEXT
   ======================================== */

p {
  margin-bottom: var(--space-4);
}

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

.lead {
  font-size: var(--text-xl);
  line-height: var(--leading-relaxed);
  color: var(--color-text-secondary);
}

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

.tiny {
  font-size: var(--text-xs);
}

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

em, i {
  font-style: italic;
}

/* ========================================
   TYPOGRAPHY — LINKS
   ======================================== */

a {
  color: var(--color-link);
  transition: var(--transition-colors);
}

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

/* Styled link with underline animation */
.link {
  color: var(--color-link);
  text-decoration: none;
  position: relative;
  display: inline-block;
}

.link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--ocean-light);
  transition: width var(--duration-normal) var(--ease-out);
}

.link:hover::after {
  width: 100%;
}

/* External link indicator */
.link--external::after {
  content: none;
}

/* ========================================
   TYPOGRAPHY — LISTS
   ======================================== */

ul, ol {
  padding-left: var(--space-6);
  margin-bottom: var(--space-4);
}

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

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

/* Unstyled list */
.list-none {
  list-style: none;
  padding-left: 0;
}

/* ========================================
   TYPOGRAPHY — CODE
   ======================================== */

code, kbd, samp, pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

code {
  background-color: var(--sand);
  color: var(--ocean-deep);
  padding: 0.125em 0.375em;
  border-radius: var(--radius-sm);
}

pre {
  background-color: var(--midnight);
  color: var(--white);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin-bottom: var(--space-4);
}

pre code {
  background: none;
  color: inherit;
  padding: 0;
  font-size: var(--text-sm);
}

kbd {
  background-color: var(--sand-dark);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.125em 0.375em;
  font-size: 0.85em;
}

/* ========================================
   TYPOGRAPHY — BLOCKQUOTE
   ======================================== */

blockquote {
  border-left: 4px solid var(--ocean);
  padding-left: var(--space-4);
  margin: var(--space-6) 0;
  font-style: italic;
  color: var(--color-text-muted);
}

blockquote cite {
  display: block;
  margin-top: var(--space-2);
  font-size: var(--text-sm);
  font-style: normal;
  color: var(--color-text-secondary);
}

/* ========================================
   HORIZONTAL RULE
   ======================================== */

hr {
  border: none;
  height: 1px;
  background: linear-gradient(
    to right,
    transparent,
    var(--color-border),
    transparent
  );
  margin: var(--space-8) 0;
}

/* ========================================
   SELECTION
   ======================================== */

::selection {
  background-color: var(--ocean-light);
  color: var(--midnight);
}

/* ========================================
   UTILITY CLASSES — SPACING
   ======================================== */

/* Margin utilities */
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mt-12 { margin-top: var(--space-12); }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }
.mb-12 { margin-bottom: var(--space-12); }

.my-0 { margin-top: 0; margin-bottom: 0; }
.my-4 { margin-top: var(--space-4); margin-bottom: var(--space-4); }
.my-8 { margin-top: var(--space-8); margin-bottom: var(--space-8); }

.mx-auto { margin-left: auto; margin-right: auto; }

/* Padding utilities */
.p-0 { padding: 0; }
.p-2 { padding: var(--space-2); }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }

.py-4 { padding-top: var(--space-4); padding-bottom: var(--space-4); }
.py-8 { padding-top: var(--space-8); padding-bottom: var(--space-8); }
.py-12 { padding-top: var(--space-12); padding-bottom: var(--space-12); }
.py-16 { padding-top: var(--space-16); padding-bottom: var(--space-16); }

.px-4 { padding-left: var(--space-4); padding-right: var(--space-4); }
.px-6 { padding-left: var(--space-6); padding-right: var(--space-6); }

/* ========================================
   UTILITY CLASSES — TEXT
   ======================================== */

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

.text-primary { color: var(--color-text-primary); }
.text-secondary { color: var(--color-text-secondary); }
.text-muted { color: var(--color-text-muted); }
.text-ocean { color: var(--ocean); }
.text-coral { color: var(--coral); }
.text-jungle { color: var(--jungle); }

.font-normal { font-weight: var(--font-normal); }
.font-medium { font-weight: var(--font-medium); }
.font-semibold { font-weight: var(--font-semibold); }
.font-bold { font-weight: var(--font-bold); }

.uppercase { text-transform: uppercase; letter-spacing: var(--tracking-wide); }
.capitalize { text-transform: capitalize; }

/* ========================================
   UTILITY CLASSES — DISPLAY
   ======================================== */

.block { display: block; }
.inline-block { display: inline-block; }
.inline { display: inline; }
.hidden { display: none; }

.flex { display: flex; }
.inline-flex { display: inline-flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

/* ========================================
   UTILITY CLASSES — WIDTH & HEIGHT
   ======================================== */

.w-full { width: 100%; }
.max-w-prose { max-width: 65ch; }

/* ========================================
   UTILITY CLASSES — MISC
   ======================================== */

.rounded { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-full { border-radius: var(--radius-full); }

.shadow { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }

.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }

.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }

/* ========================================
   RESPONSIVE UTILITIES
   ======================================== */

@media (min-width: 640px) {
  .sm\:hidden { display: none; }
  .sm\:block { display: block; }
  .sm\:flex { display: flex; }
  .sm\:text-left { text-align: left; }
}

@media (min-width: 768px) {
  .md\:hidden { display: none; }
  .md\:block { display: block; }
  .md\:flex { display: flex; }
  .md\:text-left { text-align: left; }
}

@media (min-width: 1024px) {
  .lg\:hidden { display: none; }
  .lg\:block { display: block; }
  .lg\:flex { display: flex; }
}
