@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;600&display=swap');

:root {
    --width: 680px;
    --font-main: 'Roboto', system-ui, sans-serif;
    --font-scale: 16px;
    --background-color: #f2f2f2;
    --heading-color: #111111;
    --text-color: #1e1e1e;
    --link-color: #111111;
    --visited-color: #666666;
    --border-color: #e5e5e5;
}

@media (prefers-color-scheme: dark) {
    :root {
        --background-color: #0f1417;
        --heading-color: #f2f2f2;
        --text-color: #d0d0d0;
        --link-color: #f2f2f2;
        --visited-color: #a0a0a0;
        --border-color: #2a2f33;
    }
}

[data-theme="dark"] {
    --background-color: #0f1417;
    --heading-color: #f2f2f2;
    --text-color: #d0d0d0;
    --link-color: #f2f2f2;
    --visited-color: #a0a0a0;
    --border-color: #2a2f33;
}

[data-theme="light"] {
    --background-color: #f2f2f2;
    --heading-color: #111111;
    --text-color: #1e1e1e;
    --link-color: #111111;
    --visited-color: #666666;
    --border-color: #e5e5e5;
}

* { box-sizing: border-box; }

html {
    font-family: var(--font-main);
    background-color: var(--background-color);
    color: var(--text-color);
    font-size: var(--font-scale);
}

body {
    margin: 3.5rem auto;
    padding: 0 1.25rem;
    max-width: var(--width);
    line-height: 1.4375;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--link-color);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

a:hover { opacity: 0.75; }

/* ---- Profile ---- */
.profile {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    margin-bottom: 28px;
}

.photo {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.profile-info { flex: 1; }

.site-title {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    color: var(--heading-color);
}

.site-title h1 {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: 0 0 6px;
    display: inline;
}

.bio {
    font-size: 0.88rem;
    color: var(--text-color);
    line-height: 1.4375;
    margin-bottom: 12px;
}

.bio p { margin: 0; }

.bio a {
    color: var(--link-color);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* ---- Icons ---- */
.icons {
    display: flex;
    gap: 8px;
}

.icon-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 2px solid var(--visited-color);
    border-radius: 5px;
    color: var(--visited-color);
    text-decoration: none;
    transition: border-color 0.15s, color 0.15s;
}

.icon-link:hover {
    border-color: var(--heading-color);
    color: var(--heading-color);
    opacity: 1;
}

.icon-link svg {
    width: 18px;
    height: 18px;
}

/* ---- Tabs ---- */
.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    border-bottom: 1px solid var(--border-color);
}

.tab {
    font-size: 0.78rem;
    color: var(--visited-color);
    padding: 7px 14px 9px;
    cursor: pointer;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    background: none;
    font-family: var(--font-main);
    transition: color 0.15s;
    line-height: 1;
}

.tab:hover { color: var(--heading-color); }

.tab.active-appunti {
    color: var(--heading-color);
    border-bottom-color: var(--heading-color);
    font-weight: 600;
    background: #ffffff;
    border-top: 0.5px solid var(--border-color);
    border-left: 0.5px solid var(--border-color);
    border-right: 0.5px solid var(--border-color);
    border-radius: 4px 4px 0 0;
}

@media (prefers-color-scheme: dark) {
    .tab.active-appunti { background: #1a1f23; }
}

.tab.active-cat {
    color: var(--heading-color);
    border-bottom-color: var(--heading-color);
    font-weight: 500;
}

/* ---- Tab content ---- */
.tab-content {
    padding: 16px 0 0;
    min-height: 60px;
}

.tab-content.white-bg {
    background: #ffffff;
    border: 0.5px solid var(--border-color);
    border-top: none;
    padding: 16px;
    border-radius: 0 0 4px 4px;
}

@media (prefers-color-scheme: dark) {
    .tab-content.white-bg { background: #1a1f23; }
}

/* ---- Post list ---- */
.posts {
    list-style: none;
    padding: 0;
    margin: 0;
}

.post-item {
    display: flex;
    gap: 1rem;
    align-items: baseline;
    padding: 9px 0;
    border-bottom: 0.5px solid var(--border-color);
}

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

.post-date {
    font-size: 0.78rem;
    color: var(--visited-color);
    flex-shrink: 0;
    width: 72px;
}

.post-link {
    font-size: 0.88rem;
    color: var(--link-color);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
    line-height: 1.5;
    flex: 1;
}

.empty {
    font-size: 0.88rem;
    color: var(--visited-color);
    font-style: italic;
    padding: 8px 0;
}

/* ---- Single post ---- */
.post-header { margin-bottom: 2rem; }

.post-header h1 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    margin-top: 2rem;
    color: var(--heading-color);
    line-height: 1.35;
    letter-spacing: -0.01em;
}

.post-date-full {
    font-size: 0.9rem;
    color: var(--visited-color);
}

.post-body p { margin: 1.25rem 0; }

.post-body ul, .post-body ol {
    padding-left: 1.5rem;
    margin: 1.25rem 0;
}

.post-body li { margin-bottom: 0.3rem; }

.post-body blockquote {
    margin: 2rem 0;
    padding-left: 1.25rem;
    border-left: 2px solid var(--border-color);
    color: var(--visited-color);
    font-style: italic;
}

.post-tags {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.tag-filter { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.tag {
    font-size: 0.78rem;
    color: var(--visited-color);
    border: 0.5px solid var(--border-color);
    border-radius: 3px;
    padding: 0.15em 0.6em;
    text-decoration: none;
    font-family: var(--font-main);
}

.tag:hover { color: var(--heading-color); border-color: var(--heading-color); opacity: 1; }

.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 2rem;
    font-size: 0.85rem;
    color: var(--visited-color);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-family: var(--font-main);
    text-decoration: none;
    transition: color 0.15s;
}

.share-btn:hover { color: var(--heading-color); }

.back-link {
    margin-top: 1.5rem;
    display: block;
    font-size: 0.85rem;
    color: var(--visited-color);
    text-decoration: none;
    font-style: italic;
}

.back-link:hover { text-decoration: underline; color: var(--link-color); }

hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 1.5rem 0;
}

/* ---- Footer ---- */
footer {
    margin-top: 3rem;
    padding: 1.5rem 0;
    font-size: 0.875rem;
    color: var(--visited-color);
    border-top: 1px solid var(--border-color);
}

footer nav {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.4rem;
    align-items: center;
}

footer nav a { color: var(--visited-color); text-decoration: none; }
footer nav a:hover { text-decoration: underline; }

/* ---- Responsive ---- */
@media (max-width: 520px) {
    .profile { flex-direction: column; align-items: center; text-align: center; }
    .icons { justify-content: center; }
    .tabs { overflow-x: auto; flex-wrap: nowrap; }
    .tab { white-space: nowrap; }
    .post-item { flex-direction: column; gap: 0.1rem; }
    .post-date { width: auto; }
}
