/* ==========================================================================
   Полимеры.Наука — общий стиль сайта
   ========================================================================== */

:root {
  --paper: #f1f4f1;
  --paper-raised: #ffffff;
  --ink: #1b2430;
  --ink-soft: #3c4757;
  --teal: #0f8b8d;
  --teal-deep: #0b6668;
  --amber: #dc9438;
  --slate: #5c7080;
  --line: #d7dcd6;
  --line-strong: #b9c2bd;

  --font-display: "Source Serif 4", "Georgia", serif;
  --font-body: "Inter", -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", monospace;

  --measure: 68ch;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* subtle graph-paper texture, like lab notebook grid */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 32px 32px;
  opacity: 0.35;
}

a { color: var(--teal-deep); }
a:hover { color: var(--amber); }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 0.5em;
  letter-spacing: -0.01em;
}

p { margin: 0 0 1.1em; max-width: var(--measure); }

code, .formula {
  font-family: var(--font-mono);
  background: rgba(15, 139, 141, 0.08);
  border: 1px solid rgba(15, 139, 141, 0.18);
  border-radius: 4px;
  padding: 0.05em 0.4em;
  font-size: 0.92em;
  color: var(--teal-deep);
}

sub, sup { font-size: 0.7em; }

/* ---------- layout shell ---------- */

.shell {
  position: relative;
  z-index: 1;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 32px;
}

/* ---------- header / nav ---------- */

header.site {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(241, 244, 241, 0.88);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line-strong);
}

.nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  max-width: 1120px;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
}

.brand-mark {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  color: var(--teal);
  border: 1.5px solid var(--ink);
  padding: 1px 6px;
  border-radius: 3px;
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
}

nav.primary { display: flex; gap: 4px; flex-wrap: wrap; }

nav.primary a {
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 0.92rem;
  padding: 8px 12px;
  border-radius: 6px;
  transition: background 0.15s ease, color 0.15s ease;
}

nav.primary a:hover { background: rgba(15,139,141,0.1); color: var(--teal-deep); }
nav.primary a.current { color: var(--teal-deep); font-weight: 600; background: rgba(15,139,141,0.12); }

/* ---------- hero ---------- */

.hero {
  padding: 72px 0 56px;
  position: relative;
}

.eyebrow {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.78rem;
  color: var(--slate);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.eyebrow::before {
  content: "";
  width: 22px;
  height: 1px;
  background: var(--amber);
  display: inline-block;
}

.hero h1 {
  font-size: clamp(2.1rem, 4vw, 3.2rem);
  max-width: 16ch;
  line-height: 1.08;
}

.hero .lede {
  font-size: 1.15rem;
  color: var(--ink-soft);
  max-width: 58ch;
  margin-top: 18px;
}

/* repeat-unit chain motif: [ –unit– ]n drawn as SVG, used across hero sections */
.chain-motif {
  margin-top: 36px;
  display: flex;
  align-items: center;
  gap: 0;
  overflow-x: auto;
}

.chain-motif svg { display: block; }

/* ---------- section scaffolding ---------- */

main { position: relative; z-index: 1; }

section.block {
  padding: 52px 0;
  border-top: 1px solid var(--line);
}

section.block .heading-row {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

section.block .heading-row h2 {
  font-size: 1.65rem;
}

.bracket-tag {
  font-family: var(--font-mono);
  color: var(--teal);
  font-size: 0.95rem;
}

/* card grid, used for classification / concepts */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.card {
  background: var(--paper-raised);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 22px 22px 20px;
}

.card h3 {
  font-size: 1.05rem;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card h3 .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--teal);
  flex: none;
}

.card p:last-child { margin-bottom: 0; }
.card p { font-size: 0.95rem; color: var(--ink-soft); }

/* sequence steps — only used where content is a genuine ordered process */
.sequence {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-left: 2px solid var(--line-strong);
  margin-left: 6px;
}

.sequence .step {
  position: relative;
  padding: 4px 0 28px 28px;
}

.sequence .step::before {
  content: attr(data-n);
  position: absolute;
  left: -13px;
  top: 2px;
  width: 24px; height: 24px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 50%;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  display: flex; align-items: center; justify-content: center;
}

.sequence .step h4 { font-size: 1rem; margin-bottom: 4px; }
.sequence .step p { font-size: 0.94rem; color: var(--ink-soft); margin-bottom: 0; }

/* comparison table */
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.93rem;
  background: var(--paper-raised);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  overflow: hidden;
}

table.data th, table.data td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

table.data th {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--slate);
  background: rgba(92,112,128,0.06);
}

table.data tr:last-child td { border-bottom: none; }

.note {
  border-left: 3px solid var(--amber);
  background: rgba(220, 148, 56, 0.08);
  padding: 14px 18px;
  border-radius: 0 8px 8px 0;
  font-size: 0.94rem;
  color: var(--ink-soft);
}

.note strong { color: var(--ink); }

/* callout pair, for comparing two mechanisms/models side by side */
.pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 720px) {
  .pair { grid-template-columns: 1fr; }
  .nav-row { flex-direction: column; align-items: flex-start; gap: 12px; }
}

/* ---------- page nav (prev/next through the course) ---------- */

.page-flow {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 40px 0 64px;
  flex-wrap: wrap;
}

.flow-link {
  text-decoration: none;
  border: 1px solid var(--line-strong);
  background: var(--paper-raised);
  border-radius: 10px;
  padding: 16px 20px;
  max-width: 320px;
  transition: border-color 0.15s ease;
}

.flow-link:hover { border-color: var(--teal); }

.flow-link .dir {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--slate);
}

.flow-link .title { color: var(--ink); font-weight: 600; margin-top: 4px; }

/* ---------- footer ---------- */

footer.site {
  border-top: 1px solid var(--line-strong);
  padding: 28px 0 40px;
}

footer.site .shell {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

footer.site p {
  font-size: 0.85rem;
  color: var(--slate);
  margin: 0;
}

/* focus visibility */
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}
