/* =========================================================
   prosoft — Сергей Прощаев · разработчик, преподаватель
   Hand-crafted multi-page site. Dark IDE theme.
   Design tokens at :root; everything below uses them.
   ========================================================= */

:root {
  /* Палитра — GitHub-like dark */
  --bg: #0D1117;
  --bg-2: #010409;
  --surface: #161B22;
  --surface-2: #1F2630;
  --line: #30363D;
  --line-soft: #21262D;
  --fg: #E6EDF3;
  --fg-muted: #8B949E;
  --fg-dim: #6E7681;
  --accent: #58A6FF;
  --accent-2: #7EE787;     /* зелёный для «кода»/тегов */
  --accent-3: #FFA657;     /* оранжевый — редко, для статусов */
  --danger: #FF7B72;
  --ok: #3FB950;

  /* Типографика */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", "Menlo", "Consolas", monospace;

  /* Сетка */
  --container: 1240px;
  --gap: clamp(16px, 2.4vw, 32px);
  --section-y: clamp(64px, 10vw, 128px);
  --radius: 14px;
  --radius-sm: 8px;
  --radius-lg: 22px;

  --ease: cubic-bezier(.2, .7, .2, 1);
  --dur: .55s;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: clamp(15px, 1vw, 17px);
  line-height: 1.6;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; padding: 0; margin: 0; }
h1, h2, h3, h4, p { margin: 0; }
::selection { background: color-mix(in srgb, var(--accent) 50%, transparent); color: var(--fg); }

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--accent); color: var(--bg-2);
  padding: 12px 16px; border-radius: 0 0 var(--radius-sm) 0;
  z-index: 100;
}
.skip-link:focus { left: 0; }

/* ---------- Container ---------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding-inline: clamp(20px, 4vw, 48px);
}

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s var(--ease), background .3s var(--ease);
}
.site-header.is-scrolled {
  border-bottom-color: var(--line);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
}
.site-header__inner {
  display: flex; align-items: center; gap: 24px;
  height: 68px;
}
.logo {
  display: inline-flex; align-items: baseline; gap: 4px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -.01em;
}
.logo__prompt { color: var(--accent-2); }
.logo__name { color: var(--fg); }
.logo__caret {
  display: inline-block;
  width: 8px; height: 16px;
  background: var(--accent);
  margin-left: 4px;
  transform: translateY(2px);
  animation: blink 1.1s steps(2, end) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.nav {
  display: flex; gap: clamp(14px, 2vw, 28px);
  margin-left: auto;
  font-weight: 500;
  font-size: 14px;
}
.nav a {
  padding: 6px 0;
  color: var(--fg-muted);
  transition: color .2s var(--ease);
}
.nav a:hover, .nav a.is-active { color: var(--fg); }

.site-header__cta { margin-left: 4px; }

.burger {
  display: none;
  width: 40px; height: 40px;
  margin-left: auto;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0; position: relative;
}
.burger span {
  position: absolute; left: 10px; right: 10px;
  height: 2px; background: var(--fg);
  border-radius: 2px;
  transition: transform .3s var(--ease), opacity .2s;
}
.burger span:nth-child(1) { top: 13px; }
.burger span:nth-child(2) { top: 19px; }
.burger span:nth-child(3) { top: 25px; }
.burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 12px 20px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  line-height: 1;
  border: 1px solid transparent;
  transition: background .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease);
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn--solid {
  background: var(--accent); color: var(--bg-2);
  border-color: var(--accent);
}
.btn--solid:hover { background: #79B8FF; border-color: #79B8FF; }
.btn--ghost {
  background: transparent; color: var(--fg);
  border-color: var(--line);
}
.btn--ghost:hover { border-color: var(--fg); background: var(--surface); }
.btn--sm { padding: 8px 14px; font-size: 13px; }
.btn--lg { padding: 16px 28px; font-size: 15px; }
.btn__arrow { transition: transform .25s var(--ease); }
.btn:hover .btn__arrow { transform: translateX(4px); }

/* ---------- Eyebrow / section heads ---------- */
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--accent-2);
}
.eyebrow::before {
  content: "//";
  color: var(--fg-dim);
}
.section-head {
  margin-bottom: clamp(40px, 6vw, 64px);
  max-width: 680px;
}
.section-head__title {
  margin-top: 14px;
  font-weight: 800;
  letter-spacing: -.025em;
  line-height: 1.05;
  font-size: clamp(32px, 5.5vw, 64px);
}
.section-head__lead {
  margin-top: 18px;
  color: var(--fg-muted);
  font-size: clamp(15px, 1.2vw, 18px);
  max-width: 56ch;
}

