/* ============================================
   Exo7 — CSS modernisé (2026)
   ============================================ */

:root {
  --primary: #102340;
  --primary-light: #1f4d80;
  --accent: #f89400;
  --accent-dark: #d97800;

  --link-visited: #1a5c7a;
  --status-danger: #c62828;
  --bg-texture-base: #d9e2ed;
  --bg-card: #ffffff;
  --text: #162132;
  --text-on-dark: #fff;
  --text-subtle: #666;
  --text-on-dark-muted: #c7d5e7;
  --border: #d6e0ea;
  --list-even: #f8f9fb;
  --list-odd: #f4f8fc;
  --section-title-bg: #e4edf7;
  --list-hover-bg: #fff2dc;
  --bg-texture-overlay-start: rgba(255, 255, 255, 0.42);
  --bg-texture-overlay-end: rgba(237, 243, 249, 0.42);
  --link-on-dark: #e2ebf7;
  --overlay-dark-soft: rgba(0, 0, 0, 0.15);
  --overlay-dark-strong: rgba(0, 0, 0, 0.28);
  --shadow: 0 10px 26px rgba(16, 35, 64, 0.12);
  --radius: 8px;
  --font-body: "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-serif: Georgia, "Times New Roman", serif;
  --gradient-dark: linear-gradient(
    135deg,
    #2b2b2b 0%,
    #5a5a5a 60%,
    #3c3c3c 100%
  );
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg-texture-base);
  /* Texture metal discret: l'image est adoucie par un voile clair. */
  background-image:
    linear-gradient(var(--bg-texture-overlay-start), var(--bg-texture-overlay-end)),
    url("glossymetal.jpg");
  background-repeat: repeat;
  background-position: top left;
  min-width: 320px;
}

input {
  font-size: inherit;
}

p {
  line-height: 1.7em;
  margin-bottom: 1em;
  text-align: justify;
}

a {
  color: var(--primary-light);
  text-decoration: none;
  transition: color 0.15s;
}

a:visited {
  color: var(--link-visited);
}

a:hover {
  color: var(--accent-dark);
  text-decoration: underline;
}

a img {
  border: 0;
}

hr {
  height: 1px;
  border: none;
  border-bottom: 1px solid var(--border);
}

h3 span {
  font-weight: normal;
}

h3,
h4 {
  font-weight: bold;
}

h3 {
  font-family: var(--font-body);
  font-weight: 700;
  color: var(--primary);
  font-size: 1.4em;
  text-align: left;
  margin: 1em 0 0.5em;
  padding-right: 0;
}

h4 {
  font-size: 1.1em;
}

/* ---- Misc ---- */
.contentarea {
  padding-top: 1em;
}

.contentarea ul {
  padding-left: 1.5em;
}

.text-center {
  text-align: center;
}

.resource-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7em;
  margin: 0 0 1.5em;
  padding: 1em 1.1em;
  background: #f6f9fd;
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary-light);
  box-shadow: var(--shadow);
}

.resource-filter-label {
  display: inline-flex;
  align-items: center;
  color: var(--primary);
  font-size: 0.92em;
  font-weight: 700;
  margin-right: 0.2em;
}

.resource-filter-button {
  appearance: none;
  border: 1px solid rgba(16, 35, 64, 0.14);
  background: #fff;
  color: var(--primary);
  border-radius: 999px;
  padding: 0.45em 0.9em;
  font: inherit;
  font-size: 0.9em;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.15s,
    color 0.15s,
    border-color 0.15s,
    transform 0.15s;
}

.resource-filter-button:hover {
  background: #eef4fb;
  border-color: rgba(16, 35, 64, 0.28);
  text-decoration: none;
}

.resource-filter-button.is-active {
  background: var(--primary-light);
  border-color: var(--primary-light);
  color: #fff;
}

.resource-filter-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.yt-logo {
  text-align: center;
  padding: 0.8em 0;
}

.yt-logo a {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  text-decoration: none;
}

.yt-logo img {
  height: 40px;
}

.yt-logo span {
  font-size: 0.85em;
  font-weight: 700;
  color: var(--text);
}

.yt-logo a:hover span {
  color: var(--accent-dark);
}

.text-red {
  color: var(--status-danger);
}

.book-showcase {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.75em 1.5em;
  margin-bottom: 1em;
}

img {
  border: 0;
  max-width: 100%;
  height: auto;
}

.book-cover {
  height: clamp(73px, 10vw, 90px);
  width: auto;
  max-width: none;
}

/* ---- Dividers ---- */
.divider2 {
  height: 1px;
  border-bottom: 2px solid var(--accent);
  margin: 1.5em 0;
  opacity: 0.4;
}

/* ---- Post sections ---- */
.post {
  margin-bottom: 1.5em;
}

.post h3 {
  font-size: 1.1em;
  padding: 0.55em 0.9em;
  border-left: 4px solid var(--accent);
  background-color: var(--section-title-bg);
  border-radius: 0;
}

