/* 
 * Martin Kaplan Digital Journal
 * Main Stylesheet
 * A clean, elegant design for a distinguished professional
 */

:root {
  /* Color Palette */
  --primary-color: #2c3e50;      /* Dark blue-gray */
  --secondary-color: #34495e;    /* Slightly lighter blue-gray */
  --accent-color: #c0392b;       /* Deep red */
  --light-accent: #e74c3c;       /* Brighter red */
  --text-color: #333333;         /* Near black for text */
  --light-text: #7f8c8d;         /* Gray for secondary text */
  --background-color: #f5f5f5;   /* Off-white background */
  --card-color: #ffffff;         /* White for cards/content areas */
  --border-color: #ecf0f1;       /* Very light gray for borders */
  
  /* Typography */
  --serif-font: 'Libre Baskerville', Georgia, serif;
  --sans-font: 'Source Sans Pro', Helvetica, Arial, sans-serif;
  --mono-font: 'Courier New', monospace;
  
  /* Spacing */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 2rem;
  --spacing-xl: 3rem;
  
  /* Border Radius */
  --border-radius: 4px;
  
  /* Box Shadow */
  --box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  --box-shadow-hover: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Base Styles */
html {
  font-size: 16px;
  box-sizing: border-box;
}

*, *:before, *:after {
  box-sizing: inherit;
}

body {
  font-family: var(--sans-font);
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--background-color);
  margin: 0;
  padding: 0;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--serif-font);
  margin-top: var(--spacing-lg);
  margin-bottom: var(--spacing-md);
  line-height: 1.3;
  color: var(--primary-color);
}

h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-top: var(--spacing-xl);
}

h2 {
  font-size: 2rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: var(--spacing-sm);
}

h3 {
  font-size: 1.5rem;
}

p {
  margin-bottom: var(--spacing-md);
}

a {
  color: var(--accent-color);
  text-decoration: none;
  transition: color 0.3s ease;
}

a:hover {
  color: var(--light-accent);
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
  border-radius: var(--border-radius);
}

blockquote {
  border-left: 4px solid var(--accent-color);
  padding-left: var(--spacing-md);
  margin-left: 0;
  color: var(--secondary-color);
  font-style: italic;
}

code {
  font-family: var(--mono-font);
  background-color: var(--border-color);
  padding: 0.2em 0.4em;
  border-radius: var(--border-radius);
}

/* Layout */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-md);
}

.content-area {
  background-color: var(--card-color);
  padding: var(--spacing-lg);
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  margin-bottom: var(--spacing-lg);
}

/* Header */
.site-header {
  background-color: var(--primary-color);
  color: white;
  padding: var(--spacing-md) 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.site-header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-title {
  font-family: var(--serif-font);
  font-size: 1.8rem;
  font-weight: 700;
  margin: 0;
}

.site-title a {
  color: white;
  text-decoration: none;
}

/* Navigation */
.main-navigation ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
}

.main-navigation li {
  margin-left: var(--spacing-md);
}

.main-navigation a {
  color: white;
  text-decoration: none;
  font-weight: 600;
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--border-radius);
  transition: background-color 0.3s ease;
}

.main-navigation a:hover {
  background-color: rgba(255, 255, 255, 0.1);
  text-decoration: none;
}

.main-navigation a.active {
  background-color: var(--accent-color);
}

/* Hero Section */
.hero {
  background-color: var(--secondary-color);
  color: white;
  /* Reduce top padding to bring photo closer to top */
  padding: var(--spacing-md) 0 var(--spacing-xl);
  margin-bottom: var(--spacing-lg);
  background-image: linear-gradient(rgba(44, 62, 80, 0.8), rgba(44, 62, 80, 0.8)), url("/static/images/hero-background.d41d8cd98f00.jpg");
  background-size: cover;
  background-position: center;
}

.hero-content {
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
}

.hero h1 {
  font-size: 3rem;
  margin-bottom: var(--spacing-md);
  color: white;
}

.hero p {
  font-size: 1.25rem;
  margin-bottom: var(--spacing-lg);
}

