/*
  Nayraq (نيرق) - site styles
  Plain CSS, no build step, no JavaScript. Mobile first.
  Fonts: Alexandria (headings) and Readex Pro (text), self-hosted from @fontsource,
  SIL Open Font License 1.1 - see ../fonts/OFL-Alexandria.txt and ../fonts/OFL-ReadexPro.txt
*/

/* ---------- Fonts ---------- */

@font-face {
  font-family: "Alexandria";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/alexandria-arabic-600-normal.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, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EEFF;
}

@font-face {
  font-family: "Alexandria";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/alexandria-latin-600-normal.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: "Alexandria";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/alexandria-arabic-700-normal.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, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EEFF;
}

@font-face {
  font-family: "Alexandria";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/alexandria-latin-700-normal.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;
}

/* The same Arabic files again, also covering the space, so Arabic pages
   never download the Latin heading files just for spaces */
@font-face {
  font-family: "Alexandria AR";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/alexandria-arabic-600-normal.woff2") format("woff2");
  unicode-range: U+0020, U+00A0, 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, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EEFF;
}

@font-face {
  font-family: "Alexandria AR";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/alexandria-arabic-700-normal.woff2") format("woff2");
  unicode-range: U+0020, U+00A0, 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, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EEFF;
}

@font-face {
  font-family: "Readex Pro";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/readex-pro-arabic-400-normal.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, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EEFF;
}

@font-face {
  font-family: "Readex Pro";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/readex-pro-latin-400-normal.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: "Readex Pro";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/readex-pro-arabic-500-normal.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, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EEFF;
}

@font-face {
  font-family: "Readex Pro";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/readex-pro-latin-500-normal.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;
}

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

:root {
  --navy: #1C2B63;
  --navy-ground: #111C45;
  --cream: #F3F1EA;
  --white: #FFFFFF;
  --gold: #C08A1E;
  --gold-on-navy: #E0A325;
  --yellow: #F7D24A;
  --blue: #3E63C7;

  --cream-muted: rgb(243 241 234 / 0.8);

  --font-display: "Alexandria", system-ui, "Segoe UI", Tahoma, sans-serif;
  --font-text: "Readex Pro", system-ui, "Segoe UI", Tahoma, sans-serif;

  --gutter: 20px;
  --page-max: 1240px;

  color-scheme: dark;
}

html[lang="ar"] {
  --font-display: "Alexandria AR", "Alexandria", system-ui, "Segoe UI", Tahoma, sans-serif;
}

@media (min-width: 768px) {
  :root {
    --gutter: 40px;
  }
}

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

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background-color: var(--navy-ground);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background-color: var(--navy-ground);
  color: var(--cream);
  font-family: var(--font-text);
  font-size: 1.0625rem;
  font-weight: 400;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html[lang="en"] body {
  line-height: 1.6;
}

main {
  flex: 1 0 auto;
}

h1,
h2,
p {
  margin: 0;
}

img,
video {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

::selection {
  background-color: var(--yellow);
  color: var(--navy-ground);
}

:focus-visible {
  outline: 3px solid var(--gold-on-navy);
  outline-offset: 3px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.nowrap {
  display: inline-block;
}

.wrap {
  width: 100%;
  max-width: calc(var(--page-max) + 2 * var(--gutter));
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

/* ---------- Header ---------- */

.site-header {
  position: relative;
  z-index: 2;
  background-color: var(--navy-ground);
}

.site-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 16px;
  padding-bottom: 16px;
}

.brand {
  display: block;
  flex: none;
}

.brand img,
.brand__logo svg {
  display: block;
  height: 44px;
  width: auto;
  overflow: visible;
}

.brand__logo {
  display: block;
}

.brand:focus-visible {
  outline-offset: 10px;
}

/* Menu: its own row on phones, between the logo and the language link on wide screens */
.site-nav {
  display: flex;
  flex-wrap: wrap;
  order: 3;
  width: 100%;
  gap: 0 28px;
  margin-top: -6px;
}

.site-nav a,
.lang-link {
  display: inline-block;
  padding: 10px 0;
  font-weight: 500;
  font-size: 0.9375rem;
  line-height: 24px;
}

.site-nav a {
  color: var(--cream-muted);
}

.lang-link {
  color: var(--cream);
}

.site-nav a:hover,
.lang-link:hover {
  color: var(--gold-on-navy);
}

/* Push the link to the far side of the page, even when the header wraps.
   Physical margins on purpose: the link carries the other language's dir. */
html[dir="rtl"] .lang-link {
  margin-right: auto;
}

html[dir="ltr"] .lang-link {
  margin-left: auto;
}

@media (min-width: 768px) {
  .site-header__inner {
    padding-top: 20px;
    padding-bottom: 20px;
  }

  .brand img,
  .brand__logo svg {
    height: 52px;
  }

  .brand:focus-visible {
    outline-offset: 12px;
  }

  .site-nav a,
  .lang-link {
    font-size: 1rem;
  }
}

@media (min-width: 900px) {
  .site-header {
    position: sticky;
    top: 0;
  }

  .site-nav {
    order: 0;
    width: auto;
    gap: 0 40px;
    margin-top: 0;
  }

  html[dir="rtl"] .site-nav {
    margin-right: 56px;
  }

  html[dir="ltr"] .site-nav {
    margin-left: 56px;
  }

  main [id] {
    scroll-margin-top: 104px;
  }
}

/* ---------- Type ---------- */

.display {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.5rem, 1.55rem + 4.4vw, 5.25rem);
  line-height: 1.25;
  text-wrap: balance;
  overflow-wrap: break-word;
}

.title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2rem, 1.45rem + 2.5vw, 3.5rem);
  line-height: 1.35;
  text-wrap: balance;
  overflow-wrap: break-word;
}

