/* ─────────────────────────────────────────────────────────────
   Hichem Bedjaoui — Portfolio
   Editorial / minimalist — warm cream, big serif display, one accent
   ───────────────────────────────────────────────────────────── */

:root {
  /* Light (default) — warm cream */
  --bg:      #f7f4ee;
  --bg-2:    #efeae0;
  --fg:      #1a1712;
  --muted:   #6b6559;
  --faint:   #a29a8c;
  --line:    rgba(26, 23, 18, 0.13);
  --line-2:  rgba(26, 23, 18, 0.22);
  --accent:  #c4451f;
  --sel:     rgba(196, 69, 31, 0.16);
}

[data-theme="dark"] {
  --bg:      #14120f;
  --bg-2:    #1c1a15;
  --fg:      #f2ede3;
  --muted:   rgba(242, 237, 227, 0.60);
  --faint:   rgba(242, 237, 227, 0.34);
  --line:    rgba(242, 237, 227, 0.14);
  --line-2:  rgba(242, 237, 227, 0.26);
  --accent:  #e57748;
  --sel:     rgba(229, 119, 72, 0.22);
}

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

html { scroll-behavior: smooth; scroll-padding-top: 80px; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background 0.3s ease, color 0.3s ease;
}
::selection { background: var(--sel); }

.serif { font-family: "Fraunces", "Georgia", serif; }

/* ── Layout ─────────────────────────────────────────────────── */
.wrap { width: 100%; max-width: 940px; margin: 0 auto; padding: 0 32px; }

section { padding: 96px 0; border-top: 1px solid var(--line); }
#hero { border-top: none; }

/* Section label: "01 / À PROPOS" */
.sec-label {
  display: flex; align-items: center; gap: 12px;
  font-size: 0.72rem; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--muted); font-weight: 600; margin-bottom: 44px;
}
.sec-label .num { color: var(--accent); font-variant-numeric: tabular-nums; }
.sec-label::after { content: ""; flex: 1; height: 1px; background: var(--line); }

h2.headline {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 400; font-size: clamp(1.9rem, 4.5vw, 3rem);
  line-height: 1.08; letter-spacing: -0.02em; margin-bottom: 40px;
  max-width: 20ch;
}

/* ── Nav ────────────────────────────────────────────────────── */
nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: 940px; margin: 0 auto; padding: 16px 32px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand {
  font-family: "Fraunces", Georgia, serif; font-size: 1.15rem; font-weight: 500;
  letter-spacing: -0.01em; text-decoration: none; color: var(--fg);
}
.brand em { color: var(--accent); font-style: italic; }
.nav-links { display: flex; align-items: center; gap: 30px; }
.nav-links a {
  color: var(--muted); text-decoration: none; font-size: 0.82rem; font-weight: 500;
  letter-spacing: 0.02em; position: relative; transition: color 0.2s ease;
}
.nav-links a::after {
  content: ""; position: absolute; left: 0; bottom: -4px; width: 0; height: 1px;
  background: var(--accent); transition: width 0.25s ease;
}
.nav-links a:hover { color: var(--fg); }
.nav-links a:hover::after { width: 100%; }
.nav-tools { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 34px; min-width: 34px; padding: 0 10px;
  border: 1px solid var(--line-2); border-radius: 999px;
  background: transparent; color: var(--fg);
  cursor: pointer; font-size: 0.76rem; font-weight: 600; letter-spacing: 0.04em;
  transition: border-color 0.2s ease, color 0.2s ease, transform 0.1s ease;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.icon-btn:active { transform: scale(0.94); }

/* ── Hero ───────────────────────────────────────────────────── */
#hero { padding-top: 84px; padding-bottom: 20px; }
.hero-top {
  display: flex; align-items: center; gap: 12px;
  font-size: 0.82rem; color: var(--muted); margin-bottom: 40px;
  letter-spacing: 0.02em;
}
.hero-top .dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 0 var(--accent); animation: pulse 2.4s infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); }
  70%  { box-shadow: 0 0 0 8px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.hero-display {
  font-family: "Fraunces", Georgia, serif; font-weight: 380;
  font-size: clamp(3.4rem, 13vw, 8.2rem); line-height: 0.94;
  letter-spacing: -0.035em; margin-bottom: 34px;
}
.hero-display .light { color: var(--faint); }
.hero-display em { font-style: italic; color: var(--accent); }
.hero-grid {
  display: grid; grid-template-columns: 1fr minmax(0, 232px);
  gap: 52px; align-items: start;
}
.hero-portrait {
  position: relative; width: 100%; aspect-ratio: 1 / 1;
  border-radius: 16px; overflow: hidden;
  border: 1px solid var(--line-2); background: var(--bg-2);
  margin-top: 6px;
}
.hero-portrait img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  filter: grayscale(0.35) contrast(1.02);
  transition: filter 0.45s ease, transform 0.5s ease;
}
.hero-portrait:hover img { filter: none; transform: scale(1.03); }
.portrait-mono {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: "Fraunces", Georgia, serif; font-weight: 400; font-size: 3.6rem;
  letter-spacing: 0.02em; color: var(--faint);
  background: radial-gradient(120% 100% at 30% 20%, var(--bg-2), var(--bg));
}
.portrait-mono::after {
  content: ""; position: absolute; left: 16px; bottom: 16px;
  width: 22px; height: 2px; background: var(--accent);
}

