/* ============================================================
   Nori · дизайн-токены и база
   ============================================================ */

:root {
  --blue: #4285f4;
  --violet: #9b72cb;
  --pink: #d96570;
  --green: #34a853;
  --yellow: #fbbc04;
  --red: #ea4335;

  --grad: linear-gradient(115deg, #4285f4 0%, #7c6cf0 32%, #9b72cb 62%, #d96570 100%);
  --grad-soft: linear-gradient(115deg, rgba(66, 133, 244, .16), rgba(155, 114, 203, .16), rgba(217, 101, 112, .16));

  --r-xs: 8px;
  --r-sm: 12px;
  --r-md: 18px;
  --r-lg: 26px;
  --r-xl: 34px;
  --r-full: 999px;

  --ease: cubic-bezier(.2, 0, 0, 1);
  --ease-out: cubic-bezier(.05, .7, .1, 1);
  --sans: 'Inter', 'Google Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

html[data-theme='light'] {
  --bg: #ffffff;
  --bg-tint: #f6f8fd;
  --surface: #ffffff;
  --surface-2: #f1f4fa;
  --surface-3: #e6ebf5;
  --line: #dfe4ee;
  --line-soft: #eaeef6;
  --text: #17191d;
  --text-2: #474e5a;
  --text-3: #767e8c;
  --accent: #1b62d6;
  --shadow-1: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 14px rgba(16, 24, 40, .06);
  --shadow-2: 0 12px 40px rgba(16, 24, 40, .12);
  --glow: 0 0 0 1px rgba(66, 133, 244, .18), 0 10px 40px rgba(66, 133, 244, .18);
  --code-bg: #f7f9fc;
}

html[data-theme='dark'] {
  --bg: #0c0e13;
  --bg-tint: #10131a;
  --surface: #14181f;
  --surface-2: #1a1f28;
  --surface-3: #232935;
  --line: #262d39;
  --line-soft: #1d232d;
  --text: #eef1f7;
  --text-2: #b3bbc9;
  --text-3: #808a99;
  --accent: #8ab4f8;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 20px rgba(0, 0, 0, .28);
  --shadow-2: 0 18px 50px rgba(0, 0, 0, .5);
  --glow: 0 0 0 1px rgba(138, 180, 248, .16), 0 10px 40px rgba(66, 133, 244, .16);
  --code-bg: #0f131a;
}

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

/* Атрибут hidden должен побеждать любые display из компонентов. */
[hidden] { display: none !important; }

/* Иконки переключателя темы */
html[data-theme='dark'] .i-sun { display: block; }
html[data-theme='dark'] .i-moon { display: none; }
html[data-theme='light'] .i-sun { display: none; }
html[data-theme='light'] .i-moon { display: block; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-wrap: break-word;
}

h1, h2, h3, h4 { line-height: 1.18; letter-spacing: -.022em; margin: 0; font-weight: 600; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
textarea, input { font: inherit; color: inherit; }
img, svg { display: block; max-width: 100%; }

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  border-radius: 6px;
}

::selection { background: rgba(66, 133, 244, .24); }

* { scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: var(--surface-3);
  border-radius: var(--r-full);
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

.grad-text {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

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

/* Кнопки ------------------------------------------------------ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 46px; padding: 0 22px;
  border-radius: var(--r-full);
  font-size: 15px; font-weight: 550; letter-spacing: -.01em;
  transition: transform .18s var(--ease), box-shadow .25s var(--ease), background .2s var(--ease), opacity .2s;
  white-space: nowrap; user-select: none;
}
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 6px 22px rgba(80, 100, 220, .34); }
.btn-primary:hover { box-shadow: 0 10px 30px rgba(80, 100, 220, .46); text-decoration: none; }
.btn-ghost { background: var(--surface-2); color: var(--text); }
.btn-ghost:hover { background: var(--surface-3); text-decoration: none; }
.btn-outline { border: 1px solid var(--line); color: var(--text); }
.btn-outline:hover { background: var(--surface-2); text-decoration: none; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px; border-radius: var(--r-full);
  color: var(--text-2);
  transition: background .18s var(--ease), color .18s var(--ease), transform .18s var(--ease);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn:active { transform: scale(.92); }

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