@layer cinematic;

@layer cinematic {
  :root {
    --background: #090b10;
    --surface: #11151d;
    --surface-raised: #171d27;
    --text: #f1f3f6;
    --muted: #b5becc;
    --quiet: #a8b3c3;
    --line: #2a333e;
    --accent: #b2d5e6;
    --blue: #a9e0ff;
    --ink: #101820;
    --radius: 12px;
  }

  body { font-family: 'Aptos', 'Segoe UI', Arial, sans-serif; }
  :lang(ar) body { font-family: 'Segoe UI', Tahoma, Arial, sans-serif; }
  h2 { font-size: clamp(2.25rem,4.45vw,4.5rem); font-weight: 650; letter-spacing: -.045em; }
  h3 { font-weight: 650; }
  .shell { width: min(100% - clamp(2rem,9vw,9rem),1260px); }
  .section { padding-block: clamp(4.4rem, 8.5vw, 8.3rem); }
  .eyebrow { color: #a7ccdd; }
  .lede { color: #b9c3d0; }

  .site-header { isolation: isolate; }
  .site-header::before {
    content: ''; position: absolute; z-index: -1; inset: 0;
    background: linear-gradient(#070a10bd, #070a1000);
    pointer-events: none;
  }
  .header-inner { min-block-size: 76px; border-color: #d5eaff33; }
  .brand-mark i { border-color: #b5dbe9; }
  .brand-mark::after { background: #bdedff; box-shadow: none; }
  .site-nav a { color: #e0e5ed; font-weight: 600; }
  .language { padding-block: .65rem; }
  .header-cta { color: #e8f5ff; border-color: #a2bccc8d; background: #10182170; }
  .header-cta:hover, .nav-toggle:hover { background: #23333e; }
  .nav-toggle { color: #ecf7ff; border-color: #698293; background: #111b25; }

  .hero {
    min-block-size: clamp(740px,100svh,930px);
    background: #0b101a;
  }
  .hero-reel, .hero-shade { position: absolute; z-index: -1; inset: 0; pointer-events: none; }
  .hero-reel { container-type: size; overflow: clip; }
  .scene-camera {
    position: absolute; inset: 0;
    transform: translate3d(0,0,0) scale(1.04);
    translate: var(--pan-x,0px) var(--pan-y,0px);
    transform-origin: 53% 49%;
  }
  .scene-film {
    position: absolute; top: 50%; left: 50%;
    width: max(100%,177.68cqh); height: max(100%,56.28cqw);
    transform: translate(-50%,-50%);
  }
  [dir=rtl] .scene-film { transform: translate(-50%,-50%) scaleX(-1); }
  .scene-film picture, .scene-weather { position: absolute; inset: 0; }
  .scene-film picture { overflow: hidden; contain: paint; }
  .scene-film picture img { position: absolute; inset-inline-start: 0; inset-block-start: 0; width: 100%; height: 200%; max-width: none; object-fit: fill; }
  .scene-film .scene-subject img { inset-block-start: -100%; }
  .scene-background { background: #101724; }
  .hero-reel[data-loading] .scene-film { visibility: hidden; }
  .scene-subject { translate: var(--near-x,0px) var(--near-y,0px); }
  .scene-weather { overflow: clip; }
  .scene-fog {
    position: absolute; inset: 35% -15% 22%; opacity: .38;
    background: radial-gradient(ellipse at 67% 58%,#b1caec50 0%,#89a3c23b 16%,transparent 61%);
  }
  .fog-high {
    inset: 23% -18% 30%; opacity: .24;
    background: radial-gradient(ellipse at 38% 79%,#cad5f24f 0%,#879cc833 22%,transparent 61%);
  }
  .scene-lights { position: absolute; inset: 0; }
  .scene-lights i {
    position: absolute; inline-size: 2px; block-size: 3px; border-radius: 1px;
    background: #fff0cd; box-shadow: 0 0 5px 1px #f4d8b2;
    opacity: .08; left: var(--x); top: var(--y);
  }
  .scene-lights i:nth-child(1) { --x: 86.35%; --y: 29.63%; --delay: -4.7s; }
  .scene-lights i:nth-child(2) { --x: 81.06%; --y: 39.37%; --delay: -7.2s; }
  .scene-lights i:nth-child(3) { --x: 52.4%; --y: 44.9%; --delay: -2.8s; }
  .scene-lights i:nth-child(4) { --x: 73.45%; --y: 38.86%; --delay: -6s; }
  .scene-road { position: absolute; left: 81.8%; top: 56.8%; width: 10%; height: 4.2%; }
  .scene-road i {
    position: absolute; left: 0; top: 0; display: block; inline-size: 3px; block-size: 1.5px;
    border-radius: 10px; background: #ffecd1; box-shadow: 0 0 4px 1px #ffcf9b;
    opacity: 0;
    offset-path: path('M 0 8 C 20 -2 50 12 137 24');
    offset-path: shape(from 0% 25%, curve to 100% 80% with 21% -8% / 38% 63%);
    offset-rotate: auto;
  }
  .scene-road i + i { background: #e6f4ff; box-shadow: 0 0 3px 1px #a3d3ff; }
  .hero-shade {
    background:
      linear-gradient(to right,#070b13eb 0%,#080c16bf 23%,#080c1648 48%,transparent 72%),
      linear-gradient(to bottom,#080c1664,transparent 24%,transparent 68%,#090b10 100%);
  }
  [dir=rtl] .hero-shade { transform: scaleX(-1); }
  .hero-inner {
    padding-block: clamp(7rem,14vh,10.2rem) 1.35rem;
    position: relative;
  }
  .hero-content {
    align-self: center; max-inline-size: min(47rem,56vw);
    padding-block-end: clamp(1.5rem,7vh,4rem);
  }
  .hero-tag {
    color: #bbdfed; font-size: .7rem; letter-spacing: .18em;
    margin-block-end: clamp(.8rem,2.2vw,1.35rem);
  }
  .hero-tag span { background: #b6d8e7; box-shadow: none; width: 20px; }
  .hero h1 {
    font-size: clamp(2.9rem,4.8vw,5.1rem); letter-spacing: -.054em; line-height: 1;
    font-weight: 635; color: #f7f8fa; text-wrap: initial;
  }
  :lang(ar) .hero h1 { font-size: clamp(2.75rem,4.8vw,5rem); letter-spacing: -.025em; line-height: 1.18; }
  .hero h1 .hero-first { color: #c8e2ed; }
  .hero h1 span + span { margin-block-start: .1em; }
  .hero-copy {
    max-inline-size: 33rem; color: #dee4ec; margin-block: 1.15rem 1.6rem;
    font-size: clamp(.99rem,1.45vw,1.1rem);
  }
  @media (min-width: 801px) {
    :lang(ar) .hero-copy { color: #fff; text-shadow: 0 1px 4px #060b14; }
  }
  .hero-foot { align-items: center; border-block-start-color: #d4eaff38; color: #e2e8f2; }
  .down { border-color: #90a7ba; }
  .motion-control {
    display: inline-flex; align-items: center; gap: .52rem; min-block-size: 44px;
    color: #e2e8f2; background: transparent; border: 0; padding-inline: .35rem;
    font-size: .8rem; font-weight: 600;
  }
  .motion-control:hover { color: var(--blue); }
  .motion-icon { inline-size: 12px; block-size: 12px; display: block; border-inline: 2px solid currentColor; }
  .motion-control[data-paused=true] .motion-icon { border: 0; background: currentColor; clip-path: polygon(23% 0,100% 50%,23% 100%); }
  [dir=rtl] .motion-control[data-paused=true] .motion-icon { transform: scaleX(-1); }

  .button { border-radius: 5px; font-weight: 650; }
  .button.primary { background: #c9e1ed; border-color: #c9e1ed; color: #131e25; box-shadow: 0 2px 16px #8ad6ec20; }
  .button.primary:hover { background: #effaff; border-color: #effaff; }
  .button.secondary { background: #121a23d9; border-color: #728a9b; color: #e8f4fa; }
  .button.secondary:hover { background: #243747; border-color: #a3cddf; }

  .world {
    background: radial-gradient(ellipse at 66% 0%,#141e2a 0%,transparent 66%),#090b10;
  }
  .world-card {
    min-block-size: 153px;
    border-block-start-color: #617a8a; border-radius: 0 0 8px 8px;
    background: linear-gradient(145deg,#141d27,#0c1118);
  }
  .world-card:hover { background: #1a2934; border-color: #91b5c8; }
  .world-card h3 { margin-block-start: .5rem; }
  .divided { border-block-start-color: #809bad35; }
  .cinematic-work { background: linear-gradient(167deg,#121b26,#090b10 62%); }
  .project-tabs { border-block-end: 1px solid #779bad44; gap: .45rem; margin-block-end: 1.15rem; }
  .project-tabs a { background: transparent; border: 0; border-block-end: 2px solid transparent; border-radius: 0; color: #c5d1da; }
  .project-tabs a:hover { color: #e7f8ff; border-block-end-color: #7398ac; }
  .project-tabs a[aria-selected=true] { background: #23313c; border-block-end-color: #b1dfef; color: #f1f8fa; }
  .project-panel {
    --panel-accent: #acd1ea;
    grid-template-columns: minmax(0,1.25fr) minmax(0,1fr);
    min-block-size: 390px; background: #111823; border-color: #526677; border-radius: 12px;
    box-shadow: 0 18px 55px #0004;
  }
  #project-1 { --panel-accent: #dfc2f5; background: #191522; border-color: #665878; grid-template-columns: minmax(0,1fr) minmax(0,1.16fr); }
  #project-2 { --panel-accent: #a0ddd9; background: #101b20; border-color: #4c6c71; }
  #project-3 { --panel-accent: #ebc9a6; background: #211a1a; border-color: #76624f; }
  #project-4 { --panel-accent: #d1cff1; background: #191b27; border-color: #626783; }
  .project-art { min-block-size: 268px; position: relative; background: #141e2a; }
  .project-art img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
  .project-art::after {
    content: ''; position: absolute; z-index: 1; inset: 0; pointer-events: none;
    background: linear-gradient(to bottom,transparent 63%,#0a1018b0),linear-gradient(115deg,#10182e30,transparent 67%);
  }
  .project-art.genesis img { object-position: center 62%; }
  .project-art.memory img { object-position: center 43%; }
  .project-art.cyber img { object-position: center 45%; }
  .project-art.diwaniya img { object-position: center 65%; }
  .project-art.education img { object-position: center 24%; }
  .project-art.cyber::after {
    background: linear-gradient(150deg,#05141828,transparent 40%,#0a202dba);
    box-shadow: inset 0 -1px #8ec8ca81;
  }
  .project-art.diwaniya::after { background: linear-gradient(110deg,#32211219,transparent 55%,#3021129d); }
  @media (min-width: 801px) {
    #project-1 .project-art { grid-column: 2; grid-row: 1; }
    #project-1 .project-copy { grid-column: 1; grid-row: 1; }
    #project-2 { grid-template-columns: minmax(0,.88fr) minmax(0,1.12fr); }
    #project-4 .project-art { grid-column: 1 / -1; grid-row: 1; }
    #project-4 .project-copy { z-index: 2; grid-column: 2; grid-row: 1; }
    #project-4 .project-art::after { background: linear-gradient(to left,#0c1420 0%,#0c1420ef 29%,#0c142040 71%,#060f2433 100%); }
    [dir=rtl] #project-4 .project-art::after { transform: scaleX(-1); }
  }
  .project-copy h3 { font-size: clamp(1.9rem,3.6vw,3.5rem); letter-spacing: -.044em; }
  :lang(ar) .project-copy h3 { letter-spacing: normal; }
  .project-status { color: var(--panel-accent); }
  .project-status span { background: var(--panel-accent); box-shadow: 0 0 8px var(--panel-accent); }
  .project-copy dl { border-block-start-color: color-mix(in srgb,var(--panel-accent) 30%,transparent); }

  .cinematic-services { background: radial-gradient(ellipse at 15% 100%,#151a26,transparent 54%),#0a0d12; }
  .service-list summary:hover { color: #c0e7f7; }
  .service-output { color: #c2dcef; }
  .card { background: linear-gradient(145deg,#151c27,#10151e 64%); border-color: #364655; }
  .lab-section { background: radial-gradient(ellipse at 36% 50%,#172737,transparent 70%),#090d14; }
  .lab-result { background: #141d29; border-color: #4b6071; }
  .cinematic-assistant { background: linear-gradient(165deg,#141d2a,#090c12 66%); }
  .brief-section { background: linear-gradient(156deg,#161825,#0b0e16 75%); }
  .vision-section {
    background: radial-gradient(ellipse at 63% 34%,#283044 0%,#161d2c 45%,#0d111a 88%);
  }
  .vision-section::before {
    background: linear-gradient(to right,#0c111923,#0c1119a8),url('cinema/vision-plate.webp') center 24% / cover;
    opacity: .25; mask-image: linear-gradient(92deg,transparent 12%,#000 91%);
  }
  .vision-inner h2 span:first-child { color: #c3dfe9; }
  .principles div { background: #131b27; border-block-start-color: #6d899c; }
  .cinematic-contact { background: radial-gradient(ellipse at 22% 33%,#171f2d,transparent 74%),#0a0d13; }
  .site-footer { background: #080b10; }

  @keyframes crane {
    from { transform: translate3d(-.45%,.35%,0) scale(1.045); }
    to { transform: translate3d(.62%,-.58%,0) scale(1.085); }
  }
  @keyframes haze {
    from { transform: translate3d(-7%,1%,0) scaleX(.92); opacity: .23; }
    to { transform: translate3d(8%,-4%,0) scaleX(1.12); opacity: .56; }
  }
  @keyframes windows {
    0%, 29%, 89%, 100% { opacity: .08; }
    39%, 75% { opacity: .59; }
  }
  @keyframes traffic {
    0% { offset-distance: 0%; opacity: 0; }
    14%, 75% { opacity: .8; }
    100% { offset-distance: 100%; opacity: 0; }
  }
  @keyframes title-reveal {
    from { opacity: 0; transform: translate3d(0,12px,0); }
    to { opacity: 1; transform: translate3d(0,0,0); }
  }
  @keyframes section-reveal {
    from { opacity: .46; transform: translate3d(0,13px,0); }
    to { opacity: 1; transform: translate3d(0,0,0); }
  }
  @media (prefers-reduced-motion: no-preference) {
    html:is([data-cinematic-motion=on],[data-cinematic-motion=paused]) .scene-camera { animation: crane 31s ease-in-out infinite alternate; }
    html:is([data-cinematic-motion=on],[data-cinematic-motion=paused]) .scene-fog { animation: haze 23s ease-in-out infinite alternate; }
    html:is([data-cinematic-motion=on],[data-cinematic-motion=paused]) .fog-high { animation-delay: -13s; animation-duration: 31s; }
    html:is([data-cinematic-motion=on],[data-cinematic-motion=paused]) .scene-lights i { animation: windows 9.8s ease-in-out var(--delay) infinite; }
    html:is([data-cinematic-motion=on],[data-cinematic-motion=paused]) .scene-road i { animation: traffic 10.9s linear -3.1s infinite; }
    html:is([data-cinematic-motion=on],[data-cinematic-motion=paused]) .scene-road i + i { animation-delay: -8.2s; animation-duration: 14s; }
    html[data-cinematic-motion=on] .hero:not([data-in-view=true]) :is(.scene-camera,.scene-fog,.scene-lights i,.scene-road i),
    html[data-cinematic-motion=paused] .hero :is(.scene-camera,.scene-fog,.scene-lights i,.scene-road i) { animation-play-state: paused; }
    html:is([data-cinematic-motion=on],[data-cinematic-motion=paused]) .hero-content > * { animation: title-reveal .68s cubic-bezier(.2,.67,.3,1) both; }
    html:is([data-cinematic-motion=on],[data-cinematic-motion=paused]) .hero-content > h1 { animation-delay: .12s; }
    html:is([data-cinematic-motion=on],[data-cinematic-motion=paused]) .hero-content > .hero-copy { animation-delay: .24s; }
    html:is([data-cinematic-motion=on],[data-cinematic-motion=paused]) .hero-content > .actions { animation-delay: .34s; }
    html[data-cinematic-motion=on] [data-entered] .section-intro,
    html[data-cinematic-motion=on] [data-entered] .vision-inner { animation: section-reveal .56s ease-out both; }
  }

  @media (max-width: 800px) {
    .header-inner { min-block-size: 65px; }
    .js .site-nav { background: #101b26; border-color: #557084; }
    .site-nav a:hover { background: #263747; }
    .hero { min-block-size: max(740px,100svh); }
    .hero-inner { padding-block: 16.25rem 1.08rem; }
    .hero-content { max-inline-size: 34rem; align-self: end; padding-block-end: 1.65rem; }
    .hero h1, :lang(ar) .hero h1 { font-size: clamp(2.55rem,7.6vw,4.4rem); }
    .hero h1 span:nth-child(2) { display: block; }
    .hero-shade { background: linear-gradient(to bottom,#060a1250,transparent 22%,#080e1852 39%,#080d17e8 68%,#090b10 100%); }
    .project-panel, #project-1 { grid-template-columns: 1fr; min-block-size: 0; }
    .project-art { min-block-size: clamp(210px,54vw,310px); }
  }
  @media screen and (max-width: 800px) {
    :is(.cinematic-services,.lab-section,.cinematic-assistant,.brief-section,.vision-section,.cinematic-contact) {
      content-visibility: auto;
      contain-intrinsic-block-size: auto var(--section-reserve, 530px);
    }
    .lab-section { --section-reserve: 700px; }
    .cinematic-contact { --section-reserve: 640px; }
  }
  @media (max-width: 680px) {
    html[data-cinematic-motion=on] .hero[data-in-view=true] .scene-fog { will-change: transform, opacity; }
    .scene-film { width: max(100%,96.74cqh); height: max(100%,103.38cqw); top: calc(50% - 84px); }
    .scene-road, .scene-lights { display: none; }
    .hero-copy { margin-block: .85rem 1.25rem; }
    .hero h1 { line-height: 1.03; }
    .hero-shade { background: linear-gradient(to bottom,#060a1268,transparent 22%,#080e1840 37%,#080e18b9 51%,#080d17f2 70%,#090b10 100%); }
  }
  @media (max-width: 380px) {
    .hero-content { padding-block-end: 1.2rem; }
    .hero h1, :lang(ar) .hero h1 { font-size: clamp(2.2rem,8.2vw,2.65rem); }
    .hero .button { padding-inline: .66rem; }
  }
}