/* ---------- Hero ---------- */
.hero {
  padding-top: clamp(48px, 7vw, 88px);
  padding-bottom: var(--section-y);
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute;
  inset: -40% 50% 40% -10%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 24%, transparent), transparent 70%);
  filter: blur(60px);
  pointer-events: none;
  z-index: -1;
}
.hero__grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: clamp(32px, 6vw, 80px);
  align-items: center;
}
.hero .eyebrow { margin-bottom: 20px; }
.hero__title {
  font-weight: 900;
  letter-spacing: -.035em;
  line-height: .98;
  font-size: clamp(40px, 7vw, 96px);
}
.hero__title em {
  font-style: normal;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero__lead {
  margin-top: clamp(20px, 2.5vw, 32px);
  color: var(--fg-muted);
  font-size: clamp(16px, 1.4vw, 20px);
  max-width: 48ch;
}
.hero__actions {
  margin-top: clamp(28px, 3.5vw, 40px);
  display: flex; flex-wrap: wrap;
  gap: 12px;
}

/* Terminal в hero */
.terminal {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 14px;
  box-shadow: 0 20px 60px -20px color-mix(in srgb, var(--accent) 30%, transparent);
}
.terminal__bar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}
.terminal__dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--line);
}
.terminal__dot:nth-child(1) { background: #FF5F57; }
.terminal__dot:nth-child(2) { background: #FEBC2E; }
.terminal__dot:nth-child(3) { background: #28C840; }
.terminal__title {
  margin-left: 10px;
  color: var(--fg-dim);
  font-size: 12px;
}
.terminal__body {
  padding: 20px 22px;
  line-height: 1.7;
}
.terminal__line {
  display: block;
  white-space: pre-wrap;
  word-break: break-word;
}
.terminal .kw { color: var(--accent); }
.terminal .str { color: var(--accent-2); }
.terminal .com { color: var(--fg-dim); }
.terminal .pr { color: var(--accent-2); }
.terminal .pr::before { content: "$ "; color: var(--accent-2); }

/* ---------- Generic card grid ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--gap);
}
.card {
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color .25s var(--ease), transform .25s var(--ease), background .25s var(--ease);
}
.card:hover {
  border-color: color-mix(in srgb, var(--accent) 60%, var(--line));
  transform: translateY(-3px);
  background: var(--surface-2);
}
.card__media {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--ph, var(--surface-2));
  overflow: hidden;
}
.card__media img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  transition: opacity .3s, transform .5s var(--ease);
}
.card__media img.is-missing { opacity: 0; }
.card:hover .card__media img { transform: scale(1.04); }
.card__media-num {
  position: absolute;
  inset-block-start: 14px;
  inset-inline-start: 18px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--fg);
  background: color-mix(in srgb, var(--bg-2) 70%, transparent);
  padding: 4px 10px;
  border-radius: 6px;
  pointer-events: none;
}
.card__body {
  padding: 20px 22px 22px;
  display: flex; flex-direction: column;
  gap: 10px;
  flex: 1;
}
.card__tag {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-2);
  display: inline-flex; align-items: center; gap: 6px;
}
.card__tag::before {
  content: ""; display: inline-block;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent-2);
}
.card__title {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -.01em;
}
.card__desc {
  color: var(--fg-muted);
  font-size: 14px;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card__meta {
  margin-top: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-dim);
  display: flex; gap: 12px; align-items: center;
  padding-top: 8px;
}
.card__meta--with-arrow {
  justify-content: space-between;
}
.card__arrow {
  color: var(--accent);
  transition: transform .25s var(--ease);
}
.card:hover .card__arrow { transform: translate(4px, -4px); }

/* ---------- About ---------- */
.about {
  padding-block: var(--section-y);
  border-top: 1px solid var(--line-soft);
}
.about__grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: clamp(32px, 6vw, 80px);
  align-items: center;
}
.about__media {
  position: relative;
  aspect-ratio: 4 / 5;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.about__media img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
  transition: opacity .3s;
}
.about__media img.is-missing { opacity: 0; }
.about__media-label {
  position: absolute;
  inset-block-end: 14px;
  inset-inline-start: 18px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-dim);
  background: color-mix(in srgb, var(--bg-2) 70%, transparent);
  padding: 4px 8px;
  border-radius: 6px;
  pointer-events: none;
}
.about__media:has(img:not(.is-missing)) .about__media-label { display: none; }

.about__text p {
  margin-top: 16px;
  color: var(--fg-muted);
  max-width: 56ch;
  font-size: clamp(15px, 1.1vw, 17px);
}
.about__text p strong { color: var(--fg); font-weight: 600; }

.tag-list {
  margin-top: 28px;
  display: flex; flex-wrap: wrap;
  gap: 8px;
}
.tag-list li {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg);
  background: var(--surface);
}

