/* ============================================================
   Le Journal d'UX — CSS public
   Extrait de docs/prototype-v4.html (source de vérité)

   Grille baseline 12px, approche "divs fixes + nudge baseline"
   Font : SF Mono / Menlo / Consolas
   ============================================================ */

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

:root {
  --cell: 12px;
  --black: #0a0a0a;
  --border-strong: rgba(10,10,10,0.3);
  --border-light: rgba(10,10,10,0.15);
  --cyan: #06b6d4;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-300: #d1d5db;
  --page-w: 888px;
  --page-pad: 24px;
  --col-vote: 36px;
  --col-gap: 24px;

  --nudge-h1: 7px;
  --nudge-h2: 3.5px;
  --nudge-link: 5px;
  --nudge-nav: 7.5px;
  --nudge-body: 7px;
  --nudge-meta: 7.5px;
  --nudge-label: 7.5px;
}

body {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  color: var(--black);
  background: #fff;
  overflow-x: hidden;
}

/* ---- PAGE WRAPPER ---- */
.page-wrap {
  max-width: var(--page-w);
  width: 100%;
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 var(--page-pad);
  position: relative;
}

/* ---- GRID OVERLAY ---- */
.grid-overlay {
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(-1 * (100vw - var(--page-w)) / 2);
  width: 100vw;
  pointer-events: none;
  z-index: 9000;
  background-image:
    linear-gradient(to right, rgba(0,0,0,0.035) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0,0,0,0.035) 1px, transparent 1px);
  background-size: var(--cell) var(--cell);
  background-position: calc((100vw - var(--page-w)) / 2 + var(--page-pad)) 0;
}
.grid-overlay.off { display: none; }

/* ---- SPACER ---- */
.sp { width: 100%; }
.sp-12 { height: 12px; }
.sp-24 { height: 24px; }
.sp-36 { height: 36px; }
.sp-48 { height: 48px; }
.sp-60 { height: 60px; }
.sp-96 { height: 96px; }

/* ---- BLOCK ---- */
.bk {
  width: 100%;
  overflow: visible;
}

/* ---- TYPOGRAPHY avec nudge ---- */
.t-h1 {
  font-size: 33px;
  line-height: 36px;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: block;
  transform: translateY(var(--nudge-h1));
}
.t-h2 {
  font-size: 24px;
  line-height: 48px;
  font-weight: 700;
  display: block;
  transform: translateY(var(--nudge-h2));
}
.t-link {
  font-size: 19px;
  line-height: 24px;
  font-weight: 600;
  display: inline;
  transform: translateY(var(--nudge-link));
}
.t-link-wrap {
  display: block;
  transform: translateY(var(--nudge-link));
}
.t-nav {
  font-size: 18px;
  line-height: 24px;
  font-weight: 500;
  display: inline-block;
  transform: translateY(var(--nudge-nav));
}
.t-body {
  font-size: 15px;
  line-height: 24px;
  font-weight: 400;
  display: block;
  transform: translateY(var(--nudge-body));
}
.t-ad {
  font-size: 15px;
  line-height: 24px;
  font-weight: 400;
  transform: translateY(var(--nudge-body));
}
.t-meta {
  font-size: 14px;
  line-height: 24px;
  font-weight: 400;
  display: inline;
}
.t-meta-wrap {
  display: block;
  transform: translateY(var(--nudge-meta));
}
.t-label {
  font-size: 14px;
  line-height: 24px;
  font-weight: 400;
  display: block;
  transform: translateY(var(--nudge-label));
}

/* ---- LINES ---- */
.line-strong, .line-light {
  height: 0;
  position: relative;
}
.line-strong::after, .line-light::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 1px;
}
.line-strong::after { background: var(--border-strong); }
.line-light::after { background: var(--border-light); }

/* ---- LINKS ---- */
a { color: inherit; text-decoration: none; }
a:hover { color: var(--cyan); }
.lk { color: var(--cyan); }
.lk:hover { text-decoration: underline; }

