@import "tokens.css";

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--page-bg);
  font-family: var(--font-body);
  color: var(--text-primary);
}
body { overflow: hidden; }

/* ---- Home screen (frame 433:2047) — fluid, fills the viewport ----------- */
.home {
  position: relative;
  width: 100%;
  height: 100vh;
  background: var(--page-bg);
  overflow: hidden;
}

/* ---- Marquee (node 433:2048) — full stage, cards centered ---------------- */
.marquee {
  position: absolute;
  top: var(--page-inset);            /* 32px from top */
  left: 0;
  right: 0;
  height: calc(100vh - 96px);        /* leaves a bottom zone so cards clear the bar; +room for hover zoom */
  overflow: hidden;
  z-index: 1;
  cursor: grab;
  touch-action: pan-y;               /* allow custom horizontal drag */
}
.marquee.is-dragging { cursor: grabbing; }

/* Track holds the cards twice (original + clone) for a seamless loop.
   Motion is JS-driven (rAF) so it can coexist with drag. Hidden until ready. */
.marquee__track {
  display: flex;
  align-items: center;
  height: 100%;
  padding-left: var(--page-inset);   /* first card starts at x32 */
  gap: var(--card-gap);
  width: max-content;
  will-change: transform;
  user-select: none;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.home.is-ready .marquee__track { opacity: 1; }

/* Loading state — spinner while card images load, hides when ready. */
.loader {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  background: var(--page-bg);
  transition: opacity 0.4s ease;
}
.home.is-ready .loader { opacity: 0; visibility: hidden; }
.loader__spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(0, 0, 0, 0.12);
  border-top-color: rgba(0, 0, 0, 0.55);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Card --------------------------------------------------------------- */
.card {
  flex: 0 0 auto;
  /* Rubber height, smaller than before (= 650px at the 810 design height, per
     the updated макет 650:14842). Centered in the marquee, above the bar. */
  height: calc(100vh - 160px);
  border-radius: var(--card-radius);   /* 12px — matches the frame's corners */
  overflow: hidden;
  background: transparent;             /* exported PNG carries its own bg */
  will-change: transform;
  transition: transform 0.22s ease;
}
.card:hover {
  transform: scale(1.04);              /* slight zoom on hover */
  z-index: 2;
}
.marquee.is-dragging .card { transition: none; }   /* no zoom flicker while dragging */
.marquee.is-dragging .card:hover { transform: none; }
.card img {
  display: block;
  height: 100%;
  width: auto;
  object-fit: cover;
  pointer-events: none;                /* don't capture drag / native image-drag */
  user-select: none;
}
.card--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--neutral-300);
  background: var(--bg-neutral-secondary);
}
.card--placeholder span {
  font-family: var(--font-main);
  font-size: 18px;
  color: var(--text-secondary-default);
  text-align: center;
  padding: 0 24px;
  max-width: 80%;
}

/* ---- Bottom bar (frame 566:2101) — pill measured from home-full.webp ----- */
.topbar {                              /* the pill plate (1420×52) */
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 11px;                        /* pill bottom ≈ y799 of 810 */
  height: 52px;
  z-index: 20;                         /* above the marquee */
  border-radius: var(--pill-radius);
  /* Frosted glass: blurs + lightens the cards behind it (matches the ref). */
  background: rgba(255, 255, 255, 0.55);
  -webkit-backdrop-filter: blur(18px);
          backdrop-filter: blur(18px);
}
.topbar__group {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 16px;
}
.topbar__group--left { left: 8px; }    /* avatar ≈ x18 on the page */
.topbar__group--right { right: 26px; } /* nav right edge ≈ x1404 */
.topbar__role {                        /* "дизайнер" — centered in the pill */
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* Nav item = link with a transparent NATIVE checkbox overlaid (mishanaer.com
   pattern). Toggling a native checkbox is what fires the system haptic on iOS.
   Overlay is interactive ONLY on touch (pointer:coarse) — on desktop the real
   link handles clicks; the checkbox is scaled ×4 to cover the whole tap target. */
.nav-item {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.haptic-wrap {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 6px;
  pointer-events: none;                /* desktop: clicks fall through to the link */
}
.haptic {
  position: absolute;
  left: 50%;
  top: 50%;
  margin: 0;
  transform: translate(-50%, -50%) scale(4);  /* native checkbox is tiny → cover the target */
  transform-origin: center;
  opacity: 0;                          /* invisible but still a native control → haptic */
  cursor: pointer;
  pointer-events: none;
}
@media (pointer: coarse) {             /* touch devices: overlay catches taps → native haptic */
  .haptic-wrap,
  .haptic { pointer-events: auto; }
}
.topbar a,
.topbar span,
.topbar__role {
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 14px;
  line-height: 18px;
  letter-spacing: 0;
  color: var(--bar-text);
  text-transform: uppercase;
  text-decoration: none;
}
.topbar__avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 auto;
}

/* ---- Info button + "Обо мне" panel (frame 1:9575) ----------------------- */
.info {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;                         /* above the marquee */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;                           /* button → panel gap */
}
.info-btn {
  width: 40px;
  height: 40px;
  border-radius: 32px;
  background: rgba(0, 0, 0, 0.08);     /* black 8% */
  -webkit-backdrop-filter: blur(25px);
          backdrop-filter: blur(25px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 8px;
}
.info-btn img { width: 24px; height: 24px; display: block; }

/* Panel: frosted glass, hidden until the info BUTTON (the circle) is hovered.
   Absolutely positioned so the .info container shrinks to the 40px button — that
   way hover only fires on the circle, not on the panel's whole footprint. */
.info-panel {
  position: absolute;
  top: 100%;
  left: 50%;
  margin-top: 10px;                    /* button → panel gap */
  width: 437px;
  padding: 20px;
  border-radius: 10px;
  /* Heavier white tint than the Figma 8% so the text stays readable over
     bright cards (orange), while keeping the frosted-glass look. */
  background: rgba(255, 255, 255, 0.82);
  -webkit-backdrop-filter: blur(60px) saturate(120%);
          backdrop-filter: blur(60px) saturate(120%);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  text-align: center;
  color: #000;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: normal;
  /* closed state */
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, -6px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
}
/* Transparent bridge over the 10px gap so moving from the circle onto the panel
   doesn't drop the hover (only active once the panel itself is shown). */
.info-panel::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -10px;
  height: 10px;
}
.info-btn:hover ~ .info-panel,
.info-panel:hover,
.info:focus-within .info-panel {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
  pointer-events: auto;
}
.info-panel__title {
  margin: 0;
  font-weight: 600;                    /* Google Sans Code SemiBold */
  text-transform: uppercase;
}
.info-panel__body {
  margin: 0;
  width: 395px;
  font-weight: 400;
}
