/* ============================================================
   Portfolio - "Fog / Editorial Cream" design system
   Recréation du thème 21st.dev @syedmoin-lab/portfolio :
   charcoal + brume grise, typo grotesque massive, texte crème,
   minimalisme éditorial, pilules outline, cartes rounded-square.
   Police d'origine (propriétaire) remplacée par Archivo (libre).
   Fully self-contained, no runtime dependencies.
   ============================================================ */

:root {
  /* Backgrounds / surfaces */
  --bg:          #17171b;   /* charcoal quasi-noir */
  --bg-deep:     #101013;
  --surface:     rgba(236, 230, 217, 0.03);
  --surface-2:   rgba(236, 230, 217, 0.06);

  /* Fog (brume grise) */
  --fog-1: rgba(150, 152, 162, 0.16);
  --fog-2: rgba(120, 122, 134, 0.13);
  --fog-3: rgba(90, 92, 104, 0.10);

  /* Text - crème / blanc cassé chaud */
  --fg:        #ece6d9;
  --fg-bright: #f5f0e6;
  --fg-muted:  rgba(236, 230, 217, 0.60);
  --fg-dim:    rgba(236, 230, 217, 0.38);

  /* Lines */
  --line:        rgba(236, 230, 217, 0.14);
  --line-bright: rgba(236, 230, 217, 0.34);

  /* accent = la crème elle-même (thème monochrome) */
  --accent:     var(--fg-bright);

  --radius:    20px;   /* rounded-square façon avatar */
  --radius-lg: 26px;
  --pill:      999px;
  --maxw:      1200px;

  --display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --sans:    "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono:    "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  position: relative;
}

/* --- Brume : nappes radiales douces qui dérivent lentement --- */
body::before {
  content: "";
  position: fixed;
  inset: -20%;
  z-index: -2;
  background:
    radial-gradient(38% 42% at 22% 30%, var(--fog-1), transparent 70%),
    radial-gradient(34% 40% at 78% 22%, var(--fog-2), transparent 68%),
    radial-gradient(46% 50% at 62% 78%, var(--fog-1), transparent 72%),
    radial-gradient(40% 44% at 30% 82%, var(--fog-3), transparent 70%),
    radial-gradient(60% 60% at 50% 50%, var(--fog-3), transparent 80%);
  filter: blur(20px);
  animation: drift 26s ease-in-out infinite alternate;
}
@keyframes drift {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  50%  { transform: translate3d(2%, -1.5%, 0) scale(1.06); }
  100% { transform: translate3d(-2%, 1.5%, 0) scale(1.03); }
}

/* --- Grain / bruit fin par-dessus (comme la texture du template) --- */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

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

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 clamp(24px, 5vw, 56px); }

.mono { font-family: var(--mono); letter-spacing: 0; }
.accent { color: var(--fg-bright); }
.cyan   { color: var(--fg-muted); }

/* ---------- Nav ---------- */
header.nav {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(6px);
  background: rgba(23, 23, 27, 0.35);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 84px; }
.brand {
  font-family: var(--display); font-weight: 800; font-size: 1.15rem;
  letter-spacing: -0.02em; color: var(--fg-bright);
}
.nav-links { display: flex; gap: 40px; font-size: 15px; }
.nav-links a {
  color: var(--fg); font-weight: 700; letter-spacing: -0.01em;
  padding-bottom: 2px; border-bottom: 1px solid transparent;
  transition: border-color 0.25s var(--ease), color 0.25s var(--ease);
}
.nav-links a:hover { border-color: var(--line-bright); }
.nav-toggle { display: none; background: none; border: 0; color: var(--fg); font-size: 22px; cursor: pointer; }

