/* ==========================================================================
   A Familiar Ring ™ - Main Stylesheet (style.css)
   ========================================================================== */

/* --- CSS Variables & Design Tokens --- */
:root {
  --primary-green: #005a00;       /* Accessible dark green */
  --accent-gold: #996e00;         /* High-contrast accessible gold */
  --bg-light: #f9f9fb;
  --surface-white: #ffffff;
  --text-main: #222222;
  --text-muted: #555555;
  --border-color: #d8d8d8;
  --table-header-bg: #005a00;
  --table-row-alt: #f4f6f4;
  --radius: 8px;
  --max-width: 960px;
}

/* --- Reset & Global Defaults --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  line-height: 1.6;
  color: var(--text-main);
  background-color: var(--primary-green);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

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

a:hover {
  color: var(--accent-gold);
}

/* Accessible focus rings */
a:focus-visible, 
button:focus-visible {
  outline: 3px solid var(--accent-gold);
  outline-offset: 3px;
}

/* --- Header & Site Navigation --- */
header {
  background-color: var(--primary-green);
  color: #ffffff;
  padding: 1.5rem 1rem 1rem;
  text-align: center;
}

.brand-link {
  display: inline-block;
  text-decoration: none;
  margin-bottom: 1rem;
}

.brand-logo {
  display: block;
  width: 100%;
  max-width: 550px;
  height: auto;
  margin: 0 auto;
}

nav {
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius);
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.5rem;
}

nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1.5rem;
}

nav a {
  color: #ffffff;
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  transition: background-color 0.2s ease, color 0.2s ease;
}

nav a:hover,
nav a[aria-current="page"] {
  background-color: #ffffff;
  color: var(--primary-green);
}

/* --- Main Layout Container --- */
main {
  flex: 1;
  width: calc(100% - 2rem);
  max-width: var(--max-width);
  margin: 1rem auto 2rem;
  padding: 2rem 1.5rem;
  background-color: var(--surface-white);
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.intro-heading,
.page-title {
  text-align: center;
  color: var(--primary-green);
  font-size: 1.75rem;
  margin-bottom: 1.5rem;
}

.page-subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 1rem;
  margin-top: -1rem;
  margin-bottom: 1.5rem;
}

.instructions-box {
  background-color: var(--bg-light);
  border-left: 4px solid var(--primary-green);
  padding: 1rem 1.25rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-bottom: 2rem;
  font-size: 0.95rem;
}

.instructions-box p {
  margin-bottom: 0.5rem;
}

.instructions-box p:last-child {
  margin-bottom: 0;
}

/* --- Homepage (index.html): 2-Column Album Grid --- */
.albums-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
}

@media (min-width: 680px) {
  .albums-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
  }
}

.album-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1.5rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background-color: var(--bg-light);
}

.album-card h2,
.album-card h3 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

.album-card p {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  flex-grow: 1;
}

.album-cover-link {
  display: block;
  width: 100%;
  max-width: 320px;
  aspect-ratio: 1 / 1;
  margin-bottom: 1.25rem;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.album-cover-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.2);
}

.album-cover-link img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.btn-listen {
  display: inline-block;
  text-decoration: none;
  background-color: var(--primary-green);
  color: #ffffff;
  padding: 0.65rem 1.25rem;
  font-weight: 600;
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

.btn-listen:hover {
  background-color: var(--accent-gold);
  color: #ffffff;
}

/* --- Music Page (music.htm): Tables & Tracklists --- */
.album-section {
  margin-bottom: 3.5rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--border-color);
}

.album-section:last-of-type {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.album-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.album-header h2 {
  font-size: 1.4rem;
  color: var(--primary-green);
  margin-bottom: 1rem;
}

.album-cover {
  max-width: 450px;
  width: 100%;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
  margin: 0 auto 1.25rem;
  display: block;
}

.table-container {
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  margin-bottom: 1rem;
  background-color: var(--surface-white);
  overflow: hidden;
}

/* Button 1: Solid Green Play Button */
.btn-play {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 0.75rem;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.8rem;
  line-height: 1;
  white-space: nowrap;
  background-color: var(--primary-green);
  color: #ffffff;
  transition: background-color 0.2s ease;
}

.btn-play:hover {
  background-color: var(--accent-gold);
  color: #ffffff;
  text-decoration: none;
}

/* Button 2: Outlined Download Button */
.btn-download-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.65rem;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.8rem;
  line-height: 1;
  white-space: nowrap;
  background-color: transparent;
  color: var(--primary-green);
  border: 1px solid var(--primary-green);
  transition: background-color 0.2s ease, color 0.2s ease;
}

