@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,700;0,800;1,700&display=swap');

/* ── Reset & base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy:  #1A9E55;
  --gold:  #E8394F;
  --gold-light: #F08090;
  --cream: #fafaf8;
  --text:  #2c2c2c;
  --muted: #666;
  --border: #ddd;
  --card-bg: #fff;
  --radius: 6px;
  --shadow: 0 2px 12px rgba(0,0,0,.08);
  --transition: .2s ease;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--cream);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
}

a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

h1, h2, h3, .section-title, .hero h1, .page-header h1 {
  font-family: 'Playfair Display', Georgia, serif;
}

/* ── Layout helpers ─────────────────────────────────────────── */
.container { max-width: 1100px; margin: 0 auto; padding: 0 1.5rem; }

.section { padding: 4rem 0; }
.section--alt { background: #f0ede8; }

.section-title {
  font-size: 1.8rem;
  color: var(--navy);
  margin-bottom: .5rem;
  font-weight: 700;
}
.section-title::after {
  content: '';
  display: block;
  width: 48px;
  height: 3px;
  background: var(--gold);
  margin-top: .4rem;
}

.section-subtitle { color: var(--muted); margin-bottom: 2.5rem; }

/* ── Navigation ─────────────────────────────────────────────── */
.site-nav {
  background: linear-gradient(90deg, #0e5a30 0%, #1A9E55 40%, #1A9E55 60%, #0e5a30 100%);
  position: sticky;
  top: 0;
  z-index: 100;
  animation: borderPulse 3s ease-in-out infinite;
  border-bottom: 3px solid var(--gold);
  overflow: hidden;
  transition: background .35s ease, box-shadow .35s ease;
}
.site-nav.scrolled {
  background: linear-gradient(90deg, rgba(14,90,48,.82) 0%, rgba(26,158,85,.82) 40%, rgba(26,158,85,.82) 60%, rgba(14,90,48,.82) 100%);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 4px 24px rgba(0,0,0,.22);
}
.site-nav::after {
  content: '';
  position: absolute;
  top: 0; left: -100%; width: 60%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(232,57,79,.10), rgba(255,200,100,.13), transparent);
  animation: navShimmer 4s ease-in-out infinite;
  pointer-events: none;
}
@keyframes navShimmer {
  0%   { left: -60%; }
  100% { left: 160%; }
}
@keyframes borderPulse {
  0%, 100% { box-shadow: 0 4px 24px rgba(0,0,0,.4), 0 3px 12px rgba(232,57,79,.35); }
  50%       { box-shadow: 0 4px 32px rgba(0,0,0,.5), 0 3px 22px rgba(232,57,79,.7); }
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 1.5rem;
  max-width: 1100px;
  margin: 0 auto;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: .6rem;
  color: #fff;
  font-weight: 700;
  font-size: 1.4rem;
  text-decoration: none;
  transition: opacity var(--transition);
}
.nav-logo img {
  border: 2px solid #fff;
  border-radius: 8px;
  box-shadow: 0 0 10px rgba(255,255,255,.3);
}
.nav-logo:hover { opacity: .85; text-decoration: none; }
.nav-logo .piece { font-size: 2.2rem; color: var(--gold); }

.nav-links {
  display: flex;
  gap: .15rem;
  list-style: none;
}

.nav-links a {
  color: rgba(255,255,255,.55);
  padding: .45rem .85rem;
  font-size: .875rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  position: relative;
  transition: color .18s;
  text-decoration: none;
}

.nav-links a::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 4px;
  background: var(--gold);
  opacity: 0;
  transform: scaleX(.5);
  transition: opacity .18s, transform .18s;
}

.nav-links a:hover {
  color: #fff;
  text-decoration: none;
}
.nav-links a:hover::before {
  opacity: .18;
  transform: scaleX(1);
}
.nav-links a.active {
  color: #fff;
  text-decoration: none;
}
.nav-links a.active::before {
  opacity: .12;
  transform: scaleX(1);
}

