/* ===========================
   Cardiff North Labour – CSS
   =========================== */

:root {
  --red: #CC0000;
  --red-dark: #990000;
  --black: #0f0f0f;
  --off-white: #f9f6f1;
  --white: #ffffff;
  --grey: #6b6b6b;
  --grey-light: #f0ede8;
  --border: #e0dbd4;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'Source Sans 3', sans-serif;
  --nav-h: 70px;
  --transition: 0.3s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--font-body); color: var(--black); background: var(--white); line-height: 1.6; }
a { text-decoration: none; color: inherit; }

/* height:auto is critical — height:100% causes reflow flash */
img { display: block; width: 100%; height: auto; object-fit: cover; }

/* ===== SCROLL FADE-IN ===== */
/* Applied by JS; never set before paint so no flash */
.fade-pending {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.fade-in {
  opacity: 1;
  transform: translateY(0);
}

/* ===== NAVBAR ===== */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: var(--white);
  border-bottom: 3px solid var(--red);
  z-index: 1000;
  box-shadow: 0 2px 20px rgba(0,0,0,0.08);
}
.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 32px;
}
.nav-logo { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

/* Explicit dimensions prevent reflow while image loads */
.logo-img { display: block; width: 140px; height: 44px; object-fit: contain; }
.logo-img.large { width: 220px; height: 70px; }

.nav-links { list-style: none; display: flex; align-items: center; gap: 8px; margin-left: auto; }
.nav-links li a {
  font-size: 14px; font-weight: 600; padding: 6px 14px;
  border-radius: 4px; color: var(--black);
  transition: color var(--transition); letter-spacing: 0.02em;
}
.nav-links li a:hover, .nav-links li a.active { color: var(--red); }
.nav-cta {
  background: var(--red) !important; color: var(--white) !important;
  padding: 8px 18px !important; border-radius: 4px !important;
  transition: background var(--transition) !important;
}
.nav-cta:hover { background: var(--red-dark) !important; }
.nav-toggle { display: none; background: none; border: none; font-size: 24px; cursor: pointer; color: var(--black); margin-left: auto; }

/* ===== HERO ===== */
.hero { position: relative; height: 100vh; min-height: 600px; margin-top: var(--nav-h); overflow: hidden; }
.slides { position: absolute; inset: 0; }
.slide { position: absolute; inset: 0; background-size: cover; background-position: center; opacity: 0; transition: opacity 1.2s ease; }
.slide.active { opacity: 1; }
.slide-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(150,0,0,0.72) 0%, rgba(0,0,0,0.55) 60%, rgba(0,0,0,0.35) 100%);
}
.hero-content {
  position: relative; z-index: 10;
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center;
  height: 100%; max-width: 1200px; margin: 0 auto; padding: 80px 24px;
}
.hero-eyebrow { font-size: 13px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; color: rgba(255,255,255,0.75); margin-bottom: 16px; }
.hero-headline { font-family: var(--font-display); font-size: clamp(42px, 7vw, 88px); font-weight: 900; color: var(--white); line-height: 1.0; margin-bottom: 24px; text-shadow: 0 4px 24px rgba(0,0,0,0.3); }
.hero-sub { font-size: 18px; color: rgba(255,255,255,0.85); max-width: 480px; margin-bottom: 40px; font-weight: 300; line-height: 1.7; }
.hero-btns { display: flex; gap: 14px; flex-wrap: wrap; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-block; padding: 14px 28px;
  font-family: var(--font-body); font-size: 14px; font-weight: 700;
  letter-spacing: 0.05em; text-transform: uppercase;
  border-radius: 3px; cursor: pointer; transition: all var(--transition);
  border: 2px solid transparent;
}
.btn-white { background: var(--white); color: var(--red); }
.btn-white:hover { background: var(--off-white); }
.btn-outline-white { background: transparent; color: var(--white); border-color: rgba(255,255,255,0.6); }
.btn-outline-white:hover { background: rgba(255,255,255,0.1); border-color: var(--white); }
.btn-red { background: var(--red); color: var(--white); }
.btn-red:hover { background: var(--red-dark); }
.btn-outline-red { background: transparent; color: var(--red); border-color: var(--red); }
.btn-outline-red:hover { background: var(--red); color: var(--white); }

/* ===== SLIDE DOTS ===== */
.slide-arrow {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 20;
  background: rgba(255,255,255,0.15); color: var(--white);
  border: 2px solid rgba(255,255,255,0.4);
  width: 52px; height: 52px; font-size: 22px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; border-radius: 50%; transition: all var(--transition); backdrop-filter: blur(4px);
}
.slide-arrow:hover { background: var(--red); border-color: var(--red); }
.slide-arrow.prev { left: 24px; }
.slide-arrow.next { right: 24px; }
.slide-dots { position: absolute; bottom: 28px; left: 50%; transform: translateX(-50%); z-index: 20; display: flex; gap: 10px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: rgba(255,255,255,0.45); border: 2px solid rgba(255,255,255,0.6); cursor: pointer; transition: all var(--transition); }
.dot.active { background: var(--white); transform: scale(1.2); }

