/* ============================================================
   SNVCP - one stylesheet for both directions.
   Layout uses CSS logical properties throughout: the Arabic tree
   (dir="rtl") and the English tree (dir="ltr") share this file.
   Never apply letter-spacing to Arabic text; tracking is unused.
   ============================================================ */

/* ---------- Fonts (self-hosted) ---------- */

@font-face {
  font-family: 'Amiri';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/amiri-400-arabic.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
  font-family: 'Amiri';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/amiri-400-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Amiri';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/assets/fonts/amiri-700-arabic.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
  font-family: 'Amiri';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/assets/fonts/amiri-700-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Source Serif 4';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/sourceserif-400-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Source Serif 4';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/sourceserif-400i-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Source Serif 4';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/assets/fonts/sourceserif-600-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Source Serif 4';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/assets/fonts/sourceserif-700-latin.woff2') format('woff2');
}

/* ---------- Tokens ---------- */

:root {
  --paper: #FBF9F3;
  --ink: #21241F;
  --ink-soft: #4B5049;
  --blue: #1B4F8A;
  --blue-deep: #14304F;
  --green: #1F6038;
  --gold: #8A6D1B;
  --gold-bright: #C6A234;
  --red: #A3271F;
  --line: #DAD4C3;
  --line-strong: #B4AD97;
  --note-bg: #F5F0E0;
  --colophon-text: #EDE8D8;
  --colophon-soft: #CFC8B0;
  --gutter: clamp(30px, 6vw, 64px);
  --font-ar: 'Amiri', 'Source Serif 4', serif;
  --font-la: 'Source Serif 4', 'Amiri', serif;
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html, body { overflow-x: clip; }

html { scroll-padding-top: 120px; }

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

html[dir="rtl"] body {
  font-family: var(--font-ar);
  font-size: 19px;
  line-height: 1.95;
}

img { max-width: 100%; height: auto; }

a { color: var(--blue); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--blue-deep); }

h1, h2, h3 { font-weight: 700; line-height: 1.3; margin: 0; }
html[dir="rtl"] h1, html[dir="rtl"] h2, html[dir="rtl"] h3 { line-height: 1.6; }

p { margin: 0 0 1em; }

:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

.wrap {
  max-width: 1120px;
  margin-inline: auto;
  padding-inline: 20px;
}

.skip {
  position: absolute;
  inset-inline-start: 12px;
  top: -60px;
  z-index: 100;
  background: var(--blue-deep);
  color: #fff;
  padding: 0.6rem 1rem;
  transition: top 0.2s;
}
.skip:focus { top: 12px; color: #fff; }

/* ---------- Masthead ---------- */

.masthead {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 60;
  overflow-anchor: none;
  background: var(--paper);
  border-bottom: 1px solid var(--line-strong);
}

.masthead__brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 0.85rem;
  transition: padding 0.25s ease;
}
.masthead.is-small .masthead__brand { padding-block: 0.3rem; }

.brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  text-decoration: none;
  color: var(--ink);
  min-width: 0;
}
.brand img {
  width: 46px;
  height: 46px;
  transition: width 0.25s ease, height 0.25s ease;
}
.masthead.is-small .brand img { width: 32px; height: 32px; }
.brand__name {
  font-weight: 700;
  font-size: 1.02rem;
  line-height: 1.3;
}
html[dir="rtl"] .brand__name { font-size: 1.12rem; }

.masthead__tools {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-shrink: 0;
}

.langswitch {
  display: inline-block;
  border: 1px solid var(--line-strong);
  padding: 0.35rem 0.9rem;
  text-decoration: none;
  color: var(--ink);
  font-size: 0.92rem;
  background: #fff;
}
.langswitch:hover { border-color: var(--blue); color: var(--blue); }

.navtoggle {
  display: none;
  background: none;
  border: 1px solid var(--line-strong);
  padding: 0.4rem 0.6rem;
  cursor: pointer;
  color: var(--ink);
}
.navtoggle svg { display: block; width: 22px; height: 22px; }
.navtoggle .icon-close { display: none; }
.masthead.nav-open .navtoggle .icon-menu { display: none; }
.masthead.nav-open .navtoggle .icon-close { display: block; }

