:root {
  --bg: #000;
  --card: #0b0b10;
  --card-2: #13131a;
  --border: #1e1e27;
  --text: #f4f4f6;
  --muted: #9a9aa8;
  --accent: #4f6ef7;
  --accent-hover: #3d5ae6;
  --radius: 22px;
  --shadow: none;
}

:root[data-theme="light"] {
  --bg: #f3f4f7;
  --card: #ffffff;
  --card-2: #f1f2f6;
  --border: #e4e5eb;
  --text: #111118;
  --muted: #646474;
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: "Inter", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  transition: background 0.25s, color 0.25s;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
ul { list-style: none; }
[hidden] { display: none !important; }
img { display: block; max-width: 100%; }

.container { width: min(1272px, 100% - 32px); margin-inline: auto; }
.muted { color: var(--muted); }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.card h2 { font-size: 24px; font-weight: 600; margin-bottom: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.card-head h2 { margin: 0; }
.link { color: var(--accent); border-bottom: 1px solid var(--accent); font-size: 15px; white-space: nowrap; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 18px; border-radius: 10px; font-weight: 500; font-size: 15px;
  transition: background 0.2s, border-color 0.2s, transform 0.1s;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-outline { border: 1px solid var(--border); }
.btn-outline:hover { background: var(--card-2); }
.btn-dark { background: var(--card-2); border: 1px solid var(--border); font-weight: 600; }
.btn-dark:hover { border-color: var(--muted); }
.icon-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 10px;
  border-radius: 10px; font-weight: 600; font-size: 14px;
}
.icon-btn:hover { background: var(--card-2); }

/* ---------- Nav ---------- */
header { position: sticky; top: 12px; z-index: 20; margin-top: 24px; }
.nav { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 12px 12px 24px; }
.logo svg { fill: var(--text); }
.nav-links { display: flex; gap: 6px; }
.nav-links a { display: block; padding: 10px 16px; border-radius: 10px; color: var(--muted); font-weight: 500; transition: color 0.2s, background 0.2s; }
.nav-links a:hover, .nav-links a.active { color: var(--text); background: var(--card-2); }
.nav-actions { display: flex; align-items: center; gap: 8px; }
.lang { position: relative; }
.lang-menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 150px;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 6px;
}
.lang-menu button { width: 100%; text-align: left; padding: 8px 12px; border-radius: 8px; }
.lang-menu button:hover, .lang-menu button.active { background: var(--card-2); }
.sun { color: #f5b301; }
[data-theme="dark"] .moon, [data-theme="light"] .sun { display: none; }

/* ---------- Bento ---------- */
main { margin-top: 24px; }
.bento { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; align-items: start; }
.col { display: grid; gap: 24px; min-width: 0; }
.bento > * { min-width: 0; }
.wide { grid-column: span 2; }
.bento > .card { height: 100%; }

.photo { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 14px; background: var(--card-2); }
.name { font-size: 24px; font-weight: 600; margin-top: 24px; }
.wave { display: inline-block; animation: wave 2.4s ease-in-out infinite; transform-origin: 70% 70%; }
@keyframes wave { 0%, 60%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(14deg); } 20% { transform: rotate(-8deg); } 40% { transform: rotate(10deg); } }
.profile > .muted { margin-top: 8px; }
.profile-btns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 24px; }
.profile-btns .btn-primary, #resumeBtn[hidden] + #eduBtn { grid-column: span 2; }
.socials { display: flex; gap: 8px; margin-top: 24px; }
.socials a {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px;
  background: var(--card-2); border: 1px solid var(--border); font-size: 18px; transition: border-color 0.2s;
}
.socials a:hover { border-color: var(--accent); }
.socials svg { width: 18px; height: 18px; fill: currentColor; }

/* Timeline */
.timeline { display: grid; gap: 22px; }
.timeline li { display: grid; grid-template-columns: 120px 32px 1fr; gap: 12px; align-items: start; }
.timeline .period { font-size: 14px; font-weight: 500; padding-top: 4px; }
.timeline .logo-box {
  width: 32px; height: 32px; border-radius: 8px; background: var(--card-2); border: 1px solid var(--border);
  display: grid; place-items: center; overflow: hidden; font-weight: 700; font-size: 14px; color: var(--accent);
}
.timeline .logo-box img { width: 100%; height: 100%; object-fit: cover; }
.timeline strong { display: block; font-weight: 600; }
.timeline .muted { font-size: 14px; }

