* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html { scroll-behavior: smooth; }

body {
  background-color: #fdfaf5;
  background-image: url('images/tile1.png');
  background-repeat: repeat;
  font-family: 'Nunito Sans', sans-serif;
  color: #4d4137;
  line-height: 1.6;
}

section, footer { width: 100%; padding: 2rem 1rem; }

h1, h2, h3 {
  font-family: 'Arvo', serif; /* Default for others */
  color: #b45f06;
  margin-bottom: 1rem;
  line-height: 1.3;
}
/* h1 is styled specifically in .hero */
h2 { font-size: 2rem; text-align: center; margin-bottom: 2rem;}
h3 { font-size: 1.5rem; color: #4d4137; }

p { margin-bottom: 1rem; }
img { max-width: 100%; height: auto; display: block; }
button { font-family: inherit; cursor: pointer; }

.container {
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
}

.hero {
  background: linear-gradient(rgba(66, 55, 45, 0.6), rgba(66, 55, 45, 0.6)), url('images/t1.jpg') center/cover no-repeat;
  color: #fff;
  text-shadow: 1px 1px 3px rgba(0,0,0,0.6);
  padding: 5rem 1rem;
  text-align: center;
  min-height: 350px;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  overflow: hidden;
}

/* Styles for Hero H1 (Reverted from SVG) */
.hero h1.hero-title-main {
  color: #fff;
  font-family: 'Lobster', cursive;
  font-size: 4.5rem;
  line-height: 1.1;
  margin-bottom: 0.5rem;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.7);
}
@media (max-width: 768px) {
    .hero h1.hero-title-main {
        font-size: 3.5rem;
    }
}
@media (max-width: 480px) {
    .hero h1.hero-title-main {
        font-size: 2.8rem;
    }
}

/* Style for the Hero Subtitle Image */
.hero-subtitle-image {
    display: block;
    margin-top: 1rem;
    margin-left: auto;
    margin-right: auto;
    max-width: 400px;
    width: 90%;
    height: auto;
}
@media (max-width: 768px) {
    .hero-subtitle-image {
        max-width: 85%;
    }
}


.intro-section {
  max-width: 960px;
  margin: 3rem auto;
  display: flex; align-items: center; gap: 2.5rem;
  background: #fff; padding: 2.5rem;
  box-shadow: 0 3px 12px rgba(0,0,0,0.1);
  border-radius: 10px;
  border: 1px solid #eee;
}
.intro-section .text-content { flex: 1; }
.intro-section img {
  flex-basis: 40%; max-width: 40%; border-radius: 6px;
  transform: rotate(-2deg); border: 8px solid #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
@media (max-width: 768px) {
  .intro-section { flex-direction: column; padding: 1.5rem; gap: 1.5rem; }
  .intro-section img { max-width: 70%; transform: rotate(0deg); flex-basis: auto; }
}

/* Style for the Intro Section Title Image */
.intro-title-image {
    display: block;
    max-width: 350px;
    height: auto;
    margin-bottom: 1rem;
    margin-left: 0;
    margin-right: auto;
}
@media (max-width: 768px) {
    .intro-title-image {
        max-width: 80%;
        margin-left: auto;
        margin-right: auto;
    }
}


.memory-lane-section {
  background-color: rgba(255, 255, 255, 0.5);
  padding: 3rem 1rem;
  margin: 3rem 0;
  border-top: 3px dashed #d97706;
  border-bottom: 3px dashed #d97706;
}
/* Style for the Image Title */
.section-title-image {
    display: block;
    margin-left: auto;
    margin-right: auto;
    max-width: 500px;
    height: auto;
    margin-bottom: 2.5rem;
}
@media (max-width: 600px) {
    .section-title-image {
        max-width: 80%;
    }
}


.recorder-highlight {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 3rem;
    background-color: #fff;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    max-width: 750px;
    margin-left: auto;
    margin-right: auto;
}
.recorder-highlight img {
    max-width: 700px;
    margin-bottom: 1rem;
    border-radius: 4px;
    border: 5px solid #f0eade;
}
 .recorder-highlight p {
    font-style: italic;
    color: #6b5e51;
    font-size: 0.9rem;
    margin-bottom: 0;
}

/* Using CSS Columns for audio zones */
#audio-zones {
  column-count: 1;
  column-gap: 3rem;
}

@media (min-width: 768px) {
  #audio-zones {
    column-count: 2;
  }
}

.audio-zone {
  background-color: #fff;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  border: 1px solid #eee;
  display: inline-block;
  width: 100%;
  margin-bottom: 3rem;
  break-inside: avoid;
  text-align: center;
}
.audio-zone .zone-image {
  max-width: 200px;
  margin-bottom: 1rem;
  border-radius: 50%;
  border: 4px solid #f0eade;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  margin-left: auto;
  margin-right: auto;
}
.audio-zone h3 {
  margin-bottom: 1.5rem;
}
.audio-zone .track-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: stretch;
}