/* contents strip: the gazette contents line */
.contents { border-top: 1px solid var(--line); }
.contents ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}
.contents a {
  display: block;
  padding: 0.5rem 0.75rem;
  font-size: 0.88rem;
  line-height: 1.4;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 2px solid transparent;
}
html[dir="rtl"] .contents a { font-size: 0.95rem; }
.contents a:hover { color: var(--blue); }
.contents a[aria-current="page"] {
  color: var(--red);
  border-bottom-color: var(--red);
  font-weight: 700;
}

/* ---------- Wayline (the Nile spine) ---------- */

.wayline { position: relative; }
.wayline__inner { position: relative; }
.wayline__inner::before {
  content: "";
  position: absolute;
  inset-block: 0;
  inset-inline-start: calc(var(--gutter) / 2);
  width: 1px;
  background: var(--line-strong);
}
.wayline__trace {
  position: absolute;
  inset-block: 0;
  inset-inline-start: calc(var(--gutter) / 2);
  width: 1px;
  background: var(--blue);
  transform-origin: top;
  transform: scaleY(0);
}
.wayline__inner {
  padding-inline-start: var(--gutter);
  padding-block-end: 3rem;
}

/* sections hang off the wayline as river stations */
.entry {
  position: relative;
  padding-block: 2.4rem;
  border-top: 1px solid var(--line);
}
.entry:first-child { border-top: 0; }
.entry::before {
  content: "";
  position: absolute;
  inset-inline-start: calc(-1 * (var(--gutter) / 2) - 5px);
  top: 3.1rem;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--blue);
}
.entry > h2 {
  font-size: 1.6rem;
  margin-block-end: 0.4rem;
}
.entry > .lead {
  color: var(--ink-soft);
  max-width: 66ch;
  margin-block-end: 1.6rem;
}

/* ---------- Part-title opener (no photo heroes anywhere) ---------- */

.part-title {
  position: relative;
  text-align: center;
  padding-block: 3.2rem 2.2rem;
}
.part-title::before { display: none; }

.running-head {
  color: var(--ink-soft);
  font-size: 0.95rem;
  margin-block-end: 1.1rem;
}

.cartouche {
  border-block: 1px solid var(--ink);
  padding-block: 1.1rem;
  position: relative;
  max-width: 900px;
  margin-inline: auto;
}
.cartouche::before {
  content: "";
  position: absolute;
  inset-block: 4px;
  inset-inline: 0;
  border-block: 1px solid var(--ink);
  opacity: 0.45;
  pointer-events: none;
}
.cartouche h1 {
  font-size: clamp(1.9rem, 4.6vw, 3rem);
  line-height: 1.35;
}
html[dir="rtl"] .cartouche h1 { line-height: 1.7; }

.standfirst {
  max-width: 62ch;
  margin: 1.4rem auto 0;
  color: var(--ink-soft);
  font-size: 1.06rem;
}

/* confluence: two rivers joining above the spine (home only) */
.confluence {
  display: block;
  width: 74px;
  height: 86px;
  margin: 1.6rem auto 0;
  color: var(--blue);
}
html[dir="rtl"] .confluence { transform: scaleX(-1); }
.confluence path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
}

/* five-pillar frieze */
.frieze {
  list-style: none;
  margin: 1.8rem 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
}
.frieze li {
  border: 1px solid var(--line-strong);
  padding: 0.5rem 1.15rem;
  font-weight: 600;
  background: #fff;
}
html[dir="rtl"] .frieze li { font-weight: 700; }

