/**
 * DF Landskap-styling - CSS för Sverige runt-landskapssidor
 * Färgpalett matchar domboksforskning.se: varma jordtoner
 */

/* ===== INFO-/TIPS-/VARNINGSBOXAR (samordnade med paletten) ===== */
.df-info-box,
.df-tips,
.df-varning {
    margin: 24px 0;
    padding: 16px 20px;
    border-radius: 6px;
    border-left: 4px solid;
    background: #faf7f1;
    color: #3a2818;
    line-height: 1.6;
}

.df-info-box {
    background: #f4ede0;
    border-left-color: #c9a96e;
}

.df-tips {
    background: #f8f4ec;
    border-left-color: #8b5a2b;
}

.df-varning {
    background: #f5e8d8;
    border-left-color: #c97a4a;
}

.df-info-box strong:first-child,
.df-tips strong:first-child,
.df-varning strong:first-child {
    color: #5e3b1c;
    display: inline-block;
    margin-right: 4px;
}

.df-info-box p,
.df-tips p,
.df-varning p {
    margin: 0;
}

.df-info-box p + p,
.df-tips p + p,
.df-varning p + p {
    margin-top: 8px;
}

/* "Specialregler för" rubrik i varning-boxar - lite tydligare */
.df-varning strong:first-child {
    color: #8b3f1f;
}

/* ===== NYCKELTAL-GRID (key stats överst) ===== */
.df-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin: 24px 0;
    padding: 0;
    list-style: none;
}

.df-stat-card {
    background: #f8f4ec;
    border: 1px solid #d9c9a8;
    border-radius: 6px;
    padding: 16px 12px;
    text-align: center;
    transition: transform 0.2s ease;
}

.df-stat-card:hover {
    transform: translateY(-2px);
}

.df-stat-number {
    display: block;
    font-size: 1.9em;
    font-weight: 700;
    color: #8b5a2b;
    line-height: 1.1;
    margin-bottom: 4px;
}

.df-stat-label {
    display: block;
    font-size: 0.85em;
    color: #4a3520;
    line-height: 1.3;
}

/* ===== RÄTTSFALL-KORT ===== */
.df-case-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin: 24px 0;
}

.df-case-card {
    background: #faf7f1;
    border: 1px solid #e5d8c0;
    border-left: 4px solid #c9a96e;
    border-radius: 6px;
    padding: 20px 24px;
    position: relative;
}

.df-case-card-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e5d8c0;
}

.df-case-year {
    display: inline-block;
    background: #8b5a2b;
    color: #fff;
    padding: 4px 12px;
    border-radius: 14px;
    font-weight: 700;
    font-size: 0.9em;
    flex-shrink: 0;
    white-space: nowrap;
}

.df-case-title {
    margin: 0 !important;
    padding: 0 !important;
    font-size: 1.2em !important;
    color: #3a2818 !important;
    line-height: 1.3;
    flex: 1 1 auto;
    min-width: 0;
}

.df-case-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    margin-bottom: 12px;
    font-size: 0.88em;
    color: #5e3b1c;
}

.df-case-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.df-case-meta-item strong {
    color: #3a2818;
}

.df-case-card p {
    margin: 0 0 12px 0;
    color: #3a2818;
    line-height: 1.6;
}

.df-case-card p:last-child {
    margin-bottom: 0;
}

.df-case-source {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed #d9c9a8;
    font-size: 0.85em;
    color: #5e3b1c;
    font-style: italic;
}

.df-case-source strong {
    font-style: normal;
    color: #3a2818;
}

/* ===== TIDSLINJE ===== */
.df-timeline {
    position: relative;
    margin: 32px 0;
    padding: 0 0 0 30px;
    list-style: none;
}

.df-timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 8px;
    bottom: 8px;
    width: 3px;
    background: linear-gradient(to bottom, #c9a96e, #8b5a2b);
    border-radius: 2px;
}

.df-timeline-item {
    position: relative;
    margin-bottom: 18px;
    padding-left: 24px;
}

.df-timeline-item::before {
    content: '';
    position: absolute;
    left: -28px;
    top: 6px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #8b5a2b;
    border: 3px solid #faf7f1;
    box-shadow: 0 0 0 2px #c9a96e;
}

.df-timeline-year {
    display: inline-block;
    font-weight: 700;
    color: #8b5a2b;
    margin-right: 8px;
    font-size: 1.02em;
}

.df-timeline-event {
    color: #3a2818;
    line-height: 1.5;
}

/* ===== 2-KOLUMNS LAYOUT ===== */
.df-two-col {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin: 24px 0;
}

.df-two-col-card {
    background: #faf7f1;
    border: 1px solid #e5d8c0;
    border-radius: 6px;
    padding: 20px 24px;
}

