@import url('https://fonts.googleapis.com/css2?family=Special+Gothic:wght@400&display=swap');

@font-face {
  font-family: 'Alagard';
  src: url('https://pearlnightslair.neocities.org/assets/alagard.ttf') format('truetype');
}
@font-face {
  font-family: 'Atkinson';
  src: url('https://pearlnightslair.neocities.org/assets/AtkinsonHyperlegible-Regular.ttf') format('truetype');
}
@font-face {
  font-family: 'Tandy';
  src: url('https://pearlnightslair.neocities.org/assets/PxPlus_Tandy1K-II_200L-2y.ttf') format('truetype');
}
@font-face {
  font-family: 'Birchleaf';
  src: url('https://pearlnightslair.neocities.org/assets/BirchLeaf.ttf') format('truetype');
}

/* ------ COLORS ------ */
:root {
    --headerfont:  'Alagard', serif;
    --buttonfont:  'Alagard', serif;
    --asciifont:   'Tandy', monospace;
    --dropcapfont: 'Birchleaf', serif;

    /* Dracula Classic */
    --color-bg:        #282A36;
    --color-line:      #6272A4;
    --color-selection: #44475A;
    --color-fg:        #F8F8F2;
    --color-comment:   #6272A4;
    --color-red:       #FF5555;
    --color-orange:    #FFB86C;
    --color-yellow:    #F1FA8C;
    --color-green:     #50FA7B;
    --color-cyan:      #8BE9FD;
    --color-purple:    #BD93F9;
    --color-pink:      #FF79C6;

    /* Layout */
    --header-bg:       none;
    --column-bg:       var(--color-bg);
    --column-image-bg: none;

    /* Text */
    --fg:              var(--color-fg);

    /* Links */
    --link:            var(--color-cyan);
    --linkhover:       var(--color-purple);

    /* Menu */
    --menubg:          var(--color-selection);
    --menucolor:       var(--color-fg);
    --menubghover:     var(--color-line);
    --menucolorhover:  var(--color-fg);

    /* Semantic */
    --text-sub:        var(--color-comment);
    --text-strike:     var(--color-red);
    --text-mark:       var(--color-yellow);
    --text-accent:     var(--color-pink);
    --text-positive:   var(--color-green);
    --text-warning:    var(--color-orange);
    --text-code:       var(--color-green);
    --text-quote:      var(--color-pink);
    --border-accent:   var(--color-purple);
    --border-subtle:   var(--color-selection);
}

@media (prefers-color-scheme: light) {
    :root {
        /* Alucard Classic */
        --color-bg:        #FFFBEB;
        --color-line:      #6C664B;
        --color-selection: #CFCFDE;
        --color-fg:        #1F1F1F;
        --color-comment:   #6C664B;
        --color-red:       #CB3A2A;
        --color-orange:    #A34D14;
        --color-yellow:    #846E15;
        --color-green:     #14710A;
        --color-cyan:      #036A96;
        --color-purple:    #644AC9;
        --color-pink:      #A3144D;

        --header-bg:       var(--color-bg);
    }
}

/* ------ RESET ------ */
* { margin: 0; padding: 0; }

/* ------ BODY ------ */
body {
    background: var(--column-bg);
    color: var(--color-fg);
    font-family: 'Special Gothic', Verdana, sans-serif;
    font-size: 1em;
    line-height: 1.5em;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Alagard', serif;
    word-spacing: 0.1em;
}

main :is(h1, h2, h3, h4, h5, h6) {
    text-align: center;
    padding: 0.5em;
    border-bottom: 1px dashed var(--border-subtle);
    border-top: 1px dashed var(--border-subtle);
}

/* ------ HEADER / FOOTER ------ */
header, footer {
    background: var(--header-bg);
    color: var(--color-fg);
    padding: 1em;
}

header {
    padding: 1em 1.5em 1.5em;
}

footer {
    text-align: center;
}

header h1 {
    font-size: 2.5em;
}

header h1 a:not(a:hover) {
    text-decoration: none;
}

/* ------ LINKS (global) ------ */
/* All interactive link contexts share the same rule */
a {
    color: var(--link);
}

a:hover, a:focus {
    color: var(--linkhover);
}

