/* ============================================================
   Gera Gursky — Interactive Resume
   ============================================================ */
:root {
  --bg:        #eef1f8;
  --card:      #ffffff;
  --ink:       #0f172a;
  --ink-soft:  #475569;
  --muted:     #94a3b8;
  --line:      #e2e8f0;
  --brand:     #4f46e5;
  --brand-2:   #06b6d4;
  --brand-ink: #312e81;
  --radius:    18px;
  --shadow:    0 10px 30px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.18);
  --grad:      linear-gradient(135deg, #4f46e5 0%, #06b6d4 100%);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

/* Global guard: never allow horizontal scroll on any screen */
html, body { max-width: 100%; overflow-x: hidden; overflow-x: clip; }

/* THE key mobile-overflow fix: flex & grid children default to
   min-width:auto and refuse to shrink below their content width,
   which pushes the page sideways on real phones. Reset it. */
.layout > *, .hero__inner > *, .job__head > *, .chat-input > *,
.col-main, .col-side { min-width: 0; }

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* Media and long words should never exceed their container */
img { max-width: 100%; height: auto; }
p, li, h1, h2, h3, h4, span, a { overflow-wrap: break-word; word-break: break-word; }

/* ---------------- HERO ---------------- */
.hero {
  background: var(--grad);
  color: #fff;
  padding: 56px 20px 88px;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(600px 300px at 85% -10%, rgba(255,255,255,.25), transparent 60%),
    radial-gradient(500px 260px at 5% 120%, rgba(255,255,255,.14), transparent 60%);
  pointer-events: none;
}
.hero__inner {
  position: relative;
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 36px;
  flex-wrap: wrap;
}
.hero__photo-wrap {
  flex: 0 0 auto;
  padding: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,.35);
  box-shadow: 0 12px 34px rgba(0,0,0,.25);
}
.hero__photo {
  width: 168px;
  height: 168px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  border: 4px solid rgba(255,255,255,.85);
}
.hero__intro { flex: 1 1 340px; min-width: 280px; }
.hero__name {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}
.hero__title {
  margin: 6px 0 0;
  font-size: clamp(1rem, 2.4vw, 1.2rem);
  font-weight: 600;
  color: rgba(255,255,255,.92);
}
.hero__tagline {
  margin: 14px 0 20px;
  max-width: 640px;
  color: rgba(255,255,255,.86);
}
.hero__contacts { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(255,255,255,.16);
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 999px;
  color: #fff;
  text-decoration: none;
  font-size: .9rem;
  font-weight: 500;
  backdrop-filter: blur(6px);
  transition: transform .15s ease, background .15s ease;
}
.chip:hover { background: rgba(255,255,255,.28); transform: translateY(-2px); }
.chip--chat {
  font: inherit;
  font-weight: 700;
  background: #fff;
  color: var(--brand-ink);
  border-color: #fff;
  cursor: pointer;
  animation: chipPulse 2.4s ease-in-out infinite;
}
.chip--chat:hover { background: #fff; transform: translateY(-2px) scale(1.03); }
.chip--chat .chip__icon { background: var(--grad); color: #fff; }
@keyframes chipPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,255,255,.55); }
  50%      { box-shadow: 0 0 0 9px rgba(255,255,255,0); }
}
.chip__icon {
  display: inline-grid;
  place-items: center;
  width: 20px; height: 20px;
  font-size: .72rem;
  font-weight: 700;
  border-radius: 6px;
  background: rgba(255,255,255,.25);
}

/* ---------------- LAYOUT ---------------- */
.layout {
  max-width: 1080px;
  margin: -56px auto 0;
  padding: 0 20px 40px;
  display: grid;
  grid-template-columns: 1.9fr 1fr;
  gap: 22px;
  position: relative;
  z-index: 2;
}
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
}

/* ---------------- CARDS ---------------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px 26px 22px;
  margin-bottom: 22px;
}
.col-main .card:last-child,
.col-side .card:last-child { margin-bottom: 0; }

.card__title {
  margin: 0 0 16px;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: var(--brand-ink);
  position: relative;
  padding-bottom: 10px;
}
.card__title::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 44px; height: 3px;
  border-radius: 3px;
  background: var(--grad);
}

/* ---------------- BULLETS ---------------- */
.bullets { margin: 0; padding-left: 0; list-style: none; }
.bullets li {
  position: relative;
  padding-left: 22px;
  margin-bottom: 8px;
  color: var(--ink-soft);
}
.bullets li::before {
  content: "";
  position: absolute;
  left: 4px; top: 9px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--brand-2);
}

