/* Portfolio d'Amine Boujahma (voir DESIGN.md) */

:root {
  --bg: #111318;
  --bg-2: #1A1C22;
  --text: #F5F4F0;
  --text-2: #A7A9B2;
  --accent: #777DAB;
  --line: #292C34;

  --sans: "Geist", "Inter", "Segoe UI", Arial, sans-serif;
  --serif: "Instrument Serif", Georgia, "Times New Roman", serif;

  --pad: clamp(20px, 4.4vw, 72px);
  --section: clamp(104px, 13vw, 200px);
  --ease: cubic-bezier(.16, 1, .3, 1);

  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { display: block; max-width: 100%; height: auto; }
figure, p, h1, h2, h3, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
h1, h2, h3 { font-weight: 500; }
em { font-family: var(--serif); font-style: italic; font-weight: 400; }

a { color: inherit; text-decoration: none; }
:focus-visible { outline: 1px solid var(--accent); outline-offset: 4px; }
::selection { background: var(--accent); color: var(--bg); }

.skip { position: absolute; left: 12px; top: -100px; background: var(--text); color: var(--bg); padding: 10px 16px; z-index: 100; }
.skip:focus { top: 12px; }

.section-tag {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 12px;
}
.section-tag::before { content: ""; width: 28px; height: 1px; background: var(--accent); }

/* ---------- Navigation ---------- */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px var(--pad);
  mix-blend-mode: normal;
  transition: background-color .4s var(--ease), border-color .4s var(--ease), padding .4s var(--ease);
  border-bottom: 1px solid transparent;
}
.nav.is-scrolled { background: rgba(17, 19, 24, .82); backdrop-filter: blur(12px); border-color: var(--line); padding-block: 14px; }

.logo { display: inline-flex; align-items: center; gap: 12px; }
.logo-mark {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  transition: border-color .3s, color .3s;
}
.logo:hover .logo-mark { border-color: var(--accent); color: var(--accent); }
.logo-name { font-size: 0.9rem; font-weight: 500; }

.nav-links { display: flex; gap: 36px; }
.nav-links a { position: relative; font-size: 0.86rem; color: var(--text-2); transition: color .3s; }
.nav-links a:hover, .nav-links a.is-active { color: var(--text); }
.nav-indicator {
  position: fixed;
  top: 0; left: 0;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0;
  transition: transform .5s var(--ease), opacity .3s;
  pointer-events: none;
}

.menu-btn { display: none; background: none; border: 1px solid var(--line); color: var(--text); font: inherit; font-size: 0.85rem; padding: 8px 14px; cursor: pointer; }
.menu-mobile {
  position: fixed;
  inset: 0;
  z-index: 35;
  background: var(--bg);
  padding: 110px var(--pad) 40px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.menu-mobile[hidden] { display: none; }
.menu-mobile ul { display: grid; gap: 6px; }
.menu-mobile ul a { font-size: clamp(2.2rem, 10vw, 3.4rem); font-weight: 500; letter-spacing: -0.03em; line-height: 1.15; }
.menu-mobile-contact { display: grid; gap: 6px; color: var(--text-2); font-size: 0.95rem; }

/* ---------- Introduction ---------- */
.intro {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  padding: 120px var(--pad) 0;
}
.intro-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: 24px;
  align-items: center;
  padding-bottom: clamp(56px, 7vw, 104px);
}
.intro-main { grid-column: 1 / span 7; }
.intro-kicker { display: flex; align-items: center; gap: 10px; font-size: 0.82rem; color: var(--text-2); letter-spacing: 0.02em; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

.intro-title {
  margin-top: 28px;
  font-size: clamp(2.4rem, 5.2vw, 5.4rem);
  line-height: 1;
  letter-spacing: -0.045em;
  text-transform: uppercase;
  font-weight: 400;
}
.intro-title em { text-transform: none; letter-spacing: -0.02em; font-size: 1.06em; color: var(--accent); }
.line { display: block; overflow: hidden; padding-bottom: 0.06em; }
.line > span { display: inline-block; }
.line-offset { padding-left: 16.6%; }

.intro-text { margin-top: 28px; max-width: 46ch; color: var(--text-2); font-size: 1rem; }

.intro-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 46px;
  padding: 0 22px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: border-color .3s, background-color .3s, color .3s;
}
.pill:hover { border-color: var(--accent); color: var(--accent); }
.pill-solid { background: var(--text); color: var(--bg); border-color: var(--text); }
.pill-solid:hover { background: var(--accent); border-color: var(--accent); color: var(--bg); }

