@import url('https://fonts.googleapis.com/css2?family=Literata:opsz,wght@7..72,500;7..72,600;7..72,700&family=Source+Sans+3:wght@400;500;600;700&display=swap');

:root {
  --cream: #fbf7ef;
  --cream-deep: #f0e4cf;
  --paper: #fffdf8;
  --ink: #3b2c20;
  --ink-soft: #6a5645;
  --brown: #7a5a3d;
  --orange: #d8893a;
  --orange-deep: #c06f22;
  --leaf: #b85a2a;
  --line: rgba(59, 44, 32, 0.12);
  --ok: #2f7a44;
  --bad: #b23b3b;
  --warn: #c07820;
  --shadow: 0 14px 40px rgba(59, 44, 32, 0.1);
  --radius: 18px;
  --radius-pill: 999px;
  --font: "Source Sans 3", "Segoe UI", sans-serif;
  --serif: "Literata", "Times New Roman", serif;
  --max: 1140px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--cream);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

.container { width: min(100% - 2rem, var(--max)); margin-inline: auto; }

h1, h2, h3 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.01em;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-pill);
  border: 1.5px solid transparent;
  font-weight: 700;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease, border-color .18s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn-primary {
  background: linear-gradient(135deg, var(--orange), var(--orange-deep));
  color: #fffaf2;
  box-shadow: 0 10px 24px rgba(192, 111, 34, 0.25);
}
.btn-ghost {
  background: rgba(255, 253, 248, 0.85);
  border-color: rgba(59, 44, 32, 0.16);
  color: var(--ink);
}
.btn-dark { background: var(--ink); color: var(--cream); }
.btn-danger { background: #f4e1e1; color: var(--bad); border-color: rgba(178, 59, 59, 0.2); }
.btn-sm { padding: 0.45rem 0.85rem; font-size: 0.88rem; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(12px);
  background: rgba(251, 247, 239, 0.9);
  border-bottom: 1px solid var(--line);
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 72px;
}
.brand { display: flex; align-items: center; gap: 0.7rem; min-width: 0; }
.brand img { width: 48px; height: 48px; object-fit: contain; }
.brand-text strong {
  display: block;
  font-family: var(--serif);
  font-size: 1.08rem;
}
.brand-text span {
  display: block;
  font-size: 0.72rem;
  color: var(--brown);
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.nav-links a:not(.btn) {
  font-weight: 600;
  color: var(--ink-soft);
}
.nav-links a:not(.btn):hover { color: var(--orange-deep); }

.phones, .socials, .link-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}
.link-row {
  flex-wrap: wrap;
}
.link-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 40px;
  padding: 0 0.95rem 0 0.5rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
  color: #fff !important;
  text-decoration: none !important;
  box-shadow: 0 1px 0 rgba(40, 28, 18, 0.06);
  transition: transform .15s ease, filter .15s ease, box-shadow .15s ease;
  flex: 0 0 auto;
  line-height: 1;
}
.link-pill .pill-label { color: inherit; }
.link-pill:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
  color: #fff !important;
  box-shadow: 0 4px 12px rgba(40, 28, 18, 0.12);
}
.link-pill:active { transform: none; }
.pill-ico {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
  flex: 0 0 auto;
  overflow: hidden;
}
.pill-ico svg { width: 15px; height: 15px; display: block; }
.pill-ico--logo {
  background: #fff;
  padding: 0;
}
.pill-ico--logo .pill-logo {
  width: 28px;
  height: 28px;
  display: block;
  object-fit: cover;
}
.link-pill--vk .pill-ico--logo,
.link-pill.vk .pill-ico--logo {
  background: transparent;
}
.link-pill--vk .pill-logo,
.link-pill.vk .pill-logo {
  width: 28px;
  height: 28px;
  border-radius: 8px;
}
.link-pill--max .pill-ico--logo,
.link-pill.max .pill-ico--logo {
  background: transparent;
}
.link-pill--max .pill-logo,
.link-pill.max .pill-logo {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  object-fit: contain;
  background: #0d001a;
}
.link-pill--whatsapp .pill-ico--logo,
.link-pill.whatsapp .pill-ico--logo,
.link-pill--telegram .pill-ico--logo,
.link-pill.telegram .pill-ico--logo {
  background: #fff;
  border-radius: 50%;
}
.link-pill--whatsapp .pill-logo,
.link-pill.whatsapp .pill-logo,
.link-pill--telegram .pill-logo,
.link-pill.telegram .pill-logo {
  width: 20px;
  height: 20px;
  object-fit: contain;
}
.link-pill.phone,
.link-pill--phone { background: #3b2c20; }
.link-pill.whatsapp,
.link-pill--whatsapp { background: #25D366; }
.link-pill.telegram,
.link-pill--telegram { background: #2AABEE; }
.link-pill.vk,
.link-pill--vk { background: #0077FF; }
.link-pill.max,
.link-pill--max {
  background: linear-gradient(135deg, #471aff 0%, #9500ff 55%, #6e1aff 100%);
}
.footer-grid a.link-pill,
.contact-panel a.link-pill,
.link-row a.link-pill {
  color: #fff !important;
}

.meta-note {
  font-size: 0.78rem;
  color: var(--ink-soft);
  max-width: 56ch;
}

.subject-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.subject-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.65rem 0.35rem 0.35rem;
  background: #fffdf8;
  border: 1px solid rgba(122, 90, 61, 0.14);
  border-radius: 999px;
  font-weight: 700;
  min-height: 0;
}
.subject-chip .subject-name {
  font-size: 0.82rem;
  line-height: 1.15;
}
.subject-chip .icon {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #8a4e24;
  background: #fff8ee;
  border: 1px solid rgba(216, 137, 58, 0.22);
  box-shadow: none;
}
.subject-chip .icon svg {
  width: 14px;
  height: 14px;
  display: block;
}
.subject-chip .icon-math { color: #2f6fed; background: #eef4ff; border-color: rgba(47, 111, 237, 0.2); }
.subject-chip .icon-russian { color: #b23b3b; background: #fff0f0; border-color: rgba(178, 59, 59, 0.18); }
.subject-chip .icon-history { color: #8a6a2f; background: #fff7e8; border-color: rgba(138, 106, 47, 0.2); }
.subject-chip .icon-social { color: #3d6ea8; background: #eff5ff; border-color: rgba(61, 110, 168, 0.2); }
.subject-chip .icon-physics { color: #6b4ad1; background: #f3efff; border-color: rgba(107, 74, 209, 0.2); }
.subject-chip .icon-lit { color: #9a4d1c; background: #fff3e9; border-color: rgba(154, 77, 28, 0.2); }
.subject-chip .icon-chem { color: #1f8a6a; background: #eafaf4; border-color: rgba(31, 138, 106, 0.2); }
.subject-chip .icon-bio { color: #2f7a44; background: #eef8f0; border-color: rgba(47, 122, 68, 0.2); }

.section { padding: 2rem 0; }
.section-head { max-width: 720px; margin-bottom: 0.9rem; }
.section-head h2 { font-size: clamp(1.55rem, 2.6vw, 2.15rem); margin-bottom: 0.4rem; }
.section-head p { margin: 0; color: var(--ink-soft); }
.eyebrow {
  display: inline-block;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--brown);
  margin-bottom: 0.5rem;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
}
.feature-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1rem 1.1rem;
  box-shadow: 0 8px 22px rgba(59, 44, 32, 0.06);
}
.feature-card h3 { font-size: 1.05rem; margin-bottom: 0.3rem; }
.feature-card p { margin: 0; color: var(--ink-soft); font-size: 0.95rem; }

.site-footer {
  border-top: 1px solid var(--line);
  padding: 1.35rem 0 1.5rem;
  background: #f3e8d6;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1.2fr 0.9fr;
  gap: 1rem;
  align-items: start;
}
.footer-grid h4 {
  margin: 0 0 0.45rem;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: var(--font);
}
.footer-grid p, .footer-grid a { color: var(--ink-soft); }
.footer-grid a:hover { color: var(--orange-deep); }

.form-grid { display: grid; gap: 0.8rem; margin-top: 0.4rem; }
.form-grid .row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
.field { display: grid; gap: 0.3rem; }
.field label { font-size: 0.84rem; font-weight: 700; color: var(--brown); }
.field input, .field select, .field textarea {
  width: 100%;
  border: 1px solid rgba(59, 44, 32, 0.16);
  background: #fffdf8;
  border-radius: 14px;
  padding: 0.8rem 0.9rem;
  color: var(--ink);
}
.field textarea { min-height: 96px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid rgba(216, 137, 58, 0.3);
  border-color: var(--orange);
}
.check-row {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  font-size: 0.92rem;
  color: var(--ink-soft);
}
.check-row input { margin-top: 0.2rem; }
.check-row a { color: var(--orange-deep); font-weight: 700; text-decoration: underline; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(40, 28, 18, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 80;
}
.modal-backdrop.open { display: flex; }
.modal {
  width: min(100%, 640px);
  max-height: min(86vh, 760px);
  overflow: auto;
  background: var(--paper);
  border-radius: 22px;
  padding: 1.4rem;
  box-shadow: var(--shadow);
}
.modal h2 { margin-bottom: 0.7rem; }
.modal .modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 1rem;
}
.agreement-text {
  color: var(--ink-soft);
  font-size: 0.94rem;
}
.agreement-text p { margin: 0 0 0.75rem; }

.cookie-bar {
  position: fixed;
  left: 0.75rem;
  right: 0.75rem;
  bottom: 0.75rem;
  z-index: 70;
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 0.7rem 0.9rem;
  border-radius: 14px;
  background: #3b2c20;
  color: #fbf7ef;
  box-shadow: 0 10px 28px rgba(59, 44, 32, 0.22);
}
.cookie-bar p { margin: 0; max-width: 70ch; font-size: 0.84rem; line-height: 1.35; }
.cookie-bar a { color: #f0c27a; }

.np-toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 90;
  background: #3b2c20;
  color: #fffaf2;
  padding: 0.85rem 1.1rem;
  border-radius: 14px;
  opacity: 0;
  transform: translateY(10px);
  transition: .2s ease;
  pointer-events: none;
  max-width: min(90vw, 360px);
}
.np-toast.show { opacity: 1; transform: none; }
.np-toast.error { background: #8a2f2f; }

.guide-overlay {
  position: fixed;
  inset: 0;
  background: rgba(35, 24, 16, 0.35);
  z-index: 85;
  display: grid;
  place-items: end center;
  padding: 1.2rem;
}
.guide-card {
  width: min(100%, 460px);
  background: var(--paper);
  border-radius: 20px;
  padding: 1.2rem 1.3rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}
.guide-step {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--orange-deep);
  margin-bottom: 0.35rem;
}
.guide-card h3 { margin-bottom: 0.4rem; }
.guide-card p { margin: 0 0 1rem; color: var(--ink-soft); }
.guide-actions { display: flex; justify-content: flex-end; gap: 0.55rem; }
.guide-target {
  position: relative;
  z-index: 86;
  box-shadow: 0 0 0 4px rgba(216, 137, 58, 0.55), var(--shadow);
  border-radius: 16px;
}

@media (max-width: 980px) {
  .card-grid, .footer-grid, .form-grid .row { grid-template-columns: 1fr 1fr; }
  .card-grid, .footer-grid { grid-template-columns: 1fr; }
  .nav-links a:not(.btn) { display: none; }
}
@media (max-width: 640px) {
  .form-grid .row { grid-template-columns: 1fr; }
  .brand-text span { display: none; }
}
