/* =========================================================
   Igor Arsenkin — Senior iOS Developer
   Dark, modern, mobile-first responsive stylesheet
   ========================================================= */

/* ---------- Tokens ---------- */
:root {
  --bg:        #0b0f17;
  --bg-alt:    #111726;
  --surface:   #161d2e;
  --surface-2: #1d2538;
  --border:    #28324a;
  --text:      #e8edf5;
  --text-dim:  #9aa6bd;
  --text-mut:  #7e8aa3;
  --accent:    #4da3ff;
  --accent-2:  #34d6c8;
  --accent-grad: linear-gradient(120deg, #4da3ff 0%, #34d6c8 100%);
  --radius:    16px;
  --radius-sm: 10px;
  --maxw:      1080px;
  --shadow:    0 18px 40px -20px rgba(0,0,0,.7);
  --font:      'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono:      'JetBrains Mono', ui-monospace, 'SF Mono', monospace;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; overscroll-behavior-y: contain; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: clamp(15px, 0.5vw + 14px, 17px);
  overflow-x: hidden;
  /* Disable native pull-to-refresh / scroll-chaining (Safari overscroll jank) */
  overscroll-behavior-y: contain;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }

.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: 22px; }
.accent { color: var(--accent); }

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(11,15,23,.78);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s, background .3s;
}
.site-header.is-scrolled { border-bottom-color: var(--border); }
.nav { display: flex; align-items: center; justify-content: space-between; height: 64px; }

/* Brand: iOS-style app-icon mark + name */
.nav__brand { display: inline-flex; align-items: center; gap: 11px; }
.nav__brand-mark {
  width: 38px; height: 38px; border-radius: 11px; flex: none;
  background: var(--accent-grad);
  display: grid; place-items: center;
  box-shadow: 0 4px 14px -4px rgba(77,163,255,.6), inset 0 1px 0 rgba(255,255,255,.35);
  transition: transform .25s ease;
}
@media (hover: hover) {
  .nav__brand:hover .nav__brand-mark { transform: rotate(-6deg) scale(1.06); }
}
.nav__brand-mark-text {
  font-family: var(--mono); font-weight: 700; font-size: 1.02rem;
  color: #06121f; letter-spacing: -.04em;
}
.nav__brand-name { font-weight: 700; font-size: 1.05rem; letter-spacing: -.01em; color: var(--text); }

.nav__menu { display: flex; gap: 6px; align-items: center; }
.nav__link {
  display: inline-block; padding: 8px 14px; border-radius: 999px;
  color: var(--text-dim); font-weight: 500; font-size: .95rem;
  transition: color .2s, background .2s;
}
.nav__link:hover { color: var(--text); background: var(--surface); }
.nav__link.is-active { color: var(--accent); background: var(--surface); }
.nav__link.is-active:hover { color: var(--accent); }

.nav__toggle {
  display: none; flex-direction: column; gap: 5px; cursor: pointer;
  background: none; border: 0; padding: 8px;
}
.nav__toggle span {
  width: 26px; height: 2px; background: var(--text); border-radius: 2px;
  transition: transform .3s, opacity .3s;
}
.nav__toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav__toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav__toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Hero ---------- */
.hero { position: relative; padding: clamp(48px, 9vw, 110px) 0 clamp(60px, 9vw, 120px); }
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(circle at 78% 18%, rgba(77,163,255,.16), transparent 42%),
    radial-gradient(circle at 12% 85%, rgba(52,214,200,.12), transparent 45%);
}
.hero__inner {
  display: grid; grid-template-columns: 1.4fr 1fr; gap: clamp(28px, 5vw, 64px);
  align-items: center;
}
.hero__title { font-size: clamp(2.4rem, 6.5vw, 4.4rem); line-height: 1.04; font-weight: 800; letter-spacing: -.03em; }
.hero__role { font-size: clamp(1.15rem, 2.6vw, 1.7rem); font-weight: 600; color: var(--text-dim); margin-top: 10px; letter-spacing: -.01em; }
.hero__lead { color: var(--text-dim); margin-top: 22px; max-width: 46ch; font-size: 1.08rem; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 32px; }
.hero__socials { display: flex; flex-wrap: wrap; gap: 20px; margin-top: 30px; font-size: .9rem; }
.hero__socials a { color: var(--text-mut); font-family: var(--mono); transition: color .2s; }
.hero__socials a:hover { color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 13px 26px; border-radius: 999px; font-weight: 600; font-size: .98rem;
  transition: transform .15s, opacity .2s, background .2s, border-color .2s;
  border: 1px solid transparent; cursor: pointer;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--accent-grad); color: #06121f; }
