/* =========================================================
   Portfolio — Thibault Mougeolle
   Titres : Montserrat · Texte : Source Sans 3
   Polices auto-hébergées (licence OFL, voir assets/fonts/)
   ========================================================= */

/* --- Polices -------------------------------------------------- */

@font-face {
  font-family: "Montserrat";
  src: url("../fonts/montserrat-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Montserrat";
  src: url("../fonts/montserrat-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Source Sans 3";
  src: url("../fonts/source-sans-3-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Source Sans 3";
  src: url("../fonts/source-sans-3-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

/* --- Variables ------------------------------------------------ */

:root {
  --bg: #ffffff;
  --bg-alt: #f5f5f5;
  --text: #1c1c1c;
  --muted: #5c5c5c;
  --border: #e2e2e2;
  --primary: #3a3a3a;
  --primary-dark: #1f1f1f;
  --primary-soft: #ededed;
  --dark: #161616;

  --font-title: "Montserrat", "Segoe UI", Arial, sans-serif;
  --font-text: "Source Sans 3", "Segoe UI", Arial, sans-serif;

  --max: 1120px;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-hover: 0 6px 18px rgba(0, 0, 0, 0.1);
  --t: 180ms ease;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141414;
    --bg-alt: #1c1c1c;
    --text: #e8e8e8;
    --muted: #a8a8a8;
    --border: #333333;
    --primary: #c9c9c9;
    --primary-dark: #ffffff;
    --primary-soft: #262626;
    --dark: #0b0b0b;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 6px 18px rgba(0, 0, 0, 0.4);
  }
}

/* --- Base ----------------------------------------------------- */

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

html {
  color-scheme: light dark;
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-text);
  font-size: 1.0625rem;
  line-height: 1.65;
}

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

a {
  color: var(--primary);
  text-underline-offset: 3px;
}

a:hover {
  color: var(--primary-dark);
}

:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-title);
  line-height: 1.25;
  margin: 0;
  color: var(--text);
}

p {
  margin: 0 0 1rem;
}

.wrap {
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: 1.25rem;
}

@media (min-width: 48rem) {
  .wrap {
    padding-inline: 2rem;
  }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  left: 1rem;
  top: -4rem;
  z-index: 300;
  background: var(--primary);
  color: #fff;
  padding: 0.6rem 1rem;
  border-radius: var(--radius);
  font-weight: 600;
}

.skip-link:focus {
  top: 1rem;
  color: #fff;
}

/* --- Boutons -------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.9rem;
  padding: 0.6rem 1.5rem;
  border: 2px solid transparent;
  border-radius: var(--radius);
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--t), color var(--t), border-color var(--t);
}

.btn--small {
  min-height: 2.5rem;
  padding: 0.4rem 1.1rem;
  font-size: 0.85rem;
}

.btn--primary {
  background: var(--primary);
  color: #fff;
}

.btn--primary:hover,
.btn--primary:focus-visible {
  background: var(--primary-dark);
  color: #fff;
}

.btn--secondary {
  border-color: var(--primary);
  color: var(--primary);
  background: transparent;
}

.btn--secondary:hover,
.btn--secondary:focus-visible {
  background: var(--primary-soft);
  color: var(--primary);
}

.btn--light {
  background: #fff;
  color: #161616;
}

.btn--light:hover,
.btn--light:focus-visible {
  background: #e2e2e2;
  color: #161616;
}

.btn--outline-light {
  border-color: rgba(255, 255, 255, 0.7);
  color: #fff;
}

.btn--outline-light:hover,
.btn--outline-light:focus-visible {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

@media (prefers-color-scheme: dark) {
  .btn--primary,
  .btn--primary:hover,
  .btn--primary:focus-visible,
  .skip-link {
    color: #141414;
  }
}

/* --- Barre de navigation --------------------------------------- */

.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.navbar__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  min-height: 4.25rem;
}

.navbar__brand {
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--text);
  text-decoration: none;
}

.navbar__brand strong {
  font-weight: 700;
  color: var(--primary);
}

.navbar__toggle {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}

.navbar__toggle-bar {
  display: block;
  width: 1.25rem;
  height: 2px;
  background: var(--text);
}

.navbar__menu {
  flex-basis: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;
  padding: 0.5rem 0 1.25rem;
}

.navbar__links {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
}

.navbar__links a {
  display: block;
  padding: 0.6rem 0;
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid var(--border);
}

