/* ==========================================
   1. BASIC RESET AND GENERAL STYLES
   ========================================== */
:root {
  /* Colors */
  --primary-color: #ab0000;
  --secondary-color: #d29d00;
  --text-color: #000000;
  --text-color-muted: #aaaaaa;
  --bg-color: #ffffff;
  --bg-color-secondary: #fff5e1;
  --bg-color-active: #e0e9ff;
  --dark-bg: #292929;
  --light-1: rgb(248, 241, 207);
  --light-2: rgb(245, 238, 201);

  /* Shadows and Effects */
  --standard-shadow: 0px 10px 10px rgba(0, 0, 0, 0.2);
  --modal-overlay: rgba(0, 0, 0, 0.7);

  /* Z-index layers */
  --z-base: 10;
  --z-typewriter: 50;
  --z-controls: 100;
  --z-popup: 200;
  --z-modal: 300;

  /* Animations */
  --backdrop-blur: 12px;
  --blur-1: 40px;
  --blur-2: 64px;
}

* {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}

body {
  background-color: var(--bg-color);
  background-image: url("img/lettera-by-jc.svg");
  background-repeat: no-repeat;
  background-position: 50% 20%;
  background-size: 450px;
  font-size: 18px;
}

a {
  text-decoration: none;
  color: var(--primary-color);
}

/* ==========================================
     2. FONTS
     ========================================== */
@font-face {
  font-family: "LetteraFont";
  src: url("font/zai_OlivettiLettera22Typewriter.ttf") format("truetype");
}

@font-face {
  font-family: "BohemiaFont";
  src: url("font/Bohemian\ Typewriter.ttf") format("truetype");
}

/* ==========================================
     3. GENERAL UI ELEMENTS
     ========================================== */
.container {
  background-color: var(--bg-color);
  width: 90vmin;
  padding: 50px 30px;
  position: absolute;
  transform: translate(-50%, -50%);
  left: 50%;
  top: 50%;
  border-radius: 10px;
}

.input-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.active {
  background-color: var(--bg-color-active);
}

#inputArea {
  opacity: 0;
  filter: alpha(opacity=0);
}

/* ==========================================
     4. INPUT FIELDS AND FORM ELEMENTS
     ========================================== */
input[type="color"] {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-color: transparent;
  width: 40px;
  height: 28px;
  border: none;
  cursor: pointer;
}

input[type="color"]::-webkit-color-swatch {
  border-radius: 15px;
  box-shadow: 0 0 0 2px var(--bg-color), 0 0 0 3px #020929;
}

input[type="color"]::-moz-color-swatch {
  border-radius: 15px;
  box-shadow: 0 0 0 2px var(--bg-color), 0 0 0 3px #020929;
}

#text-input {
  margin-top: 10px;
  border: 1px solid #dddddd;
  padding: 20px;
  height: 50vh;
  white-space: nowrap;
  overflow-x: auto;
}

/* ==========================================
     5. CANVAS AND RELATED COMPONENTS
     ========================================== */
canvas {
  background-color: var(--bg-color-secondary);
  position: absolute;
  left: -40px;
  top: -45px;
  transition: left 0.2s ease;
  letter-spacing: 20px;
  width: 600px;
  height: 1200px;
  visibility: visible;
  display: none;
}

#pointer {
  position: absolute;
  left: 50%;
  top: 155px;
  width: 50px;
}

/* ==========================================
     6. TYPEBAR ELEMENTS
     ========================================== */
#tbar-C,
#tbar-1L,
#tbar-1P,
#tbar-2L,
#tbar-2P,
#tbar-3L,
#tbar-3P,
#tbar-4L,
#tbar-4P,
#tbar-5L,
#tbar-5P {
  opacity: 0;
  transition: opacity 50ms;
  position: absolute;
  bottom: 0;
  top: -40px;
  z-index: calc(var(--z-typewriter) * 2);
  width: 600px;
  display: none;
}

/* ==========================================
     7. ANIMATIONS
     ========================================== */
