/* ========================================
   REFERA — Design System
   Palette: Papier + Noir Profond + Cuivre
   Style: Éditorial / Brutaliste-minimal
======================================== */

:root {
  --bg: #f2ede6;
  --ink: #0d0c0a;
  --ink-muted: #5a5650;
  --accent: #c4692a;     /* cuivre brûlé */
  --accent-light: #e8b89a;
  --paper: #ece7df;
  --border: rgba(13,12,10,0.12);
  --font-main: 'Syne', sans-serif;
  --font-mono: 'DM Mono', monospace;
  --nav-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; font-size: 16px; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-main);
  overflow-x: hidden;
}

/* ---- TYPOGRAPHY ---- */
.mono { font-family: var(--font-mono); font-weight: 300; letter-spacing: 0.04em; }
em { font-style: italic; font-family: var(--font-main); }


/* ---- NAV ---- */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  z-index: 100;
  mix-blend-mode: multiply;
}
.nav-logo { display: flex; align-items: center; text-decoration: none; }
.nav-logo-img { height: 52px; width: auto; object-fit: contain; display: block; }
.nav-links {
  display: flex;
  gap: 32px;
}
.nav-links a {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 300;
  color: var(--ink-muted);
  text-decoration: none;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--accent); }

/* ---- HERO ---- */
.hero {
  min-height: 100vh;
  padding: calc(var(--nav-h) + 60px) 40px 80px;
  display: grid;
  grid-template-columns: 48px 1fr 1fr;
  grid-template-rows: auto auto;
  gap: 0 40px;
  align-items: center;
  position: relative;
}

.hero-number {
  grid-column: 1;
  grid-row: 1;
  writing-mode: vertical-rl;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--ink-muted);
  letter-spacing: 0.1em;
  align-self: start;
  padding-top: 10px;
}

.hero-content {
  grid-column: 2;
  grid-row: 1;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.10em;
  margin-bottom: 36px;
  padding: 10px 20px;
  border: 1px solid var(--accent);
  background: rgba(196, 105, 42, 0.06);
  opacity: 0;
  animation: fadeUp 0.6s 0.1s forwards;
}
.hero-tag::before {
  content: '';
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  flex-shrink: 0;
  animation: tagPulse 2s ease-in-out infinite;
}

.hero-title {
  font-size: clamp(4.5rem, 8vw, 8.5rem);
  font-weight: 800;
  line-height: 0.92;
  letter-spacing: -0.04em;
  margin-bottom: 48px;
}

.line-wrap {
  display: block;
  overflow: hidden;
}

.reveal-word {
  display: inline-block;
  opacity: 0;
  transform: translateY(110%);
  animation: slideUp 0.7s cubic-bezier(0.16,1,0.3,1) forwards;
}

.line-wrap:nth-child(1) .reveal-word { animation-delay: 0.2s; }
.line-wrap:nth-child(2) .reveal-word { animation-delay: 0.35s; }
.line-wrap:nth-child(3) .reveal-word { animation-delay: 0.5s; }
.line-wrap:nth-child(4) .reveal-word { animation-delay: 0.65s; }

.accent-stroke {
  -webkit-text-stroke: 2px var(--ink);
  color: transparent;
  font-style: italic;
}

.hero-desc {
  max-width: 400px;
  opacity: 0;
  animation: fadeUp 0.7s 0.8s forwards;
}

.hero-desc p {
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--ink-muted);
  margin-bottom: 32px;
}

/* ---- CTA Button ---- */
.cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 14px 28px;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background 0.25s, transform 0.2s;
  position: relative;
  overflow: hidden;
}
.cta-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--accent);
  transform: translateX(-101%);
  transition: transform 0.35s cubic-bezier(0.16,1,0.3,1);
}
.cta-btn:hover::before { transform: translateX(0); }
.cta-btn span, .cta-btn svg { position: relative; z-index: 1; }
.cta-btn svg { width: 20px; height: 20px; transition: transform 0.25s; }
.cta-btn:hover svg { transform: translateX(4px); }

/* ---- HERO VISUAL ---- */
.hero-visual {
  grid-column: 3;
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  animation: fadeUp 0.8s 0.6s forwards;
}

.visual-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 8px;
  width: 360px;
  height: 360px;
}

.vg-cell {
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  transition: background 0.3s;
}

.cell-1 { background: var(--ink); grid-column: 1 / 3; }
.cell-2 { background: var(--accent); animation: pulse-cell 3s 0s infinite alternate; }
.cell-3 { background: var(--paper); border: 1px solid var(--border); }
.cell-4 {
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.05em;
}
.cell-4 .cell-label {
  font-size: 0.65rem;
  letter-spacing: 0.18em;
  color: var(--ink-muted);
  writing-mode: vertical-rl;
}
.cell-5 {
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  grid-column: 2 / 4;
  position: relative;
}
.orbit-ring {
  width: 100px; height: 100px;
  border: 1px solid var(--border);
  border-radius: 50%;
  position: absolute;
  animation: spin 8s linear infinite;
}
.orbit-ring::after {
  content: '';
  position: absolute;
  top: -4px; left: 50%;
  width: 8px; height: 8px;
  background: var(--accent);
  border-radius: 50%;
  transform: translateX(-50%);
}
.orbit-core {
  width: 20px; height: 20px;
  background: var(--ink);
  border-radius: 50%;
}
.cell-6 { background: var(--ink); grid-column: 1; opacity: 0.08; }

