/* =========================================================================
   Driss Najih — Portfolio (WebGL cosmos edition)
   Stellar palette · dark, orbital, technical
   ========================================================================= */

:root {
  --accent:  #7AA2FF;
  --accent2: #C792EA;
  --warm:    #FFB454;
  --glow:    rgba(122, 162, 255, .4);
  --text:    #E6E9F0;
  --muted:   #8A90A2;
  --border:  rgba(255, 255, 255, .1);
  --surface: rgba(255, 255, 255, .025);
  --bg:      #05060B;

  --font-display: 'Space Grotesk', sans-serif;
  --font-body:    'Sora', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

::selection { background: rgba(122, 162, 255, .32); }

body::-webkit-scrollbar { width: 10px; }
body::-webkit-scrollbar-track { background: var(--bg); }
body::-webkit-scrollbar-thumb { background: #1b2030; border-radius: 8px; }

/* ===== Keyframes ===== */
@keyframes floaty   { 0%, 100% { transform: translateY(0); }  50% { transform: translateY(-10px); } }
@keyframes twinkle  { 0%, 100% { opacity: .25; }              50% { opacity: .9; } }
@keyframes corepulse{ 0%, 100% { opacity: .55; transform: scale(1); } 50% { opacity: 1; transform: scale(1.06); } }
@keyframes bob      { 0%, 100% { transform: translateY(0); }  50% { transform: translateY(7px); } }
@keyframes shimmer  { to { background-position: 240% center; } }

/* =========================================================================
   Cosmos backdrop (fixed, behind the whole page for continuity)
   ========================================================================= */
.cosmos {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
/* fade: clear over the hero (top), settling into deep space behind content
   so the glitter keeps twinkling subtly the whole way down */
.cosmos-fade {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(180deg,
    rgba(5, 6, 11, 0)    0,
    rgba(5, 6, 11, 0)    76vh,
    rgba(5, 6, 11, .5)  100vh,
    rgba(5, 6, 11, .8)  140vh,
    rgba(5, 6, 11, .85) 230vh);
}

.page { position: relative; width: 100%; min-height: 100vh; background: transparent; }

/* =========================================================================
   Nav
   ========================================================================= */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px clamp(20px, 5vw, 64px);
  background: linear-gradient(180deg,
    rgba(5, 6, 11, .62) 0%,
    rgba(5, 6, 11, .2) 65%,
    rgba(5, 6, 11, 0) 100%);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: .2px;
}
.brand-orb {
  display: inline-flex;
  width: 30px; height: 30px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  position: relative;
}
.brand-orb-core {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--glow);
}
.brand-orb-ring {
  position: absolute;
  inset: 3px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-radius: 50%;
}

.nav-right { display: flex; align-items: center; gap: clamp(14px, 2.4vw, 34px); }

.navlinks {
  display: none;
  gap: 28px;
  font-size: 14px;
  color: var(--muted);
}
.navlinks a { transition: color .2s; }
.navlinks a:hover { color: var(--text); }

/* =========================================================================
   Hero
   ========================================================================= */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 120px clamp(20px, 5vw, 64px) 80px;
  overflow: hidden;
}
.hero-scrim {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: min(960px, 94vw);
  height: min(660px, 84vh);
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(ellipse at center,
    rgba(5, 6, 11, .72) 0%,
    rgba(5, 6, 11, .48) 40%,
    rgba(5, 6, 11, 0) 70%);
}
.hero-content { position: relative; z-index: 3; max-width: 880px; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 16px;
  margin-bottom: 28px;
  background: rgba(255, 255, 255, .02);
}
.eyebrow-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #3ddc84;
  box-shadow: 0 0 8px #3ddc84;
}

.hero-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(38px, 6.6vw, 76px);
  line-height: 1.02;
  letter-spacing: -1.5px;
  margin: 0 0 26px;
  text-wrap: balance;
  text-shadow: 0 2px 28px rgba(5, 6, 11, .6);
}
.grad {
  background: linear-gradient(120deg, var(--accent), var(--accent2) 40%, var(--warm) 70%, var(--accent));
  background-size: 240% auto;
  background-position: 0 center;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 7s linear infinite;
}

.hero-sub {
  max-width: 580px;
  margin: 0 auto 38px;
  font-size: clamp(16px, 1.9vw, 19px);
  line-height: 1.6;
  color: #C5CBDA;
  text-shadow: 0 1px 18px rgba(5, 6, 11, .75);
  text-wrap: pretty;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
  align-items: center;
}
.hero-socials { display: flex; gap: 10px; }

.scroll-hint {
  position: absolute;
  bottom: 30px; left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 2px;
}
.scroll-mouse { animation: bob 2.4s ease-in-out infinite; }

