/* ==========================================================================
   Filip Kjamilov — portfolio design system
   Apple-inspired: dark glass, soft gradients, restrained motion.
   ========================================================================== */

:root {
  --bg: #030407;
  --bg-soft: #0a0c12;
  --text: #f5f5f7;
  --text-dim: rgba(245, 245, 247, 0.68);
  --text-faint: rgba(245, 245, 247, 0.42);
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --glass: rgba(255, 255, 255, 0.045);
  --glass-strong: rgba(255, 255, 255, 0.08);
  --accent-1: #2997ff;
  --accent-2: #bf5af2;
  --accent-3: #ff6482;
  --gradient: linear-gradient(120deg, var(--accent-1), var(--accent-2) 55%, var(--accent-3));
  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-sm: 14px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --maxw: 1040px;
  --nav-h: 72px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 12px);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  min-height: 100vh;
}

::selection {
  background: var(--accent-1);
  color: #05060a;
}

a {
  color: inherit;
}

img {
  max-width: 100%;
  display: block;
}

/* ------------------------------ background -------------------------------- */

.bg-orbs {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.bg-orbs span {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
  will-change: transform;
}

.bg-orbs span:nth-child(1) {
  width: 46vw;
  height: 46vw;
  top: -14vw;
  left: -10vw;
  background: radial-gradient(circle at 30% 30%, var(--accent-1), transparent 70%);
  animation: drift-a 26s ease-in-out infinite;
}

.bg-orbs span:nth-child(2) {
  width: 40vw;
  height: 40vw;
  top: 20vh;
  right: -14vw;
  background: radial-gradient(circle at 60% 40%, var(--accent-2), transparent 70%);
  animation: drift-b 32s ease-in-out infinite;
}

.bg-orbs span:nth-child(3) {
  width: 34vw;
  height: 34vw;
  bottom: -14vw;
  left: 18vw;
  background: radial-gradient(circle at 50% 50%, var(--accent-3), transparent 70%);
  animation: drift-c 30s ease-in-out infinite;
}

@keyframes drift-a {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(6vw, 8vh) scale(1.12); }
}

@keyframes drift-b {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-7vw, 6vh) scale(1.08); }
}

@keyframes drift-c {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(5vw, -6vh) scale(1.15); }
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.025;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.cursor-glow {
  position: fixed;
  z-index: 2;
  top: 0;
  left: 0;
  width: 420px;
  height: 420px;
  margin: -210px 0 0 -210px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(41, 151, 255, 0.14), transparent 70%);
  pointer-events: none;
  transform: translate3d(-999px, -999px, 0);
  will-change: transform;
}

/* --------------------------------- nav ------------------------------------ */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  border-bottom: 1px solid transparent;
  transition: background 0.4s var(--ease), border-color 0.4s var(--ease), backdrop-filter 0.4s var(--ease);
}

.nav.is-scrolled {
  background: rgba(5, 6, 10, 0.7);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom-color: var(--line);
}

.nav .inner {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-weight: 600;
  letter-spacing: -0.01em;
  font-size: 1.02rem;
  text-decoration: none;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 30px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  position: relative;
  text-decoration: none;
  font-size: 0.86rem;
  color: var(--text-dim);
  transition: color 0.25s var(--ease);
}

.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -6px;
  width: 0;
  height: 1px;
  background: var(--gradient);
  transition: width 0.3s var(--ease);
}

.nav-links a:hover,
.nav-links a.is-active {
  color: var(--text);
}

.nav-links a:hover::after,
.nav-links a.is-active::after {
  width: 100%;
}

.nav-cta {
  font-size: 0.82rem !important;
  padding: 8px 18px;
  border-radius: 980px;
  background: var(--glass-strong);
  border: 1px solid var(--line-strong);
}

.nav-cta::after {
  display: none;
}

.nav-toggle {
  display: none;
  width: 36px;
  height: 36px;
  border: none;
  background: none;
  position: relative;
  cursor: pointer;
}

.nav-toggle span,
.nav-toggle span::before,
.nav-toggle span::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  height: 1.5px;
  background: var(--text);
  transition: transform 0.3s var(--ease), opacity 0.3s var(--ease);
}

.nav-toggle span { top: 17.5px; }
.nav-toggle span::before { top: -7px; }
.nav-toggle span::after { top: 7px; }

.nav.is-open .nav-toggle span { background: transparent; }
.nav.is-open .nav-toggle span::before { transform: translateY(7px) rotate(45deg); }
.nav.is-open .nav-toggle span::after { transform: translateY(-7px) rotate(-45deg); }

/* --------------------------------- scroll progress ------------------------ */

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0%;
  z-index: 60;
  background: var(--gradient);
  transition: width 0.1s linear;
}

/* --------------------------------- layout ---------------------------------- */