.btn--primary:hover { opacity: .9; }
.btn--ghost { border-color: var(--border); color: var(--text); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }

.hero__photo { display: flex; justify-content: center; }
.hero__photo-frame {
  position: relative; width: clamp(180px, 38vw, 300px); aspect-ratio: 1;
  border-radius: 24px; overflow: hidden; border: 1px solid var(--border);
  background: var(--surface); box-shadow: var(--shadow);
  display: grid; place-items: center;
}
.hero__photo-frame img { width: 100%; height: 100%; object-fit: cover; position: relative; z-index: 2; }
.hero__photo-fallback {
  position: absolute; inset: 0; display: grid; place-items: center; z-index: 1;
  font-size: clamp(3rem, 10vw, 5rem); font-weight: 800; color: var(--text-mut);
  background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.hero__photo-frame--empty { border-style: dashed; }

.hero__scroll {
  position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%);
  color: var(--text-mut); font-size: 1.4rem; animation: bob 1.8s ease-in-out infinite;
}
@keyframes bob { 0%,100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, 8px); } }

/* ---------- Section scaffolding ---------- */
.section { padding: clamp(56px, 9vw, 100px) 0; }
.section--alt { background: var(--bg-alt); }
.section__head { display: flex; align-items: baseline; gap: 16px; margin-bottom: 44px; }
.section__num { font-family: var(--mono); color: var(--accent); font-size: 1rem; font-weight: 500; }
.section__title { font-size: clamp(1.7rem, 4vw, 2.5rem); font-weight: 800; letter-spacing: -.02em; }

/* ---------- About ---------- */
.about__grid { display: grid; grid-template-columns: 1.7fr 1fr; gap: clamp(28px, 5vw, 56px); align-items: start; }
.about__text p + p { margin-top: 18px; }
.about__text p { color: var(--text-dim); }
.about__text strong { color: var(--text); }
.about__stats { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 30px; }
.stat {
  flex: 1 1 120px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 18px; text-align: center;
}
.stat__num { display: block; font-size: 1.8rem; font-weight: 800; color: var(--accent); line-height: 1; }
.stat__label { display: block; color: var(--text-mut); font-size: .82rem; margin-top: 8px; }

.about__softskills {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 26px;
}
.about__softskills-title { font-size: 1.05rem; margin-bottom: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chips li {
  padding: 8px 14px; border-radius: 999px; font-size: .88rem;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-dim);
}

/* ---------- Skills ---------- */
.skills__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.skill-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 26px; transition: transform .2s, border-color .2s;
}
@media (hover: hover) {
  .skill-card:hover { transform: translateY(-4px); border-color: var(--accent); }
}
.skill-card__title { font-size: 1.1rem; margin-bottom: 18px; color: var(--text); }
.tags { display: flex; flex-wrap: wrap; gap: 9px; }
.tags li {
  font-family: var(--mono); font-size: .82rem; padding: 6px 11px;
  border-radius: var(--radius-sm); background: var(--surface-2);
  border: 1px solid var(--border); color: var(--text-dim);
}
.tags--sm li { font-size: .76rem; padding: 4px 9px; }

/* ---------- Timeline / Experience ---------- */
.timeline { position: relative; padding-left: 4px; }
.tl-item { position: relative; padding-left: 34px; padding-bottom: 38px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: ""; position: absolute; left: 7px; top: 6px; bottom: -6px; width: 2px;
  background: var(--border);
}
.tl-item:last-child::before { display: none; }
.tl-item__marker {
  position: absolute; left: 0; top: 4px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--bg); border: 3px solid var(--accent); z-index: 1;
}
.tl-item__body {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
}
.tl-item__top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; align-items: baseline; }
.tl-item__role { font-size: 1.18rem; }
.tl-item__date { font-family: var(--mono); font-size: .82rem; color: var(--accent-2); white-space: nowrap; }
.tl-item__company { margin-top: 4px; font-weight: 600; }
.tl-item__company a { color: var(--accent); }
.tl-item__company a:hover { text-decoration: underline; }
.tl-item__loc { color: var(--text-mut); font-weight: 400; font-size: .9rem; }
.tl-item__desc { color: var(--text-dim); margin: 14px 0 16px; }