/* =========================================================================
   Buttons & icon links (hover handled in CSS)
   ========================================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 15px;
  transition: transform .2s, box-shadow .2s, border-color .2s, background .2s;
  cursor: pointer;
}
.btn-primary {
  padding: 14px 26px;
  background: var(--accent);
  color: var(--bg);
  box-shadow: 0 8px 30px var(--glow);
}
.btn-primary:hover { transform: translateY(-3px); }
.btn-outline {
  padding: 14px 26px;
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 500;
  background: transparent;
}
.btn-outline:hover { border-color: var(--accent); background: rgba(255, 255, 255, .03); }
.btn-sm  { padding: 11px 20px; font-size: 14px; }
.btn-lg  { padding: 15px 30px; font-size: 16px; }
.btn-lg.btn-outline { padding: 15px 26px; font-weight: 500; }

.icon-btn {
  display: inline-flex;
  width: 46px; height: 46px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--muted);
  transition: color .2s, border-color .2s;
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent); }

/* =========================================================================
   Sections (shared)
   ========================================================================= */
.section { position: relative; z-index: 2; margin: 0 auto; }
.section-num {
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--accent);
}
.section-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 46px);
  font-weight: 600;
  letter-spacing: -1px;
  margin: 0 0 14px;
}
.section-intro {
  font-size: 16px;
  color: var(--muted);
  max-width: 560px;
  margin: 0 0 56px;
  line-height: 1.6;
}

/* ===== About ===== */
.about { max-width: 1100px; padding: clamp(70px, 9vw, 120px) clamp(20px, 5vw, 64px); }
.about .section-num { margin-bottom: 30px; }
.about-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: clamp(36px, 6vw, 80px);
  align-items: start;
}
.about-lead {
  font-family: var(--font-display);
  font-size: clamp(21px, 2.7vw, 30px);
  line-height: 1.45;
  font-weight: 400;
  margin: 0 0 22px;
  letter-spacing: -.4px;
  text-wrap: pretty;
}
.about-body {
  font-size: 16px;
  line-height: 1.7;
  color: var(--muted);
  margin: 0 0 16px;
  text-wrap: pretty;
}
.about-body:last-child { margin-bottom: 0; }
.about-body em { color: var(--text); font-style: normal; }
.c-accent  { color: var(--accent); }
.c-accent2 { color: var(--accent2); }
.c-warm    { color: var(--warm); }

.stats { display: flex; flex-direction: column; gap: 14px; }
.stat {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px 22px;
  background: var(--surface);
}
.stat-value {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 600;
  color: var(--accent);
  line-height: 1;
  letter-spacing: -.5px;
}
.stat-label { font-size: 13.5px; color: var(--muted); margin-top: 7px; }

/* ===== Skills ===== */
.skillgrid {
  margin-top: clamp(44px, 6vw, 72px);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}
