/* File: public/css/pages/module.css */

@import "../components/link-block.css";
@import "../components/link-list.css";
@import "../components/module-mode-emploi.css";

/* ============================================================
   MODULES PAGE (OVERVIEW)
   - Dedicated CSS replacing creator.css for /modules
   ============================================================ */

/* ------------------------------------------------------------
   LEFT: Year list (annual certificates)
   Goal: underline across full width + slight tilt on hover
   ------------------------------------------------------------ */

.module-year-links {
  margin-top: 0.75rem;
  border-top: 1px solid var(--divider-color);
}

/* Render as a vertical list (not grid cards) */
.module-year-links .linkBlock-item {
  aspect-ratio: auto;
  width: 100%;
  padding: 0.75rem 0.25rem;
  background-clip: border-box;
  border-bottom: 1px solid var(--divider-color);
  display: flex;
  align-items: center;
  justify-content: flex-start;

  /* remove grid-card dividers from creator-style linkBlock */
  position: relative;
}

.module-year-links .linkBlock-item::before,
.module-year-links .linkBlock-item::after {
  display: none;
}

.module-year-links .linkBlock-item:last-child {
  border-bottom: none;
}

/* Text: align left, single year */
.module-year-links .linkBlock-text {
  display: block;
  text-align: left;
  line-height: 1.2;
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);

  transition:
    transform 120ms ease-out,
    font-weight 120ms ease-out;
}

/* Hover: underline already full-width via border-bottom, so do tilt + subtle emphasis */
.module-year-links .linkBlock-item:hover,
.module-year-links .linkBlock-item:focus {
  background-color: var(--ink-overlay-faint);
  outline: none;
}

.module-year-links .linkBlock-item:hover .linkBlock-text,
.module-year-links .linkBlock-item:focus .linkBlock-text {
  transform: translateX(2px) rotate(-0.8deg);
  font-weight: var(--font-weight-bold);
}

/* Current-year credits-progress line ("{n} / 8 crédits {year}"), shown
   under the attestations heading for logged-in users. */
.module-credits-progress {
  margin: 0 0 0.5rem;
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  color: var(--text-color);
}

/* ------------------------------------------------------------
   RIGHT: Module grid list (reuse linkBlock grid)
   Keep same behavior as creator.css grid for the main modules list
   ------------------------------------------------------------ */

.linkBlock {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: 100%;
  margin: 1rem auto 0;
  gap: 0;
}

@media (max-width: 1200px) {
  .linkBlock {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .linkBlock {
    display: block; /* Each item becomes a row */
  }
}

/* Card-like behavior (same as creator.css) */
.linkBlock-item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  width: 100%;
  background-color: transparent;
  text-decoration: none;
  color: var(--main-text-color);
  padding: 10%;
  background-clip: content-box;
  z-index: var(--z-base);
  transition: background-color 0.2s ease;
}

@media (max-width: 768px) {
  .linkBlock-item {
    aspect-ratio: auto;
    width: 100%;
    padding: 0.75rem 1rem;
    background-clip: border-box;
    border-bottom: 1px solid var(--divider-color);
    display: flex;
    align-items: center;
    justify-content: flex-start;
  }

  .linkBlock-item:last-child {
    border-bottom: none;
  }
}

/* Right divider (disabled on mobile) */
.linkBlock-item::after {
  content: "";
  position: absolute;
  top: 10%;
  bottom: 10%;
  right: 0;
  width: 1px;
  background-color: var(--divider-color);
  z-index: var(--z-sticky);
}

.linkBlock-item:nth-child(4n)::after {
  display: none;
}

@media (max-width: 1200px) {
  .linkBlock-item:nth-child(4n)::after {
    display: block;
  }
  .linkBlock-item:nth-child(3n)::after {
    display: none;
  }
}

@media (max-width: 768px) {
  .linkBlock-item::after {
    display: none;
  }
}

/* Bottom divider (handled by border on mobile) */
.linkBlock-item::before {
  content: "";
  position: absolute;
  left: 10%;
  right: 10%;
  bottom: 0;
  height: 1px;
  background-color: var(--divider-color);
  z-index: var(--z-sticky);
}

@media (max-width: 768px) {
  .linkBlock-item::before {
    display: none;
  }
}

/* Text content */
.linkBlock-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.3;
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  transition: font-size 0.2s ease, font-weight 0.2s ease;
}

/* Hover and focus */
.linkBlock-item:hover,
.linkBlock-item:focus {
  background-color: var(--ink-overlay-faint);
  outline: none;
}

.linkBlock-item:hover .linkBlock-text,
.linkBlock-item:focus .linkBlock-text {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-bold);
}