.btn-download-pill:hover {
  background-color: var(--primary-green);
  color: #ffffff;
  text-decoration: none;
}

.file-size {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ==========================================================================
   MOBILE VIEW (< 640px): Stacked Cards
   ========================================================================== */
@media (max-width: 639px) {
  .tracklist-table thead {
    display: none;
  }

  .tracklist-table,
  .tracklist-table tbody,
  .tracklist-table tfoot {
    display: block;
    width: 100%;
  }

  .tracklist-table tr {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 0.85rem 1rem;
    border-top: 1px solid var(--border-color);
  }

  .tracklist-table tbody tr:first-child {
    border-top: none;
  }

  .tracklist-table tbody tr:nth-child(even) {
    background-color: var(--table-row-alt);
  }

  .track-title-cell {
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0 0 0.5rem 0;
    width: 100%;
  }

  .track-action-cell {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    padding: 0;
    width: 100%;
  }

  .tracklist-table tfoot tr {
    background-color: #e9ece9;
    border-top: 2px solid var(--primary-green);
  }

  .tracklist-table tfoot .track-title-cell {
    color: var(--primary-green);
  }
}

/* ==========================================================================
   TABLET & DESKTOP VIEW (>= 640px): 2-Column Table
   ========================================================================== */
@media (min-width: 640px) {
  .tracklist-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
  }

  .tracklist-table th {
    background-color: var(--table-header-bg);
    color: #ffffff;
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
  }

  .tracklist-table th.center {
    text-align: right;
  }

  .tracklist-table td {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border-color);
    vertical-align: middle;
  }

  .track-action-cell {
    text-align: right;
    white-space: nowrap;
  }

  .track-action-cell .btn-play {
    margin-right: 0.4rem;
  }

  .track-action-cell .btn-download-pill {
    margin-right: 0.6rem;
  }

  .track-action-cell .file-size {
    display: inline-block;
    min-width: 45px;
    text-align: right;
  }

  .tracklist-table tbody tr:nth-child(even) {
    background-color: var(--table-row-alt);
  }

  .tracklist-table tfoot tr {
    background-color: #e9ece9;
    font-weight: bold;
  }

  .tracklist-table tfoot td {
    border-top: 2px solid var(--primary-green);
    padding: 0.85rem 1rem;
  }
}

/* --- Pictures Page (handbell-pictures.htm): Clipart Grid --- */
.clipart-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

/* 2 columns on tablets */
@media (min-width: 540px) {
  .clipart-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* 3 columns on desktop monitors */
@media (min-width: 768px) {
  .clipart-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.75rem;
  }
}

.picture-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  background-color: var(--bg-light);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.25rem 1rem;
  text-align: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.picture-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

/* Taller, generous preview container for _s images */
.thumbnail-frame {
  width: 100%;
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  background-color: #ffffff;
  border-radius: 6px;
  border: 1px solid #e8e8e8;
  padding: 0.75rem;
  text-decoration: none;
}

.thumbnail-frame img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.btn-download {
  display: inline-block;
  width: 100%;
  background-color: var(--primary-green);
  border: 1px solid var(--primary-green);
  color: #ffffff;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.55rem 0.75rem;
  border-radius: 4px;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.btn-download:hover {
  background-color: var(--accent-gold);
  border-color: var(--accent-gold);
  color: #ffffff;
  text-decoration: none;
}

.about-box {
  border-top: 1px solid var(--border-color);
  padding-top: 1.5rem;
  font-size: 0.95rem;
  color: var(--text-main);
}

.about-box h2 {
  font-size: 1.2rem;
  color: var(--primary-green);
  margin-bottom: 0.5rem;
}

/* --- Contact Page (contact.htm) --- */
.contact-card {
  max-width: 550px;
  margin: 0 auto 2rem;
  background-color: var(--bg-light);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  text-align: center;
}

.contact-card p {
  margin-bottom: 1.5rem;
  font-size: 1rem;
  color: var(--text-main);
}

.email-image-frame {
  display: inline-block;
  background-color: #ffffff;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
  max-width: 100%;
}

.email-img {
  display: block;
  width: 100%;
  max-width: 425px;
  height: auto;
  margin: 0 auto;
}

/* --- Global Footer --- */
footer {
  text-align: center;
  padding: 1.5rem 1rem;
  color: #ffffff;
  font-size: 0.85rem;
  opacity: 0.85;
}