/* to normalize cross browser look */
html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}h1{font-size:2em;margin:.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}button,[type="button"],[type="reset"],[type="submit"]{-webkit-appearance:button}button::-moz-focus-inner,[type="button"]::-moz-focus-inner,[type="reset"]::-moz-focus-inner,[type="submit"]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type="button"]:-moz-focusring,[type="reset"]:-moz-focusring,[type="submit"]:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type="checkbox"],[type="radio"]{box-sizing:border-box;padding:0}[type="number"]::-webkit-inner-spin-button,[type="number"]::-webkit-outer-spin-button{height:auto}[type="search"]{-webkit-appearance:textfield;outline-offset:-2px}[type="search"]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}


@font-face {
    font-family: "fungal";
    src: url("./assets/fonts/FungalVF.woff2") format("woff2");
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: "apfel";
    src: url("./assets/fonts/ApfelGrotezk-Regular.woff2") format("woff2");
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: "universel";
    src: url("./assets/fonts/Univers\ Else.woff2") format("woff2");
    font-weight: normal;
    font-style: normal;
}

:root {
    /* color palette */
    --color-text: #000;
    --color-bg: none;
    --color-primary: #BFF205;
    --color-secondary: #fff;
    --color-accent: #888;
    --color-border: #252525;
    --color-shadow: rgba(0,0,0,0.2);
    --color-shadow-light: rgba(0,0,0,0.04);
    --color-bg-light: #f7f7f7;
    --color-bg-scrollbar: #f1f1f1;
    --color-scrollbar-thumb: #bbb;
    --color-scrollbar-thumb-hover: #888;
    --color-article-border: #eee;
    --color-feedback-bg: #BFF205cc;

    /* font sizes */
    --font-header: 36px;
    --font-filter-title: 24px;
    --font-article-title: 112px;
    --font-article: 18px;
    --font-toggle: 0.88rem;
    --font-shortcuts: 0.75rem;
    --font-kbd: 0.69rem;
    --font-scroll-indicator: 1rem;
    --font-feedback: 0.88rem;

    /* transitions */
    --transition-main: color 0.2s ease;
    --transition-shadow: box-shadow 0.2s;
    --transition-feedback: opacity 0.5s ease;

    /* border radius */
    --border-radius-sm: 0.25rem;
    --border-radius-md: 0.5rem;
    --border-radius-lg: 1rem;
    --border-radius-xl: 2rem;
    --border-radius-full: 9999px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scrollbar-width: none;
    -ms-overflow-style: none;

    /* make highlighting impossible */
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    color: var(--color-text);
    background-color: var(--color-bg);
    position: relative;
}

#background-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

#css-renderer-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none; /* Let clicks pass through to WebGL layer by default */
}

