/* ==========================================================
   Loudjaine Bensalem — Portfolio
   One small stylesheet for every page (replaces the 240 KB
   Bootstrap theme from the original template).
   ========================================================== */

/* ---------- 0. Fonts (bundled, so the site works offline) ---------- */
@font-face { font-family: "Mulish"; src: url("../assets/fonts/mulish-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Mulish"; src: url("../assets/fonts/mulish-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Mulish"; src: url("../assets/fonts/mulish-latin-800-normal.woff2") format("woff2"); font-weight: 800; font-style: normal; font-display: swap; }
@font-face { font-family: "Saira Extra Condensed"; src: url("../assets/fonts/saira-extra-condensed-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Saira Extra Condensed"; src: url("../assets/fonts/saira-extra-condensed-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }

/* ---------- 1. Colours & sizes ---------- */
:root {
  --bg: #f6f3ee;
  --surface: #fffdf9;
  --surface-2: #efe9e0;
  --ink: #1f1d1a;
  --muted: #6b655d;
  --line: #e2dacd;
  --accent: #bd5d38;          /* the original template's colour */
  --accent-ink: #9a4527;
  --accent-soft: #f4e3d9;
  --shadow: 0 1px 2px rgba(31, 29, 26, .06), 0 8px 24px rgba(31, 29, 26, .06);

  --font-head: "Saira Extra Condensed", "Arial Narrow", sans-serif;
  --font-body: "Mulish", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --radius: 14px;
  --max: 1120px;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #141311;
  --surface: #1c1a18;
  --surface-2: #26231f;
  --ink: #f1ece4;
  --muted: #a69e92;
  --line: #34302b;
  --accent: #e07a52;
  --accent-ink: #f09a77;
  --accent-soft: #3a251b;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background-color .25s ease, color .25s ease;
}

img { max-width: 100%; display: block; }

a { color: var(--accent-ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent); }

h1, h2, h3 {
  font-family: var(--font-head);
  font-weight: 700;
  text-transform: uppercase;
  line-height: 1.05;
  letter-spacing: .01em;
  margin: 0 0 .5rem;
}
h1 { font-size: clamp(3rem, 8vw, 5.6rem); }
h2 { font-size: clamp(2rem, 4vw, 2.75rem); }
h3 { font-size: 1.55rem; }

p { margin: 0 0 1rem; }

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

.container { width: min(100% - 2.5rem, var(--max)); margin-inline: auto; }

.skip-link {
  position: absolute; left: 1rem; top: -3rem;
  background: var(--ink); color: var(--bg);
  padding: .5rem .9rem; border-radius: 8px; z-index: 100;
}
.skip-link:focus { top: 1rem; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: .8rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent-ink);
  margin-bottom: .75rem;
}

.text-accent { color: var(--accent); }
.muted { color: var(--muted); }

/* ---------- 3. Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; min-height: 68px;
}

.brand {
  display: flex; align-items: center; gap: .7rem;
  text-decoration: none; color: var(--ink);
}
.brand-mark {
  display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--accent); color: #fff;
  font-family: var(--font-head); font-size: 1.35rem; font-weight: 700;
}
.brand-name {
  font-family: var(--font-head); font-size: 1.45rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .02em;
}

.nav { display: flex; align-items: center; gap: .25rem; }
.nav ul { list-style: none; display: flex; gap: .25rem; margin: 0; padding: 0; }
.nav a {
  display: block; padding: .45rem .8rem; border-radius: 8px;
  color: var(--muted); text-decoration: none; font-weight: 700; font-size: .95rem;
}
.nav a:hover { color: var(--ink); background: var(--surface-2); }
.nav a[aria-current="page"] { color: var(--accent-ink); background: var(--accent-soft); }

.icon-btn {
  display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  cursor: pointer;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.icon-btn svg { width: 20px; height: 20px; }
.theme-toggle .moon { display: none; }
[data-theme="dark"] .theme-toggle .sun { display: none; }
[data-theme="dark"] .theme-toggle .moon { display: block; }

.menu-toggle { display: none; }

@media (max-width: 760px) {
  .menu-toggle { display: grid; }
  .nav ul {
    position: absolute; left: 0; right: 0; top: 100%;
    flex-direction: column; gap: 0;
    padding: .5rem 1.25rem 1rem;
    background: var(--bg); border-bottom: 1px solid var(--line);
    display: none;
  }
  .nav.is-open ul { display: flex; }
  .nav a { padding: .8rem .6rem; font-size: 1.05rem; }
}

/* ---------- 4. Buttons, tags, cards ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .75rem 1.2rem; border-radius: 10px;
  font: 700 .95rem/1 var(--font-body);
  text-decoration: none; cursor: pointer;
  border: 1px solid transparent;
  transition: transform .15s ease, background-color .15s ease, border-color .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-ink); color: #fff; }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-ink); }

.tags { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; margin: 0; padding: 0; }
.tags li {
  font-size: .78rem; font-weight: 700;
  padding: .22rem .6rem; border-radius: 999px;
  background: var(--surface-2); color: var(--muted);
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------- 5. Sections ---------- */
.section { padding: 4.5rem 0; }
.section + .section { border-top: 1px solid var(--line); }
.section-head { margin-bottom: 2.25rem; max-width: 44rem; }
.section-head p { color: var(--muted); }

.page-hero { padding: 4rem 0 2.5rem; }
.page-hero h1 { font-size: clamp(2.8rem, 7vw, 4.6rem); }
.page-hero p { color: var(--muted); max-width: 40rem; font-size: 1.1rem; }

/* ---------- 6. Home: hero ---------- */
.hero { padding: 4.5rem 0 4rem; }
.hero-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 3rem; align-items: center; }
.hero h1 { margin-bottom: 1rem; }
.hero .lead { font-size: 1.2rem; color: var(--muted); max-width: 36rem; }

.contact-line {
  list-style: none; padding: 0; margin: 1.5rem 0;
  display: flex; flex-wrap: wrap; gap: .5rem 1.25rem;
  font-size: .95rem;
}
.contact-line li { display: flex; align-items: center; gap: .45rem; }
.contact-line svg { width: 17px; height: 17px; color: var(--accent); flex: none; }
.contact-line a { color: var(--ink); text-decoration: none; }
.contact-line a:hover { color: var(--accent); }

.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.75rem; }


.glance { padding: 1.75rem; }
.glance h2 { font-size: 1.6rem; margin-bottom: 1rem; }
.glance dl { margin: 0; display: grid; gap: 1rem; }
.glance dt {
  font-family: var(--font-mono); font-size: .72rem; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted);
}
.glance dd { margin: .1rem 0 0; font-weight: 700; }

/* ---------- 7. Home: about + skills ---------- */
.about-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 3rem; }
.about-text p:not(.eyebrow) { font-size: 1.08rem; }
.skills { display: grid; gap: 1.25rem; }
.skill-group h3 { font-size: 1.15rem; margin-bottom: .5rem; color: var(--accent-ink); }