/* Sound Item */
.sound-item {
  background: #f8f3eb;
  border: 1px solid #e4dacf;
  border-radius: 6px;
  padding: 0.5rem 1rem;
  position: relative;
  overflow: visible;
  font-size: 0.95rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 45px;
  transition: background-color 0.3s ease, padding 0.3s ease;
}

.sound-item .clip-name {
    font-weight: 600;
    color: #4d4137;
    text-align: left;
    flex-grow: 1;
    margin-right: 1rem;
    transition: color 0.3s ease;
}

.playback-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.playback-info {
    display: none;
    flex-grow: 1;
    min-width: 100px;
}

.sound-item .progress {
    position: relative;
    height: 5px;
    background-color: rgba(74, 144, 226, 0.3);
    width: 100%;
    transition: none;
    margin-bottom: 0.25rem;
    border-radius: 3px;
    overflow: hidden;
}
.sound-item .progress-inner {
    position: absolute;
    top: 0; bottom: 0; left: 0;
    height: 100%;
    background-color: #4a90e2;
    width: 0%;
    transition: width 0.1s linear;
    border-radius: 3px;
}

.sound-item .time-display {
    font-size: 0.75rem;
    color: #6b5e51;
    text-align: right;
    width: 100%;
    transition: color 0.3s ease;
}

.audio-controls {
    display: flex;
    justify-content: flex-end;
    align-items: center; /* Vertically align items */
    min-width: 40px;
    gap: 0.1rem; /* Add small gap between initial buttons */
}

.audio-controls button {
    padding: 0.1rem 0.3rem;
    font-size: 1.65rem;
    line-height: 1;
    background: none;
    border: none;
    color: #4d4137;
    cursor: pointer;
    transition: color 0.2s ease, opacity 0.3s ease, background-color 0.2s ease;
    text-align: center;
    opacity: 0.7;
    display: inline-flex; /* Ensure buttons behave consistently */
    align-items: center;
    justify-content: center;
}

.audio-controls button:hover {
    background: none;
    color: #b45f06;
    opacity: 1;
}

/* Default State (Not Playing) */
.sound-item:not(.playing) .playback-info {
    display: none;
}
.sound-item:not(.playing) .rwd-btn,
.sound-item:not(.playing) .stop-btn,
.sound-item:not(.playing) .ff-btn {
    display: none;
}
.sound-item:not(.playing) .play-pause-btn {
    display: inline-flex; /* Use inline-flex */
    opacity: 1;
}


/* Playing State */
.sound-item.playing {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
    background-color: #e0f2e9;
    border-color: #a3d9b8;
    flex-wrap: wrap;
    align-items: flex-start;
}
.sound-item.playing .clip-name {
    width: 100%;
    margin-bottom: 0.75rem;
    color: #1f4d37;
}
.sound-item.playing .playback-section {
    width: 100%;
}
.sound-item.playing .playback-info {
    display: block;
}
.sound-item.playing .time-display {
    color: #1f4d37;
}
.sound-item.playing .progress-inner {
    background-color: #388e3c;
}
.sound-item.playing .audio-controls {
    display: grid;
    grid-template-columns: repeat(3, auto); /* 3 columns in first row */
    gap: 0.3rem 0.4rem; /* Adjusted gap */
    width: auto;
    min-width: 115px; /* Adjusted min-width slightly */
    justify-items: center;
    align-items: center; /* Align items in grid */
}
.sound-item.playing .audio-controls button {
    display: inline-flex; /* Ensure grid items are flex containers */
    opacity: 0.8;
    color: #1f4d37;
}
.sound-item.playing .audio-controls button:hover {
    color: #005000;
     opacity: 1;
     /* Remove background hover for emoji buttons */
     background-color: transparent !important;
}
.sound-item.playing .play-pause-btn {
     color: #388e3c;
}
.sound-item.playing .play-pause-btn:hover {
     color: #1f4d37;
}

/* Grid Areas for Playing State */
.sound-item.playing .rwd-btn { grid-area: 1 / 1 / 2 / 2; } /* Row 1, Col 1 */
.sound-item.playing .ff-btn { grid-area: 1 / 2 / 2 / 3; } /* Row 1, Col 2 */
/* Share button goes in 1 / 3 */
.sound-item.playing .play-pause-btn { grid-area: 2 / 1 / 3 / 2; } /* Row 2, Col 1 */
.sound-item.playing .stop-btn { grid-area: 2 / 2 / 3 / 3; } /* Row 2, Col 2 */


.sound-item .time-elapsed, .sound-item .time-duration { display: none; }

/* --- Share Button Styles --- */

/* Base style: size, shape, alignment, icon */
.share-btn {
    /* Reset base styles from other buttons if needed */
    font-size: 1rem; /* Reset font size, rely on dimensions */
    padding: 0.3rem; /* Padding around the icon */
    border-radius: 5px; /* Slightly rounded corners */
    width: 2rem;  /* Fixed width */
    height: 2rem; /* Fixed height */
    display: inline-flex; /* Use flex for centering */
    align-items: center;
    justify-content: center;
    line-height: 0; /* Remove extra line height */
    vertical-align: middle; /* Align button in the line */
    background-color: transparent; /* No background by default */
    border: none;
    color: #4d4137; /* Base color for potential icon font */
    cursor: pointer;
    transition: background-color 0.2s ease, opacity 0.3s ease;
    opacity: 0.7; /* Default opacity */
}

