/* ==========================================================================
   Polytech Montpellier — Site temporaire
   Design system
   ========================================================================== */

:root {
  /* Couleurs */
  --navy-950: #0B1A2C;
  --navy-900: #10243E;
  --navy-700: #1B3A5C;
  --blue-600: #2D6FA3;
  --blue-100: #E4EEF6;
  --amber-500: #E8A33D;
  --amber-100: #FCF0DA;
  --alert-600: #B23A2E;
  --alert-100: #FBEAE7;
  --bg: #F5F7FA;
  --surface: #FFFFFF;
  --ink-900: #12181F;
  --ink-600: #4B5768;
  --ink-400: #7C8797;
  --border: #E1E5EB;

  /* Typo */
  --font-display: "Space Grotesk", "Segoe UI", sans-serif;
  --font-body: "Source Sans 3", "Segoe UI", Arial, sans-serif;

  /* Layout */
  --content-width: 1080px;
  --radius: 10px;
  --shadow-sm: 0 1px 2px rgba(16, 36, 62, 0.06), 0 1px 1px rgba(16, 36, 62, 0.04);
  --shadow-md: 0 8px 24px rgba(16, 36, 62, 0.10);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink-900);
  line-height: 1.6;
  font-size: 16px;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--navy-900);
  line-height: 1.2;
  margin: 0 0 0.5em;
}

h1 { font-size: clamp(1.9rem, 3.2vw, 2.6rem); letter-spacing: -0.01em; }
h2 { font-size: clamp(1.4rem, 2.2vw, 1.85rem); margin-top: 2.2em; }
h3 { font-size: 1.2rem; margin-top: 1.6em; color: var(--navy-700); }
h4 { font-size: 1.02rem; margin-top: 1.4em; text-transform: uppercase; letter-spacing: 0.04em; color: var(--blue-600); }

p { margin: 0 0 1em; color: var(--ink-600); }
a { color: var(--blue-600); text-decoration-thickness: 1.5px; text-underline-offset: 2px; }
a:hover { color: var(--navy-900); }
a:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 3px solid var(--amber-500);
  outline-offset: 2px;
  border-radius: 4px;
}

ul, ol { color: var(--ink-600); padding-left: 1.3em; }
li { margin-bottom: 0.4em; }

strong { color: var(--ink-900); }

.container {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------------------------------- Skip link ---------------------------------- */
.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--navy-900);
  color: #fff;
  padding: 10px 18px;
  z-index: 1000;
  border-radius: 0 0 8px 0;
}
.skip-link:focus {
  left: 0;
}

/* ---------------------------------- Top bar ---------------------------------- */
.topbar {
  background: var(--navy-950);
  color: #C9D6E4;
  font-size: 0.82rem;
}
.topbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 6px;
  padding-bottom: 6px;
  flex-wrap: wrap;
  gap: 6px;
}
.topbar .status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.topbar .status .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--amber-500);
  box-shadow: 0 0 0 3px rgba(232, 163, 61, 0.25);
  flex-shrink: 0;
}

/* ---------------------------------- Header / Nav ---------------------------------- */
header.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

/* Row 1 : logos, centered, with the mobile toggle balanced via a 1fr/auto/1fr grid */
.header-top {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px 24px;
}
.brand {
  display: flex;
  align-items: center;
  text-decoration: none;
}
.brand img {
  height: 80px;
  width: auto;
  display: block;
}

/* Row 2 : nav, centered, separated by a hairline */
.header-bottom {
  border-top: 1px solid var(--border);
}
.header-bottom .container {
  display: flex;
  justify-content: center;
}

nav.main-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 2px 0;
}
nav.main-nav a {
  display: inline-block;
  padding: 12px 14px;
  color: var(--ink-600);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: 8px;
  transition: background 0.15s ease, color 0.15s ease;
}
nav.main-nav a:hover { background: var(--blue-100); color: var(--navy-900); }
nav.main-nav a[aria-current="page"] {
  color: var(--navy-900);
  background: var(--blue-100);
}

.nav-toggle {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
}
.nav-toggle span, .nav-toggle span::before, .nav-toggle span::after {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--navy-900);
  position: relative;
  transition: transform 0.2s ease;
}
.nav-toggle span::before, .nav-toggle span::after {

  content: "";
  position: absolute;
  left: 0;
}
.nav-toggle span::before { top: -6px; }
.nav-toggle span::after { top: 6px; }

