/* ============================================================
   REDEMPTION NATIONAL — Main Stylesheet
   ============================================================ */

:root {
  --bg:           #faf9f7;
  --bg-subtle:    #f3f1ed;
  --text:         #2c2c2c;
  --text-muted:   #5a5a5a;
  --border:       #ddd8d0;
  --nav-bg:       #1a1a1a;
  --nav-text:     #f5f5f5;
  --accent:       #8b4513;
  --accent-dark:  #5c2d0e;
  --accent-light: #f5ebe0;
  --link:         #6b3a1f;
  --link-hover:   #4a2710;
  --font-body:    georgia, 'Times New Roman', times, serif;
  --font-ui:      -apple-system, blinkmacsystemfont, 'Segoe UI', roboto, sans-serif;
  --max-width:    1100px;
  --article-width: 720px;
  --spacing-section: 3rem;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }

/* --- Skip Link --- */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  background: var(--accent);
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: 0 0 4px 4px;
  font-size: 0.875rem;
  font-weight: 600;
  z-index: 200;
  text-decoration: none;
}
.skip-link:focus { top: 0; color: #fff; text-decoration: none; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* --- Navigation --- */
.nav {
  background: var(--nav-bg);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 3px solid var(--accent);
}

.nav__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.nav__logo {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
  color: var(--nav-text);
  text-decoration: none;
}
.nav__logo:hover { color: var(--nav-text); text-decoration: none; }
.nav__logo span { color: var(--accent); font-style: italic; }

.nav__links {
  list-style: none;
  display: flex;
  gap: 1.5rem;
  align-items: center;
}
.nav__links a {
  color: var(--nav-text);
  font-size: 0.875rem;
  font-weight: 500;
}
.nav__links a:hover { color: #fff; text-decoration: underline; }

.nav__dropdown { position: relative; }
.nav__dropdown-toggle {
  background: none;
  border: none;
  color: var(--nav-text);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font-ui);
}
.nav__dropdown-toggle:hover { color: #fff; }

.nav__dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--nav-bg);
  border: 1px solid #333;
  border-radius: 4px;
  padding: 0.5rem 0;
  min-width: 160px;
  list-style: none;
  z-index: 101;
}
.nav__dropdown-menu[data-open] { display: block; }
.nav__dropdown-menu a {
  display: block;
  padding: 0.4rem 1rem;
  color: var(--nav-text);
  font-size: 0.8rem;
}
.nav__dropdown-menu a:hover { background: #333; }

/* --- Page Layout --- */
.page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.home-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 2.5rem;
  align-items: start;
}

@media (max-width: 768px) {
  .home-layout {
    grid-template-columns: 1fr;
  }
}

/* --- Home Header --- */
.home-header {
  margin-bottom: 2rem;
}
.home-header__title {
  font-family: var(--font-body);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.home-header__description {
  color: var(--text-muted);
  font-size: 1rem;
  margin-top: 0.25rem;
}

/* --- Hero --- */
.home-hero {
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 2rem;
}
.home-hero__image {
  width: 100%;
  border-radius: 4px;
  aspect-ratio: 16/9;
  object-fit: cover;
}
.home-hero__body { margin-top: 1rem; }
.home-hero__meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.home-hero__title {
  font-family: var(--font-body);
  font-size: 1.5rem;
  line-height: 1.3;
}
.home-hero__title a { color: var(--text); }
.home-hero__title a:hover { color: var(--accent); text-decoration: none; }
.home-hero__subtitle {
  color: var(--text-muted);
  margin-top: 0.5rem;
  font-size: 0.95rem;
}

/* --- Sidebar --- */
.home-sidebar {
  position: sticky;
  top: 80px;
}

.sidebar-widget {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.sidebar-widget__label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.sidebar-widget__empty {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.sidebar-projects {
  list-style: none;
}
.sidebar-projects li {
  margin-bottom: 0.75rem;
}
.sidebar-projects a {
  font-weight: 600;
  font-size: 0.9rem;
}
.sidebar-projects__desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.sidebar-recent {
  list-style: none;
}
.sidebar-recent li {
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  line-height: 1.4;
}

/* --- Search & Filters --- */
.search-filters {
  margin-bottom: 2rem;
}
.search-filters__input {
  width: 100%;
  padding: 0.6rem 1rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.9rem;
  background: #fff;
  font-family: var(--font-ui);
}
.search-filters__input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}
.search-filters__group {
  margin-top: 0.75rem;
}
.search-filters__label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-right: 0.5rem;
}
.search-filters__pills {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.search-filters__pill {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
  font-family: var(--font-ui);
  cursor: pointer;
  color: var(--text-muted);
}
.search-filters__pill--active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* --- Article List --- */
.article-list {
  list-style: none;
}
.article-card {
  border-bottom: 1px solid var(--border);
  padding: 1.25rem 0;
}
.article-card:first-child { padding-top: 0; }
.article-card__meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}
.article-card__category {
  background: var(--accent-light);
  color: var(--accent-dark);
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  text-decoration: none;
}
.article-card__category:hover { text-decoration: none; background: var(--accent); color: #fff; }
.article-card__title {
  font-family: var(--font-body);
  font-size: 1.15rem;
  line-height: 1.3;
}
.article-card__title a { color: var(--text); }
.article-card__title a:hover { color: var(--accent); text-decoration: none; }
.article-card__excerpt {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 0.3rem;
  line-height: 1.5;
}
.article-card__readmore {
  font-size: 0.8rem;
  font-weight: 600;
  margin-top: 0.5rem;
  display: inline-block;
}
.article-list__empty {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
}
.article-list__clear {
  display: block;
  margin: 0.5rem auto 0;
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.85rem;
}

/* --- Article Page --- */
.page--article {
  max-width: var(--article-width);
}

.article-header {
  margin-bottom: 2rem;
}
.article-header__meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}
.article-header__title {
  font-family: var(--font-body);
  font-size: 2rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
}
.article-header__subtitle {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}
.article-header__author {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
}

.article-hero {
  margin-bottom: 2rem;
}
.article-hero img {
  border-radius: 4px;
  width: 100%;
}

/* --- Prose --- */
.prose {
  font-family: var(--font-body);
  font-size: 1.05rem;
  line-height: 1.75;
}
.prose p { margin-bottom: 1.25rem; }
.prose h2 {
  font-size: 1.4rem;
  margin: 2rem 0 0.75rem;
  font-family: var(--font-ui);
  font-weight: 700;
}
.prose h3 {
  font-size: 1.15rem;
  margin: 1.5rem 0 0.5rem;
  font-family: var(--font-ui);
  font-weight: 600;
}
.prose blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 1.25rem;
  margin: 1.5rem 0;
  color: var(--text-muted);
  font-style: italic;
}
.prose ul, .prose ol {
  margin: 1rem 0 1.25rem 1.5rem;
}
.prose li { margin-bottom: 0.4rem; }
.prose img {
  border-radius: 4px;
  margin: 1.5rem 0;
}
.prose hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

