/* Typography: Stempel Garamond and SbstnFIN */
@font-face {
    font-family: "Stempel Garamond";
    src: url("StempelGaramondLTPro-Roman.otf") format("opentype");
    font-weight: normal;
    font-style: normal;
    font-display: block;
}

@font-face {
    font-family: "Stempel Garamond";
    src: url("StempelGaramondLTPro-Bold.otf") format("opentype");
    font-weight: bold;
    font-style: normal;
    font-display: block;
}

@font-face {
    font-family: "Stempel Garamond";
    src: url("StempelGaramondLTPro-Italic.otf") format("opentype");
    font-weight: normal;
    font-style: italic;
    font-display: block;
}

@font-face {
    font-family: "Stempel Garamond";
    src: url("StempelGaramondLTPro-Boldlt.otf") format("opentype");
    font-weight: bold;
    font-style: italic;
    font-display: block;
}

@font-face {
    font-family: "SbstnFIN";
    src: url("SbstnFIN.otf") format("opentype");
    font-weight: normal;
    font-style: normal;
    font-display: block;
}

/* Base document */

html {
    overflow-y: scroll;
    scrollbar-gutter: stable;
}

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

body {
    font-family: "Stempel Garamond", Garamond, "Times New Roman", serif;
    color: #0e0e0e;
    line-height: 1.6;
    background-color: #fff;
    min-height: 100vh;
    display: flex;
    flex-direction: column;

    font-feature-settings: "liga" 1, "clig" 1, "onum" 1;
    font-variant-numeric: oldstyle-nums proportional-nums;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* Layout */

.page-wrapper {
    flex: 1;
    padding: 1.5rem 1.5rem 0;
}

.layout {
    display: flex;
    justify-content: center;
    width: 100%;
}

.content-row {
    position: relative;
    width: fit-content;
    margin-top: 6.0rem;
}

/* Header / Site name */

.header {
    position: absolute;
    top: -6.0rem;
    left: 0;
}

.header h1 {
    font-size: 2.75rem;
    font-weight: 400;
    font-style: italic;
    letter-spacing: -0.03em;
    white-space: nowrap;
    cursor: pointer;
    transition: color 0.2s ease;
}

.header h1 a {
    color: inherit;
    text-decoration: none;
}

.header h1:hover {
    color: #555;
}

/* Navigation (desktop) */

.nav-col {
    position: absolute;
    left: -150px;
    top: 0;
    width: 120px;
}

.nav-col ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-col > ul > li {
    margin-bottom: 0.25rem;
    font-size: 1.35rem;
}

.nav-col a {
    text-decoration: none;
    color: #0e0e0e;
    transition: color 0.2s ease;
}

/* No bold/active state */
.nav-col a:hover {
    color: #555;
}

/* Submenu (desktop) */

.submenu {
    list-style: none;
    margin-top: 0.9rem;
    margin-left: 0;
    padding-left: 0;
    padding-bottom: 1.1rem;
}

.submenu li {
    font-size: 1.1rem;
    margin-bottom: 0.2rem;
    margin-top: 0.17rem;
}

.submenu li:first-child {
    margin-top: 0.17rem;
}

.submenu li a {
    display: inline-block;
    padding-left: 1.3rem;
}

/* Sections */

.section-page {
    width: 600px;
}

.section-title {
    font-size: 2rem;
    font-weight: 400;
    letter-spacing: -0.03em;
    line-height: 1;
    margin-bottom: 2rem;
}

.section-text {
    font-size: 1.2rem;
    line-height: 1.5;
    text-align: justify;
}

#contactPage .section-text {
    text-align: left;
}

/* Images */

.section-image {
    display: block;
    width: auto;
    max-width: 600px;
    height: auto;
    border-radius: 4px;
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
}

#mainImageContainer .section-image {
    margin-top: 0;
}

/* Text helpers */

.abstract-label {
    font-variant: small-caps;
    font-weight: normal;
    font-size: 1.15em;
    display: block;
    margin-bottom: 0.15rem;
}