.nav-links a span { position: relative; z-index: 1; }

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: .25rem;
  flex-direction: column;
  gap: 5px;
}
.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: var(--transition);
}

/* ── Floating chess pieces ──────────────────────────────────── */
.chess-float {
  position: absolute;
  bottom: -80px;
  pointer-events: none;
  user-select: none;
  color: #fff;
  z-index: 0;
  animation: chessDrift linear infinite;
}

@keyframes chessDrift {
  0%   { transform: translateY(0) rotate(0deg);   opacity: 0; }
  5%   { opacity: 1; }
  95%  { opacity: 1; }
  100% { transform: translateY(-110vh) rotate(25deg); opacity: 0; }
}

/* ── Hero board pattern ─────────────────────────────────────── */
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: repeating-conic-gradient(rgba(255,255,255,.04) 0% 25%, transparent 0% 50%);
  background-size: 44px 44px;
  animation: boardScroll 24s linear infinite;
  z-index: -1;
}

@keyframes boardScroll {
  0%   { background-position: 0 0; }
  100% { background-position: 44px 44px; }
}

.page-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: repeating-conic-gradient(rgba(255,255,255,.04) 0% 25%, transparent 0% 50%);
  background-size: 44px 44px;
  animation: boardScroll 24s linear infinite;
  z-index: -1;
}

/* ── Hero ───────────────────────────────────────────────────── */
.hero {
  background: var(--navy);
  color: #fff;
  padding: 5rem 1.5rem 6.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.hero::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 60' preserveAspectRatio='none'%3E%3Cpath d='M0,0 C360,60 1080,60 1440,0 L1440,60 L0,60 Z' fill='%23fafaf8'/%3E%3C/svg%3E");
  background-size: 100% 100%;
  background-repeat: no-repeat;
  pointer-events: none;
  z-index: 1;
}

/* ── Scroll fade-in ─────────────────────────────────────────── */
.fade-in {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .55s ease, transform .55s ease;
}
.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── Section title animated underline ───────────────────────── */
.section-title::after {
  width: 0;
  transition: width .5s ease;
}
.section-title.title-visible::after {
  width: 48px;
}

.hero-eyebrow {
  color: var(--gold);
  font-size: .85rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: .75rem;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 1rem;
}

.hero p {
  color: rgba(255,255,255,.8);
  max-width: 540px;
  margin: 0 auto 2rem;
  font-size: 1.05rem;
}

