:root {
  --font-display: 'Urbanist', 'Segoe UI', sans-serif;
  --font-body: 'Outfit', 'Segoe UI', sans-serif;

  --text-xs: clamp(0.75rem, 0.72rem + 0.2vw, 0.875rem);
  --text-sm: clamp(0.9rem, 0.84rem + 0.25vw, 1rem);
  --text-base: clamp(1rem, 0.96rem + 0.24vw, 1.08rem);
  --text-lg: clamp(1.15rem, 1rem + 0.7vw, 1.45rem);
  --text-xl: clamp(1.5rem, 1.15rem + 1vw, 2.2rem);
  --text-2xl: clamp(2.2rem, 1.4rem + 2.6vw, 3.8rem);

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.35rem;
  --radius-full: 999px;

  --transition-interactive: 180ms cubic-bezier(0.16, 1, 0.3, 1);

  --color-bg: #040715;
  --color-text: #f5f6ff;
  --color-text-muted: #cdcfe7;
  --color-text-faint: #8a90be;
  --color-border: rgba(187, 107, 255, 0.17);
  --color-border-strong: rgba(204, 104, 255, 0.3);
  --color-surface: rgba(8, 12, 28, 0.88);
  --color-surface-2: rgba(11, 16, 35, 0.94);
  --color-primary: #c24fff;
  --color-primary-2: #7c4dff;

  --shadow-card: 0 24px 60px rgba(3, 5, 15, 0.5);
  --shadow-glow: 0 0 0 1px rgba(195, 106, 255, 0.14), 0 0 45px rgba(116, 37, 194, 0.14);
  --container: 1280px;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 6.8rem;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--color-text);
  background:
    radial-gradient(circle at 78% 25%, rgba(152, 58, 255, 0.18), transparent 20%),
    radial-gradient(circle at 88% 52%, rgba(193, 87, 255, 0.12), transparent 18%),
    radial-gradient(circle at 18% 12%, rgba(94, 53, 255, 0.08), transparent 20%),
    linear-gradient(180deg, #030510 0%, #040714 34%, #030611 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(circle, rgba(196, 114, 255, 0.35) 0 1px, transparent 1.4px);
  background-size: 190px 190px;
  opacity: 0.18;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; }

button, a {
  transition:
    transform var(--transition-interactive),
    box-shadow var(--transition-interactive),
    background var(--transition-interactive),
    border-color var(--transition-interactive),
    color var(--transition-interactive),
    opacity var(--transition-interactive);
}

.skip-link {
  position: absolute;
  top: -40px;
  left: 1rem;
  z-index: 2000;
  padding: 0.8rem 1rem;
  border-radius: var(--radius-md);
  background: #fff;
  color: #111;
}

.skip-link:focus { top: 1rem; }

.container {
  width: min(calc(100% - 2rem), var(--container));
  margin-inline: auto;
}

.section {
  position: relative;
  padding-block: clamp(var(--space-8), 6vw, var(--space-16));
}

.study-page {
  position: relative;
  z-index: 1;
  padding-top: 7.4rem;
}

.nav-anchor {
  position: relative;
  top: -7rem;
  height: 0;
  visibility: hidden;
  pointer-events: none;
}

.study-layout,
.study-grid,
.study-visual,
.subjects-panel,
.semester-panel {
  position: relative;
  z-index: 1;
}

.study-grid {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr) 320px;
  gap: 2rem;
  align-items: start;
}

.semester-panel,
.subject-card,
.panel,
.contact-card,
.subjects-list,
.subjects-panel {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, rgba(8, 11, 27, 0.88), rgba(9, 13, 30, 0.95));
  box-shadow: var(--shadow-glow), var(--shadow-card);
}

.semester-panel::before,
.subject-card::before,
.panel::before,
.contact-card::before,
.subjects-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at top right, rgba(187, 77, 255, 0.1), transparent 28%);
}

.semester-panel {
  padding: 1rem;
}

.semester-panel__inner {
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: 1.2rem;
  padding: 1rem;
  background: rgba(5, 9, 23, 0.62);
}

.sidebar-label,
.section-heading,
.subjects-header h1 span,
.material-pill {
  color: var(--color-primary);
  text-shadow: 0 0 20px rgba(194, 79, 255, 0.33);
}

.sidebar-label {
  margin: 0 0 1rem;
  font-size: 1.05rem;
  font-weight: 700;
}

.semester-list {
  display: grid;
  gap: 0.7rem;
}

