/* ============================================================
   LUCIA Reset + Base Styles + Utility Classes
   ============================================================ */

/* --- 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(--lc-font);
  font-size: var(--lc-text-body);
  font-weight: var(--lc-fw-regular);
  line-height: var(--lc-lh-body);
  color: var(--lc-text);
  background: var(--lc-bg-1);
}

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

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

a {
  color: inherit;
  text-decoration: none;
}

ul, ol { list-style: none; }
h1, h2, h3, h4, h5, h6 { font-weight: var(--lc-fw-bold); }
table { border-collapse: collapse; }

/* --- Typography Utilities --- */

.text-display {
  font-size: var(--lc-text-display);
  line-height: var(--lc-lh-tight);
  letter-spacing: var(--lc-ls-display);
  font-weight: var(--lc-fw-bold);
}

.text-h1 {
  font-size: var(--lc-text-h1);
  line-height: var(--lc-lh-tight);
  letter-spacing: var(--lc-ls-h1);
  font-weight: var(--lc-fw-bold);
}

.text-h2 {
  font-size: var(--lc-text-h2);
  line-height: var(--lc-lh-heading);
  letter-spacing: var(--lc-ls-h2);
  font-weight: var(--lc-fw-bold);
}

.text-h3 {
  font-size: var(--lc-text-h3);
  line-height: var(--lc-lh-heading);
  letter-spacing: var(--lc-ls-h3);
  font-weight: var(--lc-fw-semibold);
}

.text-h4 {
  font-size: var(--lc-text-h4);
  line-height: var(--lc-lh-heading);
  font-weight: var(--lc-fw-semibold);
}

.text-h5 {
  font-size: var(--lc-text-h5);
  line-height: var(--lc-lh-heading);
  font-weight: var(--lc-fw-medium);
}

.text-body { font-size: var(--lc-text-body); }
.text-small { font-size: var(--lc-text-small); }
.text-micro { font-size: var(--lc-text-micro); }
.text-nano { font-size: var(--lc-text-nano); }

.text-accent { font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }
.text-mono { font-family: var(--lc-font-mono); }

.text-label {
  font-size: var(--lc-text-micro);
  font-weight: var(--lc-fw-medium);
  letter-spacing: var(--lc-ls-label);
  text-transform: uppercase;
}

.text-tag {
  font-size: var(--lc-text-nano);
  font-weight: var(--lc-fw-medium);
  letter-spacing: var(--lc-ls-tag);
  text-transform: uppercase;
}

/* --- Color Utilities --- */

.color-primary { color: var(--lc-text); }
.color-light { color: var(--lc-text-light); }
.color-secondary { color: var(--lc-text-secondary); }
.color-muted { color: var(--lc-text-muted); }
.color-accent { color: var(--lc-accent); }
.color-green { color: var(--lc-green); }
.color-amber { color: var(--lc-amber); }
.color-red { color: var(--lc-red); }

/* --- Layout Utilities --- */

.container {
  width: 100%;
  max-width: var(--lc-container);
  margin: 0 auto;
  padding: 0 var(--lc-space-10);
}

.container-sm { max-width: var(--lc-container-sm); }
.container-lg { max-width: var(--lc-container-lg); }

.flex { display: 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-1 { gap: var(--lc-space-1); }
.gap-2 { gap: var(--lc-space-2); }
.gap-3 { gap: var(--lc-space-3); }
.gap-4 { gap: var(--lc-space-4); }
.gap-6 { gap: var(--lc-space-6); }
.gap-8 { gap: var(--lc-space-8); }
.gap-12 { gap: var(--lc-space-12); }
.gap-16 { gap: var(--lc-space-16); }

.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.w-full { width: 100%; }
.h-full { height: 100%; }
.relative { position: relative; }
.absolute { position: absolute; }
.overflow-hidden { overflow: hidden; }

/* --- Component Utilities --- */

.lc-card {
  background: var(--lc-bg-2);
  border-radius: var(--lc-radius-md);
  padding: var(--lc-space-6);
  transition: background var(--lc-duration-fast) ease-in-out;
}

.lc-card:hover {
  background: var(--lc-bg-4);
}

.lc-card--flat {
  background: var(--lc-bg-2);
  border-radius: var(--lc-radius-md);
  padding: var(--lc-space-6);
}

.lc-surface {
  background: var(--lc-bg-2);
  border-radius: var(--lc-radius-md);
}

.lc-surface--dark {
  background: var(--lc-dark-2);
}

/* --- Button Base --- */

.lc-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--lc-space-2);
  padding: 12px 16px;
  font-family: var(--lc-font);
  font-size: var(--lc-text-small);
  font-weight: var(--lc-fw-medium);
  border: none;
  border-radius: var(--lc-radius-sm);
  cursor: pointer;
  overflow: hidden;
  transition: all var(--lc-duration-normal) var(--lc-ease);
  white-space: nowrap;
}

