:root {
    --theme-cream: #F4EBE1;
    --theme-white: #FFFFFF;
    --theme-orange: #D96C27;
    --theme-black: #2A2522;
    --theme-darker: #1A1614;
    --theme-darker-orange: #CB4900;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: Arial, sans-serif;
  line-height: 1.6;
  margin: 0;
  padding: 0;
  background-color: var(--theme-cream);
  color: var(--theme-black);
}

header {
  background-color: var(--theme-orange);
  color: var(--theme-white);
  padding: 1.5rem 2rem;
  text-align: center;
}

main {
  flex: 1;
  padding: 2rem;
  max-width: 800px;
  margin: 2rem auto;
  background-color: var(--theme-white);
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  border-radius: 8px;
}

section {
  margin-bottom: 2rem;
}

a {
  color: var(--theme-darker-orange);
  text-decoration: none;
  font-weight: bold;
}

a:hover {
  text-decoration: underline;
  color: var(--theme-black);
}

img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  display: block;
  margin-top: 1rem;
}

footer {
  text-align: center;
  padding: 1.5rem;
  background-color: var(--theme-black);
  color: var(--theme-white);
  margin-top: auto;
}

.headshot {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--theme-orange);
  display: block;
  margin: 1.5rem auto;
}

/* Mobile base styling */

#nav-placeholder {
    display: contents;
}

.main-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--theme-black);
  padding: 10px;
}

.mobile-menu-toggle {
  display: block;
  margin: 0 auto;
  background: none;
  border: none;
  color: var(--theme-white);
  font-size: 1.5rem;
  cursor: pointer;
}

/* Hide menu list on mobile by default */
.nav-list {
  display: none; 
  list-style: none;
  padding: 0;
  margin: 0;
  background: var(--theme-black);
}

/* Show menu when JS adds class */
.nav-list.is-open {
  display: block;
}

.nav-list a {
  display: block;
  padding: 15px 25px;
  color: var(--theme-white);
  text-decoration: none;
  font-weight: bold;
  font-family: sans-serif;
  border-bottom: 1px solid var(--theme-darker);
  transition: background-color 0.2s ease-in-out;
}

.nav-list a:hover {
  background-color: var(--theme-orange);
  color: var(--theme-white);
}

/* Hide dropdown content on mobile by default */
.dropdown-content-nav {
  display: none;
  list-style: none;
  padding-left: 20px;
  background: var(--theme-black);
  margin: 0;
}

/* Show mobile dropdown when clicked */
.dropdown-nav.dropdown-is-open .dropdown-content-nav {
  display: block;
}

/* Desktop styling */

@media (min-width: 768px) {
  /* hide mobile hamburger menu */
  .mobile-menu-toggle {
    display: none;
  }


  .nav-list {
    display: flex;
    justify-content: center;
    gap: 10px;
  }

  .nav-list a {
    border: 1px solid var(--theme-darker);
    border-radius: 6px;
  }

  .dropdown-nav {
    position: relative;
  }

  .dropdown-content-nav {
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--theme-black);
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    padding: 0;
  }

  .dropdown-content-nav a {
    border: none;
    border-radius: 0;
    border-bottom: 1px solid var(--theme-darker);
  }

  .dropdown-nav:hover .dropdown-content-nav {
    display: block;
  }
}


/* Animated form styling */
.letter-wrapper {
  position: relative;
  width: 100%;
  max-width: 320px; /* Prevent form from getting too big on desktop */
  aspect-ratio: 1 / 1;
  margin: 20px auto;
  cursor: pointer;
}

.animated-letter {
  width: 100%;
  height: 100%;
  background-image: url('./images/letter-opening-sprite.png');
  background-repeat: no-repeat;
  image-rendering: pixelated;

  background-size: 1500% 100%;
  background-position: 0 0;
}

.animated-letter.is-opening {
  animation: openLetter 2s steps(14) forwards;
}

