/* Modern responsive card layout */

/* Color scheme variables */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #3f3f3f;
    --text-color: #e5e5e5;
    --card-bg: #2a2a2a;
    --accent: #1f1f1f;
    --link-color: #60a5fa;
    --link-hover-color: #3b82f6;
  }
}

@media (prefers-color-scheme: light),
not all and (prefers-color-scheme: dark) {
  :root {
    --bg-color: #fafafa;
    --text-color: #333;
    --card-bg: #fff;
    --accent: #fff;
    --link-color: #2563eb;
    --link-hover-color: #1d4ed8;
  }
}

.centered {
  text-align: center;
}

/* Global resets */
html,
body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  background: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
}

/* Header & Footer */
header,
footer {
  background: var(--accent);
  padding: 0.5rem 1rem;
  text-align: center;
}

/* Header layout – logo left, nav right */
div.site-header-bg {
  background: var(--accent);
  width: 100%
}

header.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  max-width: 960px;
  margin: 0 auto;
}

/* Logo styling – larger, bold */
.site-logo {
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--text-color);
  text-decoration: none;
}

/* Navigation inside header */
.site-nav {
  margin-top: 0.5rem;
  margin-right: 0.5rem;
}

.nav-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.nav-link {
  color: var(--text-color);
  text-decoration: none;
  font-weight: 400;
  font-size: 1rem;
}

.nav-link:hover {
  text-decoration: underline;
}

/* Main container */
main {
  max-width: 960px;
  margin: 2rem auto;
  padding: 0 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Links - modern styling */
a {
  color: var(--link-color);
  text-decoration: none;
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

a:hover {
  color: var(--link-hover-color);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

/* Card component */
.card,
.site-main .card,
.site-main section.card {
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  padding: 0.75rem 1.75rem 0.75rem 1.75rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Tag badges */
.tag-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag-item {
  display: inline-block;
}

.tag-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0.75rem;
  background: var(--card-bg);
  border: 1px solid var(--link-color);
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--link-color);
  text-decoration: none;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.tag-link:hover {
  background: var(--link-color);
  color: var(--card-bg);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

.reading-time {
  font-style: italic;
  font-size: 90%;
}

.story-font {
  font-family: ETBembo, "Chronicle Text G2", Palatino, "Palatino Linotype", "Palatino LT STD", "Book Antiqua", Georgia, serif;
}

.code-font {
  font-family: Menlo, Monaco, Consolas, "Andale Mono", "Ubuntu Mono", "Courier New", monospace;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 400;
}

/* Preview icon with text to the right */
.preview-icon-container {
  display: flex;
  flex-direction: row;
  gap: 1rem;
  margin-bottom: 1rem;
}

.preview-icon-container .preview-thumb {
  flex: 0 0 auto;
  width: 128px;
  height: auto;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
}

.preview-icon-container .preview-text {
  flex: 1 1 auto;
  min-width: 0;
}

/* Mobile: image above, full-width text below */
@media (max-width: 600px) {
  .preview-icon-container {
    flex-direction: column;
    align-items: center;
  }

  .preview-icon-container .preview-thumb {
    width: 100%;
    max-width: 256px;
  }

  .preview-icon-container .preview-text {
    width: 100%;
  }

  .preview-icon-container .preview-text h3 {
    margin-left: auto;
    margin-right: auto;
    max-width: 256px;
  }
}

.image-wrapper {
  text-align: center;
  margin: 2rem 0;
}

.image-wrapper .image {
  max-width: 66.666%;
  width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
  border-radius: 4px;
}

.image-wrapper figcaption {
  margin-top: 0.5rem;
  font-size: 0.875rem;
}
 
/* Mobile hamburger menu */
.nav-toggle {
  display: none;
  flex-direction: column;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  z-index: 100;
}

.nav-toggle-bar {
  width: 24px;
  height: 3px;
  background: var(--text-color);
  margin: 3px 0;
  transition: all 0.3s ease;
}

/* Mobile responsive: show hamburger, hide nav by default */
@media (max-width: 768px) {
  .nav-toggle {
    display: flex;
  }

  .site-nav {
    display: none;
    position: absolute;
    top: 60px;
    right: 0;
    left: 0;
    background: var(--accent);
    border-bottom: 1px solid rgba(0,0,0,0.1);
  }

  .site-nav.active {
    display: block;
  }

  .nav-list {
    flex-direction: column;
    gap: 0;
  }

  .nav-item {
    border-bottom: 1px solid rgba(0,0,0,0.1);
  }

  .nav-link {
    display: block;
    padding: 1rem 1.5rem;
  }

  .site-header {
    flex-wrap: wrap;
    padding: 0.5rem 1rem;
  }

  .site-logo {
    flex: 1;
    padding-right: 1rem;
  }
}

/* Animate hamburger to X when active */
.nav-toggle.active .nav-toggle-bar:nth-child(1) {
  transform: rotate(45deg) translate(5px, 6px);
}

.nav-toggle.active .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}

.nav-toggle.active .nav-toggle-bar:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -6px);
}
