/* ==========================================================================
   Darkframe Game Engine — Public Archive Elementor Widgets
   Prefix: dfg-dl (library), dfg-dv (viewer), dfg-dm (metadata),
           dfg-fd (featured), dfg-rd (related)
   ========================================================================== */

/* ── Shared tokens ─────────────────────────────────────────────────────────── */

.dfg-dl, .dfg-dv, .dfg-dm, .dfg-fd, .dfg-rd {
    font-family: inherit;
    color: inherit;
    box-sizing: border-box;
}

.dfg-dl *, .dfg-dv *, .dfg-dm *, .dfg-fd *, .dfg-rd * {
    box-sizing: border-box;
}

/* ── Badges (shared) ─────────────────────────────────────────────────────── */

.dfg-dl__badge,
.dfg-dm__badge,
.dfg-fd__badge,
.dfg-rd__badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: color-mix(in srgb, var(--dfg-dl-accent, #1a1a2e) 12%, transparent);
    color: var(--dfg-dl-accent, #1a1a2e);
    white-space: nowrap;
}

/* ── Document Library ────────────────────────────────────────────────────── */

/* Filter form */
.dfg-dl__form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    align-items: flex-end;
}

.dfg-dl__form-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dfg-dl__form label {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.dfg-dl__form input[type="text"],
.dfg-dl__form select {
    height: 36px;
    padding: 0 10px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-size: 14px;
    background: #fff;
    color: #0f172a;
    outline: none;
    min-width: 120px;
}

.dfg-dl__form input[type="text"]:focus,
.dfg-dl__form select:focus {
    border-color: var(--dfg-dl-accent, #1a1a2e);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--dfg-dl-accent, #1a1a2e) 20%, transparent);
}

.dfg-dl__form-submit {
    height: 36px;
    padding: 0 16px;
    background: var(--dfg-dl-accent, #1a1a2e);
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.dfg-dl__form-submit:hover {
    opacity: 0.88;
}

/* Table layout */
.dfg-dl__table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.dfg-dl__table th {
    padding: 10px 12px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #64748b;
    border-bottom: 2px solid #e2e8f0;
    background: #f8fafc;
    white-space: nowrap;
}

.dfg-dl__table td {
    padding: 12px 12px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    color: var(--dfg-dl-text, #0f172a);
}

.dfg-dl__table tr:last-child td {
    border-bottom: none;
}

.dfg-dl__table tr:hover td {
    background: #f8fafc;
}

.dfg-dl__table a {
    color: var(--dfg-dl-accent, #1a1a2e);
    text-decoration: none;
    font-weight: 500;
}

.dfg-dl__table a:hover {
    text-decoration: underline;
}

.dfg-dl__featured-star {
    color: #f59e0b;
    font-size: 14px;
}

/* Archive list layout */
.dfg-dl__list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.dfg-dl__list-item {
    display: flex;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid #e2e8f0;
    align-items: flex-start;
}

.dfg-dl__list-item:last-child {
    border-bottom: none;
}

.dfg-dl__list-cover {
    flex-shrink: 0;
    width: 60px;
    height: 80px;
    object-fit: cover;
    border-radius: 3px;
    background: #f1f5f9;
}

.dfg-dl__list-body {
    flex: 1;
    min-width: 0;
}

.dfg-dl__list-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 4px;
    align-items: center;
}

.dfg-dl__list-ref,
.dfg-dl__list-date {
    font-size: 12px;
    color: #64748b;
    font-weight: 500;
}

.dfg-dl__list-title {
    margin: 0 0 4px;
    font-size: 15px;
    font-weight: 600;
}

.dfg-dl__list-title a {
    color: var(--dfg-dl-accent, #1a1a2e);
    text-decoration: none;
}

.dfg-dl__list-title a:hover {
    text-decoration: underline;
}

.dfg-dl__list-summary {
    margin: 0;
    font-size: 13px;
    color: #64748b;
    line-height: 1.5;
}

.dfg-dl__list-dl-btn {
    display: inline-block;
    margin-top: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--dfg-dl-accent, #1a1a2e);
    text-decoration: none;
    border: 1px solid currentColor;
    padding: 2px 8px;
    border-radius: 3px;
}

/* Cards layout */
.dfg-dl__cards {
    display: grid;
    gap: 20px;
}

.dfg-dl__cards--cols-1 { grid-template-columns: 1fr; }
.dfg-dl__cards--cols-2 { grid-template-columns: repeat(2, 1fr); }
.dfg-dl__cards--cols-3 { grid-template-columns: repeat(3, 1fr); }
.dfg-dl__cards--cols-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 900px) {
    .dfg-dl__cards--cols-4 { grid-template-columns: repeat(2, 1fr); }
    .dfg-dl__cards--cols-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
    .dfg-dl__cards--cols-4,
    .dfg-dl__cards--cols-3,
    .dfg-dl__cards--cols-2 { grid-template-columns: 1fr; }
}

.dfg-dl__card {
    background: var(--dfg-dl-card-bg, #fff);
    border-radius: var(--dfg-dl-card-radius, 6px);
    border: 1px solid #e2e8f0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.dfg-dl__card-cover {
    display: block;
    aspect-ratio: 3/4;
    overflow: hidden;
    background: #f1f5f9;
}

.dfg-dl__card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.2s;
}

.dfg-dl__card:hover .dfg-dl__card-cover img {
    transform: scale(1.03);
}

.dfg-dl__card-body {
    padding: 14px 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.dfg-dl__card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 6px;
    align-items: center;
}

.dfg-dl__card-ref,
.dfg-dl__card-date {
    font-size: 11px;
    color: #64748b;
    font-weight: 500;
}

.dfg-dl__card-title {
    margin: 0 0 8px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
    flex: 1;
}

.dfg-dl__card-title a {
    color: var(--dfg-dl-accent, #1a1a2e);
    text-decoration: none;
}

.dfg-dl__card-title a:hover {
    text-decoration: underline;
}

.dfg-dl__card-summary {
    margin: 0 0 10px;
    font-size: 12px;
    color: #64748b;
    line-height: 1.5;
}

.dfg-dl__card-dl-btn {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    color: var(--dfg-dl-accent, #1a1a2e);
    text-decoration: none;
    border: 1px solid currentColor;
    padding: 4px 10px;
    border-radius: 3px;
    align-self: flex-start;
}

/* Compact list */
.dfg-dl__compact {
    list-style: none;
    padding: 0;
    margin: 0;
}

.dfg-dl__compact-item {
    display: flex;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #f1f5f9;
    align-items: center;
}

.dfg-dl__compact-item:last-child {
    border-bottom: none;
}

.dfg-dl__compact-ref {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 500;
    white-space: nowrap;
    min-width: 80px;
}

.dfg-dl__compact-title {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
    color: var(--dfg-dl-accent, #1a1a2e);
    text-decoration: none;
}

.dfg-dl__compact-title:hover {
    text-decoration: underline;
}

.dfg-dl__compact-date {
    font-size: 12px;
    color: #94a3b8;
    white-space: nowrap;
}

/* Pagination */
.dfg-dl__pagination {
    display: flex;
    gap: 4px;
    margin-top: 24px;
    justify-content: center;
    flex-wrap: wrap;
}

.dfg-dl__page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-size: 13px;
    color: var(--dfg-dl-accent, #1a1a2e);
    text-decoration: none;
    background: #fff;
    transition: background 0.15s, border-color 0.15s;
}

.dfg-dl__page-link:hover {
    background: #f1f5f9;
    border-color: var(--dfg-dl-accent, #1a1a2e);
}

.dfg-dl__page-link--current {
    background: var(--dfg-dl-accent, #1a1a2e);
    border-color: var(--dfg-dl-accent, #1a1a2e);
    color: #fff;
    font-weight: 700;
}

.dfg-dl__empty {
    padding: 32px 0;
    color: #94a3b8;
    font-size: 14px;
    text-align: center;
}

/* Download button (shared) */
.dfg-dl__dl-btn {
    display: inline-block;
    font-size: 13px;
    font-weight: 600;
    color: var(--dfg-dl-accent, #1a1a2e);
    text-decoration: none;
    border: 1px solid currentColor;
    padding: 5px 14px;
    border-radius: 4px;
}

/* ── Document Viewer ─────────────────────────────────────────────────────── */

.dfg-dv {
    --dfg-dv-accent: #1a1a2e;
    --dfg-dv-border: #e2e8f0;
    --dfg-dv-header-bg: #f8fafc;
}

.dfg-dv__header {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: baseline;
    padding: 14px 16px;
    background: var(--dfg-dv-header-bg);
    border: 1px solid var(--dfg-dv-border);
    border-bottom: none;
    border-radius: 4px 4px 0 0;
}

.dfg-dv__ref {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
}

.dfg-dv__title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--dfg-dv-accent);
    flex: 1;
}

.dfg-dv__date {
    font-size: 12px;
    color: #94a3b8;
}

.dfg-dv__frame-wrap {
    border: 1px solid var(--dfg-dv-border);
    border-radius: 0 0 4px 4px;
    overflow: hidden;
    background: #f1f5f9;
}

.dfg-dv__frame {
    display: block;
    width: 100%;
    border: none;
}

.dfg-dv__message {
    padding: 24px;
    color: #94a3b8;
    font-size: 14px;
    border: 1px solid var(--dfg-dv-border);
    border-radius: 4px;
    text-align: center;
}

.dfg-dv__actions {
    margin-top: 12px;
    display: flex;
    gap: 10px;
}

.dfg-dv__dl-btn {
    display: inline-block;
    padding: 8px 18px;
    background: var(--dfg-dv-accent);
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
}

.dfg-dv__dl-btn:hover {
    opacity: 0.88;
}

.dfg-dv--empty {
    padding: 24px;
    color: #94a3b8;
    font-size: 14px;
    text-align: center;
}

/* ── Document Metadata ───────────────────────────────────────────────────── */

.dfg-dm {
    --dfg-dm-accent: #1a1a2e;
    --dfg-dm-label: #64748b;
    --dfg-dm-value: #0f172a;
    --dfg-dm-border: #e2e8f0;
}

/* Table layout */
.dfg-dm__table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.dfg-dm__table .dfg-dm__label {
    padding: 10px 16px 10px 0;
    font-weight: 600;
    font-size: 12px;
    color: var(--dfg-dm-label);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    vertical-align: top;
    border-bottom: 1px solid var(--dfg-dm-border);
    width: 160px;
}

.dfg-dm__table .dfg-dm__value {
    padding: 10px 0;
    color: var(--dfg-dm-value);
    border-bottom: 1px solid var(--dfg-dm-border);
    line-height: 1.5;
}

.dfg-dm__table .dfg-dm__row:last-child .dfg-dm__label,
.dfg-dm__table .dfg-dm__row:last-child .dfg-dm__value {
    border-bottom: none;
}

/* Definition list */
.dfg-dm__dl {
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 16px;
    row-gap: 0;
    font-size: 14px;
}

.dfg-dm__dl .dfg-dm__label {
    font-weight: 600;
    font-size: 12px;
    color: var(--dfg-dm-label);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 8px 0;
    border-bottom: 1px solid var(--dfg-dm-border);
    white-space: nowrap;
    align-self: start;
}

.dfg-dm__dl .dfg-dm__value {
    padding: 8px 0;
    color: var(--dfg-dm-value);
    border-bottom: 1px solid var(--dfg-dm-border);
    line-height: 1.5;
}

/* Compact inline */
.dfg-dm__compact {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 20px;
    font-size: 13px;
}

.dfg-dm__item {
    display: flex;
    gap: 4px;
    align-items: baseline;
}

.dfg-dm__compact .dfg-dm__label {
    font-size: 11px;
    font-weight: 700;
    color: var(--dfg-dm-label);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.dfg-dm__compact .dfg-dm__value {
    color: var(--dfg-dm-value);
}

.dfg-dm__badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: color-mix(in srgb, var(--dfg-dm-accent, #1a1a2e) 10%, transparent);
    color: var(--dfg-dm-accent, #1a1a2e);
}

.dfg-dm--empty {
    padding: 24px;
    color: #94a3b8;
    font-size: 14px;
    text-align: center;
}

/* ── Featured Document ───────────────────────────────────────────────────── */

.dfg-fd {
    --dfg-fd-accent: #1a1a2e;
    --dfg-fd-bg: #fff;
    --dfg-fd-text: #0f172a;
    --dfg-fd-radius: 8px;
    background: var(--dfg-fd-bg);
    border-radius: var(--dfg-fd-radius);
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

/* Side by side */
.dfg-fd--side_by_side {
    display: grid;
    grid-template-columns: 260px 1fr;
}

@media (max-width: 700px) {
    .dfg-fd--side_by_side {
        grid-template-columns: 1fr;
    }
}

/* Stacked */
.dfg-fd--stacked {
    display: flex;
    flex-direction: column;
}

/* Overlay */
.dfg-fd--overlay {
    position: relative;
}

.dfg-fd--overlay .dfg-fd__image {
    position: relative;
}

.dfg-fd--overlay .dfg-fd__image img {
    display: block;
    width: 100%;
    max-height: 420px;
    object-fit: cover;
}

.dfg-fd--overlay .dfg-fd__body {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0) 100%);
    color: #fff;
    padding: 32px 24px 24px;
}

.dfg-fd--overlay .dfg-fd__title,
.dfg-fd--overlay .dfg-fd__summary {
    color: #fff;
}

.dfg-fd__image {
    overflow: hidden;
    background: #f1f5f9;
}

.dfg-fd__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.dfg-fd__body {
    padding: 28px 32px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    color: var(--dfg-fd-text);
}

.dfg-fd__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
}

.dfg-fd__badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    background: color-mix(in srgb, var(--dfg-fd-accent, #1a1a2e) 12%, transparent);
    color: var(--dfg-fd-accent, #1a1a2e);
}

.dfg-fd--overlay .dfg-fd__badge {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

.dfg-fd__ref {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
}

.dfg-fd__date {
    font-size: 12px;
    color: #94a3b8;
}

.dfg-fd__title {
    margin: 0 0 12px;
    font-size: 22px;
    font-weight: 700;
    color: var(--dfg-fd-accent);
    line-height: 1.25;
}

.dfg-fd__summary {
    margin: 0 0 20px;
    font-size: 14px;
    color: #475569;
    line-height: 1.65;
}

.dfg-fd__actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.dfg-fd__btn {
    display: inline-block;
    padding: 9px 20px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: opacity 0.15s;
}

.dfg-fd__btn:hover {
    opacity: 0.85;
}

.dfg-fd__btn--primary {
    background: var(--dfg-fd-accent);
    color: #fff;
}

.dfg-fd__btn--secondary {
    background: transparent;
    color: var(--dfg-fd-accent);
    border: 1px solid currentColor;
}

.dfg-fd--empty {
    padding: 24px;
    color: #94a3b8;
    font-size: 14px;
    text-align: center;
}

/* ── Related Documents ───────────────────────────────────────────────────── */

.dfg-rd {
    --dfg-rd-accent: #1a1a2e;
    --dfg-rd-card-bg: #fff;
    --dfg-rd-radius: 6px;
}

.dfg-rd__heading {
    margin: 0 0 16px;
    font-size: 15px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--dfg-rd-accent);
}

.dfg-rd__empty {
    color: #94a3b8;
    font-size: 14px;
}

/* Cards */
.dfg-rd__cards {
    display: grid;
    gap: 16px;
}

.dfg-rd__cards--cols-1 { grid-template-columns: 1fr; }
.dfg-rd__cards--cols-2 { grid-template-columns: repeat(2, 1fr); }
.dfg-rd__cards--cols-3 { grid-template-columns: repeat(3, 1fr); }
.dfg-rd__cards--cols-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 900px) {
    .dfg-rd__cards--cols-4,
    .dfg-rd__cards--cols-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
    .dfg-rd__cards--cols-4,
    .dfg-rd__cards--cols-3,
    .dfg-rd__cards--cols-2 { grid-template-columns: 1fr; }
}

.dfg-rd__card {
    background: var(--dfg-rd-card-bg);
    border-radius: var(--dfg-rd-radius);
    border: 1px solid #e2e8f0;
    overflow: hidden;
}

.dfg-rd__card-image {
    display: block;
    aspect-ratio: 3/4;
    overflow: hidden;
    background: #f1f5f9;
}

.dfg-rd__card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.2s;
}

.dfg-rd__card:hover .dfg-rd__card-image img {
    transform: scale(1.03);
}

.dfg-rd__card-body {
    padding: 12px 14px;
}

.dfg-rd__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin-bottom: 6px;
}

.dfg-rd__ref,
.dfg-rd__date {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 500;
}

.dfg-rd__card-title {
    margin: 0 0 6px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
}

.dfg-rd__card-title a {
    color: var(--dfg-rd-accent);
    text-decoration: none;
}

.dfg-rd__card-title a:hover {
    text-decoration: underline;
}

.dfg-rd__card-summary {
    margin: 0;
    font-size: 12px;
    color: #64748b;
    line-height: 1.5;
}

/* Compact list */
.dfg-rd__compact {
    list-style: none;
    padding: 0;
    margin: 0;
}

.dfg-rd__compact-item {
    display: flex;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #f1f5f9;
    align-items: center;
}

.dfg-rd__compact-item:last-child {
    border-bottom: none;
}

.dfg-rd__compact-thumb {
    flex-shrink: 0;
    width: 40px;
    height: 54px;
    object-fit: cover;
    border-radius: 2px;
    background: #f1f5f9;
}

.dfg-rd__compact-body {
    flex: 1;
    min-width: 0;
}

.dfg-rd__compact-title {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--dfg-rd-accent);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dfg-rd__compact-title:hover {
    text-decoration: underline;
}

/* Archive list */
.dfg-rd__list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.dfg-rd__list-item {
    padding: 14px 0;
    border-bottom: 1px solid #e2e8f0;
}

.dfg-rd__list-item:last-child {
    border-bottom: none;
}

.dfg-rd__list-title {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--dfg-rd-accent);
    text-decoration: none;
    margin: 4px 0;
}

.dfg-rd__list-title:hover {
    text-decoration: underline;
}

.dfg-rd__list-summary {
    margin: 4px 0 0;
    font-size: 13px;
    color: #64748b;
    line-height: 1.5;
}