.navbar__links a:hover,
.navbar__links a:focus-visible {
  color: var(--primary);
}

/* Sans JS, le menu mobile reste affiché ; avec JS il est replié. */
@media (max-width: 61.99rem) {
  .has-js .navbar__menu {
    display: none;
  }

  .has-js .navbar__menu.is-open {
    display: flex;
  }
}

@media (min-width: 62rem) {
  .navbar__toggle {
    display: none;
  }

  .navbar__menu {
    flex-basis: auto;
    flex-direction: row;
    align-items: center;
    gap: 1.75rem;
    padding: 0;
  }

  .navbar__links {
    display: flex;
    gap: 1.6rem;
    width: auto;
  }

  .navbar__links a {
    padding: 0.4rem 0;
    border-bottom: 2px solid transparent;
    font-size: 0.98rem;
  }

  .navbar__links a:hover,
  .navbar__links a:focus-visible {
    border-bottom-color: var(--primary);
  }
}

/* --- Accueil (hero) --------------------------------------------- */

.hero {
  background: linear-gradient(180deg, var(--primary-soft) 0%, var(--bg) 100%);
  padding-block: 3.5rem 4rem;
}

.hero__grid {
  display: grid;
  gap: 2.5rem;
  align-items: center;
}

@media (min-width: 62rem) {
  .hero {
    padding-block: 5.5rem 6rem;
  }

  .hero__grid {
    grid-template-columns: 1.35fr 1fr;
    gap: 4rem;
  }
}

.hero__kicker {
  margin-bottom: 0.75rem;
  color: var(--primary);
  font-weight: 600;
  font-size: 1rem;
}

.hero__title {
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  font-weight: 700;
  margin-bottom: 0.6rem;
}

.hero__subtitle {
  font-family: var(--font-title);
  font-weight: 600;
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  color: var(--primary);
  margin-bottom: 1.25rem;
}

.hero__lede {
  font-size: 1.15rem;
  color: var(--muted);
  max-width: 34rem;
  margin-bottom: 2rem;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
}

.hero__card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-hover);
  padding: 1.75rem;
}