.btn {
  display: inline-block;
  padding: .7rem 1.5rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: .95rem;
  transition: var(--transition);
  cursor: pointer;
  border: none;
}
.btn-primary {
  background: var(--gold);
  color: #fff;
}
.btn-primary:hover { background: var(--gold-light); text-decoration: none; color: #fff; }

.btn-outline {
  background: transparent;
  color: #fff;
  border: 2px solid rgba(255,255,255,.3);
  margin-left: .5rem;
}
.btn-outline:hover { border-color: var(--gold); color: var(--gold); text-decoration: none; }

/* ── Dragon watermark ───────────────────────────────────────── */
.dragon-watermark {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 62%;
  max-width: 560px;
  opacity: .75;
  mix-blend-mode: multiply;
  pointer-events: none;
  user-select: none;
  z-index: -1;
}
.page-header .dragon-watermark {
  width: auto;
  height: 78%;
  max-height: 160px;
  max-width: none;
  left: auto;
  right: 2rem;
  transform: translateY(-50%);
  opacity: .65;
}
.crest-watermark {
  position: absolute;
  top: 50%;
  left: 2rem;
  transform: translateY(-50%);
  width: auto;
  height: 78%;
  max-height: 160px;
  opacity: .65;
  mix-blend-mode: multiply;
  filter: grayscale(1) invert(1);
  pointer-events: none;
  user-select: none;
}

/* ── Info bar ───────────────────────────────────────────────── */
.info-bar {
  background: var(--gold);
  color: #fff;
  padding: .8rem 1.5rem;
  text-align: center;
  font-weight: 600;
  font-size: .9rem;
}
.info-bar a { color: #fff; text-decoration: underline; }

/* ── Cards ──────────────────────────────────────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.75rem;
  border-top: 3px solid var(--gold);
}
.card-icon { font-size: 2rem; margin-bottom: .75rem; }
.card h3 { color: var(--navy); margin-bottom: .4rem; font-size: 1.05rem; }
.card p { color: var(--muted); font-size: .9rem; }

/* ── Table ──────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}
thead { background: var(--navy); color: #fff; }
thead th { padding: .75rem 1rem; text-align: left; font-weight: 600; }
thead th::after { content: ''; margin-left: .4rem; opacity: .4; font-size: .7rem; }
thead th.sort-asc::after  { content: '▲'; opacity: 1; }
thead th.sort-desc::after { content: '▼'; opacity: 1; }
tbody tr { border-bottom: 1px solid var(--border); }
tbody tr:hover { background: #f5f2ed; }
/* ── Board detail expand ───────────────────────────────────── */
tr.board-detail td { padding: 0; background: #f9f7f4; border-bottom: 2px solid var(--navy); }
.board-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.board-table tr + tr { border-top: 1px solid #e8e3dc; }
.bt-num    { width: 3rem; padding: .35rem .75rem; color: var(--muted); font-size: .75rem; }
.bt-player { padding: .35rem .75rem; }
.bt-result { width: 4rem; text-align: center; padding: .35rem .5rem; font-weight: 600; font-size: .8rem; }
.bt-away   { text-align: right; }
.bt-winner { font-weight: 700; }
.bt-decisive { color: var(--navy); }
.bt-drawn    { color: var(--muted); }

tr.round-header td {
  background: var(--navy);
  color: #fff;
  font-weight: 600;
  font-size: .8rem;
  letter-spacing: .04em;
  padding: .4rem 1rem;
}
.round-date {
  font-weight: 400;
  font-size: .78rem;
  opacity: .8;
  margin-left: .4rem;
}
tbody td { padding: .7rem 1rem; }

.badge {
  display: inline-block;
  padding: .2rem .6rem;
  border-radius: 99px;
  font-size: .75rem;
  font-weight: 600;
}
.badge-win  { background: #d4edda; color: #155724; }
.badge-loss { background: #f0e0e0; color: #8B0000; }
.badge-draw { background: #fff3cd; color: #856404; }

.members-loading, .members-error {
  text-align: center;
  padding: 2rem;
  color: var(--muted);
  font-style: italic;
}
.members-error a { color: var(--navy); }

.diff-pos  { color: #155724; font-weight: 600; }
.diff-neg  { color: #8B0000; font-weight: 600; }
.diff-zero { color: var(--muted); }

.junior-badge {
  display: inline-block;
  padding: .15rem .45rem;
  border-radius: 99px;
  font-size: .7rem;
  font-weight: 600;
  background: #cce5ff;
  color: #004085;
  margin-left: .35rem;
  vertical-align: middle;
}

.ncc-junior-toggle {
  margin-left: .5rem;
  padding: .1rem .45rem;
  border: 1px solid #004085;
  border-radius: 99px;
  font-size: .7rem;
  cursor: pointer;
  background: transparent;
  color: #004085;
  vertical-align: middle;
}
.ncc-junior-toggle.active {
  background: #cce5ff;
  font-weight: 600;
}

.wcu-link {
  display: inline-block;
  padding: .2rem .6rem;
  border-radius: 4px;
  font-size: .75rem;
  font-weight: 600;
  background: var(--navy);
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
}
.wcu-link:hover { opacity: .85; }

/* ── News ───────────────────────────────────────────────────── */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.news-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.news-card-body { padding: 1.25rem 1.5rem; }
.news-meta { font-size: .8rem; color: var(--muted); margin-bottom: .4rem; }
.news-card h3 { color: var(--navy); margin-bottom: .5rem; font-size: 1rem; }
.news-card p { font-size: .875rem; color: var(--muted); }
.news-img-placeholder {
  height: 160px;
  background: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: var(--gold);
}

/* ── Members ────────────────────────────────────────────────── */
.members-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.25rem;
}

.member-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem 1rem;
  text-align: center;
}
.member-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--gold);
  margin: 0 auto .75rem;
  position: relative;
  overflow: hidden;
}
.member-avatar-img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.member-avatar .ncc-img-edit-btn {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  font-size: .65rem;
  padding: .25rem .2rem;
  border-radius: 0;
  text-align: center;
  width: 50%;
}
.member-avatar .ncc-img-upload-label { left: 0; }
.member-avatar .ncc-img-url-btn { left: 50%; }
.member-card h3 { font-size: .95rem; color: var(--navy); margin-bottom: .2rem; }
.member-card .role { font-size: .8rem; color: var(--gold); font-weight: 600; }
.member-card .rating { font-size: .8rem; color: var(--muted); margin-top: .2rem; }

/* ── Tournaments ────────────────────────────────────────────── */
.tournament-list { display: flex; flex-direction: column; gap: 1rem; }

.tournament-item {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.tournament-date {
  background: var(--navy);
  color: #fff;
  border-radius: var(--radius);
  padding: .5rem .75rem;
  text-align: center;
  min-width: 60px;
}
.tournament-date .month { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--gold-light); }
.tournament-date .day { font-size: 1.5rem; font-weight: 700; line-height: 1; }
.tournament-info { flex: 1; }
.tournament-info h3 { color: var(--navy); margin-bottom: .2rem; }
.tournament-info p { font-size: .875rem; color: var(--muted); }
.tournament-tag {
  font-size: .75rem;
  background: #e8f5ee;
  color: #007A3D;
  padding: .2rem .6rem;
  border-radius: 99px;
  font-weight: 600;
}
.tournament-tag--england {
  background: #e8eef8;
  color: #003078;
}

/* ── Contact ────────────────────────────────────────────────── */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 3rem;
  align-items: start;
}
@media (max-width: 700px) { .contact-grid { grid-template-columns: 1fr; } }

.contact-info h3 { color: var(--navy); margin: 1.25rem 0 .3rem; font-size: 1rem; }
.contact-info p, .contact-info a { font-size: .9rem; color: var(--muted); }

.contact-form { display: flex; flex-direction: column; gap: 1rem; }

.form-group { display: flex; flex-direction: column; gap: .3rem; }
.form-group label { font-size: .85rem; font-weight: 600; color: var(--navy); }
.form-group input,
.form-group select,
.form-group textarea {
  padding: .6rem .9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .9rem;
  font-family: inherit;
  transition: border-color var(--transition);
  background: #fff;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,168,76,.15);
}
.form-group textarea { resize: vertical; min-height: 120px; }

/* ── Page header ────────────────────────────────────────────── */
.page-header {
  background: var(--navy);
  color: #fff;
  padding: 2.5rem 1.5rem 4.5rem;
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.page-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 52px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 52' preserveAspectRatio='none'%3E%3Cpath d='M0,0 C360,52 1080,52 1440,0 L1440,52 L0,52 Z' fill='%23fafaf8'/%3E%3C/svg%3E");
  background-size: 100% 100%;
  background-repeat: no-repeat;
  pointer-events: none;
  z-index: 1;
}
.page-header h1 { font-size: 1.8rem; margin-bottom: .25rem; }
.page-header p { color: rgba(255,255,255,.75); font-size: .95rem; }

/* ── Footer ─────────────────────────────────────────────────── */
.site-footer {
  background: linear-gradient(90deg, #0e5a30 0%, #1A9E55 40%, #1A9E55 60%, #0e5a30 100%);
  color: rgba(255,255,255,.65);
  padding: 2.5rem 1.5rem;
  margin-top: 4rem;
  position: relative;
  overflow: hidden;
  border-top: 2px solid var(--gold);
  animation: borderPulse 3s ease-in-out infinite;
}
.site-footer::before {
  content: '';
  position: absolute;
  top: 0; left: -100%; width: 60%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(232,57,79,.08), rgba(255,200,100,.10), transparent);
  animation: navShimmer 5s ease-in-out infinite 1.5s;
  pointer-events: none;
}
.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .75rem;
  position: relative;
  z-index: 1;
}
.footer-links { display: flex; gap: .15rem; flex-wrap: wrap; justify-content: center; }
.footer-links a {
  color: rgba(255,255,255,.55);
  padding: .35rem .7rem;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  position: relative;
  transition: color .18s;
  text-decoration: none;
}
.footer-links a::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 4px;
  background: var(--gold);
  opacity: 0;
  transform: scaleX(.5);
  transition: opacity .18s, transform .18s;
}
.footer-links a:hover { color: #fff; text-decoration: none; }
.footer-links a:hover::before { opacity: .18; transform: scaleX(1); }
.footer-copy { font-size: .8rem; text-align: center; color: rgba(255,255,255,.55); }

/* ── Back to top ────────────────────────────────────────────── */
#back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(26,158,85,.4);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .25s, transform .25s;
  pointer-events: none;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
}
#back-to-top.visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
#back-to-top:hover { background: #158a47; }

/* ── Admin bar ──────────────────────────────────────────────── */
#ncc-admin-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 48px;
  background: #1a1a1a;
  color: #fff;
  z-index: 99999;
  box-shadow: 0 2px 8px rgba(0,0,0,.5);
}
.ncc-admin-inner {
  max-width: 1200px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  gap: 1rem;
}
.ncc-admin-brand {
  font-weight: 700;
  font-size: .9rem;
  white-space: nowrap;
}
.ncc-admin-controls {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}
.ncc-admin-controls button,
.ncc-admin-btn {
  background: rgba(255,255,255,.1);
  color: #fff;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 4px;
  padding: .3rem .75rem;
  font-size: .8rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s;
  text-decoration: none;
}
.ncc-admin-controls button:hover,
.ncc-admin-btn:hover { background: rgba(255,255,255,.22); text-decoration: none; color: #fff; }
.ncc-admin-controls button#ncc-edit-toggle.active { background: #C8102E; border-color: #C8102E; }
.ncc-admin-controls button#ncc-download { background: #007A3D; border-color: #007A3D; }
.ncc-admin-controls button#ncc-logout { background: rgba(255,60,60,.2); border-color: rgba(255,60,60,.4); }

/* Add row / delete row buttons in edit mode */
.ncc-add-row-btn {
  margin-top: .6rem;
  padding: .4rem 1rem;
  background: #007A3D;
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s;
}
.ncc-add-row-btn:hover { opacity: .82; }

.ncc-del-row-btn {
  margin-left: .5rem;
  padding: .15rem .45rem;
  background: #E8394F;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: .7rem;
  cursor: pointer;
  vertical-align: middle;
  line-height: 1;
}
.ncc-del-row-btn:hover { opacity: .8; }

/* Badge dropdowns in edit mode */
.ncc-badge-select {
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  font-size: .75rem;
  border-radius: 99px;
  padding: .2rem .6rem;
  outline: 2px solid rgba(200,16,46,.5);
  outline-offset: 2px;
}
.ncc-badge-select:focus { outline-color: #C8102E; }

/* Highlight editable elements in edit mode */
.ncc-editable {
  outline: 2px dashed rgba(200,16,46,.5) !important;
  outline-offset: 2px;
  border-radius: 2px;
  cursor: text;
}
.ncc-editable:hover { outline-color: #C8102E !important; background: rgba(200,16,46,.04); }
.ncc-editable:focus { outline-color: #C8102E !important; background: rgba(200,16,46,.06); outline-style: solid !important; }

/* ── Link card logos ────────────────────────────────────────── */
.card-logo-wrap {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  background: #f5f5f5;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: .75rem;
  padding: 10px;
  overflow: hidden;
}
.card-logo-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ── Chess.com watch embed ──────────────────────────────────── */
#chess-watch-wrap {
  border-radius: var(--radius);
  overflow: hidden;
}

/* ── Puzzle section layout ──────────────────────────────────── */
.puzzle-layout {
  display: flex;
  gap: 2.5rem;
  align-items: flex-start;
  flex-wrap: wrap;
}

#puzzle {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  flex-shrink: 0;
  width: 648px; /* 600px board + 2×1.5rem card padding */
}

#puzzle-container {
  width: max-content;
  min-width: 0;
}

/* ── Live chess 2-column layout ─────────────────────────────── */
.live-chess-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.5rem;
  align-items: start;
}

.knight-tour-panel {
  background: var(--navy);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  height: 700px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
  flex: 1;
  min-width: 300px;
}

.knight-tour-title {
  color: #fff;
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: .4rem;
}

.knight-tour-desc {
  color: rgba(255,255,255,.7);
  font-size: .8rem;
  text-align: center;
  line-height: 1.5;
  margin-bottom: .75rem;
}

.canvas-wrap {
  position: relative;
  display: inline-block;
}

#knight-canvas {
  border-radius: 4px;
  box-shadow: 0 4px 20px rgba(0,0,0,.4);
  display: block;
}