.df-two-col-card.df-free {
    border-top: 4px solid #5a8a4f;
}

.df-two-col-card.df-paid {
    border-top: 4px solid #c97a4a;
}

.df-two-col-card h3 {
    margin-top: 0 !important;
    padding-top: 0 !important;
    color: #3a2818 !important;
    display: block;
    line-height: 1.3;
}

.df-two-col-badge {
    display: inline-block;
    margin-bottom: 10px;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.72em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #fff;
    vertical-align: middle;
}

.df-free .df-two-col-badge {
    background: #5a8a4f;
}

.df-paid .df-two-col-badge {
    background: #c97a4a;
}

.df-two-col-card ul {
    margin: 12px 0 0 0;
    padding-left: 20px;
}

.df-two-col-card li {
    margin-bottom: 10px;
    line-height: 1.5;
}

.df-two-col-card li:last-child {
    margin-bottom: 0;
}

/* ===== CITAT-BLOCK (för originalcitat från domböcker) ===== */
.df-quote {
    margin: 24px 0;
    padding: 20px 28px 20px 36px;
    background: #f4ede0;
    border-left: 5px solid #8b5a2b;
    border-radius: 0 6px 6px 0;
    font-style: italic;
    color: #3a2818;
    position: relative;
    line-height: 1.6;
}

.df-quote::before {
    content: '\201E';
    position: absolute;
    left: 6px;
    top: 8px;
    font-size: 2.6em;
    color: #c9a96e;
    line-height: 1;
    font-family: Georgia, serif;
    font-style: normal;
}

.df-quote-source {
    display: block;
    margin-top: 10px;
    font-style: normal;
    font-size: 0.88em;
    color: #5e3b1c;
}

.df-quote-source::before {
    content: '— ';
}

/* ===== RESPONSIVE-TABLE (härads-tabell) ===== */
.entry-content table.responsive-table,
table.responsive-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 24px 0;
    background: #faf7f1;
    border: 1px solid #e5d8c0;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(58, 40, 24, 0.05);
}

