/* Global styles */

/* Publish date styling */
.publish-date {
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
  font-style: italic;
  color: #666;
  font-size: 0.9rem;
  text-align: right;
}
:root {
  --text-color: #2d3748;
  --background-color: #f8f9fa;
  --accent-color: #5a67d8;
  --link-color: #4c51bf;
  --border-color: #e2e8f0;
  --subtle-bg: #f7fafc;
  --subtle-accent: #ebf4ff;
  --footer-color: #718096;
  --focus-ring: #4c51bf55;
}

/* Base styles with improved typography */
html {
  font-size: 18px;
  box-sizing: border-box;
}

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

body {
  font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, serif;
  line-height: 1.7;
  color: var(--text-color);
  background-color: var(--background-color);
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background-image:
    radial-gradient(circle at 25% 25%, rgba(90, 103, 216, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 75% 75%, rgba(90, 103, 216, 0.03) 0%, transparent 50%);
}

.container {
  width: 100%;
  max-width: 42rem; /* Narrower content width for better readability */
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Typography with improved hierarchy */
h1, h2, h3 {
  font-weight: normal;
  color: var(--accent-color);
  line-height: 1.3;
  letter-spacing: -0.01em;
}

h1 {
  font-size: 2.5rem;
  margin-top: 2rem;
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
  position: relative;
}

h1::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 3rem;
  height: 3px;
  background-color: var(--accent-color);
  border-radius: 2px;
}

h2 {
  font-size: 1.8rem;
  margin-top: 2rem;
  margin-bottom: 1rem;
}

h3 {
  font-size: 1.4rem;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}

p {
  margin-bottom: 1.5rem;
}

/* Improved link styling with better accessibility */
a {
  color: var(--link-color);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: all 0.2s ease;
  padding: 0.1em 0;
}

a:hover, a:focus {
  border-bottom: 1px solid var(--link-color);
}

a:focus {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Header with improved spacing */
header {
  margin-bottom: 3rem;
  padding-top: 2rem;
}

nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding: 0.5rem 0 1rem;
  border-bottom: 1px solid var(--border-color);
}

nav a {
  margin-right: 1.5rem;
  font-size: 1.1rem;
  border-bottom: none;
  position: relative;
}

nav a:hover {
  border-bottom: none;
}

nav a::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--accent-color);
  transition: width 0.3s ease;
}

.nav-links {
  display: flex;
  align-items: center;
}

nav a:hover::after, nav a:focus::after {
  width: 100%;
}

.title-section {
  margin-bottom: 2.5rem;
}

.description {
  font-style: italic;
  color: var(--footer-color);
  font-size: 1.1rem;
  max-width: 38rem;
  line-height: 1.6;
}

/* Language selector with improved styling */
.language-selector {
  margin-left: auto;
  display: flex;
  align-items: center;
}

.earth-emoji {
  margin-right: 0.5rem;
  font-size: 1.2rem;
}

.language-selector select {
  padding: 0.5rem 1rem 0.5rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background-color: var(--background-color);
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text-color);
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235a67d8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  background-size: 1em;
}

.language-selector select:hover {
  border-color: var(--accent-color);
}

.language-selector select:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

/* Main content with improved spacing */
main {
  flex: 1;
  margin-bottom: 4rem;
}

/* Note content with improved typography */
.note-content {
  margin-bottom: 3rem;
  line-height: 1.8;
  font-size: 1.1rem;
}

.note-content p {
  margin-bottom: 1.5rem;
}

.note-content p:first-of-type::first-letter {
  font-size: 1.5em;
  font-weight: normal;
  color: var(--accent-color);
}

/* Audio player styling */
.audio-hint {
  margin-bottom: 0.2rem;
  font-size: 0.95rem;
  color: var(--footer-color);
  font-style: italic;
  text-align: center;
}

.audio-player {
  margin: 0.5rem 0 2rem;
  padding: 1rem;
  background-color: var(--subtle-bg);
  border-radius: 8px;
  border-left: 3px solid var(--accent-color);
}

.audio-player audio {
  width: 100%;
  outline: none;
}

/* Podcast section styling */
.podcast-section {
  margin-bottom: 3rem;
  padding: 1.5rem;
  background-color: var(--subtle-bg);
  border-radius: 8px;
  border-left: 3px solid var(--accent-color);
}

.podcast-info h2 {
  margin-top: 0;
  font-size: 1.6rem;
}

.podcast-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1.5rem;
}

