/* =========================================================
   PhysAlgo — catalogues NSI & Physique
   CSS autonome, sans Bootstrap.
   ========================================================= */

:root {
  --bg: #07111d;
  --bg-soft: #0b1726;
  --surface: rgba(15, 29, 46, .82);
  --surface-hover: rgba(22, 41, 62, .94);
  --line: rgba(255,255,255,.10);
  --text: #f5f1e7;
  --muted: #9eacba;
  --gold: #d8aa58;
  --gold-light: #f0cf8d;
  --cyan: #54d6d1;
  --blue: #61a7ff;
  --violet: #a981ff;
  --radius: 20px;
  --shell: 1180px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 8%, rgba(84,214,209,.065), transparent 25rem),
    radial-gradient(circle at 88% 12%, rgba(216,170,88,.065), transparent 27rem),
    var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body.theme-nsi {
  --accent: var(--cyan);
  --accent-soft: rgba(84,214,209,.13);
}

body.theme-phy {
  --accent: var(--gold-light);
  --accent-soft: rgba(216,170,88,.13);
}

a {
  color: inherit;
}

.shell {
  width: min(calc(100% - 2rem), var(--shell));
  margin-inline: auto;
}


/* En-tête -------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  border-bottom: 1px solid rgba(255,255,255,.07);
  background: rgba(7,17,29,.88);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.nav-shell {
  width: min(calc(100% - 2rem), var(--shell));
  min-height: 66px;
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .72rem;
  text-decoration: none;
}

.brand-mark {
  min-width: 42px;
  height: 42px;
  padding-inline: .55rem;
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  border-radius: 13px;
  color: var(--accent);
  background: var(--accent-soft);
  font-family: Georgia, "Times New Roman", serif;
  font-size: .84rem;
  font-weight: 900;
  letter-spacing: .06em;
}

.brand-text {
  display: grid;
  line-height: 1.15;
}

.brand-text strong {
  font-size: .98rem;
  letter-spacing: .035em;
}

.brand-text small {
  margin-top: .16rem;
  color: var(--muted);
  font-size: .63rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: .35rem;
}

.nav-home,
.nav-dropdown > summary {
  padding: .6rem .75rem;
  border-radius: 10px;
  color: #dce5ee;
  text-decoration: none;
  cursor: pointer;
  list-style: none;
  font-size: .88rem;
  transition: background .18s ease, color .18s ease;
}

.nav-dropdown > summary::-webkit-details-marker {
  display: none;
}

.nav-dropdown > summary::after {
  content: "⌄";
  margin-left: .4rem;
  color: var(--accent);
}

.nav-home:hover,
.nav-home:focus-visible,
.nav-dropdown > summary:hover,
.nav-dropdown > summary:focus-visible,
.nav-dropdown[open] > summary {
  background: rgba(255,255,255,.065);
  color: #fff;
  outline: none;
}

.nav-dropdown {
  position: relative;
}

.dropdown-panel {
  position: absolute;
  top: calc(100% + .5rem);
  right: 0;
  width: min(330px, calc(100vw - 1.5rem));
  padding: .5rem;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(10,23,37,.985);
  box-shadow: 0 22px 60px rgba(0,0,0,.38);
}

.dropdown-panel a,
.dropdown-panel span {
  display: block;
  padding: .68rem .72rem;
  border-radius: 9px;
  color: #d5dfe9;
  text-decoration: none;
  font-size: .82rem;
}

.dropdown-panel a:hover,
.dropdown-panel a:focus-visible {
  background: rgba(255,255,255,.065);
  color: #fff;
  outline: none;
}

.dropdown-panel--info span {
  color: var(--muted);
}

/* Introduction ---------------------------------------------- */

.page-intro {
  padding: clamp(1.5rem, 4vw, 3rem) 0 clamp(1.2rem, 2.8vw, 2rem);
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  align-items: end;
  gap: 2rem;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 .38rem;
  color: var(--accent);
  font-size: .7rem;
  font-weight: 900;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.page-intro h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4.8vw, 4rem);
  line-height: .98;
  letter-spacing: -.035em;
}

.page-intro > p {
  max-width: 520px;
  margin: 0 0 .15rem auto;
  color: var(--muted);
  font-size: .94rem;
}

/* Catalogue ------------------------------------------------ */

.catalogue {
  padding-block: clamp(1.2rem, 3vw, 2.4rem) clamp(2.2rem, 5vw, 4.5rem);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: .9rem;
}

.category-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, rgba(255,255,255,.045), rgba(255,255,255,.018));
}

