/* ═══════════════════════════════════════════════════════
   Класична Електродинаміка — стиль для TeX4ht HTML
   ═══════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,500;0,600;0,700;1,400;1,600&family=EB+Garamond:ital,wght@0,400;0,500;1,400&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── Variables ── */
:root {
  --navy:         #0d1b2e;
  --navy2:        #152238;
  --gold:         #c8a84b;
  --gold2:        #e6c96e;
  --cream:        #f7f2e8;
  --cream2:       #ede8db;
  --ink:          #1e2030;
  --ink2:         #2f3050;
  --muted:        #6b7080;
  --accent:       #3a7abf;
  --radius:       6px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Page shell: темно-синій зовні, кремовий всередині ── */
html {
  min-height: 100%;
  background: var(--navy);
  /* силові лінії на фоні */
  background-image:
    repeating-linear-gradient(
      115deg,
      transparent 0px, transparent 60px,
      rgba(200,168,75,.025) 60px, rgba(200,168,75,.025) 61px
    ),
    radial-gradient(ellipse at 15% 50%, rgba(58,122,191,.08) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 20%, rgba(200,168,75,.06) 0%, transparent 45%);
}

body {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 0 80px;
  background: var(--cream);
  color: var(--ink);
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 18px;
  line-height: 1.82;
  border-left:  1px solid rgba(200,168,75,.2);
  border-right: 1px solid rgba(200,168,75,.2);
  box-shadow: 0 0 100px rgba(0,0,0,.55);
  /* золота смуга зверху */
  border-top: 4px solid var(--gold);
  position: relative;
}

/* ── Paragraphs ── */
p { margin: .7em 0; }
p.indent  { text-indent: 1.5em; text-align: justify; hyphens: auto; }
p.noindent { text-indent: 0;    text-align: justify; hyphens: auto; }

/* ── Headings ── */
h2, h3, h4, h5, h6 {
  font-family: 'Cormorant Garamond', serif;
  color: var(--navy);
  line-height: 1.3;
  margin-top: 2.2em;
  margin-bottom: .7em;
  font-weight: 600;
}

/* Розділ (Chapter) */
h2.chapterHead,
h2.likechapterHead {
  font-size: 2rem;
  font-weight: 700;
  text-align: center;
  padding: 1.4em 60px .9em;
  border-bottom: 2px solid var(--gold);
  margin-bottom: 1.4em;
  margin-top: .5em;
  position: relative;
  background: linear-gradient(to bottom, rgba(200,168,75,.06), transparent);
}
h2.likechapterHead { /* Зміст */
  font-size: 1.6rem;
  padding: 2em 60px .7em;
  letter-spacing: .08em;
}
h2.chapterHead .titlemark {
  display: block;
  font-size: .62rem;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: .4em;
  font-style: normal;
  font-weight: 700;
}

/* Параграф (Section) */
h3.sectionHead,
h3.likesectionHead {
  font-size: 1.65rem;
  border-left: 5px solid var(--gold);
  padding: .1em 0 .1em .6em;
  margin-top: 2em;
}
h3.sectionHead .titlemark {
  color: var(--gold);
  font-style: normal;
}

/* Підпараграф (Subsection) */
h4.likesubsectionHead,
h4.subsectionHead {
  font-size: 1.28rem;
  font-style: italic;
  color: var(--ink2);
  padding-bottom: .25em;
  border-bottom: 1px solid var(--cream2);
  position: relative;
}
h4.likesubsectionHead::before,
h4.subsectionHead::before {
  content: '';
  position: absolute;
  bottom: -1px; left: 0;
  width: 60px; height: 2px;
  background: var(--gold);
}

/* ── Content padding ── */
h2.chapterHead ~ *,
h2.likechapterHead ~ *,
p, .newtheorem, .tcolorbox, .figure, ul, ol {
  padding-left: 60px;
  padding-right: 60px;
}
/* Reset для елементів що мають власний padding */
h2, h3, h4 { padding-left: 60px; padding-right: 60px; }
h3.sectionHead { padding-left: calc(60px + .15em); } /* компенсація border-left */

/* ── TOC ── */
.tableofcontents {
  background: var(--navy);
  border: 1px solid rgba(200,168,75,.3);
  border-radius: var(--radius);
  padding: 1.8em 2em 1.6em;
  margin: 0 60px 2em;
  position: relative;
}
.tableofcontents::before {
  content: 'ЗМІСТ';
  display: block;
  font-family: 'Cormorant Garamond', serif;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .28em;
  color: var(--gold);
  margin-bottom: .9em;
  padding-bottom: .6em;
  border-bottom: 1px solid rgba(200,168,75,.2);
}
.chapterToc,
.sectionToc {
  display: block;
  margin: .25em 0;
}
.chapterToc a {
  color: var(--cream);
  font-family: 'EB Garamond', serif;
  font-size: 1rem;
  font-weight: 500;
}
.sectionToc a {
  color: rgba(247,242,232,.7);
  font-family: 'EB Garamond', serif;
  font-size: .93rem;
  padding-left: 1.3em;
  display: inline-block;
}
.tableofcontents a {
  text-decoration: none;
  border-bottom: none;
  transition: color .2s, padding-left .15s;
}
.tableofcontents a:hover { color: var(--gold2) !important; padding-left: calc(1.3em + 4px); }
.chapterToc a:hover { padding-left: 4px; }

/* ── Links ── */
a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dotted var(--accent);
  transition: color .2s, border-color .2s;
}
a:hover { color: var(--gold); border-color: var(--gold); }