/* Style for the image inside the share button */
.share-btn img {
    height: 1.1rem; /* Adjust size of the white icon */
    width: auto;
    display: block; /* Prevents extra space below image */
}

/* Hide share button by default (when not playing) */
.sound-item:not(.playing) .share-btn {
    display: none;
}

/* Styles ONLY when playing (BACKGROUND COLOR) */
.sound-item.playing .share-btn {
    background-color: #58AAF8; /* The requested blue background */
    display: inline-flex; /* Ensure it's visible and uses flex */
    opacity: 0.85; /* Slightly more visible when active */
    color: #fff; /* Just in case, though image is used */
}

/* Hover effect ONLY when playing */
.sound-item.playing .share-btn:hover {
    background-color: #4a90e2; /* Darker blue on hover */
    opacity: 1;
}

/* Define grid position for the share button when playing */
.sound-item.playing .share-btn {
    grid-area: 1 / 3 / 2 / 4; /* Place it in Row 1, Column 3 */
}


.scrapbook-image {
  display: block;
  margin: 2.5rem auto;
  max-width: 90%;
  border: 8px solid #fff;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
  border-radius: 3px;
  background-color: #fff;
}

.scrapbook-image.small-image {
  max-width: 200px;
}

.scrapbook-image.medium-image {
  max-width: 350px;
}

.scrapbook-image.large-image {
    max-width: 600px;
}

.scrapbook-image.tilt-left {
  transform: rotate(-3deg);
}

.scrapbook-image.tilt-right {
  transform: rotate(4deg);
}

.image-row {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 2rem;
  margin: 3rem auto;
  max-width: 1000px;
  padding-left: 1rem;
  padding-right: 1rem;
}

.image-row .scrapbook-image {
  margin: 0;
  max-width: 45%;
  min-width: 200px;
}

.image-row.three-images .scrapbook-image {
    max-width: 30%;
    min-width: 180px;
}


@media (max-width: 768px) {
    .recorder-highlight img {
        max-width: 70%;
    }
    .image-row.three-images .scrapbook-image {
        max-width: 45%;
        min-width: 150px;
    }
     .image-row:not(.three-images) .scrapbook-image {
        max-width: 60%;
     }
     .scrapbook-image.large-image {
        max-width: 450px;
    }
}

@media (max-width: 600px) {
  .scrapbook-image {
    max-width: 80%;
    margin: 1.5rem auto;
  }
  .scrapbook-image.small-image {
    max-width: 150px;
  }
  .scrapbook-image.medium-image {
    max-width: 280px;
  }
   .scrapbook-image.large-image {
    max-width: 300px;
  }

  .recorder-highlight img {
     max-width: 90%;
  }

  .image-row {
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    margin: 2rem auto;
    max-width: 90%;
  }
  .image-row .scrapbook-image {
    max-width: 80% !important;
    min-width: auto;
  }

   #audio-zones {
       column-count: 1;
   }
   .audio-zone {
       width: 100%;
       margin-bottom: 2rem;
   }

   .sound-item {
        align-items: center;
    }
    .sound-item.playing {
        align-items: flex-start;
    }
    .playback-section {
        flex-direction: row;
        align-items: center;
    }
    .playback-info {
         min-width: 0;
    }
    .audio-controls {
         justify-content: flex-end;
    }
    .sound-item.playing .audio-controls {
        width: auto;
        justify-content: center; /* Center grid */
    }
}

/* Responsive adjustments for share button */
@media (max-width: 480px) {
    .share-btn {
         width: 1.9rem;   /* Slightly smaller button */
         height: 1.9rem;
         padding: 0.25rem;
    }
    .share-btn img {
         height: 1.0rem; /* Slightly smaller icon */
    }
    .sound-item.playing .audio-controls {
         min-width: 105px; /* Fine-tune */
         gap: 0.2rem 0.3rem;
    }
}


.closing {
  text-align: center; padding: 3rem 1rem;
  font-style: normal;
  border-top: 1px solid #e4dacf; margin-top: 2rem;
}
/* Style for the Footer Closing Image */
.footer-closing-image {
    display: block;
    margin-left: auto;
    margin-right: auto;
    max-width: 450px;
    height: auto;
    margin-top: 2rem;
}
@media (max-width: 600px) {
    .footer-closing-image {
        max-width: 75%;
        margin-top: 1.5rem;
    }
}

/* Ensure disabled buttons look distinct */
button:disabled {
    opacity: 0.4 !important;
    cursor: not-allowed !important;
    background-color: transparent !important; /* Ensure no background lingers on disabled share btn */
}
/* Specific style for disabled share button image */
.share-btn:disabled img {
    opacity: 0.6;
}