@keyframes fadeInOut {
  0% {
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

.fadeInOut {
  animation-name: fadeInOut;
  animation-duration: 100ms;
}

@keyframes slideInFromBottom {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

@-webkit-keyframes slideInFromBottom {
  from {
    -webkit-transform: translateY(100%);
  }
  to {
    -webkit-transform: translateY(0);
  }
}

@keyframes slideUp {
  from {
    transform: translateY(150px);
  }
  to {
    transform: translateY(0);
  }
}

@-webkit-keyframes slideUp {
  from {
    -webkit-transform: translateY(150px);
  }
  to {
    -webkit-transform: translateY(0);
  }
}

.typewriter-animation {
  animation: slideInFromBottom 1.5s ease-out forwards;
  -webkit-animation: slideInFromBottom 1.5s ease-out forwards;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.canvas-animation {
  animation: slideUp 1s ease-out forwards;
  -webkit-animation: slideUp 1s ease-out forwards;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* ==========================================
     8. ICONS AND CONTROLS
     ========================================== */
#iconContainer {
  margin-top: 250px;
  height: 400px;
}

.iconContainer {
  width: 48px;
  height: 48px;
  border: 2px solid black;
  border-radius: 50%;
  background-color: white;
  position: relative;
  overflow: hidden;
  box-shadow: var(--standard-shadow);
  transition: transform 0.3s ease;
  margin: 50px 0px 50px 70px;
  z-index: var(--z-controls);
}

.iconContainer:active {
  transform: translateY(4px);
  box-shadow: none;
}

.icon {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 48px;
  height: 48px;
  padding: 12px;
  transform: translate(-50%, -50%);
}

.navicon {
  float: left;
  top: -48px;
}

/* ==========================================
     9. TYPEWRITER SWITCHER
     ========================================== */
.typewriterToggleNavContainer,
.menuEditorNavContainer {
  background: var(--bg-color);
  position: fixed;
  text-align: center;
  padding: 30px 50px;
  margin: 0;
  min-width: 500px;
  border-radius: 10px;
  box-shadow: var(--standard-shadow);
  z-index: var(--z-popup);
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: none;
  flex-direction: column;
  align-items: center;
}

.typewriterToggleNavContainer.initialSelect,
.menuEditorNavContainer.initialSelect {
  padding: 40px 160px;
}

.typewriter-heading {
  font-family: "BohemiaFont";
  margin-bottom: 30px;
  font-size: 18px;
  width: 100%;
  text-align: center;
}

.typewriter-options {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 40px;
  width: 100%;
}

.typewriterToggleNavContainer .navicon,
.menuEditorNavContainer .navicon {
  float: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  top: 0;
}

.typewriterToggleNavContainer img,
.menuEditorNavContainer img {
  width: 64px;
  margin: 0;
  transition: transform 0.2s;
  cursor: pointer;
}

.typewriterToggleNavContainer img:hover,
.menuEditorNavContainer img:hover {
  transform: scale(1.1);
}

.typewriter-label {
  font-family: "BohemiaFont";
  margin-top: 10px;
  font-size: 16px;
}

.typewriterToggleNavContainer.initialSelect:after {
  display: none;
}

#menuEditor {
  display: none;
}

/* ==========================================
     10. MODAL WINDOW
     ========================================== */
#infoModalContentText {
  visibility: hidden;
  display: none;
}

#infoModal {
  display: none;
  position: fixed;
  z-index: var(--z-modal);
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgb(0, 0, 0);
  background-color: var(--modal-overlay);
}

#infoModalContent {
  width: 60%;
  max-width: 900px;
  background-color: var(--bckg-formColor);
  position: relative;
  margin: 5% auto;
  height: auto;
}

.container_modal {
  background-color: var(--bg-color-secondary);
  padding: 50px 80px;
  margin: 0 auto;
  border-radius: 10px;
  flex-direction: column;
  overflow-y: scroll;
  height: auto;
}

.close {
  color: var(--text-color-muted);
  text-align: center;
  font-size: 28px;
  font-weight: bold;
  margin-top: 100px;
}

.close:hover,
.close:focus {
  color: var(--primary-color);
  text-decoration: none;
  cursor: pointer;
}

.closeModal {
  position: relative;
  clear: both;
  margin-top: -130px;
}

/* ==========================================
     11. MODAL WINDOW TYPOGRAPHY
     ========================================== */
.container_modal h1 {
  font-family: "BohemiaFont";
  text-align: center;
  font-weight: bold;
  font-size: 2.5em;
  margin-bottom: 35px;
}