.semester-btn,
.back-semesters,
.download-btn,
.material-chip {
  min-height: 48px;
  border-radius: 1rem;
  border: 1px solid transparent;
  text-decoration: none;
  font-family: inherit;
}

.semester-btn {
  width: 100%;
  padding: 1rem 1.1rem;
  background: transparent;
  color: var(--color-text);
  font-size: clamp(1rem, 0.94rem + 0.2vw, 1.15rem);
  text-align: left;
  cursor: pointer;
}

.semester-btn:hover,
.back-semesters:hover,
.download-btn:hover,
.material-chip:hover {
  border-color: var(--color-border-strong);
  background: rgba(194, 79, 255, 0.08);
  box-shadow: 0 0 18px rgba(185, 82, 255, 0.14);
  transform: translateY(-2px);
}

.semester-btn.is-active {
  border-color: rgba(198, 96, 255, 0.36);
  background: linear-gradient(135deg, rgba(146, 41, 255, 0.8), rgba(87, 26, 170, 0.92));
  box-shadow: 0 0 24px rgba(174, 84, 255, 0.22), inset 0 0 0 1px rgba(255,255,255,0.08);
}

.back-semesters {
  margin-top: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  padding: 1rem 1.2rem;
  color: var(--color-primary);
  background: rgba(8, 12, 28, 0.86);
}

.subjects-panel {
  padding: 1.2rem;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.subjects-header {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  margin-bottom: 1rem;
}

.subjects-header__icon {
  width: 5rem;
  height: 5rem;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border-radius: 50%;
  font-size: 2rem;
  color: #fff;
  background: radial-gradient(circle, rgba(148, 65, 255, 0.9), rgba(73, 20, 153, 0.95));
  box-shadow: inset 0 0 22px rgba(255,255,255,0.12), 0 0 34px rgba(165, 88, 255, 0.25);
}

.material-pill {
  display: inline-block;
  margin: 0 0 0.45rem;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.subjects-header h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  line-height: 1;
}

.subjects-header p {
  margin: 0.35rem 0 0;
  font-size: clamp(1rem, 0.96rem + 0.3vw, 1.3rem);
  color: var(--color-text-muted);
}

.material-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-bottom: 1.4rem;
}

.material-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1rem;
  background: rgba(255,255,255,0.03);
  color: var(--color-text);
}

.material-chip.is-active {
  border-color: rgba(198, 96, 255, 0.36);
  background: linear-gradient(135deg, rgba(146, 41, 255, 0.8), rgba(87, 26, 170, 0.92));
  box-shadow: 0 0 24px rgba(174, 84, 255, 0.18), inset 0 0 0 1px rgba(255,255,255,0.08);
}

