/*
Theme Name: VEK Valhalla
Theme URI: https://vekvalhalla.org.za/
Author: Volle Evangelie Kerk Valhalla
Author URI: https://vekvalhalla.org.za/
Description: Custom WordPress theme for Volle Evangelie Kerk Valhalla with 3Ci-style Teachings (Nuutste Onderrig), downloadable notes/audio, Events Calendar (Geleenthede), Ministries, Pastoral Couple, Contact & Giving, and built-in Admin panel.
Version: 2.0.0
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 8.0
License: GPL v2 or later
Text Domain: vek-valhalla
*/

/* Layout: calm single-column sections on a cream ground, wide whitespace,
   maroon only for actions and the footer, orange only for small date marks. */
:root {
  --cream: #F8F3E9;
  --paper: #FFFCF6;
  --sand: #EFE6D4;
  --line: #E6DCCB;
  --ink: #2B2220;
  --muted: #75685F;
  --maroon: #6E2A35;
  --maroon-deep: #4A1B24;
  --amber: #B8601C;

  --font-display: 'Bricolage Grotesque', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Manrope', 'Segoe UI', system-ui, sans-serif;

  --radius: 14px;
  --gutter: clamp(16px, 4vw, 32px);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font: 400 1.0625rem/1.65 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--maroon); text-underline-offset: 3px; }
a:hover { color: var(--maroon-deep); }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.12; letter-spacing: -0.01em; margin: 0 0 .5em; text-wrap: balance; font-weight: 700; }
h1 { font-size: clamp(2.2rem, 5.5vw, 3.8rem); }
h2 { font-size: clamp(1.7rem, 3.4vw, 2.3rem); }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1em; }

.wrap { width: 100%; max-width: 1120px; margin-inline: auto; padding-inline: var(--gutter); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--maroon); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 50; }
.skip:focus { left: 8px; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--cream) 92%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 72px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); font: 700 1.15rem var(--font-display); }
.brand img { border-radius: 10px; object-fit: contain; width: 44px; height: 44px; }
.nav { display: flex; align-items: center; gap: clamp(12px, 2vw, 26px); flex-wrap: wrap; }
.nav a:not(.btn) { color: var(--ink); text-decoration: none; font-weight: 600; font-size: .95rem; padding: 6px 0; border-bottom: 2px solid transparent; }
.nav a:not(.btn):hover { border-color: var(--line); }
.nav a[aria-current="page"] { border-color: var(--amber); }
.menu-btn { display: none; background: none; border: 1px solid var(--line); border-radius: 999px; padding: 8px 16px; font: 600 .95rem var(--font-body); color: var(--ink); cursor: pointer; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--maroon); color: #fff; border: 1px solid var(--maroon); border-radius: 999px; padding: 13px 26px; font: 600 1rem var(--font-body); text-decoration: none; cursor: pointer; transition: background .15s; }
.btn:hover { background: var(--maroon-deep); color: #fff; }
.btn-small { padding: 8px 18px; font-size: .92rem; }
.btn-ghost { background: transparent; color: var(--maroon); }
.btn-ghost:hover { background: var(--sand); color: var(--maroon-deep); }
.btn-danger { background: transparent; color: #9b2c2c; border-color: #d9b5b5; }
.btn-danger:hover { background: #f6e3e3; color: #7a1f1f; }

/* Sections */
.section { padding-block: clamp(48px, 8vw, 96px); }
.section-tight { padding-block: clamp(32px, 5vw, 56px); }
.section-alt { background: var(--paper); border-block: 1px solid var(--line); }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }
.section-head h2 { margin: 0; }
.eyebrow { font: 700 .78rem var(--font-body); letter-spacing: .14em; text-transform: uppercase; color: var(--amber); margin: 0 0 12px; }
.lead { font-size: 1.2rem; color: var(--muted); max-width: 56ch; }
.muted { color: var(--muted); }

/* Hero */
.hero { padding-block: clamp(40px, 7vw, 88px) clamp(32px, 5vw, 56px); }
.hero-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: clamp(28px, 5vw, 64px); align-items: center; }
.hero-grid > * { min-width: 0; }
.hero h1 { margin-bottom: .4em; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; }
.hero-img { border-radius: 24px; aspect-ratio: 4/3.2; object-fit: cover; width: 100%; align-self: center; background: var(--sand); }

.facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); margin-top: clamp(28px, 4vw, 48px); }
.fact { padding: 20px 24px; min-width: 0; }
.fact + .fact { border-left: 1px solid var(--line); }
.fact-label { font: 700 .74rem var(--font-body); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 0 0 4px; }
.fact-value { font: 600 1.05rem/1.4 var(--font-display); margin: 0; overflow-wrap: anywhere; }
.fact-value a { text-decoration: none; color: var(--maroon); }
.fact-value a:hover { text-decoration: underline; }

