/* ===========================================================
   Mohamed Youssef Mtimet — Portfolio
   Concept: Terminal Brutalism
   =========================================================== */

/* ---------- Design tokens ---------- */
:root{
  --bg: #0B0D0C;
  --bg-alt: #121513;
  --bg-raised: #161A17;
  --fg: #F2F3EE;
  --fg-soft: #9AA39C;
  --fg-faint: #5C6660;
  --line: rgba(242,243,238,0.12);
  --line-strong: rgba(242,243,238,0.3);
  --accent: #B8FF3C;
  --accent-dim: #8FCB2C;
  --red-dot: #FF5F56;
  --amber-dot: #FFBD2E;
  --green-dot: #27C93F;

  --font-mono: "JetBrains Mono", "SF Mono", Consolas, monospace;

  --container: 1180px;
  --gutter: clamp(1.25rem, 4vw, 3rem);

  --ease: cubic-bezier(.22,.68,0,1);
}

/* ---------- Reset ---------- */
*, *::before, *::after{ box-sizing: border-box; }
html{ scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce){
  html{ scroll-behavior: auto; }
  *, *::before, *::after{
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
body{
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1,h2,h3,h4,p,dl,dd,figure,ol,ul{ margin: 0; }
ul,ol{ padding: 0; list-style: none; }
img{ max-width: 100%; display: block; }
a{ color: inherit; text-decoration: none; }
button{ font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

.skip-link{
  position: absolute;
  left: -999px; top: 0;
  background: var(--accent);
  color: var(--bg);
  padding: 0.75rem 1.25rem;
  z-index: 999;
  font-size: 0.85rem;
  font-weight: 700;
}
.skip-link:focus{ left: 1rem; top: 1rem; }

:focus-visible{ outline: 2px solid var(--accent); outline-offset: 3px; }

.fg-faint{ color: var(--fg-faint); }
.prompt{ color: var(--accent); font-weight: 700; }

/* ---------- Scanline overlay ---------- */
.scanlines{
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background-image: repeating-linear-gradient(
    to bottom,
    rgba(255,255,255,0.018) 0px,
    rgba(255,255,255,0.018) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: overlay;
}

/* ---------- Layout helpers ---------- */
.section-inner, .header-inner, .footer-inner, .hero-inner{
  position: relative;
  z-index: 1;
  max-width: var(--container);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

.section{ padding: clamp(4rem, 10vw, 7.5rem) 0; position: relative; }

.section-label{
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  color: var(--accent);
  margin-bottom: 1rem;
}

.section-title{
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: clamp(2rem, 4.6vw, 3.1rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin-bottom: 1rem;
}

.section-intro{
  max-width: 56ch;
  color: var(--fg-soft);
  font-size: 1rem;
}

.section-head{ margin-bottom: clamp(2.5rem, 6vw, 4rem); }

/* ---------- Reveal on scroll ---------- */
[data-reveal]{
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
[data-reveal].is-visible{ opacity: 1; transform: translateY(0); }

/* ---------- Buttons ---------- */
.btn{
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1.35rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  border: 2px solid var(--fg);
  border-radius: 0;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s var(--ease), color 0.2s var(--ease);
  box-shadow: 4px 4px 0 var(--fg);
  background: transparent;
  color: var(--fg);
}
.btn .prompt{ color: inherit; }
.btn:hover{ transform: translate(-2px,-2px); box-shadow: 6px 6px 0 var(--fg); }
.btn:active{ transform: translate(0,0); box-shadow: 2px 2px 0 var(--fg); }

.btn-primary{
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
  box-shadow: 4px 4px 0 var(--fg);
}
.btn-primary .prompt{ color: var(--bg); }
.btn-primary:hover{ box-shadow: 6px 6px 0 var(--fg); }

.btn-outline{ background: transparent; }

.btn-ghost{
  border: none;
  box-shadow: none;
  padding: 0.5rem 0;
  font-size: 0.82rem;
  position: relative;
}
.btn-ghost:hover{ transform: none; box-shadow: none; color: var(--accent); }

.btn-large{ padding: 1.1rem 1.6rem; font-size: 0.88rem; flex-wrap: wrap; word-break: break-all; }

/* ---------- Header ---------- */
.site-header{
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  background: rgba(11,13,12,0.86);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.header-inner{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1rem;
  padding-bottom: 1rem;
  gap: 1.5rem;
}
.logo{
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.01em;
}
.logo .at{ color: var(--accent); }
.logo-cursor{
  display: inline-block;
  color: var(--accent);
  animation: blink 1s steps(1) infinite;
}
@keyframes blink{ 0%,49%{ opacity:1; } 50%,100%{ opacity:0; } }

.main-nav{
  display: flex;
  gap: 2rem;
  font-size: 0.85rem;
}
.main-nav a{ position: relative; display: inline-flex; align-items: center; }
.nav-index{ color: var(--accent); }
.main-nav a::before{
  content: "";
  display: inline-block;
  width: 0;
  overflow: hidden;
  transition: width 0.2s var(--ease);
}
.main-nav a:hover{ color: var(--accent); }

.header-right{
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.social-icons{ display: flex; gap: 0.5rem; }
.icon-btn{
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1.5px solid var(--line-strong);
  color: var(--fg-soft);
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease), background 0.2s var(--ease), transform 0.2s var(--ease);
  flex-shrink: 0;
}
.icon-btn:hover{
  color: var(--bg);
  background: var(--accent);
  border-color: var(--accent);
  transform: translate(-1px,-1px);
}

.header-cta{ flex-shrink: 0; }

.nav-toggle{ display: none; width: 32px; height: 32px; position: relative; flex-shrink: 0; }
.nav-toggle-icon, .nav-toggle-icon::before, .nav-toggle-icon::after{
  content: "";
  position: absolute;
  left: 6px; right: 6px;
  height: 2px;
  background: var(--fg);
  transition: transform 0.3s var(--ease), opacity 0.3s var(--ease), top 0.3s var(--ease);
}
.nav-toggle-icon{ top: 15px; }
.nav-toggle-icon::before{ top: -8px; }
.nav-toggle-icon::after{ top: 8px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-icon{ background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle-icon::before{ top: 0; transform: rotate(45deg); background: var(--accent); }
.nav-toggle[aria-expanded="true"] .nav-toggle-icon::after{ top: 0; transform: rotate(-45deg); background: var(--accent); }

/* ---------- Terminal window chrome ---------- */
.term-window{
  border: 1.5px solid var(--line-strong);
  background: var(--bg-alt);
}
.term-titlebar{
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--line);
  background: var(--bg-raised);
}
.term-dot{ width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.dot-red{ background: var(--red-dot); }
.dot-amber{ background: var(--amber-dot); }
.dot-green{ background: var(--green-dot); }
.term-path{
  margin-left: 0.5rem;
  font-size: 0.75rem;
  color: var(--fg-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.term-body{ padding: clamp(1.5rem, 4vw, 2.75rem); }

/* ---------- Hero ---------- */
.hero{
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding-top: 6rem;
  padding-bottom: 3rem;
}
.hero-inner{ width: 100%; }
.hero-term{ max-width: 880px; }

.term-line{ font-size: 0.92rem; }
.prompt-line{ color: var(--fg-soft); margin-bottom: 0.35rem; }
.output-line{ color: var(--fg-soft); margin-bottom: 1.75rem; }

.hero-title{
  font-weight: 800;
  font-size: clamp(1.7rem, 4.4vw, 2.9rem);
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin-bottom: 1.75rem;
  color: var(--fg);
}
.hero-title #typed-text{ color: var(--fg); }
.caret{
  color: var(--accent);
  animation: blink 1s steps(1) infinite;
  margin-left: 2px;
}

.hero-sub{ max-width: 62ch; }

.hero-actions{ display: flex; flex-wrap: wrap; gap: 1rem; }

/* System info corner widget */
.sysinfo{
  margin-top: 2rem;
  max-width: 880px;
  border: 1.5px solid var(--line-strong);
  background: var(--bg-alt);
  font-size: 0.78rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}
.sysinfo-row{
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.sysinfo-row:nth-last-child(-n+4){ border-bottom: none; }
.sysinfo-row span:first-child{ color: var(--fg-faint); text-transform: uppercase; letter-spacing: 0.04em; }
.sysinfo-row span:last-child{ color: var(--fg); font-weight: 600; }
#uptime{ font-variant-numeric: tabular-nums; }
.status-dot{ display: inline-flex; align-items: center; gap: 0.4rem; color: var(--accent) !important; }
.status-dot::before{ content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); display: inline-block; }

@media (max-width: 640px){
  .sysinfo{ grid-template-columns: repeat(2, 1fr); }
  .sysinfo-row:nth-last-child(-n+4){ border-bottom: 1px solid var(--line); }
  .sysinfo-row:nth-last-child(-n+2){ border-bottom: none; }
}

.scroll-cue{
  position: absolute;
  left: var(--gutter);
  bottom: 2rem;
  font-size: 0.72rem;
  color: var(--fg-faint);
}

/* ---------- Project sheets ---------- */
.sheet-list{
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}
@media (min-width: 800px){
  .sheet-list{ grid-template-columns: repeat(2, 1fr); }
}

.project-sheet{ transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), border-color 0.3s var(--ease); }
.project-sheet:hover{
  transform: translate(-3px,-3px);
  box-shadow: 7px 7px 0 var(--accent);
  border-color: var(--fg-soft);
}

.sheet-body{ padding: 1.5rem; }
.sheet-head{
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 0.9rem;
  padding-bottom: 1.1rem;
  margin-bottom: 1.1rem;
  border-bottom: 1px dashed var(--line-strong);
}
.sheet-title{
  font-weight: 700;
  font-size: 1.1rem;
  flex: 1 1 auto;
  min-width: 10ch;
  color: var(--fg);
}
.sheet-tags{ display: flex; flex-wrap: wrap; gap: 0.4rem; width: 100%; }
.tag{
  font-size: 0.68rem;
  padding: 0.22rem 0.5rem;
  border: 1px solid var(--line-strong);
  color: var(--fg-soft);
}

.sheet-fields{ display: grid; gap: 1rem; }
.sheet-fields dt{
  font-size: 0.72rem;
  color: var(--accent);
  margin-bottom: 0.3rem;
}
.sheet-fields dd{ margin: 0; font-size: 0.88rem; color: var(--fg-soft); line-height: 1.55; }

.more-projects{
  margin-top: 2.25rem;
  font-size: 0.85rem;
  color: var(--fg-soft);
}
.inline-link{ color: var(--accent); border-bottom: 1px solid transparent; transition: border-color 0.2s var(--ease); }
.inline-link:hover{ border-color: var(--accent); }

/* ---------- Expertise / Parcours ---------- */
.expertise-grid{ display: grid; gap: 3rem; }
@media (min-width: 860px){
  .expertise-grid{ grid-template-columns: 1.15fr 0.85fr; gap: 4rem; }
}

.col-title{
  font-size: 0.85rem;
  color: var(--accent);
  margin-bottom: 1.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--line-strong);
}

.timeline{ position: relative; border-left: 2px solid var(--line-strong); padding-left: 1.75rem; display: grid; gap: 1.75rem; }
.timeline-item{ position: relative; }
.timeline-item::before{
  content: "";
  position: absolute;
  left: -1.98rem; top: 0.35rem;
  width: 11px; height: 11px;
  background: var(--bg);
  border: 2px solid var(--fg);
}
.timeline-item:first-child::before{ border-color: var(--accent); background: var(--accent); }
.commit-hash{ font-size: 0.75rem; color: var(--fg-faint); margin-right: 0.6rem; }
.timeline-year{ font-size: 0.75rem; color: var(--accent); }
.timeline-role{ font-weight: 700; font-size: 0.98rem; margin: 0.3rem 0 0.35rem; color: var(--fg); }
.timeline-desc{ color: var(--fg-soft); font-size: 0.85rem; max-width: 48ch; }

.skills-list{ display: grid; gap: 1rem; }
.skill-row{ display: grid; grid-template-columns: 4.5rem 1fr 2.2rem; align-items: center; gap: 0.9rem; }
.skill-name{ font-size: 0.82rem; color: var(--fg); }
.skill-value{ font-size: 0.78rem; color: var(--fg-faint); text-align: right; font-variant-numeric: tabular-nums; }
.skill-bar{
  position: relative;
  height: 10px;
  background: var(--bg-alt);
  border: 1px solid var(--line-strong);
}
.bar-fill{
  display: block;
  height: 100%;
  background: var(--accent);
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 1s var(--ease);
}
.is-visible .bar-fill{ transform: scaleX(1); }

.skills-note{ margin-top: 1.5rem; font-size: 0.78rem; color: var(--fg-faint); max-width: 42ch; line-height: 1.7; }

/* ---------- Contact ---------- */
.contact-term{ max-width: 880px; margin: 0 auto; }
.contact-title{
  font-weight: 800;
  font-size: clamp(2rem, 5.5vw, 3.2rem);
  line-height: 1.05;
  margin-bottom: 1.1rem;
  color: var(--fg);
}
.contact-sub{ max-width: 56ch; color: var(--fg-soft); font-size: 0.95rem; margin-bottom: 2.25rem; }
.contact-actions{ margin-bottom: 2.25rem; }
.contact-links{ display: flex; flex-wrap: wrap; gap: 1.75rem; margin-top: 0.75rem; }
.contact-link{
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--fg-soft);
  border-bottom: 1px solid transparent;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.contact-link svg{ flex-shrink: 0; }
.contact-link:hover{ color: var(--accent); border-color: var(--accent); }

/* ---------- Footer ---------- */
.site-footer{ border-top: 1px solid var(--line); }
.footer-inner{
  max-width: var(--container);
  margin: 0 auto;
  padding: 1.5rem var(--gutter);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--fg-faint);
}

/* ---------- Responsive nav ---------- */
@media (max-width: 760px){
  .main-nav{
    position: fixed;
    inset: 64px 0 auto 0;
    background: var(--bg);
    border-bottom: 1px solid var(--line-strong);
    flex-direction: column;
    gap: 0;
    padding: 0.5rem var(--gutter) 1rem;
    transform: translateY(-8px);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.3s var(--ease), opacity 0.3s var(--ease), visibility 0.3s;
  }
  .main-nav.is-open{ transform: translateY(0); opacity: 1; visibility: visible; }
  .main-nav a{ padding: 0.85rem 0; border-bottom: 1px dashed var(--line); font-size: 0.95rem; }
  .header-cta{ display: none; }
  .nav-toggle{ display: block; }
}
@media (min-width: 761px){
  .main-nav{ display: flex !important; }
}
