:root {
  --bg: #fafcfa;
  --surface: #f1f3f0;
  --surface-hover: #e9ece8;
  --border: #e1e5df;
  --text: #1d231f;
  --muted: #5d665f;
  --accent: #3b6b4c;
  --badge-bg: #2f6fde;
  --past-bg: #8a918b;
  --footer-bg: #eef0ed;
  --radius: 12px;
  --max: 1160px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; }
img { max-width: 100%; }

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 24px; }
main { flex: 1; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: rgba(250, 252, 250, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 72px; }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 19px; letter-spacing: -0.01em; text-decoration: none; white-space: nowrap; }
.brand img { width: 40px; height: 40px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.site-nav { display: flex; gap: 28px; }
.site-nav a {
  text-decoration: none; font-size: 14px; font-weight: 500; color: var(--muted);
  padding: 20px 0; border-bottom: 2px solid transparent;
}
.site-nav a:hover { color: var(--text); }
.site-nav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }

/* Banner carousel */
.carousel {
  /* Full page width; height is capped by screen height so Latest News still shows on the
     first screen of a laptop. Photos are cropped to fill, around each slide's "focus" point. */
  position: relative; margin: 24px 0 40px; width: 100%; aspect-ratio: 3 / 2;
  max-height: max(300px, calc(100dvh - 420px));
  border-radius: var(--radius); overflow: hidden; background: #0a0e0c;
}
.carousel-slides, .carousel-slide { position: absolute; inset: 0; }
.carousel-slide { margin: 0; opacity: 0; transition: opacity 0.8s ease; }
.carousel-slide.active { opacity: 1; }
.carousel-slide img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* "fit": "whole" slides show the entire photo, with a blurred copy filling the sides */
.carousel-slide.whole img { position: absolute; inset: 0; object-fit: contain; }
.carousel-slide.whole .carousel-backdrop { object-fit: cover; filter: blur(28px) brightness(0.6); transform: scale(1.15); }
.carousel-credit {
  position: absolute; right: 14px; bottom: 12px;
  font-size: 11px; color: rgba(255, 255, 255, 0.8); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}