.wrap {
  position: relative;
  z-index: 3;
}

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 28px;
}

/* --------------------------------- hero ------------------------------------ */

.hero {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: calc(var(--nav-h) + 40px) 28px 60px;
}

.avatar-ring {
  position: relative;
  width: 128px;
  height: 128px;
  border-radius: 50%;
  padding: 3px;
  margin-bottom: 28px;
  background: conic-gradient(from 0deg, var(--accent-1), var(--accent-2), var(--accent-3), var(--accent-1));
  animation: spin 8s linear infinite;
}

.avatar-ring img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--bg);
  animation: spin-back 8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes spin-back {
  to { transform: rotate(-360deg); }
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  color: var(--text-faint);
  font-weight: 600;
  margin: 0 0 14px;
}

.hero h1 {
  font-size: clamp(2.4rem, 6vw, 4.4rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0 0 10px;
  font-weight: 650;
}

.hero .role {
  font-size: clamp(1.05rem, 2.4vw, 1.4rem);
  font-weight: 500;
  color: var(--text-dim);
  margin: 0 0 22px;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  display: inline-block;
}

.hero p.lede {
  max-width: 620px;
  color: var(--text-dim);
  font-size: 1.08rem;
  line-height: 1.6;
  margin: 0 0 34px;
}

.hero-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
}

/* --------------------------------- buttons --------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 26px;
  border-radius: 980px;
  font-size: 0.92rem;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid transparent;
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease), background 0.35s var(--ease), border-color 0.35s var(--ease);
  cursor: pointer;
}

.btn.primary {
  background: var(--gradient);
  color: #05060a;
  font-weight: 600;
  box-shadow: 0 8px 30px -8px rgba(41, 151, 255, 0.55);
}

.btn.primary:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 14px 40px -10px rgba(191, 90, 242, 0.6);
}

.btn.ghost {
  background: var(--glass);
  border-color: var(--line-strong);
  color: var(--text);
  backdrop-filter: blur(12px);
}

.btn.ghost:hover {
  transform: translateY(-2px);
  background: var(--glass-strong);
  border-color: rgba(255, 255, 255, 0.3);
}

.btn.small {
  padding: 9px 18px;
  font-size: 0.82rem;
}

/* --------------------------------- sections --------------------------------- */

section {
  padding: 108px 0;
  position: relative;
}

.section-head {
  margin-bottom: 48px;
  text-align: left;
}

.section-head h2 {
  font-size: clamp(1.7rem, 3.4vw, 2.5rem);
  letter-spacing: -0.015em;
  font-weight: 650;
  margin: 6px 0 0;
}

section > .container > p.lead {
  color: var(--text-dim);
  font-size: 1.05rem;
  line-height: 1.7;
  max-width: 680px;
}

/* --------------------------------- reveal ----------------------------------- */

.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* --------------------------------- cards ------------------------------------ */

.grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.card {
  --mx: 50%;
  --my: 50%;
  position: relative;
  padding: 28px;
  border-radius: var(--radius-md);
  background: var(--glass);
  border: 1px solid var(--line);
  overflow: hidden;
  transition: transform 0.4s var(--ease), border-color 0.4s var(--ease), background 0.4s var(--ease);
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: radial-gradient(320px circle at var(--mx) var(--my), rgba(41, 151, 255, 0.55), transparent 60%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.4s var(--ease);
  pointer-events: none;
}

.card:hover {
  transform: translateY(-6px);
  border-color: rgba(255, 255, 255, 0.16);
  background: var(--glass-strong);
}

.card:hover::before {
  opacity: 1;
}

.card .icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient);
  color: #05060a;
  margin-bottom: 16px;
  font-size: 1.05rem;
}