/* ---------- 8. Timeline (education & experience) ---------- */
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.25rem; }
.timeline-item {
  display: grid; grid-template-columns: 170px 1fr; gap: 1.5rem;
  padding: 1.6rem 1.75rem;
}
.timeline-date {
  font-family: var(--font-mono); font-size: .85rem; color: var(--accent-ink);
  padding-top: .35rem;
}
.timeline-date span { display: block; color: var(--muted); font-size: .78rem; margin-top: .25rem; }
.timeline-item h3 { margin-bottom: .15rem; }
.timeline-item .org { font-weight: 700; color: var(--muted); margin-bottom: .75rem; }
.timeline-item ul:not(.tags) { margin: 0 0 1rem; padding-left: 1.1rem; list-style: disc; }
.timeline-item li { margin-bottom: .3rem; }
.timeline-item .tags { margin-top: .5rem; }

.mini-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.mini-card { padding: 1.25rem 1.4rem; }
.mini-card h3 { font-size: 1.2rem; margin-bottom: .25rem; }
.mini-card p { margin: 0; color: var(--muted); font-size: .95rem; }
.mini-card .when { font-family: var(--font-mono); font-size: .78rem; color: var(--accent-ink); margin-bottom: .35rem; }

/* ---------- 9. Projects ---------- */
.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 2rem; align-items: center; }
.filter-btn {
  font: 700 .9rem/1 var(--font-body);
  padding: .6rem 1rem; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
}
.filter-btn:hover { color: var(--ink); border-color: var(--ink); }
.filter-btn.is-active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.filter-count { margin: 0 0 0 auto; font-size: .9rem; color: var(--muted); }

.project-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.project-card { display: flex; flex-direction: column; overflow: hidden; transition: transform .2s ease, box-shadow .2s ease; }
.project-card:hover { transform: translateY(-3px); }
.project-card[hidden] { display: none; }

/* two wide cards (image left, text right) keep the 3-column grid even */
@media (min-width: 981px) {
  .project-grid { grid-auto-flow: dense; }
  .project-card.wide { grid-column: span 2; flex-direction: row; }
  .project-card.wide .project-cover { width: 56%; flex: none; aspect-ratio: auto; min-height: 100%; }
  .project-card.wide .project-body { padding: 1.75rem 1.75rem 1.6rem; }
  .project-card.wide h3 { font-size: 1.8rem; }
}