.lc-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity var(--lc-duration-normal) var(--lc-ease);
  z-index: 0;
  pointer-events: none;
}

.lc-btn:hover::before { opacity: 1; }
.lc-btn > * { position: relative; z-index: 1; }

/* Primary: dark on light bg */
.lc-btn--primary {
  background: var(--lc-dark-1);
  color: var(--lc-text-light);
}
.lc-btn--primary::before { background: var(--lc-dark-3); }

/* Light: warm cream on dark bg */
.lc-btn--light {
  background: var(--lc-bg-1);
  color: var(--lc-text);
}
.lc-btn--light::before { background: var(--lc-bg-4); }

/* Accent: blue CTA */
.lc-btn--accent {
  background: var(--lc-accent);
  color: #fff;
}
.lc-btn--accent::before { background: var(--lc-accent-hover); }

/* Ghost: transparent */
.lc-btn--ghost {
  background: var(--lc-btn-ghost);
  color: inherit;
}
.lc-btn--ghost::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid var(--lc-btn-ghost-border);
  border-radius: inherit;
  pointer-events: none;
}
.lc-btn--ghost::before { background: var(--lc-bg-4); }

/* Pill shape */
.lc-btn--pill { border-radius: var(--lc-radius-pill); }

/* Small */
.lc-btn--sm {
  padding: 8px 12px;
  font-size: var(--lc-text-micro);
}

/* Large */
.lc-btn--lg {
  padding: 14px 32px;
  font-size: var(--lc-text-body);
}

/* --- Badge --- */

.lc-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--lc-radius-pill);
  font-size: var(--lc-text-nano);
  font-weight: var(--lc-fw-medium);
  letter-spacing: var(--lc-ls-label);
  text-transform: uppercase;
  line-height: 1;
}

.lc-badge--green { background: var(--lc-accent-light); color: var(--lc-accent); }
.lc-badge--amber { background: var(--lc-bg-3); color: var(--lc-text-secondary); }
.lc-badge--red { background: var(--lc-dark-1); color: var(--lc-text-light); }
.lc-badge--blue { background: var(--lc-accent-light); color: var(--lc-accent); }
.lc-badge--neutral { background: var(--lc-bg-3); color: var(--lc-text-secondary); }

/* --- Dashed Line Component --- */

.lc-line {
  width: 100%;
  height: 1px;
  pointer-events: none;
  flex: none;
}

.lc-line--dashed { background: var(--lc-line-dash-h); }
.lc-line--solid { background: var(--lc-line-solid); }

.lc-line--vertical {
  width: 1px;
  height: 100%;
  background: var(--lc-line-dash-v);
}

.lc-line--full {
  width: 100vw;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
}

.lc-line--masked {
  mask-image: var(--lc-line-mask);
  -webkit-mask-image: var(--lc-line-mask);
}

/* --- Scroll Reveal --- */

.js-ready .lc-reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.6s var(--lc-ease), transform 0.6s var(--lc-ease);
}

.js-ready .lc-reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* --- Skeleton Loading --- */

.lc-skeleton {
  position: relative;
  overflow: hidden;
  background: var(--lc-bg-3);
  border-radius: var(--lc-radius-sm);
}

.lc-skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(
    90deg,
    transparent 0,
    rgba(255, 255, 255, 0.15) 20%,
    rgba(255, 255, 255, 0.3) 60%,
    transparent
  );
  animation: lc-shimmer 2s infinite;
}

@keyframes lc-shimmer {
  to { transform: translateX(100%); }
}

/* --- Reduced Motion --- */

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

/* --- Responsive --- */

@media (max-width: 1024px) {
  .container { padding: 0 var(--lc-space-6); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .hide-tablet { display: none; }
}

@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .hide-mobile { display: none; }
}