/* Improve readability of text in the hero */
.hero-content h1,
.hero-content p,
.hero-content .hero-quote,
.hero-intro h2 {
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.hero-intro {
  background: transparent;
  color: #fff;
  padding: 0;
  border-radius: 0;
  margin: var(--spacing-md) auto 0;
  max-width: 800px;
  text-align: center;
}
.hero-intro h2 { margin-bottom: var(--spacing-sm); }

.hero-intro p { color: #fff; margin: 0 0 var(--spacing-md); }

/* Content Cards */
.card {
  background-color: var(--card-color);
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  margin-bottom: var(--spacing-lg);
  overflow: hidden;
  transition: box-shadow 0.3s ease;
}

.card:hover {
  box-shadow: var(--box-shadow-hover);
}

.card-image {
  height: 200px;
  background-size: cover;
  background-position: center;
}

.card-content {
  padding: var(--spacing-md);
}

.card-title {
  margin-top: 0;
  margin-bottom: var(--spacing-sm);
  font-size: 1.5rem;
}

.card-meta {
  color: var(--light-text);
  font-size: 0.9rem;
  margin-bottom: var(--spacing-sm);
}

.card-excerpt {
  margin-bottom: var(--spacing-md);
}

/* Grid Layout */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--spacing-lg);
}

/* Article Styling */
.article-header {
  margin-bottom: var(--spacing-lg);
}

.article-meta {
  color: var(--light-text);
  margin-bottom: var(--spacing-md);
}

.article-content {
  font-family: var(--serif-font);
  font-size: 1.1rem;
  line-height: 1.8;
}

.article-content p:first-of-type::first-letter {
  font-size: 3.5rem;
  line-height: 0.8;
  float: left;
  padding-right: 8px;
  color: var(--accent-color);
  font-family: var(--serif-font);
}

.article-content img {
  margin: var(--spacing-lg) 0;
}

.article-footer {
  margin-top: var(--spacing-xl);
  padding-top: var(--spacing-md);
  border-top: 1px solid var(--border-color);
}

/* Sidebar */
.sidebar {
  background-color: var(--card-color);
  padding: var(--spacing-md);
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
}

.sidebar-section {
  margin-bottom: var(--spacing-lg);
}

.sidebar-title {
  font-size: 1.2rem;
  margin-top: 0;
  margin-bottom: var(--spacing-md);
  padding-bottom: var(--spacing-sm);
  border-bottom: 1px solid var(--border-color);
}

.sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar li {
  margin-bottom: var(--spacing-sm);
}

/* Footer */
.site-footer {
  background-color: var(--primary-color);
  color: white;
  padding: var(--spacing-lg) 0;
  margin-top: var(--spacing-xl);
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--spacing-lg);
}

.footer-section h3 {
  color: white;
  margin-top: 0;
  font-size: 1.2rem;
  margin-bottom: var(--spacing-md);
}

.footer-section ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-section li {
  margin-bottom: var(--spacing-sm);
}

.footer-section a {
  color: #ecf0f1;
  text-decoration: none;
}

.footer-section a:hover {
  text-decoration: underline;
}

.footer-bottom {
  text-align: center;
  margin-top: var(--spacing-lg);
  padding-top: var(--spacing-md);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.9rem;
}

/* Buttons */
.btn {
  display: inline-block;
  background-color: var(--accent-color);
  color: white;
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--border-radius);
  text-decoration: none;
  font-weight: 600;
  transition: background-color 0.3s ease;
  border: none;
  cursor: pointer;
}

.btn:hover {
  background-color: var(--light-accent);
  text-decoration: none;
  color: white;
}

.btn-secondary {
  background-color: var(--secondary-color);
}

.btn-secondary:hover {
  background-color: var(--primary-color);
}

.btn-outline {
  background-color: transparent;
  border: 2px solid var(--accent-color);
  color: var(--accent-color);
}

.btn-outline:hover {
  background-color: var(--accent-color);
  color: white;
}

/* Forms */
.form-group {
  margin-bottom: var(--spacing-md);
}

label {
  display: block;
  margin-bottom: var(--spacing-sm);
  font-weight: 600;
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
  width: 100%;
  padding: var(--spacing-sm);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  font-family: var(--sans-font);
  font-size: 1rem;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 2px rgba(192, 57, 43, 0.2);
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  margin-top: var(--spacing-lg);
}

.pagination a,
.pagination span {
  display: inline-block;
  padding: var(--spacing-sm) var(--spacing-md);
  margin: 0 var(--spacing-xs);
  border-radius: var(--border-radius);
  background-color: var(--card-color);
  color: var(--text-color);
  text-decoration: none;
  transition: all 0.3s ease;
}

