/* ============================================================
   Design System – stoldt.nu
   ============================================================ */

:root {
    --sidebar-width: 275px;
    --content-max-width: 720px;

    /* Sidebar palette */
    --sidebar-bg: #1a2e4a;
    --sidebar-border: rgba(255, 255, 255, 0.08);
    --sidebar-text: #94a3b8;
    --sidebar-text-strong: #f1f5f9;
    --sidebar-link-hover-bg: rgba(255, 255, 255, 0.07);
    --sidebar-link-active-bg: rgba(255, 255, 255, 0.13);
    --sidebar-link-active-indicator: #60a5fa;

    /* Content palette */
    --color-bg: #f8fafc;
    --color-surface: #ffffff;
    --color-text: #1e293b;
    --color-text-muted: #64748b;
    --color-heading: #0f172a;
    --color-border: #e2e8f0;
    --color-accent: #1d4ed8;
    --color-accent-hover: #1e40af;

    /* Cards */
    --card-bg: #fff;
    --card-border: #e2e8f0;
    --card-radius: 8px;
    --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);

    /* Typography */
    --font: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ============================================================
   Reset & Base
   ============================================================ */

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.65;
    color: var(--color-text);
    background-color: var(--color-bg);
    margin: 0;
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--color-heading);
    line-height: 1.3;
    margin-top: 0;
    margin-bottom: 0.4em;
    font-weight: 600;
}

h1 {
    font-size: 1.7rem;
    border-bottom: 2px solid var(--color-border);
    padding-bottom: 0.35em;
    margin-bottom: 1.1rem;
    margin-top: 0;
}

h2 {
    font-size: 1.25rem;
    margin-top: 2.25rem;
    margin-bottom: 0.8rem;
    padding-bottom: 0.25em;
    border-bottom: 1px solid var(--color-border);
}

h3 {
    font-size: 1.05rem;
    margin-top: 1.5rem;
}

h4 {
    font-size: 0.95rem;
}

p {
    margin-top: 0;
    margin-bottom: 1em;
}

a {
    color: var(--color-accent);
    text-decoration: none;
}

a:hover {
    color: var(--color-accent-hover);
    text-decoration: underline;
}

ul, ol {
    padding-left: 1.5em;
}

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

/* ============================================================
   Layout
   ============================================================ */

.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    min-height: 100dvh;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1.25rem 2rem;
    gap: 0.25rem;
}

.main {
    margin-left: var(--sidebar-width);
    background-color: var(--color-surface);
    min-height: 100vh;
}

turbo-frame {
    display: block;
}

.content-wrapper {
    max-width: var(--content-max-width);
    padding: 2.25rem 2.5rem 4rem;
}

/* ============================================================
   Sidebar – Profile block
   ============================================================ */

.sidebar-profile {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--sidebar-border);
    margin-bottom: 0.25rem;
}

.sidebar-profile__photo {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 0.85rem;
    border: 3px solid rgba(255, 255, 255, 0.15);
}

.sidebar-profile__name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--sidebar-text-strong);
    margin: 0 0 0.2em;
    border: none;
    padding: 0;
}

.sidebar-profile__role {
    font-size: 0.72rem;
    color: var(--sidebar-text);
    margin: 0 0 0.6em;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    font-weight: 600;
}

.sidebar-profile__affiliation {
    font-size: 0.78rem;
    color: var(--sidebar-text);
    margin: 0;
    line-height: 1.7;
}

.sidebar-profile__affiliation a {
    color: #93c5fd;
    text-decoration: none;
}

.sidebar-profile__affiliation a:hover {
    color: #bfdbfe;
    text-decoration: underline;
}

/* ============================================================
   Sidebar – Navigation
   ============================================================ */

.sidebar-nav {
    flex: 1;
}

.sidebar-nav__links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-nav__link {
    display: flex;
    align-items: center;
    gap: 0.7em;
    padding: 0.6em 0.8em;
    border-radius: 6px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    transition: background-color 0.15s, color 0.15s;
    border-left: 3px solid transparent;
}

.sidebar-nav__link i {
    width: 1.1em;
    text-align: center;
    font-size: 0.9em;
    flex-shrink: 0;
}

.sidebar-nav__link:hover {
    background-color: var(--sidebar-link-hover-bg);
    color: var(--sidebar-text-strong);
    text-decoration: none;
}

.sidebar-nav__link--active,
.sidebar-nav__links-selected > .sidebar-nav__link {
    background-color: var(--sidebar-link-active-bg);
    color: var(--sidebar-text-strong);
    border-left-color: var(--sidebar-link-active-indicator);
}

/* ============================================================
   Sidebar – Social links
   ============================================================ */

.sidebar-links {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    justify-content: center;
    padding-top: 1rem;
    border-top: 1px solid var(--sidebar-border);
    margin-top: auto;
}

