@layer base {
/* ═══ Base Element Styles ═══ */

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text);
  background-color: var(--parchment);
  background-image: var(--noise);
  background-repeat: repeat;
  background-size: 256px;
}

/* ─── Headings ─── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: var(--leading-tight);
  color: var(--ink);
  letter-spacing: var(--tracking-tight);
}

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

/* ─── Body Text ─── */
p {
  margin-bottom: var(--space-4);
  color: var(--text-secondary);
}

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

strong { font-weight: 600; color: var(--text); }
em     { font-style: italic; }

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

/* ─── Links ─── */
a {
  color: var(--berry);
  transition: color var(--duration-fast) var(--ease-out);
}

a:hover {
  color: var(--berry-vivid);
}

/* ─── Inputs ─── */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
input[type="tel"],
input[type="search"],
select,
textarea {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  color: var(--text);
  transition: border-color var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out);
}

input:focus, select:focus, textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-pale);
  outline: none;
}

input::placeholder, textarea::placeholder {
  color: var(--text-muted);
}

input[type="checkbox"] {
  width: auto;
  accent-color: var(--gold);
}

label {
  display: block;
  margin-bottom: var(--space-2);
  font-weight: 500;
  font-size: var(--text-sm);
  color: var(--text);
  letter-spacing: var(--tracking-wide);
}

/* ─── Tables ─── */
th {
  font-weight: 600;
  text-align: left;
}

/* ─── Horizontal Rule ─── */
hr {
  border: none;
  height: 1px;
  background: var(--border);
  margin: var(--space-8) 0;
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--parchment); }
::-webkit-scrollbar-thumb {
  background: var(--ink-20);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: var(--ink-40); }

/* ═══ Keyframe Animations ═══ */

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}

@keyframes twinkle {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50%      { opacity: 1; transform: scale(1.2); }
}

@keyframes shimmer {
  0%   { background-position: -200% center; }
  100% { background-position: 200% center; }
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 20px oklch(0.76 0.145 70 / 0.15); }
  50%      { box-shadow: 0 0 40px oklch(0.76 0.145 70 / 0.35); }
}

@keyframes spin-slow {
  to { transform: rotate(360deg); }
}

@keyframes progress-stripes {
  0% { background-position: 1rem 0; }
  100% { background-position: 0 0; }
}

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

}