.podcast-link {
  display: flex;
  align-items: center;
  padding: 0.75rem 1.25rem;
  background-color: var(--subtle-accent);
  border-radius: 4px;
  transition: all 0.2s ease;
  border-bottom: none;
}

.podcast-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border-bottom: none;
}

.podcast-icon {
  font-size: 1.2rem;
  margin-right: 0.5rem;
}

/* RTL support for podcast section */
html[dir="rtl"] .podcast-section {
  border-left: none;
  border-right: 3px solid var(--accent-color);
}

html[dir="rtl"] .podcast-icon {
  margin-right: 0;
  margin-left: 0.5rem;
}

/* Notes section and note list styling */
.notes-section {
  margin-bottom: 3rem;
}

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

.note-list li {
  margin-bottom: 1.5rem;
  padding: 1.5rem;
  background-color: var(--subtle-bg);
  border-radius: 8px;
  border-left: 3px solid var(--accent-color);
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}

.note-list li::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 100px;
  height: 100px;
  background: radial-gradient(circle at top right, var(--subtle-accent) 0%, transparent 70%);
  opacity: 0.5;
  z-index: 0;
}

.note-list li:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.note-number {
  display: inline-block;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--accent-color);
  margin-right: 0.5rem;
  position: relative;
  z-index: 1;
}

.note-preview {
  display: block;
  margin: 0.5rem 0;
  font-size: 1.1rem;
  position: relative;
  z-index: 1;
}

.read-more {
  display: inline-block;
  margin-top: 0.5rem;
  font-style: italic;
  color: var(--link-color);
  position: relative;
  z-index: 1;
}

.note-list a {
  display: block;
  border-bottom: none;
}

.note-list a:hover {
  border-bottom: none;
}

/* Navigation links with improved styling */
.note-navigation {
  display: flex;
  justify-content: space-between;
  margin: 3rem 0;
  padding: 1rem 0;
  border-top: 1px solid var(--border-color);
}

.note-navigation a {
  padding: 0.75rem 1.25rem;
  border-radius: 4px;
  background-color: var(--subtle-accent);
  border-bottom: none;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.prev-note, .next-note {
  position: relative;
  overflow: hidden;
}

.prev-note::before, .next-note::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--accent-color);
  opacity: 0;
  z-index: -1;
  transition: opacity 0.3s ease;
}

.note-navigation a:hover {
  background-color: transparent;
  border-bottom: none;
  color: var(--background-color);
}

.note-navigation a:hover::before {
  opacity: 1;
}

.nav-placeholder {
  width: 2rem;
}

.resource-links, .language-links {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.95rem;
  line-height: 1.6;
}

.resource-link, .nostr-link {
  display: inline-block;
  padding: 0.3rem 0.6rem;
  margin: 0.3rem 0;
  background-color: var(--subtle-bg);
  border-radius: 3px;
  transition: all 0.2s ease;
}

.resource-link:hover, .nostr-link:hover {
  background-color: var(--subtle-accent);
}

.resource-links {
  line-height: 2.2;
}

.separator {
  margin: 0 0.5rem;
  color: var(--border-color);
}

.translation-info {
  font-style: italic;
  color: var(--footer-color);
}

.language-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.language-links a {
  margin-right: 0.5rem;
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  font-size: 0.9rem;
  transition: background-color 0.2s ease;
}

.language-links a:hover {
  background-color: var(--subtle-bg);
}

/* About page styling */
.about-content {
  font-size: 1.1rem;
}

/* Footer with improved styling */
footer {
  margin-top: auto;
  padding: 2rem 0;
  border-top: 1px solid var(--border-color);
  font-size: 0.95rem;
  color: var(--footer-color);
  text-align: center;
  background-color: var(--subtle-bg);
}

footer p {
  margin: 0.5rem 0;
}

footer .footer-links {
  margin-top: 0.75rem;
  font-size: 0.9rem;
}

footer .footer-links a {
  color: var(--link-color);
  text-decoration: none;
  transition: color 0.2s ease;
}

footer .footer-links a:hover {
  color: var(--accent-color);
  text-decoration: underline;
}

/* RTL support with improved specificity */
html[dir="rtl"] body {
  text-align: right;
}

html[dir="rtl"] nav a {
  margin-right: 0;
  margin-left: 1.5rem;
}

html[dir="rtl"] h1::after {
  left: auto;
  right: 0;
}

html[dir="rtl"] nav a::after {
  left: auto;
  right: 0;
}

html[dir="rtl"] .note-list li {
  border-left: none;
  border-right: 3px solid var(--accent-color);
}