.sidebar-links__item {
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    padding: 0.3em 0.65em;
    border-radius: 9999px;
    background-color: rgba(255, 255, 255, 0.06);
    color: var(--sidebar-text);
    font-size: 0.75rem;
    text-decoration: none;
    transition: background-color 0.15s, color 0.15s;
    border: 1px solid rgba(255, 255, 255, 0.09);
    white-space: nowrap;
}

.sidebar-links__item:hover {
    background-color: rgba(255, 255, 255, 0.13);
    color: var(--sidebar-text-strong);
    text-decoration: none;
}

/* ============================================================
   Cards
   ============================================================ */

.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    padding: 0.9rem 1.1rem;
    margin-bottom: 0.65rem;
}

.card__header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.4rem;
}

.card__year {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--color-text-muted);
    white-space: nowrap;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    padding: 0.15em 0.55em;
    border-radius: 9999px;
    flex-shrink: 0;
}

.card__title {
    font-size: 0.93rem;
    font-weight: 600;
    color: var(--color-heading);
    margin: 0;
    line-height: 1.4;
}

/* Generic muted info line beneath the title */
.card__meta {
    font-size: 0.83rem;
    color: var(--color-text-muted);
    margin-bottom: 0.35rem;
}

/* Italic variant for venue / conference lines */
.card__meta--venue {
    font-style: italic;
}

/* Flex variant when the meta row contains inline badges */
.card__meta--inline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.25rem;
}

/* Authors line (publications) */
.card__authors {
    font-size: 0.83rem;
    color: var(--color-text-muted);
    margin-bottom: 0.3rem;
}

/* Button row */
.card__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.6rem;
}

/* Expandable abstract (publications) */
.card__abstract {
    margin-top: 0.75rem;
    border-top: 1px solid var(--color-border);
    padding-top: 0.6rem;
}

.card__abstract summary {
    cursor: pointer;
    color: var(--color-accent);
    font-weight: 500;
    font-size: 0.83rem;
    user-select: none;
}

.card__abstract summary:hover {
    color: var(--color-accent-hover);
}

.card__abstract p {
    font-size: 0.875rem;
    margin-top: 0.6em;
    margin-bottom: 0;
    color: var(--color-text);
    line-height: 1.7;
}

/* Keyword chips row (publications) */
.card__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.6rem;
}

/* Course/supervision task description (teaching) */
.card__task {
    font-size: 0.875rem;
    color: var(--color-text);
    margin-top: 0.2rem;
}

/* Thesis link (supervised students) */
.card__thesis {
    font-size: 0.84rem;
    margin-top: 0.4rem;
}

/* Long-form description (community / OSS) */
.card__description {
    font-size: 0.875rem;
    color: var(--color-text);
    margin-top: 0.3rem;
}

.card__description p {
    margin-bottom: 0.5em;
}

.card__description p:last-child {
    margin-bottom: 0;
}

/* ============================================================
   Action buttons & tag chips
   ============================================================ */

.action-button {
    display: inline-flex;
    align-items: center;
    gap: 0.35em;
    padding: 0.28em 0.7em;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--color-accent);
    background-color: rgba(29, 78, 216, 0.07);
    border: 1px solid rgba(29, 78, 216, 0.2);
    border-radius: 9999px;
    text-decoration: none;
    transition: background-color 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.action-button:hover {
    background-color: rgba(29, 78, 216, 0.14);
    border-color: rgba(29, 78, 216, 0.4);
    color: var(--color-accent-hover);
    text-decoration: none;
}

.tag-chip {
    display: inline-block;
    padding: 0.18em 0.6em;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--color-text-muted);
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 9999px;
}

.badge {
    display: inline-block;
    padding: 0.15em 0.5em;
    font-size: 0.72rem;
    font-weight: 600;
    border-radius: 4px;
}

.badge--credits,
.badge--role {
    background-color: #dbeafe;
    color: #1e40af;
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 700px) {
    .sidebar {
        width: 100%;
        height: auto;
        min-height: unset;
        position: static;
        flex-direction: column;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.75rem;
        padding: 1rem 1.25rem;
    }

    .main {
        margin-left: 0;
    }

    .sidebar-profile {
        flex-direction: row;
        text-align: left;
        border-bottom: none;
        padding-bottom: 0;
        margin-bottom: 0;
        gap: 0.75rem;
        flex: 1;
        min-width: 200px;
    }

    .sidebar-profile__photo {
        width: 75px;
        height: 75px;
        margin-bottom: 0;
        flex-shrink: 0;
    }

    .sidebar-nav {
        flex: 0 0 100%;
        order: 3;
    }

    .sidebar-nav__links {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .sidebar-links {
        border-top: none;
        padding-top: 0;
        margin-top: 0;
    }

    .content-wrapper {
        padding: 1.5rem 1.25rem 3rem;
    }
}