/* ------ HEADER NAV ------ */
header nav ul {
    list-style: none;
}

header nav ul li {
    display: inline-block;
    padding-right: 1em;
}

header nav ul li a {
    font-family: 'Alagard', serif;
    font-size: 1.2rem;
    text-decoration: underline;
    padding: 4px 6px;
}

header nav ul li a:hover,
header nav ul li a:focus {
    background: none;
    font-family: 'Birchleaf', serif;
}

/* ------ MAIN ------ */
body, main {
    margin: 0;
}

main {
    position: relative;
}

/* ------ COLUMNS ------ */
#left-column, #right-column {
    background: var(--column-bg);
    background-image: var(--column-image-bg);
    color: var(--color-fg);
    border: none;
    padding: 1em;
    min-width: calc(50% - 2em);
    flex-basis: 50%;
    flex-grow: 1;
}

article:not(article.single-column) {
    display: flex;
    flex-grow: 1;
}

article.single-column {
    max-width: 80ch;
    margin: 0 auto 0 15%;
    padding: 0.5em 3em;
    background: var(--column-bg);
    color: var(--color-fg);
}

/* ------ HR ------ */
hr {
    border: none;
    border-top: 1px dashed var(--border-subtle);
    margin: 1em 0;
}

/* ------ TEXT ------ */
main p {
    line-height: 1.5;
    margin: 10px 0;
}

main :is(#left-column, #right-column) :is(p, ul, ol, dl, details, summary) {
    max-width: 80ch;
    margin-left: auto;
    margin-right: auto;
}

/* ------ SEMANTIC TEXT ------ */
s, del        { color: var(--text-strike); }
sub, sup      { color: var(--text-sub); }
small         { color: var(--text-sub); }

mark {
    background: var(--text-mark);
    color: var(--color-bg);
    padding: 0 0.2em;
}

code, kbd, samp {
    font-family: var(--asciifont);
    color: var(--text-code);
    background: var(--color-selection);
    padding: 0.1em 0.35em;
    border-radius: 2px;
}

blockquote {
    color: var(--color-fg);
    border-left: 3px solid var(--color-pink);
    margin: 1em 0;
    padding: 0.5em 1em;
    font-style: italic;
}

abbr[title] {
    text-decoration: underline dotted var(--color-comment);
    cursor: help;
}

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

ul li::marker,
ol li::marker {
    color: var(--text-quote);
}

/* ------ TABLES ------ */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1em 0;
    font-family: 'Special Gothic', Verdana, sans-serif;
}

thead th {
    font-family: 'Alagard', serif;
    padding: 0.5em 0.75em;
    text-align: left;
    letter-spacing: 0.05em;
}

tbody td {
    padding: 0.5em 0.75em;
    vertical-align: top;
}

@media (max-width: 600px) {
    thead { display: none; }

    tr { display: block; margin-bottom: 8px; }

    td {
        display: block;
        border: none;
    }

    td:first-child {
        font-family: var(--headerfont);
        font-weight: normal;
    }
}

/* ------ IMG ------ */
img {
    max-width: calc(100% - 0.4em);
    margin: 0.2em auto;
    display: block;
}

/* ------ INPUTS ------ */
main input, main textarea, main select, main button {
    background: var(--color-selection);
    color: var(--color-fg);
    font-family: 'Special Gothic', Verdana, sans-serif;
    font-size: 1rem;
    border: 1px dashed var(--link);
    padding: 8px;
    margin: 2px;
}

main :is(input, textarea, select):focus {
    outline: none;
    border-color: var(--linkhover);
}

/* ------ COFFINS LIST ------ */
ul.coffins {
    list-style: none;
    padding-left: 0;
}

ul.coffins li {
    margin: 0.3em 0;
    line-height: 1.5;
}

ul.coffins li::before {
    content: "⚰ ";
    color: var(--link);
    margin-right: 0.5em;
}

/* ------ TOMBSTONE BUTTON ------ */
.tombstone {
    position: relative;
    background: none;
    font-size: 1.2rem;
    font-family: 'Alagard', serif;
    font-variant: small-caps;
    margin: 0.3rem auto;
    color: var(--link);
    padding: 0.7rem;
    text-align: center;
    display: block;
    cursor: pointer;
    border: 2px dashed var(--link);
    letter-spacing: 0.1em;
    width: auto;
}