.hero__card-title {
  font-size: 1.05rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.facts {
  margin: 0;
}

.facts__row {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 1rem;
  padding-block: 0.55rem;
}

.facts__row + .facts__row {
  border-top: 1px dashed var(--border);
}

.facts dt {
  color: var(--muted);
  font-size: 0.95rem;
}

.facts dd {
  margin: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}

/* --- Sections --------------------------------------------------- */

.section {
  padding-block: 4rem;
}

@media (min-width: 62rem) {
  .section {
    padding-block: 5rem;
  }
}

.section--alt {
  background: var(--bg-alt);
}

.section__head {
  text-align: center;
  max-width: 44rem;
  margin: 0 auto 2.75rem;
}

.section__head h2 {
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  font-weight: 700;
}

.section__head h2::after {
  content: "";
  display: block;
  width: 3.5rem;
  height: 3px;
  margin: 0.9rem auto 0;
  background: var(--primary);
  border-radius: 3px;
}

.section__intro {
  margin: 1.25rem 0 0;
  color: var(--muted);
  font-size: 1.1rem;
}

/* --- À propos --------------------------------------------------- */

.about {
  max-width: 44rem;
  margin-inline: auto;
  font-size: 1.12rem;
  text-align: center;
}

/* --- Colonnes et blocs ------------------------------------------- */

.columns {
  display: grid;
  gap: 2rem;
}

@media (min-width: 62rem) {
  .columns {
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
  }
}

.column__title {
  font-size: 1.15rem;
  margin-bottom: 1rem;
}

.entry {
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem 1.6rem;
}

.entry__tag {
  display: inline-block;
  margin-bottom: 0.6rem;
  padding: 0.15rem 0.65rem;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.85rem;
  font-weight: 600;
}

.entry__title {
  font-size: 1.08rem;
  margin-bottom: 0.3rem;
}

.entry__org {
  color: var(--muted);
  margin-bottom: 0.9rem;
}

.entry p:last-child {
  margin-bottom: 0;
}

.entry__list {
  margin: 0;
  padding-left: 1.2rem;
}

.entry__list li + li {
  margin-top: 0.35rem;
}

/* --- Homelab ----------------------------------------------------- */

.diagram {
  margin: 0 auto 3rem;
  max-width: 50rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

.diagram img {
  width: 100%;
}

.diagram figcaption {
  margin-top: 0.75rem;
  text-align: center;
  font-size: 0.92rem;
  color: var(--muted);
}

.specs {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.specs th,
.specs td {
  text-align: left;
  vertical-align: top;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.specs tr:last-child th,
.specs tr:last-child td {
  border-bottom: none;
}

.specs th {
  width: 38%;
  font-weight: 600;
  color: var(--muted);
  background: var(--bg-alt);
}

.principles {
  margin-top: 2.5rem;
}

.checklist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

@media (min-width: 48rem) {
  .checklist {
    grid-template-columns: 1fr 1fr;
  }
}

.checklist li {
  position: relative;
  padding: 0.85rem 1rem 0.85rem 2.75rem;
  background: var(--bg-alt);
  border-radius: var(--radius);
}

.checklist li::before {
  content: "";
  position: absolute;
  left: 1rem;
  top: 1.05rem;
  width: 0.9rem;
  height: 0.5rem;
  border-left: 2px solid var(--primary);
  border-bottom: 2px solid var(--primary);
  transform: rotate(-45deg);
}

/* --- Projets ------------------------------------------------------ */

.cards {
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 48rem) {
  .cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 62rem) {
  .cards {
    grid-template-columns: repeat(3, 1fr);
  }
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--border);
  border-top: 4px solid var(--primary);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.6rem;
  transition: box-shadow var(--t);
}

.card:hover {
  box-shadow: var(--shadow-hover);
}

.card__tag {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.card__title {
  font-size: 1.2rem;
  margin-bottom: 0.75rem;
}

.card__link,
.card__note {
  margin: 1.1rem 0 0;
  font-size: 0.95rem;
}

.card__link a {
  font-weight: 600;
}

.card__note {
  color: var(--muted);
}

.tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: auto 0 0;
  padding: 0.5rem 0 0;
}

.tags li {
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.85rem;
  font-weight: 600;
}

/* --- Compétences -------------------------------------------------- */

.skills {
  display: grid;
  gap: 1.25rem;
}

@media (min-width: 48rem) {
  .skills {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 62rem) {
  .skills {
    grid-template-columns: repeat(3, 1fr);
  }
}

.skill {
  background: var(--bg-alt);
  border-radius: var(--radius);
  padding: 1.4rem 1.5rem;
}

.skill__title {
  font-size: 1.05rem;
  margin-bottom: 0.5rem;
  color: var(--primary);
}

.skill p {
  margin: 0;
  color: var(--text);
}


/* --- Contact ------------------------------------------------------- */

.section--dark {
  background: var(--dark);
  color: #e6edf3;
}

.contact {
  text-align: center;
  max-width: 40rem;
}

.contact h2 {
  color: #fff;
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  margin-bottom: 1rem;
}

.contact p {
  font-size: 1.12rem;
}

.contact__email a {
  color: #fff;
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 1.2rem;
  overflow-wrap: anywhere;
}

.contact__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.9rem;
  margin-top: 1.75rem;
}

/* --- Pied de page --------------------------------------------------- */

.footer {
  background: #161616;
  color: #b3b3b3;
  font-size: 0.95rem;
}

.footer__inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-block: 1.4rem;
}

.footer p {
  margin: 0;
}

.footer a {
  color: #d9d9d9;
}

.footer a:hover {
  color: #fff;
}

/* --- Pages simples (mentions légales, 404) --------------------------- */

.page {
  max-width: 46rem;
  padding-block: 3.5rem 5rem;
}

.page h1 {
  font-size: clamp(1.8rem, 4vw, 2.3rem);
  margin-bottom: 1.5rem;
}

.page h2 {
  font-size: 1.15rem;
  margin: 2rem 0 0.6rem;
}

.page--center {
  text-align: center;
  padding-block: 6rem;
}

.page__code {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 4rem;
  line-height: 1;
  color: var(--primary);
  margin-bottom: 1rem;
}

/* Le schéma garde un fond clair en mode sombre pour rester lisible. */
@media (prefers-color-scheme: dark) {
  .diagram {
    background: #f5f5f5;
  }

  .diagram figcaption {
    color: #4a4a4a;
  }
}

@media (max-width: 29.99rem) {
  .facts__row {
    grid-template-columns: 1fr;
    gap: 0.1rem;
  }
}
