/* ==========================================================
   Kiril Karadzov — Portfolio
   Dark developer theme, card layout
   ========================================================== */

:root {
  --bg: #2a2d34;
  --card: #15171c;
  --card-2: #1b1e25;
  --panel: #232730;
  --line: rgba(255, 255, 255, 0.1);
  --text: #f4f5f7;
  --muted: #9aa1ae;
  --blue: #1f5eff;
  --blue-2: #4d82ff;
  --yellow: #ffc61a;
  --radius: 28px;
  --font-head: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --wrap: 1240px;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 96px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; margin: 0; padding: 0; }
h1, h2, h3, h4, h6, p, dl, dd, figure { margin: 0; }

:focus-visible { outline: 2px solid var(--blue-2); outline-offset: 3px; border-radius: 6px; }

/* ---------- Shared ---------- */
.card {
  width: min(var(--wrap), calc(100% - 32px));
  margin: 0 auto 28px;
  background: var(--card);
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
}

.rule { display: block; width: 72px; height: 3px; background: var(--text); margin-bottom: 28px; border-radius: 2px; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--blue-2);
  margin-bottom: 14px;
}

h1, h2, h3 { font-family: var(--font-head); letter-spacing: -0.02em; line-height: 1.1; }
h2 { font-size: clamp(1.9rem, 3.4vw, 2.9rem); font-weight: 600; }
h2.h3 { font-size: clamp(1.5rem, 2.4vw, 2rem); }
.lead { color: var(--muted); max-width: 56ch; margin-top: 18px; }
.hl { color: var(--blue-2); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--blue); color: #fff; font-weight: 600; font-size: 0.95rem;
  padding: 14px 26px; border: 0; border-radius: 999px; cursor: pointer;
  transition: transform 0.2s, background 0.2s, box-shadow 0.2s;
}
.btn:hover { background: var(--blue-2); transform: translateY(-2px); box-shadow: 0 10px 28px -10px var(--blue); }
.btn--small { padding: 9px 18px; font-size: 0.85rem; }