.pagination a:hover {
  background-color: var(--accent-color);
  color: white;
}

.pagination .current {
  background-color: var(--accent-color);
  color: white;
}

/* Tags and Categories */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-md);
}

.tag {
  background-color: var(--border-color);
  color: var(--text-color);
  padding: 0.2em 0.6em;
  border-radius: 20px;
  font-size: 0.85rem;
  text-decoration: none;
  transition: background-color 0.3s ease;
}

.tag:hover {
  background-color: var(--accent-color);
  color: white;
  text-decoration: none;
}

/* Comments */
.comments {
  margin-top: var(--spacing-xl);
}

.comment {
  padding: var(--spacing-md);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  margin-bottom: var(--spacing-md);
}

.comment-meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--spacing-sm);
  color: var(--light-text);
  font-size: 0.9rem;
}

.comment-author {
  font-weight: 600;
  color: var(--text-color);
}

/* Video Player */
.video-container {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  height: 0;
  overflow: hidden;
  margin-bottom: var(--spacing-lg);
}

.video-container iframe,
.video-container video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: var(--border-radius);
}

/* Photo Gallery */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
}

.gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: var(--border-radius);
  aspect-ratio: 1;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.gallery-item:hover img {
  transform: scale(1.05);
}

/* Custom Photo Gallery Grid */
.photo-gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr); /* Enforce 4 columns */
  gap: var(--spacing-md, 1rem); /* Grid gap */
}

/* Styling for individual photo cards within the grid */
.photo-gallery-grid .photo-card {
  /* The .card class from Bootstrap should work fine as a grid item.
     Ensure it behaves as a block or flex container for its content. */
  display: flex;
  flex-direction: column;
  width: 100%; /* Ensure it fills the grid cell width */
}

.photo-gallery-grid .photo-card .card-img-top {
  width: 100%;
  height: 200px; /* Fixed height for uniform appearance */
  object-fit: cover; /* Cover the area, cropping if needed */
  display: block; /* Good practice for images */
}
/* Responsive Design */
@media (max-width: 768px) {
  .site-header .container {
    flex-direction: column;
    text-align: center;
  }
  
  .main-navigation {
    margin-top: var(--spacing-md);
  }
  
  .main-navigation ul {
    flex-direction: column;
    align-items: center;
  }
  
  .main-navigation li {
    margin: var(--spacing-xs) 0;
  }
  
  .hero h1 {
    font-size: 2.5rem;
  }
  
  .content-area {
    padding: var(--spacing-md);
  }
  
  .footer-content {
    grid-template-columns: 1fr;
  }
html {
    font-size: 15px; /* Slightly smaller base font */
  }

  h1 {
    font-size: 2rem;
  }

  h2 {
    font-size: 1.75rem;
  }

  h3 {
    font-size: 1.3rem;
  }

  .site-title {
    font-size: 1.5rem; /* Adjust site title for smaller header */
  }

  .main-navigation a {
    padding: var(--spacing-sm) var(--spacing-sm); /* Reduce padding for nav links */
    font-size: 0.95rem;
  }

  .hero p {
    font-size: 1.1rem;
  }

  .card-title {
    font-size: 1.25rem;
  }

  .article-content {
    font-size: 1rem; /* Adjust article font size */
    line-height: 1.7;
  }

  .article-content p:first-of-type::first-letter {
    font-size: 2.8rem; /* Reduce drop cap size */
    padding-right: 6px;
  }

  .grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); /* Adjust for slightly smaller cards */
    gap: var(--spacing-md); /* Reduce gap slightly */
  }

  /* Ensure images in content don't cause overflow */
  .article-content img,
  .card-image img { /* Assuming card-image might contain an img tag directly */
    max-width: 100%;
    height: auto;
  }

  /* Adjust padding for main container on smaller screens */
  .container {
    padding: 0 var(--spacing-sm);
  }
}

/* Print Styles */
@media print {
  body {
    font-size: 12pt;
    background: none;
    color: black;
  }
  
  .site-header, .site-footer, .sidebar, .comments, .pagination {
    display: none;
  }
  
  .container {
    max-width: 100%;
    width: 100%;
  }
  
  .content-area {
    box-shadow: none;
    padding: 0;
  }
  
  a {
    color: black;
    text-decoration: underline;
  }
  
  a[href]:after {
    content: " (" attr(href) ")";
  }
}