/* ---------------------------------- Alert banners ---------------------------------- */
.alert-banner {
  border-left: 5px solid;
  border-radius: var(--radius);
  padding: 18px 20px;
  margin: 0 0 20px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.alert-banner .icon {
  font-size: 1.3rem;
  line-height: 1;
  flex-shrink: 0;
}
.alert-banner h3 {
  margin: 0 0 6px;
  font-size: 1.05rem;
  color: inherit;
}
.alert-banner p:last-child { margin-bottom: 0; }

.alert-banner.critical {
  background: var(--alert-100);
  border-color: var(--alert-600);
  color: #7A281F;
}
.alert-banner.critical h3 { color: var(--alert-600); }

.alert-banner.warning {
  background: var(--amber-100);
  border-color: var(--amber-500);
  color: #7A5310;
}
.alert-banner.warning h3 { color: #A9701C; }

.alert-banner.info {
  background: var(--blue-100);
  border-color: var(--blue-600);
  color: #1F425E;
}
.alert-banner.info h3 { color: var(--navy-700); }

/* ---------------------------------- Hero (accueil) ---------------------------------- */
.hero {
  background:
    radial-gradient(1200px 400px at 85% -10%, rgba(45, 111, 163, 0.25), transparent 60%),
    linear-gradient(180deg, var(--navy-950) 0%, var(--navy-900) 100%);
  color: #E8EEF5;
  padding: 56px 0 64px;
}
.hero .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--amber-500);
  font-weight: 700;
  margin-bottom: 14px;
}
.hero .eyebrow .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--amber-500);
  animation: pulse 2.2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(232,163,61,0.5); }
  50% { box-shadow: 0 0 0 6px rgba(232,163,61,0); }
}
.hero h1 { color: #fff; max-width: 20ch; margin-bottom: 0.4em; }
.hero .lead { color: #B9C6D6; max-width: 62ch; font-size: 1.05rem; }

/* ---------------------------------- Page header (sous-pages) ---------------------------------- */
.page-head {
  background: linear-gradient(180deg, var(--navy-900), var(--navy-700));
  color: #fff;
  padding: 40px 0;
}
.page-head h1 { color: #fff; margin: 0; }
.page-head .crumb {
  font-size: 0.82rem;
  color: #A9BBCE;
  margin-bottom: 8px;
}
.page-head .crumb a { color: #CFDCEA; }

.page-head.has-photo {
  position: relative;
  background-image:
    linear-gradient(100deg, rgba(11,26,44,0.72) 0%, rgba(11,26,44,0.48) 45%, rgba(11,26,44,0.22) 80%),
    url("img/photo_accueil.webp");
  background-size: cover;
  background-position: center;
  padding: 80px 0;
}
.page-head.has-photo .head-textbox {
  display: inline-block;
  background: #ffffff;
  border-radius: 10px;
  padding: 22px 32px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.30);
}
.page-head.has-photo .head-textbox h1 {
  color: #003366;
}

/* ---------------------------------- Main content ---------------------------------- */
main { padding: 44px 0 72px; }

.section { margin-bottom: 8px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 26px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
  margin: 24px 0;
}
.card-grid .card { margin-bottom: 0; }
.card-grid h3 { margin-top: 0; }

/* ---------------------------------- Tables ---------------------------------- */
.table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  margin: 20px 0;
  overflow: hidden;
}
table.formations {
  width: 100%;
  border-collapse: collapse;
}
table.formations th {
  background: var(--navy-900);
  color: #fff;
  text-align: left;
  padding: 12px 16px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9rem;
}
table.formations td {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  color: var(--ink-600);
  vertical-align: middle;
}
table.formations tr:nth-child(even) td { background: #FAFBFC; }
table.formations .code {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--navy-900);
  white-space: nowrap;
}
table.formations .placeholder {
  color: var(--ink-400);
  font-style: italic;
}
table.formations .group-sep td {
  padding: 0;
  height: 6px;
  background: var(--blue-100);
  border: none;
}
.syllabus-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  white-space: nowrap;
}

/* Icon buttons (mail / fichier) used inside the formations table */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--blue-100);
  color: var(--blue-600);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.icon-btn:hover {
  background: var(--navy-900);
  color: #fff;
  border-color: var(--navy-900);
}
.icon-btn svg { width: 18px !important; height: 18px !important; flex-shrink: 0; }
.icon-btn.is-empty {
  color: var(--ink-400);
  background: var(--bg);
  border-style: dashed;
  cursor: default;
  pointer-events: none;
}
table.formations th.col-icon { text-align: center; width: 1%; white-space: nowrap; }
table.formations td.col-icon { text-align: center; }

