:root {
  --gdfb-surface: #ffffff;
  --gdfb-surface-soft: #f8fafc;
  --gdfb-border: #e2e8f0;
  --gdfb-text: #0f172a;
  --gdfb-muted: #475569;
  --gdfb-primary: #1d4ed8;
  --gdfb-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
  --gdfb-radius: 22px;
}

.gdfb-library,
.gdfb-single,
.gdfb-viewer,
.gdfb-empty {
  box-sizing: border-box;
}

.gdfb-library {
  position: relative;
  margin: 1.25rem 0;
}

.gdfb-library__toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 1rem;
}

.gdfb-library__search {
  width: min(100%, 360px);
  border: 1px solid var(--gdfb-border);
  border-radius: 999px;
  background: #fff;
  padding: 0.9rem 1rem;
  outline: none;
  font-size: 0.98rem;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}

.gdfb-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.35rem;
}

.gdfb-columns-1 .gdfb-grid { grid-template-columns: 1fr; }
.gdfb-columns-2 .gdfb-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.gdfb-columns-3 .gdfb-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.gdfb-columns-4 .gdfb-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.gdfb-card {
  display: flex;
  flex-direction: column;
  background: var(--gdfb-surface);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: var(--gdfb-radius);
  overflow: hidden;
  box-shadow: var(--gdfb-shadow);
  min-width: 0;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.gdfb-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 22px 44px rgba(15, 23, 42, 0.13);
}

.gdfb-card__media {
  position: relative;
  background: linear-gradient(145deg, color-mix(in srgb, var(--gdfb-accent, var(--gdfb-primary)) 86%, white 14%), #0f172a 180%);
  aspect-ratio: 4 / 5.2;
}

.gdfb-card__media img,
.gdfb-cover-placeholder {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gdfb-cover-placeholder {
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.08em;
  font-size: clamp(1.3rem, 2vw, 2rem);
  background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02));
}

.gdfb-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.42rem 0.72rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #0f172a;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 10px 18px rgba(15, 23, 42, 0.12);
}

.gdfb-card__media .gdfb-badge {
  position: absolute;
  top: 0.9rem;
  left: 0.9rem;
}

.gdfb-card__body {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  padding: 1.15rem;
}

.gdfb-card__collections {
  color: var(--gdfb-primary);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.gdfb-card__title,
.gdfb-single__title,
.gdfb-viewer__title {
  margin: 0;
  color: var(--gdfb-text);
  line-height: 1.28;
}

.gdfb-card__title { font-size: 1.12rem; }

.gdfb-card__excerpt {
  color: var(--gdfb-muted);
  font-size: 0.95rem;
}

.gdfb-card__excerpt p:last-child { margin-bottom: 0; }

.gdfb-card__actions,
.gdfb-fallback__actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.gdfb-button,
.gdfb-tool {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.78rem 1rem;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.92rem;
  text-decoration: none;
  line-height: 1;
  transition: all 0.2s ease;
}

.gdfb-button--primary,
.gdfb-tool {
  background: var(--gdfb-accent, var(--gdfb-primary));
  color: #fff;
}

.gdfb-button--ghost,
.gdfb-tool--link {
  background: #fff;
  color: var(--gdfb-text);
  border-color: var(--gdfb-border);
}

.gdfb-button:hover,
.gdfb-tool:hover {
  transform: translateY(-1px);
}

.gdfb-single {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 1.2rem 0;
}

body.single-gdfb_document .post-thumbnail,
body.single-gdfb_document .featured-image,
body.single-gdfb_document .entry-thumb,
body.single-gdfb_document .single-thumb,
body.single-gdfb_document .single-thumbnail,
body.single-gdfb_document .post-image,
body.single-gdfb_document img.wp-post-image {
  display: none !important;
}

.gdfb-single-hero {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
  margin: 0 0 1.25rem;
  padding: 1.15rem;
  background: #fff;
  border: 1px solid var(--gdfb-border);
  border-radius: 24px;
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.08);
}

.gdfb-single-hero__cover img,
.gdfb-single-hero__cover .gdfb-cover-placeholder {
  width: 100%;
  aspect-ratio: 4 / 5.5;
  object-fit: cover;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.12);
}

