:root {
  --bg-canvas: #202028;
  --bg-sunken: #15151d;
  --brand-accent: #68afb3;
  --brand-wash: #1f2f30;
  --text-primary: #eaeaf1;
  --text-body: #ceced6;
  --text-muted: #a9a9b1;
  --text-inverse: #202028;
  --border-hairline: #4d4d56;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: dark;
  font-family:
    "Cairo",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "Noto Sans Arabic",
    Tahoma,
    sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

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

html {
  min-block-size: 100%;
  background: var(--bg-canvas);
  overflow-x: hidden;
}

body {
  min-block-size: 100%;
  margin: 0;
  color: var(--text-primary);
  background: var(--bg-canvas);
  overflow-x: hidden;
}

::selection {
  color: var(--text-inverse);
  background: var(--brand-accent);
}

body::before,
body::after {
  position: fixed;
  inset: 0;
  pointer-events: none;
  content: "";
}

body::before {
  z-index: 0;
  background:
    radial-gradient(
      ellipse 66% 62% at 50% 43%,
      var(--brand-wash) 0%,
      rgb(31 47 48 / 0%) 65%
    ),
    radial-gradient(
      ellipse 110% 95% at 50% 42%,
      rgb(32 32 40 / 0%) 55%,
      rgb(21 21 29 / 65%) 100%
    );
}

body::after {
  z-index: 3;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='.8'/%3E%3C/svg%3E");
  background-size: 11.25rem 11.25rem;
  mix-blend-mode: soft-light;
}

img,
svg {
  display: block;
}

a {
  color: inherit;
}

.page-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  min-block-size: 100vh;
  min-block-size: 100svh;
}

.hero {
  display: grid;
  place-items: center;
  min-block-size: 0;
  padding:
    clamp(3.25rem, 8vh, 6.5rem)
    max(1.25rem, env(safe-area-inset-right))
    clamp(2.5rem, 5vh, 4.25rem)
    max(1.25rem, env(safe-area-inset-left));
}

.hero__content {
  display: grid;
  justify-items: center;
  inline-size: min(100%, 50rem);
  text-align: center;
}

.calligraphy-stage {
  position: relative;
  display: grid;
  place-items: center;
  inline-size: clamp(18.5rem, 48vw, 39rem);
  aspect-ratio: 540 / 520;
  margin: 0;
  isolation: isolate;
}

.calligraphy-stage::before {
  position: absolute;
  z-index: -2;
  inset: 8% 1% 5%;
  border: 1px solid rgb(104 175 179 / 15%);
  border-radius: 50%;
  content: "";
  transform: rotate(-7deg) scaleX(1.08);
}

.calligraphy-stage::after {
  position: absolute;
  z-index: -1;
  inset-inline-end: -2.5%;
  inset-block-start: 29%;
  inline-size: 0.42rem;
  block-size: 0.42rem;
  border: 1px solid rgb(104 175 179 / 60%);
  border-radius: 50%;
  background: var(--bg-canvas);
  box-shadow: 0 0 0 0.35rem var(--bg-canvas);
  content: "";
}

.calligraphy-mark,
.calligraphy-aura {
  position: absolute;
  inset: 0;
  inline-size: 100%;
  block-size: 100%;
}