/* Per-module state badge (stacks under the title inside .linkBlock-text) */
.module-state-badge {
  display: inline-block;
  margin-top: 0.45rem;
  padding: 0.12rem 0.6rem;
  border: 1px solid transparent;
  border-radius: var(--brand-radius-pill);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  line-height: 1.5;
  white-space: nowrap;
}

.module-state-badge--validated {
  background: var(--brand-ink);
  color: var(--brand-bg);
}

/* Actionable "take the final test now" state — petrol accent so it stands
   out from the neutral in-progress / available badges. */
.module-state-badge--to-validate {
  background: var(--brand-accent-deep);
  color: var(--brand-bg);
}

.module-state-badge--in-progress {
  background: var(--ink-overlay-faint);
  color: var(--brand-ink);
}

.module-state-badge--available {
  color: var(--text-muted);
  border-color: var(--accent-border-soft);
}

/* ============================================================
   Help trigger + popup (modules landing)
   ============================================================ */

.module-help-trigger-wrapper {
  margin-top: 8px;
  margin-bottom: 18px;
}

.module-help-trigger {
  text-decoration: underline;
}

.module-help-popup__close {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 28px;
  line-height: 1;
}

.module-help-popup__title {
  margin-bottom: 16px;
}

/* Reading-width popup for the sectioned Mode d'emploi (parity with the
   first-visit guide modal — both render the shared `.me-*` content). */
#module-help-popup .popup {
  width: 660px;
}

/* ============================================================
   E-learning anonymous login-wall (relaunch S2; redesign 2026-06-18)
   The public conversion surface a logged-out visitor sees on a module
   DETAIL page (full-page render via ModuleWallRenderer::renderPage, which
   loads this sheet). A centered, contained card — eyebrow · headline · lead ·
   benefit bullets · prominent CTA — instead of bare top-left text + a stranded
   button. All colours/shadows from the design tokens (_variables.css).
   ============================================================ */

.module-wall {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 45vh;
  padding: clamp(2rem, 7vh, 5rem) 1rem;
}

.module-wall__card {
  width: 100%;
  max-width: 640px;
  box-sizing: border-box;
  padding: clamp(1.75rem, 5vw, 3rem);
  text-align: center;
  background: var(--surface-glass-strong);
  border: 1px solid var(--accent-border-soft);
  border-radius: var(--brand-radius);
  box-shadow: var(--shadow-strong);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.module-wall__eyebrow {
  margin: 0 0 0.6rem;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand-accent-deep);
}

.module-wall__title {
  margin: 0 0 0.85rem;
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-black);
  line-height: 1.15;
  color: var(--brand-ink);
}

.module-wall__lead {
  max-width: 48ch;
  margin: 0 auto 1.5rem;
  font-size: var(--font-size-lg);
  line-height: 1.5;
  color: var(--text-color);
}

.module-wall__lead p {
  margin: 0;
}

/* Benefit bullets: centered block, left-aligned items, ink checkmarks */
.module-wall__benefits {
  max-width: 30rem;
  margin: 0 auto 1.75rem;
  text-align: left;
}

.module-wall__benefits ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.7rem;
}

.module-wall__benefits li {
  position: relative;
  padding-left: 2.1rem;
  font-size: var(--font-size-base);
  line-height: 1.4;
  color: var(--brand-ink);
}

.module-wall__benefits li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 0.05em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.45rem;
  height: 1.45rem;
  border-radius: var(--brand-radius-pill);
  /* On-brand: black ink check in a faint neutral chip — the green success
     chip read as off-brand UI chrome. font-family:inherit keeps the glyph on
     the site's Naoko stack rather than a system/emoji checkmark. */
  background: var(--ink-overlay-faint);
  color: var(--brand-ink);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: var(--font-weight-bold);
}

/* Prominent filled CTA — overrides the outline `.btn-primary` (incl. its
   hover font-size rule) for this surface only. */
.module-wall__cta {
  margin-top: 0.5rem;
}

.module-wall__cta .btn-primary {
  padding: 0.85rem 2.2rem;
  border-radius: var(--brand-radius-pill);
  background: var(--brand-ink);
  color: var(--brand-bg);
  border-color: var(--brand-ink);
  box-shadow: var(--shadow-medium);
  transition:
    background-color var(--transition-medium) var(--easing-standard),
    transform var(--transition-fast) var(--easing-standard),
    box-shadow var(--transition-medium) var(--easing-standard);
}

.module-wall__cta .btn-primary .btn-text,
.module-wall__cta .btn-primary:hover .btn-text {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
}

.module-wall__cta .btn-primary:hover {
  background: var(--brand-accent-deep);
  border-color: var(--brand-accent-deep);
  transform: translateY(-1px);
  box-shadow: var(--shadow-strong);
}

@media (max-width: 768px) {
  .module-wall {
    padding: 1.5rem 0.75rem;
  }
  .module-wall__card {
    padding: 1.5rem 1.25rem;
  }
}
