/* =========================================================
   index.css — NoNAA landing page
   Minimal grid of Q&A tiles under shared header
   ========================================================= */

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

/* Body styling for this page */
body.index-body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
}

/* When modal is open, prevent background scroll */
body.qa-modal-open {
  overflow: hidden;
}

/* Basic accessibility helper (in case not in theme.css) */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Main layout */
.index-main {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 16px var(--gap);
}

/* Section wrapper */
.qa-section {
  margin-top: 12px;
}

/* Q&A grid — scrollable by page scroll */
.qa-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--gap);
}

/* Wider screens: more columns */
@media (min-width: 720px) {
  .qa-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1120px) {
  .qa-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Individual tile */
.qa-tile {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 10px;

  background: var(--color-surface);
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-1);

  padding: 14px 14px 12px;
  cursor: pointer;

  transition:
    transform 0.15s ease-out,
    box-shadow 0.15s ease-out,
    border-color 0.15s ease-out,
    background-color 0.15s ease-out;
}

/* Hover / focus feedback (PC and keyboard) */
.qa-tile:hover,
.qa-tile:focus-within {
  transform: translateY(-3px);
  border-color: var(--color-accent);
  box-shadow: var(--shadow-2);
}

/* Optional image */
.qa-thumb {
  overflow: hidden;
  border-radius: calc(var(--radius) - 2px);
}

.qa-thumb img {
  display: block;
  width: 100%;
  max-height: 180px;
  object-fit: cover;
}

/* Text content */
.qa-content {
  display: grid;
  grid-template-rows: auto auto auto;
  row-gap: 8px;
}

/* Question as small heading */
.qa-question {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 1.05rem;
  line-height: 1.3;
}

/* Short answer (landing view) */
.qa-answer {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--color-muted);
}

/* Long answer — hidden inside tiles, used only for modal content */
.qa-answer-long {
  display: none;
}

/* Links styles (used also inside modal content) */
.qa-links {
  margin: 8px 0 0;
  padding-left: 18px;
  font-size: 0.9rem;
}

.qa-links li {
  margin: 2px 0;
}

.qa-links a {
  color: var(--color-accent);
  text-decoration: none;
}

.qa-links a:hover,
.qa-links a:focus {
  text-decoration: underline;
}

/* Meta info (rating + clicks) — grid-based, no flex */
.qa-meta {
  margin-top: 4px;
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  column-gap: 10px;
  row-gap: 4px;
  align-items: center;
  font-size: 0.8rem;
  color: var(--color-muted);
}

/* On narrow screens, stack meta rows */
@media (max-width: 480px) {
  .qa-meta {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Rating block */
.qa-rating {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: auto;
  align-items: center;
  column-gap: 6px;
}

/* Stars */
.qa-stars {
  display: inline-block;
  line-height: 1;
}

.qa-star {
  font-size: 0.9rem;
  color: #555a60;              /* muted base */
  text-shadow: 0 0 1px rgba(0, 0, 0, 0.4);
}

.qa-star.filled {
  color: #f5c542;              /* gold */
}

/* Rating numbers */
.qa-rating-number {
  white-space: nowrap;
}

.qa-rating-count {
  opacity: 0.75;
  margin-left: 2px;
}

/* Click statistics */
.qa-stats {
  justify-self: end;
  text-align: right;
  white-space: nowrap;
}

@media (max-width: 480px) {
  .qa-stats {
    justify-self: start;
    text-align: left;
  }
}

.qa-clicks {
  opacity: 0.85;
}

/* =========================================================
   Modal for long answers
   ========================================================= */

.qa-modal {
  position: fixed;
  left: 0;
  right: 0;
  top: 72px;   /* start below header; adjust if your header is taller/shorter */
  bottom: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.65);
  display: none;
  padding: 16px;
}


/* Show modal when open */
.qa-modal.open {
  display: block;
}

/* Dialog box in the center/top area */
.qa-modal-dialog {
  position: relative;
  max-width: 720px;
  max-height: calc(100vh - 32px);
  margin: 0 auto;
  margin-top: 0;  /* we already pushed via .qa-modal top */

  background: var(--color-surface);
  color: var(--color-text);
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-2);

  display: grid;
  grid-template-rows: auto 1fr;
  padding: 16px 18px 18px;
  overflow: hidden;
}

/* Close button (top right inside dialog) */
.qa-modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  border: none;
  background: transparent;
  color: var(--color-muted);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.qa-modal-close:hover,
.qa-modal-close:focus {
  color: var(--color-accent);
}

/* Question heading in modal */
.qa-modal-question {
  margin: 0;
  padding-right: 32px; /* leave space for close button */
  font-family: var(--font-heading);
  font-size: 1.1rem;
  line-height: 1.4;
}

/* Scrollable body for long answer and links */
.qa-modal-body {
  margin-top: 10px;
  overflow-y: auto;
  padding-right: 6px;
  font-size: 0.95rem;
  line-height: 1.6;
}

/* Paragraphs inside modal body (copied from .qa-answer-long) */
.qa-modal-body p {
  margin: 0 0 0.7em;
}