/* ---- COLORS ---- */
.c-400 { color: var(--gray-400); }
.c-500 { color: var(--gray-500); }
.c-300 { color: var(--gray-300); }
.c-cyan { color: var(--cyan); }

/* ---- ARTICLE ROW ---- */
.row {
  display: grid;
  grid-template-columns: var(--col-vote) var(--col-gap) 1fr;
  align-items: start;
}

/* ---- VOTE COLUMN ---- */
.vote {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 36px;
}
.vote-arrow {
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  width: 12px;
  height: 24px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}
.vote-arrow::after {
  content: '';
  display: block;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 12px solid var(--gray-300);
}
.vote-arrow:hover::after { border-bottom-color: var(--cyan); }
.vote-arrow.on::after { border-bottom-color: var(--cyan); }
.vote-num {
  font-size: 16px;
  line-height: 24px;
  height: 24px;
  text-align: left;
  color: var(--gray-500);
  transform: translateY(var(--nudge-nav));
}
.vote-num.hot { color: var(--cyan); font-weight: 500; }

/* ---- NOTE BLOCK ---- */
.note {
  position: relative;
  padding-left: 24px;
}
.note::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: -12px;
  width: 2px;
  background: var(--border-light);
}

/* ---- NAV ---- */
.nav {
  display: grid;
  grid-template-columns: 108px 120px 144px 144px auto;
}
.nav a.on { color: var(--cyan); }
.nav a { color: var(--gray-500); font-size: 16px; line-height: 24px; font-weight: 500; }

/* ---- TOGGLES ---- */
.toggles { display: flex; gap: 48px; }
.toggles button {
  font-family: inherit;
  font-size: 18px;
  line-height: 24px;
  font-weight: 500;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-400);
  transform: translateY(var(--nudge-nav));
}
.toggles button.on {
  color: var(--black);
}

/* ---- AD BANNER ---- */
.ad-banner { display: flex; gap: 24px; align-items: baseline; }

/* ---- AD SPONSORED ---- */
.ad-box {
  display: grid;
  grid-template-columns: var(--col-vote) var(--col-gap) 1fr;
  box-shadow: inset 0 0 0 1px var(--border-light);
  padding: 24px;
  background: rgba(249,250,251,0.5);
}

