:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #475569;
  --line: #dbe3ee;
  --accent: #0f172a;
  --accent-soft: #e2e8f0;
  --primary: #2563eb;
  --radius: 18px;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    Arial,
    sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

a {
  color: inherit;
}

img {
  max-width: 100%;
  display: block;
}

button {
  font: inherit;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  background: var(--surface);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 10px;
  text-decoration: none;
  box-shadow: var(--shadow);
}

.skip-link:focus {
  left: 16px;
  top: 16px;
}

.container {
  width: min(1120px, calc(100% - 32px));
  margin-inline: auto;
}

.section {
  padding: 72px 0;
}

.section h2 {
  margin: 0 0 12px;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.section .intro {
  margin: 0 0 28px;
  max-width: 760px;
  color: var(--muted);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(248, 250, 252, 0.84);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.header-inner {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  font-weight: 700;
  text-decoration: none;
}

.site-nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  margin: 0;
  padding: 0;
}

.site-nav a {
  text-decoration: none;
  color: var(--muted);
  font-weight: 500;
}

.site-nav a:hover {
  color: var(--text);
}

.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
}

.nav-toggle-line {
  display: block;
  width: 100%;
  height: 2px;
  margin: 5px 0;
  background: var(--text);
  border-radius: 999px;
}

.hero {
  padding-top: 84px;
}

.hero-inner {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 32px;
  align-items: start;
}

.eyebrow {
  margin: 0 0 12px;
  display: inline-flex;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.hero h1 {
  margin: 0 0 14px;
  font-size: clamp(40px, 7vw, 72px);
  line-height: 0.98;
  letter-spacing: -0.05em;
}

.lead {
  margin: 0 0 14px;
  font-size: clamp(20px, 3vw, 28px);
  line-height: 1.25;
  font-weight: 600;
}

.hero-text {
  margin: 0 0 24px;
  max-width: 680px;
  color: var(--muted);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 28px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}

.button:hover {
  background: #f1f5f9;
}

.button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.button.primary:hover {
  background: #111827;
}

.hero-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

.hero-facts div {
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero-facts dt {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 14px;
}

.hero-facts dd {
  margin: 0;
  font-weight: 650;
}

.hero-card {
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.avatar {
  width: 88px;
  height: 88px;
  display: grid;
  place-items: center;
  margin-bottom: 20px;
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.16), rgba(15, 23, 42, 0.08)),
    #fff;
  border: 1px solid var(--line);
  font-size: 30px;
  font-weight: 800;
}

.terminal {
  padding: 18px;
  border-radius: 18px;
  background: #0f172a;
  color: #e2e8f0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 14px;
  line-height: 1.7;
}

.terminal p {
  margin: 0;
}

.grid {
  display: grid;
  gap: 20px;
}

.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card {
  height: 100%;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card h3 {
  margin: 0 0 10px;
  font-size: 22px;
  line-height: 1.2;
}

.card p {
  margin: 0 0 16px;
  color: var(--muted);
}

.about-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 24px;
  align-items: start;
}

.about-text p {
  margin: 0 0 16px;
  color: var(--text);
}

.about-card h3 {
  margin-top: 0;
}

.plain-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.plain-list li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.plain-list li:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.plain-list span {
  color: var(--muted);
}

.tags {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tags li {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 14px;
}

.project-card {
  display: flex;
  flex-direction: column;
}

.project-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.badge {
  flex: 0 0 auto;
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.project-links {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.project-links a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}

.project-links a:hover {
  text-decoration: underline;
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 20px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.timeline-period {
  color: var(--muted);
  font-weight: 600;
}

.timeline-content h3 {
  margin: 0 0 4px;
}

.timeline-content p {
  margin: 0 0 12px;
  color: var(--muted);
}

.timeline-content ul {
  margin: 0;
  padding-left: 18px;
}

/* --- Контакты: увеличенная мин. ширина и перенос длинных значений --- */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 20px;
}

.contact-card {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-width: 0;
  text-decoration: none;
}

.contact-card h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.contact-card p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.4;
  overflow-wrap: break-word;
  word-break: break-word;
}

.site-footer {
  padding: 28px 0 48px;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
}

.footer-inner a {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}

/* --- Страницы кейсов --- */
.case-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
}

.case-back:hover {
  color: var(--text);
}

.case-hero {
  padding-top: 48px;
  padding-bottom: 24px;
}

.case-hero h1 {
  margin: 0 0 14px;
  font-size: clamp(32px, 5vw, 56px);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.case-hero .lead {
  margin-bottom: 0;
}

.case-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin: 28px 0 0;
}

.case-meta > div {
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.case-meta dt {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 14px;
}

.case-meta dd {
  margin: 0;
  font-weight: 650;
}

.case-body h2 {
  margin: 36px 0 12px;
  font-size: 24px;
  letter-spacing: -0.02em;
}

.case-body p {
  margin: 0 0 16px;
  max-width: 760px;
}

.case-body ul {
  margin: 0 0 16px;
  padding-left: 20px;
  max-width: 760px;
}

.case-body li {
  margin-bottom: 6px;
}

.case-stack {
  margin-top: 8px;
}

@media (max-width: 980px) {
  .hero-inner,
  .about-grid {
    grid-template-columns: 1fr;
  }

  .cols-3 {
    grid-template-columns: 1fr;
  }

  .timeline-item {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .nav-toggle {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
  }

  .site-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: none;
    background: rgba(255, 255, 255, 0.98);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow);
  }

  .site-nav.is-open {
    display: block;
  }

  .site-nav ul {
    flex-direction: column;
    gap: 14px;
    padding: 18px 16px 22px;
  }
}

@media (max-width: 640px) {
  .section {
    padding: 56px 0;
  }

  .hero {
    padding-top: 48px;
  }

  .hero-facts {
    grid-template-columns: 1fr;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}