.article-3d-element {
    z-index: 1000;
    position: absolute;
    transform-style: preserve-3d;
    backface-visibility: hidden;
    user-select: none;
    pointer-events: auto; /* Enable pointer events for the article elements */
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.article-3d-element:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.article-3d-title {
    /* background-color: rgba(0,0,0,0.7); */
    color: var(--color-text);
    padding: 2px 16px;
    font-family: 'fungal', sans-serif;
    font-variation-settings: "THCK" 500, "grow" 300;
    animation: fungi-grow-2 0.9s ease-in-out forwards;
    font-size: 20px;
    border-radius: 4px;
    width: auto;
    text-align: center;
    margin-bottom: 8px;
    /* box-shadow: 0 2px 4px rgba(0,0,0,0.3); */
}

/* animation for fungal font */
@keyframes fungi-grow-1 {
    0% { font-variation-settings: "THCK" 300, "grow" 100; }
    25% { font-variation-settings: "THCK" 800, "grow" 800; }
    50% { font-variation-settings: "THCK" 400, "grow" 200; }
    100% { font-variation-settings: "THCK" 500, "grow" 250; }
}
@keyframes fungi-grow-2 {
    0% { font-variation-settings: "THCK" 300, "grow" 100; }
    25% { font-variation-settings: "THCK" 400, "grow" 600; }
    50% { font-variation-settings: "THCK" 900, "grow" 900; }
    100% { font-variation-settings: "THCK" 500, "grow" 300; }
}
@keyframes fungi-grow-3 {
    0% { font-variation-settings: "THCK" 300, "grow" 0; }
    25% { font-variation-settings: "THCK" 400, "grow" 600; }
    50% { font-variation-settings: "THCK" 900, "grow" 300; }
    75% { font-variation-settings: "THCK" 300, "grow" 900; }
    100% { font-variation-settings: "THCK" 500, "grow" 0; }
}

.article-3d-author {
    /* background-color: rgba(0,0,0,0.5); */
    color: var(--color-text);
    padding: 8px 12px;
    font-family: 'fungal', sans-serif;
    font-variation-settings: "THCK" 500, "grow" 300;
    animation: fungi-grow-1 1.2s ease-in-out forwards;
    font-size: 16px;
    border-radius: 4px;
    width: auto;
    text-align: center;
    /* box-shadow: 0 2px 4px rgba(0,0,0,0.2); */
}

.container {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-gap: 1rem;
    min-height: 100vh;
    padding: 1.25rem;
}

header {
    outline: var(--color-border) 3px solid;
    border-radius: var(--border-radius-xl);
    grid-column: 1 / span 2; /* header takes first 2 columns */
    padding: 1rem;
    position: sticky;
    top: 1rem;
    height: fit-content;
    background-color: var(--color-bg-light);
    display: flex;
    flex-direction: column;
    gap: 2rem;
    max-height: calc(100vh - 2rem); /* re-enable max height for scrolling */
    overflow-y: auto; /* ensure header itself is scrollable */
    z-index: 1000; /* ensure header is above the three.js canvas */
    pointer-events: auto; /* ensure header receives mouse events */
}

header *{
    width: 100%;
}

header h1 {
    font-family: "universel", arial;
    font-size: var(--font-header);
    font-weight: bold;
    line-height: 92%;
    cursor: pointer; 
    transition: var(--transition-main);
    margin: 0;
}

header h1:hover {
    color: var(--color-primary); 
}

.center-feedback {
    position: fixed;
    bottom: 1.25rem;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--color-feedback-bg);
    color: var(--color-secondary);
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    font-size: var(--font-feedback);
    transition: var(--transition-feedback);
    z-index: 1000;
    pointer-events: none; 
}


.filters {
    width: 100%;
    position: relative; /* changed from sticky for better scrolling */
    height: auto;
    z-index: 1000; 
    pointer-events: auto; 
    overflow-y: auto;
    max-height: calc(100vh - 12rem); /* leave room for header elements */
    scrollbar-width: thin; /* firefox scrollbar */
}

.filter-section {
    margin-bottom: 1.875rem;
}

.filter-section h2 {
    font-family: "universel", arial;
    font-size: var(--font-filter-title);
    border-bottom: var(--color-border) 2px solid;
}

.filter-section ul {
    list-style: none;
}

.filter-section ul li {
    margin-bottom: 0.3125rem;
    font-family: "universe", arial;
    font-size: var(--font-filter-title);
}

.filter-section ul li a {
    text-decoration: none;
    color: var(--color-accentt);
}

.filter-section ul li a:hover,
.filter-section ul li a.active {
    background-color: var(--color-text);
    color: var(--color-primary);
    padding: 0.125rem 0.25rem;
}
.filter-section ul li a:hover {
    background-color: var(--color-feedback-bg);
    color: var(--color-text);
}

.articles-container {
    grid-column: 3 / span 10; 
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    grid-gap: 2.5rem;
    padding-top: 1rem;
}

.article {
    vertical-align: baseline;
    margin-bottom: 2.5rem;
    grid-column: 1 / span 10;
    display: grid;
    grid-template-columns: 3fr 7fr; /* simplified two-column layout */
    grid-gap: 2rem;
}

/* left column containing author and description */
.article-left-column {
    display: flex;
    flex-direction: column;
    font-size: var(--font-filter-title);
    font-family: "apfel";
}

/* right column containing title and article text */
.article-right-column {
    display: flex;
    flex-direction: column;
}

.article .author {
    font-family: "fungal", arial;
    font-variation-settings: "THCK" 500, "grow" 300;
    animation: fungi-grow-3 10s ease-in-out infinite;
    font-size: 24px;
}

.article .description {
    margin-top: 0.625rem;
    line-height: 124%;
}

.article .title {
    font-family: "universel", arial;
    line-height: 92%;
    margin-bottom: 0.3125rem;
    letter-spacing: -8px;
    font-size: var(--font-article-title);
}

