* {
    font-family: "Ubuntu", sans-serif;
    border:0;
    padding:0;
    margin:0;
    scrollbar-width: thin;
    scrollbar-color: #7040d0 #05010e;
}

/* Scrollbar - Webkit (Chrome, Edge, Safari) */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #05010e;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(to bottom, #c4a84a, #7040d0);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(to bottom, #e8d48a, #9060f0);
}

html {
    overflow-x: hidden;
}

body {
    margin: 0px;
    padding: 0px;
    font-family:  Geneva, sans-serif, verdana, arial;
    font-size: 12pt;
    background-color: #020107;       /* shown until the background (js/background.js) draws */
    text-align: center;
    color: #eee;
    /* all text inherits a strong dark edge + deep haze so it stands well clear of the moving sky */
    text-shadow: 0 0 2px #000, 0 0 4px #000, 0 0 10px rgba(0, 0, 0, 0.95), 0 0 22px rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Header, menu bar and footer: near-solid panels (80%) so they stand clear of the moving sky */
:root {
    --bar-bg: rgba(6, 2, 16, 0.6);
    --bar-edge: rgba(180, 140, 255, 0.22);
}

header {
    display: block;
    padding-top: 20px;
    background: var(--bar-bg);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
}


header > a {
    font-size: 48pt;
}

header > a, header > a:hover, header > a:visited, header > a:focus  {
    color: #fff;
    outline: 0;
    text-decoration: none;
}

nav {
    height: 62px;
    min-width: 310px;
    display: block;
    position: sticky;
    top: 0;
    z-index: 1;
    border-bottom: 1px solid var(--bar-edge);
    background: var(--bar-bg);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
}

.sticky-logo {    
    visibility: hidden;
    display: block;
    width: 62px;
    height: 62px;
    opacity: 0;
    position: absolute;
    z-index: 2;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sticky-logo.is-stuck {
    opacity: 1;
    visibility: visible;
}

nav > ul {
    display: flex;
    list-style-type: none;
    justify-content: space-around; /* or space-between */
    margin: 0;
    padding: 0;
    max-width: 60%;    
    margin-left: auto;
    margin-right: auto;
    padding-top: 20px;
    padding-bottom: 20px;
}

nav > ul > li {
    display: flex;
    align-items: center;
}

nav > ul > li > a {
    font-size: 15pt;
    color: #fff;
    text-transform: uppercase;    
    text-decoration: none;
    position: relative;
    font-weight: 300;
}

nav > ul > li > a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background-color: #fff;
    transition: width 0.3s ease;
}

nav > ul > li > a:hover::after {
    opacity: 1;
    width: 100%;
}

nav > ul > li > a.active::after {
    width: 100%;
}

nav > ul > li > a.active {
    font-weight: normal;
}

nav > ul > li > a.active:hover::after {
    width: 0%;     
}

footer {
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    padding-top: 50px;
    padding-bottom: 30px;
}

footer > p {
    font-size: 14pt;
    font-weight: 300;
    color: #ccc;
}

@media only screen and (max-width: 850px) {
    footer > p {
        font-size: 11pt;               /* the copyright line, smaller on narrower screens */
    }
}

footer a, footer a:hover, footer a:active {
    font-size: 10pt;
    color: #aaa;
    text-decoration: none;
    padding-left: 10px; padding-right: 10px;
}

/* The page body is transparent: the sky and forest behind it come from js/background.js */
.main {
    flex: 1;
    width: 100%;
    position: relative;
    display: flex;
    justify-content: center;
}

/* Before the background script has drawn (and without it at all), a very dark, still night - only a
   faint hint of violet - so the page doesn't flash a brighter sky before the animated one appears */
html:not(.has-bgfx) body {
    background: radial-gradient(ellipse at 50% 20%, #0b0419 0%, #060210 40%, #020107 75%) fixed;
}

.main > * {
    position: relative;
    z-index: 1;
}

.main-inner {
    width: calc(100% - 20px);
    max-width: max(830px, 70%);        /* wide screens use 70% of the page; smaller ones as before */
}

.main-inner a, .main-inner a:visited {
    color: #9060f0;
    text-decoration: none;
}

.main-inner a:hover, .main-inner a:active {
    color: #b080ff;
}

.byline {
    font-size: 72pt;
    height: 318px;                     /* with the divider below, the area under the menu is 328px */
    line-height: 318px;
    color: #fff;
    width: 100%;
    background: transparent;          /* the sky shows through - see js/background.js */
    cursor: default;
    user-select: none;
}

.byline h1 {
    font-size: 72pt;
    position: relative;
    top: 5px;                          /* centres the letters between the menu bar and the divider line */
    z-index: 4;
    text-shadow: 0px 0px 5px #000, 0px 0px 90px #fff;
    opacity: 0;
    animation: heroFadeIn 1.1s ease-out 0.5s forwards;
}

@keyframes heroFadeIn {
    from { opacity: 0; transform: translateY(10px); letter-spacing: 0.02em; }
    to   { opacity: 1; transform: translateY(0); letter-spacing: normal; }
}

/* The home hero: just a window onto the sky now (kept as a positioned, clipping box because the
   mobile Stix flies inside it) */
.mystical-bg {
    position: relative;
    overflow: hidden;
}

/* The hero fills the whole space between the menu bar and the "Latest Titles" divider, so the
   heading is centred in it: no extra padding between the hero and that divider. */
.mystical-bg + .main .main-inner { padding-top: 0; }
.mystical-bg + .main .home-latest { padding-top: 0; }
.mystical-bg + .main .home-latest > .section-divider:first-child { margin-top: 0; }

@media only screen and (max-width: 700px) {
    /* phones: about half the height (Stix still has room to perch above "You're") */
    .byline {
        height: 155px;
        line-height: 155px;
    }
}


/* =============================================
   SITE BACKGROUND - "Oakenheim at Night" under the "Glamour Veil" sky
   All of it lives in #bgfx, created by js/background.js, fixed behind the whole page.
   ============================================= */
#bgfx {
    position: fixed;
    inset: 0;
    z-index: -1;                       /* behind everything on the page */
    pointer-events: none;
    overflow: hidden;
    animation: bgfxIn 1.4s ease-out both;   /* fades up out of the dark page instead of popping in */
}
@keyframes bgfxIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
    #bgfx { animation-duration: 0.4s; }
}
#bgfx-veil, #bgfx-sky {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}
#bgfx-moon { position: absolute; }
#bgfx-forest {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 46vh;
    overflow: visible;                 /* tall crowns rise above the strip */
}
#bgfx-forest > * {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    will-change: transform;
}
#bgfx-forest canvas { display: block; }
.bgfx-mist {
    background-repeat: repeat-x;
    background-size: 2048px 100%;      /* tile exactly as wide as the animation's travel, so each loop joins seamlessly */
    animation: bgfxMist var(--bgfx-mist-speed, 140s) linear infinite;
    opacity: 0.29;                     /* the prototype's 0.4, dimmed 15% twice to suit the darker forest */
}
.bgfx-mist.bgfx-m1 { height: 40% !important; bottom: 34% !important; --bgfx-mist-speed: 190s; opacity: 0.145; }  /* back mist: half strength */
.bgfx-mist.bgfx-m2 { height: 46% !important; bottom: 4% !important; --bgfx-mist-speed: 120s; animation-direction: reverse; }
@keyframes bgfxMist {
    from { background-position-x: 0; }
    to   { background-position-x: -2048px; }
}
.bgfx-shafts {
    mix-blend-mode: screen;
    animation: bgfxShafts 11s ease-in-out infinite alternate;
    /* fade in from the top of the strip so the beams have no hard edge */
    -webkit-mask-image: linear-gradient(to bottom, transparent, #000 50%);
    mask-image: linear-gradient(to bottom, transparent, #000 50%);
}
@keyframes bgfxShafts {
    from { opacity: 0.47; }            /* 15% below the prototype, with the darker forest */
    to   { opacity: 0.85; }
}
@media (prefers-reduced-motion: reduce) {
    .bgfx-mist, .bgfx-shafts { animation: none; }
}



@media only screen and (max-width: 850px) {
    header {
        display: block;
        padding-top: 10px;
        padding-bottom: 10px;
    }        
    header > a {
        font-size: 24pt;
    }

    .sticky-logo {    
        width: 42px;
        height: 42px;
    }

    .sticky-logo > img {
        width: 42px;
        height: 42px;
    }

    nav {
        height: 42px;
    }

    .smallspan {
        display: none;
    }

    nav > ul {
        max-width: 100%;    
        padding-left: 42px;        
        padding-right: 42px;
        padding-top: 10px;
        padding-bottom: 10px;
    }

    nav > ul > li > a {
       font-size: 12pt;
    }

    .byline h1 {
       font-size: 56pt;
    }
}

/* =============================================
   SHARED PAGE HEADINGS
   ============================================= */
.main-inner {
    text-align: left;
    padding-top: 40px;
    padding-bottom: 60px;
}

.page-title {
    font-size: 32pt;
    font-weight: 300;
    color: #fff;
    margin-bottom: 6px;
}

.page-intro {
    color: #bba7e0;
    font-size: 13pt;
    margin-bottom: 30px;
    max-width: 700px;
}

.section-title {
    font-size: 22pt;
    font-weight: 300;
    color: #fff;
    margin-bottom: 16px;
}

.section-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 6px 0 30px 0;
    color: #8a6fc0;
    user-select: none;
}

.section-divider::before,
.section-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, transparent, #7040d0, transparent);
}

