/* ReMarx layout: header, hero, sections, search, pagination, article, footer */

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--navy);
  color: var(--white);
  border-bottom: 3px solid var(--red);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
}

.wordmark {
  display: flex;
  flex-direction: column;
  line-height: 1;
  text-decoration: none;
  color: var(--white);
}
.wordmark__name {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.75rem;
  letter-spacing: 0.02em;
}
.wordmark__org {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--gold);
  margin-top: 4px;
}
.wordmark:hover { color: var(--white); }
.wordmark:hover .wordmark__name { color: var(--gold); }

.site-nav {
  display: flex;
  align-items: center;
  gap: 28px;
}
.site-nav a {
  color: #e6e6ee;
  text-decoration: none;
  font-weight: 500;
  padding: 6px 0;
  border-bottom: 2px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.site-nav a:hover {
  color: var(--red);
  border-bottom-color: var(--red);
}

.site-nav a[aria-current="page"] {
  color: var(--white);
  border-bottom-color: var(--red);
}

.site-nav .site-nav__main {
  border: 2px solid var(--red);
  border-radius: 8px;
  padding: 8px 16px;
  background: var(--red);
  color: var(--white);
}
.site-nav .site-nav__main:hover {
  background: var(--red-dark);
  border-color: var(--red-dark);
  color: var(--white);
}

.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  position: relative;
}
.nav-toggle__bar {
  position: absolute;
  left: 10px;
  right: 10px;
  height: 2px;
  background: var(--white);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.2s ease, top 0.25s ease;
}
.nav-toggle__bar:nth-child(1) { top: 14px; }
.nav-toggle__bar:nth-child(2) { top: 21px; }
.nav-toggle__bar:nth-child(3) { top: 28px; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(1) { top: 21px; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(3) { top: 21px; transform: rotate(-45deg); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(115deg, rgba(198, 40, 40, 0.28) 0%, rgba(198, 40, 40, 0) 45%),
    var(--navy);
  color: var(--white);
  padding: 96px 0 104px;
}

.hero::after {
  content: '☭';
  position: absolute;
  right: 2rem;
  bottom: -1.5rem;
  font-size: 12rem;
  line-height: 1;
  opacity: 0.06;
  color: #fff;
  pointer-events: none;
  z-index: 0;
}
.hero__inner {
  max-width: var(--container);
  position: relative;
  z-index: 1;
}
.hero__title {
  font-weight: 700;
  font-size: clamp(2.4rem, 6vw, 4.5rem);
  line-height: 1.05;
  letter-spacing: 0.005em;
  max-width: 14em;
  margin-bottom: 0.45em;
}
.hero__title-line {
  display: block;
  color: var(--gold);
}
.hero__lead {
  max-width: 40em;
  font-size: 1.15rem;
  color: #d9d9e4;
  margin-bottom: 2rem;
}
.hero__actions { display: flex; flex-wrap: wrap; gap: 14px; }

/* ---------- Page head (archive) ---------- */
.page-head {
  background: var(--navy);
  color: var(--white);
  padding: 56px 0 52px;
}
.page-head__title {
  font-size: clamp(2rem, 4.5vw, 3rem);
  font-weight: 700;
  margin-bottom: 0.25em;
}
.page-head__lead { color: #d9d9e4; margin: 0; font-size: 1.1rem; }

/* ---------- Sections ---------- */
.section { padding: 72px 0 88px; }
.section--tight { padding-top: 48px; }
.section-title {
  font-size: clamp(1.75rem, 3.5vw, 2.4rem);
  font-weight: 700;
  margin-bottom: 24px;
  padding-left: 16px;
  border-left: 5px solid var(--red);
}
.section-cta { text-align: center; margin-top: 48px; }
.empty-state,
.no-results {
  text-align: center;
  color: var(--muted);
  padding: 48px 16px;
  font-size: 1.1rem;
  margin: 0;
}

/* ---------- Search ---------- */
.search-bar {
  position: relative;
  max-width: 560px;
  margin: 0 0 12px;
}
.search-bar__icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.search-bar__input {
  width: 100%;
  height: 52px;
  padding: 0 16px 0 46px;
  font: inherit;
  color: var(--text);
  background: var(--white);
  border: 1px solid rgba(30, 30, 42, 0.25);
  border-radius: 10px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.search-bar__input:hover { border-color: var(--red); }
.search-bar__input:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(245, 176, 65, 0.55);
}
.search-status {
  min-height: 1.5em;
  margin: 0 0 20px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--muted);
}

/* Search mode: swap the normal grid for live results */
.search-results { display: none; }
body.is-searching .search-results { display: grid; }
body.is-searching #card-grid,
body.is-searching [data-hide-on-search] { display: none; }

/* ---------- Pagination ---------- */
.pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 56px;
}
.pagination__item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 44px;
  padding: 0 14px;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  text-decoration: none;
  color: var(--text);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
a.pagination__item:hover { border-color: var(--red); color: var(--red); }
.pagination__item[aria-current="page"] {
  background: var(--red);
  border-color: var(--red);
  color: var(--white);
}
.pagination__item[aria-disabled="true"] { color: #9a9aa8; background: transparent; }
.pagination__item--gap { border-color: transparent; background: transparent; min-width: 24px; padding: 0; }

/* ---------- Article ---------- */
.article { padding: 48px 0 24px; }
.article__back {
  display: inline-block;
  margin-bottom: 28px;
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
}
.article__back:hover { text-decoration: underline; }
.article__category {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--red);
  margin: 0 0 10px;
}
.article__title {
  font-size: clamp(2rem, 5vw, 3.1rem);
  font-weight: 700;
  margin-bottom: 0.3em;
}
.article__meta {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 32px;
}
.article__image {
  display: block;
  width: 100%;
  max-height: 440px;
  object-fit: cover;
  border-radius: var(--radius);
  margin: 0 0 36px;
}

.prose { font-size: 1.1rem; line-height: 1.8; }
.prose h2 { font-size: 1.9rem; margin: 2em 0 0.5em; }
.prose h3 { font-size: 1.4rem; margin: 1.8em 0 0.5em; }
.prose ul,
.prose ol { padding-left: 1.4em; margin: 0 0 1.2em; }
.prose li { margin-bottom: 0.4em; }
.prose a { text-underline-offset: 3px; }
.prose blockquote {
  margin: 1.6em 0;
  padding: 4px 0 4px 20px;
  border-left: 4px solid var(--red);
  color: #333340;
}
.prose blockquote p:last-child { margin-bottom: 0; }
.prose img { border-radius: 8px; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.5em 0; }
.prose code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: rgba(30, 30, 42, 0.07);
  padding: 2px 6px;
  border-radius: 4px;
}
.prose pre {
  overflow-x: auto;
  background: var(--navy);
  color: #eee;
  padding: 16px;
  border-radius: 8px;
}
.prose pre code { background: none; padding: 0; }
.prose table { display: block; overflow-x: auto; border-collapse: collapse; margin-bottom: 1.2em; }
.prose th,
.prose td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; }

