/* ===== style.css ===== */

/* 1. VARIABLES & RESET */
:root {
  --bg: #ffffff;
  --surface: #f8fafc;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #0e5df2;
  --brand-hover: #0b46b9;
  --brand-light: #eff6ff;
  
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-browser: 0 20px 40px rgba(0,0,0,0.12);
  
  --radius: 16px;
  --container: 1160px;
  --header-h: 70px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  padding-top: var(--header-h);
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  overflow-x: hidden;
}

a { text-decoration: none; color: inherit; transition: 0.2s; }
ul { list-style: none; padding: 0; margin: 0; }
iframe { border: none; display: block; }
img { max-width: 100%; display: block; }

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

/* Typography */
h1 { font-size: clamp(28px, 5vw, 48px); font-weight: 800; line-height: 1.1; margin: 0 0 16px; letter-spacing: -0.02em; }
h2 { font-size: clamp(24px, 4vw, 36px); font-weight: 700; margin: 0 0 20px; }
h3 { font-size: 18px; font-weight: 600; margin: 0 0 8px; }
p { margin: 0 0 16px; color: var(--muted); font-size: 16px; }
.sub { font-size: 18px; max-width: 100%; margin-bottom: 30px; }
.text-center { text-align: center; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 12px 24px; font-weight: 600; border-radius: 12px;
  transition: all 0.2s; cursor: pointer; border: 1px solid transparent;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: scale(0.98); }

.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 4px 12px rgba(14, 93, 242, 0.3); }
.btn-primary:hover { background: var(--brand-hover); }

.btn-secondary { background: #fff; border-color: var(--line); color: var(--text); }
.btn-secondary:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-light); }

.btn-outline { border: 1px solid var(--line); background: transparent; color: var(--text); }
.btn-outline:hover { border-color: var(--brand); color: var(--brand); }

/* 2. HEADER */
.header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--header-h);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(0,0,0,0.05);
  transition: transform 0.3s;
}
.header.hidden { transform: translateY(-100%); }

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