.skill { background: #080A12; padding: 22px 24px; }
.skill-label {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}
.skill-items { font-size: 14.5px; line-height: 1.75; color: var(--text); }

/* ===== Work / Featured ===== */
.work { max-width: 1180px; padding: clamp(40px, 6vw, 80px) clamp(20px, 5vw, 64px); }
.work .section-num { margin-bottom: 14px; }
.project-list { display: flex; flex-direction: column; gap: clamp(48px, 7vw, 96px); }
.project {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: clamp(28px, 4vw, 56px);
  align-items: center;
}
.project-meta { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.project-n { font-family: var(--font-mono); font-size: 13px; color: var(--accent); }
.project-rule { height: 1px; width: 42px; background: rgba(255, 255, 255, .2); }
.project-kind {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
}
.project-name {
  font-family: var(--font-display);
  font-size: clamp(28px, 3.6vw, 40px);
  font-weight: 600;
  letter-spacing: -.8px;
  margin: 0 0 6px;
}
.project-tag { font-size: 16px; color: var(--accent2); margin-bottom: 18px; }
.project-desc {
  font-size: 15.5px;
  line-height: 1.7;
  color: var(--muted);
  margin: 0 0 22px;
  text-wrap: pretty;
}
.tech-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 26px; }
.tech {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 5px 11px;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  background: var(--surface);
}
.project-links { display: flex; gap: 12px; flex-wrap: wrap; }

/* ===== Browser frame + live preview ===== */
.frame {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: #0A0C14;
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .8), 0 0 0 1px rgba(255, 255, 255, .02);
}
.frame-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  background: #0E1018;
  border-bottom: 1px solid var(--border);
}
.dot { width: 11px; height: 11px; border-radius: 50%; }
.dot-r { background: #ff5f57; }
.dot-y { background: #febc2e; }
.dot-g { background: #28c840; }
.frame-url {
  flex: 1;
  margin-left: 8px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  background: var(--bg);
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 7px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
  overflow: hidden;
  white-space: nowrap;
}
.frame-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: var(--bg);
}
.frame-viewport iframe {
  position: absolute;
  top: 0; left: 0;
  width: 133.34%;
  height: 133.34%;
  border: 0;
  transform: scale(.75);
  transform-origin: 0 0;
}

/* ===== Secondary projects ===== */
.secondary { max-width: 1180px; padding: clamp(40px, 6vw, 72px) clamp(20px, 5vw, 64px); }
.secondary-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 34px;
}
.secondary-title {
  font-family: var(--font-display);
  font-size: clamp(22px, 2.8vw, 30px);
  font-weight: 600;
  letter-spacing: -.6px;
  margin: 0;
}
.secondary-gh {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.card {
  display: block;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  background: var(--surface);
  transition: transform .25s, border-color .25s, background .25s;
}
.card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  background: rgba(255, 255, 255, .04);
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.card-name {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  margin: 0;
}
.card-tag { font-size: 14px; line-height: 1.6; color: var(--muted); margin: 0 0 16px; text-wrap: pretty; }
.card-tech { font-family: var(--font-mono); font-size: 11.5px; color: var(--accent2); }

/* ===== Experience ===== */
.experience { max-width: 980px; padding: clamp(50px, 7vw, 100px) clamp(20px, 5vw, 64px); }
.experience .section-num { margin-bottom: 14px; }
.exp-title { margin-bottom: 50px; }
.timeline { position: relative; }
.timeline-rail {
  position: absolute;
  left: 7px; top: 6px; bottom: 6px;
  width: 1px;
  background: linear-gradient(180deg, var(--accent), transparent);
  opacity: .5;
}
.tl-item { position: relative; padding-left: 40px; padding-bottom: 38px; }
.tl-dot {
  position: absolute;
  left: 0; top: 5px;
  width: 15px; height: 15px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 4px var(--bg);
}
.tl-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
  justify-content: space-between;
  margin-bottom: 4px;
}
.tl-role { font-family: var(--font-display); font-size: 19px; font-weight: 600; margin: 0; }
.tl-period { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.tl-org { font-size: 15px; color: var(--accent); margin-bottom: 10px; }
.tl-note {
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--muted);
  margin: 0 0 12px;
  max-width: 640px;
  text-wrap: pretty;
}
.tl-tags { display: flex; flex-wrap: wrap; gap: 7px; }
.tl-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 3px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
}

/* ===== Contact ===== */
.contact {
  padding: clamp(60px, 9vw, 130px) clamp(20px, 5vw, 64px);
  text-align: center;
  overflow: hidden;
}
.contact-glow {
  position: absolute;
  top: 50%; left: 50%;
  width: 600px; height: 600px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, var(--glow), transparent 65%);
  opacity: .4;
  pointer-events: none;
}
.contact-inner { position: relative; z-index: 2; max-width: 680px; margin: 0 auto; }
.contact .section-num { margin-bottom: 22px; }
.contact-title {
  font-family: var(--font-display);
  font-size: clamp(32px, 5.2vw, 58px);
  font-weight: 600;
  letter-spacing: -1.3px;
  margin: 0 0 22px;
  text-wrap: balance;
}
.contact-sub { font-size: 17px; color: var(--muted); line-height: 1.6; margin: 0 0 40px; }
.contact-actions { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }

/* ===== Footer ===== */
.footer {
  position: relative;
  z-index: 2;
  border-top: 1px solid rgba(255, 255, 255, .07);
  padding: 30px clamp(20px, 5vw, 64px);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  font-size: 13px;
  color: var(--muted);
}
.mono { font-family: var(--font-mono); }

/* =========================================================================
   Scroll-reveal (JS adds .is-visible). Static fallback: if JS/IO is absent
   or motion is reduced, content stays fully visible.
   ========================================================================= */
.js-reveal [data-reveal] {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity .7s cubic-bezier(.2, .7, .2, 1), transform .7s cubic-bezier(.2, .7, .2, 1);
}
.js-reveal [data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

/* =========================================================================
   Responsive (replaces the prototype's JS grid sizing)
   ========================================================================= */
@media (min-width: 761px) {
  .navlinks { display: flex; }
}
@media (max-width: 860px) {
  .about-grid { grid-template-columns: 1fr; }
  .project { grid-template-columns: 1fr; }
  .skillgrid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .skillgrid { grid-template-columns: 1fr; }
}

/* =========================================================================
   Reduced motion — freeze decorative animation, drop reveal transitions
   ========================================================================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .grad { animation: none; }
  .scroll-mouse { animation: none; }
  .js-reveal [data-reveal] { transition: none; opacity: 1; transform: none; }
}
