:root {
  --bg: #14161c;
  --bg-elevated: #1b1e26;
  --bg-hover: #21242e;
  --text: #e7e4dc;
  --text-muted: #9a9689;
  --text-faint: #6c6a61;
  --accent: #c9a227;
  --accent-soft: rgba(201, 162, 39, 0.16);
  --rule: #2a2d36;
  --shadow: rgba(0, 0, 0, 0.35);

  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;

  --sidebar-w: 232px;
  --content-max: 840px;

  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #f6f3ec;
  --bg-elevated: #ffffff;
  --bg-hover: #efeade;
  --text: #201f1a;
  --text-muted: #6b665a;
  --text-faint: #948e7f;
  --accent: #a1730c;
  --accent-soft: rgba(161, 115, 12, 0.12);
  --rule: #e0dac9;
  --shadow: rgba(30, 25, 10, 0.08);

  color-scheme: light;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  transition: background 0.25s ease, color 0.25s ease;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol { list-style: none; margin: 0; padding: 0; }

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

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

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--bg-elevated);
  padding: 0.1em 0.4em;
  border-radius: 3px;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.25rem 1.5rem;
  padding: 1.25rem 2rem;
  border-bottom: 1px solid var(--rule);
}

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

.site-mark {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
}

.site-mark__glyph {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--accent);
  line-height: 1;
}

.site-mark__text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.site-mark__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  letter-spacing: 0.01em;
}

.site-mark__tagline {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

.search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1 1 260px;
  max-width: 380px;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--rule);
  transition: border-color 0.15s ease;
}

.search:focus-within { border-color: var(--accent); }

.search svg {
  width: 15px;
  height: 15px;
  color: var(--text-faint);
  flex-shrink: 0;
}

.search input {
  flex: 1;
  min-width: 0;
  border: none;
  background: none;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.9rem;
  outline: none;
}

.search input::placeholder { color: var(--text-faint); }

.search-results {
  position: absolute;
  top: calc(100% + 0.6rem);
  left: 0;
  right: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--rule);
  border-radius: 8px;
  box-shadow: 0 12px 28px var(--shadow);
  max-height: 320px;
  overflow-y: auto;
  z-index: 30;
  padding: 0.35rem;
}

.search-results li a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0.6rem;
  border-radius: 5px;
  font-size: 0.88rem;
}

.search-results li a:hover { background: var(--bg-hover); }

.search-results__title {
  font-family: var(--font-display);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-results__cat {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent);
  white-space: nowrap;
}

.theme-toggle {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.3rem;
}

.theme-toggle__track {
  position: relative;
  width: 38px;
  height: 20px;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--rule);
  transition: background 0.2s ease;
}

.theme-toggle__thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  transition: transform 0.2s ease;
}

[data-theme="light"] .theme-toggle__thumb {
  transform: translateX(18px);
}

.theme-toggle__label span { display: none; }
.theme-toggle__label span[data-mode="dark"] { display: inline; }
[data-theme="light"] .theme-toggle__label span { display: none; }
[data-theme="light"] .theme-toggle__label span[data-mode="light"] { display: inline; }

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: calc(100vh - 140px);
}

.sidebar {
  border-right: 1px solid var(--rule);
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 2rem;
}

.sidebar__eyebrow {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 0.75rem;
}

.sidebar__nav ul {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.sidebar__nav a {
  display: block;
  padding: 0.45rem 0.6rem;
  margin-left: -0.6rem;
  border-radius: 4px;
  font-size: 0.92rem;
  color: var(--text-muted);
  border-left: 2px solid transparent;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.sidebar__nav a:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.sidebar__nav a[aria-current="page"] {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--accent-soft);
}

.sidebar__submenu summary {
  display: block;
  padding: 0.45rem 0.6rem;
  margin-left: -0.6rem;
  border-radius: 4px;
  font-size: 0.92rem;
  color: var(--text-muted);
  cursor: pointer;
  list-style: none;
}

.sidebar__submenu summary::-webkit-details-marker { display: none; }

.sidebar__submenu summary::after {
  content: "›";
  float: right;
  transition: transform 0.15s ease;
}

.sidebar__submenu[open] summary::after { transform: rotate(90deg); }

.sidebar__submenu summary:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.sidebar__submenu ul {
  margin-top: 0.15rem;
  padding-left: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.sidebar__submenu ul a { font-size: 0.88rem; }

.sidebar__foot p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.content {
  padding: 3rem 3rem 4rem;
  max-width: 100%;
  width: 100%;
}

.hero {
  max-width: var(--content-max);
  margin-bottom: 3.5rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--rule);
}

.hero__eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 1rem;
}