/* ===== QUICK LINKS ===== */
.quick-links { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--border); }
.ql-card { display: block; padding: 48px 36px; border-right: 1px solid var(--border); transition: background var(--transition); position: relative; }
.ql-card:last-child { border-right: none; }
.ql-card:hover { background: var(--off-white); }
.ql-card::after { content: '→'; position: absolute; right: 28px; bottom: 28px; font-size: 20px; color: var(--red); transition: transform var(--transition); }
.ql-card:hover::after { transform: translateX(4px); }
.ql-icon { font-size: 28px; margin-bottom: 14px; }
.ql-card h3 { font-family: var(--font-display); font-size: 22px; margin-bottom: 8px; color: var(--black); }
.ql-card p { font-size: 14px; color: var(--grey); }

/* ===== SHARED SECTION UTILITIES ===== */
.section-inner { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.section-label { font-size: 11px; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase; color: var(--red); margin-bottom: 12px; }
.section-title { font-family: var(--font-display); font-size: clamp(28px, 4vw, 46px); font-weight: 700; line-height: 1.15; margin-bottom: 40px; }

/* ===== PRIORITIES ===== */
.priorities { padding: 96px 0; background: var(--off-white); }
.priority-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; }
.priority-card { background: var(--white); padding: 36px 28px; border-top: 4px solid var(--red); transition: transform var(--transition), box-shadow var(--transition); }
.priority-card:hover { transform: translateY(-4px); box-shadow: 0 12px 40px rgba(0,0,0,0.08); }
.priority-num { font-family: var(--font-display); font-size: 48px; font-weight: 900; color: #cc00001a; line-height: 1; margin-bottom: 16px; }
.priority-card h3 { font-size: 18px; font-weight: 700; margin-bottom: 10px; }
.priority-card p { font-size: 14px; color: var(--grey); line-height: 1.6; }

/* ===== REPS PREVIEW ===== */
.reps-preview { padding: 96px 0; }
.reps-inner { display: grid; grid-template-columns: 1fr 1fr; gap: 80px; align-items: center; }
.reps-text p { color: var(--grey); margin-bottom: 32px; font-size: 16px; line-height: 1.8; }
.reps-faces { display: flex; gap: 24px; }
.rep-thumb { flex: 1; }
.rep-thumb img { width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: 4px; margin-bottom: 12px; filter: grayscale(20%); transition: filter var(--transition); }
.rep-thumb:hover img { filter: grayscale(0); }
.rep-name { font-weight: 700; font-size: 15px; }
.rep-role { font-size: 13px; color: var(--red); font-weight: 600; }
.rep-team { flex: 1; }
.rep-team img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 4px; margin-bottom: 12px; filter: grayscale(20%); transition: filter var(--transition); }

/* ===== PAGE HEADER ===== */
.page-header { background: var(--black); padding: 80px 0 60px; margin-top: var(--nav-h); position: relative; overflow: hidden; }
.page-header::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--red); }
.page-header-inner { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.page-header .section-label { color: rgba(255,255,255,0.45); }
.page-header h1 { font-family: var(--font-display); font-size: clamp(36px, 5vw, 64px); font-weight: 900; color: var(--white); line-height: 1.1; }

/* ===== LEAD REP CARDS ===== */
.lead-reps { display: flex; flex-direction: column; gap: 32px; }
.lead-rep-card {
  display: flex; align-items: center; gap: 32px;
  background: var(--white); border: 1px solid var(--border);
  border-left: 5px solid var(--red); border-radius: 8px; padding: 32px;
  transition: box-shadow var(--transition), transform var(--transition);
}
.lead-rep-card:hover { box-shadow: 0 12px 30px rgba(0,0,0,0.08); transform: translateY(-3px); }

/* Explicit size + min-width prevents flex collapse before image loads */
.lead-rep-img { width: 120px; height: 120px; min-width: 120px; border-radius: 50%; object-fit: cover; flex-shrink: 0; border: 3px solid var(--grey-light); }

.lead-rep-body { flex: 1; }
.lead-rep-role { font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--red); margin-bottom: 6px; }
.lead-rep-name { font-family: var(--font-display); font-size: 28px; font-weight: 800; margin-bottom: 10px; line-height: 1.1; }
.lead-rep-bio { font-size: 15px; color: var(--grey); line-height: 1.6; margin-bottom: 20px; }
.rep-actions { display: flex; gap: 20px; flex-wrap: wrap; }
.rep-actions a { font-size: 14px; font-weight: 700; color: var(--red); display: inline-flex; align-items: center; transition: opacity var(--transition); }
.rep-actions a:hover { opacity: 0.7; }