.article .article-text {
    padding-right: calc(100vw / 13);
    margin-top: 1.25rem;
    font-family: "apfel";
    font-size: var(--font-article);
    line-height: 136%;
    white-space: pre-wrap;
    overflow-y: hidden;
    pointer-events: auto;
    background: none;
    padding-left: 0.625rem;
    box-sizing: border-box;
    z-index: 10;
    position: relative;
    transition: var(--transition-shadow);
}

/* hide scrollbar by default, show on hover */
.article .article-text::-webkit-scrollbar {
    width: 0.5rem;
    background: transparent;
}
.article .article-text:hover::-webkit-scrollbar {
    background: var(--color-bg-scrollbar);
}
.article .article-text::-webkit-scrollbar-thumb {
    background: var(--color-scrollbar-thumb);
    border-radius: 0.25rem;
}
.article .article-text:hover::-webkit-scrollbar-thumb {
    background: var(--color-scrollbar-thumb-hover);
}

/* header and filters scrollbar styling */
header::-webkit-scrollbar,
.filters::-webkit-scrollbar {
    width: 0.5rem;
    background: transparent;
}
header::-webkit-scrollbar-thumb,
.filters::-webkit-scrollbar-thumb {
    background: var(--color-scrollbar-thumb);
    border-radius: 0.25rem;
}
header::-webkit-scrollbar-thumb:hover,
.filters::-webkit-scrollbar-thumb:hover {
    background: var(--color-scrollbar-thumb-hover);
}

.article .article-text.collapsed {
    max-height: 25rem;
    overflow: hidden;
    /* add gradient fade at bottom */
    -webkit-mask-image: linear-gradient(to bottom, black 50%, transparent 100%);
    mask-image: linear-gradient(to bottom, black 50%, transparent 100%);
}

.article .article-text.expanded {
    max-height: max-content;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--color-scrollbar-thumb-hover) var(--color-bg-scrollbar);
    position: relative;
    z-index: 10;
    padding-left: 0.625rem;
    outline: none;
}

.toggle-text {
    text-align: left;
    display: block;
    margin-top: 0.625rem;
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: underline;
    font-size: var(--font-toggle);
    color: #555;
    padding: 0 0 0 1rem;
}

/* search animations and feedback styles */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

#search-button.searching .search-icon {
    animation: pulse 0.3s ease;
}

.search-highlight {
    background-color: var(--color-feedback-bg);
    padding: 0 0.15rem;
    border-radius: var(--border-radius-sm);
}

.center-feedback {
    position: fixed;
    bottom: 1.25rem;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--color-feedback-bg);
    color: var(--color-secondary);
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    font-size: var(--font-feedback);
    transition: var(--transition-feedback);
    z-index: 1000;
    pointer-events: none; 
}

/* scroll indicator for article text */
.scroll-indicator {
    font-size: var(--font-scroll-indicator);
    color: var(--color-accent);
    text-align: center;
    margin-top: 0.3125rem;
    animation: bounce 1s infinite;
    position: relative;
    height: 1.25rem;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(0.3125rem);
    }
}

/* responsive display for keyboard shortcuts */
.mobile-only {
    display: none;
}

@media (max-width: 768px) {
    .desktop-only {
        display: none;
    }
    
    .mobile-only {
        display: inline;
    }
}

/* year-specific styles for articles */

/* styles for 2024 articles */
.article-year-2024 {
    font-family: Arial, Helvetica, sans-serif;
    width: auto;
    border-radius: 0;
}

.article-year-2024 .article-3d-title {
    border-radius: inherit;
    font-family: inherit;
    color: #fff;
    background-color: #000;
    width: auto;
    font-size: 36px;
}

.article-year-2024 .article-3d-author {
    font-size: 18px;
    border-radius: inherit;
    font-family: inherit;
    color: #fff;
    background-color: #000;
    max-width: 250px;
    text-align: center;
}

/* styles for 2025 articles */
.article-year-2025 {
    /* styles for 2025 articles */

}

.article-year-2025 .article-3d-title {
    font-size: 36px;
    color: #000;
    font-variation-settings: "THCK" 700, "grow" 500; /* more expressive fungal settings */
    animation: fungi-grow-3 1.2s ease-in-out forwards; /* different animation */
}

.article-year-2024 .article-3d-author {
    font-size: 18px;
}