.intro-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: clamp(40px, 5vw, 64px);
  border-top: 1px solid var(--line);
}
.intro-facts div { padding: 16px 20px 0 0; }
.intro-facts div + div { padding-left: 20px; border-left: 1px solid var(--line); }
.intro-facts dt { font-size: 0.72rem; letter-spacing: 0.08em; color: var(--text-2); }
.intro-facts dd { margin: 4px 0 0; font-size: 0.92rem; }
.intro-facts a:hover { color: var(--accent); }

.intro-image { grid-column: 9 / -1; align-self: stretch; display: flex; flex-direction: column; max-height: calc(100svh - 240px); min-height: 400px; }
.intro-image .img-reveal { flex: 1; overflow: hidden; border: 1px solid var(--line); border-bottom: 0; }
.intro-image img { width: 100%; height: 100%; object-fit: cover; object-position: center 60%; filter: grayscale(.3) brightness(.85) contrast(1.05); transition: transform 1.4s var(--ease), filter .8s; }
.intro-image:hover img { transform: scale(1.03); filter: grayscale(0) brightness(.95); }
.intro-image-bar { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; border: 1px solid var(--line); font-size: 0.72rem; color: var(--text-2); background: var(--bg-2); }
.clock time { color: var(--text); font-variant-numeric: tabular-nums; }

@keyframes scroll-drip { to { top: 100%; } }

/* ---------- À propos ---------- */
.about { padding: var(--section) var(--pad); border-top: 1px solid var(--line); }
.about-statement {
  margin-top: 40px;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.8rem, 3.2vw, 3rem);
  line-height: 1.1;
  letter-spacing: -0.01em;
  max-width: 22ch;
}
.about-intro {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: 24px;
  align-items: start;
}
.about-intro .about-statement { grid-column: 1 / span 5; position: sticky; top: 120px; }
.about-letter { grid-column: 7 / -1; margin-top: 40px; max-width: 60ch; }
.about-letter p { color: var(--text-2); font-size: 1.02rem; line-height: 1.75; }
.about-letter p + p { margin-top: 20px; }
.about-letter .about-lead { color: var(--text); font-size: clamp(1.15rem, 1.5vw, 1.35rem); line-height: 1.55; }
.about-sign { font-family: var(--serif); font-style: italic; font-size: 1.8rem; color: var(--accent) !important; margin-top: 28px !important; }

/* ---------- Compétences ---------- */
.skills { padding: var(--section) var(--pad); background: var(--bg-2); }
.skills-head { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: clamp(48px, 6vw, 88px); }
.skills-title { font-size: 0.95rem; color: var(--text-2); font-weight: 400; }
.skill-list { border-top: 1px solid var(--line); counter-reset: skill; }
.skill {
  counter-increment: skill;
  display: grid;
  grid-template-columns: 60px minmax(0, 1.45fr) minmax(0, 0.55fr);
  align-items: baseline;
  gap: 24px;
  padding: clamp(18px, 2.2vw, 28px) 0;
  border-bottom: 1px solid var(--line);
  cursor: default;
}
.skill::before { content: counter(skill, decimal-leading-zero); font-size: 0.74rem; color: var(--text-2); font-variant-numeric: tabular-nums; }
.skill-name {
  font-size: clamp(1.3rem, 2.2vw, 2rem);
  font-weight: 400;
  letter-spacing: -0.025em;
  line-height: 1.1;
  transition: transform .6s var(--ease), color .4s;
}
.skill-detail { font-size: 0.9rem; color: var(--text-2); opacity: 0.55; transform: translateX(-10px); transition: opacity .5s var(--ease), transform .6s var(--ease); }
.skill:hover .skill-name { transform: translateX(10px); color: var(--accent); }
.skill:hover .skill-detail { opacity: 1; transform: none; }

/* ---------- Projets ---------- */
.works { padding: var(--section) var(--pad); }
.works-head { display: flex; justify-content: space-between; align-items: end; margin-bottom: clamp(64px, 8vw, 120px); }
.works-title { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: clamp(1.6rem, 2.6vw, 2.4rem); line-height: 1; letter-spacing: -0.02em; }

.work {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: 24px;
  align-items: end;
}
.work + .work { margin-top: var(--section); }