/* ===== WARD BUTTONS ===== */
.ward-btn {
  display: block; padding: 18px 20px;
  background: var(--white); border: 1px solid var(--border);
  border-left: 4px solid var(--red); border-radius: 4px;
  font-weight: 600; font-size: 14px; color: var(--black);
  transition: all var(--transition); cursor: pointer; text-align: left;
}
.ward-btn:hover { background: var(--red); color: var(--white); border-color: var(--red); }
.ward-btn span { display: block; font-size: 11px; font-weight: 400; opacity: 0.6; margin-top: 3px; }

/* Ward button images: aspect-ratio reserves height before load */
.ward-btn img { width: 100%; height: auto; aspect-ratio: 1/1; object-fit: cover; border-radius: 12px; }

.ward-icon { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }

/* ===== CONTACT PAGE ===== */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; min-height: 60vh; }
.contact-panel { padding: 60px 48px; }
.contact-panel.party { background: var(--off-white); border-right: 1px solid var(--border); }
.contact-panel.reps { background: var(--white); }
.contact-panel h2 { font-family: var(--font-display); font-size: 28px; margin-bottom: 8px; }
.contact-panel p.sub { color: var(--grey); margin-bottom: 32px; font-size: 14px; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 6px; color: var(--black); }
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%; padding: 12px 16px; border: 1px solid var(--border); border-radius: 3px;
  font-family: var(--font-body); font-size: 14px; background: var(--white); color: var(--black);
  transition: border-color var(--transition); appearance: none;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: var(--red); }
.form-group textarea { min-height: 120px; resize: vertical; }

.rep-contact-card {
  display: flex; align-items: center; gap: 16px; padding: 20px;
  border: 1px solid var(--border); border-radius: 4px; margin-bottom: 14px;
  transition: border-color var(--transition); cursor: pointer; color: inherit;
}
.rep-contact-card:hover { border-color: var(--red); }

/* min-width prevents flex collapse before image loads */
.rep-contact-img { width: 56px; height: 56px; min-width: 56px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }

.rep-contact-name { font-weight: 700; font-size: 15px; }
.rep-contact-role { font-size: 12px; color: var(--red); font-weight: 600; }
.rep-contact-arrow { margin-left: auto; color: var(--grey); font-size: 18px; }

/* ===== YOUR AREA PAGE ===== */
.area-intro { padding: 60px 0; }
.area-intro p { color: var(--grey); font-size: 16px; max-width: 640px; line-height: 1.8; }
.ward-list-section { padding: 0 0 80px; }
.ward-area-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 24px; margin-top: 32px; }
.ward-area-card { display: block; border: 1px solid var(--border); border-top: 4px solid var(--red); border-radius: 4px; padding: 28px; transition: all var(--transition); color: inherit; }
.ward-area-card:hover { box-shadow: 0 8px 32px rgba(0,0,0,0.08); transform: translateY(-2px); }
.ward-area-card h3 { font-family: var(--font-display); font-size: 20px; margin-bottom: 8px; }
.ward-area-card p { font-size: 13px; color: var(--grey); margin-bottom: 16px; }
.ward-cllr-count { font-size: 12px; font-weight: 700; color: var(--red); text-transform: uppercase; letter-spacing: 0.08em; }