.project-cover {
  display: block; width: 100%; padding: 0; border: 0; cursor: zoom-in;
  font: inherit; color: inherit; text-decoration: none;
  aspect-ratio: 16 / 10; overflow: hidden; background: var(--surface-2);
}
.project-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.project-card:hover .project-cover img { transform: scale(1.03); }
.project-cover img.contain { object-fit: contain; background: #fff; }
.project-cover img.top { object-position: left top; }

.project-body { display: flex; flex-direction: column; gap: .6rem; padding: 1.25rem 1.35rem 1.4rem; flex: 1; }
.project-meta, .project-body .project-meta { font-family: var(--font-mono); font-size: .75rem; color: var(--accent-ink); margin: 0; letter-spacing: .03em; }
.project-body h3 { font-size: 1.45rem; margin: 0; }
.project-body p { color: var(--muted); font-size: .97rem; margin: 0; }
.project-actions { display: flex; gap: 1rem; margin-top: auto; padding-top: .6rem; align-items: center; }
.link-btn {
  background: none; border: 0; padding: 0; cursor: pointer;
  font: 700 .95rem/1 var(--font-body); color: var(--accent-ink);
}
.link-btn:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.project-actions a { font-weight: 700; font-size: .95rem; }

/* fallback shown by main.js when a remote image can't load (e.g. offline) */
.img-fallback {
  width: 100%; height: 100%; min-height: 180px;
  display: grid; place-items: center; text-align: center; gap: .35rem;
  background:
    repeating-linear-gradient(135deg, transparent 0 14px, color-mix(in srgb, var(--accent) 8%, transparent) 14px 15px),
    var(--accent-soft);
  color: var(--accent-ink); padding: 1rem;
}
.img-fallback strong { font-family: var(--font-head); font-size: 2rem; line-height: 1.05; text-transform: uppercase; display: block; margin-bottom: .35rem; }
.img-fallback small { font-size: .8rem; color: var(--muted); display: block; }

/* ---------- 10. Project modal ---------- */
.modal {
  width: min(100% - 2rem, 980px); max-height: calc(100vh - 2rem);
  padding: 0; border: 1px solid var(--line); border-radius: 18px;
  background: var(--surface); color: var(--ink);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .35);
}
.modal::backdrop { background: rgba(20, 18, 16, .65); backdrop-filter: blur(3px); }
.modal-inner { display: grid; grid-template-columns: 1.25fr 1fr; }
.modal-close { position: absolute; top: .9rem; right: .9rem; z-index: 2; }

.gallery { background: var(--surface-2); padding: 1rem; display: flex; flex-direction: column; gap: .75rem; }
.gallery-main {
  position: relative; border-radius: 10px; overflow: hidden; background: #fff;
  aspect-ratio: 4 / 3; display: grid; place-items: center;
}
.gallery-main img { width: 100%; height: 100%; object-fit: contain; }
.gallery-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 38px; height: 38px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(20, 18, 16, .6); color: #fff; font-size: 1.2rem;
}
.gallery-nav.prev { left: .6rem; }
.gallery-nav.next { right: .6rem; }
.gallery-thumbs { display: flex; gap: .5rem; overflow-x: auto; padding-bottom: .25rem; }
.gallery-thumbs button {
  flex: none; width: 72px; height: 52px; padding: 0; border-radius: 6px; overflow: hidden;
  border: 2px solid transparent; cursor: pointer; background: #fff; opacity: .65;
}
.gallery-thumbs button.is-active { border-color: var(--accent); opacity: 1; }
.gallery-thumbs img { width: 100%; height: 100%; object-fit: cover; }
.gallery-caption { font-size: .85rem; color: var(--muted); margin: 0; min-height: 1.3em; }

.modal-text { padding: 2rem 1.75rem; overflow-y: auto; max-height: calc(100vh - 2rem); }
.modal-text h2 { font-size: 2.1rem; padding-right: 2.5rem; }
.modal-text ul:not(.tags) { padding-left: 1.1rem; }
.modal-text li { margin-bottom: .3rem; }
.modal-links { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.25rem; }
.modal-links a { font-size: .9rem; padding: .55rem .9rem; }

/* ---------- 11. Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 2.5rem 0; margin-top: 2rem; font-size: .92rem; color: var(--muted); }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; align-items: center; }
.footer-inner p { margin: 0; }
.footer-inner a { color: var(--muted); }
.footer-links { display: flex; gap: 1rem; flex-wrap: wrap; }

.to-top {
  position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 40;
  opacity: 0; pointer-events: none; transition: opacity .2s ease;
}
.to-top.is-visible { opacity: 1; pointer-events: auto; }


/* ---------- 12. Reveal-on-scroll (added by main.js) ---------- */
.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s ease; }
.js .reveal.is-visible { opacity: 1; transform: none; }

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

/* ---------- 13. Responsive ---------- */
@media (max-width: 980px) {
  .project-grid { grid-template-columns: repeat(2, 1fr); }
  .modal-inner { grid-template-columns: 1fr; }
  .modal-text { max-height: none; }
  .modal { overflow-y: auto; }
}
@media (max-width: 860px) {
  .hero-grid, .about-grid { grid-template-columns: 1fr; gap: 2rem; }
}
@media (max-width: 640px) {
  .project-grid { grid-template-columns: 1fr; }
  .timeline-item { grid-template-columns: 1fr; gap: .4rem; padding: 1.3rem 1.25rem; }
  .section { padding: 3.25rem 0; }
  .filter-count { width: 100%; margin-left: 0; }
  .brand-name { font-size: 1.25rem; }
}

/* small placeholders inside gallery thumbnails */
.gallery-thumbs .img-fallback { min-height: 0; padding: 0; background-size: auto; }
.gallery-thumbs .img-fallback div { display: none; }
