Files
ai.interactive.fiction/public/css/style.css
T
2025-04-01 08:37:41 +02:00

460 lines
8.2 KiB
CSS

/* AI Interactive Fiction - Web UI Styles */
/* Variables */
:root {
--text-color: #222;
--background-color: #f8f4e8;
--book-shadow: rgba(0, 0, 0, 0.3);
--highlight-color: #783422;
--control-color: #555;
--light-color: rgba(255, 240, 210, 0.6);
--viewport-aspect-ratio: 1.6;
--book-width: 1000px;
--book-height: 620px;
--input-bg: rgba(255, 255, 255, 0.6);
--img-aspect-ratio: 1.613;
--aspect-ratio: min(var(--viewport-aspect-ratio), var(--img-aspect-ratio));
font-size: calc(var(--book-height)/(34 * 1.5));
}
/* Font faces */
@font-face {
font-family: "EB Garamond";
src: url("../fonts/EBGaramond12-Regular.otf") format("opentype");
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: "EB Garamond";
src: url("../fonts/EBGaramond12-Italic.otf") format("opentype");
font-weight: normal;
font-style: italic;
}
/* Global styles */
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
html, body {
height: 100%;
font-family: "EB Garamond", serif;
color: var(--text-color);
background-color: #222;
background-image: url(../images/brown-wooden-flooring.jpg);
background-size: cover;
background-position: center;
overflow: hidden;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
margin: 0;
padding: 0;
}
body.switched {
transition: color 0.6s, background-color 0.6s;
}
h1 {
font-size: 2rem;
margin-bottom: 0.8rem;
text-align: center;
text-transform: uppercase;
font-weight: normal;
}
h2 {
font-size: 1.2rem;
text-align: center;
font-weight: normal;
}
h3 {
font-size: 1.2rem;
text-align: center;
font-weight: normal;
}
.header {
padding-top: 3rem;
padding-bottom: 3rem;
}
.byline {
font-feature-settings: "smcp";
}
.separator {
text-align: center;
}
p, #ruler, #indent {
font-size: 1.2rem;
line-height: 1.2;
color: rgba(0,0,0,0.9);
margin-block-end: 0;
margin-block-start: 0;
}
a {
transition: color 0.6s;
color: #333;
font-style: italic;
text-decoration-thickness: 1px;
}
a:hover {
color: black;
transition: color 0.1s;
}
strong {
color: black;
font-weight: bold;
}
.container .hide {
opacity: 0.0;
}
.container .invisible {
display: none;
}
.container > *, .container > p > * {
opacity: 1.0;
transition: opacity 0.5s;
}
#command_input {
position: absolute;
bottom: 1rem;
left: 3rem;
right: 3rem;
display: flex;
}
#player_input {
flex-grow: 1;
font-family: inherit;
font-size: 1.2rem;
padding: 0.5rem;
border: 1px solid rgba(0,0,0,0.3);
border-radius: 0.25rem;
background: rgba(255,255,255,0.9);
}
#submit_command {
margin-left: 0.5rem;
font-family: inherit;
font-size: 1.2rem;
padding: 0.5rem 1rem;
border: 1px solid rgba(0,0,0,0.3);
border-radius: 0.25rem;
background: rgba(255,255,255,0.9);
cursor: pointer;
}
#submit_command:hover {
background: rgba(255,255,255,1);
}
#controls {
z-index: 4;
text-align: center;
position: absolute;
right: 0;
left: 0;
top: 1rem;
padding-top: 1rem;
user-select: none;
transition: color 0.6s, background 0.6s;
}
#controls [disabled] {
color: #999;
}
#controls input[type=range] {
vertical-align: middle;
-webkit-appearance: none;
appearance: none;
width: 5rem;
cursor: pointer;
outline: none;
height: 0.5rem;
background-color: transparent;
box-sizing: border-box;
border: 1px solid black;
border-radius: 0.25rem;
overflow: hidden;
}
#controls input::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
height: 0.5rem;
width: 0.5rem;
border-radius: 0.25rem;
background-color: rgba(0,0,0,0.9);
border: none;
box-shadow: -407px 0 0 400px rgba(0,0,0,0.3);
}
#controls input::-webkit-runnable-track {
-webkit-appearance: none;
appearance: none;
height: 0.5rem;
border-radius: 0.25rem;
}
#controls>a:not(:last-of-type):after, #controls>span::after {
content: " | ";
}
#book {
position: relative;
width: var(--book-width);
height: var(--book-height);
background-image: url('../images/book-3057904.png');
background-size: contain;
background-position: center;
background-repeat: no-repeat;
perspective: 500px;
perspective-origin: 50% 50%;
max-width: 90vw;
max-height: 90vh;
margin: 0 auto;
transform-origin: center center;
}
#page_left, #page_right {
position: absolute;
top: 5%;
bottom: 10%;
width: 39%;
box-sizing: border-box;
padding: 0 3rem 1rem 1rem;
overflow: visible;
overflow-y: scroll;
opacity: 0.95;
mix-blend-mode: darken;
}
#story {
overflow-x: visible;
margin-bottom: 3rem;
}
#page_left {
left: 11.5%;
}
#page_right {
right: 7%;
height: calc(28 * 1.2 * 1.2rem);
padding-bottom: 4rem;
}
.user-input {
font-style: italic;
color: #555;
margin-top: 1rem;
}
.narrative {
margin-top: 1rem;
}
/* ===== Scrollbar CSS ===== */
/* Firefox */
* {
scrollbar-width: auto;
scrollbar-color: #000000 rgba(255,255,255,0);
}
/* Chrome, Edge, and Safari */
*::-webkit-scrollbar {
width: calc(1rem/4);
}
*::-webkit-scrollbar-track {
background: rgba(255,255,255,0.0);
}
*::-webkit-scrollbar-thumb {
background-color: #000000;
border-radius: calc(1rem/4/2);
border: none;
}
.fade-in {
animation: fadeIn ease 1s;
-webkit-animation: fadeIn ease 1s;
-moz-animation: fadeIn ease 1s;
-o-animation: fadeIn ease 1s;
-ms-animation: fadeIn ease 1s;
}
@keyframes fadeIn {
0% {opacity:0;}
100% {opacity:1;}
}
@-moz-keyframes fadeIn {
0% {opacity:0;}
100% {opacity:1;}
}
@-webkit-keyframes fadeIn {
0% {opacity:0;}
100% {opacity:1;}
}
@-o-keyframes fadeIn {
0% {opacity:0;}
100% {opacity:1;}
}
@-ms-keyframes fadeIn {
0% {opacity:0;}
100% {opacity:1;}
}
#ruler, #indent {
visibility: hidden;
position: absolute;
top: -8000px;
width: auto;
display: inline;
left: -8000px;
text-indent: 0;
text-align: left;
hyphens: none;
margin-block-end: 0;
}
#lighting {
position: absolute;
top: -35%;
left: -35%;
width: 180%;
height: 180%;
animation: gradient-animation-shrink 1s 1;
background: radial-gradient(circle, rgba(255,240,182,0.1) 0%, rgba(255,237,165,0.2) 20%, rgba(0,0,0,0.9) 65%, rgba(0,0,0,0.9) 100%);
mix-blend-mode: color-burn;
pointer-events: none;
z-index: 999;
}
@keyframes gradient-animation-grow {
0% { width: 180%; height: 180%; left: -35%; top: -35%; }
100% { width: 170%; height: 170%; left: -33%; top: -33%; }
}
@keyframes gradient-animation-shrink {
0% { width: 170%; height: 170%; left: -33%; top: -33%; }
100% { width: 180%; height: 180%; left: -35%; top: -35%; }
}
.loading-indicator {
display: inline-block;
position: relative;
width: 1.2rem;
height: 1.2rem;
margin-left: 0.5rem;
}
.loading-indicator div {
box-sizing: border-box;
display: block;
position: absolute;
width: 1rem;
height: 1rem;
border: 0.2rem solid #000;
border-radius: 50%;
animation: loading-indicator 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
border-color: #000 transparent transparent transparent;
}
.loading-indicator div:nth-child(1) {
animation-delay: -0.45s;
}
.loading-indicator div:nth-child(2) {
animation-delay: -0.3s;
}
.loading-indicator div:nth-child(3) {
animation-delay: -0.15s;
}
@keyframes loading-indicator {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
/* Media queries for responsive design */
@media (max-width: 768px) {
:root {
font-size: calc(var(--book-height)/(40 * 1.5));
}
#book {
max-width: 95vw;
max-height: 95vh;
}
#page_left, #page_right {
width: 38%;
padding: 0 1rem 1rem 1rem;
}
}
/* Ensure responsive book sizing */
@media (max-width: 1200px) {
#book {
transform: scale(0.95);
transform-origin: center center;
}
}
@media (max-width: 992px) {
#book {
transform: scale(0.85);
transform-origin: center center;
}
}
@media (max-width: 768px) {
#book {
transform: scale(0.75);
transform-origin: center center;
}
}
@media (max-width: 576px) {
#book {
transform: scale(0.65);
transform-origin: center center;
}
}
/* Additional responsive fix to ensure book remains centered */
@media (max-height: 700px) {
#book {
transform: scale(0.8);
transform-origin: center center;
}
}
@media (max-height: 600px) {
#book {
transform: scale(0.7);
transform-origin: center center;
}
}