/* =========================
   Nimbus — pixel-art team site
   ========================= */

/* ---------- Fonts ---------- */
@font-face {
  font-family: "Pixelify Sans";
  src: url("../fonts/pixelify-cyrillic.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Pixelify Sans";
  src: url("../fonts/pixelify-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Golos Text";
  src: url("../fonts/golos-cyrillic.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Golos Text";
  src: url("../fonts/golos-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Tokens ---------- */
:root {
  --bg: #0B0F2A;
  --bg-deep: #05081A;
  --header-bg: #080836;
  --neon: #4F52DB;
  --neon-soft: rgba(79, 82, 219, 0.35);
  --neon-glow: rgba(79, 82, 219, 0.6);
  --building: #0B0032;
  --attic: #0A0030;
  --text: #F5F7FF;
  --text-muted: #B7BCE6;
  --text-dim: #7A82C4;
  --panel: rgba(11, 0, 50, 0.72);
  --panel-border: rgba(79, 82, 219, 0.55);
  --radius: 0px;
  --font-pixel: "Pixelify Sans", "Press Start 2P", monospace;
  --font-body: "Golos Text", "Segoe UI", system-ui, sans-serif;
  --container: 1200px;
  --building-w: 1047px;
  --gap: 24px;
  --shadow-neon: 0 0 0 2px var(--neon), 0 0 24px var(--neon-glow);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(1px 1px at 12px 18px, rgba(255,255,255,0.85), transparent 2px),
    radial-gradient(1px 1px at 47px 92px, rgba(255,255,255,0.55), transparent 2px),
    radial-gradient(1px 1px at 133px 41px, rgba(255,255,255,0.7), transparent 2px),
    radial-gradient(1px 1px at 178px 160px, rgba(255,255,255,0.45), transparent 2px),
    radial-gradient(2px 2px at 95px 200px, rgba(180,190,255,0.6), transparent 3px);
  background-size: 220px 220px;
  background-repeat: repeat;
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; image-rendering: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4 { margin: 0; font-family: var(--font-pixel); font-weight: 600; letter-spacing: 0.02em; }
p { margin: 0; }
:focus-visible { outline: 3px solid var(--neon); outline-offset: 3px; }
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 1000;
  padding: 8px 12px; background: var(--header-bg); color: var(--text);
}
.skip-link:focus { left: 12px; top: 12px; }

/* ---------- Header ---------- */
.site-header {
  background: var(--header-bg);
  border-bottom: 2px solid var(--neon);
  min-height: 127px;
  display: flex;
  align-items: center;
}
.site-header__inner {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 24px 32px;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 16px; }
.brand-mark {
  width: 76px; height: 76px;
  border-radius: 50%;
  background: #FFFFFF;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  box-shadow: 0 0 0 2px var(--neon), 0 0 18px var(--neon-soft);
  overflow: hidden;
}
.brand-mark__img {
  width: 62%;
  height: auto;
  image-rendering: pixelated;
}
.brand-wordmark { height: 28px; width: auto; }
.site-header__subtitle {
  font-family: var(--font-pixel);
  font-size: clamp(16px, 1.9vw, 26px);
  color: #DCE2FF;
  margin-left: auto;
  max-width: 520px;
  text-align: right;
  line-height: 1.3;
  text-shadow: 0 0 12px rgba(79, 82, 219, 0.55);
  letter-spacing: 0.02em;
}

/* ---------- Page / building ---------- */
.page { padding: 0 0 0; }
.hero { padding: 173px 0 0; }
.building {
  width: min(var(--building-w), calc(100vw - 32px));
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Attic */
.building__attic {
  position: relative;
  width: 100%;
  aspect-ratio: 1047 / 281;
}
.building__attic-roof {
  position: absolute;
  inset: 0;
  background: var(--attic);
  clip-path: polygon(6.72% 0%, 93.28% 0%, 100% 100%, 0% 100%);
  border: none;
}
.building__attic-room {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  width: 97.7%;
  height: 100%;
  display: block;
}
.building__art--attic {
  width: 100%;
  height: 100%;
  object-fit: fill;
}
.building__robot {
  position: absolute;
  right: 12%;
  bottom: 8%;
  width: 21%;
  height: auto;
  aspect-ratio: 1 / 1;
  filter: drop-shadow(0 6px 12px rgba(0,0,0,0.6));
  animation: robot-float 3.2s ease-in-out infinite;
  pointer-events: none;
}
@keyframes robot-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* Grid */
.building__grid {
  width: 100%;
  background: var(--building);
  padding: 24px 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.building__floor {
  display: grid;
  gap: 24px;
  padding: 0 0;
  width: 100%;
}
.building__floor--top { grid-template-columns: repeat(3, 1fr); }
.building__floor--bottom { grid-template-columns: 248fr 505fr 248fr; }

/* Room cards */
.room-card {
  position: relative;
  display: block;
  overflow: hidden;
  border: none;
  background: #1a1a3e;
  transition: transform 0.22s ease, box-shadow 0.22s ease, filter 0.22s ease;
  isolation: isolate;
}
.room-card__media { display: block; }
.room-card__media img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.3s ease;
}
.room-card:hover, .room-card:focus-visible {
  transform: translateY(-4px);
  box-shadow: var(--shadow-neon);
  z-index: 2;
}
.room-card:hover .room-card__media img,
.room-card:focus-visible .room-card__media img {
  transform: scale(1.03);
}
.room-card__label {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 12px 14px 14px;
  background: linear-gradient(180deg, transparent 0%, rgba(8, 8, 54, 0.92) 70%);
  color: var(--text);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.22s ease, transform 0.22s ease;
  pointer-events: none;
}
.room-card:hover .room-card__label,
.room-card:focus-visible .room-card__label {
  opacity: 1;
  transform: translateY(0);
}
.room-card__name {
  display: block;
  font-family: var(--font-pixel);
  font-size: 15px;
  color: #fff;
  text-shadow: 0 1px 0 rgba(0,0,0,0.6);
}
.room-card__role {
  display: block;
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.room-card--narrow .room-card__name { font-size: 14px; }
.room-card--hub { cursor: pointer; }
.room-card--hub .room-card__media img {
  box-shadow: inset 0 0 0 5px var(--neon);
}
.room-card__label--hub .room-card__name { color: #FFD84D; }

/* Basement */
.basement {
  position: relative;
  width: min(var(--building-w), calc(100vw - 32px));
  margin: 0 auto;
  aspect-ratio: 1047 / 170;
  overflow: hidden;
}
.basement__art {
  width: 100%;
  height: 100%;
  object-fit: fill;
}
.basement__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 48px;
  gap: 16px;
}
.basement__title {
  font-size: clamp(16px, 2vw, 26px);
  color: #fff;
  text-shadow: 0 2px 0 rgba(0,0,0,0.7), 0 0 12px var(--neon-glow);
}
.basement__cta {
  font-family: var(--font-pixel);
  font-size: 14px;
  padding: 12px 22px;
  background: var(--neon);
  color: #fff;
  border: 2px solid #fff;
  box-shadow: 0 0 16px var(--neon-glow);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.basement__cta:hover, .basement__cta:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 0 24px var(--neon-glow);
}

/* Underground */
.underground {
  position: relative;
  width: 100%;
  height: 120px;
  overflow: hidden;
  margin-top: 0;
}
.underground__art {
  position: absolute;
  top: -150px;
  left: 50%;
  transform: translateX(-50%);
  width: 1200px;
  height: 334px;
  max-width: none;
}

/* ---------- Modals (native dialog) ---------- */
.modal {
  border: none;
  padding: 0;
  background: transparent;
  max-width: 100vw;
  max-height: 100vh;
}
.modal::backdrop {
  background: rgba(3, 4, 20, 0.78);
  backdrop-filter: blur(2px);
}
.modal__panel {
  position: relative;
  width: min(920px, calc(100vw - 32px));
  max-height: 88vh;
  overflow: auto;
  margin: auto;
  padding: 28px 32px 32px;
  background: var(--building);
  border: 2px solid var(--neon);
  box-shadow: 0 0 40px var(--neon-glow);
  color: var(--text);
}
.modal__close {
  position: absolute;
  top: 10px; right: 14px;
  width: 36px; height: 36px;
  font-family: var(--font-pixel);
  font-size: 22px;
  line-height: 1;
  color: var(--text);
  background: rgba(79,82,219,0.18);
  border: 1px solid var(--neon);
  transition: background 0.15s ease;
}
.modal__close:hover, .modal__close:focus-visible { background: var(--neon); }
.modal__title {
  font-size: clamp(18px, 2.4vw, 26px);
  color: #fff;
  text-shadow: 0 0 12px var(--neon-glow);
}
.modal__lead { margin-top: 6px; color: var(--text-muted); font-size: 14px; }
.modal__members {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}
.modal__member {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: rgba(79,82,219,0.08);
  border: 1px solid var(--panel-border);
}
.modal__avatar {
  width: 64px; height: 64px;
  object-fit: cover;
  border: 2px solid var(--neon);
  flex-shrink: 0;
}
.modal__member-name { font-size: 14px; color: #fff; }
.modal__member-role { font-size: 12px; color: var(--text-muted); margin-top: 2px; font-family: var(--font-body); }
.modal__skills { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px; }
.modal__skills li {
  font-family: var(--font-pixel);
  font-size: 10px;
  padding: 3px 7px;
  background: rgba(79,82,219,0.22);
  border: 1px solid var(--neon);
  color: var(--text);
}
.modal__block { margin-top: 22px; }
.modal__block-title { font-size: 15px; color: #FFD84D; margin-bottom: 8px; }
.modal__projects li { margin-bottom: 10px; display: flex; flex-direction: column; gap: 2px; }
.modal__projects strong { font-family: var(--font-pixel); font-size: 13px; color: #fff; }
.modal__projects span { font-size: 13px; color: var(--text-muted); }
.modal__projects small { font-size: 11px; color: var(--text-dim); }
.modal__empty { color: var(--text-muted); font-size: 13px; }
.modal__all-skills { display: flex; flex-wrap: wrap; gap: 6px; }
.modal__all-skills li {
  font-size: 12px; padding: 4px 9px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.18);
  color: var(--text);
}
.contacts-list { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.contacts-list__item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  background: rgba(79,82,219,0.08);
  border: 1px solid var(--panel-border);
}
.contacts-list__avatar { width: 44px; height: 44px; object-fit: cover; border: 1px solid var(--neon); }
.contacts-list__info { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.contacts-list__name { font-family: var(--font-pixel); font-size: 13px; color: #fff; }
.contacts-list__role { font-size: 11px; color: var(--text-muted); }
.contacts-list__link {
  font-family: var(--font-pixel); font-size: 12px;
  padding: 8px 14px; background: var(--neon); color: #fff;
  border: 1px solid #fff;
  transition: transform 0.15s ease;
}
.contacts-list__link:hover, .contacts-list__link:focus-visible { transform: translateY(-1px); }

/* ---------- Room page ---------- */
.room-page { max-width: var(--container); margin: 0 auto; padding: 24px 16px 48px; }
.room-nav {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 20px;
}
.room-nav__back, .room-nav__link {
  font-family: var(--font-pixel); font-size: 13px;
  padding: 8px 14px; border: 1px solid var(--neon);
  background: rgba(79,82,219,0.12); color: var(--text);
  transition: background 0.15s ease;
}
.room-nav__back:hover, .room-nav__link:hover,
.room-nav__back:focus-visible, .room-nav__link:focus-visible { background: var(--neon); }
.room-nav__switch { display: flex; gap: 8px; }
.room-hero {
  position: relative;
  background: var(--building);
  border: 2px solid var(--neon);
  overflow: hidden;
  margin-bottom: 24px;
}
.room-hero__media { width: 100%; aspect-ratio: 1047 / 281; overflow: hidden; }
.room-hero__media img { width: 100%; height: 100%; object-fit: cover; }
.room-hero__card {
  display: flex; align-items: center; gap: 20px;
  padding: 20px 24px;
  background: linear-gradient(180deg, transparent, rgba(8,8,54,0.9));
  border-top: 2px solid var(--neon);
}
.room-hero__avatar {
  width: 112px; height: 112px; object-fit: cover;
  border: 3px solid var(--accent, var(--neon));
  box-shadow: 0 0 18px var(--neon-soft);
  flex-shrink: 0;
}
.room-hero__kicker { font-family: var(--font-pixel); font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.12em; }
.room-hero__name { font-size: clamp(20px, 3vw, 32px); color: #fff; margin-top: 4px; }
.room-hero__role { font-family: var(--font-body); font-size: 15px; color: var(--text-muted); margin-top: 4px; }
.room-hero__meta { display: flex; gap: 24px; margin-top: 10px; flex-wrap: wrap; }
.room-hero__meta div { display: flex; flex-direction: column; gap: 2px; }
.room-hero__meta dt { font-family: var(--font-pixel); font-size: 10px; color: var(--text-dim); text-transform: uppercase; }
.room-hero__meta dd { font-size: 13px; color: var(--text); }
.room-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}
.room-panel {
  padding: 20px 22px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(2px);
}
.room-panel__title { font-size: 16px; color: #FFD84D; margin-bottom: 10px; }
.room-panel__subtitle { font-size: 13px; color: var(--neon); margin: 14px 0 6px; }
.room-panel__text { font-size: 14px; color: var(--text); line-height: 1.6; }
.room-panel__text--muted { color: var(--text-muted); }
.room-panel__hint { font-size: 12px; color: var(--text-dim); margin-top: 10px; }
.skill-list { display: flex; flex-wrap: wrap; gap: 8px; }
.skill-list__item {
  font-family: var(--font-pixel); font-size: 11px;
  padding: 6px 10px;
  background: rgba(79,82,219,0.18);
  border: 1px solid var(--accent, var(--neon));
  color: var(--text);
}
.bullet-list { display: flex; flex-direction: column; gap: 8px; }
.bullet-list li {
  font-size: 14px; color: var(--text); padding-left: 18px; position: relative;
}
.bullet-list li::before {
  content: "▸"; position: absolute; left: 0; top: 0; color: var(--neon);
}
.room-contact {
  display: inline-flex; align-items: center; gap: 10px;
  margin-top: 8px; padding: 10px 18px;
  font-family: var(--font-pixel); font-size: 13px;
  background: var(--accent, var(--neon)); color: #fff;
  border: 2px solid #fff;
  transition: transform 0.18s ease;
}
.room-contact:hover, .room-contact:focus-visible { transform: translateY(-2px); }
.room-contact__icon {
  display: inline-grid; place-items: center;
  width: 28px; height: 28px; background: #fff; color: var(--accent, var(--neon));
  font-size: 11px; font-weight: 700;
}

/* ---------- 404 ---------- */
.error-page { min-height: 60vh; display: grid; place-items: center; padding: 40px 16px; }
.error-page__inner { text-align: center; max-width: 560px; }
.error-page__code { font-size: clamp(64px, 14vw, 120px); color: var(--neon); text-shadow: 0 0 24px var(--neon-glow); line-height: 1; }
.error-page__title { font-size: clamp(18px, 3vw, 26px); color: #fff; margin-top: 12px; }
.error-page__text { color: var(--text-muted); margin-top: 10px; font-size: 14px; }
.error-page__btn {
  display: inline-block; margin-top: 20px;
  font-family: var(--font-pixel); font-size: 13px;
  padding: 12px 22px; background: var(--neon); color: #fff;
  border: 2px solid #fff;
}
.error-page__links { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 24px; }
.error-page__links a {
  font-family: var(--font-pixel); font-size: 12px;
  padding: 6px 12px; border: 1px solid var(--neon); color: var(--text);
}
.error-page__links a:hover, .error-page__links a:focus-visible { background: var(--neon); }

/* ---------- Responsive ---------- */
/* Tablet */
@media (max-width: 1024px) {
  .site-header__inner { padding: 20px 24px; gap: 16px; }
  .brand-mark { width: 60px; height: 60px; }
  .brand-wordmark { height: 22px; }
  .building__robot { width: 24%; }
  .basement__overlay { padding: 0 24px; }
  .basement__title { font-size: 18px; }
}

/* Small tablet / large phone */
@media (max-width: 768px) {
  .site-header { min-height: auto; }
  .site-header__inner { flex-direction: column; align-items: flex-start; padding: 16px 20px; gap: 10px; }
  .site-header__subtitle { margin-left: 0; text-align: left; max-width: 100%; }
  .brand-mark { width: 52px; height: 52px; }
  .brand-wordmark { height: 20px; }

  .building { width: calc(100vw - 20px); }
  .basement { width: calc(100vw - 20px); }
  .hero { padding-top: 64px; }

  .building__floor--top,
  .building__floor--bottom {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .room-card__label { opacity: 1; transform: none; }
  .room-card { transform: none !important; }
  .room-card:hover .room-card__media img { transform: none; }

  .building__robot { width: 26%; right: 8%; bottom: 6%; }

  .basement__overlay { padding: 0 16px; flex-direction: row; justify-content: space-between; text-align: left; gap: 10px; }
  .basement__title { font-size: 15px; }
  .basement__cta { font-size: 12px; padding: 9px 14px; white-space: nowrap; }

  .underground { height: 90px; }
  .underground__art { top: -170px; }

  .modal__panel { padding: 20px 18px 24px; }
  .modal__members { grid-template-columns: 1fr; }

  .room-hero__card { flex-direction: column; align-items: flex-start; }
  .room-hero__avatar { width: 88px; height: 88px; }
  .room-nav { flex-direction: column; align-items: stretch; }
  .room-nav__switch { justify-content: space-between; }
}

/* Phone */
@media (max-width: 430px) {
  body { font-size: 15px; }
  .hero { padding-top: 48px; }
  .building { width: calc(100vw - 16px); }
  .basement { width: calc(100vw - 16px); }
  .basement__overlay { padding: 0 12px; gap: 8px; }
  .basement__title { font-size: 13px; }
  .basement__cta { font-size: 11px; padding: 8px 12px; }
  .building__grid { padding: 16px 0; gap: 14px; }
  .building__floor { gap: 14px; }
  .room-card__name { font-size: 13px; }
  .room-card__role { font-size: 11px; }
  .underground { height: 76px; }
  .underground__art { top: -190px; }
}

@media (max-width: 360px) {
  .brand-mark { width: 44px; height: 44px; }
  .brand-wordmark { height: 18px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .building__robot { animation: none; }
}

/* Print */
@media print {
  body { background: #fff; color: #000; }
  .site-header, .basement, .underground { display: none; }
}

/* ---------- Hotfix 2: basement & contacts on mobile ---------- */
/* На мобилке overlay больше не absolute: контент идёт под картинкой,
   чтобы ничего не обрезалось и не наезжало. */

@media (max-width: 768px) {
  .basement {
    aspect-ratio: auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }
  .basement__art {
    width: 100%;
    height: auto;
    object-fit: contain;
  }
  .basement__overlay {
    position: static;
    inset: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 16px;
    background: linear-gradient(180deg, rgba(8, 8, 54, 0.75), rgba(8, 8, 54, 0.95));
  }
  .basement__title {
    font-size: 16px;
    text-align: center;
    white-space: normal;
    line-height: 1.2;
  }
  .basement__cta {
    font-size: 12px;
    padding: 8px 16px;
    white-space: normal;
    text-align: center;
  }
}

@media (max-width: 430px) {
  .basement__title {
    font-size: 14px;
  }
  .basement__cta {
    font-size: 11px;
    padding: 7px 12px;
  }
}

/* contacts modal: никакого горизонтального вылезания */
.contacts-list__item {
  flex-wrap: wrap;
  align-items: flex-start;
}
.contacts-list__info {
  min-width: 0;
  flex: 1 1 100%;
}
.contacts-list__name,
.contacts-list__role {
  word-break: break-word;
  overflow-wrap: anywhere;
}
.contacts-list__link {
  flex-shrink: 0;
  margin-left: auto;
  align-self: flex-end;
}