/* ---------- Projects ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 30px; }
.filter {
  padding: 9px 18px; border-radius: 999px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-dim);
  font-family: var(--font); font-size: .9rem; font-weight: 500; transition: all .2s;
}
.filter:hover { color: var(--text); border-color: var(--accent); }
.filter.is-active { background: var(--accent-grad); color: #06121f; border-color: transparent; font-weight: 700; }

.projects__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.project {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; display: flex; flex-direction: column;
  transition: transform .2s, border-color .2s; min-height: 100%;
}
@media (hover: hover) {
  .project:hover { transform: translateY(-4px); border-color: var(--accent); }
}
.project.is-hidden { display: none; }
.project__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.project__title { font-size: 1.15rem; }
.project__tag { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 4px 9px; border-radius: 999px; white-space: nowrap; }
.project__tag--pro { background: rgba(77,163,255,.15); color: var(--accent); }
.project__tag--hobby { background: rgba(52,214,200,.15); color: var(--accent-2); }
.project__tag--vol { background: rgba(180,142,255,.15); color: #b48eff; }
.project__role { font-family: var(--mono); font-size: .78rem; color: var(--text-mut); margin-top: 8px; }
.project__desc { color: var(--text-dim); margin: 12px 0 16px; flex-grow: 1; font-size: .95rem; }
.project__link { color: var(--accent); font-weight: 600; font-size: .9rem; transition: gap .2s; }
.project__link:hover { text-decoration: underline; }
.project__link--muted { color: var(--text-mut); }

/* ---------- Education ---------- */
.edu__grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.edu {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
}
.edu__title { font-size: 1.05rem; }
.edu__school { color: var(--text-dim); margin-top: 6px; font-size: .92rem; }
.edu__date { display: inline-block; margin-top: 12px; font-family: var(--mono); font-size: .8rem; color: var(--accent-2); }
.languages { margin-top: 40px; }
.languages__title { font-size: 1.1rem; margin-bottom: 16px; }

/* ---------- Contact ---------- */
.contact__lead { color: var(--text-dim); max-width: 50ch; font-size: 1.1rem; }
.contact__methods { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; margin: 30px 0; }
.contact__card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; transition: transform .2s, border-color .2s;
}
@media (hover: hover) {
  .contact__card:hover { transform: translateY(-3px); border-color: var(--accent); }
}
.contact__label { display: block; font-family: var(--mono); font-size: .78rem; color: var(--text-mut); text-transform: uppercase; letter-spacing: .06em; }
.contact__value { display: block; margin-top: 8px; font-size: 1.1rem; font-weight: 600; color: var(--text); word-break: break-all; }
.contact__socials { display: flex; flex-wrap: wrap; gap: 22px; }
.contact__socials a { color: var(--text-mut); font-family: var(--mono); font-size: .9rem; transition: color .2s; }
.contact__socials a:hover { color: var(--accent); }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--border); padding: 28px 0; color: var(--text-mut); font-size: .88rem; }
.footer__inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.footer__top { color: var(--text-dim); transition: color .2s; }
.footer__top:hover { color: var(--accent); }

/* ---------- Scroll reveal ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .6s ease, transform .6s ease; }
.reveal.is-visible { opacity: 1; transform: none; }

/* =========================================================
   RESPONSIVE — tablet
   ========================================================= */
@media (max-width: 900px) {
  .hero__inner { grid-template-columns: 1fr; text-align: left; }
  .hero__photo { order: -1; justify-content: flex-start; }
  .skills__grid { grid-template-columns: repeat(2, 1fr); }
  .projects__grid { grid-template-columns: repeat(2, 1fr); }
  .about__grid { grid-template-columns: 1fr; }
}

/* =========================================================
   RESPONSIVE — phone
   ========================================================= */
@media (max-width: 640px) {
  .nav__toggle { display: flex; }
  .nav__menu {
    position: fixed; inset: 64px 0 auto 0;
    flex-direction: column; align-items: stretch; gap: 4px;
    background: var(--bg-alt); border-bottom: 1px solid var(--border);
    padding: 16px 22px 24px;
    transform: translateY(-120%); visibility: hidden;
    transition: transform .32s ease, visibility .32s ease; z-index: 49;
  }
  .nav__menu.is-open { transform: translateY(0); visibility: visible; }
  .nav__link { padding: 12px 14px; font-size: 1rem; }
  .nav__brand-name { display: none; }

  .skills__grid,
  .projects__grid,
  .contact__methods,
  .edu__grid { grid-template-columns: 1fr; }

  .hero__actions { width: 100%; }
  .btn { flex: 1 1 auto; }
  .section__head { margin-bottom: 32px; }
  .tl-item__top { flex-direction: column; gap: 2px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .hero__scroll { animation: none; }
}
