* {
    box-sizing: border-box;
}
/* ======================
   SPECIAL FONTS
   ====================== */
@font-face {
    font-family: "druid";
    src: url("/fonts/LevelFourteenDruid.woff2") format("woff2"), url("/fonts/LevelFourteenDruid.woff") format("woff");
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "runes";
    src: url("/fonts/haraldrunic.woff2") format("woff2"), url("/fonts/haraldrunic.woff") format("woff");
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* ======================
   Body
   ====================== */
html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    font-family: "druid", Courier;
    background: #111; /* placeholder paper color */
    background-image: url("/meidambique/images/table-top.jpg");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    /*overflow: hidden; *//* absolutely no scrolling */
    overflow-x: auto;
    overflow-y: hidden;
}

/* Center the book */
body {
    display: flex;
    align-items: center;
    justify-content: center;
}

body.no-paper .book {
    background-image: none;
    background: transparent;
    box-shadow: none;
}

@media (orientation: portrait) {
    body {
        align-items: flex-start; /* stop vertical centering */
    }

    .book {
        height: 97vh;
        flex-shrink: 0; /* prevents weird compression */
    }
}

/* ======================
   Book spread container and pages
   ====================== */
.book {
    aspect-ratio: 16 / 10;
    height: 97vh;
    width: auto; /*max-width: 97vw;*/
    display: flex;
    background: #f6f1e6; /* placeholder paper color */
    background-image: url("/meidambique/images/paper-texture.jpg");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    box-shadow: 0 0 40px rgba(0,0,0,0.6);
}

/* Individual pages */
.page {
    width: 50%;
    height: 100%;
    padding: 2.5rem;
    overflow: hidden;
    /* visual separation */
    background: transparent;
    color: #4d0000;
}

.page.full-bleed {
    padding: 0;
    display: flex;
}

.page.full-bleed img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* or cover */
    box-shadow: inset 0 0 60px rgba(0,0,0,0.2);
}

.page-header-img {
    width: 100%;
    object-fit: cover;
    display: block;
    margin-bottom: 1.5rem;
}

.page-square-img {
    width: 100%;
    object-fit: cover;
    display: block;
    margin-bottom: 1.5rem;
}

.note {
    position: relative;
    display: inline-block;
    padding: 2rem;
    z-index: 0; /* creates stacking context */
}

.note::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: url("/meidambique/images/scrap-paper.png");
    background-size: 100% 100%;
    background-repeat: no-repeat;
    transform: rotate(-2deg);
    filter: drop-shadow(4px 6px 8px rgba(0,0,0,0.25));
    z-index: 0; /* NOT -1 */
}

/* Lift text above scrap */
.note > * {
    position: relative;
    z-index: 1;
}

/* ======================
   PAGE NAVIGATION
   ====================== */
.nav-group {
    position: absolute;
    top: 2rem;
    transform: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    z-index: 20;
}

.nav-group.left {
    left: 1.5rem;
}

.nav-group.right {
    right: 1.5rem;
}

.page-arrow {
    font-size: 2.5rem;
    color: #eee;
    text-decoration: none;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.icon-button {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #eee;
    text-decoration: none;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.icon-button svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
}

.toc-button {
    font-size: 2.2rem;
}

.icon-button:hover, .page-arrow:hover {
    text-shadow: 0 0 8px rgba(255,255,255,0.6);
    opacity: 1;
}


/* ======================
   TYPOGRAPHY
   ====================== */
.page h1 {
    text-align: center;
    font-size: 3rem;
}

.page h2 {
    text-align: center;
    font-size: 2rem;
}

.page h3 {
    text-align: left;
    font-size: 1.5rem;
}

.page p {
    line-height: 1.5;
}

.runes-text {
    font-family: "runes", serif;
    font-size: 0.8em; /* 90% of parent size */
}

/* ======================
   MAP STUFF
   ====================== */
svg {
    width: auto;
    height: auto;
    pointer-events: auto;
}

#map-container {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

#map {
    max-width: 100%;
    max-height: 100%;
    display: block;
    border: none;
}



/* ======================
   TABLE OF CONTENTS
   ====================== */
.toc ul {
    list-style: none;
    padding: 0;
    margin: 2rem 0;
}

.toc li {
    margin: 0.5rem 0;
}

.toc a {
    display: flex;
    align-items: baseline;
    text-decoration: none;
    transition: color 0.25s ease, text-shadow 0.25s ease, transform 0.15s ease;
    color: #4d0000;
}

.toc a:hover {
    color: #7a0000; /* slightly brighter red */
    text-shadow: 0 0 6px rgba(122, 0, 0, 0.6);
    transform: translateX(3px); /* subtle slide */
}

.toc a:visited {
    color: #4d0000;
}

/* Title */
.toc-title {
    white-space: nowrap;
}

.toc-alt-title {
    font-family: "runes", serif;
    white-space: nowrap;
}

/* Dots */
.toc-dots {
    flex: 1;
    border-bottom: 1px dotted #4d0000;
    margin: 0 0.5rem;
    transform: translateY(-0.3rem);
}

/* Placeholder symbol */
.toc-symbol {
    white-space: nowrap;
}

.toc-level-1 a {
    padding-left: 0;
    font-size: 1.2rem;
}

.toc-level-2 a {
    padding-left: 1.5rem;
    font-size: 1rem;
}

.toc-level-3 a {
    padding-left: 3rem;
    font-size: 0.9rem;
}

/* ======================
   WIP PAGE
   ====================== */
.wip-container {
    height: 100vh;
    width: 100vw;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wip-panel {
    position: relative;
    aspect-ratio: 16 / 10;
    height: 90vh;
    max-width: 95vw;
    box-shadow: 0 0 40px rgba(0,0,0,0.6);
}

.wip-panel img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Text overlay */
.wip-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #f6f1e6;
    background: rgba(0,0,0,0.35); /* subtle darkening */
}

/* Return button */
.return-button {
    margin-top: 1.5rem;
    padding: 0.6rem 1.2rem;
    font-family: "druid", Courier;
    font-size: 1rem;
    color: #f6f1e6;
    background: transparent;
    border: 1px solid #f6f1e6;
    cursor: pointer;
    transition: all 0.25s ease;
}

.return-button:hover {
    background: #f6f1e6;
    color: #4d0000;
    box-shadow: 0 0 10px rgba(255,255,255,0.5);
}
