:root {
    color-scheme: light;
    --page-bg: #eff1ff;
    --header-bg: #03050c;
    --footer-bg: #03050c;
    --panel-bg: #ffffff;
    --panel-border: #dbe4fb;
    --panel-line: #e8eefc;
    --copy: #566482;
    --title: #102046;
    --text: #223253;
    --meta: #5f6f8f;
}

* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }
body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: "Roboto", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: var(--page-bg);
    color: var(--text);
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

.site-shell { width: min(1180px, calc(100% - 2rem)); margin-inline: auto; }
.site-header {
    position: relative;
    background: var(--header-bg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
    padding: 1rem 0;
    z-index: 20;
}
.site-header-row {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 3rem;
    gap: 1rem;
}
.brand-mark { position: relative; z-index: 1; }
.brand-mark img { height: 1.95rem; width: auto; }
.nav-pill {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(8, 10, 20, 0.84);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.26);
}
.nav-link {
    padding: 0.62rem 1rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.66);
}
.nav-link.is-active, .nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.site-main { flex: 1 0 auto; }
.page-section { padding: 3rem 0 6rem; }

.message-list {
    max-width: 72rem;
    margin: 0 auto 1rem;
    display: grid;
    gap: 12px;
}
.message {
    padding: 14px 16px;
    border-radius: 16px;
    font-size: 0.95rem;
    line-height: 1.5;
}
.message.error {
    background: #ffe7e2;
    color: #912f2f;
}

.digest-title {
    display: flex;
    align-items: center;
    justify-content: center; /* centra tutto orizzontalmente */
    gap: 12px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
}
.digest-title img {
    width: 4rem;
    height: auto;
    border-radius: 50%;
    object-fit: cover;
}
.digest-subtitle {
    max-width: 48rem;
    margin: 1rem auto 0;
    font-size: 1rem;
    line-height: 1.75;
    color: var(--copy);
}

.media-panel,
.article-card {
    margin: 0 auto;
    border-radius: 2rem;
    border: 1px solid var(--panel-border);
    background: var(--panel-bg);
    box-shadow: 0 18px 42px rgba(13, 25, 54, 0.08);
}
.media-panel {
    max-width: 80rem;
    padding: 1.5rem;
}
.media-panel-header {
    border-bottom: 1px solid var(--panel-line);
    padding-bottom: 1.5rem;
    text-align: center;
}
.media-panel-header h1,
.media-panel-header p {
    max-width: 48rem;
    margin: 1rem auto 0;
    font-size: 1rem;
    line-height: 1.75;
    color: var(--copy);
}
.media-grid {
    list-style: none;
    margin: 2rem 0 0;
    padding: 0;
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
.media-grid-item { min-width: 0; }
.media-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    border-radius: 1.7rem;
    border: 1px solid #e6edff;
    background: #f8faff;
    padding: 1rem;
    transition: transform 220ms ease, background-color 220ms ease, box-shadow 220ms ease;
}
.media-card:hover {
    transform: translateY(-4px);
    background: #eef3ff;
    box-shadow: 0 16px 32px rgba(13, 25, 54, 0.08);
}
.media-card-hero-link,
.media-card-title-link {
    display: block;
    color: inherit;
    text-decoration: none;
}
.media-card-hero {
    overflow: hidden;
    border-radius: 1.35rem;
    background: #ffffff;
}
.media-card-hero img {
    display: block;
    width: 100%;
    height: auto;
}
.media-card-copy { padding: 1.25rem 0.25rem 0.25rem; }
.media-card-copy {
    display: grid;
    gap: 0.85rem;
}
.media-card-title-link {
    display: grid;
    gap: 0.85rem;
}
.media-card h2 {
    margin: 0;
    font-size: 1.25rem;
    line-height: 1.2;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: #1a2a4e;
}
.media-card p {
    margin: 0;
    font-size: 0.94rem;
    line-height: 1.75;
    color: var(--copy);
}
.media-card-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    justify-content: space-between;
    min-width: 0;
}
.media-card-author-line {
    display: inline-flex;
    align-items: center;
    gap: 0.48rem;
    min-width: 0;
    flex-wrap: wrap;
    font-size: 0.82rem;
    font-weight: 600;
    color: #7282a3;
}
.media-card-author-link,
.media-card-author {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    min-width: 0;
}
.media-card-author-link {
    color: inherit;
    text-decoration: none;
}
.media-card-author-link:hover .media-card-author-name,
.media-card-title-link:hover h2 {
    color: #18346c;
}
.media-card-title {
    margin: 0;
    font-size: 1.25rem;
    line-height: 1.2;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: #1a2a4e;
}
.media-card-subtitle {
    font-size: 0.875rem;
    line-height: 1.75;
    color: #5e6d8f;
    margin-top: 0.75rem;
}
.media-card-author-avatar {
    width: 1.95rem;
    height: 1.95rem;
    border-radius: 999px;
    object-fit: cover;
    border: 1px solid #d8e3fb;
    background: #ffffff;
    flex-shrink: 0;
}
.media-card-author-name {
    font-weight: 700;
    color: #22345c;
}
.media-card-separator {
    color: #7a88a7;
}
.media-card-date {
    min-width: 0;
    overflow-wrap: anywhere;
}
.media-card-tags {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
}
.media-card-tag,
.article-tag-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 1.65rem;
    padding: 0.28rem 0.58rem;
    border-radius: 999px;
    border: 1px solid #dde7fd;
    background: rgba(238, 243, 255, 0.72);
    color: #5a6a88;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: inherit;
    text-decoration: none;
}
.media-card-tag:hover,
.article-tag-link:hover {
    background: rgba(226, 235, 255, 0.96);
    color: #38507d;
}
.empty-state {
    margin: 2rem 0 0;
    text-align: center;
    color: var(--copy);
    font-size: 1rem;
}