/* ===== WARD DETAIL PAGE ===== */
.ward-header { background: var(--red); padding: 80px 0 60px; margin-top: var(--nav-h); }
.ward-header .section-label { color: rgba(255,255,255,0.6); }
.ward-header h1 { font-family: var(--font-display); font-size: clamp(36px, 5vw, 60px); color: var(--white); font-weight: 900; }
.ward-header p { color: rgba(255,255,255,0.8); font-size: 16px; margin-top: 12px; max-width: 560px; }
.ward-councillors { padding: 80px 0; }
.ward-cllr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 32px; margin-top: 40px; }
.cllr-card { border: 1px solid var(--border); border-radius: 4px; overflow: hidden; transition: box-shadow var(--transition); }
.cllr-card:hover { box-shadow: 0 12px 40px rgba(0,0,0,0.1); }
/* aspect-ratio reserves space before image loads */
.cllr-img { width: 100%; aspect-ratio: 1; object-fit: cover; object-position: top center; background: var(--grey-light); }
.cllr-body { padding: 24px; }
.cllr-name { font-family: var(--font-display); font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.cllr-role { font-size: 12px; color: var(--red); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 12px; }
.cllr-bio { font-size: 13px; color: var(--grey); line-height: 1.6; margin-bottom: 16px; }
.cllr-contact-link { font-size: 13px; font-weight: 700; color: var(--red); transition: opacity var(--transition); }
.cllr-contact-link:hover { opacity: 0.7; }

/* ===== REP PROFILE PAGE ===== */
.rep-profile { padding: 80px 0; }
.rep-profile-inner { max-width: 1200px; margin: 0 auto; padding: 0 24px; display: grid; grid-template-columns: 320px 1fr; gap: 60px; }
/* aspect-ratio reserves space before image loads */
.rep-profile-img { width: 100%; border-radius: 4px; aspect-ratio: 3/4; object-fit: cover; object-position: top center; border-top: 5px solid var(--red); }
.rep-profile-name { font-family: var(--font-display); font-size: 42px; font-weight: 900; line-height: 1.1; margin-bottom: 8px; }
.rep-profile-role { font-size: 14px; font-weight: 700; color: var(--red); text-transform: uppercase; letter-spacing: 0.12em; margin-bottom: 32px; }
.rep-profile-bio { font-size: 16px; color: var(--grey); line-height: 1.85; margin-bottom: 10px; }
.rep-profile-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 32px; }
.rep-profile-socials { display: flex; gap: 10px; flex-wrap: wrap; }
.social-link { font-size: 13px; font-weight: 600; color: var(--red); transition: opacity var(--transition); }
.social-link2 { font-size: 25px; font-weight: 600; color: var(--red); transition: opacity var(--transition); }
.social-link:hover { opacity: 0.7; }

/* ===== TEAM / CONTACT PANEL LAYOUT ===== */
.team-panel { padding: 80px 64px; }
.team-panel.reps { background: var(--white); border-right: 1px solid var(--border); }
.team-panel.wards { background: var(--off-white); }
.team-panel h2 { font-family: var(--font-display); font-size: 38px; line-height: 1.2; margin-bottom: 16px; }
.team-panel .sub { color: var(--grey); font-size: 16px; line-height: 1.6; margin-bottom: 48px; max-width: 540px; }

/* ===== FORM SUCCESS ===== */
.form-success { display: none; background: #00aa44; color: var(--white); padding: 16px 20px; border-radius: 4px; font-weight: 600; margin-top: 16px; font-size: 14px; }

/* ===== FOOTER ===== */
.footer { background: var(--black); color: var(--white); padding: 60px 0 0; }
.footer-inner { max-width: 1200px; margin: 0 auto; padding: 0 24px 48px; display: flex; align-items: center; gap: 48px; flex-wrap: wrap; }
.footer-links { display: flex; gap: 24px; margin-left: auto; }
.footer-links a { font-size: 13px; color: rgba(255,255,255,0.6); transition: color var(--transition); }
.footer-links a:hover { color: var(--white); }
.footer-social { display: flex; gap: 16px; }
.footer-social a { width: 36px; height: 36px; border: 1px solid rgba(255,255,255,0.2); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; color: rgba(255,255,255,0.6); transition: all var(--transition); }
.footer-social a:hover { background: var(--red); border-color: var(--red); color: var(--white); }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.08); padding: 20px 24px; text-align: center; font-size: 11px; color: rgba(255,255,255,0.3); max-width: 1200px; margin: 0 auto; }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .quick-links { grid-template-columns: 1fr; }
  .ql-card { border-right: none; border-bottom: 1px solid var(--border); }
  .priority-grid { grid-template-columns: 1fr 1fr; }
  .reps-inner { grid-template-columns: 1fr; gap: 48px; }
  .contact-grid { grid-template-columns: 1fr; }
  .contact-panel.party { border-right: none; border-bottom: 1px solid var(--border); }
  .rep-profile-inner { grid-template-columns: 1fr; }
  .rep-profile-img { aspect-ratio: 4/3; max-width: 360px; }
  .ward-cllr-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 600px) {
  .nav-links { display: none; flex-direction: column; position: absolute; top: var(--nav-h); left: 0; right: 0; background: var(--white); border-top: 1px solid var(--border); padding: 16px 0; }
  .nav-links.open { display: flex; }
  .nav-toggle { display: block; }
  .priority-grid { grid-template-columns: 1fr; }
  .reps-faces { flex-direction: column; }
  .slide-arrow { width: 40px; height: 40px; font-size: 16px; }
  .ward-cllr-grid { grid-template-columns: 1fr; }
  .footer-inner { flex-direction: column; align-items: flex-start; gap: 24px; }
  .footer-links { margin-left: 0; }
  .contact-panel { padding: 40px 24px; }
  .lead-rep-card { flex-direction: column; align-items: flex-start; padding: 24px; gap: 16px; }
  .lead-rep-img { width: 100%; height: auto; aspect-ratio: 1; min-width: unset; border-radius: 12px; }
  .lead-rep-body { width: 100%; }
  .team-panel { padding: 40px 24px; }
}