.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; }
.brand-badge { width: 24px; height: 24px; background: linear-gradient(135deg, var(--brand), #60a5fa); border-radius: 6px; }

.menu { display: flex; gap: 24px; }
.menu a { font-weight: 500; font-size: 14px; }
.menu a:hover, .menu a.active { color: var(--brand); }

.burger { display: none; background: none; border: none; cursor: pointer; padding: 10px; }
.burger span { display: block; width: 24px; height: 2px; background: var(--text); position: relative; }
.burger span::before, .burger span::after { content: ''; position: absolute; left: 0; width: 100%; height: 2px; background: var(--text); transition: 0.3s; }
.burger span::before { top: -6px; }
.burger span::after { top: 6px; }
.burger.active span { background: transparent; }
.burger.active span::before { top: 0; transform: rotate(45deg); }
.burger.active span::after { top: 0; transform: rotate(-45deg); }

/* Mobile Menu (ВИПРАВЛЕНО) */
.mobile-menu {
  position: fixed;
  top: var(--header-h);
  left: 0;
  width: 100%;
  height: calc(100vh - var(--header-h)); /* Висота на весь залишок екрану */
  background-color: #ffffff; /* Явно білий фон */
  z-index: 95;
  display: flex;
  flex-direction: column;
  padding: 24px;
  gap: 20px;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-top: 1px solid var(--line);
  overflow-y: auto;
}

.mobile-menu.open {
  transform: translateX(0);
  box-shadow: -10px 0 20px rgba(0,0,0,0.1);
}

.mobile-menu a {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  border-bottom: 1px solid var(--surface);
  padding-bottom: 16px;
  display: block;
}

.mobile-menu a:hover {
  color: var(--brand);
}

/* 3. HERO (Index) */
.hero { padding: 50px 0 70px; background: linear-gradient(180deg, #f0f7ff 0%, #ffffff 100%); overflow: hidden; }
.hero-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: center; }

/* Page Hero (Program) */
.page-hero { padding: 60px 0 40px; background: linear-gradient(180deg, #f0f7ff 0%, #ffffff 100%); text-align: center; }

/* Browser Window Style */
#heroLive {
  background: #fff; border-radius: 12px; border: 1px solid #cbd5e1;
  box-shadow: var(--shadow-browser); overflow: hidden;
  transform: perspective(1000px) rotateY(-2deg); transition: transform 0.4s ease;
}
#heroLive:hover { transform: perspective(1000px) rotateY(0deg); }

.browser-header { background: #f1f5f9; padding: 10px 16px; border-bottom: 1px solid #e2e8f0; display: flex; gap: 8px; }
.dot { width: 10px; height: 10px; border-radius: 50%; }
.d-red { background: #ff5f57; border: 1px solid #e0443e; }
.d-yel { background: #febc2e; border: 1px solid #d89e24; }
.d-grn { background: #28c840; border: 1px solid #1aab29; }

.preview-content { padding: 32px; }
.eyebrow { display: inline-block; background: var(--brand-light); color: var(--brand); font-size: 12px; padding: 4px 10px; border-radius: 20px; font-weight: 600; margin-bottom: 12px; }

/* Code Editor */
.codewrap {
  background: #0f172a; color: #e2e8f0; border-radius: 12px; padding: 20px;
  font-family: 'JetBrains Mono', monospace; font-size: 13px; line-height: 1.6;
  height: 450px; overflow: hidden; border: 1px solid #334155; position: relative;
  box-shadow: var(--shadow-hover);
}
.cursor-blink { display: inline-block; width: 8px; height: 16px; background: var(--brand); animation: blink 1s infinite; vertical-align: middle; }
@keyframes blink { 50% { opacity: 0; } }

/* 4. GENERIC SECTIONS */
section { padding: 70px 0; }
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow-card); }

/* 5. WORKS CAROUSEL */
.works-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 24px; }
.carousel-nav { display: flex; gap: 10px; }
.nav-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line);
  background: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: 0.2s; font-size: 18px;
}
.nav-btn:hover { border-color: var(--brand); color: var(--brand); }

.carousel-track {
  display: flex; gap: 24px; overflow-x: auto; scroll-snap-type: x mandatory;
  padding-bottom: 20px; scrollbar-width: none; -ms-overflow-style: none;
}
.carousel-track::-webkit-scrollbar { display: none; }

.work-card {
  flex: 0 0 320px; scroll-snap-align: start;
  background: #fff; border: 1px solid var(--line); border-radius: 16px;
  overflow: hidden; box-shadow: var(--shadow-card);
  transition: transform 0.3s, box-shadow 0.3s;
  display: flex; flex-direction: column;
}
.work-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-hover); border-color: var(--brand-light); }

.work-card-head { padding: 14px 18px; border-bottom: 1px solid #f1f5f9; display: flex; justify-content: space-between; align-items: center; }
.work-card-head h4 { margin: 0; font-size: 16px; font-weight: 700; }
.gh-link { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.work-iframe { width: 100%; aspect-ratio: 16/10; background: #f8fafc; position: relative; border-bottom: 1px solid #f1f5f9; }
.work-iframe iframe { width: 200%; height: 200%; transform: scale(0.5); transform-origin: top left; background: #fff; pointer-events: none; }
.work-card-foot { padding: 14px 18px; background: #fff; font-size: 13px; color: var(--muted); display: flex; justify-content: space-between; }
.badge { background: #f1f5f9; padding: 4px 8px; border-radius: 6px; color: #334155; font-weight: 500; }

/* 6. TIMELINE (Program Page) */
.timeline-section { padding: 40px 0 80px; }
.timeline { position: relative; max-width: 800px; margin: 0 auto; padding-left: 30px; }
.timeline::before { content: ''; position: absolute; left: 30px; top: 20px; bottom: 20px; width: 2px; background: #e2e8f0; border-radius: 2px; }

.month-card {
  position: relative; background: #fff; border: 1px solid var(--line); border-radius: 16px;
  padding: 24px; margin-bottom: 30px; box-shadow: var(--shadow-card);
  transition: transform 0.3s; margin-left: 30px;
}
.month-card:hover { transform: translateY(-5px); border-color: var(--brand-light); }

.month-badge {
  position: absolute; left: -46px; top: 24px; width: 32px; height: 32px;
  background: var(--brand); color: #fff; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; box-shadow: 0 0 0 4px #fff; z-index: 2;
}

.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; flex-wrap: wrap; gap: 10px; }
.month-title { font-size: 20px; font-weight: 700; color: var(--text); margin: 0; }
.topic-tag { background: var(--brand-light); color: var(--brand); padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; text-transform: uppercase; }

.skills-list { margin: 16px 0; padding-left: 20px; color: var(--text); }
.skills-list li { margin-bottom: 6px; list-style-type: disc; }
.result-box { background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 8px; padding: 12px 16px; color: #166534; font-size: 14px; font-weight: 500; display: flex; align-items: center; gap: 8px; }
.result-icon { font-size: 18px; }

/* 7. ADVANCED SECTION */
.advanced-section {
  background: #0f172a; color: #f8fafc; padding: 80px 0;
  border-radius: 30px 30px 0 0; position: relative; overflow: hidden;
}
.advanced-section h2 { color: #fff; }
.advanced-section p { color: #94a3b8; }
.glow { position: absolute; width: 300px; height: 300px; background: var(--brand); filter: blur(120px); opacity: 0.15; border-radius: 50%; pointer-events: none; }
.g-1 { top: -100px; left: -100px; }
.g-2 { bottom: -100px; right: -100px; }
.adv-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 30px; margin-top: 40px; }
.adv-card { background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); padding: 24px; border-radius: 16px; }
.adv-card h3 { color: #60a5fa; margin-bottom: 10px; }

/* 8. FAQ & FORM */
.faq-container { max-width: 800px; margin: 0 auto; }
details { background: #fff; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; overflow: hidden; transition: 0.2s; }
details[open] { border-color: var(--brand); box-shadow: 0 4px 12px rgba(14,93,242,0.1); }
summary { padding: 18px; cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; align-items: center; }
summary::after { content: '+'; font-size: 20px; color: var(--brand); }
details[open] summary::after { content: '−'; }
details p { padding: 0 18px 18px; margin: 0; color: var(--muted); line-height: 1.6; }

.form-section { background: var(--brand-light); }
.form-wrapper { max-width: 800px; margin: 0 auto; background: #fff; padding: 40px; border-radius: 20px; box-shadow: var(--shadow-hover); border: 1px solid var(--line); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-full { grid-column: 1 / -1; }
label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
input, textarea { width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 16px; font-family: inherit; transition: 0.2s; }
input:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(14,93,242,0.15); }

/* Footer */
footer { padding: 40px 0; border-top: 1px solid var(--line); background: #fff; font-size: 14px; color: var(--muted); }

/* Animations */
.reveal { opacity: 0; transform: translateY(20px); transition: 0.6s ease; }
.reveal.visible { opacity: 1; transform: translateY(0); }

/* RESPONSIVE */
@media (max-width: 900px) {
  .hero-grid, .cards, .form-grid { grid-template-columns: 1fr; }
  .menu { display: none; }
  .burger { display: block; }
  aside.demo { display: none; }
  #heroLive { transform: none; }
  .carousel-nav { display: none; }
  .work-card { flex: 0 0 85vw; }
}
@media (max-width: 768px) {
  .timeline::before { left: 16px; }
  .timeline { padding-left: 0; }
  .month-card { margin-left: 40px; }
  .month-badge { left: -40px; }
  .adv-grid { grid-template-columns: 1fr; }
}