/* Лектофонд — university lecture archive cover */
@import url("https://fonts.googleapis.com/css2?family=Literata:opsz,wght@7..72,500;7..72,700&family=Onest:wght@400;500;600;700&display=swap");

:root {
  --ink: #0e1a28;
  --ink-soft: #243447;
  --paper: #f3f1eb;
  --paper-2: #e7e9ee;
  --panel: #ffffff;
  --brass: #9a7340;
  --brass-deep: #6e4f28;
  --forest: #1f4d3c;
  --forest-soft: #2f6b54;
  --line: rgba(14, 26, 40, 0.12);
  --muted: #5b6b7c;
  --danger: #8b2e2e;
  --shadow: 0 18px 50px rgba(14, 26, 40, 0.12);
  --radius: 14px;
  --font-display: "Literata", "Times New Roman", serif;
  --font-body: "Onest", "Segoe UI", sans-serif;
  --max: 1180px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-body);
  background:
    radial-gradient(900px 420px at 8% -8%, rgba(154, 115, 64, 0.16), transparent 60%),
    radial-gradient(800px 500px at 100% 0%, rgba(31, 77, 60, 0.12), transparent 55%),
    linear-gradient(180deg, var(--paper) 0%, var(--paper-2) 100%);
  background-attachment: fixed;
}

a { color: inherit; }
img { max-width: 100%; display: block; }

.skip {
  position: absolute;
  left: -999px;
  top: 0;
}
.skip:focus {
  left: 1rem;
  top: 1rem;
  z-index: 50;
  background: #fff;
  padding: 0.5rem 0.75rem;
}

/* Top bar */
.top {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(14px);
  background: rgba(243, 241, 235, 0.86);
  border-bottom: 1px solid var(--line);
}
.top-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0.9rem 1.25rem;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1rem;
  align-items: center;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
}
.brand-mark {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 8px;
  background:
    linear-gradient(145deg, var(--forest), #0d2c22 60%),
    var(--forest);
  color: #f5efe4;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.03em;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.12);
}
.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.brand-text strong {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.brand-text span {
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  justify-content: center;
}
.nav a {
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
}
.nav a:hover,
.nav a[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--brass);
}
.top-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.7rem 1.15rem;
  border-radius: 999px;
  border: 1px solid transparent;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease, color 180ms ease, border-color 180ms ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary {
  background: var(--forest);
  color: #f7f4ec;
}
.btn-primary:hover { background: var(--forest-soft); }
.btn-brass {
  background: linear-gradient(180deg, #b5894d, var(--brass));
  color: #1a1208;
}
.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}
.btn-ghost:hover { border-color: var(--brass); }
.btn-sm { padding: 0.45rem 0.85rem; font-size: 0.85rem; }

main { padding-bottom: 4rem; }

/* Hero — one composition */
.hero {
  position: relative;
  min-height: min(88vh, 760px);
  display: grid;
  align-items: end;
  overflow: hidden;
  isolation: isolate;
}
.hero-media {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(8, 16, 28, 0.28) 0%, rgba(8, 16, 28, 0.68) 55%, rgba(8, 16, 28, 0.92) 100%),
    url("/img/hero.jpg") center/cover no-repeat;
  transform: scale(1.04);
  animation: heroDrift 18s ease-in-out infinite alternate;
}
.hero-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      -12deg,
      transparent,
      transparent 18px,
      rgba(255,255,255,0.015) 18px,
      rgba(255,255,255,0.015) 19px
    );
  pointer-events: none;
}
@keyframes heroDrift {
  from { transform: scale(1.04) translate3d(0, 0, 0); }
  to { transform: scale(1.08) translate3d(-1.2%, -0.8%, 0); }
}
.hero-inner {
  position: relative;
  z-index: 1;
  max-width: var(--max);
  width: 100%;
  margin: 0 auto;
  padding: 4.5rem 1.25rem 3.25rem;
  color: #f4efe6;
}
.hero-brand {
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 8vw, 5.4rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 0.95;
  margin: 0 0 1rem;
  animation: riseIn 700ms ease both;
}
.hero-lead {
  max-width: 34rem;
  font-size: clamp(1.05rem, 2.2vw, 1.25rem);
  color: rgba(244, 239, 230, 0.84);
  margin: 0 0 1.6rem;
  animation: riseIn 800ms ease 80ms both;
}
.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  animation: riseIn 900ms ease 140ms both;
}
@keyframes riseIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.section {
  max-width: var(--max);
  margin: 0 auto;
  padding: 2.75rem 1.25rem 0;
}
.section-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
  margin-bottom: 1.25rem;
}
.section-head h2 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  margin: 0;
  letter-spacing: -0.02em;
}
.section-head p {
  margin: 0.35rem 0 0;
  color: var(--muted);
  max-width: 36rem;
}