/* ---- HERO SCROLL ---- */
.hero-scroll {
  position: absolute;
  bottom: 40px;
  left: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  opacity: 0;
  animation: fadeUp 0.6s 1.2s forwards;
}
.scroll-line {
  width: 1px;
  height: 50px;
  background: var(--ink-muted);
  animation: scrollPulse 2s ease-in-out infinite;
}
.hero-scroll span {
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

/* ---- MARQUEE ---- */
.marquee-wrap {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  padding: 14px 0;
  background: var(--ink);
}
.marquee-track {
  display: flex;
  gap: 40px;
  width: max-content;
  animation: marquee 24s linear infinite;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--bg);
}
.marquee-track .sep { color: var(--accent); }

/* ---- SECTIONS ---- */
.section {
  padding: 120px 40px;
}
.section-header {
  display: flex;
  align-items: flex-start;
  gap: 32px;
  margin-bottom: 80px;
}
.section-num {
  font-size: 0.72rem;
  color: var(--ink-muted);
  padding-top: 6px;
  min-width: 24px;
}
.section-title {
  font-size: clamp(2.8rem, 5vw, 5rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
}

/* ---- PILLARS ---- */
.pillars {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
}
.pillar {
  padding: 48px 40px;
  border-left: 1px solid var(--border);
  position: relative;
  transition: background 0.3s;
}
.pillar:last-child { border-right: 1px solid var(--border); }
.pillar:hover { background: var(--paper); }
.pillar-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 32px;
}
.pillar-num {
  font-size: 0.7rem;
  color: var(--ink-muted);
}
.pillar-icon {
  width: 40px; height: 40px;
  color: var(--accent);
}
.pillar h3 {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
  line-height: 1.1;
}
.pillar p {
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--ink-muted);
}

/* ---- PROJECTS ---- */
.realisations { background: var(--paper); }
.projects { display: flex; flex-direction: column; gap: 0; }

.project {
  display: grid;
  grid-template-columns: 120px 1fr 1fr;
  gap: 0 60px;
  padding: 64px 0;
  border-top: 1px solid var(--border);
  align-items: center;
}
.project:last-child { border-bottom: 1px solid var(--border); }
.project-alt { direction: rtl; }
.project-alt > * { direction: ltr; }

.project-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.project-num { font-size: 0.7rem; color: var(--ink-muted); }
.project-type { font-size: 0.7rem; color: var(--accent); text-transform: uppercase; letter-spacing: 0.08em; }

