/* ── Fonts ───────────────────────────────────────────────────────────────── */
@font-face {
  font-family: 'Montreal';
  src: url('../fonts/PPNeueMontreal-Medium.woff2') format('woff2'),
       url('../fonts/PPNeueMontreal-Medium.woff') format('woff');
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: 'Montreal';
  src: url('../fonts/PPNeueMontreal-Semibold.woff2') format('woff2'),
       url('../fonts/PPNeueMontreal-Semibold.woff') format('woff');
  font-weight: 600;
  font-display: swap;
}

/* ── Reset & base ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: #000;
  color: #BFBFBF;
  font-family: 'Montreal', Arial, sans-serif;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.25;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow: hidden;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; padding: 0; }
ul { list-style: none; }
p { margin: 0; }
h1, h2 { font: inherit; }

/* ── Noise canvas ────────────────────────────────────────────────────────── */
#noise {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

/* ── Hero screen ─────────────────────────────────────────────────────────── */
#hero {
  position: fixed;
  inset: 0;
  z-index: 1;
}

/* ── Top nav ─────────────────────────────────────────────────────────────── */
#topnav {
  position: absolute;
  top: 20px;
  left: 5.2%;
  right: 5.2%;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

#nav-left {
  display: flex;
  align-items: flex-start;
  gap: 76px;
}

#nav-col1,
#nav-col2 {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.nav-btn {
  display: block;
  padding: 0;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s;
  white-space: nowrap;
  text-align: left;
}

.nav-btn:hover {
  border-bottom-color: rgba(191, 191, 191, 0.4);
}

.nav-btn.active {
  border-bottom-color: #BFBFBF;
}

/* ── Hero center (title + gear) ──────────────────────────────────────────── */
#hero-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

h1 {
  font-size: 28px;
  font-weight: 600;
  color: #F2F2F2;
  line-height: 1;
}

@keyframes gear-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

#gear {
  width: 56px;
  height: 56px;
  animation: gear-spin 8000ms linear infinite;
  display: block;
}

/* ── Popup windows ───────────────────────────────────────────────────────── */
.window {
  position: fixed;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid #202020;
  color: #BFBFBF;
  z-index: 1000;
  max-width: calc(100vw - 24px);
}

/* Window specific widths */
#window-portfolio { width: 448px; }
#window-maverick  { width: 448px; }
#window-fondi     { width: 568px; }
#window-deal      { width: 448px; }
#window-contacts  { width: 544px; }
#window-login     { width: 380px; }