.card h3 {
  font-size: 1.06rem;
  margin: 0 0 8px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.card p {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.94rem;
  line-height: 1.6;
}

/* --------------------------------- stats ------------------------------------ */

.stats {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.stat {
  padding: 26px 22px;
  border-radius: var(--radius-md);
  background: var(--glass);
  border: 1px solid var(--line);
  text-align: left;
}

.stat .num {
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  display: block;
}

.stat .label {
  margin-top: 6px;
  font-size: 0.86rem;
  color: var(--text-dim);
}

/* --------------------------------- work items -------------------------------- */

.work-item {
  padding: 30px;
  border-radius: var(--radius-md);
  background: var(--glass);
  border: 1px solid var(--line);
  transition: transform 0.4s var(--ease), border-color 0.4s var(--ease);
}

.work-item:hover {
  transform: translateY(-4px);
  border-color: var(--line-strong);
}

.work-item h3 {
  margin: 0 0 10px;
  font-size: 1.16rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.work-item p {
  margin: 0 0 18px;
  color: var(--text-dim);
  line-height: 1.65;
}

.work-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* --------------------------------- footer ------------------------------------ */

.site-footer {
  padding: 60px 0 80px;
  text-align: center;
}

.icons {
  display: flex;
  justify-content: center;
  gap: 14px;
  list-style: none;
  padding: 0;
  margin: 0 0 18px;
}

.icons a {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--glass);
  border: 1px solid var(--line);
  text-decoration: none;
  color: var(--text-dim);
  transition: transform 0.3s var(--ease), color 0.3s var(--ease), border-color 0.3s var(--ease);
}

.icons a:hover {
  transform: translateY(-3px);
  color: var(--text);
  border-color: var(--line-strong);
}

.icons .label {
  display: none;
}

.site-footer .fine {
  color: var(--text-faint);
  font-size: 0.82rem;
}

/* --------------------------------- app showcase -------------------------------- */

.work-item.has-shots {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 28px;
  align-items: center;
}

.app-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.app-logo {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  object-fit: cover;
  box-shadow: 0 6px 18px -6px rgba(0, 0, 0, 0.6);
  flex-shrink: 0;
}

.app-header h3 {
  margin: 0;
}

.app-shots {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 200px;
}

.app-shots img {
  width: 132px;
  border-radius: 20px;
  border: 1px solid var(--line-strong);
  box-shadow: 0 24px 48px -16px rgba(0, 0, 0, 0.65);
  transition: transform 0.5s var(--ease);
}

.app-shots img:first-child {
  transform: rotate(-7deg) translateX(16px);
  z-index: 1;
}

.app-shots img:last-child {
  transform: rotate(7deg) translateX(-16px);
  z-index: 2;
  margin-left: -34px;
}

.work-item:hover .app-shots img:first-child {
  transform: rotate(-11deg) translateX(10px) translateY(-6px);
}

.work-item:hover .app-shots img:last-child {
  transform: rotate(11deg) translateX(-10px) translateY(-6px);
}

@media (max-width: 760px) {
  .work-item.has-shots {
    grid-template-columns: 1fr;
  }

  .app-shots {
    margin-top: 8px;
  }
}

/* --------------------------------- CV specific -------------------------------- */

.timeline {
  position: relative;
  padding-left: 28px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 6px;
  bottom: 6px;
  width: 1px;
  background: linear-gradient(var(--line-strong), transparent);
}

.timeline-item {
  position: relative;
  padding: 0 0 40px 26px;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -28px;
  top: 6px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--gradient);
  box-shadow: 0 0 0 4px var(--bg), 0 0 16px rgba(41, 151, 255, 0.6);
}

.timeline-item h3 {
  margin: 0 0 4px;
  font-size: 1.1rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.timeline-item .meta {
  display: block;
  font-size: 0.82rem;
  color: var(--text-faint);
  margin-bottom: 14px;
}

.timeline-item ul {
  margin: 0;
  padding-left: 20px;
  color: var(--text-dim);
  line-height: 1.75;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tag {
  padding: 8px 16px;
  border-radius: 980px;
  background: var(--glass);
  border: 1px solid var(--line);
  font-size: 0.85rem;
  color: var(--text-dim);
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease), color 0.3s var(--ease);
}

.tag:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  color: var(--text);
}

ul.plain {
  margin: 0;
  padding-left: 20px;
  color: var(--text-dim);
  line-height: 1.8;
}

/* --------------------------------- lists (generic content) -------------------- */

section ul:not(.icons):not(.tags):not(.nav-links) {
  padding-left: 20px;
  color: var(--text-dim);
  line-height: 1.8;
}

section ul li strong {
  color: var(--text);
}

/* --------------------------------- responsive ---------------------------------- */

@media (max-width: 760px) {
  .nav-links {
    position: fixed;
    top: var(--nav-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    background: rgba(5, 6, 10, 0.92);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--line);
    padding: 8px 28px 20px;
    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
  }

  .nav.is-open .nav-links {
    opacity: 1;
    transform: none;
    pointer-events: auto;
  }

  .nav-links li {
    width: 100%;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
  }

  .nav-links li:last-child {
    border-bottom: none;
  }

  .nav-toggle {
    display: block;
  }

  section {
    padding: 76px 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* --------------------------------- print (CV) ---------------------------------- */

@media print {
  .bg-orbs, .grain, .cursor-glow, .nav, .scroll-progress, .hero-actions, .site-footer {
    display: none !important;
  }

  body {
    background: #fff;
    color: #111;
  }

  .hero {
    min-height: auto;
    padding: 10px 0 30px;
  }

  .card, .stat, .work-item, .timeline-item::before {
    background: none;
    border-color: #ddd;
  }

  .hero .role, .stat .num, .nav-logo {
    -webkit-text-fill-color: initial;
    background: none;
    color: #333;
  }

  a { color: #111; text-decoration: underline; }
  .reveal { opacity: 1 !important; transform: none !important; }
}
