/* Shared by the whole site: colors and fonts, the menu island, buttons. New colors and sizes go into :root here. */
:root {
  --paper: #f3eee4;
  --sheet: #fffcf6;
  --ink: #141312;
  --muted: #6b655a;
  --faint: #b3ab9c;
  --line: #e2dacb;
  --leaf: #f2b93b;
  --display: "Onest", system-ui, sans-serif;
  --sans: "Onest", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --side: clamp(16px, 3vw, 40px);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 17px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
.paper { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }
.leaf { fill: var(--leaf); width: 30px; height: 26px; flex: none; }

/* The menu is Sena's shelf at the notch (ui.js): a black island that opens with a spring into six cards */
.island {
  position: fixed; top: 12px; left: 50%; z-index: 20; transform: translateX(-50%);
  width: min(520px, calc(100% - 24px)); border-radius: 26px; background: var(--ink); color: var(--sheet);
  box-shadow: 0 18px 40px -18px #000c; overflow: hidden;
  transition: width .6s cubic-bezier(.3, 1.35, .45, 1), border-radius .5s, box-shadow .4s;
}
.island.open { width: min(860px, calc(100% - 24px)); border-radius: 30px; box-shadow: 0 40px 80px -30px #000d, 0 0 0 6px #f2b93b22; }
.nt-bar { display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 7px 0 10px; }
.brand { display: flex; align-items: center; gap: 9px; font: 700 16px var(--display); letter-spacing: -0.02em; flex: none; }
.nt-ring { position: relative; display: grid; place-items: center; width: 36px; height: 36px; }
.nt-ring svg:first-child { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.nt-ring circle { fill: none; stroke: #ffffff1c; stroke-width: 2.5; }
.nt-ring circle.p { stroke: var(--leaf); stroke-linecap: round; transition: stroke-dashoffset .2s; }
.nt-ring .leaf { width: 19px; height: 17px; animation: sway 6s ease-in-out infinite; transform-origin: 50% 90%; }
@keyframes sway { 50% { transform: rotate(-8deg); } }
.nt-now { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; height: 36px; border-radius: 999px; cursor: pointer; font: 500 14px var(--sans); color: #fffcf6d9; transition: background .3s; }
.nt-now:hover { background: #ffffff12; }
.nt-now b { font: 500 11px var(--mono); color: var(--leaf); }
.nt-chev { width: 8px; height: 8px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: rotate(45deg) translateY(-2px); transition: transform .4s var(--ease-out); opacity: .7; }
.island.open .nt-chev { transform: rotate(225deg) translateY(-2px); }
.nt-right { display: flex; align-items: center; gap: 4px; flex: none; }
.lang { font: 500 12px var(--mono); color: #fffcf6b3; background: none; border: 0; padding: 8px 10px; cursor: pointer; }
.lang:hover { color: var(--sheet); }
.gh { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--sheet); transition: background .3s, transform .3s var(--ease-out); }
.gh svg { width: 18px; height: 18px; fill: var(--ink); }
.gh:hover { background: var(--leaf); transform: rotate(-12deg); }
/* the opened shelf: six cards, the agents hop in one after another */
.nt-shelf { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .55s cubic-bezier(.3, 1.2, .45, 1); }
.island.open .nt-shelf { grid-template-rows: 1fr; }
.nt-grid { min-height: 0; overflow: hidden; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 0 10px; transition: padding .5s; }
.island.open .nt-grid { padding: 4px 10px 12px; }
.nt-grid a { position: relative; display: grid; grid-template-columns: 46px 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; padding: 12px; border-radius: 18px; background: #ffffff0d;
  opacity: 0; transform: translateY(-10px) scale(.96); transition: background .25s, opacity .35s, transform .45s var(--ease-out); }
.island.open .nt-grid a { opacity: 1; transform: none; }
.island.open .nt-grid a:nth-child(2) { transition-delay: .04s; } .island.open .nt-grid a:nth-child(3) { transition-delay: .08s; }
.island.open .nt-grid a:nth-child(4) { transition-delay: .12s; } .island.open .nt-grid a:nth-child(5) { transition-delay: .16s; } .island.open .nt-grid a:nth-child(6) { transition-delay: .2s; }
.nt-grid a:hover { background: #ffffff1f; }
.nt-grid a.here { background: var(--sheet); color: var(--ink); }
.nt-grid canvas.mini { grid-row: 1 / 3; width: 46px !important; height: 46px !important; }
.nt-grid b { position: absolute; right: 12px; top: 10px; font: 500 10.5px var(--mono); color: var(--leaf); }
.nt-grid span { font: 700 15px var(--display); letter-spacing: -0.02em; }
.nt-grid em { font-style: normal; font-size: 12px; color: #fffcf699; }
.nt-grid a.here em { color: var(--muted); } .nt-grid a.here b { color: var(--ink); }
/* Buttons: magnetic, with a fill that rises on hover */
.btn {
  position: relative; overflow: hidden; isolation: isolate;
  display: inline-flex; align-items: center; justify-content: center;
  height: 52px; padding: 0 26px; border-radius: 999px;
  font: 600 16px var(--sans); white-space: nowrap;
  transition: transform .35s var(--ease-out), color .35s;
}
.btn::before {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit;
  background: var(--leaf); transform: translateY(101%); transition: transform .45s var(--ease-out);
}
.btn:hover::before { transform: none; }
.btn-dark { background: var(--ink); color: var(--sheet); }
.btn-dark:hover { color: var(--ink); }
.btn-line { box-shadow: inset 0 0 0 1.5px var(--ink); }

/* Back to the portfolio (ui.js): white, in the top right corner, only for visitors who came from it */
.back-btn {
  position: fixed; top: 16px; right: 16px; z-index: 21; display: inline-flex; align-items: center; gap: 4px;
  height: 38px; padding: 0 14px 0 10px; border-radius: 999px; background: #ffffffe6; color: var(--ink);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  font: 600 13px var(--sans); letter-spacing: -0.01em; box-shadow: 0 6px 18px -10px #0005, 0 0 0 1px #00000014;
  transition: transform .3s var(--ease-out), background .2s;
}
.back-btn:hover { transform: translateX(-2px); background: #fff; }
.island.open ~ .back-btn { opacity: 0; pointer-events: none; }
.back-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

/* Nothing may stick out sideways (the spinning orbit layer, cursors, tags): a phone or a tablet would let the page pan or
   zoom out. On a desktop it changes nothing visible, body already hides what is past the edge. clip, not hidden: it makes no
   scroll container, so sticky and scrolling stay as they are */
main { overflow-x: clip; }
/* Tablet: the folded island is centred in the space left of the back button, so they never touch */
@media (min-width: 701px) and (max-width: 1000px) {
  .has-back .island:not(.open) { left: calc(50% - 61px); }
}
/* Phone */
@media (max-width: 700px) {
  .has-back .island { left: 12px; transform: none; width: calc(100% - 88px); }
  .back-btn { top: 12px; right: 12px; padding: 0; width: 40px; height: 40px; justify-content: center; } .back-btn span { display: none; }
  .nt-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* a long section name ("Инженерные решения") must not push the island past the screen: it is cut with an ellipsis */
  .nt-now { min-width: 0; } .nt-now #navName { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .nt-grid em { display: none; }
}
@media (max-width: 560px) {
  .lang { display: none; }
  .btn { height: 48px; padding: 0 20px; flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