.anim-ctrl-btn {
  position: absolute;
  top: .45rem;
  right: .45rem;
  background: rgba(0,0,0,.4);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 50%;
  width: 2rem;
  height: 2rem;
  font-size: .9rem;
  cursor: pointer;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  transition: background .18s;
  z-index: 2;
}
.anim-ctrl-btn:hover { background: rgba(0,0,0,.65); }

.knight-tour-counter {
  color: var(--gold-light);
  font-size: 1rem;
  font-weight: 600;
  margin-top: .75rem;
}

.knight-tour-pieces {
  display: flex;
  gap: .6rem;
  font-size: 1.8rem;
  margin-top: .75rem;
}

.knight-tour-pieces span {
  color: #fff;
  opacity: .7;
  animation: piecePulse 2s ease-in-out infinite;
}
.knight-tour-pieces span:nth-child(1) { animation-delay: 0s; }
.knight-tour-pieces span:nth-child(2) { animation-delay: .3s; }
.knight-tour-pieces span:nth-child(3) { animation-delay: .6s; }
.knight-tour-pieces span:nth-child(4) { animation-delay: .9s; }
.knight-tour-pieces span:nth-child(5) { animation-delay: 1.2s; }
.knight-tour-pieces span:nth-child(6) { animation-delay: 1.5s; }