/* ---- FOOTER ---- */
.foot-links { display: flex; flex-wrap: wrap; gap: 12px; }
.foot-nl {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.foot-nl input {
  font-family: inherit;
  font-size: 16px;
  height: 48px;
  width: 240px;
  padding: 0 24px;
  border: 1px solid var(--border-strong);
  background: #fff;
  -webkit-appearance: none;
  appearance: none;
  border-radius: 0;
  position: relative;
  z-index: 9001;
}
.foot-nl input:focus { outline: 2px solid var(--cyan); outline-offset: 0; }
.foot-nl button {
  font-family: inherit;
  font-size: 16px;
  height: 48px;
  padding: 0 24px;
  background: var(--black);
  color: #fff;
  border: none;
  cursor: pointer;
  position: relative;
  z-index: 9001;
}
.foot-nl button:hover { background: var(--cyan); }

/* ---- GRID TOGGLE BUTTON ---- */
.grid-btn {
  position: fixed;
  bottom: 12px;
  right: 12px;
  z-index: 9999;
  background: #111;
  color: #fff;
  font-family: inherit;
  font-size: 11px;
  padding: 6px 12px;
  cursor: pointer;
  border: none;
}

/* ---- COMMENTAIRE ---- */
.commentaire-action { cursor: pointer; }
.commentaire-action:hover { color: var(--gray-400); }
.comment-form {
  width: 100%;
}
.comment-form form {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.comment-textarea {
  font-family: inherit;
  font-size: 15px;
  line-height: 24px;
  width: 100%;
  height: 96px;
  padding: 12px 24px;
  border: 1px solid var(--border-light);
  background: #fff;
  color: var(--black);
  resize: none;
  -webkit-appearance: none;
  appearance: none;
  border-radius: 0;
  position: relative;
  z-index: 9001;
}
.comment-textarea:focus { outline: 2px solid var(--cyan); outline-offset: 0; }
.comment-btn {
  font-family: inherit;
  font-size: 16px;
  line-height: 48px;
  height: 48px;
  width: 132px;
  padding: 0;
  background: var(--black);
  color: #fff;
  border: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  border-radius: 0;
  position: relative;
  z-index: 9001;
}
.comment-btn:hover { background: var(--cyan); }
.comment-btn-cancel {
  background: transparent;
  color: var(--gray-400);
  border: 1px solid var(--border-light);
  width: auto;
  padding: 0 24px;
  margin-left: 12px;
}
.comment-btn-cancel:hover { background: transparent; color: var(--black); border-color: var(--black); }
.reply-textarea { height: 72px; }
.reply-form-active { width: 100%; }
.reply-btns { display: flex; gap: 12px; justify-content: flex-end; }

/* ---- USER MENU ---- */
.user-menu {
  position: absolute;
  right: 0;
  top: 12px;
  height: 24px;
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-size: 14px;
  line-height: 24px;
}
.user-menu span,
.user-menu button { transform: translateY(var(--nudge-meta)); }
.user-menu .user-pseudo { display: inline; }
.user-menu .user-sep { display: inline; }
.link-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
  color: var(--gray-400);
}
.link-btn:hover { color: var(--cyan); }

/* ---- AUTH FORMS ---- */
.auth-input,
form input[type="email"],
form input[type="text"],
form input[type="url"] {
  font-family: inherit;
  font-size: 16px;
  line-height: 24px;
  height: 48px;
  width: 100%;
  max-width: 420px;
  padding: 0 24px;
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--black);
  -webkit-appearance: none;
  appearance: none;
  border-radius: 0;
  position: relative;
  z-index: 9001;
}
form input[type="email"]:focus,
form input[type="text"]:focus,
form input[type="url"]:focus,
form select:focus { outline: 2px solid var(--cyan); outline-offset: 0; }
form select {
  font-family: inherit;
  font-size: 16px;
  line-height: 24px;
  height: 48px;
  width: 100%;
  max-width: 420px;
  padding: 0 24px;
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--black);
  -webkit-appearance: none;
  appearance: none;
  border-radius: 0;
  position: relative;
  z-index: 9001;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%239ca3af'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* ---- HINT TEXT ---- */
.hint-titre {
  display: block;
  transform: translateY(var(--nudge-meta));
}
.btn {
  font-family: inherit;
  font-size: 16px;
  line-height: 48px;
  height: 48px;
  padding: 0 36px;
  background: var(--black);
  color: #fff;
  border: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  border-radius: 0;
}
.btn:hover { background: var(--cyan); }
.btn:disabled, .btn[disabled] { background: var(--gray-300); cursor: not-allowed; }
.btn:disabled:hover, .btn[disabled]:hover { background: var(--gray-300); }

/* ---- INPUT PREFIX (@ for pseudo) ---- */
.input-prefix-wrap {
  position: relative;
  max-width: 420px;
}
.input-prefix-wrap input {
  padding-left: 36px;
}
.input-prefix {
  position: absolute;
  left: 12px;
  top: 0;
  height: 48px;
  line-height: 48px;
  font-family: inherit;
  font-size: 16px;
  color: var(--gray-400);
  pointer-events: none;
  z-index: 9002;
}

/* ---- CHECKBOX ---- */
.checkbox-wrap {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
}
.checkbox-wrap input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  border: 2px solid var(--border-strong);
  background: #fff;
  cursor: pointer;
  position: relative;
}
.checkbox-wrap input[type="checkbox"]:checked {
  border-color: var(--cyan);
  background: var(--cyan);
}
.checkbox-wrap input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 6px;
  top: 2px;
  width: 6px;
  height: 12px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* ---- COMMENT HIGHLIGHT ---- */
