/* ==========================================================================
   Grantim — design tokens & base  (v2: bright, modern, student-friendly)
   Brand blue + sunny yellow + mint + coral on a cool light canvas.
   Legacy token names (--paper, --lapis, --teal, --saffron, --brick) are kept
   as aliases so every component picks up the new palette automatically.
   ========================================================================== */
:root {
  /* canvas */
  --bg: #f4f6fc;
  --bg-2: #eaeef9;
  --bg-3: #dfe5f4;
  --surface: #ffffff;
  --ink: #0f1b3d;
  --ink-2: #39446a;
  --muted: #6b7594;
  --line: #e2e7f3;
  --line-2: #cbd3e8;

  /* brand */
  --brand: #2b59ff;
  --brand-600: #1f47e0;
  --brand-700: #1838b8;
  --brand-900: #0d1d63;
  --brand-50: #edf2ff;
  --brand-100: #d8e2ff;
  --sun: #ffcb2f;
  --sun-50: #fff6d4;
  --sun-700: #9a6a00;
  --mint: #12b886;
  --mint-50: #e0f7ee;
  --mint-700: #04724f;
  --coral: #ff6b5b;
  --coral-50: #ffece9;
  --coral-700: #b93224;
  --sky: #38c3f0;
  --sky-50: #e3f6fd;

  /* legacy aliases */
  --paper: var(--bg);
  --paper-2: var(--bg-2);
  --paper-3: var(--bg-3);
  --lapis: var(--brand);
  --lapis-600: var(--brand-600);
  --lapis-800: var(--brand-700);
  --lapis-900: var(--brand-900);
  --lapis-50: var(--brand-50);
  --lapis-100: var(--brand-100);
  --teal: var(--mint);
  --teal-50: var(--mint-50);
  --teal-100: #bfeedd;
  --saffron: var(--sun);
  --saffron-600: #f0b400;
  --saffron-800: var(--sun-700);
  --saffron-50: var(--sun-50);
  --brick: var(--coral);
  --brick-50: var(--coral-50);

  --ok: var(--mint);
  --warn: var(--sun-700);
  --bad: var(--coral);

  --r-xs: 8px;
  --r-s: 12px;
  --r: 16px;
  --r-l: 24px;
  --r-xl: 32px;

  --shadow-1: 0 1px 2px rgb(15 27 61 / 0.06), 0 1px 1px rgb(15 27 61 / 0.03);
  --shadow-2: 0 2px 6px rgb(15 27 61 / 0.05), 0 16px 32px -18px rgb(15 27 61 / 0.3);
  --shadow-3: 0 28px 64px -24px rgb(13 29 99 / 0.42);
  --shadow-brand: 0 14px 30px -12px rgb(43 89 255 / 0.55);

  --font-display: "Bricolage Grotesque", "Onest", ui-sans-serif, system-ui, sans-serif;
  --font-ui: "Onest", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --container: 1240px;
  --gutter: 16px;
  --header-h: 64px;
  --tabbar-h: 0px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  --dots: radial-gradient(rgb(43 89 255 / 0.13) 1.2px, transparent 1.4px);
  --girih: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72' viewBox='0 0 72 72'%3E%3Cg fill='none' stroke='%232b59ff' stroke-opacity='.08' stroke-width='1.1'%3E%3Crect x='23' y='23' width='26' height='26'/%3E%3Crect x='23' y='23' width='26' height='26' transform='rotate(45 36 36)'/%3E%3Ccircle cx='36' cy='36' r='5.5'/%3E%3C/g%3E%3C/svg%3E");
  --girih-light: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72' viewBox='0 0 72 72'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.1' stroke-width='1.1'%3E%3Crect x='23' y='23' width='26' height='26'/%3E%3Crect x='23' y='23' width='26' height='26' transform='rotate(45 36 36)'/%3E%3Ccircle cx='36' cy='36' r='5.5'/%3E%3C/g%3E%3C/svg%3E");

  color-scheme: light;
}

@media (min-width: 640px) { :root { --gutter: 24px; } }
@media (min-width: 1024px) { :root { --gutter: 32px; --header-h: 72px; } }
@media (max-width: 899px) { :root { --tabbar-h: 66px; } }

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 12px);
  background: var(--paper);
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
}

img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
p { margin: 0 0 1em; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.15; text-wrap: balance; }
ul, ol { margin: 0; padding: 0; list-style: none; }
table { border-collapse: collapse; width: 100%; }
hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }
[hidden] { display: none !important; }

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

::selection { background: var(--saffron-50); color: var(--ink); }

.ic {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ic-s { width: 16px; height: 16px; }
.ic-l { width: 24px; height: 24px; }
.ic-xl { width: 32px; height: 32px; stroke-width: 1.5; }

.display { font-family: var(--font-display); font-optical-sizing: auto; letter-spacing: -0.02em; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.container {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip-link {
  position: fixed; left: 12px; top: -60px; z-index: 200;
  background: var(--ink); color: #fff; padding: 10px 14px; border-radius: var(--r-s);
}
.skip-link:focus { top: 12px; }

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

/* View transition between pages (progressive enhancement) */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.22s; }

/* Long words (Russian compounds, long university names) never push the page sideways.
   break-word only splits a word that cannot fit on a line by itself — normal words stay whole. */
h1, h2, h3, .pick span, .chip, .uni-card h3 { overflow-wrap: break-word; }
html[lang='ru'] h1, html[lang='ru'] h2, html[lang='ru'] h3, html[lang='ru'] .pick span { hyphens: auto; }
.pick { min-width: 0; }
.pick span { min-width: 0; }