/* ---------- Section: courses ---------- */
.courses-section {
  padding-block: var(--section-y);
  border-top: 1px solid var(--line-soft);
}
.course-card {
  position: relative;
  text-align: left;
}
.course-card--soon {
  border-style: dashed;
  background: transparent;
}
.course-card--soon:hover { transform: none; background: transparent; }
.course-card--soon .card__title { color: var(--fg-muted); }

/* ---------- Section: articles & videos ---------- */
.feed-section {
  padding-block: var(--section-y);
  border-top: 1px solid var(--line-soft);
}
.feed-state {
  padding: 32px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  text-align: center;
  color: var(--fg-muted);
  font-family: var(--font-mono);
  font-size: 14px;
}
.feed-state.is-error { color: var(--danger); border-color: var(--danger); }

.video-card .card__media { aspect-ratio: 16 / 9; }
.video-card .card__media-play {
  position: absolute;
  inset: 0;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.video-card .card__media-play::before {
  content: "▶";
  width: 56px; height: 56px;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--bg-2) 75%, transparent);
  border: 1px solid color-mix(in srgb, var(--fg) 40%, transparent);
  border-radius: 50%;
  font-size: 18px;
  color: var(--fg);
  padding-left: 4px;
  transition: transform .25s var(--ease), background .25s;
}
.video-card:hover .card__media-play::before {
  transform: scale(1.08);
  background: var(--accent);
  color: var(--bg-2);
}

/* ---------- Contact ---------- */
.contact-section {
  padding-block: var(--section-y);
  border-top: 1px solid var(--line-soft);
}
.contact__grid {
  display: grid;
  grid-template-columns: 5fr 6fr;
  gap: clamp(32px, 6vw, 80px);
  align-items: start;
}
.contact__lead {
  margin-top: 18px;
  color: var(--fg-muted);
  max-width: 44ch;
  font-size: clamp(15px, 1.1vw, 17px);
}
.socials {
  margin-top: 32px;
  display: flex; flex-wrap: wrap;
  gap: 8px;
}
.socials a {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--fg);
  transition: border-color .2s var(--ease), color .2s var(--ease), transform .2s var(--ease);
}
.socials a:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

/* ---------- Form ---------- */
.form {
  display: grid; gap: 16px;
  background: var(--surface);
  padding: clamp(24px, 3vw, 36px);
  border-radius: var(--radius);
  border: 1px solid var(--line);
}
.form__honeypot {
  position: absolute !important;
  left: -9999px;
  width: 1px; height: 1px; overflow: hidden;
}
.field { display: grid; gap: 6px; }
.field__label {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-muted);
  letter-spacing: .02em;
}
.field__label em {
  font-style: normal;
  color: var(--fg-dim);
}
.field__input {
  width: 100%;
  padding: 13px 14px;
  font: inherit;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.field__input::placeholder { color: var(--fg-dim); }
.field__input:hover { border-color: color-mix(in srgb, var(--fg) 30%, var(--line)); }
.field__input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
.field__input--area {
  resize: vertical;
  min-height: 110px;
  line-height: 1.5;
  font-family: inherit;
}
.form__submit { justify-self: start; margin-top: 4px; }
.form__submit[disabled] { opacity: .55; cursor: not-allowed; }
.form__status {
  min-height: 20px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--fg-muted);
}
.form__status.is-ok { color: var(--ok); }
.form__status.is-error { color: var(--danger); }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding-block: clamp(28px, 3vw, 40px);
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--fg-dim);
}
.site-footer__inner {
  display: flex; justify-content: space-between;
  align-items: center; gap: 16px; flex-wrap: wrap;
}
.site-footer__up:hover { color: var(--accent); }