.animated-letter.is-closing {
  animation: closeLetter 2s steps(14) forwards;
}

@keyframes openLetter {
  0% { background-position: 0% 0; }
  100% { background-position: 100% 0; }
}

@keyframes closeLetter {
  0% { background-position: 100% 0; }
  100% { background-position: 0% 0; }
}

.paper-form-overlay {
  position: absolute;
  top: 20px;
  left: 55px;
  right: 50px;
  bottom: 30px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease-in;
  display: flex;
  flex-direction: column;
}

.paper-form-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.paper-form {
  display: flex;
  flex-direction: column;
  gap: 5px;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 15px;
  scrollbar-gutter: stable;
}

.paper-form h3 {
  font-family: 'Press Start 2P', system-ui;
  font-size: 16px;
  text-align: center;
  line-height: 1;
  margin-bottom: 5px;
}

.paper-form button {
  font-family: 'Press Start 2P', system-ui;
  font-size: 10px;
  padding: 12px;
  cursor: pointer;
  background-color: var(--theme-cream);
  border: 2px solid var(--theme-black);
}

input, textarea, button { 
  padding: 10px;
  font-family: 'VT323', monospace;
  font-size: 16px;
}

.input-row {
  display: flex;
  gap: 10px;
  width: 100%;
}

.input-row input {
  flex: 1;
  width: 100%;
  min-width: 0;
}

/* Retro looking scrollbar for paper-form*/
.paper-form::-webkit-scrollbar {
  width: 10px;
}

.paper-form::-webkit-scrollbar-track {
  background: transparent;
  border-left: 2px dashed var(--theme-black);
}

.paper-form::-webkit-scrollbar-thumb {
  background: var(--theme-black);
  border: 2px solid var(--theme-white);
}

/* Form error detected styling */
.pixel-error-box {
  /* position error box to appear above form container */
  position: absolute;
  top: -20px;
  left: 5%;
  width: 90%;
  z-index: 100;
  
  /* styling */
  background-color: var(--theme-orange);
  color: var(--theme-white);
  font-family: 'VT323', monospace;
  font-size: 18px;
  padding: 8px;
  border: 4px solid var(--theme-black);
  text-align: center;
  box-shadow: 4px 4px 0px rgba(0,0,0,0.5);

  display: none;
}

.pixel-error-box.is-visible {
  display: block;
  animation: dropDown 0.2s ease-out forwards;
}

@keyframes dropDown {
  0% {
    transform: translateY(-20px);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes errorShake {
  0% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  50% { transform: translateX(4px); }
  75% { transform: translateX(-4px); }
  1000% { transform: translateX(0); }
}

.shake-animation {
  animation: errorShake 0.3s ease-in-out;
  border-color: var(--theme-darker-orange);
  background-color: var(--theme-orange)
}

/* Utility class for swapping screens */
.hidden {
  display: none !important;
}

#pixel-confirmation-screen {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  padding-right: 15px;
  scrollbar-gutter: stable;
}

#pixel-confirmation-screen h3 {
  font-family: 'Press Start 2P', system-ui;
  font-size: 16px;
  text-align: center;
  line-height: 1;
  margin-bottom: 5px;
}

.confirm-details p {
  font-family: 'VT323', monospace;
  font-size: 16px;
  margin: 5px 0;
  border-bottom: 1px dashed var(--theme-black)
}

/* Side-by-side buttons for confirmation screen */
.button-row {
  display: flex;
  gap: 10px;
  margin-top: auto;
  padding-top: 15px;
}

.button-row button {
  flex: 1;
  font-family: 'Press Start 2P', system-ui;
  font-size: 10px;
  padding: 12px 5px;
  cursor: pointer;
  border: 2px solid var(--theme-black);
}

.edit-btn {
  background-color: var(--theme-cream);
}

.confirm-btn {
  background-color: var(--theme-cream);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}