/* ---------- Hero ---------- */
.hero { padding: clamp(64px, 12vh, 140px) 0 clamp(72px, 12vh, 120px); position: relative; }
.badge {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.04em;
  color: var(--fg-muted); text-transform: uppercase;
  border: 1px solid var(--line-bright); border-radius: var(--pill);
  padding: 8px 16px; margin-bottom: 34px;
}
.badge .pulse {
  width: 7px; height: 7px; border-radius: 50%; background: var(--fg-bright);
  box-shadow: 0 0 8px var(--fg-bright); animation: pulse 2.4s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.35; }
}
.hero h1 {
  font-family: var(--display); font-weight: 900;
  font-size: clamp(3rem, 11vw, 8.5rem);
  line-height: 0.92; letter-spacing: -0.03em;
  color: var(--fg-bright);
  text-wrap: balance;
}
.hero h1 .grad {
  background: linear-gradient(180deg, var(--fg-bright), var(--fg-muted));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p.lead {
  color: var(--fg-muted); font-size: clamp(1.05rem, 1.6vw, 1.3rem);
  max-width: 640px; margin-top: 30px; line-height: 1.55;
}
.hero p.lead .accent, .hero p.lead .mono.accent {
  color: var(--fg-bright); text-decoration: underline;
  text-decoration-color: var(--line-bright); text-underline-offset: 3px;
}
.hero-cta { display: flex; gap: 16px; margin-top: 44px; flex-wrap: wrap; }

.btn {
  font-family: var(--display); font-size: 13px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  padding: 15px 30px; border-radius: var(--pill); cursor: pointer;
  transition: background 0.25s var(--ease), color 0.25s var(--ease), border-color 0.25s var(--ease), transform 0.25s var(--ease);
  border: 1px solid var(--line-bright); display: inline-flex; align-items: center; gap: 9px;
}
.btn-primary { background: var(--fg-bright); color: #17171b; border-color: var(--fg-bright); }
.btn-primary:hover { transform: translateY(-2px); background: #fff; }
.btn-ghost { background: transparent; color: var(--fg); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--fg); }

.hero-stats { display: flex; gap: clamp(32px, 5vw, 64px); margin-top: 64px; flex-wrap: wrap; }
.stat .num { font-family: var(--display); font-size: 2.2rem; font-weight: 900; color: var(--fg-bright); letter-spacing: -0.03em; }
.stat .lbl { font-size: 12px; color: var(--fg-dim); text-transform: uppercase; letter-spacing: 0.12em; margin-top: 2px; }

/* ---------- Sections ---------- */
section { padding: clamp(72px, 12vh, 128px) 0; }
.sec-head { margin-bottom: 56px; max-width: 720px; }
.sec-head .kicker { font-family: var(--mono); font-size: 12px; color: var(--fg-dim); letter-spacing: 0.1em; text-transform: uppercase; }
.sec-head h2 {
  font-family: var(--display); font-weight: 900;
  font-size: clamp(2.2rem, 5.5vw, 4rem); letter-spacing: -0.03em;
  margin-top: 14px; line-height: 0.98; color: var(--fg-bright);
}
.sec-head p { color: var(--fg-muted); margin-top: 18px; font-size: 1.05rem; }

/* ---------- Infra / Rack ---------- */
.infra-grid { display: grid; grid-template-columns: 340px 1fr; gap: 44px; align-items: start; }

.rack {
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--surface); backdrop-filter: blur(4px);
  padding: 18px; position: relative;
}
.rack-title {
  font-family: var(--mono); font-size: 12px; color: var(--fg-dim);
  text-align: center; margin-bottom: 14px; letter-spacing: 0.08em;
}
.ru {
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface); margin-bottom: 9px; padding: 13px 15px;
  display: flex; align-items: center; gap: 13px;
  transition: border-color 0.25s var(--ease), background 0.25s var(--ease), transform 0.25s var(--ease);
  cursor: default; position: relative;
}
.ru[data-desc] { cursor: pointer; }
.ru:hover { border-color: var(--line-bright); background: var(--surface-2); transform: translateX(4px); }
.ru[data-desc]:focus-visible { outline: none; border-color: var(--fg); box-shadow: 0 0 0 2px var(--line-bright); }
.ru .u-count { font-family: var(--mono); font-size: 11px; color: var(--fg-dim); min-width: 26px; }
.ru .u-name { font-family: var(--display); font-size: 14px; font-weight: 700; color: var(--fg-bright); }
.ru .u-sub { font-size: 12px; color: var(--fg-muted); }
.ru .led { width: 8px; height: 8px; border-radius: 50%; background: var(--fg-bright); margin-left: auto; box-shadow: 0 0 8px var(--fg-bright); }
.ru.blank { background: repeating-linear-gradient(45deg, rgba(236,230,217,0.02), rgba(236,230,217,0.02) 6px, rgba(236,230,217,0.05) 6px, rgba(236,230,217,0.05) 12px); opacity: 0.55; justify-content: center; }
.ru.blank .u-name { color: var(--fg-dim); font-weight: 400; }

.spec-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.spec {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); backdrop-filter: blur(4px); padding: 24px;
  transition: border-color 0.25s var(--ease), transform 0.25s var(--ease), background 0.25s var(--ease);
}
.spec:hover { border-color: var(--line-bright); background: var(--surface-2); transform: translateY(-3px); }
.spec .tag { font-family: var(--mono); font-size: 11px; color: var(--fg-dim); text-transform: uppercase; letter-spacing: 0.1em; }
.spec h3 { font-family: var(--display); font-weight: 800; font-size: 1.15rem; margin: 10px 0 4px; color: var(--fg-bright); letter-spacing: -0.02em; }
.spec .model { font-family: var(--mono); font-size: 12px; color: var(--fg-dim); margin-bottom: 14px; }
.spec ul { list-style: none; display: flex; flex-direction: column; gap: 7px; }
.spec li { font-size: 13.5px; color: var(--fg-muted); display: flex; gap: 9px; }
.spec li::before { content: "-"; color: var(--fg-dim); }