.cta-row {
  margin: 2rem 0 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.9rem;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  background: var(--blue);
  color: #fff;
  border: 1px solid var(--blue);
  padding: 0.75rem 1.5rem;
  text-decoration: none;
  font-weight: 600;
  line-height: 1.4;
}
.btn:hover { background: var(--blue-deep); border-color: var(--blue-deep); color: #fff; }
.btn--ghost {
  background: transparent;
  color: var(--blue);
}
.btn--ghost:hover { background: var(--blue); color: #fff; }
.btn svg { width: 17px; height: 17px; flex-shrink: 0; }
html[dir="rtl"] .btn svg.icon-dir { transform: scaleX(-1); }

/* container link colour must never override a filled button */
.entry a:not(.btn), .colophon a:not(.btn) { text-decoration-color: var(--line-strong); }

/* ---------- Items (ruled entries, never equal-height cards) ---------- */

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 0 2.6rem;
  align-items: start;
}

.item {
  border-top: 2px solid var(--accent, var(--line-strong));
  padding-block: 1.3rem;
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 0 0.9rem;
  align-items: start;
}
.item__icon {
  grid-row: span 2;
  width: 30px;
  height: 30px;
  color: var(--ink);
  margin-block-start: 0.15rem;
}
.item__icon svg { width: 100%; height: 100%; display: block; }
.item h3 {
  font-size: 1.12rem;
  margin-block-end: 0.25rem;
}
.item p { margin: 0; color: var(--ink-soft); font-size: 0.97rem; }
html[dir="rtl"] .item p { font-size: 1rem; }

.item__num {
  grid-row: span 2;
  font-size: 0.9rem;
  color: var(--gold);
  font-weight: 700;
  padding-block-start: 0.2rem;
}

/* ---------- Mission quote ---------- */

.party-mission {
  margin: 0;
  border-block: 1px solid var(--ink);
  padding-block: 1.6rem;
  text-align: center;
  font-size: 1.25rem;
  line-height: 1.75;
}
html[dir="rtl"] .party-mission { font-size: 1.3rem; line-height: 2.1; }

/* ---------- Marginal notes (the standing client notes) ---------- */

.note {
  border-inline-start: 3px solid var(--gold);
  background: var(--note-bg);
  padding: 1rem 1.3rem;
  margin-block: 1.6rem 0;
  font-size: 0.95rem;
  color: var(--ink);
  max-width: 70ch;
}
html[dir="rtl"] .note { font-size: 1rem; }

/* ---------- Timeline (hangs on the wayline) ---------- */

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  border-top: 1px solid var(--line);
  padding-block: 1.2rem;
  display: grid;
  grid-template-columns: minmax(110px, 150px) 1fr;
  gap: 0 1.6rem;
  align-items: start;
}
.timeline__date {
  font-weight: 700;
  color: var(--blue);
}
.timeline li p { margin: 0; color: var(--ink-soft); }

/* ---------- Plates (figures in the compendium convention) ---------- */