.hero__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  line-height: 1.05;
  margin: 0 0 1rem;
}

.hero__lede {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 46ch;
  margin: 0;
}

.hero__body {
  margin-top: 1.5rem;
  max-width: 60ch;
  color: var(--text-muted);
}
.hero__body p { margin: 0 0 1rem; }
.hero__body p:last-child { margin-bottom: 0; }
.hero__body a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }

.dashboard { margin-bottom: 3.5rem; }

.dashboard__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 1rem;
}

.dashboard__card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1.1rem 1.2rem;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--bg-elevated);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.dashboard__card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.dashboard__card-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.05rem;
}

.dashboard__card-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.dashboard__card-count {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-faint);
  margin-top: auto;
  padding-top: 0.4rem;
}

.featured { margin-bottom: 3.5rem; }

.featured__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.25rem;
}

.featured__card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.25rem;
  border: 1px solid var(--rule);
  border-radius: 8px;
  transition: border-color 0.15s ease;
}

.featured__card:hover { border-color: var(--accent); }
.featured__card:hover .featured__card-title { color: var(--accent); }

.featured__card-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.1rem;
  transition: color 0.15s ease;
}

.featured__card-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.featured__card-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.15rem;
}

.post-list__eyebrow,
.section-head__eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 0 0 1.25rem;
}

.section-head { margin-bottom: 2.5rem; }

.section-head__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 2.1rem;
  margin: 0 0 0.75rem;
}

.section-head__desc { color: var(--text-muted); max-width: 60ch; }

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.filter-bar__btn {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.03em;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.filter-bar__btn:hover { color: var(--text); border-color: var(--text-muted); }

.filter-bar__btn.is-active {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.post-list__items {
  display: flex;
  flex-direction: column;
}

.post-list__item {
  display: grid;
  grid-template-columns: 2.6rem minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 1rem;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--rule);
}

.post-list__num {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent);
}

.post-list__link {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.post-list__title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 500;
  transition: color 0.15s ease;
}

.post-list__item:hover .post-list__title { color: var(--accent); }

.post-list__desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.post-list__cats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.25rem;
}

.tag--sm {
  font-size: 0.66rem;
  padding: 0.08rem 0.45rem;
}

.post-list__item.post-list__item--term {
  grid-template-columns: minmax(0, 1fr) auto;
}

.term-back {
  margin-top: 2rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.term-back a { color: var(--text-muted); }
.term-back a:hover { color: var(--accent); }

.post-list__date {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-faint);
  white-space: nowrap;
}

.post-list--empty {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.post { max-width: var(--content-max); }

.post__eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 1rem;
}

.post__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  line-height: 1.1;
  margin: 0 0 1rem;
}

.post__meta {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-faint);
  padding-bottom: 2rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--rule);
}

.tag {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  margin-right: 0.35rem;
  transition: background 0.15s ease;
}

a.tag:hover { background: var(--rule); }

.tag--muted {
  background: var(--bg-elevated);
  color: var(--text-muted);
}

.post__body { font-size: 1.02rem; }
.post__body h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  margin: 2.2rem 0 1rem;
}
.post__body h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  margin: 1.8rem 0 0.8rem;
}
.post__body p { margin: 0 0 1.2rem; }
.post__body a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.post__body blockquote {
  margin: 1.5rem 0;
  padding: 0.2rem 0 0.2rem 1.2rem;
  border-left: 2px solid var(--accent);
  color: var(--text-muted);
  font-style: italic;
}
.post__body pre {
  background: var(--bg-elevated);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 1rem;
  overflow-x: auto;
}
.post__body pre code { background: none; padding: 0; }
.post__body ul, .post__body ol {
  margin: 0 0 1.2rem;
  padding-left: 1.4rem;
  list-style: disc;
}
.post__body ol { list-style: decimal; }

.gallery {
  position: relative;
  margin: 2rem auto;
  overflow: hidden;
  border-radius: 8px;
  transition: height 0.25s ease;
}

.gallery__track {
  display: flex;
  gap: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  height: 100%;
}

.gallery__track::-webkit-scrollbar { display: none; }

.gallery__item {
  flex: 0 0 100%;
  width: 100%;
  margin: 0;
  scroll-snap-align: start;
  background: var(--bg-elevated);
  border: 1px solid var(--rule);
  border-radius: 8px;
  overflow: hidden;
}

.gallery__item img {
  width: 100%;
  height: auto;
  max-height: 70vh;
  object-fit: contain;
  display: block;
}

.gallery__item figcaption {
  padding: 0.6rem 0.8rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.gallery__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--rule);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  font-size: 1.15rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px var(--shadow);
}