.link-u {
  display: inline-block; font-size: 0.78rem; font-weight: 600; letter-spacing: 0.04em;
  padding-bottom: 3px; border-bottom: 1.5px solid var(--text);
  transition: color 0.2s, border-color 0.2s;
}
.link-u:hover { color: var(--blue-2); border-color: var(--blue-2); }

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity 0.7s ease, transform 0.7s ease; transition-delay: var(--d, 0s); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  padding: 14px 16px;
  transition: background 0.3s, backdrop-filter 0.3s;
}
.site-header.scrolled { background: rgba(42, 45, 52, 0.78); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.header__inner {
  width: min(var(--wrap), 100%); margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 6px 28px;
}
.logo { display: inline-flex; align-items: center; gap: 12px; font-family: var(--font-head); font-weight: 600; font-size: 1.25rem; }
.logo svg { color: var(--blue-2); }
.nav { display: flex; align-items: center; gap: 30px; font-size: 0.88rem; color: #d6d9e0; }
.nav a:not(.btn) { position: relative; padding: 4px 0; transition: color 0.2s; }
.nav a:not(.btn)::after { content: ""; position: absolute; left: 0; bottom: 0; width: 0; height: 2px; background: var(--blue-2); transition: width 0.25s; }
.nav a:not(.btn):hover, .nav a.active { color: #fff; }
.nav a:not(.btn):hover::after, .nav a.active::after { width: 100%; }

.burger { display: none; width: 44px; height: 44px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; flex-direction: column; align-items: center; justify-content: center; gap: 5px; }
.burger span { width: 20px; height: 2px; background: #fff; border-radius: 2px; transition: transform 0.25s, opacity 0.25s; }
.burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Photo ---------- */
.photo-ring {
  position: relative; aspect-ratio: 1; border-radius: 50%;
  background: var(--yellow);
  box-shadow: 0 0 0 10px rgba(31, 94, 255, 0.18), 0 0 0 11px rgba(31, 94, 255, 0.5), 0 40px 80px -30px rgba(0, 0, 0, 0.8);
  overflow: hidden;
}
.photo-ring img { width: 100%; height: 100%; object-fit: cover; object-position: center 20%; }
.monogram { position: absolute; inset: 0; display: none; place-items: center; font-family: var(--font-head); font-weight: 700; font-size: clamp(4rem, 10vw, 7rem); color: var(--card); }
.photo-ring.no-photo img { display: none; }
.photo-ring.no-photo .monogram { display: grid; }

/* ---------- Hero ---------- */
.hero {
  display: grid; grid-template-columns: 1.15fr 0.95fr 0.8fr; align-items: center; gap: 40px;
  padding: 72px 56px 64px; min-height: 640px;
  background:
    radial-gradient(60% 70% at 55% 55%, rgba(31, 94, 255, 0.16), transparent 70%),
    var(--card);
}
.hero h1 { font-size: clamp(2.5rem, 4.6vw, 4.2rem); font-weight: 600; margin-bottom: 26px; }
.hero__text p { color: var(--muted); max-width: 44ch; margin-bottom: 38px; }

.round-btn {
  display: grid; place-items: center; width: 62px; height: 62px; border-radius: 50%;
  background: var(--blue); color: #fff; transition: transform 0.25s, background 0.25s;
  animation: bob 2.4s ease-in-out infinite;
}
.round-btn:hover { background: var(--blue-2); animation-play-state: paused; transform: scale(1.08); }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(6px); } }

.hero__photo { position: relative; justify-self: center; width: 100%; max-width: 400px; }
.badge {
  position: absolute; left: 50%; bottom: -18px; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 10px; white-space: nowrap;
  background: var(--card-2); border: 1px solid var(--line); border-radius: 999px;
  padding: 10px 18px; font-size: 0.82rem; font-weight: 500;
}
.pulse { width: 9px; height: 9px; border-radius: 50%; background: #35d07f; box-shadow: 0 0 0 0 rgba(53, 208, 127, 0.6); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px rgba(53, 208, 127, 0); } 100% { box-shadow: 0 0 0 0 rgba(53, 208, 127, 0); } }

.hero__side { display: grid; gap: 30px; }
.side-block h6 { font-family: var(--font-mono); font-weight: 500; font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.side-block p { font-size: 0.88rem; color: #c4c8d1; margin-bottom: 14px; }
.socials { display: flex; gap: 10px; }
.socials a { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); color: #d6d9e0; transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.2s; }
.socials a:hover { background: var(--blue); border-color: var(--blue); color: #fff; transform: translateY(-3px); }

/* ---------- About ---------- */
.about { padding: 80px 56px; }
.about__top { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 56px; align-items: center; }
.about h2 { margin-bottom: 24px; max-width: 14ch; }
.about__text p + p { margin-top: 14px; }
.about__text > p:not(.eyebrow) { color: var(--muted); max-width: 54ch; }
.about__photo { justify-self: center; width: 100%; max-width: 380px; }

.stats { display: flex; gap: 44px; margin-top: 44px; flex-wrap: wrap; }
.stats li { display: flex; align-items: center; gap: 14px; }
.stats strong { font-family: var(--font-head); font-size: clamp(2.6rem, 4vw, 3.6rem); font-weight: 500; line-height: 1; }
.stats strong em { font-style: normal; color: var(--blue-2); }
.stats li > span { font-size: 0.82rem; color: var(--muted); line-height: 1.35; }

.about__bottom { display: grid; grid-template-columns: 1.3fr 1fr; gap: 28px; margin-top: 64px; align-items: stretch; }

.code { background: #0f1115; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.code__bar { display: flex; align-items: center; gap: 7px; padding: 12px 16px; background: #181b21; border-bottom: 1px solid var(--line); }
.code__bar i { width: 11px; height: 11px; border-radius: 50%; background: #3a3f4a; }
.code__bar i:nth-child(1) { background: #ff5f57; } .code__bar i:nth-child(2) { background: #febc2e; } .code__bar i:nth-child(3) { background: #28c840; }
.code__bar span { margin-left: 12px; font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted); }
.code pre { margin: 0; padding: 22px 24px; overflow-x: auto; font-family: var(--font-mono); font-size: 0.84rem; line-height: 1.75; color: #d6d9e0; }
.c-k { color: #c792ea; } .c-v { color: #82aaff; } .c-p { color: #7fdbca; } .c-s { color: #ecc48d; }

.facts { display: grid; align-content: center; background: var(--card-2); border: 1px solid var(--line); border-radius: 18px; padding: 8px 28px; }
.facts div { display: flex; justify-content: space-between; gap: 20px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.facts div:last-child { border-bottom: 0; }
.facts dt { font-family: var(--font-mono); font-size: 0.74rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.facts dd { font-weight: 500; text-align: right; }
.facts a:hover { color: var(--blue-2); }

/* ---------- Portfolio ---------- */
.work { padding: 80px 56px; }
.section-head h2 { max-width: 20ch; }
.projects { margin-top: 48px; border-top: 1px solid var(--line); }
.projects li { border-bottom: 1px solid var(--line); }
.projects a {
  display: grid; grid-template-columns: 60px 1fr auto 52px; align-items: center; gap: 24px;
  padding: 30px 12px; border-radius: 4px; transition: background 0.25s, padding 0.25s;
}
.projects a:hover { background: var(--card-2); padding-left: 24px; padding-right: 24px; }
.p-num { font-family: var(--font-mono); font-size: 0.85rem; color: var(--muted); }
.p-main { display: grid; gap: 4px; }
.p-main small { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--blue-2); }
.p-main strong { font-family: var(--font-head); font-size: clamp(1.3rem, 2.2vw, 1.9rem); font-weight: 600; letter-spacing: -0.01em; }
.p-main span { color: var(--muted); font-size: 0.92rem; }
.p-tags { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.p-tags b, .s-tags b { font-weight: 500; font-size: 0.74rem; color: #c4c8d1; border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; }
.p-arrow { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--line); transition: background 0.25s, border-color 0.25s, transform 0.25s; }
.projects a:hover .p-arrow { background: var(--blue); border-color: var(--blue); transform: rotate(45deg); }
.projects .more .p-main strong { color: var(--blue-2); }

/* ---------- Services / split ---------- */
.split { display: grid; grid-template-columns: 1.45fr 1fr; padding: 0; }
.split__main { padding: 80px 56px; }
.split__panel { background: var(--panel); padding: 80px 48px; }
.panel__inner { position: sticky; top: 110px; }
.panel__inner > p:not(.eyebrow) { color: var(--muted); margin-top: 16px; font-size: 0.95rem; }

.services { margin-top: 48px; border-top: 1px solid var(--line); }
.services li { display: grid; grid-template-columns: 52px 1fr 30px; gap: 16px; align-items: start; padding: 28px 0; border-bottom: 1px solid var(--line); transition: padding 0.25s; }
.services li:hover { padding-left: 12px; }
.s-num { font-family: var(--font-mono); font-size: 0.8rem; color: var(--muted); padding-top: 6px; }
.services h3 { font-size: 1.35rem; font-weight: 600; margin-bottom: 8px; }
.services p { color: var(--muted); font-size: 0.93rem; max-width: 52ch; }
.s-tags { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.s-arrow { font-style: normal; font-size: 1.3rem; color: var(--muted); transition: transform 0.25s, color 0.25s; }
.services li:hover .s-arrow { transform: translateX(6px); color: var(--blue-2); }

.approach, .background { margin-top: 80px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 32px; }
.steps li { background: var(--card-2); border: 1px solid var(--line); border-radius: 18px; padding: 26px 22px; transition: transform 0.25s, border-color 0.25s; }
.steps li:hover { transform: translateY(-4px); border-color: rgba(77, 130, 255, 0.5); }
.steps span { font-family: var(--font-mono); font-size: 0.8rem; color: var(--blue-2); }
.steps h3 { font-size: 1.15rem; margin: 10px 0 8px; }
.steps p { font-size: 0.88rem; color: var(--muted); }

.timeline { margin-top: 32px; position: relative; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 8px; bottom: 8px; width: 1px; background: var(--line); }
.timeline li { position: relative; display: grid; grid-template-columns: 110px 1fr; gap: 12px; padding: 0 0 30px 34px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: 0; top: 7px; width: 13px; height: 13px; border-radius: 50%; background: var(--card); border: 3px solid var(--blue); }
.timeline time { font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--blue-2); padding-top: 4px; }
.timeline h3 { font-size: 1.1rem; margin-bottom: 4px; }
.timeline p { color: var(--muted); font-size: 0.9rem; }

/* ---------- Contact ---------- */
.contact-list { margin: 26px 0 30px; display: grid; gap: 8px; }
.contact-list a { font-weight: 500; border-bottom: 1px solid transparent; transition: color 0.2s, border-color 0.2s; }
.contact-list a:hover { color: var(--blue-2); border-color: var(--blue-2); }

form { display: grid; gap: 18px; }
form label { display: grid; gap: 6px; }
form label span { font-size: 0.78rem; color: var(--muted); }
form input, form textarea {
  width: 100%; font: inherit; color: var(--text);
  background: transparent; border: 0; border-bottom: 1px solid rgba(255, 255, 255, 0.25);
  padding: 8px 0 10px; border-radius: 0; resize: vertical;
  transition: border-color 0.2s;
}
form input:focus, form textarea:focus { outline: none; border-color: var(--blue-2); }
form .invalid { border-color: #ff6b6b; }
form .btn { margin-top: 8px; justify-self: start; }
.form-status { font-size: 0.85rem; min-height: 1.4em; color: var(--muted); }
.form-status.error { color: #ff8585; }
.form-status.ok { color: #5fe0a0; }

/* ---------- Footer ---------- */
.site-footer { width: min(var(--wrap), calc(100% - 32px)); margin: 0 auto; padding: 36px 8px 48px; }
.footer__inner { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 28px; }
.site-footer p { color: var(--muted); font-size: 0.88rem; margin-top: 10px; }
.footer__links { display: grid; gap: 8px; font-size: 0.9rem; }
.footer__links a:hover { color: var(--blue-2); }
.site-footer .copy { margin: 0; text-align: right; line-height: 1.6; }

/* ==========================================================
   Responsive
   ========================================================== */
@media (max-width: 1080px) {
  .hero { grid-template-columns: 1fr 0.9fr; padding: 56px 40px; }
  .hero__side { grid-column: 1 / -1; grid-template-columns: repeat(3, 1fr); gap: 28px; padding-top: 32px; border-top: 1px solid var(--line); }
  .split { grid-template-columns: 1fr; }
  .panel__inner { position: static; }
  .split__panel { padding: 64px 56px; }
}

@media (max-width: 860px) {
  .burger { display: flex; }
  .nav {
    position: absolute; top: calc(100% + 4px); left: 16px; right: 16px;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 10px;
    opacity: 0; visibility: hidden; transform: translateY(-8px); transition: opacity 0.25s, transform 0.25s, visibility 0.25s;
  }
  .nav.open { opacity: 1; visibility: visible; transform: none; }
  .nav a { padding: 14px 16px !important; }
  .nav a:not(.btn)::after { display: none; }
  .nav__cta { margin-top: 6px; }

  .hero, .about, .work, .split__main { padding-left: 28px; padding-right: 28px; }
  .hero { grid-template-columns: 1fr; padding-top: 48px; padding-bottom: 48px; gap: 52px; min-height: 0; }
  .hero__photo { max-width: 320px; order: -1; }
  .hero__side { grid-template-columns: 1fr; }
  .hero__text p { max-width: none; }

  .about { padding-top: 56px; padding-bottom: 56px; }
  .about__top { grid-template-columns: 1fr; gap: 44px; }
  .about__photo { order: -1; max-width: 300px; }
  .about h2 { max-width: none; }
  .about__bottom { grid-template-columns: 1fr; }

  .work { padding-top: 56px; padding-bottom: 56px; }
  .projects a { grid-template-columns: 40px 1fr 44px; gap: 14px; }
  .p-tags { display: none; }

  .split__main { padding-top: 56px; padding-bottom: 56px; }
  .split__panel { padding: 56px 28px; }
  .steps { grid-template-columns: 1fr; }
  .timeline li { grid-template-columns: 1fr; gap: 2px; }
}

@media (max-width: 480px) {
  .stats { gap: 28px; }
  .facts { padding: 4px 20px; }
  .site-footer .copy { text-align: left; }
  .badge { font-size: 0.74rem; padding: 8px 14px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}