.work-visual { grid-column: 1 / span 9; position: relative; display: block; padding-bottom: 8%; cursor: none; }
.frame { background: var(--bg-2); border: 1px solid var(--line); overflow: hidden; }
.frame img { transition: transform 1.1s var(--ease); }
.frame-bar { height: 26px; display: flex; align-items: center; gap: 6px; padding: 0 12px; border-bottom: 1px solid var(--line); }
.frame-bar i { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.frame-desktop { position: relative; z-index: 1; width: 86%; }
.frame-detail { position: absolute; z-index: 0; right: 0; top: -9%; width: 40%; opacity: 0.55; }
.frame-phone { position: absolute; z-index: 2; right: 4%; bottom: 0; width: 19%; border-radius: 18px; border: 5px solid #000; }
.work-visual:hover .frame-desktop img { transform: scale(1.035); }
.work-visual:hover .frame-detail { opacity: 0.8; }

.work-cursor {
  position: absolute;
  z-index: 5;
  top: 0; left: 0;
  padding: 10px 16px;
  background: var(--text);
  color: var(--bg);
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: 999px;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -50%) scale(.6);
  transition: opacity .3s, transform .4s var(--ease);
  white-space: nowrap;
}
.work-visual.is-hover .work-cursor { opacity: 1; transform: translate(-50%, -50%) scale(1); }

.work-info { grid-column: 10 / -1; padding-bottom: 8%; }
.work-num { font-family: var(--serif); font-style: italic; font-size: 1.2rem; color: var(--accent); }
.work-info h3 { margin-top: 8px; font-size: clamp(1.3rem, 1.8vw, 1.7rem); letter-spacing: -0.035em; line-height: 1.05; }
.work-meta { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; font-size: 0.86rem; color: var(--text-2); }
.work-note { margin-top: 8px; font-size: 0.82rem; color: var(--text-2); }
.work-link {
  display: inline-flex;
  margin-top: 28px;
  font-size: 0.95rem;
  font-weight: 500;
  padding-bottom: 4px;
  background: linear-gradient(var(--accent), var(--accent)) left bottom / 100% 1px no-repeat;
  transition: background-size .5s var(--ease), color .3s;
}
.work-link:hover { color: var(--accent); background-size: 30% 1px; }

/* Projet à venir */
.work-soon .soon-visual {
  grid-column: 4 / -1;
  grid-row: 1;
  aspect-ratio: 16 / 6;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  background:
    repeating-linear-gradient(-45deg, transparent 0 14px, rgba(41, 44, 52, .45) 14px 15px),
    var(--bg);
}
.soon-visual span { font-family: var(--serif); font-style: italic; font-size: clamp(1.6rem, 3vw, 2.8rem); color: var(--text-2); opacity: 0.5; }
.work-soon .work-info { grid-column: 1 / span 3; grid-row: 1; padding-bottom: 0; }

/* ---------- Méthode ---------- */
.process { padding: var(--section) var(--pad); border-top: 1px solid var(--line); position: relative; }
.process-head { margin-bottom: clamp(64px, 8vw, 120px); }
.process-title { margin-top: 24px; font-size: clamp(1.6rem, 2.6vw, 2.4rem); letter-spacing: -0.03em; line-height: 1.05; font-weight: 400; }
.steps { position: relative; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: 24px; row-gap: 0; }
.steps::before {
  content: "";
  position: absolute;
  left: 4%; right: 8%; top: 0; bottom: 0;
  background: linear-gradient(to bottom right, transparent calc(50% - 1px), var(--line) 50%, transparent calc(50% + 1px));
  pointer-events: none;
}
.step { position: relative; background: var(--bg); padding: 18px 0 28px; border-top: 1px solid var(--line); }
.step:nth-child(1) { grid-column: 1 / span 3; }
.step:nth-child(2) { grid-column: 4 / span 3; margin-top: 90px; }
.step:nth-child(3) { grid-column: 7 / span 3; margin-top: 180px; }
.step:nth-child(4) { grid-column: 10 / span 3; margin-top: 270px; }
.step-num { font-family: var(--serif); font-style: italic; font-size: clamp(1.8rem, 2.4vw, 2.4rem); line-height: 1; color: var(--accent); }
.step h3 { margin-top: 14px; font-size: 1.05rem; font-weight: 500; letter-spacing: -0.02em; }
.step p { margin-top: 10px; color: var(--text-2); font-size: 0.94rem; max-width: 30ch; }

/* ---------- Contact ---------- */
.contact { padding: var(--section) var(--pad) clamp(60px, 8vw, 120px); border-top: 1px solid var(--line); background: var(--bg-2); }
.contact-title {
  margin-top: 36px;
  font-size: clamp(2.2rem, 5.6vw, 5.6rem);
  line-height: 1;
  letter-spacing: -0.04em;
  text-transform: uppercase;
  font-weight: 400;
}
.contact-title em { text-transform: none; letter-spacing: -0.02em; font-size: 1.05em; color: var(--accent); }
.contact-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px 32px;
  margin-top: clamp(48px, 6vw, 96px);
  padding-top: 28px;
  border-top: 1px solid var(--line);
}
.contact-mail { font-size: clamp(1.15rem, 2vw, 1.7rem); letter-spacing: -0.03em; font-weight: 500; position: relative; overflow-wrap: anywhere; }
.contact-mail-text {
  background: linear-gradient(var(--accent), var(--accent)) left bottom / 0 1px no-repeat;
  padding-bottom: 6px;
  transition: background-size .6s var(--ease), color .3s;
}
.contact-mail:hover .contact-mail-text { background-size: 100% 1px; color: var(--accent); }
.contact-phone { font-size: clamp(1.15rem, 2vw, 1.7rem); letter-spacing: -0.03em; font-weight: 500; color: var(--text-2); transition: color .3s; }
.contact-phone:hover { color: var(--accent); }
.copy { font: inherit; font-size: 0.85rem; color: var(--text); background: none; border: 1px solid var(--line); padding: 10px 18px; border-radius: 999px; cursor: pointer; transition: border-color .3s, color .3s; }
.copy:hover { border-color: var(--accent); color: var(--accent); }
.copy-status { font-size: 0.85rem; color: var(--text-2); }

.footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 24px; padding: 28px var(--pad); font-size: 0.8rem; color: var(--text-2); border-top: 1px solid var(--line); background: var(--bg-2); }
.footer a:hover { color: var(--text); }

/* ---------- Animations d'apparition (actives seulement avec JS) ---------- */
.js .reveal { opacity: 0; transform: translateY(28px); transition: opacity 1s var(--ease), transform 1.1s var(--ease); }
.js .reveal.is-in { opacity: 1; transform: none; }
.js .line > span { transform: translateY(105%); transition: transform 1.2s var(--ease); }
.js .is-in .line > span, .js .line.is-in > span { transform: none; }
.js .intro-title .line:nth-child(2) > span { transition-delay: .1s; }
.js .intro-title .line:nth-child(3) > span { transition-delay: .2s; }
.js .contact-title .line:nth-child(2) > span { transition-delay: .12s; }
.js .img-reveal { clip-path: inset(100% 0 0 0); transition: clip-path 1.4s var(--ease); }
.js .img-reveal.is-in { clip-path: inset(0 0 0 0); }
.js .frame-detail.img-reveal { transition-delay: .2s; }
.js .frame-phone.img-reveal { transition-delay: .35s; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .intro-main { grid-column: 1 / span 7; }
  .intro-image { grid-column: 8 / -1; }
        .about-intro .about-statement { grid-column: 1 / -1; position: static; }
  .about-letter { grid-column: 1 / -1; }
  .work-visual { grid-column: 1 / -1; }
  .work-info { grid-column: 1 / span 6; padding-bottom: 0; margin-top: 40px; }
  .work-soon .soon-visual { grid-column: 1 / -1; }
  .work-soon .work-info { grid-row: 2; grid-column: 1 / span 6; }
  .steps::before { display: none; }
  .step:nth-child(n) { grid-column: span 6; margin-top: 0; }
  .step:nth-child(even) { margin-top: 80px; }
  .skill { grid-template-columns: 44px minmax(0, 1fr); }
  .skill-detail { grid-column: 2; opacity: 1; transform: none; }
}

@media (max-width: 760px) {
  .nav-links, .nav-indicator { display: none; }
  .menu-btn { display: block; }
  .logo-name { display: none; }
  .intro { padding-top: 100px; }
  .line-offset { padding-left: 8%; }
  .intro-main, .intro-image { grid-column: 1 / -1; }
  .intro-image { margin-top: 40px; max-height: none; min-height: 0; }
  .intro-image .img-reveal { aspect-ratio: 4 / 3; flex: none; }
  .intro-facts { grid-template-columns: minmax(0, 1fr); }
  .intro-facts div, .intro-facts div + div { padding: 12px 0; border-left: 0; border-bottom: 1px solid var(--line); }
        .work-info, .work-soon .work-info { grid-column: 1 / -1; }
  .work-visual { cursor: pointer; }
  .work-cursor { display: none; }
  .step:nth-child(n) { grid-column: 1 / -1; margin-top: 0; }
  .step + .step { margin-top: 24px; }
  .skills-head, .works-head { flex-direction: column; align-items: flex-start; gap: 18px; }
}

@media (hover: none) {
  .work-visual { cursor: pointer; }
  .work-cursor { display: none; }
  .skill-detail { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js .reveal, .js .line > span, .js .img-reveal { opacity: 1 !important; transform: none !important; clip-path: none !important; }
}
