/* ============================================
   CSS VARIABLES & RESET (mobile-first)
   ============================================ */

:root {
  --bg: #0b1120;
  --bg-alt: #0f172a;
  --surface: #1e293b;
  --surface-hover: #273549;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --accent: #38bdf8;
  --accent-hover: #7dd3fc;
  --border: rgba(148, 163, 184, 0.15);
  --radius: 10px;
  --radius-sm: 8px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  --nav-height: 4rem;
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2.5rem;
  --space-xl: 4rem;
  --transition: 0.25s ease;
  --container: min(1100px, 100% - 2rem);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
  padding-top: var(--nav-height);
}

body.preloader-active {
  overflow: hidden;
}

body.preloader-active .navbar,
body.preloader-active main,
body.preloader-active .site-footer,
body.preloader-active .top-btn {
  opacity: 0;
}

body.is-loaded .navbar,
body.is-loaded main,
body.is-loaded .site-footer,
body.is-loaded .top-btn {
  opacity: 1;
  transition: opacity 0.45s ease;
}

/* ============================================
   DEVELOPER PRELOADER
   ============================================ */

.preloader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #05080f;
  background-image: radial-gradient(
    ellipse 70% 50% at 50% 0%,
    rgba(56, 189, 248, 0.08),
    transparent 70%
  );
  transition: opacity 0.55s ease, visibility 0.55s ease;
}

.preloader--done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.preloader__terminal {
  width: min(92vw, 26rem);
  padding: var(--space-md) var(--space-lg);
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: var(--radius);
  box-shadow: 0 0 40px rgba(56, 189, 248, 0.08);
  font-family: "Cascadia Code", "Consolas", "Courier New", monospace;
}

.preloader__line {
  font-size: 0.9rem;
  color: #a5f3fc;
  margin-bottom: var(--space-sm);
  min-height: 1.4em;
}

.preloader__prompt {
  color: var(--accent);
  margin-right: 0.35rem;
}

.preloader__cursor {
  display: inline-block;
  color: var(--accent);
  animation: cursor-blink 0.9s step-end infinite;
}

@keyframes cursor-blink {
  50% {
    opacity: 0;
  }
}

.preloader__bar {
  height: 4px;
  background: var(--bg);
  border-radius: 99px;
  overflow: hidden;
}

.preloader__progress {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #818cf8);
  border-radius: 99px;
  transition: width 0.35s ease;
}

@media (prefers-reduced-motion: reduce) {
  .preloader__cursor {
    animation: none;
  }

  .preloader,
  body.is-loaded .navbar,
  body.is-loaded main,
  body.is-loaded .site-footer {
    transition: none;
  }
}

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

a {
  color: var(--accent);
  transition: color var(--transition);
}

a:hover {
  color: var(--accent-hover);
}

.container {
  width: var(--container);
  margin-inline: auto;
}

/* ============================================
   SCROLL REVEAL ANIMATIONS
   ============================================ */

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity 0.6s ease,
    transform 0.6s ease;
  transition-delay: var(--delay, 0ms);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .top-btn,
  .project-card,
  .btn,
  .navbar__menu {
    transition: none !important;
  }
}

/* ============================================
   STICKY NAVBAR
   ============================================ */

.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: var(--nav-height);
  background: rgba(11, 17, 32, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: box-shadow var(--transition);
}

.navbar--scrolled {
  box-shadow: var(--shadow);
}

.navbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.navbar__brand {
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--text);
  text-decoration: none;
}

.navbar__brand:hover {
  color: var(--accent);
}

.navbar__toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0.5rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.navbar__toggle-bar {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}

.navbar__toggle[aria-expanded="true"] .navbar__toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.navbar__toggle[aria-expanded="true"] .navbar__toggle-bar:nth-child(2) {
  opacity: 0;
}

.navbar__toggle[aria-expanded="true"] .navbar__toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.navbar__menu {
  list-style: none;
  display: none;
  flex-direction: column;
  gap: 0.25rem;
  position: absolute;
  top: var(--nav-height);
  left: 0;
  right: 0;
  padding: var(--space-sm);
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
}

.navbar__menu.is-open {
  display: flex;
}

.nav-link {
  display: block;
  padding: 0.65rem 1rem;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
}

.nav-link:hover,
.nav-link--active {
  color: var(--text);
  background: rgba(56, 189, 248, 0.1);
}

.nav-link--active {
  color: var(--accent);
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
  display: inline-block;
  padding: 0.7rem 1.35rem;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: background var(--transition), transform var(--transition), color var(--transition);
}