.project-title {
  font-size: clamp(2rem, 3.5vw, 3.2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 20px;
}
.project-desc {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--ink-muted);
  max-width: 380px;
  margin-bottom: 24px;
}
.project-tags {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.project-tags span {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  padding: 5px 12px;
  border: 1px solid var(--border);
  color: var(--ink-muted);
  text-transform: uppercase;
}

/* ---- PROJECT VISUALS ---- */
.project-visual {
  border-radius: 2px;
  overflow: hidden;
  position: relative;
  height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 3D Tile Visual */
.pv-1 { background: #1a1613; }
.pv-grid {
  display: grid;
  grid-template-columns: repeat(3, 60px);
  grid-template-rows: repeat(3, 60px);
  gap: 3px;
  transform: perspective(400px) rotateX(30deg) rotateY(-15deg);
  animation: float3d 6s ease-in-out infinite;
}
.pv-tile {
  background: #2a2420;
  border: 1px solid rgba(255,255,255,0.05);
  transition: background 0.3s;
}
.t1 { background: #d4cdc5; }
.t2 { background: #c9c2ba; }
.t3 { background: #bfb8b0; }
.t4 { background: #c9c2ba; }
.t5 { background: var(--accent); opacity: 0.6; }
.t6 { background: #d4cdc5; }
.t7 { background: #bfb8b0; }
.t8 { background: #c9c2ba; }
.t9 { background: #d4cdc5; }

/* Interview Visual */
.pv-2 { background: var(--ink); padding: 24px; }
.interview-card {
  width: 100%;
  max-width: 280px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px;
  padding: 20px;
}
.ic-top { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.ic-avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  flex-shrink: 0;
}
.ic-info { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.ic-bar { height: 8px; background: rgba(255,255,255,0.15); border-radius: 2px; }
.ic-bar.thin { height: 6px; }
.ic-bar.w40 { width: 40%; }
.ic-bar.w50 { width: 50%; }
.ic-bar.w60 { width: 60%; }
.ic-bar.w80 { width: 80%; }
.ic-bar.w90 { width: 90%; }
.ic-bubble {
  background: rgba(196,105,42,0.12);
  border-left: 2px solid var(--accent);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}
.ic-mic {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 10px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 2px;
  color: var(--accent);
}
.ic-mic svg { width: 18px; height: 18px; }
.mic-wave {
  width: 40px;
  height: 20px;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 40 20' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 10 Q5 2 10 10 Q15 18 20 10 Q25 2 30 10 Q35 18 40 10' fill='none' stroke='%23c4692a' stroke-width='1.5'/%3E%3C/svg%3E") center/contain no-repeat;
  animation: waveAnim 1.2s ease-in-out infinite;
}

/* ---- PROCESS ---- */
.process { background: var(--bg); }
.steps {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  position: relative;
}
.step {
  padding: 40px 32px;
  border-left: 1px solid var(--border);
  position: relative;
}
.step:last-child { border-right: 1px solid var(--border); }
.step-line {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--border);
}
.step-dot {
  position: absolute;
  top: -5px; left: 32px;
  width: 10px; height: 10px;
  background: var(--accent);
  border-radius: 50%;
}
.step-content { padding-top: 24px; }
.step-num {
  display: block;
  font-size: 0.7rem;
  color: var(--accent);
  letter-spacing: 0.1em;
  margin-bottom: 16px;
}
.step h4 {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}
.step p {
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--ink-muted);
}

/* ---- CONTACT ---- */
.contact-section {
  background: var(--ink);
  color: var(--bg);
}
.contact-inner {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 80px;
  align-items: start;
}
.contact-left .section-num { color: var(--ink-muted); }
.contact-title {
  font-size: clamp(2.5rem, 4vw, 4.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  margin: 16px 0 24px;
}
.contact-title em { color: var(--accent); font-style: italic; }
.contact-sub {
  font-size: 0.95rem;
  line-height: 1.7;
  color: rgba(242,237,230,0.55);
  max-width: 340px;
}

/* ---- FORM ---- */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.form-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.form-field label {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(242,237,230,0.45);
}
.form-field input,
.form-field textarea {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--bg);
  font-family: var(--font-main);
  font-size: 0.95rem;
  padding: 14px 16px;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
  resize: none;
  border-radius: 0;
}
.form-field input::placeholder,
.form-field textarea::placeholder { color: rgba(242,237,230,0.25); }
.form-field input:focus,
.form-field textarea:focus {
  border-color: var(--accent);
  background: rgba(196,105,42,0.05);
}

.submit-btn {
  align-self: flex-start;
  background: var(--accent);
  color: var(--bg);
}
.submit-btn::before { background: var(--bg); }
.submit-btn:hover { color: var(--ink); }

/* ---- FOOTER ---- */
.footer {
  background: var(--ink);
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: 28px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--bg);
}
.footer-left { display: flex; align-items: center; gap: 24px; }
.footer-logo-img { height: 36px; width: auto; object-fit: contain; display: block; }
.footer-tagline { font-size: 0.72rem; color: rgba(242,237,230,0.4); }
.footer-right { font-size: 0.72rem; color: rgba(242,237,230,0.35); }
.footer-links { display: flex; gap: 24px; }
.footer-links a {
  font-size: 0.72rem;
  color: rgba(242,237,230,0.4);
  text-decoration: none;
  transition: color 0.2s;
}
.footer-links a:hover { color: var(--accent); }

/* ---- KEYFRAMES ---- */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(110%); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes spin {
  from { transform: rotate(0); }
  to   { transform: rotate(360deg); }
}
@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
@keyframes pulse-cell {
  from { opacity: 1; }
  to   { opacity: 0.7; }
}
@keyframes scrollPulse {
  0%, 100% { scaleY: 1; opacity: 1; }
  50% { transform: scaleY(0.6); opacity: 0.4; }
}
@keyframes float3d {
  0%, 100% { transform: perspective(400px) rotateX(30deg) rotateY(-15deg) translateY(0); }
  50%       { transform: perspective(400px) rotateX(28deg) rotateY(-13deg) translateY(-8px); }
}
@keyframes waveAnim {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}
@keyframes tagPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

/* ---- SCROLL ANIMATIONS ---- */
.fade-in {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s cubic-bezier(0.16,1,0.3,1), transform 0.7s cubic-bezier(0.16,1,0.3,1);
}
.fade-in.visible {
  opacity: 1;
  transform: none;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 1024px) {
  .hero { grid-template-columns: 48px 1fr; }
  .hero-visual { display: none; }
  .pillars { grid-template-columns: 1fr; }
  .pillar { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
  .steps { grid-template-columns: repeat(3, 1fr); }
  .contact-inner { grid-template-columns: 1fr; gap: 48px; }
  .project { grid-template-columns: 1fr; }
  .project-alt { direction: ltr; }
  .project-visual { height: 200px; }
}

@media (max-width: 640px) {
  .nav { padding: 0 20px; }
  .hero { padding: calc(var(--nav-h) + 40px) 20px 60px; grid-template-columns: 1fr; }
  .hero-number { display: none; }
  .hero-title { font-size: clamp(3.5rem, 14vw, 5rem); }
  .section { padding: 80px 20px; }
  .steps { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .footer { flex-direction: column; gap: 12px; text-align: center; }
  .footer-links { justify-content: center; }
}
