/* Узел Design System – Root Styles Entry Point */

/* Global CSS custom properties and foundational styles */

/* ========== IMPORTS ========== */
@import url("tokens/fonts.css");
@import url("tokens/colors.css");
@import url("tokens/typography.css");
@import url("tokens/spacing.css");
@import url("tokens/shadows.css");

/* ========== GLOBAL RESET & BASE STYLES ========== */

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: var(--size-base);
  font-weight: var(--weight-regular);
  line-height: var(--line-body);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  transition: background-color var(--transition-base),
              color var(--transition-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ========== TYPOGRAPHY BASE ========== */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  line-height: var(--line-display);
  letter-spacing: var(--letter-tight);
  margin-bottom: var(--space-4);
  color: var(--text-primary);
}

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

h2 {
  font-size: var(--size-display-lg);
}

h3 {
  font-size: var(--size-lg);
}

h4 {
  font-size: var(--size-md);
}

h5, h6 {
  font-size: var(--size-base);
}

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

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

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

a:focus-visible {
  outline: 2px solid var(--accent-focus);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

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

em, i {
  font-style: italic;
}

code {
  font-family: var(--font-mono);
  font-size: var(--size-sm);
  background-color: var(--bg-secondary);
  padding: 0.25em 0.5em;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
}

pre {
  background-color: var(--bg-secondary);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  margin-bottom: var(--space-6);
}

pre code {
  background-color: transparent;
  padding: 0;
  border-radius: 0;
}

/* ========== FORM ELEMENTS (Base) ========== */

input,
textarea,
select {
  font-family: var(--font-body);
  font-size: var(--size-base);
  color: var(--text-primary);
  background-color: var(--surface-inset);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-base);
  padding: var(--padding-input-y) var(--padding-input-x);
  box-shadow: var(--shadow-inset-sm);
  transition: border-color var(--transition-base),
              box-shadow var(--transition-base),
              background-color var(--transition-base);
}

input:hover,
textarea:hover,
select:hover {
  border-color: var(--border-secondary);
  background-color: var(--surface-hover);
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-focus);
  background-color: var(--surface-default);
}

input:disabled,
textarea:disabled,
select:disabled {
  background-color: var(--surface-disabled);
  color: var(--text-disabled);
  cursor: not-allowed;
  opacity: 0.6;
}

/* ========== BUTTONS (Base) ========== */

button {
  font-family: var(--font-body);
  font-size: var(--size-sm);
  font-weight: var(--weight-bold);
  line-height: var(--line-lg);
  cursor: pointer;
  border: none;
  border-radius: var(--radius-lg);
  padding: var(--padding-button-y) var(--padding-button-x);
  transition: box-shadow var(--transition-fast), background-color var(--transition-fast), transform var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--gap-sm);
  white-space: nowrap;
  user-select: none;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background-color: var(--surface-raised);
  color: var(--text-primary);
  box-shadow: var(--bevel-raised);
}

button:active:not(:disabled) {
  box-shadow: var(--bevel-pressed);
  transform: translateY(1px);
}

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

/* ========== LISTS ========== */

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

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

/* ========== TABLES ========== */

table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--space-6);
}

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

th {
  font-weight: var(--weight-semibold);
  background-color: var(--bg-secondary);
  color: var(--text-primary);
}

tr:hover {
  background-color: var(--bg-secondary);
}

/* ========== UTILITY CLASSES ========== */

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

@media (min-width: 640px) {
  .container {
    max-width: 640px;
  }
}

@media (min-width: 768px) {
  .container {
    max-width: 768px;
  }
}

@media (min-width: 1024px) {
  .container {
    max-width: 1024px;
  }
}

@media (min-width: 1280px) {
  .container {
    max-width: 1280px;
  }
}

/* Flexbox utilities */
.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.flex-row {
  flex-direction: row;
}

.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-start {
  justify-content: flex-start;
}

.justify-end {
  justify-content: flex-end;
}

/* Grid utilities */
.grid {
  display: grid;
}

/* Text utilities */
.text-center {
  text-align: center;
}

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

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

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Visibility utilities */
.hidden {
  display: none;
}

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

/* ========== RESPONSIVE HELPERS ========== */

@media (max-width: 767px) {
  .hidden-mobile {
    display: none;
  }
}

@media (min-width: 768px) {
  .hidden-desktop {
    display: none;
  }
}

/* Prevent layout shift from scrollbar */
html {
  overflow-y: scroll;
}
