/* =====================================================================
   Article Detail — libraries_info_view styling
   Depends on: tokens.css (--d3-*)
===================================================================== */

/* HERO BREADCRUMB */
.breadcrumb-trail {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .78rem;
  font-weight: 500;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: rgba(255,255,255,.6);
  margin-bottom: 1.2rem;
}
.breadcrumb-trail .crumb-sep { opacity: .5; }
.breadcrumb-trail .crumb-link {
  color: rgba(255,255,255,.9);
  transition: color .2s;
}
.breadcrumb-trail .crumb-link:hover { color: #fff; }
.breadcrumb-trail .crumb-current { color: var(--d3-brand); }

/* ARTICLE SECTION */
.article-body-section {
  padding: clamp(4rem, 8vw, 6.5rem) 0 clamp(4rem, 8vw, 6rem);
  background: linear-gradient(180deg, var(--d3-paper) 0%, var(--d3-white) 100%);
}

.article-layout {
  max-width: var(--d3-maxw);
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 4vw, 3rem);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: clamp(2.5rem, 5vw, 4rem);
  align-items: start;
}

/* Main column */
.article-main { min-width: 0; }

.article-hero-img {
  border-radius: 12px;
  overflow: hidden;
  background: var(--d3-paper-2);
  aspect-ratio: 21/9;
  box-shadow: 0 20px 60px -20px rgba(3, 16, 49, .18);
  position: relative;
  margin-bottom: 0;
}
.article-hero-img::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(3,16,49,0) 60%, rgba(3,16,49,.35) 100%);
  pointer-events: none;
}
.article-hero-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .7s cubic-bezier(.2, .7, .2, 1);
}
.article-hero-img:hover img { transform: scale(1.03); }

.article-head {
  padding: 2.5rem 0 0;
  margin-bottom: 2rem;
}
.article-head .a-kicker {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-family: var(--d3-ff-body);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--d3-brand);
  margin-bottom: 1rem;
  padding: 6px 12px;
  background: rgba(252, 55, 46, .08);
  border-radius: 4px;
}
.article-head h1 {
  font-family: var(--d3-ff-disp);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -.02em;
  color: var(--d3-ink);
  margin-bottom: 1.25rem;
  max-width: 24ch;
}
.article-head .a-meta {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  font-size: .85rem;
  color: var(--d3-steel);
  font-family: var(--d3-ff-body);
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--d3-rule);
}
.article-head .a-meta span { display: inline-flex; align-items: center; gap: .5rem; }
.article-head .a-meta i { font-size: .72rem; color: var(--d3-brand); }

/* Prose styling */
.article-prose { max-width: 72ch; }
.article-prose p {
  font-size: 1.125rem;
  color: var(--d3-ink-soft);
  line-height: 1.85;
  margin-bottom: 1.75rem;
}
.article-prose h2 {
  font-family: var(--d3-ff-disp);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -.015em;
  color: var(--d3-ink);
  margin: 2.75rem 0 1rem;
  padding-bottom: .6rem;
  border-bottom: 2px solid var(--d3-rule);
  display: inline-block;
}
.article-prose ul {
  margin: 0 0 1.75rem;
  padding-left: 0;
  color: var(--d3-ink-soft);
  line-height: 1.85;
  list-style: none;
}
.article-prose li {
  margin-bottom: .75rem;
  padding-left: 1.5rem;
  position: relative;
  font-size: 1.0625rem;
}
.article-prose li::before {
  content: '';
  position: absolute;
  left: 0;
  top: .65rem;
  width: 8px;
  height: 8px;
  background: var(--d3-brand);
  border-radius: 50%;
}

/* Attachments */
.a-attachments { margin-top: 3rem; }
.a-attachments h3 {
  font-family: var(--d3-ff-disp);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--d3-ink);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: .75rem;
}
.a-attachments h3 svg { color: var(--d3-brand); }

.a-download-grid { display: grid; gap: .875rem; }
.a-download {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.35rem;
  background: var(--d3-white);
  border: 1px solid var(--d3-rule);
  border-radius: 8px;
  transition: border-color .2s, box-shadow .2s, transform .2s;
  text-decoration: none;
  color: inherit;
}
.a-download:hover {
  border-color: var(--d3-rule-hard);
  box-shadow: 0 8px 28px -10px rgba(3, 16, 49, .14);
  transform: translateY(-2px);
}
.a-download .dl-icon {
  flex: none;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--d3-paper-2) 0%, var(--d3-paper-3) 100%);
  border-radius: 8px;
  color: var(--d3-ink);
}
.a-download .dl-text { flex: 1; min-width: 0; }
.a-download .dl-name {
  font-family: var(--d3-ff-body);
  font-size: .95rem;
  font-weight: 600;
  color: var(--d3-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.a-download .dl-hint {
  font-size: .75rem;
  color: var(--d3-steel);
  margin-top: 3px;
}
.a-download .dl-action {
  flex: none;
  font-size: .8rem;
  font-weight: 700;
  color: var(--d3-brand);
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.a-download:hover .dl-action { gap: .55rem; }
.a-download .dl-action svg { transition: transform .2s; }
.a-download:hover .dl-action svg { transform: translateX(3px); }

/* Back link */
.a-back {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  margin-top: 3rem;
  font-size: .88rem;
  font-weight: 700;
  color: var(--d3-ink);
  padding: 12px 20px;
  border: 1px solid var(--d3-rule);
  border-radius: 6px;
  transition: color .2s, border-color .2s, background .2s, gap .2s;
  text-decoration: none;
}
.a-back:hover {
  color: var(--d3-brand);
  border-color: var(--d3-brand);
  background: rgba(252, 55, 46, .04);
  gap: .85rem;
}

/* Sidebar */
.article-aside {
  position: sticky;
  top: 32px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.a-aside-card {
  background: var(--d3-white);
  border: 1px solid var(--d3-rule);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 24px -8px rgba(3, 16, 49, .08);
}

.a-aside-card .aside-head {
  padding: 1.25rem 1.5rem .9rem;
  border-bottom: 1px solid var(--d3-rule);
  background: var(--d3-paper);
}
.a-aside-card .aside-head h2 {
  font-family: var(--d3-ff-disp);
  font-size: 1rem;
  font-weight: 700;
  color: var(--d3-ink);
  line-height: 1.3;
  margin: 0;
}
.a-aside-card .aside-head p {
  font-size: .78rem;
  color: var(--d3-steel);
  margin: .35rem 0 0;
}

.a-related { 
  list-style: none; 
  margin: 0; 
  padding: 0;
}
.a-related li { 
  border-bottom: 1px solid var(--d3-rule); 
}
.a-related li:last-child { border-bottom: none; }
.a-related li.a-related-empty {
  padding: 1.25rem 1.5rem;
  color: var(--d3-steel);
  font-size: .88rem;
}
.a-related a {
  display: flex;
  gap: 1rem;
  padding: 1rem 1.5rem;
  transition: background .2s;
  text-decoration: none;
  color: inherit;
}
.a-related a:hover { background: var(--d3-paper-2); }
.a-related .rel-img {
  flex: none;
  width: 72px;
  height: 54px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--d3-paper-2);
}
.a-related .rel-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.a-related .rel-body { 
  min-width: 0; 
  flex: 1; 
  display: flex; 
  flex-direction: column; 
  justify-content: center; 
}
.a-related .rel-title {
  font-family: var(--d3-ff-body);
  font-size: .88rem;
  font-weight: 600;
  line-height: 1.45;
  color: var(--d3-ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color .2s;
}
.a-related a:hover .rel-title { color: var(--d3-brand); }
.a-related .rel-date {
  font-size: .72rem;
  color: var(--d3-steel-2);
  margin-top: .35rem;
}

/* ============================================================
   Photo Gallery
============================================================ */
.a-gallery {
  margin-top: 3rem;
}

.a-gallery h3 {
  font-family: var(--d3-ff-disp);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--d3-ink);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: .75rem;
}

.a-gallery h3 svg { color: var(--d3-brand); }

.a-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: .875rem;
}

.a-gallery-item {
  display: block;
  border-radius: 8px;
  overflow: hidden;
  background: var(--d3-paper-2);
  box-shadow: 0 4px 16px -6px rgba(3, 16, 49, .12);
  transition: transform .3s cubic-bezier(.2, .7, .2, 1), box-shadow .3s;
}

.a-gallery-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 32px -8px rgba(3, 16, 49, .20);
}

.a-gallery-item img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  display: block;
  transition: transform .5s cubic-bezier(.2, .7, .2, 1);
}

.a-gallery-item:hover img {
  transform: scale(1.05);
}

/* RESPONSIVE */
@media (max-width: 1080px) {
  .article-layout { 
    grid-template-columns: 1fr; 
  }
  .article-aside { 
    position: static; 
  }
}

@media (max-width: 768px) {
  .article-hero-img { 
    aspect-ratio: 16/9; 
  }
  .a-related .rel-img { 
    width: 56px; 
    height: 42px; 
  }
  .a-gallery-grid { 
    grid-template-columns: repeat(2, 1fr); 
  }
  .a-gallery-item img { 
    height: 130px; 
  }
  .article-head h1 { 
    max-width: 100%; 
    font-size: 1.75rem;
  }
  .breadcrumb-trail { 
    font-size: .72rem; 
    flex-wrap: wrap; 
  }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .a-gallery-item, .a-gallery-item img { transform: none !important; }
}
