/**
 * Global Variables & Theme Definition
 */
:root {
  --bg: #0f0b0b;
  --bg2: #160d0d;
  --panel: rgba(255,255,255,0.06);
  --panel2: rgba(255,255,255,0.04);
  --border: rgba(255,255,255,0.12);
  --text: rgba(255,255,255,0.92);
  --muted: rgba(255,255,255,0.72);
  --accent: #ffd700; /* gold */
  --shadow: 0 18px 40px rgba(0,0,0,0.35);
  --radius: 16px;
  --sidebarW: 292px;
  --max: 1120px;
}

/* Global Reset */
* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: "Lora", serif;
  color: var(--text);
  background: radial-gradient(1200px 800px at 20% 0%, #2b1717 0%, #0f0b0b 55%, #090707 100%);
}

/**
 * Background Effects
 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("https://www.essexkt.org/test/gallery/anim/KnightsAmin.gif");
  background-repeat: no-repeat;
  background-position: center center;
  background-size: cover;
  opacity: 0.20;
  z-index: -2;
  pointer-events: none;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.003);
  z-index: -1;
  pointer-events: none;
}

a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 10px;
}

/**
 * Layout & Topbar
 */
.layout {
  display: grid;
  grid-template-columns: var(--sidebarW) 1fr;
  min-height: 100vh;
}

.topbar {
  display: block; 
  position: relative; 
  z-index: 30;
  background: rgba(10,7,7,0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
  width: 100%;
}

@media (min-width: 981px) {
  .menuBtn { display: none !important; }
  .topbar__inner { justify-content: center; }
}

.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 0 16px;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  min-width: 0;
}

.brand__logo {
  display: block;
  height: 102px;
  width: auto;
  max-width: min(55vw, 880px);
  object-fit: contain;
}

.menuBtn {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  cursor: pointer;
}

.menuBtn__bars { width: 18px; height: 12px; position: relative; }
.menuBtn__bars span {
  position: absolute; left: 0; right: 0;
  height: 2px;
  background: rgba(255,255,255,0.85);
  border-radius: 999px;
}
.menuBtn__bars span:nth-child(1) { top: 0; }
.menuBtn__bars span:nth-child(2) { top: 5px; opacity: 0.8; }
.menuBtn__bars span:nth-child(3) { bottom: 0; opacity: 0.65; }

/**
 * Sidebar & Navigation
 */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 16px;
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(10,7,7,0.70), rgba(10,7,7,0.40));
  backdrop-filter: blur(10px);
  overflow: auto;
}

.sidebar__panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.04);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.sidebar__head {
  padding: 16px 16px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.10);
  background: radial-gradient(600px 220px at 30% 0%, rgba(255,215,0,0.18), transparent 55%), rgba(255,255,255,0.02);
}

.sidebar__title { margin: 0; font-size: 16px; font-weight: 700; line-height: 1.2; }
.sidebar__sub { margin: 6px 0 0; font-size: 12px; color: var(--muted); }

.nav { padding: 10px; }
.nav ul { list-style: none; padding: 0; margin: 0; }
.navItem { margin: 6px 0; }

.navLink, .navToggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  color: var(--text);
  background: transparent;
  font: inherit;
  cursor: pointer;
  text-align: left;
}

.navLink:hover, .navToggle:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.08);
}

.navLink--active {
  background: rgba(255,215,0,0.12);
  border-color: rgba(255,215,0,0.22);
}

.dot {
  width: 10px; height: 10px; border-radius: 999px;
  background: rgba(255,255,255,0.20);
  border: 1px solid rgba(255,255,255,0.20);
  flex: 0 0 auto;
}
.dot--gold { background: rgba(255,215,0,0.55); border-color: rgba(255,215,0,0.45); }

