/* ==========================================================
   Kymograph
   Main stylesheet
   ========================================================== */


/* ==========================================================
   ROOT VARIABLES
   ========================================================== */

:root {
    --sidebar-width: 240px;
    --site-max-width: 1360px;

    /* Backgrounds */
    --bg-page: #202124;
    --bg-hover: #303236;
    --bg-active: #35383c;
    --bg-card: #26272a;
    --bg-card-hover: #2c2d30;

    /* Text */
    --color-text-primary: #ececec;   /* headings, entry titles */
    --color-text-body: #d2d2d2;      /* paragraph text */
    --color-text-subtitle: #aaaaaa;  /* site subtitle */
    --color-text-secondary: #cfcfcf; /* menu items, about links */
    --color-text-muted: #a8a8a8;     /* menu icons, captions, descriptions, separators */
    --color-white: #ffffff;

    /* Accent */
    --color-accent-gold: #b08d57;
}


/* ==========================================================
   RESET / GENERAL
   ========================================================== */

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

html,
body {
    height: 100%;
    margin: 0;
}

body {
    background: var(--bg-page);
    color: var(--color-text-primary);
    font-family: "Source Sans 3", sans-serif;
    font-weight: 400;
}

a {
    color: inherit;
}

.page {
    height: 100vh;
    display: flex;
    flex-direction: column;
}


/* ==========================================================
   HEADER
   ========================================================== */

.site-header {
    display: flex;
    align-items: center;
    gap: 24px;
    max-width: var(--site-max-width);
    margin: 0 auto;
    width: 100%;
    padding: 20px 40px;
    flex-shrink: 0;
}

.logo {
    width: 110px;
    border: 2px solid var(--color-accent-gold);
    border-radius: 50%;
    flex-shrink: 0;
}

.site-title {
    flex: 1;
    min-width: 0;
}

.site-title h1 {
    margin: 0;
    font-size: 2.8rem;
    font-weight: 600;
    letter-spacing: 1px;
}

.site-title p {
    margin: 4px 0 0;
    font-size: 1.05rem;
    color: var(--color-text-subtitle);
}


/* ==========================================================
   KYMOGRAPH TRACE
   ========================================================== */

.trace {
    width: 100%;
    flex-shrink: 0;
}

.trace img {
    display: block;
    width: 90%;
    margin: auto;
}


/* ==========================================================
   LANGUAGE SELECTOR
   ========================================================== */

.language {
    font-size: 1rem;
    letter-spacing: .05em;
    white-space: nowrap;
    flex-shrink: 0;
}

.language a {
    color: var(--color-text-muted);
    text-decoration: none;
    transition: color .2s;
}

.language a:hover {
    color: var(--color-white);
}

.active-language {
    color: var(--color-accent-gold);
    font-weight: 700;
}

.separator {
    color: var(--color-text-muted);
    margin: 0 .35rem;
}

.lang-unavailable {
    color: var(--color-text-muted);
    opacity: 0.5;
    cursor: not-allowed;
}


/* ==========================================================
   MAIN LAYOUT
   ========================================================== */

.main-layout {
    flex: 1;
    display: flex;
    overflow: hidden;
    max-width: var(--site-max-width);
    margin: 0 auto;
    width: 100%;
}


/* ==========================================================
   SIDEBAR
   ========================================================== */

.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    padding: 30px;
    overflow-y: auto;
}

.menu-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    margin-bottom: 4px;

    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: 1.05rem;

    border-radius: 7px;
    overflow: hidden;

    transition:
        background .2s,
        color .2s;
}

.menu-icon {
    font-size: 1.1rem;
    color: var(--color-text-muted);
    flex-shrink: 0;
    transition: color .2s;
}

.menu-item::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--color-accent-gold);
    transform: scaleY(0);
    transform-origin: center;
    transition: transform .25s ease;
}

.menu-item:hover {
    color: var(--color-white);
    background: var(--bg-hover);
}

.menu-item.active {
    color: var(--color-white);
    background: var(--bg-active);
}

.menu-item:hover .menu-icon,
.menu-item.active .menu-icon {
    color: var(--color-accent-gold);
}

.menu-item:hover::before,
.menu-item.active::before {
    transform: scaleY(1);
}

.nav-label {
    display: block;
    font-size: 0.85rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin: 0 0 14px 15px;
}


/* ==========================================================
   CONTENT
   ========================================================== */

.content {
    flex: 1;
    overflow-y: auto;
    padding: 25px 24px 40px 60px;

    /* Base typography */
    font-size: 1.2rem;
    line-height: 1.8;
    color: var(--color-text-body);
}

.content > p,
.content > h2,
.content > h3,
.content > h4,
.content > ul,
.content > ol,
.content > blockquote {
    max-width: min(95%, 1080px);
}