@keyframes piecePulse {
  0%, 100% { opacity: .4; transform: translateY(0); }
  50%       { opacity: 1;  transform: translateY(-6px); }
}

@media (max-width: 900px) {
  .live-chess-layout { grid-template-columns: 1fr; }
  .knight-tour-panel { height: auto; }
}

/* ── Club history section ────────────────────────────────────── */
.history-layout {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 3rem;
  align-items: start;
}
.history-text p { margin-bottom: 1rem; line-height: 1.75; }
.history-text p:last-child { margin-bottom: 0; }
.history-gallery {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .65rem;
}
.history-figure { margin: 0; }
.history-figure img {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: block;
  object-fit: cover;
  aspect-ratio: 4/3;
}
.history-figure figcaption {
  font-size: .72rem;
  color: var(--muted);
  text-align: center;
  margin-top: .3rem;
  font-style: italic;
  line-height: 1.3;
}
@media (max-width: 768px) {
  .history-layout { grid-template-columns: 1fr; }
}

/* ── News articles (expandable) ─────────────────────────────── */
.news-article {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0;
  margin-bottom: 1.5rem;
  border-left: 4px solid var(--gold);
  overflow: hidden;
}
.news-article-body {
  padding: 1.5rem 2rem 2rem;
}
.news-img-wrap {
  position: relative;
  width: 100%;
  line-height: 0;
  overflow: hidden;
  cursor: zoom-in;
}
.news-img {
  width: 100%;
  height: 260px;
  object-fit: cover;
  object-position: top;
  display: block;
  cursor: zoom-in;
}
.ncc-img-edit-btn,
.ncc-img-upload-label {
  position: absolute;
  right: .5rem;
  background: rgba(0,0,0,.75);
  color: #fff;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 4px;
  padding: .28rem .6rem;
  font-size: .72rem;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s;
  display: block;
  line-height: 1.4;
  text-align: center;
  user-select: none;
}
.ncc-img-upload-label { top: .5rem; }
.ncc-img-url-btn { top: 2.2rem; border: none; }
.ncc-img-edit-btn:hover,
.ncc-img-upload-label:hover { background: rgba(0,0,0,.92); }
.ncc-add-news-btn {
  display: block;
  width: 100%;
  margin-top: 1.25rem;
  padding: .75rem;
  background: #007A3D;
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s;
  text-align: center;
}
.ncc-add-news-btn:hover { opacity: .85; }
.ncc-del-article-btn {
  display: block;
  margin: 1rem 2rem 1.5rem;
  padding: .3rem .8rem;
  background: #E8394F;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: .78rem;
  cursor: pointer;
  transition: opacity .15s;
}
.ncc-del-article-btn:hover { opacity: .8; }
.ncc-reorder-toolbar {
  display: flex;
  gap: .5rem;
  margin: .5rem 2rem 1rem;
}
.ncc-reorder-btn {
  padding: .3rem .75rem;
  background: var(--navy);
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: .78rem;
  cursor: pointer;
  transition: opacity .15s;
}
.ncc-reorder-btn:hover { opacity: .8; }
.news-article > p,
.news-article > h2,
.news-article > .news-summary,
.news-article > .news-toggle,
.news-article > .news-body,
.news-article > .news-meta {
  padding-left: 2rem;
  padding-right: 2rem;
}
.news-article > .news-meta { padding-top: 1.5rem; }
.news-article > .news-body { padding-bottom: 1.5rem; }
.news-article > .news-toggle { margin-left: 2rem; }
.news-article h2 {
  color: var(--navy);
  font-size: 1.3rem;
  margin: .35rem 0 .6rem;
}
.news-article .news-summary { color: var(--text); }
.news-article .news-body {
  display: none;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.news-article.expanded .news-body { display: block; }
.news-body p { margin-top: .75rem; }
.news-body p:first-child { margin-top: 0; }
.news-body ul { margin: .75rem 0 0 1.5rem; }
.news-body li { margin-bottom: .3rem; }
.news-toggle {
  display: inline-block;
  margin-top: .75rem;
  background: none;
  border: 1px solid var(--gold);
  color: var(--gold);
  padding: .3rem .9rem;
  border-radius: 99px;
  cursor: pointer;
  font-size: .85rem;
  font-family: inherit;
  transition: var(--transition);
}
.news-toggle:hover { background: var(--gold); color: #fff; }

/* ── Gallery ─────────────────────────────────────────────────── */
.gallery-filters {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}
.gallery-filter {
  padding: .4rem 1.1rem;
  border: 2px solid var(--navy);
  background: transparent;
  color: var(--navy);
  border-radius: 99px;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background .18s, color .18s;
}
.gallery-filter:hover,
.gallery-filter.active {
  background: var(--navy);
  color: #fff;
}
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}
.gallery-item {
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--card-bg);
  box-shadow: var(--shadow);
  transition: transform .2s, box-shadow .2s;
  cursor: pointer;
}
.gallery-item.gallery-hidden { display: none !important; }
.gallery-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 28px rgba(0,0,0,.14);
}
.gallery-img-wrap {
  position: relative;
  overflow: hidden;
  line-height: 0;
}
.gallery-img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  object-position: top;
  display: block;
  transition: transform .3s;
}
.gallery-item:hover .gallery-img { transform: scale(1.05); }
.gallery-overlay {
  position: absolute;
  inset: 0;
  background: rgba(26,158,85,.55);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .2s;
}
.gallery-item:hover .gallery-overlay { opacity: 1; }
.gallery-zoom { font-size: 2rem; color: #fff; }
.gallery-caption {
  padding: .65rem .9rem;
  font-size: .82rem;
  color: var(--muted);
  line-height: 1.4;
}

/* Lightbox */
.gallery-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.92);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.gallery-lightbox.open { display: flex; }
.lightbox-content {
  max-width: 900px;
  width: 100%;
  text-align: center;
}
.lightbox-content img {
  max-width: 100%;
  max-height: 75vh;
  border-radius: var(--radius);
  display: block;
  margin: 0 auto;
  box-shadow: 0 8px 48px rgba(0,0,0,.6);
}
.lightbox-caption {
  color: rgba(255,255,255,.8);
  margin-top: .75rem;
  font-size: .9rem;
}
.lightbox-close {
  position: fixed;
  top: 1rem;
  right: 1.25rem;
  background: none;
  border: none;
  color: #fff;
  font-size: 2.5rem;
  cursor: pointer;
  line-height: 1;
  opacity: .75;
  transition: opacity .15s;
}
.lightbox-close:hover { opacity: 1; }
.lightbox-prev,
.lightbox-next {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,.12);
  border: none;
  color: #fff;
  font-size: 3rem;
  padding: .25rem .75rem;
  cursor: pointer;
  border-radius: var(--radius);
  transition: background .15s;
  line-height: 1;
}
.lightbox-prev { left: .75rem; }
.lightbox-next { right: .75rem; }
.lightbox-prev:hover,
.lightbox-next:hover { background: rgba(255,255,255,.25); }