.navText { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.chev {
  width: 10px; height: 10px;
  border-right: 2px solid rgba(255,255,255,0.7);
  border-bottom: 2px solid rgba(255,255,255,0.7);
  transform: rotate(-45deg);
  transition: transform 220ms ease;
  flex: 0 0 auto;
}
.navToggle[aria-expanded="true"] .chev { transform: rotate(45deg); }

.subWrap {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 260ms ease;
  margin: 0 0 6px;
}
.subWrap[aria-hidden="false"] { grid-template-rows: 1fr; }
.subInner { overflow: hidden; }

.subMenu {
  padding: 4px 0 6px 18px;
  margin: 0 10px 10px;
  border-left: 1px solid rgba(255,255,255,0.14);
}

.subLink {
  display: block;
  padding: 9px 12px;
  margin: 5px 0;
  border-radius: 12px;
  color: rgba(255,255,255,0.86);
  background: rgba(0,0,0,0.10);
}

/**
 * Main Content Components
 */
.main { padding: 28px 22px; }
.main__inner { max-width: var(--max); margin: 0 auto; }

/* FORCE SCALE & CENTER: Prior Card */
.prior-card {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  text-align: center !important;
  padding: 20px !important;
}

.prior-photo {
  width: 300px !important; 
  max-width: 100% !important; 
  height: auto !important;
  border-radius: var(--radius) !important;
  border: 1px solid var(--border) !important;
  margin-bottom: 15px !important;
  box-shadow: var(--shadow) !important;
  object-fit: cover !important;
}

.prior-caption {
  color: var(--accent); 
  margin: 0 !important;
  width: 100% !important;
  font-size: 1rem !important;
  line-height: 1.4;
}

/* Add to site.css */

.welcome-wrap{
  width:100%;
}

.full-width-label{
  display:block;
  width:100%;
  box-sizing:border-box;
  text-align:center;
}

/* Feature Grid Adjustments for Large Card */
.feature-grid {
  display: grid;
  grid-template-columns: 1fr 450px; /* Swapped columns: content left, prior right */
  gap: 24px;
  max-width: var(--max);
  margin: 0 auto 26px;
  align-items: start;
}

.prior-card { grid-column: 2; }
.feature-right { grid-column: 1; grid-row: 1; display: flex; flex-direction: column; gap: 24px; }

/* Ticker */
.ticker {
  border: 1px solid rgba(255,215,0,0.22);
  background: linear-gradient(180deg, rgba(0,0,0,0.08), rgba(255,255,255,0.03));
  border-radius: 18px;
  overflow: hidden;
}

.ticker__link { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center; padding: 12px 14px; }
.ticker__label {
  display: inline-flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 999px;
  background: rgba(0,0,0,0.22); border: 1px solid rgba(255,215,0,0.18);
  color: var(--accent); font-weight: 600; white-space: nowrap; font-size: clamp(14px, 1.6vw, 26px);
}

.ticker__viewport { position: relative; overflow: hidden; min-height: 26px; }
.ticker__viewport::before, .ticker__viewport::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 42px; z-index: 2; pointer-events: none;
}
.ticker__viewport::before { left: 0; background: linear-gradient(90deg, var(--bg), transparent); }
.ticker__viewport::after { right: 0; background: linear-gradient(270deg, var(--bg), transparent); }

.ticker__track { display: flex; width: max-content; animation: tickerScroll var(--tickerSpeed, 26s) linear infinite; }
.ticker__items { display: inline-flex; align-items: center; gap: 16px; padding-right: 18px; }
.ticker__item { display: inline-flex; align-items: center; gap: 10px; white-space: nowrap; font-weight: 700; font-size: clamp(14px, 1.6vw, 26px); }

@keyframes tickerScroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* Welcome Label */
.welcome_label {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 8px 12px;
  border-radius: 18px; background: rgba(0,0,0,0.22); border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff; font-weight: 700; font-size: clamp(24px, 3.2vw, 52px);
  animation: welcomeGlow 2.2s ease-in-out infinite;
}

@keyframes welcomeGlow {
  0%, 100% { opacity: 0.95; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.03); box-shadow: 0 0 12px rgba(255,255,255,0.18); }
}

/* Centenary Card */
.centenary-card { 
    padding: clamp(16px, 2.2vw, 24px); 
    border: 1px solid var(--border); 
    border-radius: var(--radius); 
    background: var(--panel2); 
    display: flex;
    flex-direction: column;
    align-items: center; 
    text-align: center;
}
.centenary-row { 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    gap: clamp(10px, 2.4vw, 18px);
    width: 100%; 
}
.centenary-logo { width: clamp(54px, 8vw, 120px); height: auto; object-fit: contain; }
.centenary-title { text-align: center; font-size: clamp(16px, 2.4vw, 32px); margin: 0; min-width: 0; }

/* Custom Scaling for Centenary Row Images */
.centenary-row .centenary-logo {
  /* Adjust 100px to your preferred size (e.g., 80px for smaller, 120px for larger) */
  height: 125px !important; 
  width: auto !important;
  
  /* Adds a subtle shadow to make the jewel and seal "pop" against the knights background */
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.4));
  
  /* Ensures they don't look squashed */
  object-fit: contain;
  transition: transform 0.3s ease;
}

/* Hover effect for a touch of wit/interactivity */
.centenary-row .centenary-logo:hover {
  transform: scale(1.1) rotate(2deg);
}

@media (max-width: 640px) {
  .centenary-row .centenary-logo {
    height: 70px !important; /* Scaled down for mobile glass container */
  }
}

.centenary-card p, 
.countdown-values {
    margin: 10px 0;
    width: 100%;
}