.stat-rail {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: -2.4rem;
  position: relative;
  z-index: 2;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
}
.stat b {
  display: block;
  font-family: var(--font-display);
  font-size: 1.55rem;
  letter-spacing: -0.02em;
}
.stat span {
  color: var(--muted);
  font-size: 0.86rem;
}

.subject-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.75rem;
}
.subject-chip {
  text-decoration: none;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius);
  padding: 1rem;
  min-height: 7.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 180ms ease, border-color 180ms ease;
  position: relative;
  overflow: hidden;
}
.subject-chip .chip-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.28;
  filter: saturate(0.85);
  pointer-events: none;
}
.subject-chip::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, hsl(var(--hue, 210) 40% 96% / 0.92) 20%, hsl(var(--hue, 210) 30% 92% / 0.55) 100%);
  pointer-events: none;
}
.subject-chip:hover {
  transform: translateY(-3px);
  border-color: hsl(var(--hue, 210) 40% 40% / 0.45);
}
.subject-chip strong {
  font-family: var(--font-display);
  font-size: 1.05rem;
  position: relative;
  z-index: 1;
}
.subject-chip span {
  position: relative;
  z-index: 1;
  color: var(--muted);
  font-size: 0.85rem;
}

/* Lecture grid — interactive tiles */
.lecture-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}
.lecture {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  padding: 0;
  font: inherit;
  color: inherit;
  display: flex;
  flex-direction: column;
  transition: transform 180ms ease, box-shadow 180ms ease;
  animation: cardIn 480ms ease both;
}
.lecture:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.thumb {
  aspect-ratio: 16 / 10;
  position: relative;
  background:
    radial-gradient(circle at 20% 20%, hsl(var(--hue, 210) 55% 62% / 0.55), transparent 45%),
    linear-gradient(145deg, hsl(var(--hue, 210) 28% 18%), hsl(calc(var(--hue, 210) + 28) 35% 28%));
  color: #f5f1ea;
  overflow: hidden;
}
.thumb-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.thumb::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, transparent 35%, rgba(8, 14, 22, 0.55) 100%);
  opacity: 1;
  pointer-events: none;
  z-index: 0;
}
.thumb-meta {
  position: absolute;
  inset: auto 0.7rem 0.7rem 0.7rem;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  z-index: 2;
  font-size: 0.72rem;
  font-weight: 600;
}
.thumb-meta span {
  background: rgba(8, 14, 22, 0.55);
  padding: 0.25rem 0.45rem;
  border-radius: 999px;
  backdrop-filter: blur(6px);
}
.thumb-play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity 180ms ease;
  z-index: 2;
}
.lecture:hover .thumb-play { opacity: 1; }
.thumb-play i {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: rgba(247, 244, 236, 0.92);
  color: var(--ink);
  display: grid;
  place-items: center;
  font-style: normal;
  font-weight: 700;
}
.lecture-body {
  padding: 0.9rem 0.95rem 1.05rem;
  display: grid;
  gap: 0.35rem;
}
.lecture-body h3 {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.35;
  font-weight: 600;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.7em;
}
.lecture-body .meta {
  color: var(--muted);
  font-size: 0.82rem;
  display: grid;
  gap: 0.15rem;
}
.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.25rem;
}
.badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.18rem 0.45rem;
  border-radius: 999px;
  background: rgba(31, 77, 60, 0.1);
  color: var(--forest);
}

/* Catalog controls */
.catalog-shell {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.5rem 1.25rem 0;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 1.25rem;
  align-items: start;
}
.filters {
  position: sticky;
  top: 5rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}
.filters h2 {
  margin: 0 0 0.85rem;
  font-family: var(--font-display);
  font-size: 1.2rem;
}
.field { margin-bottom: 0.85rem; }
.field label {
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.35rem;
}
.field input,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  font: inherit;
  background: #fbfaf7;
  color: var(--ink);
}
.field input:focus,
.field select:focus {
  outline: 2px solid rgba(154, 115, 64, 0.35);
  border-color: var(--brass);
}
.check-list {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.4rem;
  max-height: 14rem;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0.15rem 0.35rem 0.15rem 0;
  margin: 0;
}
.check-list label {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 0.55rem;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 0.2rem 0;
  font-size: 0.9rem;
  line-height: 1.35;
  color: var(--ink-soft);
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
}
.check-list input[type="radio"] {
  flex: 0 0 auto;
  width: 1rem;
  height: 1rem;
  margin: 0.2rem 0 0;
  accent-color: var(--brass);
}
.check-list label > span {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
}
.catalog-main { min-width: 0; }
.catalog-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
}
.catalog-toolbar p {
  margin: 0;
  color: var(--muted);
}
.pager {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 1.5rem;
}
.empty {
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.5);
}