/* Source reference spans */
.source-ref {
  border-bottom: 1px dashed var(--accent);
  cursor: help;
}

/* Figure shortcode */
.article-figure {
  margin: 1.5rem 0;
}
.article-figure img {
  border-radius: 4px;
  width: 100%;
}
.article-figure figcaption {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  font-family: var(--font-ui);
}

/* --- Related --- */
.article-related {
  border-top: 1px solid var(--border);
  margin-top: 3rem;
  padding-top: 1.5rem;
}
.article-related__title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}
.article-related__list {
  list-style: none;
}
.article-related__list li {
  margin-bottom: 0.5rem;
}
.article-related__list a {
  font-size: 0.95rem;
}

/* --- Footer --- */
.footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.5rem;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* --- Projects Pages --- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.project-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.5rem;
  transition: box-shadow 0.2s;
}
.project-card:hover {
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}
.project-card__title {
  font-family: var(--font-body);
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}
.project-card__title a { color: var(--text); }
.project-card__title a:hover { color: var(--accent); text-decoration: none; }
.project-card__desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.project-card__tag {
  display: inline-block;
  margin-top: 0.75rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--accent-light);
  color: var(--accent-dark);
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
}
.project-card--thumbnail {
  padding: 0;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  display: block;
  max-width: 600px;
}
.project-card--thumbnail:hover {
  text-decoration: none;
}
.project-card__image {
  width: 100%;
  aspect-ratio: 2 / 1;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}
.project-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.project-card__body {
  padding: 1.25rem 1.5rem;
}
.project-card__meta {
  display: block;
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* --- Category Page --- */
.category-header {
  margin-bottom: 2rem;
}
.category-header__title {
  font-family: var(--font-body);
  font-size: 1.75rem;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .nav__inner { height: 48px; }
  .nav__links { gap: 0.75rem; }
  .nav__links a, .nav__dropdown-toggle { font-size: 0.8rem; }
  .home-header__title { font-size: 1.5rem; }
  .article-header__title { font-size: 1.5rem; }
  .home-sidebar { position: static; }
  .projects-grid { gap: 1rem; }
  .project-card--thumbnail { max-width: 100%; }
}

@media (max-width: 480px) {
  .nav__inner {
    height: auto;
    flex-wrap: wrap;
    padding: 0.5rem 1rem;
    gap: 0.25rem;
  }
  .nav__logo { font-size: 1.05rem; }
  .nav__links { gap: 0.5rem; flex-wrap: wrap; }
  .nav__links a, .nav__dropdown-toggle { font-size: 0.75rem; }
  .page { padding: 1.5rem 1rem; }
  .home-layout { gap: 1.5rem; }
  .prose { font-size: 1rem; }
}