/**
 * Tables & Preceptories
 */
.table-wrap { margin-top: 12px; overflow-x: auto; border-radius: 14px; border: 1px solid var(--border); background: var(--panel2); }
.table-modern { width: 100%; border-collapse: collapse; min-width: 720px; }
.table-modern thead th { padding: 12px 14px; background: rgba(0,0,0,0.25); color: var(--accent); border: 1px solid var(--border); text-align: left; }
.table-modern tbody td { padding: 12px 14px; border: 1px solid var(--border); vertical-align: top; }

.preceptories-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin-top: 14px; }
.preceptory {
  display: grid; grid-template-columns: 72px 1fr; gap: 12px; align-items: center;
  border: 1px solid var(--border); background: var(--panel2); padding: 14px; border-radius: 16px;
  transition: transform 120ms ease; text-decoration: none;
}
.preceptory:hover { transform: translateY(-2px); background: rgba(255,255,255,0.06); }
.preceptory__logo { width: 72px; height: 72px; border-radius: 12px; background: rgba(255,255,255,0.08); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.preceptory__logo img { width: 100%; height: 100%; object-fit: contain; padding: 8px; }

/**
 * Gallery
 */
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; margin-top: 14px; }
.gallery-grid a { display: block; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); transition: transform .2s ease; }
.gallery-grid img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-grid a:hover { transform: translateY(-2px); box-shadow: 0 14px 28px rgba(0,0,0,0.4); }

/**
 * UI Elements: Callouts, Notices, Buttons
 */
.callout { margin-top: 16px; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--border); background: rgba(255,255,255,0.03); }
.notice {
  padding: 14px 16px; border-radius: var(--radius); border: 1px solid rgba(255, 207, 0, 0.35);
  background: rgba(255, 207, 0, 0.06); display: flex; gap: 10px; align-items: flex-start;
}
.notice i { color: var(--accent); margin-top: 2px; }

.btn { display: inline-flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 14px; border: 1px solid var(--border); background: rgba(255,255,255,0.06); cursor: pointer; }
.btn--ghost { background: transparent; }
.btn--accent { background: var(--accent); border: none; color: #000; font-weight: 600; }

/**
 * Cookie Consent
 */
.cookie-consent {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 9999;
  max-width: 720px; width: calc(100% - 36px); background: rgba(15,11,11,0.96);
  border: 1px solid var(--border); border-radius: var(--radius); display: none;
}
.cookie-consent__inner { padding: 16px 18px; display: grid; gap: 14px; }
.cookie-consent__actions { display: flex; justify-content: flex-end; gap: 10px; }

/**
 * Mobile Logic
 */
.sidebar--drawer { display: none; }

@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .topbar { display: block; }
  .menuBtn { display: inline-flex; }
  
  .sidebar { display: none; }
  .sidebar.sidebar--drawer {
    display: block; position: fixed; transform: translateX(-110%);
    width: 280px; top: 0; left: 0; bottom: 0; z-index: 50; transition: transform 260ms ease;
    background: var(--bg);
  }
  body.navOpen .sidebar--drawer { transform: translateX(0); }
  .overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 40; }
  body.navOpen .overlay { display: block; }

  .main__inner {
    background: rgba(15, 11, 11, 0.88); 
    backdrop-filter: blur(8px);
    padding: 20px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-top: 10px;
  }
  
  .hero { text-align: center; }
  body::before { background-attachment: fixed; opacity: 0.15; }
  body::after { background: linear-gradient(to bottom, rgba(15, 11, 11, 0.2), rgba(15, 11, 11, 0.85)); }

  .feature-grid { grid-template-columns: 1fr; text-align: center; }
  .prior-card { grid-column: 1; order: 1; }
  .feature-right { grid-column: 1; order: 2; }
  .centenary-row { flex-direction: column; gap: 10px; }
}

/* News article image layout */
.news-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  align-items: start;
  margin: 1.5rem 0;
}

.news-gallery.single {
  grid-template-columns: 1fr;
  max-width: 900px;
}

.news-gallery figure {
  margin: 0;
  width: 100%;
}

.news-gallery img {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  border-radius: 10px;
}

.news-gallery figcaption {
  margin-top: 0.5rem;
  font-size: 0.95rem;
  line-height: 1.4;
}

/* Optional: make large single images a bit neater */
.news-gallery.single figure {
  margin: 0 auto;
}

/* Better behaviour on smaller screens */
@media (max-width: 768px) {
  .news-gallery {
    grid-template-columns: 1fr;
  }
}

.news-gallery img {
  box-shadow: 0 6px 18px rgba(0,0,0,.08);
  transition: transform .25s ease;
}

.news-gallery img:hover {
  transform: scale(1.02);
}
