@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700&family=Syne:wght@500;600;700;800&display=swap");

:root {
  --forest: #1a2f23;
  --forest-light: #2a4435;
  --sage: #7c8c7f;
  --sage-light: #9eada1;
  --earth-beige: #f9f8f3;
  --earth-dark: #d6d0c2;
  --charcoal: #121212;
  --gold: #c59b27;
  --muted-teal: #3b6f75;
  --paper: #fdfcfb;
  --danger: #401212;
  --font-serif: "Syne", sans-serif;
  --font-sans: "DM Sans", sans-serif;
  --font-mono: "DM Sans", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: #fbf8f2;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(251, 248, 242, 0.18));
  color: var(--charcoal);
  font-family: var(--font-sans);
}

body,
button,
input,
select,
textarea {
  font-family: var(--font-sans);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(251, 248, 242, 0.18));
  pointer-events: none;
}

#site-shell {
  position: relative;
  z-index: 0;
  background: transparent;
}

body.menu-open {
  overflow: hidden;
}

img,
video {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-serif);
  overflow-wrap: anywhere;
}

p,
li,
a,
span,
strong,
figcaption {
  overflow-wrap: anywhere;
}

button {
  border: 0;
}

::selection {
  background: rgba(124, 140, 127, 0.2);
  color: var(--forest);
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--earth-beige);
}

::-webkit-scrollbar-thumb {
  background: var(--sage-light);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--sage);
}

.container {
  width: min(100% - 2rem, 80rem);
  margin: 0 auto;
}

.narrow {
  width: min(100% - 2rem, 64rem);
}

.site-main {
  padding-top: 0;
  padding-bottom: 2.5rem;
  overflow-x: clip;
}

.page-stack {
  display: grid;
  gap: 4rem;
}

.section-block {
  display: grid;
  gap: 1.5rem;
  min-width: 0;
  padding: 1.1rem;
  border: 1px solid rgba(26, 47, 35, 0.08);
  border-radius: 0;
  background: rgba(251, 248, 242, 0.84);
  box-shadow: none;
  backdrop-filter: none;
}

.section-header {
  display: grid;
  gap: 0.5rem;
  border-bottom: 1px solid rgba(26, 47, 35, 0.15);
  padding-bottom: 1rem;
}

.section-header span,
.archive-bar span,
.desk-banner span,
.explainer-banner span,
.video-division-banner span,
.mission-card span {
  color: var(--sage);
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.section-header h1,
.section-header h2,
.section-header h3,
.center-title {
  margin: 0;
  color: var(--forest);
  font-family: var(--font-serif);
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.05;
  letter-spacing: 0;
}

.section-header p {
  max-width: 42rem;
  margin: 0;
  color: var(--sage);
  font-size: 0.9rem;
  line-height: 1.7;
}

.section-header h1 {
  font-size: clamp(2.4rem, 5vw, 4rem);
}

.section-header span {
  width: fit-content;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 2.75rem;
  padding: 0.8rem 1.35rem;
  border-radius: 0.375rem;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transition: background-color 220ms ease, color 220ms ease, border-color 220ms ease, transform 220ms ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-gold {
  background: var(--gold);
  color: var(--forest);
}

.btn-gold:hover {
  background: #b6871e;
}

.btn-outline-light {
  border: 1px solid var(--sage-light);
  color: var(--earth-beige);
}

.btn-outline-light:hover {
  background: rgba(249, 248, 243, 0.1);
}

.btn-forest {
  background: var(--forest);
  color: var(--earth-beige);
}

.btn-forest:hover {
  background: var(--forest-light);
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.85); }
}

.archive-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  border-bottom: 1px solid rgba(26, 47, 35, 0.15);
  padding-bottom: 0.5rem;
}

@media (max-width: 900px) {
  .container,
  .narrow {
    width: min(100% - 1.5rem, 80rem);
  }

  .page-stack {
    gap: 2.5rem;
  }
}

@media (max-width: 768px) {
  .site-main {
    padding-bottom: 2rem;
  }

  .section-block {
    gap: 1.25rem;
    padding: 0.95rem;
  }

  .section-header h1,
  .section-header h2,
  .section-header h3,
  .center-title {
    font-size: clamp(1.65rem, 8vw, 2.35rem);
    line-height: 1.08;
  }

  .section-header p {
    font-size: 0.92rem;
    line-height: 1.6;
  }
}