.calligraphy-mark {
  z-index: 1;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

.calligraphy-aura {
  z-index: 0;
  background: var(--brand-accent);
  filter: blur(2rem);
  opacity: 0.12;
  transform: scale(0.985);
  -webkit-mask: url("assets/sultan_calligraphy.svg") center / contain no-repeat;
  mask: url("assets/sultan_calligraphy.svg") center / contain no-repeat;
}

.hero__message {
  margin: clamp(1.4rem, 3vh, 2rem) 0 0;
  color: var(--text-body);
  font-family: "Almarai", "Cairo", sans-serif;
  font-size: clamp(1rem, 1.25vw, 1.125rem);
  font-weight: 400;
  line-height: 1.8;
}

.hero__message-accent {
  color: var(--text-primary);
  white-space: nowrap;
}

.site-footer {
  inline-size: 100%;
  min-inline-size: 0;
  padding:
    0
    max(1.25rem, env(safe-area-inset-right))
    max(1.15rem, env(safe-area-inset-bottom))
    max(1.25rem, env(safe-area-inset-left));
}

.social-links {
  position: relative;
  display: flex;
  justify-content: center;
  inline-size: 100%;
  max-inline-size: 52rem;
  min-inline-size: 0;
  margin-inline: auto;
  border-block-start: 1px solid var(--border-hairline);
}

.social-link {
  position: relative;
  display: grid;
  grid-template-columns: 1.35rem auto 0.8rem;
  align-items: center;
  min-inline-size: 0;
  min-block-size: 5.25rem;
  padding: 1rem clamp(1.2rem, 4vw, 3.5rem);
  text-decoration: none;
  transition:
    color 200ms ease,
    transform 220ms var(--ease-out);
}

.social-link + .social-link {
  border-inline-start: 1px solid var(--border-hairline);
}

.social-link::after {
  position: absolute;
  inset-inline: 1rem;
  inset-block-end: -1px;
  block-size: 1px;
  background: var(--brand-accent);
  content: "";
  transform: scaleX(0);
  transform-origin: right center;
  transition: transform 240ms var(--ease-out);
}

.social-link__icon {
  inline-size: 1.25rem;
  block-size: 1.25rem;
  fill: none;
  stroke: var(--brand-accent);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.35;
  opacity: 0.9;
  transition:
    opacity 200ms ease,
    transform 220ms var(--ease-out);
}

.social-link__icon--substack {
  stroke-width: 1.5;
}

.social-link__text {
  display: grid;
  gap: 0.1rem;
  margin-inline: 0.75rem 1rem;
  text-align: start;
}

.social-link__label {
  color: var(--text-primary);
  font-family: "Almarai", "Cairo", sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.4;
}

.social-link__service {
  color: var(--text-muted);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  line-height: 1.4;
  transition: color 200ms ease;
}

.social-link__arrow {
  inline-size: 0.75rem;
  block-size: 0.75rem;
  fill: none;
  stroke: var(--text-muted);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.25;
  transition:
    stroke 200ms ease,
    transform 220ms var(--ease-out);
}

.social-link:focus-visible {
  border-radius: 0.15rem;
  outline: 2px solid var(--brand-accent);
  outline-offset: -0.15rem;
}

@media (hover: hover) {
  .social-link:hover {
    transform: translateY(-0.125rem);
  }

  .social-link:hover::after {
    transform: scaleX(1);
  }

  .social-link:hover .social-link__icon {
    opacity: 1;
    transform: translateY(-0.125rem);
  }

  .social-link:hover .social-link__service {
    color: var(--brand-accent);
  }

  .social-link:hover .social-link__arrow {
    stroke: var(--brand-accent);
    transform: translate(0.125rem, -0.125rem);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .calligraphy-stage::before {
    animation: orbit-arrive 1.25s 100ms var(--ease-out) both;
  }

  .calligraphy-stage::after {
    animation: marker-arrive 650ms 520ms var(--ease-out) both;
  }

  .calligraphy-aura {
    animation: aura-arrive 1.2s 80ms var(--ease-out) both;
  }

  .calligraphy-mark {
    animation: mark-arrive 1.05s 180ms var(--ease-out) both;
  }

  .hero__message {
    animation: content-arrive 800ms 620ms var(--ease-out) both;
  }

  .site-footer {
    animation: content-arrive 800ms 820ms var(--ease-out) both;
  }
}

@keyframes orbit-arrive {
  from {
    opacity: 0;
    transform: rotate(-14deg) scale(0.9, 0.95);
  }
  to {
    opacity: 1;
    transform: rotate(-7deg) scaleX(1.08);
  }
}

@keyframes marker-arrive {
  from {
    opacity: 0;
    transform: scale(0);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes aura-arrive {
  from {
    filter: blur(3rem);
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    filter: blur(2rem);
    opacity: 0.12;
    transform: scale(0.985);
  }
}

@keyframes mark-arrive {
  from {
    filter: blur(0.4rem);
    opacity: 0;
    transform: translateY(0.875rem) scale(0.985);
  }
  to {
    filter: blur(0);
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes content-arrive {
  from {
    opacity: 0;
    transform: translateY(0.6rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 37.5rem) {
  .hero {
    padding-block-start: clamp(2.25rem, 7vh, 4rem);
  }

  .calligraphy-stage {
    inline-size: min(88vw, 23rem);
  }

  .hero__message {
    max-inline-size: 19rem;
    margin-block-start: 1rem;
  }

  .social-link {
    grid-template-columns: 1.25rem auto 0.7rem;
    min-block-size: 4.85rem;
    padding-inline: clamp(0.7rem, 3.5vw, 1.25rem);
  }

  .social-link__text {
    margin-inline: 0.55rem 0.65rem;
  }
}

@media (max-height: 48rem) and (min-width: 37.51rem) {
  .hero {
    padding-block: 2rem 1.5rem;
  }

  .calligraphy-stage {
    inline-size: min(58vh, 30rem);
  }

  .site-footer {
    position: relative;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