.hero-sub {
  font-size: 0.82rem; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--muted); font-weight: 600; margin-bottom: 28px;
}
.hero-lead {
  font-size: 1.25rem; line-height: 1.6; color: var(--fg);
  max-width: 30ch; margin-bottom: 30px; font-weight: 400;
}
.hero-lead .serif { font-style: italic; }
.hero-meta {
  display: flex; flex-wrap: wrap; gap: 28px; color: var(--muted);
  font-size: 0.9rem; margin-bottom: 40px;
}
.hero-meta span { display: inline-flex; align-items: center; gap: 8px; }
.hero-meta .k { color: var(--faint); }

.cta-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 13px 24px; border-radius: 999px; font-weight: 600; font-size: 0.9rem;
  text-decoration: none; cursor: pointer; border: 1px solid transparent;
  transition: transform 0.14s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.btn-solid { background: var(--fg); color: var(--bg); }
.btn-solid:hover { background: var(--accent); transform: translateY(-2px); }
.btn-line { border-color: var(--line-2); color: var(--fg); }
.btn-line:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }
.btn svg { width: 16px; height: 16px; }

/* ── About ──────────────────────────────────────────────────── */
.split { display: grid; grid-template-columns: 1fr 1.4fr; gap: 56px; }
.split .lead-serif {
  font-family: "Fraunces", Georgia, serif; font-weight: 400;
  font-size: 1.5rem; line-height: 1.4; letter-spacing: -0.01em;
}
.about-body p { color: var(--muted); font-size: 1.05rem; }
.about-body p + p { margin-top: 18px; }
.about-body strong { color: var(--fg); font-weight: 600; }

/* ── Skills ─────────────────────────────────────────────────── */
.skills-list { display: flex; flex-direction: column; }
.skill-row {
  display: grid; grid-template-columns: 200px 1fr; gap: 32px;
  padding: 22px 0; border-top: 1px solid var(--line);
}
.skill-row:first-child { border-top: none; }
.skill-row h3 {
  font-size: 0.78rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--fg); font-weight: 700; padding-top: 4px;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 5px 13px; border-radius: 999px; font-size: 0.86rem; font-weight: 500;
  border: 1px solid var(--line-2); color: var(--muted); background: transparent;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.chip:hover { border-color: var(--accent); color: var(--fg); }