.small-caps-label {
    font-variant: small-caps;
    font-weight: normal;
    letter-spacing: 0.02em;
    font-size: 1.2em;
}

.indent {
    display: block;
    text-indent: 2em;
}

.sbstn-flat {
    font-family: "SbstnFIN";
    font-style: normal;
    font-weight: normal;
    display: inline;
    font-size: 1.152em;
    line-height: 1;
    vertical-align: baseline;
    position: relative;
    top: -0.142em;
}

/* Writing entries */

.writing-entry {
    margin-bottom: 1.2rem;
}

.writing-heading {
    cursor: pointer;
    transition: color 0.2s ease;
    font-size: 1.2rem;
    display: inline-block;
}

#writingPage .writing-heading,
#otherPage .writing-heading {
    white-space: nowrap;
}

.writing-heading:hover {
    color: #555;
}

.writing-entry.open .writing-heading {
    transform: translateY(0.5rem);
}

.writing-content {
    display: none;
    margin-top: 1.25rem;
    margin-bottom: 3.0rem;
    cursor: pointer;
    padding-left: 1.5rem;
}

/* Links */

a {
    color: #0e0e0e;
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: #555;
}

.external-link {
    color: #0B3D6E;
}

.external-link:hover {
    color: #082C50;
}

/* Footer */

.footer {
    text-align: center;
    padding: 6rem 0 2.5rem 0;
    font-size: 1.05rem;
    color: #434343;
}

/* Responsive tweaks: mobile layout */
@media screen and (max-width: 768px) {

    /* Layout: content full-width, header+nav as a fixed-height block */
    .layout {
        justify-content: flex-start;
    }

    .content-row {
        width: 100%;
        margin-top: 0;          /* reset the desktop offset */
        padding-top: 8.7rem;      /* fixed space reserved for header + nav */
        position: relative;
    }

    /* Header: sits at top inside content-row */
    .header {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        margin-bottom: 0;
    }

    .header h1 {
        white-space: normal;
        font-size: 2.2rem;
    }

    /* Navigation: directly under header, inside the same block */
   .nav-col {
    position: absolute;
    top: 3.0rem;
    left: 0;
    right: 0;
    width: 100%;
    margin-bottom: 0;
    padding-left: 0.25rem;   /* match section-page padding */
    padding-right: 0.25rem;  /* optional, for symmetry */
}

    .nav-col > ul {
        list-style: none;
        margin: 0;
        padding: 0.75rem 0 0 0;  /* some padding from the header */
        display: flex;
        flex-wrap: wrap;
        gap: 0.85rem;
    }

    .nav-col > ul > li {
        font-size: 1.2rem;
        margin-bottom: 0;
        position: relative;
    }

    .nav-col > ul > li > a {
        display: inline-block;
        padding-right: 0.25rem;
    }

    /* Submenu: inside nav, but total header+nav block height stays controlled */
    .submenu {
        list-style: none;
        margin: 0.25rem 0 0 0;
        padding: 0;
        display: flex;
        flex-direction: column;
        width: 100%;
    }

    .submenu li {
        font-size: 1.05rem;
        margin: 0.02rem 0;
        line-height: 1.3;
    }

    .submenu li a {
        display: inline-block;
        padding-left: 1.6rem;
        padding-right: 0.25rem;
    }

    /* Section: always starts after the reserved header+nav space */
    .section-page {
        width: 100%;
        padding-right: 0.25rem;
        padding-left: 0.25rem;
        padding-top: 0;
        margin-top: 0;          /* no extra margin; padding-top on content-row does the work */
    }

    .section-image {
        max-width: 100%;
        height: auto;
    }

    .page-wrapper {
        padding: 1.5rem 1rem 0;
    }

    .writing-heading {
        font-size: 1.1rem;
    }

    #writingPage .writing-heading,
    #otherPage .writing-heading {
        white-space: normal;
    }

    .writing-content {
        padding-left: 1.0rem;
        margin-bottom: 2.0rem;
    }

    .section-text {
        font-size: 1.1rem;
        line-height: 1.5;
        text-align: justify;
    }
}