/* One screen: the photograph, the name and two links on top, the headline and the email,
   and the legal line and image credit along the darkened lower edge. */

@font-face {
  font-family: "Source Serif 4";
  src: url("fonts/source-serif-4.woff2") format("woff2");
  font-weight: 300 650;
  font-display: swap;
}
@font-face {
  font-family: "Noto Naskh Arabic";
  src: url("fonts/noto-naskh-arabic.woff2") format("woff2");
  font-weight: 400 500;
  font-display: swap;
  unicode-range: U+0600-06FF, U+200C-200F, U+FD3E-FD3F;
}
/* Georgia, scaled to Source Serif 4's width and line metrics, shows while the webfont loads,
   so the headline is readable at once and barely moves when the real face arrives. */
@font-face {
  font-family: "Serif Fallback";
  src: local("Georgia");
  size-adjust: 92%;
  ascent-override: 112%;
  descent-override: 36%;
  line-gap-override: 0%;
}

:root {
  --night: #0e0e0d;
  --light: #ecebe6;
  --gutter: clamp(20px, 4.2vw, 64px);
  --serif: "Source Serif 4", "Serif Fallback", Georgia, "Times New Roman", serif;
  --ease: cubic-bezier(0.2, 0.7, 0.1, 1);
  color-scheme: dark;
}
html[lang="ar"] { --serif: "Noto Naskh Arabic", "Source Serif 4", "Geeza Pro", Tahoma, serif; }

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  position: relative;
  overflow-x: hidden;
  background: var(--night);
  color: var(--light);
  font-family: var(--serif);
  font-weight: 380;
  font-size: 17px;
  line-height: 1.5;
  font-kerning: normal;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  text-decoration-color: rgba(236, 235, 230, 0.4);
  transition: text-decoration-color 0.2s ease;
}
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid currentColor; outline-offset: 4px; border-radius: 1px; }
::selection { background: var(--light); color: var(--night); }

/* ---------------------------------------------------------------- the photograph */

.plate {
  position: fixed;
  inset: -3%;
  z-index: 0;
  background: #161616;
  will-change: transform;
}
.plate picture { display: block; width: 100%; height: 100%; }
html[dir="rtl"] .plate picture { transform: scaleX(-1); }
.plate img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 42%;
  transform-origin: 62% 38%;
}

.shade {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(to top, rgba(8, 8, 7, 0.88) 0%, rgba(8, 8, 7, 0.6) 14%, rgba(0, 0, 0, 0.26) 40%, rgba(0, 0, 0, 0.04) 60%, rgba(0, 0, 0, 0) 70%),
    linear-gradient(to bottom, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0) 16%);
}

.top, main, footer { position: relative; z-index: 1; }

/* ---------------------------------------------------------------- header */

.top {
  padding: 0 var(--gutter);
  min-height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.mark {
  display: inline-grid;
  justify-items: start;
  color: inherit;
  text-decoration: none;
  padding: 8px 0;
  margin: -8px 0;
}
.mark svg {
  grid-area: 1 / 1;
  display: block;
  height: 15px;
  width: auto;
  fill: currentColor;
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
}
.mark svg.alt { opacity: 0; transform: translateY(6px); }
/* The Arabic mark is set larger so both scripts read at the same size. */
html[lang="ar"] .mark svg.main,
html[lang="en"] .mark svg.alt { height: 24px; }
/* Hovering or focusing the name shows it in the other script. */
.mark:hover svg.main, .mark:focus-visible svg.main { opacity: 0; transform: translateY(-6px); }
.mark:hover svg.alt, .mark:focus-visible svg.alt { opacity: 1; transform: none; }

nav { display: flex; gap: 30px; font-size: 16px; line-height: 1.4; }
html[lang="ar"] nav { font-size: 17px; }
nav a { text-decoration: none; padding: 10px 0; }
nav a:hover { text-decoration: underline; text-underline-offset: 0.3em; }
nav a[lang="ar"] { font-family: "Noto Naskh Arabic", serif; font-size: 17px; }
nav a[lang="en"] { font-family: "Source Serif 4", "Serif Fallback", Georgia, serif; font-size: 16px; }

/* ---------------------------------------------------------------- headline and email */

main {
  align-self: end;
  padding: 48px var(--gutter) clamp(40px, 8vh, 88px);
}

h1 {
  margin: 0;
  max-width: 16.5em;
  font-weight: 380;
  font-size: clamp(38px, 4vw + 12px, 76px);
  line-height: 1.04;
  letter-spacing: -0.012em;
  text-wrap: balance;
  text-shadow: 0 0 40px rgba(0, 0, 0, 0.25);
}
html[lang="ar"] h1 {
  max-width: 15em;
  font-weight: 500;
  font-size: clamp(33px, 3.2vw + 12px, 64px);
  line-height: 1.55;
  letter-spacing: 0;
}

.email {
  margin: clamp(22px, 3.4vh, 36px) 0 0;
  font-size: clamp(19px, 0.5vw + 15px, 23px);
  line-height: 1.3;
}
.email a { font-family: "Source Serif 4", "Serif Fallback", Georgia, serif; }

/* ---------------------------------------------------------------- legal line and credit */

footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 6px 32px;
  padding: 18px var(--gutter) max(26px, env(safe-area-inset-bottom));
  border-top: 1px solid rgba(236, 235, 230, 0.16);
  margin: 0 var(--gutter);
  padding-left: 0;
  padding-right: 0;
  font-size: 14px;
  line-height: 1.5;
  color: rgba(236, 235, 230, 0.8);
}
html[lang="ar"] footer { font-size: 15px; }
footer p { margin: 0; }
footer bdi { unicode-bidi: isolate; }

/* ---------------------------------------------------------------- motion */

@media (prefers-reduced-motion: no-preference) {
  /* The photograph drifts, slowly enough that it reads as still at a glance. */
  .plate img { animation: drift 90s ease-in-out infinite alternate; }
  /* The headline and the email settle in. Text is never hidden while the font loads:
     the fallback face shows at once and the fade starts on first paint. */
  h1 { animation: rise 1.5s var(--ease) both; }
  .email { animation: rise 1.5s var(--ease) 0.25s both; }
  .top { animation: fade 1.2s ease 0.1s both; }
  footer { animation: fade 1.2s ease 0.45s both; }
}
@keyframes drift { from { transform: scale(1.02); } to { transform: scale(1.07) translate3d(-1.4%, 1%, 0); } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------------------------------------------------------------- small and short screens */

@media (max-height: 700px) and (min-width: 761px) {
  .top { min-height: 72px; }
  main { padding-top: 24px; padding-bottom: 32px; }
  h1 { font-size: clamp(36px, 3.4vw + 8px, 60px); }
  html[lang="ar"] h1 { font-size: clamp(32px, 2.8vw + 8px, 52px); line-height: 1.5; }
}

@media (max-width: 760px) {
  .top { min-height: 64px; }
  nav { gap: 22px; }
  .plate img { object-position: 38% 50%; }
  main { padding-bottom: 32px; }
  footer { display: block; font-size: 13.5px; }
  html[lang="ar"] footer { font-size: 14.5px; }
  footer p + p { margin-top: 4px; }
}

@media print {
  .plate, .shade, nav { display: none; }
  html, body { background: #fff; color: #141414; }
  body { display: block; }
  main { padding: 48px 0; }
  footer { margin: 0; color: #141414; border-color: #141414; }
}