.gdfb-single-hero__content {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.gdfb-single-hero__excerpt {
  color: var(--gdfb-muted);
  font-size: 0.98rem;
}

.gdfb-single-hero__excerpt p:last-child { margin-bottom: 0; }

.gdfb-single-hero__actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.gdfb-single__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.gdfb-inline-viewer,
.gdfb-modal__content {
  min-height: 240px;
}

.gdfb-viewer {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 26px;
  background: linear-gradient(180deg, #ffffff, #f8fafc);
  border: 1px solid var(--gdfb-border);
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.14);
}

.gdfb-viewer__topbar,
.gdfb-viewer__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.15rem;
  background: rgba(255,255,255,0.86);
  backdrop-filter: blur(14px);
}

.gdfb-viewer__meta {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.gdfb-viewer__status,
.gdfb-page-indicator,
.gdfb-fallback__note,
.gdfb-fallback__error {
  color: var(--gdfb-muted);
  font-size: 0.92rem;
}

.gdfb-viewer__actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.gdfb-viewer__body {
  position: relative;
  padding: 1rem;
  background:
    radial-gradient(circle at top left, rgba(29, 78, 216, 0.08), transparent 26%),
    radial-gradient(circle at top right, rgba(15, 23, 42, 0.06), transparent 28%),
    #eef2ff;
}

.gdfb-flip-stage,
.gdfb-fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
}

.gdfb-book {
  width: 100%;
  max-width: 1100px;
  margin-inline: auto;
}

.gdfb-page {
  background: #fff;
  overflow: hidden;
  display: grid;
  place-items: center;
}

.gdfb-page__canvas {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.gdfb-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  gap: 0.75rem;
  align-content: center;
  background: rgba(255,255,255,0.72);
  z-index: 3;
}

.gdfb-spinner {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 4px solid rgba(29,78,216,0.15);
  border-top-color: var(--gdfb-primary);
  animation: gdfb-spin 0.9s linear infinite;
}

.gdfb-loading__text { font-weight: 700; color: var(--gdfb-text); }

@keyframes gdfb-spin { to { transform: rotate(360deg); } }

.gdfb-fallback iframe {
  width: 100%;
  height: 100%;
  min-height: 480px;
  border: 0;
  border-radius: 18px;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(226,232,240,0.9);
}

.gdfb-fallback {
  align-content: start;
  gap: 0.9rem;
}

.gdfb-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: 0.2s ease;
}

.gdfb-modal.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.gdfb-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(8px);
}

.gdfb-modal__dialog {
  position: relative;
  width: min(96vw, 1320px);
  max-height: min(94vh, 1080px);
  margin: 3vh auto;
  background: transparent;
}

.gdfb-modal__close {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  z-index: 5;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,0.96);
  box-shadow: 0 12px 22px rgba(15, 23, 42, 0.22);
  cursor: pointer;
  font-size: 1.35rem;
  line-height: 1;
}

.gdfb-modal__content > .gdfb-viewer { max-height: 92vh; }

.gdfb-empty {
  padding: 1rem 1.15rem;
  background: #fff;
  border: 1px dashed var(--gdfb-border);
  border-radius: 16px;
  color: var(--gdfb-muted);
}

.is-hidden { display: none !important; }
.gdfb-lock-scroll { overflow: hidden; }

@media (max-width: 1100px) {
  .gdfb-columns-4 .gdfb-grid,
  .gdfb-columns-3 .gdfb-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 767px) {
  .gdfb-grid,
  .gdfb-columns-4 .gdfb-grid,
  .gdfb-columns-3 .gdfb-grid,
  .gdfb-columns-2 .gdfb-grid { grid-template-columns: 1fr; }

  .gdfb-single-hero {
    grid-template-columns: 1fr;
  }

  .gdfb-viewer__topbar,
  .gdfb-viewer__footer,
  .gdfb-single__header {
    flex-direction: column;
    align-items: stretch;
  }

  .gdfb-viewer__actions {
    width: 100%;
  }

  .gdfb-tool,
  .gdfb-button {
    flex: 1 1 auto;
    justify-content: center;
    text-align: center;
  }

  .gdfb-modal__dialog {
    width: min(98vw, 1320px);
    margin: 1vh auto;
  }

  .gdfb-viewer__body {
    padding: 0.75rem;
  }
}


.gdfb-library--solo .gdfb-grid {
  grid-template-columns: 1fr;
}

.gdfb-library--solo .gdfb-card {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(0, 1fr);
  align-items: stretch;
}

.gdfb-library--solo .gdfb-card__media {
  aspect-ratio: auto;
  min-height: 100%;
}

.gdfb-library--solo .gdfb-card__body {
  justify-content: center;
  padding: 1.4rem;
}

@media (max-width: 768px) {
  .gdfb-library--solo .gdfb-card {
    grid-template-columns: 1fr;
  }
}