.article__cta {
  margin-top: 40px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
}
.article__cta-text {
  font-size: 1rem;
  color: var(--muted);
  margin-bottom: 18px;
}
.article__socials {
  display: flex;
  gap: 18px;
  align-items: center;
}
.article__socials a {
  color: var(--muted);
  transition: color 0.2s ease, transform 0.2s ease;
}
.article__socials a:hover {
  color: var(--red);
  transform: translateY(-2px);
}
.article__socials svg {
  width: 22px;
  height: 22px;
  display: block;
}

.read-next { padding-top: 56px; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--navy);
  color: var(--footer-link);
  margin-top: 0;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr;
  gap: 48px;
  padding-top: 64px;
  padding-bottom: 56px;
}
.footer-heading {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--gold);
  margin-bottom: 16px;
}
.footer-col p { max-width: 30em; margin: 0; }
.footer-col ul { list-style: none; margin: 0; padding: 0; }
.footer-col li { margin-bottom: 10px; }
.site-footer a {
  color: var(--footer-link);
  text-decoration: none;
  transition: color 0.2s ease;
}
.site-footer a:hover { 
  color: var(--red); 
  text-decoration: underline; 
  text-underline-offset: 3px; 
}

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

.social-footer-list li {
  margin-bottom: 12px;
}

.social-footer-list li a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--footer-link);
  text-decoration: none;
  transition: color 0.2s ease;
}

.social-footer-list li a:hover {
  color: var(--red);
}

.social-footer-list li a svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: block;
  transition: color 0.2s ease;
}

.social-footer-list li a:hover svg {
  color: var(--red);
}

.social-footer-list li a span {
  line-height: 1.2;
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding: 20px 0;
  font-family: var(--font-mono);
  font-size: 0.8rem;
}
.footer-bottom p { margin: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  :root { --header-h: 62px; }

  .container { padding: 0 20px; }

  .nav-toggle { display: block; }
  .site-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--navy);
    padding: 8px 20px 20px;
    border-bottom: 3px solid var(--red);
  }
  .site-nav.is-open { display: flex; }
  .site-nav a {
    padding: 14px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }
  .site-nav a:hover,
  .site-nav a[aria-current="page"] { border-bottom-color: var(--red); }
  .site-nav .site-nav__main {
    margin-top: 14px;
    text-align: center;
    border-bottom: 2px solid var(--red);
  }

  .hero { padding: 64px 0 72px; }
  .section { padding: 48px 0 64px; }
  .search-bar { max-width: none; }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 36px;
    padding-top: 48px;
    padding-bottom: 40px;
  }
}
