/* =====================================================================
   Extem — Underwater hero
   Layered living ocean + floating 3D laptop. All motion is
   transform/opacity only. Theme-aware via [data-theme="dark"].
   ===================================================================== */

.hero {
  position: relative;
  height: 100vh;
  height: 100svh;
  min-height: 560px;
  display: flex;
  align-items: center;
  padding: 84px 7% 24px;
  overflow: hidden;
  isolation: isolate;
}

/* ---------------- Ocean backdrop ---------------- */
.ocean {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.ocean-depth {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg,
    #ffffff 0%, #dceffb 22%, #b5dcf4 48%,
    #8ac6ea 72%, #62a5d4 100%);
  transition: opacity 0.6s ease;
}
[data-theme="dark"] .ocean-depth {
  background: linear-gradient(180deg,
    #0d3a5c 0%, #082a46 26%, #051d33 52%,
    #031223 76%, #010910 100%);
}

/* Sun / moon glow — lives in the corner by the theme toggle */
.ocean-sun {
  position: absolute;
  top: -110px;
  inset-inline-end: 4%;
  width: min(420px, 60vw);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle,
    #fffdf2 0%, rgba(255, 248, 214, 0.9) 16%,
    rgba(255, 240, 190, 0.35) 42%, rgba(255, 240, 190, 0) 70%);
  filter: blur(6px);
  animation: sunPulse 7s ease-in-out infinite;
}
[data-theme="dark"] .ocean-sun {
  background: radial-gradient(circle,
    #f2f8ff 0%, rgba(205, 228, 255, 0.75) 14%,
    rgba(140, 180, 230, 0.28) 42%, rgba(140, 180, 230, 0) 70%);
}
@keyframes sunPulse {
  0%, 100% { transform: scale(1); opacity: 0.95; }
  50% { transform: scale(1.07); opacity: 1; }
}

/* Light rays falling from the light corner */
.light-rays {
  position: absolute;
  inset: -10% 0;
  will-change: transform;
}
.light-rays i {
  position: absolute;
  top: -12%;
  height: 130%;
  width: 110px;
  background: linear-gradient(to bottom,
    rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.08) 60%, transparent 85%);
  filter: blur(16px);
  transform-origin: top center;
  animation: lightRaySway 9s ease-in-out infinite alternate;
  will-change: transform, opacity;
}
.light-rays i:nth-child(1) { inset-inline-end: 9%;  --light-ray-rot: 20deg; }
.light-rays i:nth-child(2) { inset-inline-end: 20%; width: 70px;  --light-ray-rot: 17deg; animation-delay: -3s; opacity: 0.8; }
.light-rays i:nth-child(3) { inset-inline-end: 30%; width: 150px; --light-ray-rot: 22deg; animation-delay: -5.5s; opacity: 0.6; }
.light-rays i:nth-child(4) { inset-inline-end: 2%;  width: 60px;  --light-ray-rot: 15deg; animation-delay: -7s; opacity: 0.7; }
[data-theme="dark"] .light-rays i {
  background: linear-gradient(to bottom,
    rgba(170, 205, 245, 0.35), rgba(170, 205, 245, 0.06) 60%, transparent 85%);
}
@keyframes lightRaySway {
  from { opacity: 0.45; transform: rotate(var(--light-ray-rot, 18deg)) translateY(0); }
  to   { opacity: 0.9;  transform: rotate(var(--light-ray-rot, 18deg)) translateY(26px); }
}

/* Slow drifting light blooms — dancing water light */
.ocean-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  mix-blend-mode: screen;
}
.ocean-glow.g1 {
  width: 46vmax; height: 46vmax;
  left: -10vmax; top: 6%;
  background: radial-gradient(circle, rgba(160, 235, 255, 0.3), transparent 65%);
  animation: drift1 16s ease-in-out infinite alternate;
}
.ocean-glow.g2 {
  width: 38vmax; height: 38vmax;
  right: -8vmax; bottom: -6vmax;
  background: radial-gradient(circle, rgba(255, 246, 200, 0.22), transparent 65%);
  animation: drift2 21s ease-in-out infinite alternate;
}
[data-theme="dark"] .ocean-glow.g1 { background: radial-gradient(circle, rgba(90, 160, 220, 0.35), transparent 65%); }
[data-theme="dark"] .ocean-glow.g2 { background: radial-gradient(circle, rgba(120, 170, 255, 0.18), transparent 65%); }
@keyframes drift1 {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(9vmax, 6vh) scale(1.15); }
}
@keyframes drift2 {
  from { transform: translate(0, 0) scale(1.1); }
  to   { transform: translate(-8vmax, -5vh) scale(0.95); }
}