/* Admin gallery controls */
.ncc-add-photo-wrap {
  display: flex;
  gap: .75rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}
.ncc-add-photo-btn {
  flex: 1;
  min-width: 180px;
  padding: .75rem 1rem;
  background: #007A3D;
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s;
  text-align: center;
  display: block;
}
.ncc-add-photo-btn:hover { opacity: .85; }
.ncc-del-photo-btn {
  display: block;
  width: 100%;
  padding: .25rem;
  background: #E8394F;
  color: #fff;
  border: none;
  font-size: .75rem;
  cursor: pointer;
  transition: opacity .15s;
}
.ncc-del-photo-btn:hover { opacity: .8; }
.ncc-img-menu {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,.2);
  padding: .5rem;
  display: flex;
  flex-direction: column;
  gap: .35rem;
  min-width: 220px;
}
.ncc-img-menu button {
  text-align: left;
  padding: .55rem .9rem;
  border: none;
  border-radius: 4px;
  background: none;
  cursor: pointer;
  font-size: .88rem;
  font-family: inherit;
  color: var(--text);
  transition: background .12s;
}
.ncc-img-menu button:hover { background: #f0f0f0; }
.ncc-img-menu button:last-child { color: #E8394F; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #0a3d20;
    flex-direction: column;
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255,255,255,.1);
    gap: .1rem;
    box-shadow: 0 8px 24px rgba(0,0,0,.4);
    z-index: 200;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: .75rem .75rem; }
  /* Keep sticky — only remove overflow:hidden so dropdown isn't clipped */
  .site-nav { overflow: visible; }
  .site-nav::after { display: none; }

  .page-header {
    padding: 1.25rem 1.5rem 3.5rem;
  }
  .page-header .container > img {
    height: 80px !important;
  }
  .page-header .dragon-watermark,
  .crest-watermark {
    height: 40%;
    max-height: 70px;
  }
  .page-header .dragon-watermark { right: .75rem; }
  .crest-watermark { left: .75rem; }
  .nav-toggle { display: flex; }

  .hero { padding: 3rem 1.5rem; }
  .section { padding: 2.5rem 0; }
  .contact-grid { grid-template-columns: 1fr; }
  .footer-inner { flex-direction: column; text-align: center; }
  .footer-links { gap: .1rem; }
  .footer-links a { padding: .55rem 1rem; font-size: .82rem; }

  .puzzle-layout { flex-direction: column; gap: 1.5rem; }
  #puzzle { width: 100%; overflow: hidden; min-width: 0; }
  .knight-tour-panel { min-width: 0; width: 100%; height: auto; }
}