.btn--primary {
  color: var(--bg);
  background: var(--accent);
}

.btn--primary:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  color: var(--bg);
}

.btn--ghost {
  color: var(--text);
  border: 1px solid var(--border);
  background: transparent;
}

.btn--ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}

.btn:focus-visible,
.hero__cta:focus-visible,
.top-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ============================================
   HERO (HOME)
   ============================================ */

.hero {
  min-height: calc(100vh - var(--nav-height));
  min-height: calc(100dvh - var(--nav-height));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg) var(--space-sm);
  text-align: center;
  background-color: var(--bg-alt);
  background-image: radial-gradient(
    ellipse 90% 60% at 50% -10%,
    rgba(56, 189, 248, 0.12),
    transparent 70%
  );
}

.hero__inner {
  max-width: 40rem;
}

/* Profile photo (replace assets/images/profile.jpg to update) */
.profile-photo {
  display: block;
  width: 9.5rem;
  height: 9.5rem;
  margin: 0 auto var(--space-md);
  object-fit: cover;
  object-position: center 15%;
  border-radius: 50%;
  border: 3px solid rgba(56, 189, 248, 0.35);
  box-shadow: var(--shadow);
  opacity: 0;
  transition: opacity 0.4s ease;
}

body.is-loaded .profile-photo {
  opacity: 1;
}

.hero__greeting {
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--space-xs);
}

.hero__name {
  font-size: clamp(1.75rem, 6vw, 2.85rem);
  font-weight: 700;
  line-height: 1.15;
  color: #f8fafc;
  margin-bottom: var(--space-sm);
}

.hero__title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: var(--space-xs);
}

.hero__subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: var(--space-md);
}

.hero__mission {
  color: #cbd5e1;
  margin-bottom: var(--space-md);
  max-width: 34rem;
  margin-inline: auto;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  justify-content: center;
}

/* ============================================
   SECTIONS (shared)
   ============================================ */

.section {
  padding: var(--space-xl) 0;
}

.section--alt {
  background: var(--bg-alt);
}

.section__header {
  text-align: center;
  margin-bottom: var(--space-lg);
  max-width: 36rem;
  margin-inline: auto;
}

.section__title {
  font-size: clamp(1.5rem, 4vw, 2rem);
  color: #f8fafc;
  margin-bottom: var(--space-xs);
}

.section__lead {
  color: var(--text-muted);
}

/* ============================================
   PROJECT CARDS
   ============================================ */

.projects-grid {
  display: grid;
  gap: var(--space-md);
}

.project-card {
  padding: var(--space-md);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.project-card:hover {
  transform: translateY(-4px);
  border-color: rgba(56, 189, 248, 0.35);
  box-shadow: var(--shadow);
}

.project-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: var(--space-sm);
}

.project-card__tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  background: rgba(56, 189, 248, 0.12);
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
}

.project-card__level {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
}

.project-card__title {
  font-size: 1.2rem;
  color: #f8fafc;
  margin-bottom: var(--space-xs);
}

.project-card__desc {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: var(--space-sm);
}

.project-card__stack {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: var(--space-sm);
}

.project-card__stack li {
  font-size: 0.8rem;
  padding: 0.2rem 0.5rem;
  background: var(--bg);
  border-radius: 4px;
  color: var(--text-muted);
}

.project-card__link {
  font-weight: 600;
  text-decoration: none;
}