/* Seabed + pool of light on the sand */
.ocean-floor {
  position: absolute;
  left: -10%; right: -10%; bottom: -4%;
  height: 30%;
  background:
    radial-gradient(55% 95% at 28% 108%, #6fa3c8 0%, transparent 70%),
    radial-gradient(48% 90% at 74% 110%, #5d97c2 0%, transparent 70%),
    linear-gradient(to top, #3f6f94 20%, transparent 90%);
}
[data-theme="dark"] .ocean-floor {
  background:
    radial-gradient(55% 95% at 28% 108%, #041525 0%, transparent 70%),
    radial-gradient(48% 90% at 74% 110%, #031120 0%, transparent 70%),
    linear-gradient(to top, #020c17 25%, transparent 90%);
}
.ocean-rock {
  position: absolute;
  bottom: -6%;
  border-radius: 50%;
  background: #4a7ba0;
  filter: blur(28px);
  opacity: 0.85;
}
.ocean-rock.r1 { left: 6%;  width: 300px; height: 150px; }
.ocean-rock.r2 { right: 8%; width: 380px; height: 170px; }
[data-theme="dark"] .ocean-rock { background: #010a14; }
.ocean-sandlight {
  position: absolute;
  bottom: 2%; left: 50%;
  width: min(560px, 70%);
  height: 120px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse, rgba(235, 246, 253, 0.6), transparent 70%);
  filter: blur(30px);
  animation: sandBreathe 6s ease-in-out infinite alternate;
}
[data-theme="dark"] .ocean-sandlight {
  background: radial-gradient(ellipse, rgba(150, 200, 250, 0.16), transparent 70%);
}
@keyframes sandBreathe {
  from { opacity: 0.6; transform: translateX(-50%) scaleX(1); }
  to   { opacity: 1;    transform: translateX(-50%) scaleX(1.12); }
}

/* Gray particles */
.ocean-snow {
  position: absolute;
  inset: 0;
}

/* Marine snow — tiny gray drifting motes (transform/opacity only,
   no filters, so phones can composite them for free) */
.snow-mote {
  position: absolute;
  border-radius: 50%;
  background: rgba(148, 163, 184, 0.6);
  animation: snowDrift linear infinite;
  will-change: transform, opacity;
}
@keyframes snowDrift {
  0%   { transform: translate(0, -5vh); opacity: 0; }
  15%  { opacity: 0.8; }
  85%  { opacity: 0.5; }
  100% { transform: translate(-6vw, 108vh); opacity: 0; }
}

/* Readability vignette + navbar shade */
.ocean-vignette {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, rgba(2, 10, 24, 0.42), transparent 130px),
    radial-gradient(120% 100% at 50% 42%, transparent 55%, rgba(30, 80, 120, 0.3) 100%);
}

/* Seamless melt into the next section — no hard cut.
   The veil sits above the ocean (z 0) but below content (z 2),
   ending in the exact color the .skills section starts with. */
.hero {
  margin-bottom: -1px;
}
.hero::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 170px;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(98, 165, 212, 0) 0%, #62a5d4 100%);
}
[data-theme="dark"] .hero::after {
  background: linear-gradient(to bottom, rgba(1, 9, 16, 0) 0%, #010910 100%);
}

/* ---------------- Hero layout ---------------- */
.hero-inner {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 1240px;
  margin: -3vh auto 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 48px;
}

.hero-text {
  flex: 1 1 48%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: start;
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: clamp(15px, 1.8vw, 21px);
  font-weight: 600;
  letter-spacing: 0.4px;
  color: #d9f6ff;
  text-shadow: 0 2px 14px rgba(0, 30, 60, 0.6);
  opacity: 0;
  animation: heroUp 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) 0.15s forwards;
}
.hero-kicker::before {
  content: "";
  width: 34px;
  height: 3px;
  border-radius: 3px;
  background: linear-gradient(90deg, #7ef0ff, #2bb8e6);
  box-shadow: 0 0 12px rgba(126, 240, 255, 0.8);
}
[dir="rtl"] .hero-kicker::before {
  background: linear-gradient(-90deg, #7ef0ff, #2bb8e6);
}

/* Arabic script: Tajawal + no letter-spacing (it would break joining) */
[dir="rtl"] .hero-text h1.hero-title,
[dir="rtl"] .hero-kicker {
  font-family: "Tajawal", "Montserrat", sans-serif;
  letter-spacing: 0;
  white-space: nowrap;
}

.hero-text h1.hero-title {
  margin: 14px 0 30px;
  font-size: clamp(36px, 5.2vw, 72px);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.5px;
  white-space: nowrap;
  max-width: none;
  color: #ffffff;
  text-shadow: 0 4px 30px rgba(0, 25, 55, 0.55);
  opacity: 0;
  animation: heroUp 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) 0.3s forwards;
}

.hero-text a.hero-cta {
  display: inline-block;
  padding: 15px 38px;
  font-size: 16px;
  font-weight: 700;
  color: #04263e;
  text-decoration: none;
  border-radius: 999px;
  background: linear-gradient(135deg, #a5f3fc, #38d6f5 55%, #1aa3d6);
  box-shadow: 0 10px 32px rgba(56, 214, 245, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  user-select: none;
  opacity: 0;
  animation: heroUp 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) 0.45s forwards;
}
.hero-text a.hero-cta:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 16px 44px rgba(56, 214, 245, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  opacity: 1;
}
/* Light water is near-white — ink the hero title navy, and give the
   small kicker a white-on-halo treatment so it pops (dark theme
   keeps its white via brand.css !important). */
html:not([data-theme="dark"]) .hero-kicker {
  color: #ffffff;
  text-shadow:
    0 0 5px rgba(4, 40, 70, 0.65),
    0 2px 18px rgba(4, 40, 70, 0.7);
}
html:not([data-theme="dark"]) .hero-text h1.hero-title {
  color: #062f52;
  text-shadow: 0 3px 22px rgba(255, 255, 255, 0.6);
}
@keyframes heroUp {
  from { opacity: 0; transform: translateY(34px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------------- 3D laptop ---------------- */
.laptop-scene {
  flex: 1 1 52%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  perspective: 2800px;
  opacity: 0;
  user-select: none;
  -webkit-user-select: none;
  animation: heroUp 1.1s cubic-bezier(0.2, 0.7, 0.2, 1) 0.55s forwards;
}

.laptop-fit {
  display: flex;
  flex-direction: column;
  align-items: center;
  transform-origin: top center;
}

.laptop-tilt {
  transform-style: preserve-3d;
  will-change: transform;
}

.laptop {
  position: relative;
  width: 560px;
  height: 330px;
  transform-style: preserve-3d;
  transform: rotateX(-18deg) rotateY(-14deg);
  animation: laptopFloat 7s ease-in-out infinite;
  will-change: transform;
}
@keyframes laptopFloat {
  0%, 100% { transform: rotateX(-18deg) rotateY(-14deg) translateY(0); }
  50%      { transform: rotateX(-19deg) rotateY(-12deg) translateY(-16px); }
}

/* RTL: the laptop faces the other way */
[dir="rtl"] .laptop {
  transform: rotateX(-18deg) rotateY(14deg);
  animation-name: laptopFloatRTL;
}
@keyframes laptopFloatRTL {
  0%, 100% { transform: rotateX(-18deg) rotateY(14deg) translateY(0); }
  50%      { transform: rotateX(-19deg) rotateY(12deg) translateY(-16px); }
}

/* Screen */
.laptop-screen {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  padding: 15px 15px 20px;
  background: linear-gradient(145deg, #3c3f47, #22242a 40%, #101216);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.35), inset 0 -2px 6px rgba(0, 0, 0, 0.8);
}

/* Hinge bar joining screen and base */
.laptop-hinge {
  position: absolute;
  top: calc(100% - 8px);
  left: 3%;
  right: 3%;
  height: 15px;
  border-radius: 8px;
  background: linear-gradient(to bottom, #6a6f78, #33363d 55%, #101216);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transform: translateZ(4px);
}
.laptop-display {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 5px;
  overflow: hidden;
  background: linear-gradient(160deg, #0b2f52 0%, #0e5e8f 55%, #1293bd 100%);
  box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.45);
}
/* Glass reflection sweeping the screen */
.laptop-display::after {
  content: "";
  position: absolute;
  top: -20%; bottom: -20%;
  width: 34%;
  left: -60%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.28), transparent);
  transform: skewX(-12deg);
  animation: screenSheen 6.5s ease-in-out infinite;
}
@keyframes screenSheen {
  0%, 55%  { left: -60%; }
  90%, 100% { left: 140%; }
}
/* Mini Extem site on the screen */
.mini-bar {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 10px;
  background: rgba(3, 18, 34, 0.55);
}
.mini-bar b {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
}
.mini-bar b:first-child { background: #ff8a8a; }
.mini-bar b:nth-child(2) { background: #ffd479; }
.mini-bar b:nth-child(3) { background: #7df0b2; }
.mini-url {
  margin-inline-start: 8px;
  font-size: 7px;
  letter-spacing: 0.5px;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  padding: 3px 26px;
}
.mini-body { padding: 24px 24px; text-align: center; }
.mini-logo {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 8px;
  color: #ffffff;
  text-shadow: 0 2px 12px rgba(0, 40, 80, 0.6);
}
.mini-tag {
  margin-top: 7px;
  font-size: 8.5px;
  letter-spacing: 1px;
  color: #cdeffd;
}
.mini-btn {
  display: inline-block;
  margin-top: 13px;
  font-size: 8px;
  font-weight: 700;
  color: #06334c;
  background: linear-gradient(135deg, #b8f4ff, #4fd8f7);
  border-radius: 999px;
  padding: 6px 22px;
  box-shadow: 0 4px 16px rgba(80, 220, 250, 0.5);
}
.mini-cards {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 18px;
}
.mini-cards span {
  width: 76px;
  height: 40px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.22);
}
/* Webcam dot */
.laptop-screen::before {
  content: "";
  position: absolute;
  top: 6px; left: 50%;
  width: 5px; height: 5px;
  margin-left: -2.5px;
  border-radius: 50%;
  background: #3d5a76;
  box-shadow: inset 0 0 2px #000, 0 0 3px rgba(120, 190, 255, 0.8);
  z-index: 2;
}

/* Base / keyboard */
.laptop-base {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 360px;
  transform-origin: top center;
  transform: rotateX(66deg);
  border-radius: 6px 6px 22px 22px;
  background: linear-gradient(to bottom, #d7dbe0 0%, #b9bec6 12%, #9aa0a9 60%, #7e848d 100%);
  box-shadow: inset 0 2px 2px rgba(255, 255, 255, 0.8), inset 0 -8px 18px rgba(0, 0, 0, 0.35),
    inset 0 14px 14px -8px rgba(0, 0, 0, 0.55);
}
/* Front lip glow */
.laptop-base::before {
  content: "";
  position: absolute;
  left: 8px; right: 8px; bottom: 5px;
  height: 7px;
  border-radius: 0 0 14px 14px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.28), transparent);
}
/* Keyboard deck — real keys are generated by hero.js */
.laptop-keys {
  position: absolute;
  top: 8%;
  left: 8%;
  right: 8%;
  height: 50%;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.kb-row {
  display: flex;
  gap: 5px;
  flex: 1 1 0;
  min-height: 0;
}
.kb-row.fn { flex: 0.78 1 0; }
.kb-key {
  flex-basis: 0;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  font-weight: 600;
  color: #c6cbd5;
  border-radius: 4px;
  background: linear-gradient(180deg, #4c515b, #34373f 70%, #26292f);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  white-space: nowrap;
}
/* Trackpad */
.laptop-pad {
  position: absolute;
  bottom: 6%;
  left: 50%;
  width: 30%;
  height: 28%;
  transform: translateX(-50%);
  border-radius: 8px;
  background: linear-gradient(180deg, #c3c8cf, #a8adb5);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 0 rgba(255, 255, 255, 0.7);
}

/* Floating shadow under the laptop */
.laptop-shadow {
  margin-top: 145px;
  width: 62%;
  height: 30px;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(0, 8, 20, 0.55), transparent 70%);
  filter: blur(10px);
  animation: shadowPulse 7s ease-in-out infinite;
}
@keyframes shadowPulse {
  0%, 100% { transform: scaleX(1); opacity: 0.9; }
  50%      { transform: scaleX(0.82); opacity: 0.55; }
}

/* ---------------- Responsive ---------------- */
@media (max-width: 1020px) {
  .laptop { width: 480px; height: 285px; }
  .laptop-base { height: 310px; }
}
@media (max-width: 900px) {
  .hero-inner {
    flex-direction: column;
    text-align: center;
    gap: 30px;
  }
  [dir="rtl"] .hero-inner { flex-direction: column; }
  .hero-text { align-items: center; }
  .laptop-shadow { margin-top: 104px; }
}
@media (max-width: 480px) {
  .hero { padding: 100px 6% 60px; }
  .laptop { width: 320px; height: 190px; }
  .laptop-base { height: 205px; }
  .laptop-screen { padding: 11px 11px 19px; border-radius: 10px; }
  .mini-body { padding: 14px 12px; }
  .mini-logo { font-size: 15px; letter-spacing: 5px; }
  .mini-cards span { width: 46px; height: 24px; }
  .laptop-keys { gap: 2px; }
  .kb-row { gap: 2px; }
  .kb-key { font-size: 5px; border-radius: 2px; }
  .laptop-shadow { margin-top: 90px; }
  .ocean-sun { top: -70px; }
}

/* ---------------- Reduced motion ---------------- */
@media (prefers-reduced-motion: reduce) {
  .ocean-sun, .light-rays i, .ocean-glow,
  .ocean-sandlight, .laptop, .laptop-shadow,
  .laptop-display::after, .hero-kicker,
  .hero-text h1.hero-title, .hero-cta, .laptop-scene {
    animation: none;
  }
  .hero-kicker, .hero-text h1.hero-title,
  .hero-cta, .laptop-scene { opacity: 1; }
  .ocean-snow { display: none; }
}
