/**
 * Plugin Detail Page Styles
 *
 * @package WPFolks
 * @since 1.0.0
 */

/* --- Hero --- */
.pd-hero {
  background: var(--color-dark);
  color: var(--color-white);
  padding: 48px 0;
}

.pd-hero .back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: rgba(255,255,255,0.5);
  margin-bottom: 24px;
  text-decoration: none;
}

.pd-hero .back-link:hover {
  color: #ffffff;
}

.pd-hero-inner {
  display: flex;
  align-items: center;
  gap: 24px;
}

.pd-icon {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  flex-shrink: 0;
  overflow: hidden;
}

.pd-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.pd-hero-info {
  flex: 1;
  min-width: 0;
}

.pd-hero-info h1 {
  font-size: 32px;
  margin-bottom: 6px;
  line-height: 1.2;
}

.pd-author {
  font-size: 15px;
  color: rgba(255,255,255,0.7);
  margin-bottom: 12px;
}

.pd-author a {
  color: #ffffff;
}

.pd-author a:hover {
  color: var(--color-accent);
}

.pd-hero-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pd-hero-meta .pill {
  font-size: 12px;
  border: 1px solid rgba(255,255,255,0.15);
}

.pd-hero-meta .pill--primary {
  background: rgba(33,69,230,0.2);
  color: #a0b4ff;
  border-color: rgba(33,69,230,0.3);
}

.pd-hero-meta .pill--success {
  background: rgba(16,185,129,0.2);
  color: #6ee7b7;
  border-color: rgba(16,185,129,0.3);
}

/* --- Layout --- */
.pd-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 32px;
  padding: 32px 0 64px;
}

/* --- Main Content --- */
.pd-main {
  min-width: 0;
}

.pd-section {
  margin-bottom: 40px;
}

.pd-section-title {
  font-size: 22px;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--color-border);
}

.pd-desc {
  font-size: 15px;
  line-height: 1.8;
  color: var(--color-text);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Inline media inside the user-submitted long description must shrink
 * to the column on narrow viewports. wp_kses_post lets authors paste
 * images / iframes / tables, which on mobile would otherwise overflow
 * the card and force the whole page to scroll horizontally. */

/* Images: height auto preserves intrinsic aspect ratio when the
 * image scales down. */
.pd-desc img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Videos & iframes (YouTube, Vimeo, etc.): can't use `height: auto`
 * because iframes have no intrinsic aspect ratio — that would collapse
 * them to the 150px browser default. Use `aspect-ratio: 16/9` instead
 * so width scales with the column and height tracks proportionally.
 * Native <video> elements also get the same treatment so they don't
 * letterbox awkwardly on phones. */
.pd-desc video,
.pd-desc iframe,
.pd-desc embed,
.pd-desc object {
  max-width: 100%;
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  border: 0;
}

.pd-desc figure {
  max-width: 100%;
  margin: 16px 0;
}
.pd-desc table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
}

.pd-desc p {
  margin-bottom: 16px;
}

.pd-desc p:last-child {
  margin-bottom: 0;
}

/* Headings inside description */
.pd-desc h2,
.pd-desc h3,
.pd-desc h4 {
  font-family: var(--font-body);
  color: var(--color-text);
  margin: 28px 0 12px;
  line-height: 1.3;
}

.pd-desc h2:first-child,
.pd-desc h3:first-child,
.pd-desc h4:first-child {
  margin-top: 0;
}

.pd-desc h2 {
  font-size: 20px;
  font-weight: 700;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--color-border);
}

.pd-desc h3 {
  font-size: 17px;
  font-weight: 700;
}

.pd-desc h4 {
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--color-text-secondary);
}

/* Lists */
.pd-desc ul,
.pd-desc ol {
  padding-left: 24px;
  margin-bottom: 16px;
}

.pd-desc ul {
  list-style: disc;
}

.pd-desc ol {
  list-style: decimal;
}

.pd-desc li {
  margin-bottom: 6px;
  line-height: 1.7;
}

.pd-desc li ul,
.pd-desc li ol {
  margin-top: 6px;
  margin-bottom: 0;
}

/* Links */
.pd-desc a {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 500;
}

.pd-desc a:hover {
  text-decoration: underline;
}

/* Blockquotes */
.pd-desc blockquote {
  border-left: 3px solid var(--color-primary);
  margin: 16px 0;
  padding: 12px 20px;
  background: var(--color-off-white);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--color-text-secondary);
  font-style: italic;
}

.pd-desc blockquote p:last-child {
  margin-bottom: 0;
}

/* Code inline */
.pd-desc code {
  background: var(--color-off-white);
  border: 1px solid var(--color-border);
  border-radius: 3px;
  padding: 2px 6px;
  font-size: 13px;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  color: #d63384;
  word-break: break-word;
}

/* Code blocks */
.pd-desc pre {
  background: #1e1e2e;
  color: #cdd6f4;
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin: 16px 0;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.6;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

.pd-desc pre code {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

/* Tables */
.pd-desc table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 14px;
}

.pd-desc th,
.pd-desc td {
  padding: 10px 14px;
  text-align: left;
  border: 1px solid var(--color-border);
}

.pd-desc th {
  background: var(--color-off-white);
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--color-text-secondary);
}

.pd-desc tr:nth-child(even) td {
  background: rgba(0,0,0,0.015);
}

/* Horizontal rule */
.pd-desc hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 24px 0;
}

/* Images inside description */
.pd-desc img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  margin: 12px 0;
}

/* Bold & italic */
.pd-desc strong,
.pd-desc b {
  font-weight: 700;
  color: var(--color-text);
}

.pd-desc em,
.pd-desc i {
  font-style: italic;
}

/* Definition lists (wp.org uses these) */
.pd-desc dl {
  margin: 16px 0;
}

.pd-desc dt {
  font-weight: 700;
  margin-bottom: 4px;
}

.pd-desc dd {
  margin-left: 20px;
  margin-bottom: 12px;
  color: var(--color-text-secondary);
}

/* Checkbox/feature lists (wp.org style ✓ lists) */
.pd-desc ul li::marker {
  color: var(--color-primary);
}

/* --- Banner — full-width strip below the page-meta-bar, above the
       two-column body. Hotlinked from wp.org for synced plugins,
       served from the media library for premium uploads. --- */
.pd-banner {
  margin: 24px 0 0;
  border-radius: 12px;
  overflow: hidden;
  background: var(--color-off-white, #f6f7f7);
}
.pd-banner img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 320px;
  object-fit: cover;
}

/* --- Screenshots --- */
.pd-screenshots {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.pd-screenshot {
  display: block;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--color-border, #dcdcde);
  background: var(--color-off-white, #f6f7f7);
  text-decoration: none;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.pd-screenshot:hover {
  border-color: var(--color-primary, #2145e6);
  transform: translateY(-2px);
  box-shadow: 0 8px 18px -8px rgba(0, 0, 0, 0.18);
}

.pd-screenshot img {
  width: 100%;
  height: 180px;
  display: block;
  object-fit: cover;
}
.pd-screenshot__caption {
  display: block;
  padding: 8px 10px;
  font-size: 12px;
  color: var(--color-text-secondary, #50575e);
  background: #fff;
  border-top: 1px solid var(--color-border, #dcdcde);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Reviews --- */
.pd-review {
  padding: 20px;
  margin-bottom: 12px;
}

.pd-review-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.pd-review-name {
  font-weight: 700;
  font-size: 14px;
}

.pd-review-date {
  font-size: 12px;
  color: var(--color-text-secondary);
}

.pd-review-stars {
  color: var(--color-accent);
  font-size: 14px;
  margin-bottom: 8px;
}

.pd-review-text {
  font-size: 14px;
  color: var(--color-text-secondary);
  line-height: 1.6;
}

/* --- Sidebar --- */
.pd-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.pd-sidebar-card {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 24px;
}

.pd-sidebar-card h3 {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 16px;
}

/* Upvote box */
.pd-upvote-box {
  text-align: center;
}

.pd-upvote-count {
  font-size: 36px;
  font-weight: 800;
  color: var(--color-primary);
  display: block;
  margin-bottom: 4px;
}

.pd-upvote-label {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin-bottom: 16px;
  display: block;
}

/* Info list */
.pd-info-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pd-info-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
}

.pd-info-label {
  color: var(--color-text-secondary);
}

.pd-info-value {
  font-weight: 600;
  color: var(--color-text);
}

/* Links */
.pd-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pd-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--color-off-white);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  transition: background 0.2s;
}

.pd-link:hover {
  background: var(--color-border);
  color: var(--color-text);
}

.pd-link svg {
  color: var(--color-text-secondary);
  flex-shrink: 0;
}

/* Author card */
.pd-author-card {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pd-author-info {
  flex: 1;
}

.pd-author-name {
  font-weight: 700;
  font-size: 15px;
}

.pd-author-name a {
  color: var(--color-text);
}

.pd-author-name a:hover {
  color: var(--color-primary);
}

.pd-author-role {
  font-size: 12px;
  color: var(--color-text-secondary);
}

/* Contributor list — sits below the Author card. Each entry mirrors
   the Author card's chrome (avatar + name + secondary line) at a
   slightly smaller scale so the primary author stays visually dominant. */
.pd-contributor-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pd-contributor {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.pd-contributor img,
.pd-contributor .avatar,
.pd-contributor-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
}
.pd-contributor-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--color-off-white, #f6f7f7);
  color: var(--color-text-secondary, #50575e);
  border: 1px solid var(--color-border, #dcdcde);
}
.pd-contributor-info {
  flex: 1;
  min-width: 0;
}
.pd-contributor-name {
  font-weight: 600;
  font-size: 14px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pd-contributor-name a {
  color: var(--color-text);
  text-decoration: none;
}
.pd-contributor-name a:hover {
  color: var(--color-primary);
}
.pd-contributor-handle {
  font-size: 12px;
  color: var(--color-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .pd-layout {
    grid-template-columns: 1fr;
  }

  .pd-hero-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .pd-hero-info h1 {
    font-size: 24px;
  }

  .pd-screenshots {
    grid-template-columns: 1fr 1fr;
  }
}