.page-nsi .category-card:nth-child(5) {
  grid-column: 1 / -1;
}

.category-card > summary {
  min-height: 75px;
  padding: .9rem 1rem;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: .8rem;
  list-style: none;
  cursor: pointer;
  user-select: none;
}

.category-card > summary::-webkit-details-marker {
  display: none;
}

.category-card > summary:hover {
  background: rgba(255,255,255,.025);
}

.category-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--accent) 34%, transparent);
  border-radius: 13px;
  color: var(--accent);
  background: var(--accent-soft);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .92rem;
  font-weight: 900;
}

.category-title {
  display: grid;
  gap: .08rem;
}

.category-title strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.05rem, 2vw, 1.42rem);
  line-height: 1.12;
}

.category-title small {
  color: var(--muted);
  font-size: .7rem;
}

.category-chevron {
  color: var(--accent);
  transition: transform .18s ease;
}

.category-card[open] .category-chevron {
  transform: rotate(180deg);
}

.resource-list {
  margin: 0;
  padding: 0 .72rem .72rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .52rem;
  list-style: none;
}

.resource-link {
  min-height: 62px;
  padding: .72rem .78rem;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: .75rem;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 12px;
  color: #dbe5ee;
  background: rgba(255,255,255,.028);
  text-decoration: none;
  font-size: .80rem;
  line-height: 1.35;
  transition:
    transform .18s ease,
    border-color .18s ease,
    background .18s ease;
}

.resource-link:hover,
.resource-link:focus-visible {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 36%, transparent);
  background: var(--surface-hover);
  color: #fff;
  outline: none;
}

.resource-arrow {
  color: var(--accent);
  font-size: .95rem;
}

/* Footer --------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--line);
  background: #050d16;
}

.footer-grid {
  padding-block: 2rem;
  display: grid;
  grid-template-columns: 1.1fr 1fr .7fr;
  gap: 2rem;
}

.footer-brand,
.footer-title {
  margin: 0 0 .7rem;
  color: var(--accent);
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.footer-muted {
  margin: .3rem 0;
  color: var(--muted);
  font-size: .76rem;
}

.footer-links {
  margin: 0;
  padding: 0;
  display: grid;
  gap: .36rem;
  list-style: none;
}

.footer-links a,
.footer-contact {
  color: #aebbc8;
  text-decoration: none;
  font-size: .76rem;
}

.footer-links a:hover,
.footer-links a:focus-visible,
.footer-contact:hover,
.footer-contact:focus-visible {
  color: #fff;
  text-decoration: underline;
  text-underline-offset: .22em;
}

.footer-bottom {
  min-height: 50px;
  padding-block: .7rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-top: 1px solid var(--line);
  color: #6f7d8b;
  font-size: .7rem;
}

/* Responsive ------------------------------------------------ */

@media (max-width: 850px) {
  .nav-shell {
    min-height: 62px;
  }

  .brand-text small {
    display: none;
  }

  .page-intro {
    grid-template-columns: 1fr;
    gap: .65rem;
  }

  .page-intro > p {
    margin-left: 0;
  }

  .catalogue {
    grid-template-columns: 1fr;
  }

  .page-nsi .category-card:nth-child(5) {
    grid-column: auto;
  }

  .footer-grid {
    grid-template-columns: repeat(2, minmax(0,1fr));
  }
}

@media (max-width: 620px) {
  .shell,
  .nav-shell {
    width: min(calc(100% - 1rem), var(--shell));
  }

  .nav-shell {
    align-items: center;
    gap: .5rem;
  }

  .brand-mark {
    min-width: 38px;
    height: 38px;
  }

  .main-nav {
    gap: .1rem;
  }

  .nav-home,
  .nav-dropdown > summary {
    padding: .52rem .46rem;
    font-size: .76rem;
  }

  .dropdown-panel {
    position: fixed;
    top: 62px;
    left: .5rem;
    right: .5rem;
    width: auto;
  }

  .page-intro {
    padding-top: 1.2rem;
  }

  .page-intro h1 {
    font-size: clamp(1.85rem, 9vw, 2.7rem);
  }

  .resource-list {
    grid-template-columns: 1fr;
  }

  .category-card > summary {
    min-height: 66px;
    padding: .75rem;
  }

  .category-icon {
    width: 42px;
    height: 42px;
  }

  .resource-link {
    min-height: 55px;
    font-size: .78rem;
  }

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

  .footer-bottom {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .001ms !important;
  }
}
