@import './design-system/design-tokens.css';
@import './design-system/breakpoints.css';
@import './design-system/themes.css';
@import './design-system/animations.css';
@import './design-system/components.css';
@import './design-system/component-specific.css';
@import './design-system/theme-components.css';
@import './design-system/utilities.css';

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

html {
  font-family: var(--font-primary);
  scroll-behavior: smooth;
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
  transition: background-color var(--duration-300) var(--ease-out),
              color var(--duration-300) var(--ease-out);
}

body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  line-height: var(--leading-normal);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  width: 100%;
  max-width: 100vw;
  position: relative;
  transition: background-color var(--duration-300) var(--ease-out),
              color var(--duration-300) var(--ease-out);
}

.container,
[class*="container"],
[class*="section"],
section {
  max-width: 100%;
  overflow-x: hidden;
}

*[style*="transform"],
*[class*="slide"],
*[class*="slider"] {
  backface-visibility: hidden;
  transform-style: preserve-3d;
}

[data-slider] {
  contain: layout style paint;
  isolation: isolate;
}

.gpu-accelerated {
  transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
  will-change: transform;
}

.no-transition,
.no-transition *,
.no-transition *:before,
.no-transition *:after {
  transition: none !important;
  animation: none !important;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: var(--border-2) solid var(--focus-ring);
  outline-offset: var(--space-1);
}

button,
[role="button"],
.interactive {
  cursor: pointer;
  transition: var(--transition-base);
}

button:disabled,
[role="button"][aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
}

input,
textarea,
select {
  font-family: var(--font-primary);
  color: var(--text-primary);
  background-color: var(--bg-secondary);
  border: var(--border-1) solid var(--border-primary);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  transition: var(--transition-colors);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 var(--border-1) var(--accent-light);
}

input:disabled,
textarea:disabled,
select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background-color: var(--bg-tertiary);
}

::placeholder {
  color: var(--text-muted);
  opacity: 1;
}

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

::-moz-placeholder {
  color: var(--text-muted);
  opacity: 1;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--text-primary);
  line-height: var(--leading-tight);
  margin: 0;
}

h1 { font-size: var(--text-4xl); font-weight: var(--font-light); }
h2 { font-size: var(--text-3xl); font-weight: var(--font-light); }
h3 { font-size: var(--text-2xl); font-weight: var(--font-normal); }
h4 { font-size: var(--text-xl); font-weight: var(--font-normal); }
h5 { font-size: var(--text-lg); font-weight: var(--font-medium); }
h6 { font-size: var(--text-base); font-weight: var(--font-medium); }

p {
  font-family: var(--font-primary);
  color: var(--text-primary);
  line-height: var(--leading-normal);
  margin: 0 0 var(--space-4) 0;
}

a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: var(--transition-colors);
}

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

ul, ol {
  color: var(--text-primary);
  padding-left: var(--space-6);
}

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

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

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--accent-primary);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-hover);
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--accent-primary) var(--bg-secondary);
}

::selection {
  background-color: var(--selection-bg);
  color: var(--selection-text);
}

::-moz-selection {
  background-color: var(--selection-bg);
  color: var(--selection-text);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(var(--space-5));
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInFromLeft {
  from {
    opacity: 0;
    transform: translateX(calc(-1 * var(--space-8)));
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInFromRight {
  from {
    opacity: 0;
    transform: translateX(var(--space-8));
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.fade-in {
  animation: fadeIn var(--duration-500) var(--ease-out);
}

.slide-in-left {
  animation: slideInFromLeft var(--duration-500) var(--ease-out);
}

.slide-in-right {
  animation: slideInFromRight var(--duration-500) var(--ease-out);
}

.skip-link {
  position: absolute;
  top: calc(-1 * var(--space-10));
  left: var(--space-2);
  background: var(--bg-primary);
  color: var(--text-primary);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  text-decoration: none;
  z-index: var(--z-toast);
  transition: var(--transition-fast);
  border: var(--border-2) solid var(--accent-primary);
}

.skip-link:focus {
  top: var(--space-2);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.theme-transition,
.theme-transition *,
.theme-transition *::before,
.theme-transition *::after {
  transition: background-color var(--duration-300) var(--ease-out),
              color var(--duration-300) var(--ease-out),
              border-color var(--duration-300) var(--ease-out),
              box-shadow var(--duration-300) var(--ease-out) !important;
}

.safe-area-top {
  padding-top: env(safe-area-inset-top);
}

.safe-area-bottom {
  padding-bottom: env(safe-area-inset-bottom);
}

.safe-area-left {
  padding-left: env(safe-area-inset-left);
}

.safe-area-right {
  padding-right: env(safe-area-inset-right);
}

.h-screen-dynamic {
  height: 100vh;
  height: 100dvh;
}

.min-h-screen-dynamic {
  min-height: 100vh;
  min-height: 100dvh;
}

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-overlay);
  backdrop-filter: var(--backdrop-blur);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition-base);
}

.loading-overlay.show {
  opacity: 1;
  visibility: visible;
}

body[data-debug-breakpoints="true"] {
  position: relative;
}

body[data-debug-breakpoints="true"]:before {
  content: attr(data-current-breakpoint);
  position: fixed;
  top: var(--space-3);
  right: var(--space-3);
  background: var(--glass-bg);
  backdrop-filter: var(--backdrop-blur);
  color: var(--text-primary);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  z-index: var(--z-toast);
  pointer-events: none;
  border: var(--border-1) solid var(--accent-primary);
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

@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;
  }
}

@media (prefers-contrast: high) {

}

@media (prefers-color-scheme: dark) {

}

@media print {
  * {
    background: transparent !important;
    color: black !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }
  
  body {
    font-size: 12pt;
    line-height: 1.5;
  }
  
  h1, h2, h3, h4, h5, h6 {
    color: black !important;
    page-break-after: avoid;
  }
  
  p {
    orphans: 3;
    widows: 3;
  }
  
  a {
    text-decoration: underline;
  }
  
  .no-print {
    display: none !important;
  }
}