body {
    font-family: Arial, sans-serif;
    margin: 0;
    transition: background 0.3s, color 0.3s;
}

/* Dark theme */
body.dark {
    background: #1a1a1a;
    color: #ddd;
}

/* Light theme */
body.light {
    background: #eaf2fa; /* mjuk ljusblågrå */
    color: #111;
}

/* Header */
header {
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #0a0a0a;
    color: #fff;
}
body.light header {
    background: #3399ff;
    color: #fff;
}

nav a {
    margin: 0 10px;
    color: inherit;
    text-decoration: none;
}
nav a:hover {
    text-decoration: underline;
}

/* Theme button */
#theme-toggle {
    background: transparent;
    border: 1px solid #555;
    color: inherit;
    border-radius: 5px;
    padding: 5px 10px;
    cursor: pointer;
    transition: background 0.3s;
}
#theme-toggle:hover {
    background: rgba(255,255,255,0.1);
}

/* Grid */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    padding: 20px;
}

/* Cards */
.card {
    background: #222;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    padding: 15px;
    transition: transform 0.2s, box-shadow 0.2s, opacity 0.6s, transform 0.6s;
    opacity: 0;
    transform: translateY(20px);
}
.card.visible {
    opacity: 1;
    transform: translateY(0);
}
.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.6);
}
body.light .card {
    background: #fff;
    color: #111;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* Images */
.card-image img {
    width: 100%;
    max-height: 250px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 10px;
}

/* Headline */
.card h3 {
    font-size: 1.1em;
    margin: 0 0 8px 0;
}

/* Summary text */
.article-summary {
    font-size: 0.9em;
    line-height: 1.4em;
    margin-bottom: 10px;
}

.article-summary.short {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.article-summary.full.hidden {
    display: none;
}

/* Expanded mode */
.card.expanded .article-summary.short {
    display: none;
}
.card.expanded .article-summary.full {
    display: block;
}

/* Expand button */
.expand-btn {
    margin: 5px 0;
    background: #444;
    border: none;
    color: #fff;
    padding: 6px 10px;
    border-radius: 5px;
    cursor: pointer;
}
.expand-btn:hover {
    background: #666;
}
body.light .expand-btn {
    background: #ddd;
    color: #111;
}
body.light .expand-btn:hover {
    background: #ccc;
}

/* Footer */
footer {
    text-align: center;
    padding: 20px;
    font-size: 14px;
    opacity: 0.8;
}

footer .sig {
    margin-top: 5px;
    font-style: italic;
    font-size: 13px;
    color: #66aaff;
}
footer .sig a {
    color: #66aaff;
    text-decoration: none;
}
footer .sig a:hover {
    text-decoration: underline;
}

/* Load More button */
.load-more-container {
    text-align: center;
    margin: 20px 0;
}
#load-more-btn {
    background: #444;
    border: none;
    color: #fff;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.3s;
}
#load-more-btn:hover {
    background: #666;
}
body.light #load-more-btn {
    background: #ddd;
    color: #111;
}
body.light #load-more-btn:hover {
    background: #ccc;
}

/* Expand/collapse smooth */
.article-summary.full {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.5s ease, opacity 0.4s ease;
}
.card.expanded .article-summary.full {
    max-height: 1000px; /* tillräckligt högt för det mesta */
    opacity: 1;
}

/* Spinner */
.spinner {
    border: 4px solid rgba(255,255,255,0.2);
    border-top: 4px solid #66aaff;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    margin: 20px auto;
    animation: spin 1s linear infinite;
}
body.light .spinner {
    border: 4px solid rgba(0,0,0,0.1);
    border-top: 4px solid #3399ff;
}
.spinner.hidden {
    display: none;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Fade-in för bilder */
.card-image img {
    opacity: 0;
    transition: opacity 0.6s ease;
}
.card-image img.loaded {
    opacity: 1;
}
/* Retro ANSI banner */
/* Fix */
.ansi-warez {
    font-family: monospace;
    font-size: 11px;
    white-space: pre;
    line-height: 1.1em;
    color: #66ffcc;
    text-shadow: 0 0 6px #00ffaa;
    margin: 30px auto;
    text-align: center;
    max-width: 95%;
    overflow-x: auto;   /* bara sidscroll om texten är bred */
    overflow-y: hidden; /* ta bort vertical scroll helt */
    display: block;
}