/* ---- Sidebar box ---- */
.box {
  position: relative;
  background: var(--bg-card);
  padding: 1.2em;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1.5em;
}

.box h4 {
  display: block;
  font-weight: 700;
  font-size: 1em;
  color: var(--primary);
  border-bottom: 2px solid var(--accent);
  padding-bottom: 0.45em;
  margin-bottom: 0.8em;
  background: none;
  padding-left: 0;
  border-radius: 0;
}

.box .contentarea {
  padding-top: 0.4em;
}

.box ul {
  list-style: none;
  padding: 0;
}

.box ul li {
  padding: 0.5em 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9em;
  line-height: 1.5;
}

.box ul li:last-child {
  border-bottom: none;
}

/* ---- Link list ---- */
ul.linklist {
  list-style: none;
}

ul.linklist li {
  line-height: 2em;
}

ul.linklist a {
  color: var(--text);
}

ul.linklist a:hover {
  text-decoration: underline;
}

/* ---- File list ---- */
[hidden] {
  display: none !important;
}

ul.ficlist {
  list-style: none;
  width: 100%;
  position: relative;
}

ul.ficlist li {
  position: relative;
  color: var(--primary);
  background-color: var(--list-even);
  line-height: 1.85em;
  width: 100%;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.25em 0.35em;
  padding: clamp(0.25em, 0.5vw, 0.4em) 10px;
}

ul.ficlist li:nth-child(even) {
  background-color: var(--list-odd);
}

ul.ficlist li:hover {
  background-color: var(--list-hover-bg);
}

/* ---- Cours vs Exercices ---- */

ul.ficlist li.item-cours .fictitre::before,
ul.ficlist li.item-exo .fictitre::before,
ul.ficlist li.item-livre .fictitre::before,
ul.ficlist li.item-formulaire .fictitre::before {
  display: inline-block;
  font-size: 0.7em;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-indent: 0.03em;
  padding: 0 0.45em 0 0.55em;
  height: 1.7em;
  line-height: 1.7em;
  border-radius: 3px;
  margin-right: 0.5em;
  vertical-align: middle;
  text-align: center;
  white-space: nowrap;
}

ul.ficlist li.item-cours .fictitre::before {
  content: "COURS";
  background: rgba(31, 77, 128, 0.4);
  color: #fff;
}

ul.ficlist li.item-exo .fictitre::before {
  content: "EXERCICES";
  background: rgba(248, 148, 0, 0.4);
  color: #fff;
}

ul.ficlist li.item-livre .fictitre::before {
  content: "LIVRE";
  background: rgba(58, 125, 82, 0.4);
  color: #fff;
}

ul.ficlist li.item-formulaire .fictitre::before {
  content: "REF";
  background: rgba(107, 82, 160, 0.4);
  color: #fff;
}

.fictitre {
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 600;
  font-size: 0.95em;
  text-align: left;
  color: var(--text);
}

.fictitre a {
  color: var(--primary-light);
  transition: color 0.15s;
}

.fictitre a:hover {
  color: var(--accent-dark);
}

.ficlien {
  display: flex;
  gap: 0.75em;
  align-items: center;
  margin-left: auto;
  color: var(--text-subtle);
  font-size: 0.85em;
  white-space: nowrap;
  flex: 0 0 auto;
}

.ficvideo {
  text-align: right;
  color: var(--text-subtle);
  font-size: 0.95em;
}

/* ---- Outer container ---- */
#outer {
  position: relative;
  max-width: 1200px;
  margin: 0 auto;
  background-color: var(--bg-card);
  box-shadow: var(--shadow);
}

/* ---- Header ---- */
#header {
  position: relative;
  width: 100%;
  background: var(--gradient-dark);
  padding: clamp(0.9em, 2vw, 1.15em) clamp(1.1em, 2.5vw, 2em);
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 4.3em;
}

#headercontent {
  padding: 0;
}

#headercontent h1 {
  font-weight: normal;
  color: var(--text-on-dark);
  font-size: clamp(2em, 4.5vw, 2.5em);
  text-align: left;
  margin: 0 0 -0.2em 0;
  font-family: var(--font-serif);
}

#headercontent h1 sup {
  color: var(--text-on-dark-muted);
}

#headercontent h2 {
  font-size: clamp(0.95em, 2vw, 1.1em);
  font-weight: normal;
  font-family: var(--font-serif);
  color: var(--text-on-dark);
  margin: 0;
  text-align: left;
  font-style: normal;
}

#headerlogo {
  margin: 0;
}

#headerlogo img {
  height: clamp(58px, 9vw, 76px);
  width: auto;
}

/* ---- Navigation ---- */
#menu {
  position: relative;
  background: var(--accent);
  border-bottom: 1px solid rgba(16, 35, 64, 0.18);
  padding: 0 clamp(0.5em, 1.5vw, 1em);
  margin-bottom: 0;
  font-weight: 600;
}

#menu ul {
  display: flex;
  flex-wrap: wrap;
  list-style: none;
}

#menu ul li {
  display: block;
}