/* ---------- Reveal animation ---------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}
[data-reveal].is-in { opacity: 1; transform: none; }

/* ---------- Focus ---------- */
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 8px;
}
.field__input:focus-visible { outline: none; }

/* =========================================================
   COURSE PAGE-specific (inherits from above)
   ========================================================= */
.course-hero {
  padding-top: clamp(48px, 7vw, 88px);
  padding-bottom: var(--section-y);
  position: relative;
  overflow: hidden;
}
.course-hero::after {
  content: "";
  position: absolute;
  inset: -30% -10% 30% 60%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%);
  filter: blur(60px);
  pointer-events: none;
  z-index: -1;
}
.course-hero__badge {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
  padding: 6px 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 50%, var(--line));
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-radius: 999px;
}
.course-hero__title {
  margin-top: 22px;
  font-weight: 900;
  letter-spacing: -.03em;
  line-height: 1;
  font-size: clamp(40px, 8vw, 112px);
}
.course-hero__lead {
  margin-top: 24px;
  color: var(--fg-muted);
  font-size: clamp(16px, 1.4vw, 20px);
  max-width: 60ch;
}
.course-hero__meta {
  margin-top: 36px;
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: clamp(16px, 3vw, 40px);
  padding: 20px 0;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  font-family: var(--font-mono);
  font-size: 13px;
}
.course-hero__meta dt {
  color: var(--fg-dim);
  margin-bottom: 6px;
}
.course-hero__meta dd {
  margin: 0;
  color: var(--fg);
  font-size: 18px;
  font-family: var(--font-sans);
  font-weight: 600;
  letter-spacing: -.01em;
}
.course-hero__actions {
  margin-top: 32px;
  display: flex; flex-wrap: wrap; gap: 12px;
}

.modules {
  padding-block: var(--section-y);
  border-top: 1px solid var(--line-soft);
}
.modules__list {
  display: grid;
  gap: 12px;
}
.module {
  display: grid;
  grid-template-columns: 60px 1fr auto;
  align-items: center;
  gap: clamp(12px, 2vw, 24px);
  padding: 20px 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color .2s var(--ease), background .2s var(--ease);
}
.module:hover {
  border-color: color-mix(in srgb, var(--accent) 60%, var(--line));
  background: var(--surface-2);
}
.module__num {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
}
.module__title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -.01em;
}
.module__desc {
  margin-top: 4px;
  color: var(--fg-muted);
  font-size: 14px;
  line-height: 1.5;
}
.module__week {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-dim);
  white-space: nowrap;
}

.checklist {
  padding-block: var(--section-y);
  border-top: 1px solid var(--line-soft);
}
.checklist__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--gap);
}
.check {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 14px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.check__mark {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent-2) 20%, transparent);
  color: var(--accent-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 700;
}
.check__mark::before { content: "✓"; }
.check p {
  color: var(--fg);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.4;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero__grid { grid-template-columns: 1fr; }
  .hero__visual { order: -1; max-width: 520px; }
  .about__grid,
  .contact__grid { grid-template-columns: 1fr; }
  .module { grid-template-columns: 56px 1fr; }
  .module__week { grid-column: 2; padding-top: 4px; }
  .course-hero__meta { grid-template-columns: 1fr 1fr; gap: 18px 32px; }
}

@media (max-width: 640px) {
  .nav { display: none; }
  .site-header__cta { display: none; }
  .burger { display: inline-block; }

  .nav.is-open {
    display: flex;
    position: absolute;
    top: 68px; left: 0; right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    flex-direction: column;
    gap: 0;
    padding: 8px 0 16px;
  }
  .nav.is-open a {
    padding: 14px clamp(20px, 4vw, 48px);
    border-top: 1px solid var(--line-soft);
    font-size: 16px;
    color: var(--fg);
  }

  .course-hero__meta { grid-template-columns: 1fr; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  [data-reveal] { opacity: 1; transform: none; }
  .logo__caret { animation: none; }
}