.entry-content table.responsive-table thead,
table.responsive-table thead {
    background: linear-gradient(135deg, #8b5a2b, #a0683a);
}

.entry-content table.responsive-table thead th,
table.responsive-table thead th {
    padding: 14px 18px;
    text-align: left;
    color: #fff;
    font-weight: 600;
    font-size: 0.95em;
    letter-spacing: 0.02em;
    border: none;
}

.entry-content table.responsive-table tbody tr,
table.responsive-table tbody tr {
    transition: background 0.15s ease;
}

.entry-content table.responsive-table tbody tr:nth-child(odd) td,
table.responsive-table tbody tr:nth-child(odd) td {
    background: #faf7f1;
}

.entry-content table.responsive-table tbody tr:nth-child(even) td,
table.responsive-table tbody tr:nth-child(even) td {
    background: #f4ede0;
}

.entry-content table.responsive-table tbody tr:hover td,
table.responsive-table tbody tr:hover td {
    background: #ede2cb;
}

.entry-content table.responsive-table td,
table.responsive-table td {
    padding: 12px 18px;
    color: #3a2818;
    border: none;
    border-top: 1px solid #e5d8c0;
    line-height: 1.4;
}

.entry-content table.responsive-table tbody tr:first-child td,
table.responsive-table tbody tr:first-child td {
    border-top: none;
}

/* Första kolumnen (Härad-namnet) bold och accentfärgad */
.entry-content table.responsive-table tbody td:first-child,
table.responsive-table tbody td:first-child {
    font-weight: 600;
    color: #5e3b1c;
    border-left: 3px solid transparent;
}

.entry-content table.responsive-table tbody tr:hover td:first-child,
table.responsive-table tbody tr:hover td:first-child {
    border-left-color: #c9a96e;
}

/* Andra kolumnen (Arkivnummer) som monospace för läsbarhet */
.entry-content table.responsive-table tbody td:nth-child(2),
table.responsive-table tbody td:nth-child(2) {
    font-family: ui-monospace, "SF Mono", "Cascadia Code", "Roboto Mono", Consolas, monospace;
    font-size: 0.92em;
    color: #4a3520;
}

/* "Sök i NAD" stilas som muted-text */
.entry-content table.responsive-table tbody td:nth-child(2):not(:has(a)),
table.responsive-table tbody td:nth-child(2) {
    /* gäller alla, men nedan görs muted */
}

/* Mobil-anpassning för responsive-tabell */
@media (max-width: 600px) {
    .entry-content table.responsive-table,
    table.responsive-table {
        font-size: 0.92em;
    }

    .entry-content table.responsive-table thead th,
    table.responsive-table thead th {
        padding: 10px 12px;
    }

    .entry-content table.responsive-table td,
    table.responsive-table td {
        padding: 10px 12px;
    }
}

/* ===== NAMNFORMER-TABELL (snyggare än ul) ===== */
.df-namnformer {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: #faf7f1;
    border: 1px solid #e5d8c0;
    border-radius: 6px;
    overflow: hidden;
}

.df-namnformer thead {
    background: #c9a96e;
    color: #fff;
}

.df-namnformer th {
    padding: 10px 16px;
    text-align: left;
    font-weight: 600;
}

.df-namnformer td {
    padding: 10px 16px;
    border-top: 1px solid #e5d8c0;
    color: #3a2818;
}

.df-namnformer tr:nth-child(even) td {
    background: #f4ede0;
}

.df-namnformer .df-namnform-old {
    font-weight: 600;
    color: #5e3b1c;
}

/* ===== MOBIL ===== */
@media (max-width: 600px) {
    .df-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .df-stat-card {
        padding: 12px 8px;
    }

    .df-stat-number {
        font-size: 1.5em;
    }

    .df-case-card {
        padding: 16px;
    }

    .df-case-card-header {
        flex-direction: column;
        gap: 8px;
    }

    .df-two-col {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .df-quote {
        padding: 16px 20px 16px 30px;
    }

    .df-quote::before {
        font-size: 2em;
    }

    .df-timeline {
        padding-left: 24px;
    }

    .df-namnformer {
        font-size: 0.92em;
    }

    .df-namnformer th, .df-namnformer td {
        padding: 8px 10px;
    }
}

/* ===== DARK MODE ===== */
@media (prefers-color-scheme: dark) {
    /* Info/tips/varning */
    .df-info-box {
        background: #2a2218;
        color: #e5d8c0;
        border-left-color: #b8975e;
    }

    .df-tips {
        background: #221c12;
        color: #e5d8c0;
        border-left-color: #d4a574;
    }

    .df-varning {
        background: #2e211a;
        color: #f0d8c5;
        border-left-color: #d49575;
    }

    .df-info-box strong:first-child,
    .df-tips strong:first-child {
        color: #d4a574;
    }

    .df-varning strong:first-child {
        color: #e09975;
    }
    .df-stat-card {
        background: #221c12;
        border-color: #4a3d28;
    }

    .df-stat-number {
        color: #d4a574;
    }

    .df-stat-label {
        color: #d8c9a8;
    }

    .df-case-card {
        background: #221c12;
        border-color: #4a3d28;
        border-left-color: #b8975e;
    }

    .df-case-card-header {
        border-bottom-color: #4a3d28;
    }

    .df-case-year {
        background: #b8975e;
    }

    .df-case-title {
        color: #f0e5cc !important;
    }

    .df-case-meta {
        color: #d4a574;
    }

    .df-case-meta strong, .df-case-card p {
        color: #e5d8c0;
    }

    .df-case-source {
        border-top-color: #4a3d28;
        color: #d4a574;
    }

    .df-timeline-event {
        color: #e5d8c0;
    }

    .df-timeline-year {
        color: #d4a574;
    }

    .df-two-col-card {
        background: #221c12;
        border-color: #4a3d28;
    }

    .df-two-col-card h3 {
        color: #f0e5cc !important;
    }

    .df-quote {
        background: #2a2218;
        color: #e5d8c0;
        border-left-color: #b8975e;
    }

    .df-quote-source {
        color: #d4a574;
    }

    .df-namnformer {
        background: #221c12;
        border-color: #4a3d28;
    }

    .df-namnformer td {
        color: #e5d8c0;
        border-top-color: #4a3d28;
    }

    .df-namnformer tr:nth-child(even) td {
        background: #2a2218;
    }

    /* Responsive-table dark mode */
    .entry-content table.responsive-table,
    table.responsive-table {
        background: #221c12;
        border-color: #4a3d28;
    }

    .entry-content table.responsive-table tbody tr:nth-child(odd) td,
    table.responsive-table tbody tr:nth-child(odd) td {
        background: #221c12;
    }

    .entry-content table.responsive-table tbody tr:nth-child(even) td,
    table.responsive-table tbody tr:nth-child(even) td {
        background: #2a2218;
    }

    .entry-content table.responsive-table tbody tr:hover td,
    table.responsive-table tbody tr:hover td {
        background: #332a1c;
    }

    .entry-content table.responsive-table td,
    table.responsive-table td {
        color: #e5d8c0;
        border-top-color: #4a3d28;
    }

    .entry-content table.responsive-table tbody td:first-child,
    table.responsive-table tbody td:first-child {
        color: #d4a574;
    }

    .entry-content table.responsive-table tbody td:nth-child(2),
    table.responsive-table tbody td:nth-child(2) {
        color: #d8c9a8;
    }
}