/* ---------------- JOBS ---------------- */
.job { padding: 14px 0; border-top: 1px dashed var(--line); }
.job:first-of-type { padding-top: 4px; border-top: none; }
.job__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin-bottom: 8px;
}
.job__role { margin: 0; font-size: 1.05rem; font-weight: 700; color: var(--ink); }
.job__meta { font-size: .85rem; font-weight: 600; color: var(--brand); }

/* ---------------- SKILLS ---------------- */
.skill-group { margin-bottom: 16px; }
.skill-group:last-child { margin-bottom: 0; }
.skill-group__label {
  margin: 0 0 8px;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
}
.tags { display: flex; flex-wrap: wrap; gap: 7px; }
.tag {
  font-size: .8rem;
  font-weight: 500;
  padding: 5px 11px;
  border-radius: 8px;
  background: #f1f5f9;
  color: var(--brand-ink);
  border: 1px solid var(--line);
}

/* ---------------- LANGUAGES / SERVICE ---------------- */
.lang-list { list-style: none; margin: 0; padding: 0; }
.lang-list li {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.lang-list li:last-child { border-bottom: none; }
.lang-list em { font-style: normal; color: var(--brand); font-weight: 600; font-size: .9rem; }
.service-text { margin: 0 0 4px; color: var(--ink-soft); }
.service-text.muted { color: var(--muted); font-size: .9rem; }

/* ---------------- FOOTER ---------------- */
.site-footer {
  text-align: center;
  color: var(--muted);
  font-size: .82rem;
  padding: 10px 20px 40px;
}

/* ============================================================
   CHAT WIDGET
   ============================================================ */
.chat-fab {
  position: fixed;
  right: 22px; bottom: 22px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border: none;
  border-radius: 999px;
  background: var(--grad);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  z-index: 50;
  transition: transform .18s ease, box-shadow .18s ease;
}
.chat-fab:hover { transform: translateY(-3px) scale(1.02); }
.chat-fab__icon { font-size: 1.2rem; line-height: 1; }
.chat-fab.is-hidden { opacity: 0; pointer-events: none; transform: scale(.8); }

.chat-panel {
  position: fixed;
  right: 22px; bottom: 22px;
  width: min(400px, calc(100vw - 32px));
  height: min(620px, calc(100vh - 40px));
  background: var(--card);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  transform: translateY(24px) scale(.96);
  transition: opacity .2s ease, transform .2s ease;
}
.chat-panel.is-open { opacity: 1; pointer-events: auto; transform: translateY(0) scale(1); }

.chat-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--grad);
  color: #fff;
}
.chat-panel__id { display: flex; align-items: center; gap: 12px; }
.chat-panel__avatar {
  width: 40px; height: 40px; border-radius: 50%;
  object-fit: cover; border: 2px solid rgba(255,255,255,.7);
}
.chat-panel__id strong { display: block; font-size: .98rem; }
.chat-panel__status { font-size: .76rem; color: rgba(255,255,255,.85); }
.chat-panel__close {
  border: none; background: rgba(255,255,255,.18); color: #fff;
  width: 30px; height: 30px; border-radius: 8px; cursor: pointer;
  font-size: .9rem; transition: background .15s ease;
}
.chat-panel__close:hover { background: rgba(255,255,255,.32); }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f8fafc;
}
.msg {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: .92rem;
  white-space: pre-wrap;
  word-wrap: break-word;
  animation: pop .18s ease;
}
@keyframes pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.msg--bot { align-self: flex-start; background: #fff; border: 1px solid var(--line); color: var(--ink); border-bottom-left-radius: 4px; }
.msg--user { align-self: flex-end; background: var(--grad); color: #fff; border-bottom-right-radius: 4px; }
.msg--error { align-self: flex-start; background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; }

.typing { display: inline-flex; gap: 4px; align-items: center; }
.typing span {
  width: 7px; height: 7px; border-radius: 50%; background: var(--muted);
  animation: blink 1.2s infinite ease-in-out;
}
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }

.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 10px 16px 4px;
  background: #f8fafc;
}
.suggestion {
  font: inherit;
  font-size: .78rem;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--brand);
  cursor: pointer;
  transition: background .15s ease, transform .15s ease;
}
.suggestion:hover { background: #eef2ff; transform: translateY(-1px); }
.chat-suggestions.is-hidden { display: none; }

.chat-input {
  display: flex;
  gap: 8px;
  padding: 12px 16px 16px;
  background: #f8fafc;
  border-top: 1px solid var(--line);
}
.chat-input input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 14px;
  font: inherit;
  outline: none;
  background: #fff;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.chat-input input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(79,70,229,.15); }
.chat-input button {
  flex: 0 0 auto;
  width: 44px;
  border: none;
  border-radius: 12px;
  background: var(--grad);
  color: #fff;
  font-size: 1.05rem;
  cursor: pointer;
  transition: transform .15s ease, opacity .15s ease;
}
.chat-input button:hover { transform: translateY(-1px); }
.chat-input button:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ---------------- MOBILE (tablets & phones) ---------------- */
@media (max-width: 600px) {
  .hero { padding: 34px 16px 66px; }
  .hero__inner { gap: 22px; text-align: center; justify-content: center; }
  .hero__intro { flex-basis: 100%; }
  .hero__photo { width: 128px; height: 128px; }
  .hero__contacts { justify-content: center; }
  .hero__tagline { margin-left: auto; margin-right: auto; }

  .layout { padding: 0 14px 32px; gap: 16px; }
  .card { padding: 20px 18px 18px; margin-bottom: 16px; }

  .job__head { gap: 2px 12px; }
}

/* ---------------- SMALL PHONES ---------------- */
@media (max-width: 480px) {
  .chat-panel {
    right: 0; bottom: 0; left: 0;
    width: 100%;
    height: 100dvh;
    border-radius: 0;
  }
  .chat-fab { right: 16px; bottom: 16px; padding: 14px 16px; }
  .chat-fab__label { display: none; }

  /* Chat button in the header goes full-width so it's unmissable */
  .hero__contacts { flex-direction: column; align-items: stretch; }
  .chip { justify-content: center; }
}


/* ============================================================
   "HOW THIS APP IS BUILT" — header button + modal
   ============================================================ */
.chip--arch {
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  background: rgba(255,255,255,.16);
  color: #fff;
  border-color: rgba(255,255,255,.45);
}
.chip--arch:hover { background: rgba(255,255,255,.30); transform: translateY(-2px); }
.chip--arch .chip__icon { background: rgba(255,255,255,.25); }

/* modal shell */
.arch-modal {
  position: fixed; inset: 0; z-index: 80;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  opacity: 0; pointer-events: none; transition: opacity .2s ease;
}
.arch-modal.is-open { opacity: 1; pointer-events: auto; }
.arch-modal__backdrop {
  position: absolute; inset: 0;
  background: rgba(15,23,42,.55); backdrop-filter: blur(3px);
}
.arch-modal__card {
  position: relative; width: min(760px, 100%);
  max-height: 88vh; overflow-y: auto;
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 26px;
  transform: translateY(16px) scale(.98); transition: transform .2s ease;
}
.arch-modal.is-open .arch-modal__card { transform: none; }
.arch-modal__head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; margin-bottom: 20px;
}
.arch-modal__title { margin: 0 0 4px; font-size: 1.25rem; font-weight: 800; color: var(--brand-ink); }
.arch-modal__sub { margin: 0; font-size: .9rem; color: var(--ink-soft); }
.arch-modal__close {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; color: var(--ink-soft);
  cursor: pointer; font-size: .95rem; transition: background .15s ease;
}
.arch-modal__close:hover { background: #f1f5f9; }

/* flows */
.flow { margin-bottom: 18px; }
.flow__label {
  display: inline-block; margin-bottom: 10px;
  font-size: .78rem; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--brand);
}
.flow__row { display: flex; align-items: stretch; flex-wrap: wrap; gap: 6px; }
.node {
  flex: 1 1 auto; min-width: 0;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 12px 10px; border-radius: 12px; cursor: pointer;
  background: #f8fafc; border: 1px solid var(--line); color: var(--ink);
  font: inherit; text-align: center;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.node:hover { transform: translateY(-2px); border-color: var(--brand-2); }
.node.is-active {
  border-color: transparent;
  background: linear-gradient(#fff,#fff) padding-box, var(--grad) border-box;
  box-shadow: 0 6px 18px rgba(79,70,229,.18);
}
.node__icon { font-size: 1.4rem; line-height: 1; }
.node__name { font-size: .85rem; font-weight: 700; }
.node__tag { font-size: .66rem; color: var(--muted); }
.conn { flex: 0 0 auto; align-self: center; color: var(--brand-2); font-size: 1.15rem; font-weight: 700; }

/* explanation panel */
.arch-detail {
  margin-top: 8px; padding: 14px 16px; min-height: 52px;
  background: #f1f5f9; border: 1px solid var(--line); border-radius: 12px;
  font-size: .92rem; color: var(--ink-soft); line-height: 1.5;
}
.arch-detail strong { color: var(--brand-ink); }
.arch-detail__hint { color: var(--muted); }

/* mobile: stack each flow vertically */
@media (max-width: 620px) {
  .arch-modal__card { padding: 20px 18px; }
  .flow__row { flex-direction: column; align-items: stretch; }
  .node { flex-direction: row; justify-content: flex-start; gap: 12px; }
  .conn { align-self: center; transform: rotate(90deg); }
}