.content h2 {
    margin-bottom: 1.8rem;
    font-size: 2.5rem;
    font-weight: 600;
}

.content h3 {
    margin-top: 2rem;
    margin-bottom: 0.8rem;
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--color-text-primary);
}

.content h4 {
    margin-top: 2rem;
    margin-bottom: 0.8rem;
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--color-text-primary);
}

.content p {
    margin-bottom: 1rem;
}


/* ==========================================================
   COMPONENT — ABOUT
   ========================================================== */

.about {
    display: flex;
    align-items: flex-start;
    gap: 40px;
}

.profile-photo {
    width: 200px;
    border-radius: 20%;
    border: 2px solid var(--color-accent-gold);
    flex-shrink: 0;
}

.about-text {
    max-width: 1000px;
}

.about-text > *:first-child {
    margin-top: 0;
}

.about-signature {
    font-weight: 700;
    margin-top: 1.2rem;
    margin-bottom: 0.3rem;
}

.about-links {
    margin-top: 0;
    margin-bottom: 0;
}

.about-links a {
    color: var(--color-text-secondary);
    text-decoration: none;
    transition: color .2s;
}

.about-links a:hover {
    color: var(--color-accent-gold);
}

.about-links .dot {
    color: var(--color-text-muted);
    margin: 0 .4rem;
}


/* ==========================================================
   COMPONENT — ENTRY LIST
   (reusable for research/teaching/blog index pages)
   ========================================================== */

.entry-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 1.5rem 0;
}

.entry-card {
    display: block;
    text-decoration: none;
    padding: 16px 18px;
    border-radius: 8px;
    background: var(--bg-card);
    border-left: 3px solid var(--color-accent-gold);
    transition: background .2s;
}

.entry-card:hover {
    background: var(--bg-card-hover);
}

.entry-card-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
}

.entry-card-title {
    color: var(--color-text-primary);
    font-size: 1.05rem;
    font-weight: 500;
}

.entry-card-tag {
    color: var(--color-accent-gold);
    font-size: 0.75rem;
    letter-spacing: .05em;
    text-transform: uppercase;
    white-space: nowrap;
    flex-shrink: 0;
}

.entry-card-tag--muted {
    color: var(--color-text-muted);
}

.entry-card-desc {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    margin: 6px 0 0;
    line-height: 1.5;
}


/* ==========================================================
   COMPONENT — FLOATED IMAGE
   (text wraps around it — homepage, articles, etc.)
   ========================================================== */

.float-photo {
    float: right;
    width: 340px;
    margin: 4px 0 20px 32px;
    border-radius: 12px;
    border: 2px solid var(--color-accent-gold);
}

.float-photo-caption {
    float: right;
    clear: right;
    width: 340px;
    margin: -14px 0 24px 32px;
    font-size: 0.85rem;
    color: var(--color-text-muted);
    text-align: right;
}


/* ==========================================================
   TABLES
   ========================================================== */

td {
    vertical-align: top;
}


/* ==========================================================
   RESPONSIVE
   ========================================================== */

/* Tablets and small laptops */
@media (max-width: 991.98px) {

    :root {
        --sidebar-width: 200px;
    }

    .sidebar {
        padding: 20px;
    }

    .content {
        padding-left: 40px;
    }
}

/* Phones */
@media (max-width: 767.98px) {

    .page {
        height: auto;
        min-height: 100vh;
    }

    .main-layout {
        flex-direction: column;
        overflow: visible;
    }

    .site-header {
        flex-wrap: wrap;
        gap: 15px;
        padding: 20px;
    }

    .logo {
        width: 90px;
    }

    .site-title h1 {
        font-size: 2.2rem;
    }

    .site-title p {
        font-size: 1rem;
    }

    .language {
        order: 3;
        width: 100%;
        text-align: left;
    }

    .sidebar {
        width: 100%;
        overflow-y: visible;
        padding: 15px 20px;
    }

    nav {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }

    .menu-item {
        margin-bottom: 0;
        padding: 8px 12px;
    }

    .menu-item::before {
        left: 0;
        right: 0;
        top: auto;
        bottom: 0;
        width: auto;
        height: 3px;
        transform: scaleX(0);
    }

    .menu-item:hover::before,
    .menu-item.active::before {
        transform: scaleX(1);
    }

    .content {
        height: auto;
        overflow-y: visible;
        padding: 20px;
        max-width: 100%;
    }

    .content h2 {
        font-size: 1.8rem;
    }

    .content p {
        font-size: 1.05rem;
    }

    .float-photo,
    .float-photo-caption {
        float: none;
        width: 100%;
        margin: 0 0 16px 0;
        text-align: left;
    }
}