/* tei-refine.css — loaded after style.css. Additions for the refined home page. */

/* ---- Brand wordmark: bold brown TEI, same height as the old circle mark ---- */
.brand-word {
  display: inline-flex;
  align-items: center;
  height: 36px;
  font-family: var(--serif, 'Source Serif 4', serif);
  font-weight: 700;
  font-size: 40px;
  letter-spacing: 0.02em;
  line-height: 1;
  color: var(--accent, #8a4b2a);
}
.brand-word-sm { height: 28px; font-size: 20px; }

/* ---- Footer: thin, two lines, tight padding ---- */
footer.site-footer {
  padding-top: 8px;
  padding-bottom: 8px;
  line-height: 1.2;
}
.site-footer .wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.footer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 16px;
}
.site-footer .brand {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  margin: 0;
  line-height: 1.2;
}
.footer-copy {
  font-family: var(--mono, 'IBM Plex Mono', monospace);
  font-size: 12px;
  color: var(--muted, #6b6b6b);
  line-height: 1.2;
  white-space: nowrap;
}
.footer-email {
  font-family: var(--mono, 'IBM Plex Mono', monospace);
  font-size: 12px;
  color: var(--muted, #6b6b6b);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  white-space: nowrap;
}
.footer-email:hover,
.footer-email:focus-visible {
  color: var(--accent, #8a4b2a);
  border-bottom-color: currentColor;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  align-items: center;
  margin: 0;
  line-height: 1.2;
}
.footer-links a {
  font-family: var(--mono, 'IBM Plex Mono', monospace);
  font-size: 12px;
  color: var(--muted, #6b6b6b);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.footer-links a:hover,
.footer-links a:focus-visible {
  color: var(--accent, #8a4b2a);
  border-bottom-color: currentColor;
}
.site-footer .fnote {
  text-align: center;
  font-size: 11px;
  line-height: 1.25;
  color: var(--muted, #6b6b6b);
  margin: 2px 0 0;
}

/* ---- Not-registered popup ---- */
.tei-modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(20, 16, 12, 0.55);
  z-index: 1000;
}
.tei-modal {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: min(420px, calc(100vw - 32px));
  background: var(--card, #fff);
  border: 1px solid var(--line, #e3ddd4);
  border-radius: 14px;
  padding: 28px 24px;
  z-index: 1001;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0,0,0,0.22);
}
.tei-modal h3 {
  font-family: var(--serif, 'Source Serif 4', serif);
  font-size: 22px;
  margin: 0 0 6px;
}
.tei-modal p { margin: 0 0 18px; color: var(--muted, #6b6b6b); }
.tei-modal-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
body.tei-modal-open { overflow: hidden; }

/* ---- Homepage FAQ teaser (links out to /faqs.php) ---- */
.faqs-teaser { padding: 48px 0; }
.faqs-teaser-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px 32px;
  flex-wrap: wrap;
  border: 1px solid var(--line, #e3ddd4);
  border-radius: 14px;
  padding: 28px 32px;
}
.faqs-teaser-inner h2 { margin: 4px 0 6px; font-size: clamp(20px, 3vw, 26px); }
.faqs-teaser-inner p { margin: 0; color: var(--muted, #6b6b6b); }

/* ---- FAQ list ---- */
.faq-group-title {
  font-family: var(--serif, 'Source Serif 4', serif);
  font-size: 18px;
  margin: 36px 0 10px;
}
.faqs-page .faq-group-title:first-of-type { margin-top: 24px; }
#faqs .faq-list { max-width: 760px; margin: 0 auto; }
.faq-item {
  border-bottom: 1px solid var(--line, #e3ddd4);
  padding: 4px 0;
}
.faq-item summary {
  cursor: pointer;
  list-style: none;
  padding: 16px 28px 16px 0;
  position: relative;
  font-weight: 600;
  font-size: 16px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: '+';
  position: absolute; right: 4px; top: 50%;
  transform: translateY(-50%);
  font-family: var(--mono, monospace);
  color: var(--accent, #8a4b2a);
  font-size: 18px;
}
.faq-item[open] summary::after { content: '–'; }
.faq-item p {
  margin: 0 0 16px;
  color: var(--muted, #555);
  line-height: 1.65;
  max-width: 68ch;
}

/* ---- Legal pages ---- */
.legal-page { padding: 56px 0 80px; }
.legal-page .wrap { max-width: 780px; }
.legal-page h1 {
  font-family: var(--serif, 'Source Serif 4', serif);
  font-size: clamp(28px, 5vw, 40px);
  margin: 0 0 8px;
}
.legal-updated {
  font-family: var(--mono, monospace);
  font-size: 12px;
  color: var(--muted, #6b6b6b);
  margin-bottom: 32px;
}
.legal-page h2 { font-size: 20px; margin: 32px 0 10px; }
.legal-page p, .legal-page li { line-height: 1.7; color: var(--ink, #2b2620); }
.legal-page ul { padding-left: 20px; }
.legal-page a { color: var(--accent, #8a4b2a); }

/* ============================================================
   GLOBAL OVERFLOW GUARD — stops any horizontal scroll on mobile
   Does not affect desktop layout.
   ============================================================ */
html, body { max-width: 100%; overflow-x: hidden; }
* { box-sizing: border-box; }

/* ============================================================
   HEADER — DESKTOP: unchanged (no rules here override it).
   MOBILE ONLY (inside the media query below): no hamburger, no
   drawer. Row 1 = logo + small Log in button. Row 2 = How it
   works / FAQs / Contact / Register, wrapped, always visible.
   ============================================================ */

/* Mobile-only elements — hidden by default so desktop never sees them */
.nav-login-mobile { display: none; }
.nav-link-register-mobile { display: none; }

@media (max-width: 640px) {
  html { -webkit-text-size-adjust: 100%; }

  /* ---- Header brand: shrink so logo + name fit on one row ---- */
  .nav .wrap {
    flex-wrap: wrap;
    row-gap: 8px;
    max-width: 100%;
  }
  .brand {
    gap: 6px;
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
  }
  .brand-word {
    height: 22px;
    font-size: 28px;
    letter-spacing: 0.01em;
    flex-shrink: 0;
  }
  .brand-text {
    font-size: 14px;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 60vw;
    min-width: 0;
  }
  .brand-text span {
    display: block;
    font-size: 9px;
    opacity: 0.75;
  }

  /* Row 1 (right side): small Log in button only */
  .nav-actions { flex-shrink: 0; display: flex; align-items: center; gap: 8px; }
  .nav-actions-desktop { display: none !important; }
  .nav-login-mobile {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    padding: 6px 14px;
    margin-top: 8px;
    font-size: 13px;
    line-height: 1.2;
    border-radius: 8px;
  }

  /* Logged-in avatar menu: keep visible on mobile too (no drawer to fall back on) */
  .user-menu-name { display: none; }  /* keep just the avatar circle to save space */

  /* Row 2 (full width, wraps below): How it works · FAQs · Contact · Register */
  .nav-links {
    display: flex !important;
    flex: 1 1 100%;
    width: 100%;
    order: 3;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 18px;
    padding-top: 8px;
    margin-top: 2px;
    border-top: 1px solid var(--line, #e3ddd4);
  }
  .nav-links a {
    font-size: 13px;
    white-space: nowrap;
  }
  .nav-link-register-mobile {
    display: inline !important;
    color: var(--accent, #8a4b2a);
    font-weight: 600;
  }

  .hero-copy h1 { font-size: clamp(28px, 8vw, 36px); line-height: 1.15; }
  .hero-copy .lede { font-size: 16px; }

  .search-box { display: flex; flex-direction: column; gap: 10px; }
  .search-box input,
  .search-box button {
    width: 100%;
    min-height: 48px;
    font-size: 16px;
  }

  .stats-strip .wrap {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px 12px;
    text-align: center;
  }
  .stats-strip .n { font-size: 18px; }
  .stats-strip .l { font-size: 12px; }

  .cat-list { grid-template-columns: 1fr; }

  .report-head h3 { font-size: 20px; }
  .report-meta { display: flex; flex-direction: column; gap: 4px; }
  .report-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }

  .exp-entry { display: block; }
  .exp-entry .exp-cat { margin-bottom: 6px; }
  .exp-entry .exp-status { display: inline-block; margin-top: 8px; }

  .stamp-card { width: 100%; }
  .stat-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }

  .cta-actions { flex-direction: column; align-items: stretch; }
  .cta-actions .btn { width: 100%; text-align: center; min-height: 48px; }

  footer .wrap { flex-direction: column; align-items: flex-start; gap: 4px; }
  .footer-row { flex-wrap: wrap; row-gap: 2px; }
  .footer-copy, .footer-email, .footer-links a { font-size: 10.5px; }
  .site-footer .brand { gap: 3px 8px; }
  .footer-links { gap: 2px 12px; }
}
.legal-page a.btn { color: #fff; }

/* ---- Mobile compatibility (900px breakpoint, layout-level) ---- */
@media (max-width: 900px) {
  .hero .wrap { display: block; }
  .stamp-card { margin-top: 32px; max-width: 480px; }
  .how-grid { grid-template-columns: 1fr; gap: 20px; }
  .report-stats { flex-wrap: wrap; }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
