/* 
  The Roots & Branches Project 
*/

/* 1. Global Variables */
:root {
  /* Colors - Light Mode */
  --bg-primary: #D4DFD2;
  --text-main: #22421A;
  --text-input: #4A5246;
  --bg-nav: #B8C7B5;
  --accent: #BC735A;
  --bg-card: #EDEADE;

  /* Typography */
  --font-serif: 'Caladea', Georgia, serif;
  --font-sans: 'Comme', Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Colors - Dark Mode */
    --bg-primary: #282D1C;
    --text-main: #F2E6D0;
    --text-input: #D6D0BC;
    --bg-nav: #524F3A;
    --bg-card: #4A5234;
  }
}

/* 2. Resets & Base Styles */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: clamp(1.125rem, 1rem + 0.5vw, 1.25rem);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-optical-sizing: auto;
}

h1,
h2,
h5,
h6 {
  font-family: var(--font-serif);
  font-weight: 400;
  margin-top: 0;
}

h3 {
  font-weight: 500;
}

h4 {
  font-family: var(--font-sans);
  font-weight: 600;
}

h1 {
  font-size: clamp(2.5rem, 5vw + 1rem, 4rem);
  line-height: 1.1;
  margin-bottom: 2rem;
  letter-spacing: -0.02em;
}

h2 {
  font-size: clamp(1.75rem, 3vw + 1rem, 2.5rem);
  line-height: 1.2;
  margin-bottom: 1rem;
}

h3 {
  font-size: clamp(1.25rem, 2vw + 1rem, 1.75rem);
  line-height: 1.3;
  margin-top: 1.75rem;
  margin-bottom: 0.3rem;
}

h4 {
  margin-top: 1.75rem;
  margin-bottom: 0;
}

p+h2,
p+h3 {
  margin-top: 2rem;
}

p {
  margin-top: 0;
  margin-bottom: 1.5rem;
  max-width: 65ch;
  text-wrap: pretty;
  hyphens: auto;
  font-optical-sizing: auto;
  hanging-punctuation: first last;
}

hr {
  border: none;
  height: 1px;
  background-image: linear-gradient(to right, transparent, rgba(34, 66, 26, 0.2), transparent);
  width: 100%;
}

a {
  color: var(--text-main);
  text-decoration: underline;
  text-underline-offset: 0.15em;
  text-decoration-skip-ink: auto;
  transition: color 0.2s ease, background-color 0.2s ease;
}

/* 3. Layout Components */

/* Header Area */
header {
  padding: 2rem 4vw;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}

.site-title {
  font-family: var(--font-serif);
  font-size: 50px;
  margin: 0;
  text-align: center;
}

/* Pill Navigation */
nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
}

nav a {
  font-weight: 400;
  font-size: 16px;
  background-color: var(--bg-nav);
  padding: 9px 16px;
  border-radius: 100px;
  text-decoration: none;
}

nav a:hover {
  background-color: var(--accent);
  color: #FFF;
}

/* Main Content Area */
main {
  padding: 0rem 4vw;
  max-width: 1200px;
  margin: 0 auto;
}

/* 4. Footer */
footer {
  margin: 4rem 4vw 2rem;
  padding: 2rem;
  text-align: center;
}

footer p {
  font-size: 14px;
  margin: 0 auto;
  opacity: 0.8;
}

/* 5. Photo Gallery Grid */
.albums-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 64px 24px;
  margin: 32px 0 64px;
}

.album-card {
  display: block;
  text-decoration: none;
  background-color: var(--bg-card);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease-out, box-shadow 0.2s ease-out;
}

.album-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.album-card .img-wrapper {
  overflow: hidden;
  border-radius: 6px;
  background-color: #e5e5e5;
  /* placeholder color while loading */
}

.album-card img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  display: block;
}

.album-card h4 {
  margin: 16px 16px 4px;
  font-weight: 700;
  font-size: 16px;
}

.album-card span {
  display: block;
  margin: 0 16px 16px;
  font-size: 14px;
  opacity: 0.7;
}