#menu ul li a {
  display: block;
  padding: clamp(0.65em, 1.2vw, 0.75em) clamp(0.95em, 2vw, 1.2em);
  color: var(--text-on-dark);
  text-decoration: none;
  font-size: 0.95em;
  transition: background 0.2s;
}

#menu ul li a:hover {
  background: var(--overlay-dark-soft);
  text-decoration: none;
}

#menu ul li a.active {
  background: var(--overlay-dark-strong);
  box-shadow: inset 0 -3px 0 var(--primary);
}

/* ---- Content layout (flexbox) ---- */
#content {
  padding: clamp(1em, 3vw, 2em);
  display: flex;
  align-items: flex-start;
  gap: clamp(1.2em, 3vw, 2em);
}

#primarycontainer {
  flex: 1;
  margin: 0;
  width: 100%;
  min-width: 0;
}

#primarycontent {
  margin: 0;
}

#secondarycontent {
  width: 20em;
  flex-shrink: 0;
  margin-top: 0;
  position: sticky;
  top: 1.5em;
  align-self: flex-start;
  max-height: calc(100vh - 3em);
  overflow-y: auto;
  scrollbar-gutter: stable;
}

#secondarycontent .box {
  margin-bottom: 0;
}

.post h3[id] {
  scroll-margin-top: 1.2em;
}

/* ---- Footer ---- */
#footer {
  position: relative;
  clear: both;
  padding: 2.4em 2em;
  background: var(--gradient-dark);
  border-top: 4px solid var(--accent);
  color: var(--text-on-dark-muted);
  font-size: 0.85em;
  font-family: var(--font-serif);
  font-style: normal;
  font-weight: normal;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#footer a {
  color: var(--link-on-dark);
}

/* ---- Responsive ---- */
@media (max-width: 900px) {
  #content {
    flex-direction: column;
  }

  #menu ul {
    justify-content: center;
  }

  #secondarycontent {
    width: 100%;
    position: static;
    max-height: none;
    overflow: visible;
  }
}

@media (max-width: 640px) {
  #header {
    flex-direction: column;
    text-align: center;
    gap: 0.65em;
  }

  #headercontent h1,
  #headercontent h2 {
    text-align: center;
  }

  #menu ul {
    flex-direction: column;
  }

  .resource-filters {
    flex-direction: column;
    align-items: stretch;
  }

  .resource-filter-label {
    margin-right: 0;
  }

  .ficlien {
    display: block;
    padding: 0 0 0.2em 10px;
    text-align: right;
  }

  ul.ficlist li {
    flex-wrap: wrap;
    align-items: baseline;
  }

  .fictitre,
  .ficlien {
    width: 100%;
    margin-left: 0;
  }

  #menulivre img {
    height: 70px;
  }
}

@media print {
  #menu,
  #secondarycontent,
  #footer,
  .divider2 {
    display: none !important;
  }

  #outer {
    box-shadow: none;
    max-width: 100%;
  }

  #content {
    padding: 0;
  }
}

/* ---- Search / exercice3 selects ---- */
.search-selects {
  display: flex;
  gap: 1em;
  flex-wrap: wrap;
  margin-bottom: 1em;
}

.search-selects select {
  flex: 1 1 0;
  min-width: 12em;
  font-size: 0.92em;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.2em;
}

.search-select-title {
  font-weight: 700;
  color: var(--primary);
  background: var(--section-title-bg);
}

.search-actions {
  display: flex;
  gap: 0.7em;
  flex-wrap: wrap;
  margin: 1em 0 2em;
  max-width: 50%;
}

.search-submit {
  appearance: none;
  flex: 1 1 0;
  min-width: 8em;
  border: 1px solid rgba(16, 35, 64, 0.14);
  background: var(--primary-light);
  color: #fff;
  border-radius: 999px;
  padding: 0.55em 1.4em;
  font: inherit;
  font-size: 0.92em;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.search-submit:hover {
  background: var(--primary);
}

.search-submit:active {
  transform: scale(0.97);
}

.search-options {
  margin: 0.8em 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #f6f9fd;
}

.search-options summary {
  padding: 0.6em 1em;
  font-weight: 700;
  color: var(--primary);
  cursor: pointer;
  list-style: revert;
}

.search-options summary:hover {
  background: var(--section-title-bg);
}

.search-options-body {
  padding: 0.6em 1em 1em 1.8em;
}

.search-options-body label {
  cursor: pointer;
}

.search-textarea {
  width: 100%;
  font-family: var(--font-body);
  font-size: 0.95em;
  padding: 0.5em;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  resize: vertical;
}

.search-header-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6em 1.5em;
}

.search-header-grid label {
  display: flex;
  flex-direction: column;
  font-size: 0.9em;
  font-weight: 600;
  color: var(--text-subtle);
}

.search-header-grid input[type="text"] {
  margin-top: 0.2em;
  padding: 0.4em 0.5em;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  font-weight: 400;
  color: var(--text);
}

.search-header-full {
  grid-column: 1 / -1;
}

.search-header-full input[type="text"] {
  width: 100%;
}