.detail-actions {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}
.back-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.85rem;
    padding: 0.85rem 1.35rem;
    border-radius: 999px;
    border: 1px solid #cfe0ff;
    background: #eef4ff;
    color: #17306a;
    box-shadow: 0 10px 24px rgba(13, 25, 54, 0.08);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.article-header {
    border-bottom: 1px solid var(--panel-line);
    padding-bottom: 1.5rem;
    text-align: center;
}
.article-title {
    margin: 0;
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 1.05;
    letter-spacing: -0.03em;
    color: var(--title);
    font-weight: 800;
}
.article-date {
    font-size: 0.95rem;
    color: var(--meta);
}
.article-card {
    max-width: 64rem;
    padding: 1.5rem;
}
.article-meta {
    margin-top: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    font-size: 0.95rem;
    color: var(--meta);
}
.article-meta img {
    height: 2rem;
    width: 2rem;
    border-radius: 999px;
    object-fit: cover;
}
.author-line {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}
.article-meta .author,
.article-meta .author-role {
    font-weight: 700;
    color: #26365e;
}
.article-author-link {
    color: inherit;
    text-decoration: none;
}
.article-author-link:hover .author {
    color: #18346c;
}
/* Author page */
.author-panel-header { display: flex; flex-direction: column; align-items: center; gap: 0.75rem; }
.author-page-avatar {
    width: 5rem;
    height: 5rem;
    border-radius: 999px;
    object-fit: cover;
    border: 3px solid #dbe4fb;
    background: #f0f4ff;
}
.author-page-role {
    margin: 0;
    font-size: 1rem;
    color: var(--copy);
}

