:root {
  --main-bg: #f5e6d3;
  --primary-color: #d4a373;
  --secondary-color: #f0c987;
  --accent-dark: #8b4513;
  --text-color: #5d4037;
  --border-width: 10px;
  --wiggle-speed: 1s;
  --row-height: 320px;
} 

@font-face {
  font-family: 'sillyBilly';
  src: url('assets/CaveatBrush-Regular.ttf') format('truetype');
  font-display: swap;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background-color: var(--main-bg);
  font-family: 'sillyBilly', cursive;
  text-align: center;
  color: var(--text-color);
  display: flex;
  flex-direction: column; 
  align-items: center;
}

.content-wrapper {
  width: 75%;
  padding: 0.8rem;
  display: flex;
  flex-direction: column;
  justify-self: center;
  gap: 1rem;
  flex: 1;
}

h1 {
  font-size: clamp(38px, 6.5vw, 52px);
  line-height: 1.1;
  margin: 0;
}

p {
  font-size: clamp(16px, 2.5vw, 20px);
  line-height: 1.5;
  margin: 0.6rem 0;
}

.placeholder-text {
  font-size: clamp(18px, 3vw, 22px);
  color: #8b6f47;
  margin: 0.8rem 0;
  opacity: 0.8;
}

@keyframes wigglyBorder {
  0%, 100% { border-image: url('assets/squiggleBorder.png') 1000 stretch; }
  25%  { border-image: url('assets/squiggleBorder2.png') 1000 stretch; }
  50%  { border-image: url('assets/squiggleBorder3.png') 1000 stretch; }
  75%  { border-image: url('assets/squiggleBorder4.png') 1000 stretch; }
}

.wiggly-style {
  border: var(--border-width) solid transparent;
  border-image: url('assets/squiggleBorder.png') 1000 stretch;
  background-color: rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(2px);
  animation: wigglyBorder var(--wiggle-speed) infinite ease-in-out;
}

body.is-loading .wiggly-style {
  opacity: 0; 
  transition: opacity 0.3s ease;
}

#global-loader {
  position: fixed;
  inset: 0;
  background: white;
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
}

input, button {
  font-family: 'sillyBilly', cursive;
  font-size: clamp(16px, 2.5vw, 20px);
  border-radius: 6px;
  border: 4px solid var(--primary-color);
  padding: 0.6rem 0.8rem;
  transition: all 0.3s ease;
}

input { outline: none; }
input:focus {
  border-color: var(--accent-dark);
  background-color: #fffaf0;
}

button {
  background-color: var(--secondary-color);
  cursor: pointer;
  padding: 0.6rem 1rem;
}
button:hover {
  background-color: #e6b76c;
  border-color: #c48f4a;
}

form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
}

#headerSection {
  padding: 0.6rem 0.8rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  background-color: rgba(255, 255, 255, 0.4);
}

#headerSection img {
  max-width: 160px;
  height: auto;
  border-radius: 50%;
  background-color: white;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

#mainGrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: var(--row-height);
  gap: 1rem;
  width: 100%;
  align-items: start;
}

@media (min-width: 1440px) {
  :root { --row-height: 420px; }
} 

.wiggly-section {
  padding: 0.6rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  height: var(--row-height);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.2) transparent;
}

.wiggly-section::-webkit-scrollbar { width: 6px; }
.wiggly-section::-webkit-scrollbar-thumb {
  background-color: rgba(0,0,0,0.2);
  border-radius: 4px;
}

#galleryGrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

#galleryGrid img {
  width: 100%;
  height: 100%; 
  object-fit: cover;
  border-radius: 12px;
  background-color: white;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transition: transform 0.3s ease;
}
#galleryGrid img:hover {
  transform: scale(1.05);
  z-index: 10;
}

#papersContainer a {
  color: black;
  text-decoration: none;
  display: inline-block;
  margin-top: 0.6rem;
  border: 4px solid var(--primary-color);
  border-radius: 8px;
  width: 50%;
  align-self: center;
}