@media (max-width: 600px) {
  .albums-grid {
    grid-template-columns: 1fr;
    gap: 48px;
  }
}

/* 6. Individual Album Masonry View */
.album-header {
  margin-bottom: 3rem;
  text-align: center;
}

.album-footer {
  margin-bottom: 3rem;
  text-align: center;
}

.back-link {
  display: inline-block;
  font-size: 14px;
  text-decoration: underline;
  opacity: 0.8;
}

.back-link:hover {
  opacity: 1;
}

.album-date {
  font-size: 16px;
  opacity: 0.7;
}

.album-masonry {
  /* Using CSS columns for a simple masonry effect */
  column-count: 2;
  column-gap: 16px;
  margin-bottom: 4rem;
}

.album-image {
  margin-bottom: 16px;
  border-radius: 6px;
  overflow: hidden;
  break-inside: avoid;
}

.album-image img {
  width: 100%;
  height: auto;
  display: block;
}

@media (max-width: 800px) {
  .album-masonry {
    column-count: 2;
  }
}

@media (max-width: 600px) {
  .album-masonry {
    column-count: 1;
  }
}

/* 7. Home Page Layout */
.home-hero-container {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  align-items: center;
  text-align: center;
}

.home-hero-text {
  max-width: 800px;
}

.home-hero-image {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  width: 100%;
}

@media (max-width: 600px) {
  .home-hero-image {
    grid-template-columns: 1fr;
  }
}

.home-hero-image img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  display: block;
}

/* 8. Contact Form */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-width: 600px;
  margin-top: 2rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  font-size: 16px;
  font-weight: 500;
}

.form-group input,
.form-group textarea {
  color: var(--text-input);
  font-size: 16px;
  padding: 12px;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 6px;
  background-color: var(--bg-card);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(214, 71, 153, 0.1);
}

.submit-button {
  font-weight: 500;
  font-size: 16px;
  background-color: var(--text-main);
  color: var(--bg-primary);
  border: none;
  padding: 12px 24px;
  border-radius: 100px;
  cursor: pointer;
  align-self: flex-start;
  transition: background-color 0.2s ease, transform 0.1s ease;
}

.submit-button:hover {
  background-color: var(--accent);
  color: #FFF;
}

.submit-button:active {
  transform: scale(0.98);
}

.success-message {
  background-color: var(--bg-nav);
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 2rem;
  font-weight: 500;
}

.error-message {
  background-color: var(--bg-card);
  color: var(--accent);
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 2rem;
  font-weight: 500;
}

/* 9. Events Page */
.events-list {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  margin-bottom: 4rem;
}

.event-card {
  display: flex;
  gap: 2rem;
  background-color: var(--bg-card);
  border-radius: 8px;
  padding: 1.75rem 2rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  align-items: flex-start;
}

.event-date-badge {
  font-family: var(--font-serif);
  font-size: clamp(1.25rem, 2vw + 1rem, 1.75rem); /* matches h3 */
  color: var(--accent);
  white-space: nowrap;
  min-width: 7rem;
  padding-top: 0.3rem;
  flex-shrink: 0;
}

.event-body {
  flex: 1;
}

.event-title {
  /* inherits h2 size from global styles */
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.event-location {
  font-size: 0.9em;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.event-details {
  font-size: 0.85em;
  margin-bottom: 0.4rem;
  opacity: 0.85;
}

@media (max-width: 600px) {
  .event-card {
    flex-direction: column;
    gap: 0.75rem;
  }

  .event-date-badge {
    min-width: unset;
  }
}

@media (prefers-color-scheme: dark) {
  body {
    font-weight: 350;
    letter-spacing: 0.01em;
  }

  /* Subtle adjustments for readability */
  h1,
  h2,
  h3 {
    font-weight: 400;
  }

  .album-card,
  .album-image {
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4);
  }

  hr {
    background-image: linear-gradient(to right, transparent, rgba(255, 248, 220, 0.2), transparent);
  }
}