html[lang="en"] .display {
  line-height: 1.06;
  letter-spacing: -0.02em;
}

html[lang="en"] .title {
  line-height: 1.12;
  letter-spacing: -0.015em;
}

.lead {
  font-size: clamp(1.125rem, 1rem + 0.55vw, 1.5rem);
  line-height: 1.85;
  color: var(--cream-muted);
  text-wrap: pretty;
}

html[lang="en"] .lead {
  line-height: 1.55;
}

/* ---------- Hero ---------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.hero__media {
  position: relative;
  order: -1;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background-color: var(--navy-ground);
}

.hero__media img,
.hero__media video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero__text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 40px var(--gutter) 72px;
}

.hero__text .lead {
  max-width: 30rem;
  margin-top: 20px;
}

@media (min-width: 900px) {
  .hero {
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    min-height: min(calc(100svh - 92px), 880px);
  }

  .hero__media {
    order: 0;
    aspect-ratio: auto;
    min-height: 600px;
  }

  .hero__text {
    padding-top: 56px;
    padding-bottom: 72px;
    padding-inline-start: max(var(--gutter), calc((100vw - var(--page-max)) / 2));
    padding-inline-end: 56px;
  }
}

/* ---------- Two-column sections ---------- */

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 40px;
  align-items: center;
}

.split .lead {
  max-width: 34rem;
  margin-top: 24px;
}

.photo {
  overflow: hidden;
  background-color: var(--navy);
}

.photo img {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
}

@media (min-width: 900px) {
  .split {
    grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
    gap: 96px;
  }

  .split--flip {
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  }

  .split--flip .photo {
    order: -1;
  }
}

.about {
  padding-top: clamp(4.5rem, 3rem + 6vw, 9rem);
  padding-bottom: clamp(4.5rem, 3rem + 6vw, 9rem);
}

/* ---------- Moving picture band ---------- */

.band {
  position: relative;
  height: clamp(260px, 46vw, 660px);
  overflow: hidden;
  background-color: var(--navy);
}

.band img,
.band video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---------- Coming soon (light) ---------- */

.soon {
  padding-top: clamp(4.5rem, 3rem + 6vw, 9rem);
  padding-bottom: clamp(4.5rem, 3rem + 6vw, 9rem);
  background-color: var(--cream);
  color: var(--navy);
}

.soon .lead {
  color: var(--navy);
}

.soon :focus-visible {
  outline-color: var(--navy);
}

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

.contact {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: clamp(560px, 62vw, 820px);
  overflow: hidden;
  background-color: var(--navy-ground);
}

.contact__bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 62%;
}

.contact::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background-image: linear-gradient(to top, rgb(17 28 69 / 0.95) 0%, rgb(17 28 69 / 0.78) 30%, rgb(17 28 69 / 0.2) 58%, rgb(17 28 69 / 0) 75%);
}

.contact__inner {
  position: relative;
  z-index: 1;
  padding-top: 160px;
  padding-bottom: clamp(3.5rem, 2.5rem + 4vw, 6rem);
}

.contact__inner .lead {
  margin-top: 24px;
}

.email {
  margin-top: 8px;
}

.email a {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.5rem, 0.85rem + 3vw, 3.25rem);
  line-height: 1.3;
  color: var(--cream);
  overflow-wrap: anywhere;
}

.email a:hover {
  color: var(--gold-on-navy);
}

/* ---------- 404 ---------- */

.not-found {
  padding-top: clamp(4.5rem, 3rem + 6vw, 9rem);
  padding-bottom: clamp(4.5rem, 3rem + 6vw, 9rem);
}

.not-found .lead {
  max-width: 34rem;
  margin-top: 24px;
}

.not-found .email {
  margin-top: 32px;
}