.plate {
  margin: 0;
  border: 1px solid var(--line-strong);
  background: #fff;
  padding: 12px;
}
.plate img { display: block; width: 100%; }
.plate figcaption {
  border-top: 1px solid var(--line);
  margin-block-start: 0.7rem;
  padding-block-start: 0.6rem;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

/* emblem plate on about-party */
.emblem-plate { max-width: 300px; margin-inline: auto; }

/* ---------- Library ---------- */

.library {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 2rem;
  align-items: start;
}
.library__meta {
  color: var(--ink-soft);
  font-size: 0.95rem;
  margin-block: 0.4rem 1rem;
}
.library__actions { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-block-start: 1.2rem; }

.map-plate { max-width: 560px; margin-block-start: 2.4rem; }

/* ---------- Downloads ---------- */

.downloads { display: grid; gap: 0; }
.download {
  display: flex;
  align-items: center;
  gap: 1rem;
  border-top: 1px solid var(--line-strong);
  padding-block: 1.1rem;
  text-decoration: none;
  color: var(--ink);
}
.download:hover { color: var(--blue); }
.download svg { width: 26px; height: 26px; flex-shrink: 0; color: var(--blue); }
.download__name { font-weight: 600; }
.download__size { color: var(--ink-soft); font-size: 0.9rem; margin-inline-start: auto; flex-shrink: 0; }

/* ---------- Contact ---------- */

.contact-grid {
  display: grid;
  grid-template-columns: minmax(260px, 340px) 1fr;
  gap: 2.6rem;
  align-items: start;
}
.contact-facts { border-top: 2px solid var(--line-strong); padding-block-start: 1.2rem; }
.contact-facts dt {
  font-weight: 700;
  margin-block-start: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.contact-facts dt:first-child { margin-block-start: 0; }
.contact-facts dt svg { width: 20px; height: 20px; color: var(--blue); }
.contact-facts dd { margin: 0.2rem 0 0; color: var(--ink-soft); }

.form { border-top: 2px solid var(--line-strong); padding-block-start: 1.2rem; }
.form label {
  display: block;
  font-weight: 600;
  margin-block: 1rem 0.3rem;
}
.form input, .form textarea {
  width: 100%;
  font: inherit;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--ink);
}
.form input:focus, .form textarea:focus {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
  border-color: var(--blue);
}
.form .btn { margin-block-start: 1.3rem; cursor: pointer; }
.hp {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

/* ---------- Utility pages (thanks / 404) ---------- */

.utility { text-align: center; padding-block: 5rem; }
.utility::before { display: none; }
.utility h1 { font-size: 2.2rem; margin-block-end: 0.8rem; }
.utility p { color: var(--ink-soft); max-width: 52ch; margin-inline: auto; }

/* ---------- Colophon (footer) ---------- */

.colophon {
  background: var(--blue-deep);
  color: var(--colophon-text);
  padding-block: 2.8rem 1.4rem;
  margin-block-start: 0;
}
.colophon a { color: var(--colophon-text); }
.colophon a:hover { color: #fff; }
.colophon__grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 2.4rem;
  padding-block-end: 2rem;
  border-bottom: 1px solid rgba(237, 232, 216, 0.25);
}
.colophon__brand { display: flex; gap: 0.9rem; align-items: flex-start; }
.colophon__brand img { width: 54px; height: 54px; flex-shrink: 0; }
.colophon__name { font-weight: 700; font-size: 1.1rem; margin-block-end: 0.3rem; }
.colophon__statement { color: var(--colophon-soft); font-size: 0.95rem; margin: 0; max-width: 46ch; }
.colophon__links h2 {
  font-size: 0.95rem;
  color: var(--colophon-text);
  margin-block-end: 0.6rem;
}
.colophon__links ul {
  list-style: none;
  margin: 0;
  padding: 0;
  columns: 2;
  column-gap: 1.6rem;
}
.colophon__links li { break-inside: avoid; }
.colophon__links a {
  display: inline-block;
  padding-block: 0.22rem;
  font-size: 0.92rem;
  text-decoration: none;
}
.colophon__links a:hover { text-decoration: underline; }
.colophon__legal {
  color: var(--colophon-soft);
  font-size: 0.85rem;
  padding-block: 1.2rem 0;
  margin: 0;
}
.colophon__base {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.4rem 1.4rem;
  padding-block-start: 1.1rem;
  font-size: 0.88rem;
}
.colophon__base p { margin: 0; }
.colophon__credit { color: var(--colophon-soft); }
.colophon__credit a { color: var(--colophon-soft); text-decoration: underline; }

/* ---------- Mobile bottom bar ---------- */

.callbar {
  display: none;
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 70;
  background: var(--blue-deep);
  border-top: 1px solid rgba(237, 232, 216, 0.3);
}
.callbar a {
  flex: 1;
  text-align: center;
  color: #fff;
  text-decoration: none;
  padding: 0.85rem 0.5rem;
  font-weight: 600;
  font-size: 0.95rem;
}
.callbar a + a { border-inline-start: 1px solid rgba(237, 232, 216, 0.3); }
.callbar a:hover { background: var(--blue); color: #fff; }

/* ---------- Reveal motion (JS-gated; page complete without JS) ---------- */

.js .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.js .reveal.is-in { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */

@media (max-width: 1020px) {
  .navtoggle { display: block; }
  .contents {
    display: none;
    border-top: 0;
    position: absolute;
    inset-inline: 0;
    top: 100%;
    background: var(--paper);
    border-bottom: 2px solid var(--ink);
    max-height: 70vh;
    overflow-y: auto;
  }
  .masthead.nav-open .contents { display: block; }
  .contents ul { flex-direction: column; align-items: stretch; }
  .contents a {
    padding: 0.7rem 1.2rem;
    border-bottom: 1px solid var(--line);
    font-size: 1rem;
  }
  .contents a[aria-current="page"] { border-bottom: 1px solid var(--line); color: var(--red); }
}

@media (max-width: 760px) {
  :root { --gutter: 30px; }
  .library { grid-template-columns: 1fr; }
  .library .plate { max-width: 300px; }
  .contact-grid { grid-template-columns: 1fr; }
  .colophon__grid { grid-template-columns: 1fr; }
  .colophon__links ul { columns: 1; }
  .callbar { display: flex; }
  body { padding-block-end: 52px; }
  .brand__name { font-size: 0.92rem; }
  html[dir="rtl"] .brand__name { font-size: 1rem; }
  .timeline li { grid-template-columns: 1fr; gap: 0.15rem 0; }
  .grid-2 { grid-template-columns: 1fr; }
}
