/* ══════════════════════════════════════════════════════════════
   Publications Component — Grav 2 + Quark2
   
   CSS custom properties are defined by Quark2 and available in
   your theme's color scheme. This component adheres to:
   - Quark2 design tokens (--q2-*)
   - Accessible contrast ratios (WCAG AA)
   - Responsive mobile-first design
   ══════════════════════════════════════════════════════════════ */

/* ──────────────────────────────────────────────────────────────
   Section Title with accent bar
   ────────────────────────────────────────────────────────────── */
.pub-section-title {
  padding-left: 14px;
  position: relative;
  margin-bottom: 2rem;
  font-family: var(--q2-font-display, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--q2-text-strong, #1f2937);
  letter-spacing: -0.02em;
}

.pub-section-title::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.2em;
  bottom: 0.2em;
  width: 3px;
  background: var(--q2-accent, #2563eb);
  border-radius: 9999px;
  transition: width 0.3s ease;
}

.pub-section-title:hover::before {
  width: 4px;
}

/* ──────────────────────────────────────────────────────────────
   Publication List (container)
   ────────────────────────────────────────────────────────────── */
.pub-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0;
  margin: 0;
}

/* ──────────────────────────────────────────────────────────────
   Individual Publication Card
   ────────────────────────────────────────────────────────────── */
