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

@import "../components/link-block.css";
@import "../components/link-list.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);
}

/* ------------------------------------------------------------
   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);
}

/* ============================================================
   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;
}

.module-help-popup__last-paragraph {
  margin-bottom: 0;
}