/* Tag page */
.tag-page-label {
    margin: 0 0 0.25rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--meta);
}
.author-role {
    font-size: 0.95rem;
    line-height: 1.3;
}
.author-separator { color: var(--meta); }
.article-subtitle {
    max-width: 48rem;
    margin: 1rem auto 0;
    font-size: 1.125rem;
    line-height: 1.8;
    color: var(--copy);
}
.article-tags {
    margin-top: 1rem;
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.article-tag,
.locale-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 1.9rem;
    padding: 0.42rem 0.72rem;
    border-radius: 999px;
    background: #eef3ff;
    color: #2b3a60;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.article-hero {
    margin-top: 2rem;
    overflow: hidden;
    border-radius: 1.6rem;
    border: 1px solid #e6edff;
    background: #f8faff;
}
.article-hero img {
    display: block;
    width: 100%;
    height: auto;
}
.blog-content {
    margin-top: 2rem;
    color: var(--text);
    line-height: 1.75;
    font-size: 1rem;
}
.blog-content br { display: block; content: ""; line-height: 1.15; }
.blog-content h1,
.blog-content h2,
.blog-content h3 {
    margin: 0.7rem 0 0.25rem;
    color: var(--title);
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.02em;
}
.blog-content h1 { font-size: clamp(1.7rem, 3.2vw, 2.4rem); }
.blog-content h2 { font-size: clamp(1.35rem, 2.3vw, 1.85rem); }
.blog-content h3 { font-size: clamp(1.15rem, 1.8vw, 1.45rem); }
.blog-content p { margin: 0.18rem 0; }
.blog-content :is(strong, b) { font-weight: 700; }
.blog-content :is(em, i) { font-style: italic; }
.blog-content sup { font-size: 0.72em; vertical-align: super; line-height: 0; }
.blog-content ul,
.blog-content ol { margin: 0.2rem 0; padding-left: 2.4rem; }
.blog-content li { margin: 0.02rem 0; padding-left: 0.08rem; }
.blog-content blockquote {
    margin: 0.5rem 0;
    padding-left: 0.8rem;
    border-left: 2px solid #c9d7fb;
    color: #43547a;
    font-style: italic;
}
.blog-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.6rem 0;
    font-size: 0.96rem;
}
.blog-content th,
.blog-content td {
    border: 1px solid #d7e2fb;
    padding: 0.45rem 0.55rem;
    text-align: left;
    vertical-align: top;
}
.blog-content th {
    background: #f3f7ff;
    color: #1c2d52;
    font-weight: 700;
}
.blog-content a { color: #1a56db; text-decoration: underline; text-underline-offset: 2px; }
.blog-content a:hover { color: #0e3bab; cursor: pointer; }

.site-footer {
    position: relative;
    background: var(--footer-bg);
    color: #f6f8ff;
    padding: 2.5rem 0 2rem;
}
.site-footer-line {
    height: 1px;
    width: 100%;
    margin-bottom: 1.8rem;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.06));
}
.footer-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr 1.2fr;
    gap: 1.5rem;
    align-items: end;
}
.footer-logo { height: 1.75rem; width: auto; }
.footer-motto,
.footer-meta,
.footer-nav { color: rgba(255, 255, 255, 0.64); }
.footer-nav {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.68rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}
.footer-link:hover { color: #ffffff; }
.footer-meta {
    text-align: right;
    font-size: 0.82rem;
    line-height: 1.7;
}

.locale-switcher {
    position: fixed;
    right: 16px;
    --locale-base-bottom: 16px;
    --locale-bottom: var(--locale-base-bottom);
    bottom: var(--locale-bottom);
    z-index: 60;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.55rem;
}
.locale-menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    opacity: 0;
    transform: translateY(0.5rem) scale(0.98);
    pointer-events: none;
    transition: opacity 150ms ease, transform 150ms ease;
}
.locale-switcher.is-open .locale-menu,
.locale-switcher:hover .locale-menu,
.locale-switcher:focus-within .locale-menu {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}
.locale-trigger,
.locale-option {
    width: 3rem;
    height: 3rem;
    border: 0;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(8, 12, 24, 0.92);
    color: #ffffff;
    box-shadow: 0 18px 34px rgba(3, 5, 12, 0.28);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: transform 150ms ease, background-color 150ms ease;
}
.locale-flag {
    display: inline-flex;
    width: 1.35rem;
    height: 1rem;
    overflow: hidden;
    border-radius: 0.2rem;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14);
    flex-shrink: 0;
}
.locale-current-flag {
    width: 1.5rem;
    height: 1.12rem;
}
.locale-flag.fi,
.locale-current-flag.fi {
    line-height: 1;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}
.locale-flag.fi::before,
.locale-current-flag.fi::before,
.locale-flag-half::before {
    content: "";
}
.locale-flag-split {
    position: relative;
    display: inline-flex;
}
.locale-flag-half {
    display: block;
    width: 50%;
    height: 100%;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}
.locale-flag-half.is-left {
    border-radius: 0.2rem 0 0 0.2rem;
}
.locale-flag-half.is-right {
    border-radius: 0 0.2rem 0.2rem 0;
}
.locale-trigger:hover,
.locale-option:hover {
    transform: translateY(-1px);
    background: rgba(16, 20, 34, 0.98);
}
.locale-trigger:focus-visible,
.locale-option:focus-visible,
.back-link:focus-visible {
    outline: 2px solid rgba(131, 165, 255, 0.42);
    outline-offset: 4px;
}

@media (max-width: 1024px) {
    .site-header-row {
        min-height: 0;
        flex-direction: column;
        align-items: flex-start;
    }
    .nav-pill {
        position: static;
        left: auto;
        top: auto;
        transform: none;
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }
    .media-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .footer-grid { grid-template-columns: 1fr; align-items: start; }
    .footer-meta { text-align: left; }
}

@media (max-width: 720px) {
    .page-section { padding: 1.5rem 0 5rem; }
    .media-panel,
    .article-card { padding: 1.1rem; border-radius: 1.5rem; }
    .media-grid { grid-template-columns: 1fr; }
    .media-panel-header h1,
    .article-header h1 { font-size: 2rem; }
    .article-subtitle { font-size: 1rem; }
    .digest-title { flex-direction: column; gap: 14px; }
    .digest-title img { width: 96px; height: 96px; }
}