/* ---------- Services grid ---------- */
.svc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 16px; }
.svc {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); backdrop-filter: blur(4px);
  padding: 20px 16px; text-align: center; width: 100%;
  font-family: var(--display); font-weight: 700; font-size: 14px; color: var(--fg);
  cursor: pointer; -webkit-appearance: none; appearance: none; line-height: 1.5;
  transition: border-color 0.25s var(--ease), background 0.25s var(--ease), transform 0.25s var(--ease);
}
.svc:hover { border-color: var(--line-bright); background: var(--surface-2); transform: translateY(-3px); }
.svc:focus-visible { outline: none; border-color: var(--fg); box-shadow: 0 0 0 2px var(--line-bright); }
.svc small { font-family: var(--mono); font-weight: 400; color: var(--fg-dim); font-size: 11px; }
.svc .ic { font-size: 24px; display: block; margin-bottom: 10px; filter: grayscale(1) opacity(0.85); }
.svc .ic-img {
  display: block; height: 44px; width: auto; max-width: 88%;
  margin: 0 auto 12px; object-fit: contain;
  background: #f2ede2; border-radius: 9px; padding: 5px;
}

.svc-hint { font-family: var(--mono); font-size: 12px; color: var(--fg-dim); text-align: center; margin-top: 24px; }

/* ---------- Modale service ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(16, 16, 19, 0.72); backdrop-filter: blur(8px);
  animation: fade 0.25s var(--ease);
}
.modal-card {
  position: relative; z-index: 1; width: 100%; max-width: 480px;
  border: 1px solid var(--line-bright); border-radius: var(--radius-lg);
  background: linear-gradient(180deg, #1e1e23, #17171b);
  padding: 40px 36px 36px; text-align: left;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  animation: pop 0.28s var(--ease);
}
.modal-close {
  position: absolute; top: 18px; right: 18px;
  width: 34px; height: 34px; border-radius: var(--pill);
  background: transparent; border: 1px solid var(--line); color: var(--fg-muted);
  font-size: 14px; cursor: pointer; line-height: 1;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}
.modal-close:hover { border-color: var(--fg); color: var(--fg-bright); }
.modal-icon { font-size: 40px; display: block; margin-bottom: 18px; }
.modal-icon img {
  height: 64px; width: auto; max-width: 60%; object-fit: contain;
  background: #f2ede2; border-radius: 12px; padding: 8px;
}
.modal-cat { font-size: 12px; color: var(--fg-dim); text-transform: uppercase; letter-spacing: 0.1em; }
.modal-name { font-family: var(--display); font-weight: 900; font-size: 2rem; letter-spacing: -0.03em; color: var(--fg-bright); margin: 8px 0 16px; }
.modal-desc { color: var(--fg-muted); font-size: 1.02rem; line-height: 1.6; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(0.98); } to { opacity: 1; transform: none; } }

/* ---------- Projects ---------- */
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 22px; }
.proj {
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--surface); backdrop-filter: blur(4px);
  padding: 28px; position: relative; overflow: hidden;
  transition: border-color 0.25s var(--ease), transform 0.25s var(--ease), background 0.25s var(--ease);
}
.proj[data-desc] { cursor: pointer; }
.proj:hover { border-color: var(--line-bright); background: var(--surface-2); transform: translateY(-4px); }
.proj[data-desc]:focus-visible { outline: none; border-color: var(--fg); box-shadow: 0 0 0 2px var(--line-bright); }
.proj .tags { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 16px; }
.proj .tags span { font-family: var(--mono); font-size: 11px; color: var(--fg-dim); border: 1px solid var(--line); border-radius: var(--pill); padding: 3px 11px; }
.proj h3 { font-family: var(--display); font-weight: 800; font-size: 1.3rem; margin-bottom: 10px; color: var(--fg-bright); letter-spacing: -0.02em; }
.proj p { font-size: 14.5px; color: var(--fg-muted); }

/* ---------- Contact / footer ---------- */
.contact { text-align: center; }
.contact .kicker { color: var(--fg-dim) !important; }
.contact h2 {
  font-family: var(--display); font-weight: 900;
  font-size: clamp(2.4rem, 7vw, 5rem); letter-spacing: -0.03em;
  color: var(--fg-bright); line-height: 0.98;
}
.contact p { color: var(--fg-muted); margin: 20px auto 36px; max-width: 500px; font-size: 1.05rem; }
footer { border-top: 1px solid var(--line); padding: 40px 0; color: var(--fg-dim); font-size: 13px; }
.footer-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; font-family: var(--mono); }

/* ---------- Reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .infra-grid { grid-template-columns: 1fr; }
  .rack { max-width: 380px; margin: 0 auto; }
  .nav-links { display: none; }
  .nav-links.open {
    display: flex; flex-direction: column; position: absolute; top: 84px; left: 0; right: 0;
    background: var(--bg-deep); border-bottom: 1px solid var(--line); padding: 22px 24px; gap: 20px;
  }
  .nav-toggle { display: block; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
  body::before { animation: none; }
}
