/* Local fonts integration */
/* Commissioner (cyrillic + latin) */
@font-face {
  font-family: 'Commissioner';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/commissioner-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Commissioner';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/commissioner-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* Manrope (cyrillic + latin) */
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url('../fonts/manrope-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url('../fonts/manrope-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Tabler Icons base alignment */
.ti {
    font-size: 1.2em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    line-height: 1;
}

/* Optical alignment: shift icons down strictly inside buttons */
.btn .ti {
    position: relative;
    top: 1px;
}

/* Extra optical alignment for specific icons that visually float upwards */
.btn .ti-plus,
.btn .ti-folder-plus,
.btn .ti-rocket {
    top: 2px;
}


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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-family: var(--font-sans);
    font-size: var(--font-size-base);
    line-height: var(--line-height);
    color: var(--text-primary);
    background-color: var(--bg-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ================================================================
   TYPOGRAPHY
   ================================================================ */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
}

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

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

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

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

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

strong {
    font-weight: 600;
}

code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    background: var(--accent-subtle);
    padding: 0.15em 0.4em;
    border-radius: var(--radius-sm);
}

hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: var(--space-6) 0;
}

/* ================================================================
   FORM ELEMENTS (base)
   ================================================================ */
input,
textarea,
select {
    font-family: var(--font-sans);
    font-size: var(--font-size-base);
    color: var(--text-primary);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-4);
    transition: border-color var(--transition), box-shadow var(--transition);
    width: 100%;
    outline: none;
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}

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

input:disabled,
textarea:disabled,
select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

textarea {
    resize: vertical;
    min-height: 100px;
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%235c6070' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--space-3) center;
    padding-right: var(--space-8);
}

/* Dark theme: lighter select arrow */
[data-theme="dark"] select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238b8fa3' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
}

label {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--space-1);
}

/* ================================================================
   BUTTONS (base — overridden in components.css)
   ================================================================ */
button {
    font-family: var(--font-sans);
    font-size: var(--font-size-base);
    cursor: pointer;
    border: none;
    outline: none;
    background: none;
    color: inherit;
}

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

/* ================================================================
   GLOBAL FOCUS RING
   ================================================================ */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Remove outline for mouse clicks, keep for keyboard */
:focus:not(:focus-visible) {
    outline: none;
}

/* ================================================================
   TABLES (base)
   ================================================================ */
table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    text-align: left;
    padding: var(--space-3) var(--space-4);
}

/* ================================================================
   IMAGES & MEDIA
   ================================================================ */
img, svg {
    max-width: 100%;
    display: block;
}

/* ================================================================
   LISTS
   ================================================================ */
ul, ol {
    padding-left: var(--space-6);
}

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

/* ================================================================
   SCROLLBAR STYLING
   ================================================================ */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: var(--radius-full);
}

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

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--text-muted) transparent;
}

/* ================================================================
   SELECTION
   ================================================================ */
::selection {
    background: var(--accent);
    color: var(--accent-text);
}

/* ================================================================
   UTILITY: hidden
   ================================================================ */
.hidden {
    display: none !important;
}

.skip-to-content {
    position: absolute;
    top: -100%;
    left: var(--space-4);
    z-index: 9999;
    padding: var(--space-2) var(--space-4);
    background: var(--accent);
    color: var(--accent-text);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 500;
    text-decoration: none;
    transition: top 0.15s ease;
}

.skip-to-content:focus {
    top: var(--space-2);
    color: var(--accent-text);
}

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

/* ================================================================
   PAGE TRANSITION (fade-in on route change)
   ================================================================ */
@keyframes page-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

#page-content {
    animation: page-fade-in 0.15s ease-out;
}

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