@media (max-width: 560px) {
  .container,
  .narrow {
    width: min(100% - 1rem, 80rem);
  }

  .page-stack {
    gap: 1.85rem;
  }

  .section-block {
    padding: 0.85rem;
  }

  .archive-bar {
    align-items: flex-start;
    gap: 0.65rem;
  }

  .article-card.list {
    padding-inline: 0;
  }

  .card-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .pagination a {
    min-width: 2.35rem;
    min-height: 2.35rem;
    font-size: 0.8rem;
  }
}

.archive-bar strong {
  border-radius: 999px;
  background: rgba(124, 140, 127, 0.1);
  color: var(--sage);
  padding: 0.15rem 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.74rem;
}

.article-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem;
}

.article-grid.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.article-list {
  display: grid;
  gap: 0;
}

.article-card {
  display: flex;
  min-width: 0;
  height: 100%;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(26, 47, 35, 0.15);
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.82);
  transition: border-color 300ms ease, box-shadow 300ms ease, background 300ms ease;
}

.article-card:hover {
  border-color: rgba(26, 47, 35, 0.3);
  box-shadow: 0 4px 18px rgba(26, 47, 35, 0.06);
}

.article-card.list {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
  gap: 2rem;
  border-width: 0 0 1px;
  border-radius: 0.5rem;
  background: transparent;
  padding: 2rem 0.5rem;
}

.article-card.list:hover {
  background: rgba(26, 47, 35, 0.02);
  box-shadow: none;
}

.article-media {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 15rem;
  width: 100%;
  overflow: hidden;
  border-bottom: 1px solid rgba(26, 47, 35, 0.15);
  background: linear-gradient(180deg, #f4efe5 0%, #e8e3d6 100%);
}

.article-card.list .article-media {
  min-height: 18rem;
  border: 1px solid rgba(26, 47, 35, 0.15);
  border-radius: 0.5rem;
}

.article-media img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  padding: 0;
  background: linear-gradient(180deg, #f4efe5 0%, #e8e3d6 100%);
}

.article-card:hover .article-media img {
  transform: none;
}

.card-content {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem;
}

.article-card.list .card-content {
  padding: 0.25rem 0 0;
}

.meta-row,
.card-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  color: var(--sage);
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.card-footer {
  justify-content: space-between;
  border-top: 1px solid rgba(26, 47, 35, 0.1);
  padding-top: 0.75rem;
}

.category-pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(26, 47, 35, 0.15);
  border-radius: 0.25rem;
  background: rgba(26, 47, 35, 0.05);
  color: var(--forest);
  padding: 0.2rem 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.category-pill.news {
  border-color: rgba(23, 59, 45, 0.32);
  background: rgba(23, 59, 45, 0.08);
  color: #173b2d;
}

.category-pill.explained {
  border-color: rgba(197, 155, 39, 0.3);
  background: #ede5d5;
  color: var(--gold);
}

.article-card h3 {
  margin: 0.45rem 0 0;
  color: var(--forest);
  font-family: var(--font-serif);
  font-size: clamp(1.1rem, 2vw, 1.45rem);
  line-height: 1.18;
  transition: color 300ms ease;
}

.article-card:hover h3 {
  color: var(--gold);
}

.article-card p {
  display: -webkit-box;
  margin: 0.5rem 0 0;
  overflow: hidden;
  color: #4a4947;
  font-size: 0.85rem;
  line-height: 1.65;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.author-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--forest);
  font-size: 0.7rem;
  font-weight: 700;
}

.author-chip img {
  width: 1.35rem;
  height: 1.35rem;
  border: 1px solid rgba(26, 47, 35, 0.15);
  border-radius: 999px;
  object-fit: cover;
}

.read-link {
  color: var(--sage);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition: color 240ms ease;
}

.read-link:hover {
  color: var(--gold);
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  justify-items: center;
  gap: 2rem;
}

.video-card {
  position: relative;
  width: 100%;
  max-width: 18.125rem;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  border: 1px solid rgba(124, 140, 127, 0.2);
  border-radius: 0.75rem;
  background: rgba(18, 40, 30, 0.88);
  color: var(--earth-beige);
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(18, 40, 30, 0.18);
  transition: border-color 300ms ease, box-shadow 300ms ease;
}

