/* Temporary: Raleway via Google Fonts CDN for local testing only.
   BRIEF.md Section 10 calls for self-hosting the font files before launch (EU/GDPR consideration). */
@import url('https://fonts.googleapis.com/css2?family=Raleway:wght@400;500;600;700;800&display=swap');

:root {
  --color-main: #003265;
  --color-secondary: #0059b2;
  --color-body: #000000;
  --color-highlight: #d35800;
  --color-bg: #ffffff;
  --color-border: #e0e0e0;
  --font-base: 'Raleway', system-ui, sans-serif;
  --max-width: 1200px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-base);
  color: var(--color-body);
  background: var(--color-bg);
  line-height: 1.6;
}

a { color: var(--color-secondary); }
a:hover { color: var(--color-highlight); }

/* ---------- Header ---------- */
.site-header {
  background: var(--color-main);
  color: #fff;
}
.site-header__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
}
.site-branding {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0; /* required for text-overflow ellipsis to work inside a flex child */
  text-decoration: none;
}
.site-branding__logo { height: 40px; display: block; flex-shrink: 0; }
.site-title-text {
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (min-width: 600px) {
  .site-title-text { font-size: 1.05rem; }
}

.burger {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  z-index: 1001;
  flex-shrink: 0;
}
.burger__icon {
  width: 26px;
  height: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.burger__icon span {
  display: block;
  height: 2.5px;
  background: #fff;
  border-radius: 2px;
}
.burger__label {
  color: #fff;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

/* Burger + full-screen menu is the single nav pattern on every screen size. */
body.nav-open { overflow: hidden; }

.main-nav {
  display: none;
}
.main-nav.is-open {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  background: var(--color-main);
  z-index: 1000;
  /* flex-start (not center) + generous top padding: a centered flex column
     taller than the viewport hides its top items with no way to scroll to
     them in most browsers, since only bottom overflow is scrollable. */
  justify-content: flex-start;
  padding: 90px 24px 40px;
  overflow-y: auto;
  text-align: center;
}
.main-nav__close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: none;
  border: none;
  color: #fff;
  font-size: 2.2rem;
  line-height: 1;
  cursor: pointer;
  padding: 8px;
}
.main-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 480px;
  width: 100%;
}
.main-nav li { border-top: 1px solid rgba(255,255,255,0.15); }
.main-nav li:first-child { border-top: none; }
.main-nav a, .main-nav .nav-pending {
  display: block;
  padding: 14px 4px;
  color: #fff;
  text-decoration: none;
  font-size: 1.05rem;
}
.main-nav a:hover { color: var(--color-highlight); }
.main-nav .nav-pending { color: rgba(255,255,255,0.4); cursor: default; }
.main-nav__toc-link {
  display: inline-block;
  margin-top: 24px;
  font-weight: 600;
  color: #fff;
  text-decoration: underline;
}

/* Always-visible language switcher, its own thin bar under the main header row. */
.header-translate {
  background: #f2f4f7;
  border-top: 1px solid rgba(255,255,255,0.15);
  padding: 6px 20px;
}
.header-translate__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.header-translate__label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-main);
}
#google_translate_element {
  max-width: var(--max-width);
}
/* De-emphasise (not remove) Google's required attribution so the dropdown reads
   as the primary control; the credit link itself stays visible per Google's terms. */
.goog-te-gadget { font-size: 0.7rem !important; color: #99a0aa !important; }
.goog-te-gadget > span > a { vertical-align: middle; }

/* ---------- Main content ---------- */
main#content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 32px 20px 60px;
}

.page-title {
  color: var(--color-main);
  margin-top: 0;
}

.chapter-back-links {
  margin-bottom: 20px;
  font-size: 0.9rem;
}
.chapter-back-links a { margin-right: 16px; }

/* 50/50 content+image layout, stacks on mobile */
.content-split {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  align-items: start;
}
@media (min-width: 800px) {
  .content-split {
    grid-template-columns: 1fr 1fr;
    gap: 40px;
  }
}
.content-split__image img {
  width: 100%;
  height: auto;
  border-radius: 4px;
  display: block;
}
.content-split__text ul { padding-left: 20px; }
.content-split__text h3 { color: var(--color-secondary); }

/* Previous/Next between point sub-pages within a chapter */
.point-nav {
  display: flex;
  gap: 16px;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--color-border);
}
.point-nav__link, .point-nav__spacer { flex: 1 1 0; min-width: 0; }
.point-nav__link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  text-decoration: none;
  color: var(--color-main);
}
.point-nav__link:hover { border-color: var(--color-highlight); }
.point-nav__link--next { text-align: right; }
.point-nav__direction {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-secondary);
}
.point-nav__title {
  font-weight: 600;
  color: var(--color-body);
}
.point-nav__link:hover .point-nav__title,
.point-nav__link:hover .point-nav__direction { color: var(--color-highlight); }

.point-list {
  list-style: none;
  margin: 24px 0 0;
  padding: 0;
  display: grid;
  gap: 12px;
}
.point-list a {
  display: block;
  padding: 14px 18px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  text-decoration: none;
  color: var(--color-main);
  font-weight: 600;
}
.point-list a:hover { border-color: var(--color-highlight); color: var(--color-highlight); }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--color-main);
  color: #fff;
  margin-top: 40px;
}
.site-footer__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 24px 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px;
  justify-content: space-between;
}
.footer-logo img { height: 28px; opacity: 0.9; }
.footer-links a {
  color: #fff;
  margin-right: 18px;
  text-decoration: none;
  font-size: 0.9rem;
}
.footer-links a:hover { color: var(--color-highlight); }
.pdf-button {
  background: var(--color-highlight);
  padding: 8px 14px;
  border-radius: 4px;
  font-weight: 600;
}
.pdf-button:hover { color: #fff !important; opacity: 0.9; }
.footer-meta {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.75);
  display: flex;
  gap: 12px;
  align-items: center;
}
.footer-doi { color: rgba(255,255,255,0.75); }
.footer-doi--pending { font-style: italic; }

/* ---------- Title page ---------- */
.title-page {
  text-align: center;
  padding: 40px 0;
}
.title-page h1 { font-size: 2.2rem; color: var(--color-main); }
.title-page .subtitle { font-size: 1.2rem; color: var(--color-secondary); }
.title-page .cta {
  display: inline-block;
  margin-top: 24px;
  padding: 12px 28px;
  background: var(--color-main);
  color: #fff;
  text-decoration: none;
  border-radius: 4px;
  font-weight: 600;
}
.title-page .cta:hover { background: var(--color-highlight); }
.cite-block {
  margin-top: 40px;
  padding: 16px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  font-size: 0.85rem;
  text-align: left;
  color: #444;
}

/* ---------- TOC page ---------- */
.toc-list { list-style: none; padding: 0; }
.toc-list li { border-bottom: 1px solid var(--color-border); padding: 12px 0; }
.toc-list a { font-weight: 600; text-decoration: none; }
.toc-list .nav-pending { color: #999; }