.comment-highlight {
  position: relative;
  z-index: 2;
  box-shadow: 0 0 0 12px #fff;
  background: #fff;
  animation: highlight-fade 7s ease-out forwards;
}
@keyframes highlight-fade {
  0%, 70% { box-shadow: 0 0 0 12px #fff; background: #fff; }
  100% { box-shadow: 0 0 0 12px transparent; background: transparent; }
}

/* ---- SECONDARY BUTTON ---- */
.btn-secondary {
  background: transparent;
  color: var(--gray-400);
  box-shadow: inset 0 0 0 1px var(--border-light);
  text-align: center;
  line-height: 48px;
  display: inline-block;
}
.btn-secondary:hover { background: transparent; color: var(--black); box-shadow: inset 0 0 0 1px var(--black); }

/* ---- DISABLED ACTIONS ---- */
.action-disabled {
  cursor: not-allowed;
  position: relative;
}
.action-disabled:hover::after {
  content: attr(title);
  position: absolute;
  left: 0;
  top: 100%;
  margin-top: 12px;
  padding: 12px;
  background: var(--black);
  color: #fff;
  font-size: 14px;
  line-height: 24px;
  white-space: nowrap;
  z-index: 9999;
}

/* ---- TRAP FIELD (anti password manager) ---- */
.trap-field {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  z-index: -1;
}

/* ---- UTILITY ---- */
.c-error { color: #ef4444; }
.form-inline { display: inline; }
.flex-actions { display: flex; gap: 24px; }
.flex-btns { display: flex; gap: 12px; }
.hidden { display: none; }

/* ---- TEXTAREA WRAP + CHAR COUNT ---- */
.textarea-wrap { position: relative; }
.char-count {
  position: absolute;
  bottom: 12px;
  right: 12px;
  pointer-events: none;
}

/* ---- META SEGMENTS ---- */
.meta-seg { white-space: nowrap; }
.meta-mobile { display: none; }

/* ---- FAB BUTTON (hidden on desktop) ---- */
.fab-soumettre {
  display: none;
}

/* ---- WIKI ---- */
.wiki-search-field {
  position: relative;
  display: flex;
}
.wiki-search input {
  flex: 1;
  font-family: inherit;
  font-size: 15px;
  line-height: 24px;
  height: 48px;
  padding: 0 24px;
  border: 1px solid var(--border-strong);
  border-right: none;
  background: #fff;
  color: var(--black);
  -webkit-appearance: none;
  appearance: none;
  border-radius: 0;
  min-width: 0;
}
.wiki-search input:focus { outline: 2px solid var(--cyan); outline-offset: 0; z-index: 2; }
.wiki-search-clear {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  font-size: 18px;
  color: var(--gray-400);
  text-decoration: none;
  border: 1px solid var(--border-strong);
  border-left: none;
  border-right: none;
  background: #fff;
  position: relative;
  z-index: 9001;
}
.wiki-search-clear:hover { color: var(--black); }
.wiki-search button {
  font-family: inherit;
  font-size: 16px;
  line-height: 48px;
  height: 48px;
  padding: 0 24px;
  background: var(--black);
  color: #fff;
  border: 1px solid var(--black);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  border-radius: 0;
}
.wiki-search button:hover { background: var(--cyan); border-color: var(--cyan); }

.wiki-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.wiki-filter {
  font-family: inherit;
  font-size: 14px;
  line-height: 24px;
  height: 36px;
  padding: 0 12px;
  background: none;
  cursor: pointer;
  color: var(--gray-400);
  border: 1px solid var(--border-light);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  -webkit-appearance: none;
  appearance: none;
  border-radius: 0;
}
.wiki-filter:hover { border-color: var(--border-strong); color: var(--black); }
.wiki-filter.on { border-color: var(--black); color: var(--black); }

.wiki-entry-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.wiki-badge {
  font-family: inherit;
  font-size: 14px;
  line-height: 24px;
  color: var(--gray-400);
  white-space: nowrap;
}

.wiki-title-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.wiki-type-badge {
  font-family: inherit;
  font-size: 14px;
  line-height: 24px;
  color: var(--gray-400);
  box-shadow: inset 0 0 0 1px var(--border-light);
  padding: 0 12px;
  white-space: nowrap;
  text-decoration: none;
}
.wiki-type-badge:hover {
  color: var(--black);
  box-shadow: inset 0 0 0 1px var(--border-strong);
}

/* ---- RESPONSIVE MOBILE ---- */
@media (max-width: 888px) {
  .page-wrap {
    padding: 0 12px;
  }

  /* Grille visible, bouton grille masqué */
  .grid-overlay {
    left: 0;
    background-position: 12px 0;
  }
  .grid-btn {
    display: none;
  }

  /* User menu sur mobile : juste déconnexion */
  .user-menu {
    position: static;
    height: 24px;
    line-height: 24px;
    margin-top: 0;
    transform: none;
  }
  .user-menu .user-pseudo { display: none; }
  .user-menu .user-sep { display: none; }

  /* Moins d'espace au-dessus du logo */
  .sp-top-page {
    height: 24px;
  }

  /* Baseline : auto-height pour le retour à la ligne */
  .bk-baseline {
    height: auto !important;
    min-height: 24px;
  }

  /* Réduire l'espace entre filet et nav */
  .sp-pre-nav {
    height: 12px;
  }

  /* Grille articles : gap réduit de 24px à 12px (1 case au lieu de 2) */
  .row {
    grid-template-columns: var(--col-vote) 12px 1fr;
  }

  /* H1 */
  .t-h1 {
    font-size: 24px;
    line-height: 36px;
  }

  /* Titres h2 réduits (18px/24px) — nudge-nav car même taille que la nav */
  .t-h2 {
    font-size: 18px;
    line-height: 24px;
    transform: translateY(var(--nudge-nav));
  }
  .bk:has(> .t-h2),
  .bk:has(> h2.t-h2) {
    height: 24px !important;
  }

  /* Titres articles réduits (16px) — nudge-nav car 16px/24px comme nav links */
  .t-link {
    font-size: 16px;
  }
  .t-link-wrap {
    transform: translateY(var(--nudge-nav));
  }

  /* Flèches de vote : pas de nudge, restent calées dans la grille */

  /* Nav en grille 2x2 (4 items, Soumettre masqué) */
  .nav-bk {
    height: auto !important;
  }
  .nav {
    display: grid;
    grid-template-columns: 168px 1fr;
    row-gap: 12px;
  }
  .nav a {
    font-size: 18px;
    line-height: 24px;
    transform: translateY(var(--nudge-nav));
  }

  /* Soumettre masqué dans la nav, FAB affiché */
  .nav-soumettre {
    display: none;
  }
  .fab-soumettre {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    bottom: 12px;
    right: 12px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--black);
    color: #fff;
    font-family: inherit;
    font-size: 24px;
    line-height: 48px;
    z-index: 9998;
    text-decoration: none;
  }
  .fab-soumettre:hover {
    background: var(--cyan);
    color: #fff;
  }

  /* com. sur mobile, commentaire(s) sur desktop */
  .meta-desktop { display: none; }
  .meta-mobile { display: inline; }

  /* Ad banner */
  .ad-banner {
    flex-wrap: wrap;
    gap: 12px;
  }
  .ad-banner a[style*="margin-left:auto"] {
    margin-left: 0 !important;
  }
  .ad-banner span.c-300 {
    display: none;
  }

  /* Footer */
  .foot-nl input {
    width: 100%;
  }
  .foot-nl {
    flex-direction: column;
    align-items: flex-start;
  }
  .foot-nl button {
    width: 100%;
  }

  /* Wiki */
  .wiki-search-field {
    flex-direction: column;
  }
  .wiki-search input {
    border-right: 1px solid var(--border-strong);
  }
  .wiki-search-clear {
    border: 1px solid var(--border-strong);
    border-top: none;
    border-bottom: none;
    width: 100%;
    height: 48px;
  }
  .wiki-search button {
    width: 100%;
  }

  /* Tooltip : wrap text on mobile */
  .action-disabled:hover::after {
    white-space: normal;
    max-width: 264px;
  }
}