.gallery__nav--prev { left: -14px; }
.gallery__nav--next { right: -14px; }

@media (max-width: 820px) {
  .gallery__nav { display: none; }
}

.site-footer {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  padding: 1.5rem;
  border-top: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-faint);
}

@media (max-width: 820px) {
  .search {
    order: 3;
    flex-basis: 100%;
    max-width: none;
  }

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

  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--rule);
    flex-direction: row;
    align-items: center;
    padding: 1rem 1.5rem;
    overflow-x: auto;
  }

  .sidebar__nav ul {
    flex-direction: row;
    gap: 0.5rem;
  }

  .sidebar__nav a { margin-left: 0; border-left: none; border-bottom: 2px solid transparent; }
  .sidebar__nav a[aria-current="page"] { border-left: none; border-bottom-color: var(--accent); }

  .sidebar__foot { display: none; }

  .content { padding: 2rem 1.25rem 3rem; }

  .post-list__item {
    grid-template-columns: 2rem 1fr;
  }

  .post-list__date { grid-column: 2; order: 3; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

.img-text {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  margin: 2rem 0;
}

.img-text--right { flex-direction: row-reverse; }

.img-text img {
  flex: 0 0 42%;
  max-width: 42%;
  border-radius: 8px;
  border: 1px solid var(--rule);
}

.img-text__body { flex: 1; min-width: 0; }
.img-text__body p:first-child { margin-top: 0; }
.img-text__body p:last-child { margin-bottom: 0; }

@media (max-width: 640px) {
  .img-text { flex-direction: column; }
  .img-text img { max-width: 100%; flex: 0 0 auto; }
}

.card-row {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--rule);
  border-radius: 8px;
  margin: 1rem 0;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.card-row:hover {
  border-color: var(--accent);
  background: var(--bg-hover);
}

.card-row__img {
  flex: 0 0 72px;
  width: 72px;
  height: 72px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg);
  border: 1px solid var(--rule);
}

.card-row__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-row__content {
  flex: 1;
  min-width: 0;
}

.card-row__content h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  margin: 0 0 0.25rem 0;
  color: var(--text);
}

.card-row__content p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.dropdown-details {
  background: var(--bg-elevated);
  border: 1px solid var(--rule);
  border-radius: 8px;
  margin: 1.5rem 0;
  padding: 0.8rem 1.2rem;
  transition: border-color 0.15s ease;
}

.dropdown-details[open] {
  border-color: var(--accent);
}

.dropdown-details summary {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.02rem;
  color: var(--text);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}

.dropdown-details summary::after {
  content: "›";
  font-family: var(--font-mono);
  font-size: 1.2rem;
  color: var(--accent);
  transition: transform 0.2s ease;
}

.dropdown-details[open] summary::after {
  transform: rotate(90deg);
}

.dropdown-content {
  margin-top: 0.8rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--rule);
  font-size: 0.95rem;
  color: var(--text-muted);
}

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

.lexicon-index {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--rule);
}

.lexicon-index a {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--rule);
  background: var(--bg-elevated);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.92rem;
  color: var(--text-muted);
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.lexicon-index a:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-2px);
}

/* Pour les affichage de lien Mastodon */

.embed-mastodon {
  margin: 2rem auto;
  max-width: 100%;
}

/* Pareil pour Pixelfed */

.embed-pixelfed {
  margin: 2rem auto;
}

/* Pour les affichage PDF */

.pdf-container {
  width: 100%;
  max-width: 600px;
  margin: 2rem;
  border: 1px solid var(--rule);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-elevated);
}

.pdf-container iframe {
  display: block;
  width: 100%;
  height: 600px;
  border: none;
}

.pdf-fallback {
  padding: 1rem;
  text-align: center;
  background: var(--bg-hover);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  border-top: 1px solid var(--rule);
}

.pdf-fallback a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

@media (max-width: 768px) {
  .pdf-container iframe {
    height: 400px;
  }
}

/* page principale, affichage ajout sur la droite */

.home-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 3rem;
  align-items: start;
}

.home-recent {
  position: sticky;
  top: 2rem;
  border-left: 1px solid var(--rule);
  padding-left: 1.5rem;
}

.home-recent__list {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.home-recent__item a {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.home-recent__title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--text);
  transition: color 0.15s ease;
}

.home-recent__item:hover .home-recent__title { color: var(--accent); }

.home-recent__date {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-faint);
}

@media (max-width: 960px) {
  .home-layout {
    grid-template-columns: 1fr;
  }

  .home-recent {
    position: static;
    border-left: none;
    padding-left: 0;
    border-top: 1px solid var(--rule);
    padding-top: 1.5rem;
    margin-top: 1rem;
  }
}