.not-found .email a {
  font-size: clamp(1.25rem, 1rem + 1.2vw, 2rem);
}

/* ---------- Footer ---------- */

.site-footer {
  padding-top: 32px;
  padding-bottom: 32px;
  background-color: var(--navy-ground);
  color: var(--cream-muted);
  font-size: 0.875rem;
  line-height: 1.9;
}

/* ---------- Motion ---------- */
/* Videos, the turning logo and the picture reveals only run when the visitor has
   not asked for reduced motion. One pause button (a checkbox, so no JavaScript)
   stops all of it, as WCAG 2.2.2 requires for motion that runs on its own. */

.motion-button {
  display: none;
}

/* The header logo's circle is the first group in its SVG, drawn with
   transform="translate(417.812 -7.455) scale(3.86364)" (Arabic file) or
   transform="translate(-7.455 -7.455) scale(3.86364)" (English file).
   Its centre is (603.269, 189.595) or (178.002, 189.595) in the SVG. Every frame
   keeps that transform and adds a turn around the centre, so it turns in place. */
@keyframes nayraq-wheel-ar {
  from {
    transform: translate(603.269px, 189.595px) rotate(0deg) translate(-603.269px, -189.595px) translate(417.812px, -7.455px) scale(3.86364);
  }

  to {
    transform: translate(603.269px, 189.595px) rotate(360deg) translate(-603.269px, -189.595px) translate(417.812px, -7.455px) scale(3.86364);
  }
}

@keyframes nayraq-wheel-en {
  from {
    transform: translate(178.002px, 189.595px) rotate(0deg) translate(-178.002px, -189.595px) translate(-7.455px, -7.455px) scale(3.86364);
  }

  to {
    transform: translate(178.002px, 189.595px) rotate(360deg) translate(-178.002px, -189.595px) translate(-7.455px, -7.455px) scale(3.86364);
  }
}

@keyframes nayraq-reveal {
  from {
    clip-path: inset(16% 0 0 0);
  }

  to {
    clip-path: inset(0 0 0 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero__media video,
  .band video {
    display: none;
  }

  .motion-toggle {
    display: none;
  }
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }

  html[lang="ar"] .brand__logo svg > g:first-of-type {
    animation: nayraq-wheel-ar 20s linear infinite;
  }

  html[lang="en"] .brand__logo svg > g:first-of-type {
    animation: nayraq-wheel-en 20s linear infinite;
  }

  body:has(.motion-toggle:checked) .brand__logo svg > g:first-of-type {
    animation-play-state: paused;
  }

  .motion-toggle:checked ~ .hero video,
  .motion-toggle:checked ~ .band video {
    display: none;
  }

  .motion-button {
    display: block;
    position: absolute;
    z-index: 1;
    bottom: 16px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: rgb(17 28 69 / 0.6);
    cursor: pointer;
  }

  html[dir="rtl"] .motion-button {
    left: 16px;
  }

  html[dir="ltr"] .motion-button {
    right: 16px;
  }

  .motion-button:hover {
    background-color: rgb(17 28 69 / 0.85);
  }

  .motion-toggle:focus-visible ~ .hero .motion-button {
    outline: 3px solid var(--gold-on-navy);
    outline-offset: 3px;
  }

  /* Pause icon: two bars */
  .motion-button::before,
  .motion-button::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 4px;
    height: 14px;
    margin-top: -7px;
    border-radius: 1px;
    background-color: var(--cream);
  }

  .motion-button::before {
    left: calc(50% - 6px);
  }

  .motion-button::after {
    left: calc(50% + 2px);
  }

  /* Play icon when paused */
  .motion-toggle:checked ~ .hero .motion-button::before {
    left: calc(50% - 4px);
    width: 0;
    height: 0;
    margin-top: -8px;
    border-style: solid;
    border-width: 8px 0 8px 13px;
    border-color: transparent transparent transparent var(--cream);
    border-radius: 0;
    background: none;
  }

  .motion-toggle:checked ~ .hero .motion-button::after {
    display: none;
  }

  @supports (animation-timeline: view()) {
    .reveal {
      animation: nayraq-reveal linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 70%;
    }
  }
}

/* ---------- Windows High Contrast (forced colours) ---------- */

@media (forced-colors: active) {
  .brand img,
  .brand__logo {
    forced-color-adjust: none;
    box-sizing: content-box;
    padding: 14px;
    background-color: var(--navy-ground);
  }

  .motion-button {
    forced-color-adjust: none;
    border: 2px solid CanvasText;
  }

  .motion-button::before,
  .motion-button::after {
    background-color: CanvasText;
  }

  .motion-toggle:checked ~ .hero .motion-button::before {
    border-left-color: CanvasText;
  }
}