.container_modal h2 {
  font-family: "BohemiaFont";
  text-align: center;
  font-weight: bold;
  font-size: 1.8em;
  margin-bottom: 28px;
}

.container_modal h3 {
  font-family: "BohemiaFont";
  text-align: center;
  font-weight: bold;
  font-size: 1.2em;
  margin-bottom: 22px;
}

.container_modal p,
ul {
  margin-bottom: 15px;
  font-family: "BohemiaFont";
}

/* ==========================================
     12. TABINATOR IN MODAL WINDOW
     ========================================== */
.tabinator {
  padding: 30px;
  font-family: "BohemiaFont";
}

.tabinator h2 {
  text-align: center;
  margin-bottom: 60px;
}

.tabinator input {
  display: none;
}

.tabinator label {
  box-sizing: border-box;
  display: inline-block;
  padding: 15px 25px;
  color: var(--text-color-muted);
  margin-bottom: -1px;
  margin-left: -1px;
}

.tabinator label:hover {
  color: var(--primary-color);
  cursor: pointer;
}

.tabinator input:checked + label {
  position: relative;
  color: var(--text-color);
  border: 1px solid var(--secondary-color);
  border-radius: 5px 5px 0 0;
  background-color: var(--secondary-color);
}

.tabinator input:checked + label:after {
  display: block;
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
}

#content1,
#content2,
#content3,
#content4 {
  display: none;
  border-top: 1px solid var(--secondary-color);
  padding: 15px;
  height: auto;
  min-height: 500px;
}

#tab1:checked ~ #content1,
#tab2:checked ~ #content2,
#tab3:checked ~ #content3,
#tab4:checked ~ #content4 {
  display: block;
}

/* ==========================================
     13. CONTROLS INFO SECTION
     ========================================== */
.controls-info {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px 16px;
  align-items: center;
  max-width: 600px;
  margin: 20px auto;
  padding: 16px;
}

.controls-info img {
  width: 24px;
  height: auto;
  justify-self: end;
}

.controls-info span {
  font-size: 16px;
  line-height: 1.4;
}

/* ==========================================
     14. BUY ME A COFFEE
     ========================================== */
.buyMeACoffee {
  display: flex;
  padding: 25px;
  flex-wrap: wrap;
  align-items: center;
  gap: 40px;
}

.buyMeACoffee > div {
  flex: 0 0 45%;
}

.buyMeACoffee button {
  border: none;
  border-radius: 15px;
  background-color: var(--secondary-color);
  cursor: pointer;
  min-width: 260px;
  padding: 10px;
  font-size: 20px;
  flex: 0 0 55%;
}

.buyMeACoffee button:hover {
  background-color: var(--primary-color);
  color: var(--bg-color);
}

.buyMeACoffee a {
  text-decoration: none;
  color: var(--bg-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "BohemiaFont";
  gap: 20px;
}

.bmc-logo {
  width: 20px;
  height: auto;
}

/* ==========================================
     15. CONTACT
     ========================================== */
.contact a {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  font-size: 1.3em;
  margin-bottom: 25px;
}

/* ==========================================
     16. TYPEWRITER COMPONENTS
     ========================================== */
#typeMachineBodyHammersGreen {
  background-repeat: no-repeat;
  background-position: 50%;
  background-size: 1440px 300px;
  position: fixed;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 300px;
  display: none;
  justify-content: center;
}

#typewriterBaseFrame {
  position: fixed;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 500px;
}

#typeBars {
  position: fixed;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 500px;
}

#typeBars img {
  position: relative;
  margin: 0 auto;
  width: 600px;
  top: 130px;
}

.typewriter-element {
  display: none;
  position: fixed;
  width: 100%;
  height: 500px;
  background-repeat: no-repeat;
  background-position: 50%;
  background-size: 2040px 500px;
  bottom: 0;
  visibility: visible;
}

.typewriter-moving-part {
  transition: left 0.2s ease;
}

/* ==========================================
     17. INDIVIDUAL TYPEWRITER PARTS
     ========================================== */
#letteraBlueFrontBody {
  background-image: url("img/Lettera_Blue-1body.svg");
}