.tombstone:hover {
    color: var(--linkhover);
    border-color: var(--linkhover);
    font-family: 'Birchleaf', serif;
}

.button-row {
    display: flex;
    gap: 0.5rem;
}

.button-row .tombstone {
    flex: 1;
    margin: 0;
}

/* ------ PAGE ROUTING ------ */
.page { display: none; width: 100%; }
.page:target { display: block; width: 100%; }
#home { display: block; width: 100%; }

@supports selector(:has(*)) {
    main:has(#all-prompts:target) #home { display: none; }
}

/* ------ DL ------ */
dl dt {
    font-size: 1.3em;
    letter-spacing: 0.05em;
}

dl dd {
    padding: 1em;
    padding-bottom: 1.3em;
}

/* ------ TOOLS SWITCHER ------ */
#tools-switcher {
    position: relative;
    float: right;
    margin-right: 0.5em;
}

#tools-menu {
    position: absolute;
    bottom: 100%;
    right: 0;
    margin-bottom: 0.3em;
    display: flex;
    flex-direction: column;
    gap: 0.3em;
    visibility: hidden;
    pointer-events: none;
}

#tools-switcher.open #tools-menu {
    visibility: visible;
    pointer-events: auto;
}

/* Shared style for tools toggle + menu buttons */
#tools-btn,
#tools-menu button {
    cursor: pointer;
    background: var(--color-bg);
    border: 1px dashed var(--link);
    color: var(--link);
    font-family: inherit;
    font-size: 1.5rem;
    padding: 4px 10px;
    letter-spacing: 0.05em;
    transition: color 0.2s, border-color 0.2s;
    user-select: none;
    white-space: nowrap;
}

#tools-btn:is(:hover, :focus),
#tools-menu button:hover {
    color: var(--linkhover);
    border-color: var(--linkhover);
}

#tools-btn {
    touch-action: manipulation;
}

/* ------ ASCII ART ------ */
.ascii-art-label pre {
    display: table;
    font-family: var(--asciifont);
    margin: 0 auto;
    text-align: left;
    line-height: 1.3;
    font-size: 16px;
    color: var(--text-sub);
}

/* ------ ACCESSIBILITY ------ */
body.readable-atkinson { font-family: 'Atkinson', sans-serif; }
html.larger-text { font-size: 120%; }

@media (max-width: 1024px) {
    #mobile-hide { display: none; }
}

/* ------ PORTRAIT (MOBILE) ------ */
@media only screen and (orientation: portrait) {
    header nav ul {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 4px;
    }

    header nav ul::-webkit-scrollbar { display: none; }
    header nav ul li { flex-shrink: 0; }

    article { flex-direction: column; }

    article.single-column {
        padding: 0.5em 1em;
        margin: 0 auto;
    }

    #swat-btn, #anim-toggle { display: none; }

    #tools-switcher {
        float: none;
        display: flex;
        padding-top: 1rem;
        justify-content: center;
        margin-right: 0;
    }

    #tools-menu {
        left: 50%;
        transform: translateX(-50%);
        right: auto;
    }
}

/* ------ LANDSCAPE (DESKTOP) ------ */
@media only screen and (orientation: landscape) {
    main {
        min-height: 100%;
        flex-grow: 1;
    }

    #left-column {
        overflow-y: auto;
        max-height: 77vh;
        position: sticky;
        top: 0;
    }

    #right-column {
        overflow-y: auto;
        max-height: 77vh;
        position: sticky;
        top: 0;
        transition: max-height 0.5s cubic-bezier(0.77, 0, 0.175, 1);
    }

    #left-column.dismissed { display: none; }

    #swat-btn {
        display: block;
        cursor: pointer;
        background: none;
        border: 1px dashed var(--link);
        color: var(--link);
        font-family: var(--asciifont);
        font-size: 1rem;
        padding: 2px 6px;
        letter-spacing: 0.1em;
        transition: color 0.2s, border-color 0.2s;
        user-select: none;
        float: right;
    }

    #swat-btn:hover {
        color: var(--linkhover);
        border-color: var(--linkhover);
    }
}