/* ── Experience ─────────────────────────────────────────────── */
.exp-row {
  display: grid; grid-template-columns: 160px 1fr; gap: 32px;
  padding: 30px 0; border-top: 1px solid var(--line);
  transition: background 0.2s ease;
}
.exp-row:first-child { border-top: none; }
.exp-row .yr {
  font-family: "Fraunces", Georgia, serif; font-size: 1rem; color: var(--faint);
  font-variant-numeric: tabular-nums; padding-top: 3px;
}
.exp-row h3 {
  font-family: "Fraunces", Georgia, serif; font-weight: 500;
  font-size: 1.4rem; letter-spacing: -0.01em; line-height: 1.2;
}
.exp-row .org { color: var(--accent); font-weight: 600; font-size: 0.92rem; margin: 4px 0 10px; }
.exp-row .org .place { color: var(--faint); font-weight: 400; }
.exp-row p { color: var(--muted); font-size: 0.98rem; max-width: 60ch; }

/* ── Projects ───────────────────────────────────────────────── */
.project {
  padding: 40px 0; border-top: 1px solid var(--line);
}
.project:first-of-type { border-top: none; }
.project .ptag {
  font-size: 0.72rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--accent); font-weight: 700; margin-bottom: 16px;
}
.project h3 {
  font-family: "Fraunces", Georgia, serif; font-weight: 400;
  font-size: clamp(2rem, 5vw, 3.2rem); line-height: 1; letter-spacing: -0.02em;
  margin-bottom: 20px;
}
.project p { color: var(--muted); font-size: 1.1rem; max-width: 58ch; margin-bottom: 24px; }
.project .stack {
  display: flex; flex-wrap: wrap; gap: 10px 22px; margin-bottom: 26px;
  font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint);
}
.project-link {
  display: inline-flex; align-items: center; gap: 10px; color: var(--fg);
  text-decoration: none; font-weight: 600; font-size: 0.95rem;
  border-bottom: 1px solid var(--fg); padding-bottom: 3px;
  transition: color 0.2s ease, border-color 0.2s ease, gap 0.2s ease;
}
.project-link:hover { color: var(--accent); border-color: var(--accent); gap: 14px; }
.project-link svg { width: 15px; height: 15px; }

/* ── Education ──────────────────────────────────────────────── */
.edu-row {
  display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: baseline;
  padding: 22px 0; border-top: 1px solid var(--line);
}
.edu-row:first-child { border-top: none; }
.edu-row h4 { font-family: "Fraunces", Georgia, serif; font-weight: 500; font-size: 1.2rem; }
.edu-row .sub { color: var(--muted); font-size: 0.95rem; margin-top: 2px; }
.edu-row .side { color: var(--faint); font-size: 0.85rem; letter-spacing: 0.04em; text-align: right; white-space: nowrap; }

/* ── Contact ────────────────────────────────────────────────── */
#contact { text-align: left; }
.contact-big {
  font-family: "Fraunces", Georgia, serif; font-weight: 400;
  font-size: clamp(2.6rem, 8vw, 5.5rem); line-height: 0.98; letter-spacing: -0.03em;
  margin-bottom: 30px;
}
.contact-big em { font-style: italic; color: var(--accent); }
#contact .lead { color: var(--muted); font-size: 1.15rem; max-width: 40ch; margin-bottom: 34px; }

footer {
  border-top: 1px solid var(--line); padding: 34px 0 60px;
  display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between;
  color: var(--faint); font-size: 0.85rem;
}
footer a { color: var(--muted); text-decoration: none; }
footer a:hover { color: var(--accent); }
.footer-social { display: flex; gap: 24px; }

/* ── Reveal ─────────────────────────────────────────────────── */
.reveal { opacity: 0; transform: translateY(20px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
  .dot { animation: none; }
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 760px) {
  body { font-size: 16px; }
  .nav-links { display: none; }
  .hero-grid { grid-template-columns: 1fr; gap: 32px; }
  .hero-portrait { max-width: 168px; aspect-ratio: 1 / 1; border-radius: 14px; }
  .portrait-mono { font-size: 2.6rem; }
  section { padding: 68px 0; }
  .split { grid-template-columns: 1fr; gap: 22px; }
  .skill-row { grid-template-columns: 1fr; gap: 12px; }
  .exp-row { grid-template-columns: 1fr; gap: 6px; }
  .exp-row .yr { padding-top: 0; }
  .edu-row { grid-template-columns: 1fr; }
  .edu-row .side { text-align: left; }
}