/* Series & Filter Bar (3Ci style) */
.filter-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; padding: 16px 20px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.filter-pills { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; padding: 6px 14px; border-radius: 999px; font: 600 .86rem var(--font-body); text-decoration: none; color: var(--ink); background: var(--cream); border: 1px solid var(--line); transition: all .15s; }
.pill:hover { border-color: var(--maroon); color: var(--maroon); }
.pill.is-active { background: var(--maroon); color: #fff; border-color: var(--maroon); }
.series-badge { display: inline-block; font: 700 .72rem var(--font-body); letter-spacing: .08em; text-transform: uppercase; color: var(--amber); background: var(--sand); padding: 3px 9px; border-radius: 6px; margin-bottom: 4px; width: fit-content; }
.search-inline { display: flex; gap: 8px; align-items: center; }
.search-inline input[type=search] { padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; background: #fff; font: inherit; font-size: .9rem; min-width: 200px; }

/* Teaching cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 20px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.card h3 { margin: 0; }
.card h3 a, .teaching h2 a { color: var(--ink); text-decoration: none; }
.card h3 a:hover, .teaching h2 a:hover { color: var(--maroon); }
.meta { font-size: .9rem; color: var(--muted); margin: 0; }
.card p { margin: 0; }
.file-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.file { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--cream); text-decoration: none; color: var(--ink); min-width: 0; transition: border-color .15s; }
.file:hover { border-color: var(--maroon); color: var(--ink); }
.file-ext { flex: none; font: 700 .7rem var(--font-body); letter-spacing: .06em; text-transform: uppercase; background: var(--sand); color: var(--maroon); border-radius: 6px; padding: 4px 7px; }
.file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: .95rem; }
.file-size { flex: none; font-size: .82rem; color: var(--muted); }
.file-cta { flex: none; font-weight: 700; font-size: .85rem; color: var(--maroon); }
.card-foot { margin-top: auto; padding-top: 8px; display: flex; flex-wrap: wrap; gap: 14px; align-items: center; font-weight: 600; font-size: .92rem; }

.teaching-list { display: flex; flex-direction: column; gap: 20px; }
.teaching { display: grid; grid-template-columns: 200px 1fr; gap: 28px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; }
.teaching > * { min-width: 0; }
.teaching h2 { font-size: 1.5rem; margin-bottom: .3em; }
.teaching-date { font: 700 1.05rem var(--font-display); margin: 0; }
.teaching-speaker { color: var(--muted); font-size: .92rem; margin: 4px 0 0; }
.video-embed { margin-top: 14px; border-radius: 12px; overflow: hidden; aspect-ratio: 16/9; background: #000; max-width: 720px; }
.video-embed iframe { width: 100%; height: 100%; border: 0; }
.audio-player { margin-top: 10px; width: 100%; max-width: 520px; }

/* Events */
.event-list { display: flex; flex-direction: column; gap: 14px; }
.event { display: grid; grid-template-columns: 76px 1fr; gap: 20px; align-items: start; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 24px; }
.event > * { min-width: 0; }
.event-date { text-align: center; border-right: 1px solid var(--line); padding-right: 20px; }
.event-day { display: block; font: 700 2rem/1 var(--font-display); }
.event-month { display: block; font: 700 .78rem var(--font-body); letter-spacing: .12em; text-transform: uppercase; color: var(--amber); margin-top: 6px; }
.event h3 { margin: 0 0 4px; }
.event p { margin: 4px 0 0; }
.event.is-past { background: transparent; opacity: .8; }
.empty { padding: 32px; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); }

/* Statement */
.statement { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.statement > * { min-width: 0; }
.statement h3 { margin-bottom: .4em; }
.statement .tile { padding: 28px; background: var(--cream); border: 1px solid var(--line); border-radius: var(--radius); }
.tile p { margin: 0 0 .7em; }
.tile ul { margin: 0; padding-left: 1.1em; }
.tile li { margin-bottom: .45em; }
.verse { color: var(--muted); font-size: .88rem; }

/* Contact */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(24px, 4vw, 56px); }
.two-col > * { min-width: 0; }
.detail-list { list-style: none; padding: 0; margin: 0 0 24px; display: grid; gap: 14px; }
.detail-list dt { font: 700 .74rem var(--font-body); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.detail-list dd { margin: 2px 0 0; font-weight: 600; overflow-wrap: anywhere; }
.map { width: 100%; height: 100%; min-height: 320px; border: 0; border-radius: var(--radius); background: var(--sand); }
.bank { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px 28px; max-width: 520px; }
.bank dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 8px 24px; }
.bank dt { color: var(--muted); }
.bank dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

/* Rich Content & Text pages */
.prose { max-width: 68ch; }
.prose-wide { max-width: 100%; }
.prose h3, .prose-wide h2, .prose-wide h3 { margin-top: 1.4em; }
.page-title { padding-block: clamp(40px, 6vw, 72px) 8px; }
.ministry-grid { display: grid; gap: 28px; }
.ministry-card { display: grid; grid-template-columns: 1.2fr .8fr; gap: 32px; align-items: center; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; }
.ministry-card:nth-child(even) { grid-template-columns: .8fr 1.2fr; }
.ministry-card img { border-radius: 12px; width: 100%; max-height: 340px; object-fit: cover; background: var(--sand); }
.ministry-card ul { margin: 8px 0 0; padding-left: 1.2em; }
.ministry-card li { margin-bottom: 6px; }
.pastor-portraits { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 320px)); gap: 24px; justify-content: center; margin-bottom: 24px; }
.pastor-portraits img { border-radius: var(--radius); width: 100%; height: 360px; object-fit: cover; object-position: top; background: var(--sand); border: 1px solid var(--line); }
.bio-section { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; margin-bottom: 24px; }

