:root {
  --red: #ce1126;
  --red-deep: #a50e1f;
  --flag-black: #111;
  --green: #007a3d;
  --ink: #1d1b19;
  --fg: #111;
  --muted: #6b6560;
  --gold: #a9803f;
  --gold-soft: #d9c29a;
  --paper: #ffffff;
  --cream: #f8f5f0;
  --line: #e6dfd3;
  --serif: "Amiri", "Times New Roman", serif;
  --sans: "Noto Naskh Arabic", "Segoe UI", Tahoma, sans-serif;
}

[data-theme="dark"] {
  --paper: #0c0b0a;
  --cream: #151311;
  --ink: #e8e2d7;
  --fg: #f4efe6;
  --muted: #9d9488;
  --line: #29251f;
  --gold: #c9a066;
  --gold-soft: #5a4a33;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.9;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }

.wrap {
  width: min(1120px, 100% - 32px);
  margin-inline: auto;
}

.flagline {
  display: grid;
  grid-template-rows: 6px 6px 6px;
}
.flagline span:nth-child(1) { background: var(--red); }
.flagline span:nth-child(2) { background: #fff; }
.flagline span:nth-child(3) { background: var(--flag-black); }
[data-theme="dark"] .flagline span:nth-child(3) { background: #000; }

.masthead {
  position: relative;
  background: var(--paper);
}
.masthead__inner {
  text-align: center;
  padding: 56px 16px 40px;
}
.crest {
  width: 210px;
  margin: 0 auto 22px;
}
.masthead__title {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(30px, 4.4vw, 48px);
  line-height: 1.3;
  margin: 0;
  color: var(--fg);
}
.masthead__sub {
  margin: 6px 0 0;
  font-family: var(--serif);
  font-size: 19px;
  color: var(--gold);
}

.theme-toggle {
  position: absolute;
  top: 22px;
  inset-inline-end: 22px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  background: transparent;
  border: 0;
  cursor: pointer;
}
.theme-toggle:hover { color: var(--gold); }
.theme-toggle svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.6; }
.theme-toggle .sun { display: none; }
[data-theme="dark"] .theme-toggle .sun { display: block; }
[data-theme="dark"] .theme-toggle .moon { display: none; }

.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--paper);
}
.nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: center;
  gap: 8px;
}
.nav a {
  display: block;
  padding: 14px 20px;
  font-size: 15.5px;
  font-weight: 500;
}
.nav a:hover,
.nav a.is-active { color: var(--red); }
.nav__toggle { display: none; }

section { padding: 88px 0; }

.sechead {
  font-family: var(--serif);
  font-size: clamp(28px, 3.2vw, 38px);
  line-height: 1.3;
  color: var(--fg);
  margin: 0 0 36px;
}

.btn {
  display: inline-block;
  padding: 11px 30px;
  font-size: 15px;
  font-weight: 600;
  border: 1px solid transparent;
}
.btn--red { background: var(--red); color: #fff; }
.btn--red:hover { background: var(--red-deep); }

.intro { padding-top: 80px; }
.intro__grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 72px;
  align-items: center;
}
.intro h2 {
  font-family: var(--serif);
  font-size: clamp(32px, 4vw, 50px);
  line-height: 1.35;
  color: var(--fg);
  margin: 0 0 18px;
}
.intro p {
  color: var(--muted);
  max-width: 540px;
  margin: 0 0 30px;
}
.intro__actions { display: flex; gap: 12px; flex-wrap: wrap; }

.flagcard__flag {
  display: grid;
  grid-template-rows: 1fr 1fr 1fr;
  aspect-ratio: 3 / 2;
  border-radius: 3px;
  overflow: hidden;
  box-shadow: 0 18px 40px -24px rgba(0,0,0,.5);
}
.flagcard__flag .r { background: var(--red); }
.flagcard__flag .k { background: var(--flag-black); }
[data-theme="dark"] .flagcard__flag { box-shadow: 0 0 0 1px rgba(255, 255, 255, .08); }
[data-theme="dark"] .flagcard__flag .k { background: #000; }
.flagcard__flag .w {
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18%;
}
.flagcard__flag svg {
  width: 13%;
  aspect-ratio: 100 / 95;
  fill: var(--green);
}
.flagcard__meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 24px;
  margin: 26px 0 0;
}
.flagcard__meta dt { font-size: 13px; color: var(--muted); }
.flagcard__meta dd { margin: 0; font-family: var(--serif); font-size: 20px; font-weight: 700; color: var(--fg); }

.about { background: var(--cream); }
.about__cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
}
.about__cols p { margin: 0; color: var(--muted); }
.about__cols .lead {
  font-family: var(--serif);
  font-size: 23px;
  line-height: 1.8;
  color: var(--ink);
}

.facts {
  list-style: none;
  padding: 0;
  margin: 64px 0 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.facts strong {
  display: block;
  font-family: var(--serif);
  font-size: 38px;
  line-height: 1.2;
  color: var(--red);
}
.facts span { font-size: 14.5px; color: var(--muted); }

.files {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 56px 48px;
}
.file {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 28px;
  align-items: start;
}
.frame {
  margin: 0;
  border-radius: 3px;
  overflow: hidden;
  background: var(--cream);
}
.frame img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
}
.frame--emblem img {
  object-fit: contain;
  padding: 28% 14%;
  background: var(--cream);
}
.frame.is-empty {
  aspect-ratio: 4 / 5;
  display: grid;
  place-items: center;
  background: var(--cream);
  color: var(--muted);
  font-size: 12px;
  direction: ltr;
}
.file__dates {
  display: block;
  font-size: 14px;
  color: var(--gold);
}
.file h3 {
  font-family: var(--serif);
  font-size: 30px;
  line-height: 1.35;
  color: var(--fg);
  margin: 2px 0 10px;
}
.file p { margin: 0; color: var(--muted); font-size: 15.5px; }

.footer { background: var(--paper); }
.footer__inner {
  text-align: center;
  padding: 44px 0 30px;
}
.footer img { margin: 0 auto 10px; }
.footer p {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 700;
  color: var(--fg);
  margin: 0;
}
.footer small { color: var(--muted); font-size: 13px; }
@media (max-width: 900px) {
  .intro__grid,
  .about__cols { grid-template-columns: 1fr; gap: 36px; }
  .files { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  body { font-size: 16px; }
  section { padding: 64px 0; }
  .masthead__inner { padding-top: 70px; }
  .crest { width: 150px; }
  .theme-toggle { top: 16px; inset-inline-end: 16px; }
  .nav__toggle {
    display: block;
    width: 100%;
    padding: 12px;
    font: inherit;
    font-weight: 600;
    color: var(--ink);
    background: none;
    border: 0;
    cursor: pointer;
  }
  .nav ul { display: none; flex-direction: column; text-align: center; gap: 0; padding-bottom: 8px; }
  .nav.is-open ul { display: flex; }
  .facts { grid-template-columns: 1fr; }
  .file { grid-template-columns: 1fr; }
  .file .frame { max-width: 260px; }
}