.section-divider span {
    font-size: 14pt;
    text-shadow: 0 0 10px rgba(180,120,255,0.7);
}

/* =============================================
   BOOKS PAGE
   ============================================= */
.series-block {
    margin-bottom: 50px;
}

.series-title {
    font-size: 22pt;
    font-weight: 400;
    color: #e8d48a;
    border-bottom: 1px solid #2a1a4a;
    padding-bottom: 10px;
    margin-bottom: 24px;
}

.series-count {
    font-size: 12pt;
    font-weight: 300;
    color: #8a6fc0;
}

.book-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;          /* rows are centred, so a series with fewer books doesn't sit on the left */
    gap: 30px;
}

.book-card {
    flex: 1 1 280px;
    max-width: 340px;
    display: flex;
    flex-direction: column;
    background: linear-gradient(#140a28, #0a0518);
    border: 1px solid #2a1a4a;
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.3s ease, transform 0.3s ease;
}

.book-card:hover {
    border-color: #7040d0;
}

@media only screen and (max-width: 700px) {
    .book-card { max-width: none; }   /* phones: one full-width card per row, as before */
}

.book-cover-link {
    display: block;
    position: relative;
    text-align: center;
    background: #05010e;
    padding: 16px 16px 0 16px;
}

.book-cover {
    max-width: 100%;
    height: clamp(260px, 17vw, 300px);   /* a little larger on wide screens */
    object-fit: contain;
    border-radius: 3px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.6);
    transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.book-cover-link:hover .book-cover {
    transform: translateY(-6px) scale(1.03);
    box-shadow: 0 16px 34px rgba(0,0,0,0.65), 0 0 26px rgba(112,64,208,0.55);
}

.book-number {
    display: block;
    font-size: 10pt;
    color: #8a6fc0;
    padding: 8px 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.book-info {
    padding: 18px 20px 22px 20px;
}

.book-info h3 {
    font-size: 16pt;
    font-weight: 400;
    color: #fff;
    margin-bottom: 6px;
}

.book-date {
    font-size: 10pt;
    color: #7a68a0;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.book-info p {
    font-size: 12.5pt;
    line-height: 1.6;
    color: #d8cdf0;
    margin-bottom: 12px;
}

.buy-link {
    display: inline-block;
    margin-top: 6px;
    font-size: 11.5pt;
    font-weight: 500;
    color: #e8d48a !important;
}

/* =============================================
   NEWS PAGE
   ============================================= */
.news-list {
    display: flex;
    flex-direction: column;
    gap: 34px;
}

.news-item {
    display: flex;
    gap: 26px;
    background: linear-gradient(#140a28, #0a0518);
    border: 1px solid #2a1a4a;
    border-radius: 8px;
    padding: 22px;
}

.news-cover-link {
    flex: 0 0 auto;
}

.news-cover {
    width: 130px;
    height: auto;
    border-radius: 3px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.6);
    transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.news-cover-link:hover .news-cover {
    transform: translateY(-5px) scale(1.04);
    box-shadow: 0 14px 30px rgba(0,0,0,0.65), 0 0 24px rgba(112,64,208,0.55);
}

.news-info h2 {
    font-size: 17pt;
    font-weight: 400;
    color: #fff;
    margin-bottom: 8px;
}

.news-series {
    font-size: 11pt;
    font-weight: 300;
    color: #8a6fc0;
}

.news-date {
    font-size: 10pt;
    color: #7a68a0;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 10px;
}

.news-info p {
    font-size: 12.5pt;
    line-height: 1.6;
    color: #d8cdf0;
    margin-bottom: 10px;
}

.news-more {
    margin-top: 36px;
    text-align: center;
}

/* =============================================
   ABOUT PAGE
   ============================================= */
.about-layout {
    display: flex;
    gap: 34px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.about-badge {
    width: 240px;
    height: 240px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.6);
    flex: 0 0 auto;
}

.about-text {
    flex: 1 1 380px;
}

.about-text p {
    font-size: 12.5pt;
    line-height: 1.7;
    color: #d8cdf0;
    margin-bottom: 16px;
}

.about-aside {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #2a1a4a;
    font-size: 12.5pt;
    line-height: 1.6;
    color: #ddd2f5;                    /* light lavender: still an aside, but readable over the sky */
    font-style: italic;
}

/* =============================================
   HOME - LATEST TITLES
   ============================================= */
.home-latest {
    padding: 50px 0 30px 0;
}

.home-book-row {
    display: flex;
    gap: clamp(24px, 2.2vw, 44px);
    flex-wrap: wrap;
    justify-content: center;
}

.home-book {
    display: block;
    width: clamp(160px, 12vw, 210px);       /* grows a little with the browser width */
    text-align: center;
    color: #d8cdf0 !important;
    text-decoration: none !important;
}

.home-book img {    
    height: clamp(220px, 17vw, 330px);
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 10px 24px rgba(0,0,0,0.6);
    margin-bottom: 10px;
    transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.home-book:hover img {
    transform: translateY(-6px) scale(1.04);
    box-shadow: 0 16px 32px rgba(0,0,0,0.65), 0 0 26px rgba(112,64,208,0.55);
}

.home-book span {
    font-size: 11pt;
    line-height: 1.4;
    display: block;
}

.home-more {
    margin-top: 34px;
    text-align: center;
}

/* a proper button, in the same violet as the contact form's Send (home page and Latest News) */
.home-more a,
.news-more a {
    display: inline-block;
    padding: 12px 30px;
    border-radius: 999px;
    background: linear-gradient(to bottom, #7040d0, #4a2590);
    border: 1px solid rgba(200, 170, 255, 0.45);
    color: #fff !important;
    font-size: 12pt;
    font-weight: 500;
    letter-spacing: 0.03em;
    text-decoration: none !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.55), 0 0 18px rgba(112, 64, 208, 0.45);
    transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}

.home-more a:hover,
.home-more a:focus-visible,
.news-more a:hover,
.news-more a:focus-visible {
    background: linear-gradient(to bottom, #9060f0, #6035b0);
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.6), 0 0 28px rgba(150, 100, 255, 0.7);
}

/* =============================================
   CONTACT PAGE
   ============================================= */
.contact-feedback {
    padding: 14px 18px;
    border-radius: 6px;
    margin-bottom: 24px;
    font-size: 12pt;
    max-width: 600px;
}

.contact-feedback.ok {
    background: rgba(80,200,120,0.12);
    border: 1px solid rgba(80,200,120,0.4);
    color: #a8e8bc;
}

.contact-feedback.error {
    background: rgba(200,80,80,0.12);
    border: 1px solid rgba(200,80,80,0.4);
    color: #e8a8a8;
}

.contact-form .formTable {
    width: 100%;
    max-width: 560px;
}

.contact-form th {
    text-align: right;
    vertical-align: top;
    padding: 10px 16px 10px 0;
    font-weight: 300;
    color: #bba7e0;
    white-space: nowrap;
}

.contact-form td {
    padding: 10px 0;
}

.contact-form input[type=text],
.contact-form input[type=email],
.contact-form textarea {
    width: 100%;
    background: #0a0518;
    border: 1px solid #3a2a5a !important;
    border-radius: 4px;
    color: #eee;
    padding: 8px 10px;
    font-size: 12pt;
    box-sizing: border-box;
}

.contact-form textarea {
    height: 110px;
    resize: vertical;
}

.contact-form input[type=submit] {
    background: linear-gradient(to bottom, #7040d0, #4a2590);
    color: #fff;
    padding: 10px 26px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12pt;
}

.contact-form input[type=submit]:hover {
    background: linear-gradient(to bottom, #9060f0, #6035b0);
}

/* =============================================
   STIX - FLYING DRAGON MASCOT
   ============================================= */
.stix-flight-outer {
    position: fixed;
    top: 0;
    left: 0;
    width: 240px;
    height: 120px;
    z-index: 500;
    pointer-events: none;
    transform-origin: top left;
    /* actual scale is set from JS (stixflight.js), scaled to the viewport
       so he doesn't end up tiny on large/high-res screens */
}

.stix-flight-inner {
    position: relative;   /* the 3D canvas extends above this box (room for raised wings) */
    width: 240px;
    height: 120px;
    transition: none;
    line-height: 0;   /* inside the hero he'd inherit its tall line-height, which pushes the video way down his box */
}

.stix-flight-inner video,
.stix-flight-inner canvas {
    display: block;
    /* a soft dark glow around his outline to lift him off the background (like the text) */
    filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.85)) drop-shadow(0 0 9px rgba(0, 0, 0, 0.55));
}

/* Mobile home-page mode: confined inside the hero banner (which already has
   position:relative + overflow:hidden) rather than fixed to the viewport. */
.stix-flight-outer.stix-hero-mode {
    position: absolute;
    z-index: 5;
}

/* Mobile inner pages: standing beside the page title, scrolling with it. */
.stix-flight-outer.stix-title-mode {
    position: absolute;
    z-index: 5;
}

/* Mobile inner pages: sitting on the moon - part of the sky, so behind the page content like the
   moon (#bgfx is also z-index -1; Stix comes later in the page, so he's drawn over the background) */
.stix-flight-outer.stix-moon-mode {
    position: fixed;
    z-index: -1;
}

@media only screen and (max-width: 850px) {
    .about-badge {
        width: 180px;
        height: 180px;
    }

    .news-item {
        flex-direction: column;
    }

    .news-cover {
        width: 110px;
    }
}

@media only screen and (max-width: 450px) {
     nav > ul > li > a {
       font-size: 10pt;
    }

    .byline h1 {
       font-size: 35pt;
    }

    .sticky-logo {    
        width: 32px;
        height: 32px;
    }

    .sticky-logo > img {
        width: 32px;
        height: 32px;
    }

    nav {
        height: 32px;
    }

     nav > ul {
        padding-left: 32px;        
    }
}

/* "You're Here" reveal (js/herotext.js): the real heading is transparent while a canvas plays the
   reveal behind it, then its colour and glow fade back in */
.byline h1.hero-magic,
.byline h1.hero-magic-done { animation: none; opacity: 1; }
.byline h1.hero-magic { color: transparent; text-shadow: 0 0 5px transparent, 0 0 90px transparent; }
.byline h1.hero-magic-done { transition: text-shadow 2.4s ease; }   /* letters at once (they sit exactly under the canvas's), glow fades in */
.hero-magic-canvas {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 3;
}

/* Read by search engines and screen readers, not shown (e.g. who "You're Here" is about) */
.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}
