/* Local Font Faces */
@font-face {
  font-family: 'Libre Baskerville';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/libre-baskerville-regular.ttf') format('truetype');
}

@font-face {
  font-family: 'Libre Baskerville';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/libre-baskerville-bold.ttf') format('truetype');
}

@font-face {
  font-family: 'Libre Baskerville';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/libre-baskerville-italic.ttf') format('truetype');
}

@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/roboto-regular.ttf') format('truetype');
}

@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/roboto-bold.ttf') format('truetype');
}

@font-face {
  font-family: 'Roboto';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/roboto-italic.ttf') format('truetype');
}

/* CSS Variables for Theming */
/*
 * Color Palette Options (uncomment to switch):
 *
 * Sea Green (previous):
 *   Dark:  --link-color: #2e8b57;
 *   Light: --link-color: #228b22;
 *
 * Teal/Blue-Green (current - 2026 trend):
 *   Dark:  --link-color: #2dd4bf;
 *   Light: --link-color: #0d9488;
 *
 * Emerald:
 *   Dark:  --link-color: #50c878;
 *   Light: --link-color: #047857;
 *
 * Original Orange:
 *   Dark:  --link-color: #cf5c10;
 *   Light: --link-color: #8b4513;
 */
:root {
  --bg-color: #0c0a09;
  --text-color: #e0e0e0;
  --heading-color: #f5f5f5;
  --border-color: #404040;
  --link-color: #3cb371;
  --meta-color: #a0a0a0;
  --header-border: #505050;
  --font-family:
    "Libre Baskerville", Garamond, "Times New Roman", Georgia, serif;
  transition:
    background-color 0.3s ease,
    color 0.3s ease;
}

[data-theme="light"] {
  --bg-color: #fafaf8;
  --text-color: #333;
  --heading-color: #222;
  --border-color: #e0e0e0;
  --link-color: #1e7b1e;
  --meta-color: #666;
  --header-border: #ddd;
}

[data-font="sans-serif"] {
  --font-family: "Roboto", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  line-height: 1.8;
  color: var(--text-color);
  background-color: var(--bg-color);
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  transition:
    background-color 0.3s ease,
    color 0.3s ease,
    font-family 0.3s ease;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 700;
  line-height: 1.3;
  margin-top: 2rem;
  margin-bottom: 1rem;
  color: var(--heading-color);
}

h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

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

h3 {
  font-size: 1.5rem;
}

p {
  margin-bottom: 1.5rem;
  text-align: justify;
}

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

a:hover {
  opacity: 0.7;
}

/* Header */
header {
  text-align: center;
  padding: 2rem 0 0 0;
  margin-bottom: 3rem;
  position: relative;
  border-bottom: 4px solid var(--header-border);
}

header h1 {
  margin: 0;
  font-size: 3.5rem;
}

header p {
  font-style: italic;
  color: var(--meta-color);
  margin: 0.5rem 0 0 0;
}

/* Navigation */
nav {
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
}

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

nav a {
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 1.1rem;
  font-weight: 700;
}

/* Story List */
.story-list {
  margin: 2rem 0;
}

.story-item {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.story-item:last-child {
  border-bottom: none;
}

.story-title {
  margin-bottom: 0.5rem;
}

.story-meta {
  font-size: 0.9rem;
  color: var(--meta-color);
  font-style: italic;
  margin-bottom: 1rem;
}

.story-summary {
  margin-bottom: 0;
}

.read-more {
  font-weight: 700;
  font-size: 0.95rem;
}

/* Single Story */
.story-header {
  text-align: center;
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 2px solid var(--border-color);
}

.story-header h1 {
  margin-top: 0;
  font-size: 2.5rem;
}

.story-content p {
  text-indent: 2rem;
}

.no-indent p {
  text-indent: 0;
}

.static-page h1 {
  text-align: center;
}

.page-content h2 {
  text-align: left;
}

hr.story-divider {
  display: block;
  width: 50%;
  height: 0;
  margin: 2rem auto;
  border: none;
  border-top: 2px solid var(--border-color);
}

/* Story Footer */
.story-footer {
  height: 50vh;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 4rem;
}

.story-end-note {
  font-size: 0.75rem;
  color: var(--meta-color);
  font-style: italic;
  opacity: 0.6;
  text-align: center;
  margin-bottom: 0;
}

/* Footer */
footer {
  margin-top: 4rem;
  padding: 2rem 0 0 0;
  text-align: center;
  font-size: 0.9rem;
  color: var(--meta-color);
  border-top: 4px solid var(--header-border);
}

/* Theme and Font Toggles */
.theme-toggle,
.font-toggle {
  position: absolute;
  top: 2rem;
  background: none;
  border: 2px solid var(--border-color);
  color: var(--text-color);
  font-family: var(--font-family);
  font-size: 1.1rem;
  padding: 0.5rem 1rem;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.3s ease;
}

.theme-toggle {
  right: 0;
  width: 2.75rem !important;
  min-width: 2.75rem !important;
  max-width: 2.75rem !important;
  height: 2.5rem !important;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.font-toggle {
  right: 3.25rem;
  width: 2.75rem !important;
  min-width: 2.75rem !important;
  max-width: 2.75rem !important;
  height: 2.5rem !important;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-family: sans-serif;
}

.theme-toggle:hover,
.font-toggle:hover {
  background-color: var(--border-color);
  transform: translateY(-2px);
}

.theme-toggle:active,
.font-toggle:active {
  transform: translateY(0);
}

.font-toggle-icon {
  font-weight: 700;
  letter-spacing: 1px;
  display: inline-block;
  min-width: 1ch;
  text-align: center;
}

.font-toggle-icon .serif-icon,
.font-toggle-icon .sans-icon {
  display: none;
}

.theme-toggle-icon {
  display: inline-flex;
  align-items: center;
  line-height: 1;
  vertical-align: middle;
}

.theme-toggle-icon svg {
  display: none;
  vertical-align: middle;
}

/* Tags */
.story-tags {
  margin-top: 1rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.tag {
  display: inline;
  font-size: 1rem;
  font-weight: 400;
  text-transform: lowercase;
  color: var(--link-color);
  transition: opacity 0.2s ease;
}

.tag:hover {
  opacity: 0.7;
}

.tags-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.tag-card {
  display: block;
  padding: 1.5rem;
  border: 2px solid var(--border-color);
  border-radius: 4px;
  transition: border-color 0.3s ease;
  text-decoration: none;
}

.tag-card:hover {
  border-color: var(--link-color);
  opacity: 1;
}

.tag-card h2 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-size: 1.5rem;
  border-bottom: none;
  text-transform: capitalize;
  color: var(--link-color);
}

.tag-count {
  color: var(--meta-color);
  font-size: 0.9rem;
  margin: 0;
}

.tag-description {
  color: var(--meta-color);
  font-style: italic;
  text-align: center;
  margin-bottom: 2rem;
}

.tag-link {
  color: var(--link-color);
  font-size: 0.9rem;
  text-transform: lowercase;
}

main h1,
main > section > h2,
.home h2,
.tag-page h1,
.tags-overview h1 {
  text-align: center;
}

/* Responsive */
@media (max-width: 600px) {
  body {
    padding: 1rem;
  }

  h1 {
    font-size: 2rem;
  }

  header {
    padding-top: 4rem;
  }

  header h1 {
    font-size: 2.75rem;
  }

  nav ul {
    flex-direction: column;
    gap: 1rem;
  }

  .theme-toggle,
  .font-toggle {
    top: 1rem;
  }

  .theme-toggle {
    right: 0;
  }

  .font-toggle {
    right: 3.25rem;
  }
}