.window-titlebar {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 8px 20px 9px 20px;
  height: 56px;
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.window-titlebar:active {
  cursor: grabbing;
}

.window-title {
  color: #BFBFBF;
  font-weight: 600;
  text-align: center;
}

.window-close {
  position: absolute;
  top: 12px;
  right: 16px;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.15s;
  line-height: 0;
}

.window-close:hover {
  opacity: 1;
}

.window-close img {
  width: 20px;
  height: 20px;
  display: block;
}

.window-body {
  margin: 0 12px 12px 12px;
  border: 1px solid #202020;
  padding: 16px 12px 20px 12px;
}

/* ── Portfolio grid ──────────────────────────────────────────────────────── */
.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.portfolio-item {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 78px;
  padding: 8px;
}

.portfolio-item img {
  max-width: 100%;
  max-height: 28px;
  object-fit: contain;
  display: block;
}

/* Optical size normalization — logos have very different visual weights */
.portfolio-item:nth-child(3) img { max-height: 23px; }  /* Flo — tall with feather */
.portfolio-item:nth-child(5) img { max-height: 14px; }  /* Revolut — heavy bold */
.portfolio-item:nth-child(6) img { max-height: 40px; }  /* Neuralink — thin wide */
.portfolio-item:nth-child(7) img { max-height: 38px; }  /* Celestia — thin */
.portfolio-item:nth-child(8) img { max-height: 24px; }  /* xAI — compact mark */
.portfolio-item:nth-child(9) img { max-height: 24px; }  /* ByteDance — thin text */

/* ── Maverick criteria ───────────────────────────────────────────────────── */
.window-body p {
  margin-bottom: 12px;
}

.window-body > p:first-child {
  opacity: 0.5;
  margin-bottom: 24px;
}

.criteria-list {
  margin-top: 4px;
}

.criteria-list li {
  padding: 0 0 8px 0;
}

.criteria-list li::before {
  content: "• ";
}

/* ── Fondo di Fondi diagram ──────────────────────────────────────────────── */
.fondi-diagram {
  position: relative;
  width: 100%;
  margin-top: 4px;
}

.diagram-img {
  display: block;
  width: 100%;
  height: auto;
}

.diagram-overlay-img {
  position: absolute;
  top: 3%;
  left: 1.6%;
  width: 2%;
  pointer-events: none;
}

.diag-label {
  position: absolute;
  color: #BFBFBF;
  white-space: nowrap;
  line-height: 1.25;
}

.diag-investor { top: 14%;  left: 46%; }
.diag-100      { top: 30%;  left: 46%; }
.diag-feeder   { top: 47%;  left: 46%; }
.diag-core     { top: 80%;  left: 46%; }
.diag-pv       { top: 30%;  left: 70%; }
.diag-master   { top: 64%;  left: 70%; }
.diag-zlp-label { top: 55%; left: 0; }
.diag-zlp-desc {
  position: absolute;
  top: 63%;
  left: 0;
  color: #BFBFBF;
  line-height: 1.25;
  max-width: 38%;
  opacity: 0.5;
}

/* ── Deal-by-Deal table ──────────────────────────────────────────────────── */
.deal-table {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 8px;
}

.deal-col-title {
  margin-bottom: 6px;
  color: #F2F2F2;
}

.deal-col li {
  padding-bottom: 4px;
}

/* ── Contacts grid ───────────────────────────────────────────────────────── */
.contacts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px 16px;
}

.contact-item p {
  margin-bottom: 4px;
}

.contact-name {
  margin-bottom: 4px;
}

.contact-city {
  margin-bottom: 4px;
  opacity: 0.6;
}

.contact-address {
  opacity: 0.7;
}

/* ── Login form ──────────────────────────────────────────────────────────── */
.login-field {
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
  margin-bottom: 2px;
}

.login-field input {
  display: block;
  width: 100%;
  background: transparent;
  border: none;
  color: #BFBFBF;
  font: inherit;
  padding: 8px 0;
  outline: none;
}

.login-field input::placeholder {
  color: rgba(191, 191, 191, 0.45);
}

.btn-login {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 0;
  margin-top: 4px;
  color: #BFBFBF;
  transition: color 0.15s;
}

.btn-login:hover { color: #F2F2F2; }

.login-error {
  color: #BFBFBF;
  opacity: 0;
  transition: opacity 0.3s ease;
  margin-top: 8px;
  min-height: 1em;
}

.login-error.visible {
  opacity: 1;
}

/* ── Mobile ──────────────────────────────────────────────────────────────── */
@media (max-width: 767px) {
  html, body { font-size: 13px; }

  .window { font-size: 13px; }

  .nav-btn { padding: 3px 0; }

  .window-close { padding: 14px; top: 6px; right: 8px; }

  .window-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    max-height: calc(100dvh - 120px);
  }

  .login-field input { font-size: 16px; }

  /* Fondo di Fondi: сдвиг pv и master на 2px влево */
  .diag-pv     { left: calc(70% - 2px); }
  .diag-master { left: calc(70% - 2px); }

  /* Deal-by-Deal, Portfolio: уже других окон */
  #window-deal, #window-portfolio { width: 300px; }

  .portfolio-item { height: 52px; }

  .deal-table {
    grid-template-columns: auto 1fr;
    gap: 10px 16px;
    align-items: start;
  }

  .deal-col { display: contents; }

  .deal-col-title { margin-bottom: 0; }

  .contacts-grid { gap: 16px 8px; }
}