.carousel-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, 0.85); color: var(--text);
  font-size: 24px; line-height: 1; cursor: pointer; opacity: 0; transition: opacity 0.2s;
}
.carousel:hover .carousel-arrow, .carousel-arrow:focus-visible { opacity: 1; }
.carousel-arrow.prev { left: 14px; }
.carousel-arrow.next { right: 14px; }
.carousel-dots { position: absolute; left: 0; right: 0; bottom: 14px; display: flex; justify-content: center; gap: 8px; }
.carousel-dots button {
  width: 8px; height: 8px; padding: 0; border: 0; border-radius: 4px;
  background: rgba(255, 255, 255, 0.5); cursor: pointer; transition: width 0.3s, background 0.3s;
}
.carousel-dots button[aria-current="true"] { width: 22px; background: #fff; }

/* Member federations scroller */
.members-strip {
  display: flex; align-items: center; gap: 24px;
  margin: -16px 0 40px; padding: 14px 0;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.members-strip h2 {
  flex: none; margin: 0; font-size: 12px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--accent); white-space: nowrap;
}
.marquee {
  flex: 1; min-width: 0; display: flex; overflow: hidden;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 6%, #000 94%, transparent);
  mask-image: linear-gradient(to right, transparent, #000 6%, #000 94%, transparent);
}
.marquee-list {
  flex: none; display: flex; margin: 0; padding: 0; list-style: none;
  animation: marquee 45s linear infinite;
}
.marquee:hover .marquee-list { animation-play-state: paused; }
.marquee-list li {
  display: flex; align-items: center; white-space: nowrap;
  font-size: 15px; font-weight: 600; color: var(--text);
}
.member-flag {
  width: auto; height: 16px; margin-right: 8px; border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}
.marquee-list li::after {
  content: ""; width: 16px; height: 16px; margin: 0 22px;
  background: url("knight-icon.png") center / contain no-repeat; opacity: 0.35;
}
@keyframes marquee { to { transform: translateX(-100%); } }
@media (prefers-reduced-motion: reduce) {
  .marquee { -webkit-mask-image: none; mask-image: none; flex-wrap: wrap; }
  .marquee-list { animation: none; flex-wrap: wrap; row-gap: 6px; }
  .marquee-list[aria-hidden="true"] { display: none; }
}

/* Homepage sections */
.home-section { margin-bottom: 40px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.section-head h2 { margin: 0; font-size: 20px; font-weight: 600; }
.section-head a { font-size: 14px; color: var(--accent); text-decoration: none; white-space: nowrap; }
.section-head a:hover { text-decoration: underline; }

.news-list { display: flex; flex-direction: column; gap: 14px; }
.news-row {
  display: flex; align-items: stretch; gap: 20px; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  text-decoration: none; transition: background 0.15s;
}
.news-row:hover { background: var(--surface-hover); }
.news-row .news-thumb { flex: none; width: 200px; aspect-ratio: 4 / 3; }
.news-row-body { padding: 16px 20px 16px 0; display: flex; flex-direction: column; min-width: 0; }
.news-row h3 { margin: 0 0 4px; font-size: 16px; font-weight: 600; }
.news-row .news-preview { -webkit-line-clamp: 3; font-size: 14px; }
.read-more { margin-top: auto; padding-top: 10px; font-size: 14px; font-weight: 500; color: var(--accent); }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab {
  display: flex; align-items: center; gap: 6px;
  background: none; border: 0; border-bottom: 2px solid transparent;
  font: inherit; font-size: 14px; font-weight: 500; color: var(--muted);
  padding: 10px 12px; cursor: pointer;
}
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.tab svg { width: 16px; height: 16px; }

/* Event cards */
.event-list { display: flex; flex-direction: column; gap: 14px; }
.event-card {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 20px 24px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  text-decoration: none; transition: background 0.15s;
}
.event-card:hover { background: var(--surface-hover); }
.event-card h3 { margin: 0 0 8px; font-size: 16px; font-weight: 600; }
.meta { display: flex; align-items: flex-start; gap: 8px; color: var(--muted); font-size: 14px; margin-top: 3px; }
.meta svg { flex: none; width: 15px; height: 15px; margin-top: 3px; }
.flag {
  flex: none; width: 52px; height: 36px; object-fit: cover;
  border-radius: 4px; box-shadow: 0 0 0 1px var(--border);
}
.empty { color: var(--muted); padding: 32px 0; text-align: center; }

/* Pagination */
.pager { display: flex; align-items: center; justify-content: space-between; margin: 20px 0 48px; font-size: 14px; }
.pager button {
  background: none; border: 0; font: inherit; color: var(--accent); cursor: pointer; padding: 6px 0;
}
.pager button:disabled { color: #b8bdb9; cursor: default; }

/* Detail page */
.detail { padding: 40px 0 64px; }
.detail h1 { font-size: 26px; font-weight: 600; margin: 0 0 28px; }
.back { display: inline-block; margin-bottom: 20px; font-size: 14px; color: var(--muted); text-decoration: none; }
.back:hover { color: var(--text); }
.fields { border-top: 1px solid var(--border); }
.field { display: grid; grid-template-columns: 200px 1fr; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.field dt { color: var(--muted); }
.field dd { margin: 0; overflow-wrap: anywhere; white-space: pre-line; }
.badge { display: inline-block; padding: 1px 10px; border-radius: 6px; color: #fff; font-size: 13px; background: var(--badge-bg); }
.badge.past { background: var(--past-bg); }

/* About */
.prose { max-width: 720px; margin: 0 auto; padding: 48px 0 64px; font-size: 16px; }
.prose h1 { font-size: 32px; font-weight: 600; margin: 0 0 24px; }
.prose h2 { font-size: 19px; font-weight: 600; margin: 32px 0 8px; }
.prose ul { padding-left: 20px; }
.prose li { margin: 4px 0; }

/* News */
.news-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 40px 0 20px; flex-wrap: wrap; }
.news-head h1 { font-size: 20px; font-weight: 600; margin: 0; }
.news-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.news-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; padding-bottom: 64px; }
.news-card {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  text-decoration: none;
}
.news-card:hover { background: var(--surface-hover); }
.news-thumb { aspect-ratio: 16 / 9; display: flex; align-items: center; justify-content: center; background: #e7eae6; color: #8a918b; }
.news-thumb img { width: 100%; height: 100%; object-fit: cover; }
.news-thumb svg { width: 40px; height: 40px; }
.news-body { padding: 16px 20px 20px; }
.news-body h3 { margin: 0 0 8px; font-size: 16px; font-weight: 600; }
.news-date { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.news-preview { font-size: 13px; color: var(--muted); margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.post-date { color: var(--muted); font-size: 14px; margin: -16px 0 24px; }
.post-image { margin: 0 0 28px; }
.post-image img { display: block; border-radius: 12px; }
.post-image figcaption { margin-top: 8px; font-size: 13px; color: var(--muted); }
.post-credit { margin-top: 40px; padding-top: 14px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); }

/* Footer */
.site-footer { background: var(--footer-bg); padding: 28px 0; font-size: 13px; color: var(--muted); }

@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .site-nav { gap: 16px; }
  .brand { gap: 8px; font-size: 17px; }
  .brand img { width: 34px; height: 34px; }
  .members-strip { flex-direction: column; align-items: stretch; gap: 10px; margin: -8px 0 32px; }
  .marquee-list li { font-size: 14px; }
  .marquee-list li::after { margin: 0 16px; }
  .event-card { padding: 16px; align-items: flex-start; }
  .flag { width: 40px; height: 28px; }
  .field { grid-template-columns: 1fr; gap: 4px; }
  .carousel { margin: 16px 0 32px; }
  .carousel-arrow { display: none; }
  .news-row { gap: 14px; }
  .news-row .news-thumb { width: 104px; aspect-ratio: 1; }
  .news-row-body { padding: 12px 14px 12px 0; }
  .news-row h3 { font-size: 15px; }
  .news-row .news-preview { -webkit-line-clamp: 2; }
}