#letteraBlueTypeHead {
  background-image: url("img/Lettera_Blue-2heart-normal.svg");
}

#letteraBlueLeftWing {
  background-image: url("img/Lettera_Blue-6left-wing.svg");
}

#letteraBlueRailBottom {
  background-image: url("img/Lettera_Blue-3rail-bottom-wib.svg");
}

#letteraBlueRailRollers {
  background-image: url("img/Lettera_Blue-7rollers.svg");
}

#letteraBlueRailBack {
  background-image: url("img/Lettera_Blue-4rail-back.svg");
}

#letteraBlueBodyBack {
  background-image: url("img/Lettera_Blue-5back.svg");
}

#letteraBlueLittleSomething {
  background-image: url("img/Lettera_Blue-1smallSomething.svg");
}

/* ==========================================
     18. LOW RESOLUTION MESSAGE
     ========================================== */
#lowResolutionMsg {
  display: none;
  position: absolute;
  top: 55%;
  padding: 10%;
}

#lowResolutionMsg p {
  font-size: 1.2em;
}

/* ==========================================
     19. DARK MODE
     ========================================== */
.lamp-wrapper {
  position: fixed;
  width: 100vw;
  display: none;
  align-items: center;
  justify-content: center;
  isolation: isolate;
  z-index: 0;
  height: 68vh;
  overflow: hidden;
  background: var(--dark-bg);
}

.lamp-wrapper * {
  position: absolute;
}

.light-beam {
  width: 50%;
  aspect-ratio: 2.14;
}

.light-beam.left {
  right: 50%;
  background-image: conic-gradient(
    from 70deg at center top,
    var(--light-2),
    transparent,
    transparent
  );
}

.light-beam.right {
  left: 50%;
  background-image: conic-gradient(
    from 290deg at center top,
    transparent,
    transparent,
    var(--light-2)
  );
}

.beam-bottom {
  width: 100%;
  aspect-ratio: 3;
  background: var(--dark-bg);
  bottom: 0;
  z-index: 20;
  mask-image: linear-gradient(0deg, #fff, transparent);
}

.light-beam.left .beam-side {
  left: 0;
  mask-image: linear-gradient(90deg, #fff, transparent);
}

.light-beam.right .beam-side {
  right: 0;
  mask-image: linear-gradient(270deg, #fff, transparent);
}

/* ==========================================
     20. LIGHT SWITCH
     ========================================== */
.lightSwitch {
  width: 48px;
  height: 100px;
  border: 2px solid black;
  border-radius: 10px;
  background-color: white;
  position: relative;
  overflow: hidden;
  box-shadow: var(--standard-shadow);
  transition: transform 0.3s ease;
  margin: 50px 0px 50px 70px;
  z-index: var(--z-controls);
}

.iconTop {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translate(-50%, -50%);
}

.iconTop img {
  width: 48px;
  height: 48px;
  padding: 12px;
  transform: translate(-50%, -50%);
}

.iconBottom {
  position: absolute;
  top: 75px;
  left: 50%;
  transform: translate(-50%, -50%);
}

.iconBottom img {
  width: 48px;
  height: 48px;
  padding: 12px;
  transform: translate(-50%, -50%);
}

/* ==========================================
     21. RESPONSIVE DESIGN
     ========================================== */
@media only screen and (max-width: 1024px) {
  body {
    background-position: 50% 0%;
    background-size: 55%;
  }

  #iconContainer {
    display: none !important;
  }

  #letteraBlueBodyBack,
  #letteraBlueFrontBody,
  #letteraBlueLeftWing,
  #letteraBlueLittleSomething,
  #letteraBlueRailBack,
  #letteraBlueRailBottom,
  #letteraBlueRailRollers,
  #letteraBlueTypeHead,
  canvas {
    display: none !important;
  }

  #lowResolutionMsg {
    display: block;
  }

  #lowResolutionMsg p {
    font-size: 1.5em;
  }

  .buyMeACoffee {
    flex-direction: column !important;
  }

  .buyMeACoffee > div,
  .buyMeACoffee button {
    flex: 0 0 100%;
  }
}

@media only screen and (max-width: 800px) {
  body {
    background-position: 50% 0%;
    background-size: 80%;
  }

  #lowResolutionMsg p {
    font-size: 1.5em;
  }
}