/* Pager */
.pager { display: flex; gap: 12px; justify-content: center; margin-top: 32px; }

/* Footer */
.site-footer { background: var(--maroon-deep); color: #EADFD0; padding-top: 56px; margin-top: 0; }
.site-footer a { color: #fff; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 32px; }
.footer-grid > * { min-width: 0; }
.footer-grid p { margin: 0 0 .4em; overflow-wrap: anywhere; }
.footer-name { font: 700 1.2rem var(--font-display); color: #fff; margin-bottom: .5em !important; }
.footer-label { font: 700 .74rem var(--font-body); letter-spacing: .12em; text-transform: uppercase; color: #C9B8A3; margin-bottom: .6em !important; }
.footer-base { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 40px; padding-block: 20px; border-top: 1px solid rgba(255,255,255,.14); font-size: .88rem; color: #C9B8A3; }
.footer-base a { color: #C9B8A3; }

/* Responsive */
@media (max-width: 860px) {
  .hero-grid, .two-col, .statement, .footer-grid, .ministry-card, .ministry-card:nth-child(even) { grid-template-columns: 1fr; }
  .facts { grid-template-columns: 1fr; }
  .fact + .fact { border-left: 0; border-top: 1px solid var(--line); }
  .teaching { grid-template-columns: 1fr; gap: 12px; padding: 22px; }
  .menu-btn { display: inline-block; }
  .nav { display: none; width: 100%; flex-direction: column; align-items: stretch; gap: 0; padding-bottom: 16px; }
  .nav.is-open { display: flex; }
  .nav a:not(.btn) { padding: 12px 0; border-bottom: 1px solid var(--line); }
  .nav .btn { margin-top: 12px; }
  .hero-img { order: -1; aspect-ratio: 16/10; }
}
@media (max-width: 480px) {
  .event { grid-template-columns: 60px 1fr; gap: 14px; padding: 16px; }
  .event-date { padding-right: 14px; }
  .bank dl { grid-template-columns: 1fr; gap: 2px; }
  .bank dd { margin-bottom: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

/* ---- Admin ---- */
.admin-bar { background: var(--paper); border-bottom: 1px solid var(--line); }
.admin-bar .wrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; min-height: 60px; padding-block: 8px; }
.admin-bar strong { font-family: var(--font-display); margin-right: 8px; }
.admin-bar a { font-weight: 600; text-decoration: none; color: var(--ink); }
.admin-bar a[aria-current="page"] { color: var(--maroon); text-decoration: underline; text-decoration-color: var(--amber); text-decoration-thickness: 2px; }
.admin-bar .spacer { flex: 1; }
.admin-main { padding-block: 40px 80px; }
.admin-main h1 { font-size: 2rem; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; margin-bottom: 28px; }
.panel h2 { font-size: 1.35rem; }
.form-grid { display: grid; gap: 18px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-row > * { min-width: 0; }
label { display: block; font-weight: 700; font-size: .92rem; margin-bottom: 6px; }
.hint { font-weight: 400; color: var(--muted); font-size: .85rem; }
input[type=text], input[type=password], input[type=date], input[type=url], textarea, input[type=file], select {
  width: 100%; font: inherit; color: var(--ink); background: #fff; border: 1px solid #D5C9B6; border-radius: 10px; padding: 11px 14px;
}
textarea { min-height: 120px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 3px solid color-mix(in srgb, var(--amber) 45%, transparent); border-color: var(--amber); }
.actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.flash { padding: 14px 18px; border-radius: 10px; margin-bottom: 20px; font-weight: 600; }
.flash-ok { background: #E6F0E1; color: #2C5A1E; border: 1px solid #C5DDBA; }
.flash-err { background: #F8E3E3; color: #7A1F1F; border: 1px solid #E8C4C4; }
.table-wrap { overflow-x: auto; }
table.vek-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
table.vek-table th, table.vek-table td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.vek-table th { font: 700 .74rem var(--font-body); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
table.vek-table td.row-actions { white-space: nowrap; }
.inline-form { display: inline; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; font-weight: 600; color: #9b2c2c; cursor: pointer; text-decoration: underline; }
.existing-files { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 6px; }
.existing-files label { display: flex; gap: 10px; align-items: center; font-weight: 500; margin: 0; }
.auth-box { max-width: 440px; margin: 64px auto; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }
