/* CTP Media Library — matches ctpuniverse.com */
:root {
  --blue: #0958b2;
  --navy: #073b73;
  --turquoise: #58d6de;
  --bg: #ecfeff;
  --mist: #eaf8fa;
  --line: #dce4ea;
  --ink: #13283a;
  --muted: #5b6b7a;
  --white: #ffffff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Header */
.site-header {
  background: var(--blue);
  color: var(--white);
  padding: 28px 0 26px;
}
.wordmark {
  margin: 0 0 6px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--turquoise);
}
.site-header h1 { margin: 0 0 8px; font-size: 2rem; line-height: 1.15; }
.intro { margin: 0; max-width: 720px; color: rgba(255, 255, 255, 0.92); }

/* Layout */
.layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 24px;
  padding-top: 24px;
  padding-bottom: 48px;
  align-items: start;
}
@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
}

/* Sidebar */
.sidebar {
  background: var(--mist);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  position: sticky;
  top: 16px;
}
@media (max-width: 820px) { .sidebar { position: static; } }

.search input {
  width: 100%;
  padding: 10px 12px;
  font-size: 1rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--white);
  color: var(--ink);
}
.search input:focus { outline: 2px solid var(--blue); outline-offset: 1px; }

.folder-tree { margin-top: 14px; }
.folder-tree ul { list-style: none; margin: 0; padding-left: 16px; }
.folder-tree > ul { padding-left: 0; }
.folder-item { margin: 2px 0; }
.folder-btn {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 7px 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font-size: 0.95rem;
  text-align: left;
  cursor: pointer;
}
.folder-btn:hover { background: rgba(9, 88, 178, 0.08); }
.folder-btn.active { background: var(--blue); color: var(--white); font-weight: 700; }
.folder-btn.active .folder-count { color: rgba(255, 255, 255, 0.85); }
.folder-count { color: var(--muted); font-size: 0.85rem; white-space: nowrap; }

.sidebar-note { margin: 16px 4px 0; font-size: 0.85rem; color: var(--muted); }

/* Content */
.content-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 14px;
  margin-bottom: 14px;
}
.content-head h2 { margin: 0; font-size: 1.35rem; }
.count-line { margin: 0; color: var(--muted); font-size: 0.95rem; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}
.card {
  background: var(--mist);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  padding: 0;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.card:hover { border-color: var(--blue); }
.card:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--white);
}
.card-body { padding: 10px 12px 12px; }
.card-name {
  margin: 0 0 3px;
  font-size: 0.85rem;
  font-weight: 600;
  word-break: break-all;
}
.card-meta { margin: 0; font-size: 0.8rem; color: var(--muted); }

/* Empty / error states */
.empty {
  background: var(--mist);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 32px 24px;
  text-align: center;
}
.empty-title { margin: 0 0 6px; font-size: 1.15rem; font-weight: 700; }
.empty-text { margin: 0 auto 16px; max-width: 520px; color: var(--muted); }
.empty code { background: var(--white); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }

/* Buttons */
.btn {
  display: inline-block;
  padding: 9px 16px;
  border: 1px solid var(--blue);
  border-radius: 6px;
  background: var(--white);
  color: var(--blue);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: var(--mist); }
.btn-primary { background: var(--blue); color: var(--white); }
.btn-primary:hover { background: var(--navy); }

/* Detail modal */
.modal { position: fixed; inset: 0; z-index: 50; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(7, 29, 51, 0.65); }
.modal-card {
  position: relative;
  max-width: 860px;
  max-height: calc(100vh - 48px);
  margin: 24px auto;
  overflow: auto;
  background: var(--white);
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(7, 29, 51, 0.35);
}
.modal-close {
  position: absolute;
  top: 10px; right: 12px;
  width: 38px; height: 38px;
  border: 0; border-radius: 50%;
  background: rgba(7, 29, 51, 0.75);
  color: var(--white);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}
.detail-image {
  display: block;
  width: 100%;
  max-height: 62vh;
  object-fit: contain;
  background: var(--mist);
}
.detail-body { padding: 20px 24px 24px; }
.detail-name { margin: 0 0 12px; font-size: 1.15rem; word-break: break-all; }
.detail-list { margin: 0 0 18px; }
.detail-list div {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 4px 12px;
  padding: 7px 0;
  border-top: 1px solid var(--line);
}
.detail-list dt { font-weight: 700; color: var(--muted); font-size: 0.9rem; }
.detail-list dd { margin: 0; font-size: 0.95rem; }
.detail-url { word-break: break-all; font-size: 0.85rem; }
.credit-missing { color: var(--muted); font-style: italic; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.copy-note { margin: 12px 0 0; min-height: 1.2em; color: var(--blue); font-weight: 600; font-size: 0.9rem; }