.update-box {
  border: 6px solid transparent;
  border-image: url('assets/squiggleBorder.png') 600 stretch;
  animation: wigglyBorder 1s infinite ease-in-out;
  background-color: rgba(255, 255, 255, 0.5);
  padding: 1rem;
  text-align: left;
  margin-bottom: 1rem;
  flex: 0 0 auto;
  box-sizing: border-box;
}

.update-title {
  font-size: clamp(20px, 4vw, 26px);
  margin: 0 0 0.5rem 0;
  color: var(--accent-dark);
  font-weight: bold;
}

#linksContainer       { grid-column: 1; grid-row: 1; }
#galleryContainer     { grid-column: 2; grid-row: 1; }
#aboutMeContainer     { grid-column: 3; grid-row: 1; }
#updateContainer      { grid-column: 1; grid-row: 2; }
#funFactsContainer    { grid-column: 2; grid-row: 2; }
#interactiveContainer { grid-column: 3; grid-row: 2; }

#siteFooter {
  width: 100%;
  margin-top: 1.2rem;
  padding: 0.8rem;
  border-top: var(--border-width) solid transparent;
  border-image: url('assets/squiggleBorder.png') 1000 stretch;
  background-color: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(2px);
  animation: wigglyBorder 1s infinite ease-in-out;
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
}


.footer-socials { display: flex; gap: 1rem; }
.footer-socials a { color: var(--accent-dark); transition: transform 0.2s ease; }
.footer-socials a:hover { transform: scale(1.2) rotate(-5deg); color: #c46210; }

#updateContainer {
  height: 100%;
  overflow-y: auto;
  padding-right: 0.5rem;
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.18) transparent;
}

#updateContainer::-webkit-scrollbar { width: 8px; }
#updateContainer::-webkit-scrollbar-thumb { background-color: rgba(0,0,0,0.12); border-radius: 6px; }

.paper-body {
  background: white;
  padding: 2rem;
  border-radius: 12px;
  max-width: 1000px;
  margin: 1.5rem auto;
  box-shadow: 0 8px 20px rgba(0,0,0,0.06);
  text-align: left;
}

.reference-list {
  font-size: 0.95rem;
  border-top: 1px solid rgba(0,0,0,0.06);
  margin-top: 1.5rem;
  padding-top: 1rem;
}

.back-link {
  display: inline-block;
  text-decoration: none;
  padding: 0.4rem 1rem;
  background: var(--main-bg);
  color: var(--accent-dark);
  border-radius: 8px;
}


@media (min-width: 769px) and (max-width: 1024px) {
  .content-wrapper { width: auto; }
  #mainGrid {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto;
  }

  #linksContainer       { grid-column: 1; grid-row: 1; }
  #galleryContainer     { grid-column: 2; grid-row: 1; }
  #aboutMeContainer     { grid-column: 1 / -1; grid-row: 2; }
  
  #updateContainer      { display: none !important; }

  #funFactsContainer    { grid-column: 1; grid-row: 3; }
  #interactiveContainer { grid-column: 2; grid-row: 3; }

  #galleryGrid { grid-template-columns: 1fr 1fr; }
  
  .wiggly-section { max-height: 500px; }
}

@media (max-width: 768px) {
  .content-wrapper { padding: 0; gap: 0.8rem; width: auto }
  
  #headerSection h1 { font-size: clamp(34px, 9vw, 48px); }
  #headerSection img { max-width: 140px; }

  #mainGrid {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    grid-auto-rows: auto;
  }

  #updateContainer { display: none !important; }

  .wiggly-section {
    max-height: none;
    height: auto;
    width: calc(100vw - 1rem);
    max-width: calc(100vw - 1rem);
    margin: 0.4rem auto;
    box-sizing: border-box;
  }

  #galleryGrid {
    display: flex;
    overflow-x: auto;
    gap: 1rem;
    padding-bottom: 0.5rem;
    scroll-snap-type: x mandatory;
  }
  
  #galleryGrid img {
    flex: 0 0 150px; 
    height: 150px;
    scroll-snap-align: start;
  }

  .footer-container {
    flex-direction: column;
    text-align: center;
  }
}