/* ── Inline formatting ── */
.rm-lmbx-10, strong, b { font-weight: 600; }
.rm-lmri-10, em { font-style: italic; color: var(--ink2); }
.textsuperscript { font-size: .75em; vertical-align: super; }
.footnote-mark { font-size: .75em; vertical-align: super; color: var(--gold); }

/* ── Display equations ── */
.mathjax-env {
  margin: 1.1em 60px;
  padding: .5em 1.2em;
  background: rgba(200,168,75,.06);
  border-radius: 4px;
  text-align: center;
  overflow-x: auto;
}
/* скасовуємо подвійний padding якщо клас вже набрав його */
.mathjax-env { padding-left: 1.2em; padding-right: 1.2em; }

.mathjax-block {
  margin: 1em 60px;
  overflow-x: auto;
}

/* Inline math — нічого не чіпаємо */
.mathjax-inline { color: inherit; }

/* ── Problem boxes (tcolorbox) ── */
.tcolorbox {
  background: #fdf8ef;
  border-left: 4px solid var(--gold) !important;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 1.6em 60px;
  padding: 0;
  box-shadow: 0 2px 12px rgba(0,0,0,.07), 0 0 0 1px rgba(200,168,75,.12);
  position: relative;
  overflow: hidden;
  /* скасуй успадкований padding від * */
  padding-left: 0 !important;
  padding-right: 0 !important;
}
.tcolorbox::after {
  content: '⬡';
  position: absolute;
  top: 8px; right: 14px;
  font-size: 1.6rem;
  color: rgba(200,168,75,.12);
  pointer-events: none;
}
.tcolorbox-content {
  padding: 1.1em 1.8em 1.1em 1.5em;
  /* скасуй padding від загального правила */
  padding-left: 1.5em !important;
  padding-right: 1.8em !important;
}

/* ── Theorems ── */
.newtheorem {
  background: rgba(58,122,191,.06);
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 1.4em 60px;
  padding-left: 0 !important;
  padding-right: 0 !important;
}
.newtheorem .head {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  font-size: 1rem;
  color: var(--accent);
  padding: .8em 1.5em .2em;
  display: block;
}
.newtheorem .content {
  padding: 0 1.8em 1em 1.5em;
}
.newtheorem .id { display: none; } /* номер вже в .head */

/* ── Lists ── */
ul.itemize,
ul.itemize1,
ul.itemize2 {
  margin: .6em 0;
  padding-left: 1.5em;
  list-style: none;
}
ul.itemize  li::before { content: '▸'; color: var(--gold); margin-right: .5em; }
ul.itemize1 li::before { content: '–'; color: var(--muted); margin-right: .5em; }
ul.itemize2 li::before { content: '·'; color: var(--muted); margin-right: .5em; }

/* ── Figures ── */
.figure {
  text-align: center;
  margin: 1.8em 60px;
  padding-left: 0 !important;
  padding-right: 0 !important;
}
.caption {
  font-size: .85rem;
  color: var(--muted);
  font-style: italic;
  margin-top: .5em;
}
img { max-width: 100%; height: auto; }

/* ── Scrollbar (WebKit) ── */
::-webkit-scrollbar { width: 8px; height: 6px; }
::-webkit-scrollbar-track { background: var(--cream2); }
::-webkit-scrollbar-thumb { background: rgba(200,168,75,.4); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold); }

/* ── Responsive ── */
@media (max-width: 860px) {
  body { font-size: 16px; }
  p.indent, p.noindent { padding-left: 24px; padding-right: 24px; }
  h2, h3, h4 { padding-left: 24px !important; padding-right: 24px !important; }
  .tableofcontents, .mathjax-env, .mathjax-block,
  .tcolorbox, .newtheorem, .figure { margin-left: 24px; margin-right: 24px; }
}