html[dir="rtl"] .language-links a {
  margin-right: 0;
  margin-left: 0.75rem;
}

html[dir="rtl"] .earth-emoji {
  margin-right: 0;
  margin-left: 0.5rem;
}

/* Responsive design with improved breakpoints */
@media (max-width: 768px) {
  html {
    font-size: 16px;
  }
  
  .container {
    padding: 0 1rem;
  }
  
  h1 {
    font-size: 2rem;
  }
  
  h2 {
    font-size: 1.6rem;
  }
  
  h3 {
    font-size: 1.3rem;
  }
}

@media (max-width: 640px) {
  nav {
    flex-direction: column;
    align-items: flex-start;
  }
  
  nav a {
    margin-bottom: 0.75rem;
  }
  
  .podcast-links {
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .podcast-link {
    width: 100%;
  }
  
  .language-selector {
    margin-left: 0;
    margin-top: 1rem;
    width: 100%;
  }
  
  .language-selector select {
    width: 100%;
  }
  
  .note-navigation {
    flex-direction: column;
    gap: 1rem;
  }
  
  .note-list li {
    padding: 1rem;
  }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Nostr infobox styling */
.nostr-infobox {
  margin: 1.5rem 0;
  padding: 1.5rem;
  background-color: var(--subtle-bg);
  border-radius: 8px;
  border-left: 3px solid var(--accent-color);
  font-size: 0.95rem;
  line-height: 1.6;
}

.nostr-infobox p {
  margin-bottom: 1rem;
}

.nostr-services {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.nostr-services button {
  padding: 0.5rem 1rem;
  background-color: var(--subtle-accent);
  color: var(--text-color);
  border: none;
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nostr-services button:hover {
  background-color: var(--accent-color);
  color: white;
  transform: translateY(-2px);
}

.nostr-services button:focus {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

/* RTL support for Nostr infobox */
html[dir="rtl"] .nostr-infobox {
  border-left: none;
  border-right: 3px solid var(--accent-color);
}

/* Responsive design for Nostr services */
@media (max-width: 640px) {
  .nostr-services {
    flex-direction: column;
  }
  
  .nostr-services button {
    width: 100%;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  :root {
    --text-color: #e2e8f0;
    --background-color: #1a202c;
    --accent-color: #7f9cf5;
    --link-color: #a3bffa;
    --border-color: #2d3748;
    --subtle-bg: #2d3748;
    --subtle-accent: #2a4365;
    --footer-color: #a0aec0;
    --focus-ring: #7f9cf555;
  }
  
  .note-list li {
    background-color: #2d3748;
  }
  
  .note-navigation a:hover {
    background-color: #2a4365;
  }
  
  img {
    filter: brightness(.8) contrast(1.2);
  }
}

/* Share section styling */
.share-section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

.share-section h3 {
  font-size: 1.2rem;
  margin-bottom: 1rem;
  color: var(--accent-color);
}

.share-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

.share-button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background-color: var(--subtle-bg);
  color: var(--text-color);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
  font-family: inherit;
  border-bottom: 1px solid var(--border-color);
}

.share-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border-bottom: 1px solid var(--border-color);
}

.share-button:focus {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
  border-bottom: 1px solid var(--border-color);
}

.share-button svg {
  flex-shrink: 0;
}

/* Platform-specific colors */
.share-button.facebook:hover {
  background-color: #1877f2;
  color: white;
  border-color: #1877f2;
}

.share-button.twitter:hover {
  background-color: #000000;
  color: white;
  border-color: #000000;
}

.share-button.whatsapp:hover {
  background-color: #25d366;
  color: white;
  border-color: #25d366;
}

.share-button.telegram:hover {
  background-color: #0088cc;
  color: white;
  border-color: #0088cc;
}

.share-button.native-share:hover {
  background-color: var(--accent-color);
  color: white;
  border-color: var(--accent-color);
}

/* RTL support for share section */
html[dir="rtl"] .share-buttons {
  direction: rtl;
}

html[dir="rtl"] .share-button {
  flex-direction: row-reverse;
}

/* Responsive design for share buttons */
@media (max-width: 640px) {
  .share-buttons {
    flex-direction: column;
  }
  
  .share-button {
    width: 100%;
    justify-content: center;
  }
}

/* Dark mode support for share buttons */
@media (prefers-color-scheme: dark) {
  .share-button {
    background-color: var(--subtle-bg);
    border-color: var(--border-color);
  }
  
  .share-button:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  }
}