/* Reflow to stacked cards below 700px: no horizontal scrolling needed */
@media (max-width: 700px) {

  /* On masque l'en-tête du tableau */
  table.formations thead { display: none; }

  /* Chaque ligne devient une carte verticale */
  table.formations tr {
    display: block;
    padding: 20px 18px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
  }

  /* On remet les cellules en bloc vertical */
  table.formations td {
    display: block;
    padding: 6px 0;
  }

  /* On enlève les labels automatiques */
  table.formations td::before {
    display: none;
  }

  /* Le nom de la formation devient un titre */
  table.formations td.code {
    font-size: 1rem;
    font-weight: 700;
    color: var(--navy-900);
   margin-bottom: 12px;
   white-space: normal;        /* autorise le retour à la ligne */
   word-break: break-word;     /* coupe proprement si trop long */
   line-height: 1.3;
  }

  /* Ligne "Contact :" */
  table.formations td[data-label="Contact"] {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: var(--ink-600);
  }
  table.formations td[data-label="Contact"]::before {
    content: "Contact :";
    font-weight: 600;
    color: var(--ink-600);
  }

  /* Ligne "Plaquette :" */
  table.formations td.col-icon {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: var(--ink-600);
  }
  table.formations td.col-icon::before {
    content: "Plaquette :";
    font-weight: 600;
    color: var(--ink-600);
  }

  /* Icônes plus petites et alignées */
  .icon-btn {
    width: 34px;
    height: 34px;
  }
}

/* ---------------------------------- Definition-style lists ---------------------------------- */
.timeline-block {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 20px 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}
.timeline-block h4 { margin-top: 0; }

.pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 14px 0;
}
.pill-list li {
  background: var(--blue-100);
  color: var(--navy-700);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0;
}

.doc-list {
  list-style: none;
  padding: 0;
  margin: 16px 0;
  display: grid;
  gap: 10px;
}
.doc-list a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  text-decoration: none;
  font-weight: 600;
  color: var(--navy-900);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.doc-list a:hover { border-color: var(--blue-600); background: var(--blue-100); }
.doc-list a .doc-icon { color: var(--blue-600); flex-shrink: 0; }

/* ---------------------------------- Access rapide (liens externes) ---------------------------------- */
.link-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  margin-top: 24px;
}
.link-card {
  display: block;
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 22px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.link-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--blue-600);
}
.link-card .k {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--navy-900);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.link-card .arrow { color: var(--amber-500); font-size: 1.3rem; transition: transform 0.15s ease; }
.link-card:hover .arrow { transform: translateX(4px); }
.link-card .note { color: var(--ink-400); font-size: 0.85rem; margin-top: 6px; }

/* ---------------------------------- Footer ---------------------------------- */
footer.site-footer {
  background: var(--navy-950);
  color: #93A4B8;
  padding: 32px 0;
  font-size: 0.85rem;
}
footer.site-footer .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
footer.site-footer a { color: #C9D6E4; }

/* ---------------------------------- Responsive ---------------------------------- */
@media (max-width: 860px) {
  .header-bottom { border-top: 0; }
  .header-bottom .container { padding: 0; }
  nav.main-nav {
    position: fixed;
    top: 100%;
    left: 0;
    right: 0;
    max-height: calc(100vh - 80px);
    background: var(--surface);
    flex-direction: column;
    align-items: stretch;
    padding: 12px;
    gap: 2px;
    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
    border-top: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    overflow-y: auto;
  }
  nav.main-nav a { padding: 14px 16px; font-size: 1.02rem; }
  body.nav-open nav.main-nav {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }
  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .header-top { padding: 12px 20px; }
  .brand img { height: 50px; }
  .hero { padding: 40px 0 48px; }
  .card { padding: 20px; }
}

@media (max-width: 520px) {
  .brand img { height: 50px; }
  .topbar .container { font-size: 0.76rem; }
}