.pub-item {
  background: var(--q2-bg-elev, #ffffff);
  border-radius: var(--q2-radius-md, 0.5rem);
  box-shadow: var(--q2-shadow-card, 0 1px 3px rgba(0, 0, 0, 0.1));
  overflow: hidden;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.pub-item:hover {
  box-shadow: var(--q2-shadow-raised, 0 10px 15px -3px rgba(0, 0, 0, 0.1));
  transform: translateY(-1px);
}

/* ──────────────────────────────────────────────────────────────
   Toggle Button (clickable area)
   ────────────────────────────────────────────────────────────── */
.pub-toggle {
  all: unset;
  display: block;
  width: 100%;
  cursor: pointer;
  padding: 1.1rem 1.25rem;
  background: var(--q2-bg-elev, #ffffff);
  transition: background 0.2s ease;
  font-family: inherit;
}

.pub-toggle:hover {
  background: var(--q2-bg-muted, #f9fafb);
}

.pub-toggle:active {
  background: var(--q2-bg-muted, #f9fafb);
}

.pub-toggle:focus-visible {
  outline: 2px solid var(--q2-accent, #2563eb);
  outline-offset: -2px;
  background: var(--q2-bg-muted, #f9fafb);
}

.pub-toggle:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

/* ──────────────────────────────────────────────────────────────
   Toggle Inner Layout (flex container for chevron + content)
   ────────────────────────────────────────────────────────────── */
.pub-toggle-inner {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

/* ──────────────────────────────────────────────────────────────
   Chevron Icon (animates on state change)
   ────────────────────────────────────────────────────────────── */
.pub-chevron {
  flex-shrink: 0;
  margin-top: 0.3rem;
  width: 16px;
  height: 16px;
  color: var(--q2-text-muted, #6b7280);
  transition: transform 0.2s ease, color 0.2s ease;
}

.pub-item.is-open .pub-chevron {
  transform: rotate(180deg);
  color: var(--q2-accent, #2563eb);
}

/* ──────────────────────────────────────────────────────────────
   Publication Title
   ────────────────────────────────────────────────────────────── */
.pub-title {
  font-family: var(--q2-font-display, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--q2-text-strong, #1f2937);
  margin: 0 0 0.4rem 0;
  letter-spacing: -0.01em;
}

/* ──────────────────────────────────────────────────────────────
   Metadata (authors, year, badges, links)
   ────────────────────────────────────────────────────────────── */
.pub-meta {
  font-size: 0.84rem;
  color: var(--q2-text-muted, #6b7280);
  line-height: 1.6;
  margin: 0;
  word-break: break-word;
}

.pub-authors {
  font-weight: 500;
  color: var(--q2-text, #374151);
}

.pub-year {
  font-weight: 600;
  color: var(--q2-text, #374151);
}

/* ──────────────────────────────────────────────────────────────
   Links (DOI, journal, arXiv)
   ────────────────────────────────────────────────────────────── */
.pub-link {
  color: var(--q2-accent, #2563eb);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: text-decoration-thickness 0.2s ease, color 0.15s ease;
}

.pub-link:hover {
  text-decoration-thickness: 2px;
  color: var(--q2-accent-hover, #1d4ed8);
}

.pub-link:focus-visible {
  outline: 2px solid var(--q2-accent, #2563eb);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ──────────────────────────────────────────────────────────────
   Badges (Journal, DOI, arXiv type labels)
   ────────────────────────────────────────────────────────────── */
.pub-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: var(--q2-radius-sm, 0.25rem);
  vertical-align: middle;
  margin-right: 2px;
  border: 1px solid transparent;
}

.pub-badge-journal {
  background: rgba(37, 99, 235, 0.08);
  color: var(--q2-accent, #2563eb);
  border-color: rgba(37, 99, 235, 0.2);
}

.pub-badge-doi {
  background: rgba(37, 99, 235, 0.08);
  color: var(--q2-accent, #2563eb);
  border-color: rgba(37, 99, 235, 0.2);
}

.pub-badge-arxiv {
  background: rgba(220, 38, 38, 0.07);
  color: #dc2626;
  border-color: rgba(220, 38, 38, 0.18);
}

.pub-badge-preprint {
  background: rgba(168, 85, 247, 0.07);
  color: #a855f7;
  border-color: rgba(168, 85, 247, 0.18);
}

/* ──────────────────────────────────────────────────────────────
   Abstract Wrapper (collapsible container)
   ────────────────────────────────────────────────────────────── */
.pub-abstract-wrap {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.22s ease;
}

.pub-item.is-open .pub-abstract-wrap {
  opacity: 1;
}

/* ──────────────────────────────────────────────────────────────
   Abstract Content
   ────────────────────────────────────────────────────────────── */
.pub-abstract {
  padding: 1rem 1.25rem 1.2rem;
  border-top: 1px solid var(--q2-border, #e5e7eb);
  background: var(--q2-bg-muted, #f9fafb);
  font-size: 0.9rem;
  line-height: 1.8;
  color: var(--q2-text, #374151);
}

.pub-abstract strong {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--q2-text-muted, #6b7280);
  margin-bottom: 0.45rem;
}

/* ──────────────────────────────────────────────────────────────
   Empty State
   ────────────────────────────────────────────────────────────── */
.publications-empty {
  padding: 2rem 1.25rem;
  text-align: center;
  color: var(--q2-text-muted, #6b7280);
  font-size: 0.95rem;
}

/* ──────────────────────────────────────────────────────────────
   Responsive: Tablet and smaller
   ────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .pub-section-title {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
  }

  .pub-toggle {
    padding: 0.9rem 1rem;
  }

  .pub-abstract {
    padding: 0.9rem 1rem 1rem;
  }

  .pub-title {
    font-size: 1rem;
  }

  .pub-meta {
    font-size: 0.8rem;
  }
}

/* ──────────────────────────────────────────────────────────────
   Dark mode support (if Quark2 provides dark scheme)
   ────────────────────────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
  /* Dark mode variables are typically handled by Quark2 CSS variables
     The component will automatically adapt via --q2-* variables */
}

/* ──────────────────────────────────────────────────────────────
   Print styles
   ────────────────────────────────────────────────────────────── */
@media print {
  .pub-item {
    page-break-inside: avoid;
    box-shadow: none;
    border: 1px solid var(--q2-border, #e5e7eb);
  }

  .pub-toggle {
    cursor: default;
  }

  .pub-toggle:hover {
    background: inherit;
  }

  .pub-abstract-wrap {
    max-height: none !important;
    opacity: 1 !important;
  }
}