.subjects-list {
  display: grid;
  gap: 0.9rem;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.subject-card {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  padding: 1.35rem 1.5rem;
}

.subject-card:hover,
.contact-card:hover,
.panel:hover,
.semester-panel:hover {
  border-color: rgba(204, 114, 255, 0.28);
  box-shadow: 0 0 0 1px rgba(197, 110, 255, 0.18), 0 24px 58px rgba(4, 6, 19, 0.5), 0 0 30px rgba(176, 73, 255, 0.12);
}

.subject-icon {
  width: 3.8rem;
  height: 3.8rem;
  display: grid;
  place-items: center;
  border-radius: 1rem;
  flex-shrink: 0;
  font-size: 1.65rem;
  color: #f8ecff;
  background: linear-gradient(180deg, rgba(106, 31, 203, 0.88), rgba(64, 18, 124, 0.96));
  box-shadow: inset 0 0 14px rgba(255,255,255,0.08), 0 0 20px rgba(162, 71, 255, 0.12);
}

.subject-card h3 {
  margin: 0 0 0.2rem;
  font-size: clamp(1.25rem, 1.1rem + 0.45vw, 1.8rem);
  font-weight: 500;
}

.subject-card p {
  margin: 0;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.subject-copy {
  flex: 1;
  min-width: 0;
}

.download-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  padding: 0.95rem 1.25rem;
  background: rgba(113, 44, 201, 0.04);
  color: var(--color-primary);
  border: 1px solid rgba(196, 86, 255, 0.24);
  font-weight: 600;
  cursor: pointer;
}

.empty-state {
  padding: 2rem 1rem;
  text-align: center;
  border: 1px dashed rgba(198, 96, 255, 0.2);
  border-radius: 1.2rem;
  color: var(--color-text-muted);
  background: rgba(255,255,255,0.02);
}

.study-visual {
  min-height: 38rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.study-visual__glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(10px);
  pointer-events: none;
}

.study-visual__glow--one {
  width: 13rem;
  height: 13rem;
  top: 4rem;
  right: 20%;
  background: radial-gradient(circle, rgba(181, 77, 255, 0.46), transparent 70%);
}

.study-visual__glow--two {
  width: 9rem;
  height: 9rem;
  right: 12%;
  bottom: 6rem;
  background: radial-gradient(circle, rgba(105, 72, 255, 0.32), transparent 70%);
}

.study-visual__png {
  position: relative;
  z-index: 2;
  width: min(100%, 420px);
  height: auto;
  display: block;
  object-fit: contain;
  margin-inline: auto;
  filter: drop-shadow(0 22px 44px rgba(10, 8, 30, 0.45));
}

.panel {
  padding: 1rem 1.2rem 1.1rem;
}

.section-heading {
  margin: 0 0 0.9rem;
  text-align: center;
  font-family: var(--font-display);
  font-size: clamp(1.85rem, 1.4rem + 1vw, 2.45rem);
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.contact-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 5.8rem;
  padding: 0.95rem 1rem;
  text-decoration: none;
}

.contact-card__icon {
  width: 3.55rem;
  height: 3.55rem;
  border-radius: 1rem;
  display: grid;
  place-items: center;
  font-size: 1.95rem;
  color: #fff;
  flex-shrink: 0;
}

.gmail { background: linear-gradient(135deg, #ff6c55, #ffbd66); }
.instagram { background: linear-gradient(135deg, #6a5cff, #ff4d97, #ffbb52); }
.telegram { background: linear-gradient(135deg, #4db8ff, #287eff); }
.youtube { background: linear-gradient(135deg, #ff2a2a, #ff4b1f); }

.contact-card h3 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 600;
}

.contact-card p {
  margin: 0.15rem 0 0;
  color: var(--color-text-muted);
}

.site-footer {
  padding: 0 1rem 1.7rem;
  text-align: center;
  color: var(--color-text-muted);
}

.reveal {
  opacity: 0;
  transform: translateY(36px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal-delay { transition-delay: 0.12s; }
.reveal-delay-2 { transition-delay: 0.24s; }
.reveal.is-visible { opacity: 1; transform: translateY(0); }

@media (max-width: 1200px) {
  .study-grid {
    grid-template-columns: 230px minmax(0, 1fr);
  }

  .study-visual {
    grid-column: 2;
    min-height: 23rem;
    margin-top: -0.6rem;
  }

  .study-visual__png {
    width: min(100%, 360px);
  }

  .contact-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  html { scroll-padding-top: 5.8rem; }
  .study-page { padding-top: 6.5rem; }

  .study-grid,
  .contact-grid {
    grid-template-columns: 1fr;
  }

  .semester-panel { order: 1; }
  .subjects-panel { order: 2; padding-inline: 0; }
  .study-visual { order: 3; grid-column: auto; min-height: 20rem; }
  .semester-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .back-semesters { margin-top: 0.8rem; }
  .subject-card { flex-wrap: wrap; }
  .download-btn { width: 100%; }
}

@media (max-width: 768px) {
  .study-page {
    padding-top: 6.4rem;
  }

  .study-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem;
  }

  .study-visual {
    display: none !important;
  }

  .subjects-panel {
    padding: 0.6rem;
  }

  .subject-card {
    padding: 1rem;
  }

  .subjects-header {
    gap: 0.9rem;
    margin-bottom: 1rem;
  }

  .subjects-header__icon {
    width: 4rem;
    height: 4rem;
    font-size: 1.5rem;
  }

  .subjects-header h1 {
    font-size: clamp(1.8rem, 7vw, 2.6rem);
  }
}

@media (max-width: 640px) {
  .container { width: min(calc(100% - 1rem), var(--container)); }
  .semester-list { grid-template-columns: 1fr; }
  .subjects-header { align-items: flex-start; }
  .subjects-header__icon { width: 4.2rem; height: 4.2rem; font-size: 1.7rem; }
  .material-switcher { gap: 0.6rem; }
  .material-chip { flex: 1 1 calc(50% - 0.6rem); }
  .subject-card { padding: 1rem; gap: 0.95rem; }
  .subject-card h3 { font-size: 1.2rem; }
  .contact-card { min-height: 5.4rem; }
}