/* Stack */
.stack-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 10px; }
.stack.loop {
  height: 330px; overflow: hidden;
  -webkit-mask-image: linear-gradient(transparent, #000 10%, #000 90%, transparent);
  mask-image: linear-gradient(transparent, #000 10%, #000 90%, transparent);
}
.stack-track { animation: stack-scroll var(--dur, 20s) linear infinite; }
.stack-track .stack-grid { padding-bottom: 14px; }
.stack.loop:hover .stack-track { animation-play-state: paused; }
@keyframes stack-scroll { to { transform: translateY(-50%); } }
.si-icon {
  width: 30px; height: 30px; color: var(--text); background: currentColor;
  -webkit-mask: var(--mask) center / contain no-repeat; mask: var(--mask) center / contain no-repeat;
}
.ic-icon { width: 30px; height: 30px; color: var(--accent); }
.img-icon { width: 32px; height: 32px; object-fit: contain; }
.txt-icon { font-size: 14px; font-weight: 700; color: var(--accent); letter-spacing: 0.5px; }
.stack-item { display: grid; justify-items: center; align-content: start; gap: 8px; font-size: 13px; line-height: 1.3; text-align: center; }
.stack-item .ico {
  width: 100%; height: 64px; display: grid; place-items: center; border-radius: 12px;
  background: var(--card-2); border: 1px solid var(--border); font-size: 30px; transition: transform 0.2s;
}
.stack-item:hover .ico { transform: translateY(-3px); }

/* Projects */
.preview-list { display: grid; gap: 20px; }
.project-thumb {
  position: relative; display: block; aspect-ratio: 3 / 2; border-radius: 14px; overflow: hidden;
  background: var(--card-2); border: 1px solid var(--border);
}
.project-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s; }
.project-thumb:hover img, .project-thumb:hover .placeholder { transform: scale(1.04); }
.project-thumb .placeholder {
  width: 100%; height: 100%; display: grid; place-items: center; color: #fff;
  font-size: 26px; font-weight: 700; transition: transform 0.4s;
}
.project-thumb .badge {
  position: absolute; left: 14px; bottom: 14px; background: #fff; color: var(--accent);
  font-size: 13px; font-weight: 500; padding: 3px 9px; border-radius: 6px;
}

.section { margin-top: 72px; scroll-margin-top: 110px; }
.projects-preview { scroll-margin-top: 110px; }
.section-title { font-size: 32px; font-weight: 700; margin-bottom: 24px; }
.projects-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.project-card { display: flex; flex-direction: column; gap: 14px; padding: 16px; }
.project-card h3 { font-size: 19px; font-weight: 600; }
.project-card p { font-size: 15px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.tags span { font-size: 12px; padding: 4px 10px; border-radius: 999px; background: var(--card-2); border: 1px solid var(--border); color: var(--muted); }

/* Videos */
.videos { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.video { display: grid; gap: 8px; font-size: 14px; }
.video img { aspect-ratio: 16 / 9; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); }


/* Work card: videolar bo'lmasa butun qatorni egallaydi */
#videosCard[hidden] + .work { grid-column: 1 / -1; }
/* Work card */
.work { display: flex; flex-direction: column; gap: 18px; justify-content: center; }
.work h3 { font-size: 18px; font-weight: 600; }
.work .link { align-self: flex-start; }
.marquee {
  display: flex; overflow: hidden; white-space: nowrap; background: var(--card-2);
  border-radius: 12px; padding: 14px 0; font-size: 18px; color: var(--muted);
}
.marquee span { padding-right: 48px; animation: marquee 14s linear infinite; }
@keyframes marquee { to { transform: translateX(-100%); } }

/* Contact page */
.contact-card { display: none; }
.page-contact .bento > :not(.profile, .contact-card) { display: none; }
.page-contact .contact-card { display: block; grid-column: span 2; padding: 40px; }
.contact-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.contact-title { font-size: clamp(28px, 4vw, 40px); font-weight: 700; line-height: 1.2; }
.contact-title .accent { color: var(--accent); }
.online {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 10px; flex: none;
  background: var(--card-2); color: var(--accent); font-weight: 600;
}
.online i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(79, 110, 247, 0.6); } 70%, 100% { box-shadow: 0 0 0 8px rgba(79, 110, 247, 0); } }
.contact-text { margin-top: 24px; font-size: 20px; color: var(--muted); max-width: 40ch; }
.contact-text strong { color: var(--text); }
.contact-tiles { display: flex; flex-wrap: wrap; gap: 20px; margin-top: 56px; }
.contact-tile {
  display: grid; justify-items: center; align-content: center; gap: 12px; width: 150px; height: 140px;
  border-radius: 16px; background: var(--card-2); border: 1px solid var(--border);
  transition: transform 0.2s, border-color 0.2s;
}
.contact-tile:hover { transform: translateY(-4px); border-color: var(--tile, var(--accent)); }
.tile-icon { width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; background: var(--tile, var(--accent)); color: #fff; }
.tile-icon svg { width: 28px; height: 28px; fill: currentColor; }
.tile-label { font-size: 14px; color: var(--muted); }
.tile-sub { margin-top: -8px; font-size: 13px; font-weight: 600; color: var(--text); }
.contact-tile:has(.tile-sub) { width: auto; min-width: 150px; padding: 0 18px; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50;
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 10px; font-size: 14px; font-weight: 500;
}
.tile-telegram { --tile: #27a7e7; }
.tile-linkedin { --tile: #0a66c2; }
.tile-github { --tile: #333; }
.tile-youtube { --tile: #ff0000; }
.tile-phone { --tile: #22c55e; }

.footer { padding: 48px 0 32px; text-align: center; font-size: 14px; }

/* Dialog */
.dialog {
  margin: auto; width: min(520px, 100% - 32px); background: var(--card); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 24px;
}
.dialog-wide { width: min(1080px, 100% - 32px); max-height: calc(100vh - 48px); }
.dialog-wide .project-card { background: var(--card-2); }
.dialog::backdrop { background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(4px); }

/* Snow */
#snow { position: fixed; inset: 0; pointer-events: none; z-index: 30; overflow: hidden; }
.flake { position: absolute; top: -10px; color: #9ec5ff; opacity: 0.7; animation: fall linear infinite; }
@keyframes fall { to { transform: translateY(105vh) rotate(360deg); } }


/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .projects-preview { grid-column: span 2; }
  .projects-preview .preview-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .work { grid-column: span 2; }
  .page-contact .contact-card { grid-column: auto; padding: 28px; }
  .projects-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #ctaTop { display: none; }
}
@media (max-width: 720px) {
  header { top: 8px; margin-top: 12px; }
  .nav { padding: 8px 8px 8px 16px; }
  .nav-links a { padding: 8px 10px; font-size: 14px; }
  .bento, .projects-grid, .contact, .projects-preview .preview-list { grid-template-columns: minmax(0, 1fr); }
  .bento > *, .wide, .projects-preview, .work, .page-contact .contact-card { grid-column: auto; }
  .contact-head { flex-direction: column-reverse; }
  .contact-tiles { gap: 12px; margin-top: 32px; }
  .contact-tile, .contact-tile:has(.tile-sub) { width: calc(50% - 6px); min-width: 0; padding: 0 8px; }
  .timeline li { grid-template-columns: 32px 1fr; }
  .timeline .period { grid-column: 2; padding: 0; order: 2; color: var(--muted); font-size: 13px; }
  .timeline .logo-box { grid-row: span 2; }
  .contact { padding: 24px; }
  .section { margin-top: 48px; }
}
@media (max-width: 480px) {
  .nav-links { display: none; }
  .stack-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
  .stack.loop { overflow-y: auto; }
  .stack-track .stack-grid + .stack-grid { display: none; }
}