/* Page prose */
.page-hero {
  max-width: var(--max);
  margin: 0 auto;
  padding: 2.5rem 1.25rem 0.5rem;
}
.page-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.5vw, 3rem);
  margin: 0 0 0.6rem;
  letter-spacing: -0.02em;
}
.page-hero p {
  margin: 0;
  color: var(--muted);
  max-width: 42rem;
  font-size: 1.05rem;
}
.prose {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.5rem 1.25rem 0;
}
.prose p, .prose li { color: var(--ink-soft); line-height: 1.65; }
.prose h2 {
  font-family: var(--font-display);
  margin: 1.8rem 0 0.6rem;
}
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}
.plan {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: grid;
  gap: 0.75rem;
  align-content: start;
}
.plan.featured {
  border-color: rgba(154, 115, 64, 0.55);
  box-shadow: var(--shadow);
  transform: translateY(-4px);
}
.plan h3 {
  margin: 0;
  font-family: var(--font-display);
}
.plan .price {
  font-family: var(--font-display);
  font-size: 2rem;
  letter-spacing: -0.02em;
}
.plan .price small {
  font-size: 0.95rem;
  color: var(--muted);
  font-family: var(--font-body);
}
.plan ul {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--ink-soft);
  display: grid;
  gap: 0.35rem;
}

.account-box {
  max-width: 420px;
  margin: 1.5rem auto 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}
.account-box .field { margin-bottom: 0.9rem; }
.account-box .hint {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0.75rem 0 0;
}

.timeline {
  display: grid;
  gap: 1rem;
  margin-top: 1.25rem;
}
.timeline-item {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 1rem;
  padding: 1rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.timeline-item b {
  color: var(--brass-deep);
  font-family: var(--font-display);
}

/* Modal */
.modal[hidden] { display: none; }
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 1rem;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 14, 22, 0.55);
  backdrop-filter: blur(4px);
}
.modal-panel {
  position: relative;
  width: min(720px, 100%);
  max-height: min(88vh, 860px);
  overflow: auto;
  background: var(--panel);
  border-radius: 18px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.modal-thumb {
  aspect-ratio: 16 / 8;
  background:
    radial-gradient(circle at 30% 20%, hsl(var(--hue, 210) 55% 62% / 0.5), transparent 50%),
    linear-gradient(145deg, hsl(var(--hue, 210) 28% 16%), hsl(calc(var(--hue, 210) + 24) 30% 28%));
  color: #fff;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
}
.modal-thumb .thumb-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.modal-thumb .lock {
  position: relative;
  z-index: 1;
  background: rgba(8,14,22,0.58);
  padding: 0.7rem 1rem;
  border-radius: 999px;
  font-weight: 600;
}
.modal-body { padding: 1.2rem 1.25rem 1.4rem; }
.modal-body h2 {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-size: 1.45rem;
}
.modal-body .meta {
  color: var(--muted);
  font-size: 0.92rem;
  display: grid;
  gap: 0.2rem;
  margin-bottom: 0.9rem;
}
.modal-close {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  border: 0;
  background: rgba(255,255,255,0.85);
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 1.1rem;
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 70;
  background: var(--ink);
  color: #f5f0e8;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  box-shadow: var(--shadow);
  transform: translateY(120%);
  opacity: 0;
  transition: transform 220ms ease, opacity 220ms ease;
}
.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.foot {
  margin-top: 3rem;
  border-top: 1px solid var(--line);
  background: rgba(255,255,255,0.45);
}
.foot-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.75rem 1.25rem 2rem;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 1.25rem;
}
.foot h3 {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
}
.foot p, .foot a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
}
.foot a:hover { color: var(--ink); }
.foot-links { display: grid; gap: 0.35rem; }
.foot-bottom {
  border-top: 1px solid var(--line);
  text-align: center;
  padding: 0.9rem 1rem 1.3rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.pay-wrap {
  max-width: 520px;
  margin: 0 auto 3rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.4rem 1.35rem 1.6rem;
}
.pay-brands {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 0.4rem 0 1rem;
  color: var(--muted);
  font-size: 0.82rem;
}
.pay-brands span {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.2rem 0.5rem;
}
.pay-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
.pay-status {
  margin-top: 1rem;
  padding: 0.85rem 0.95rem;
  border-radius: 10px;
  font-size: 0.92rem;
}
.pay-status.wait { background: #eef3ea; color: var(--forest); }
.pay-status.fail { background: #f7eaea; color: var(--danger); }
.pay-note { color: var(--muted); font-size: 0.82rem; margin-top: 0.85rem; }

@media (max-width: 980px) {
  .lecture-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .subject-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat-rail { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 1rem; }
  .catalog-shell { grid-template-columns: 1fr; }
  .filters { position: static; }
  .pricing-grid { grid-template-columns: 1fr; }
  .plan.featured { transform: none; }
  .foot-inner { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .pay-row { grid-template-columns: 1fr; }
  .top-inner { grid-template-columns: 1fr; }
  .nav { justify-content: flex-start; }
  .lecture-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .subject-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .timeline-item { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .lecture-grid { grid-template-columns: 1fr; }
}