.video-card:hover {
  border-color: rgba(197, 155, 39, 0.4);
  box-shadow: 0 20px 42px rgba(18, 40, 30, 0.25);
}

.video-card img,
.video-card video,
.video-card iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 500ms ease, transform 700ms ease;
}

body[data-page="home"] .article-media {
  background: linear-gradient(180deg, #f4efe5 0%, #e8e3d6 100%);
}

body[data-page="home"] .article-media img,
.video-card img,
.video-card video,
.video-card iframe {
  object-fit: contain;
  object-position: center;
  padding: 0;
}

.video-card:hover img {
  transform: scale(1.05);
}

.video-card video {
  opacity: 0;
  z-index: 2;
}

.video-card iframe {
  opacity: 0;
  z-index: 2;
  border: 0;
  pointer-events: none;
  background: #000;
}

.instagram-embed-host {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 0.75rem;
  opacity: 0;
  pointer-events: none;
  background: #fff;
}

.instagram-embed-host blockquote.instagram-media {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  margin: 0 !important;
}

.video-card.playing video {
  opacity: 1;
}

.video-card.playing iframe {
  opacity: 1;
  pointer-events: auto;
}

.video-card.playing .instagram-embed-host {
  opacity: 1;
  pointer-events: auto;
}

.video-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1rem;
  background: linear-gradient(to top, rgba(26, 47, 35, 0.92), transparent 50%, rgba(26, 47, 35, 0.35));
}

.play-button {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  width: 3.5rem;
  height: 3.5rem;
  place-items: center;
  border: 1px solid rgba(197, 155, 39, 0.4);
  border-radius: 999px;
  background: rgba(26, 47, 35, 0.86);
  color: var(--gold);
  transform: translate(-50%, -50%);
  transition: opacity 300ms ease, transform 300ms ease, background 300ms ease, color 300ms ease;
}

.video-card:hover .play-button {
  background: var(--gold);
  color: var(--forest);
  transform: translate(-50%, -50%) scale(1.08);
}

.video-card.playing .play-button {
  opacity: 0;
}

.video-card.playing > img,
.video-card.playing .video-overlay {
  opacity: 0;
  pointer-events: none;
}

.instagram-article-embed {
  display: flex;
  justify-content: center;
  width: 100%;
  min-height: 37.5rem;
  padding: 1rem 0;
}

.instagram-article-embed blockquote.instagram-media {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 33.75rem !important;
  margin: 0 auto !important;
}

.video-overlay h3 {
  margin: 0;
  color: white;
  font-family: var(--font-serif);
  font-size: 0.95rem;
  line-height: 1.2;
  transition: color 300ms ease;
}

.video-card:hover h3 {
  color: var(--gold);
}

.video-overlay p {
  display: -webkit-box;
  overflow: hidden;
  margin: 0.45rem 0 0;
  color: #cac4b7;
  font-size: 0.72rem;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.video-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  color: #8fa89b;
  font-family: var(--font-mono);
  font-size: 0.58rem;
}

.progress-track {
  height: 4px;
  margin-top: 0.55rem;
  overflow: hidden;
  border-radius: 999px;
  background: #1a3d2c;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--gold);
}

.loading-state,
.empty-state,
.error-state {
  border: 1px solid rgba(26, 47, 35, 0.15);
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.82);
  padding: 3rem 1.5rem;
  color: var(--sage);
  text-align: center;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.55rem;
  padding-top: 1rem;
}

.pagination a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.6rem;
  min-height: 2.6rem;
  border: 1px solid rgba(26, 47, 35, 0.15);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--forest);
  font-size: 0.86rem;
  font-weight: 700;
}

.pagination a.active {
  background: var(--forest);
  color: var(--earth-beige);
  border-color: var(--forest);
}

.empty-state h2,
.error-state h2 {
  margin: 0 0 0.5rem;
  color: var(--forest);
  font-family: var(--font-serif);
}

.fade-in {
  animation: fadeIn 500ms ease both;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 1024px) {
  .article-grid,
  .video-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .site-main {
    padding-top: 0;
  }

  .article-grid,
  .article-grid.two-col,
  .video-grid {
    grid-template-columns: 1fr;
  }

  .article-card.list {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .article-media {
    min-height: 13rem;
  }
}