.project-card__status {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ============================================
   SKILLS
   ============================================ */

.skills-grid {
  display: grid;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.skill-item__header {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
}

.skill-item__level {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.skill-bar {
  height: 8px;
  background: var(--surface);
  border-radius: 99px;
  overflow: hidden;
}

.skill-bar span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), #818cf8);
  border-radius: 99px;
  transition: width 1s ease;
}

.skill-item__note {
  margin-top: 0.45rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.skills-tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.skills-tags li {
  font-size: 0.85rem;
  padding: 0.35rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 99px;
  color: var(--text-muted);
  transition: border-color var(--transition), color var(--transition);
}

.skills-tags li:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ============================================
   CONTACT (two panels)
   ============================================ */

.contact-grid {
  display: grid;
  gap: var(--space-md);
  max-width: 56rem;
  margin-inline: auto;
}

.contact-panel {
  padding: var(--space-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.contact-panel__title {
  font-size: 1.15rem;
  color: #f8fafc;
  margin-bottom: var(--space-xs);
}

.contact-panel__intro {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: var(--space-md);
}

/* Panel 1: contact details with icons */
.contact-detail-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.contact-detail {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
  transition: background var(--transition), color var(--transition);
}

.contact-detail:hover {
  background: rgba(56, 189, 248, 0.08);
  color: var(--accent);
}

.contact-detail__icon {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg);
  color: var(--accent);
}

.contact-detail__icon svg {
  width: 1.15rem;
  height: 1.15rem;
}

.contact-detail__icon--whatsapp {
  color: #25d366;
}

.contact-detail__icon--telegram {
  color: #26a5e4;
}

.contact-detail__text {
  font-size: 0.92rem;
  font-weight: 500;
  word-break: break-word;
}

/* Panel 2: contact form */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group label {
  font-size: 0.9rem;
  font-weight: 600;
  color: #f8fafc;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition), opacity var(--transition);
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.form-group input:disabled,
.form-group textarea:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.form-group--locked label {
  color: var(--text-muted);
}

.form-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
}

.form-hint.is-hidden {
  display: none;
}

.contact-form__submit {
  width: 100%;
  border: none;
  cursor: pointer;
}

.contact-form__submit:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

/* ============================================
   ABOUT PAGE
   ============================================ */

.page-hero {
  padding: var(--space-xl) 0 var(--space-lg);
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
}

.back-link {
  display: inline-block;
  font-size: 0.9rem;
  text-decoration: none;
  margin-bottom: var(--space-md);
  color: var(--text-muted);
}

.back-link:hover {
  color: var(--accent);
}

.page-hero__title {
  font-size: clamp(2rem, 5vw, 2.75rem);
  color: #f8fafc;
  margin-bottom: var(--space-sm);
}

.page-hero__lead {
  color: var(--text-muted);
  max-width: 40rem;
}

.about-main {
  padding: var(--space-xl) 0;
}

.about-block {
  margin-bottom: var(--space-xl);
}

.about-block__title {
  font-size: 1.35rem;
  color: var(--accent);
  margin-bottom: var(--space-md);
}

.about-block p {
  color: #cbd5e1;
  margin-bottom: var(--space-sm);
}

.about-block p:last-child {
  margin-bottom: 0;
}

/* Timeline */
.timeline {
  list-style: none;
  border-left: 2px solid var(--border);
  margin-left: 0.5rem;
  padding-left: var(--space-md);
}

.timeline__item {
  position: relative;
  padding-bottom: var(--space-lg);
}

.timeline__item:last-child {
  padding-bottom: 0;
}

.timeline__item::before {
  content: "";
  position: absolute;
  left: calc(-1 * var(--space-md) - 5px);
  top: 0.35rem;
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 4px var(--bg);
}

.timeline__date {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 0.25rem;
}

.timeline__title {
  font-size: 1.05rem;
  color: #f8fafc;
  margin-bottom: 0.35rem;
}

.timeline__item p {
  font-size: 0.95rem;
  color: var(--text-muted);
}

/* Values grid */
.values-grid {
  list-style: none;
  display: grid;
  gap: var(--space-md);
}

.values-card {
  padding: var(--space-md);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: transform var(--transition), border-color var(--transition);
}

.values-card:hover {
  transform: translateY(-3px);
  border-color: rgba(56, 189, 248, 0.3);
}

.values-card h3 {
  color: #f8fafc;
  font-size: 1rem;
  margin-bottom: 0.35rem;
}

.values-card p {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.about-cta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  justify-content: center;
  padding-top: var(--space-md);
}

/* ============================================
   FOOTER
   ============================================ */

.site-footer {
  padding: var(--space-lg) 0;
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

/* ============================================
   BACK TO TOP BUTTON
   ============================================ */

.top-btn {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 900;
  width: 3rem;
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg);
  cursor: pointer;
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: scale(0.85);
  transition:
    opacity 0.35s ease,
    visibility 0.35s ease,
    transform 0.35s ease,
    background 0.2s ease;
}

.top-btn.is-visible {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
}

.top-btn:hover {
  background: var(--accent-hover);
  transform: scale(1.08);
}

.top-btn.is-visible:hover {
  transform: scale(1.08);
}

/* ============================================
   TABLET (768px+)
   ============================================ */

@media (min-width: 768px) {
  .navbar__toggle {
    display: none;
  }

  .navbar__menu {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.25rem;
    position: static;
    padding: 0;
    background: transparent;
    border: none;
  }

  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .skills-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .values-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .contact-grid {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

/* ============================================
   DESKTOP (1024px+)
   ============================================ */

@media (min-width: 1024px) {
  .projects-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
