/*
Theme Name: Redbridge Vihara
Theme URI: https://redbridgebuddhistvihara.org
Author: Redbridge Buddhist Vihara
Description: Custom minimal theme for Redbridge Buddhist Vihara — Forest Sangha / amaravati.org inspired design system.
Version: 1.0
Requires PHP: 8.0
Text Domain: redbridge-vihara
*/

/* ============================================================
   Redbridge Buddhist Vihara — design system (static prototype)
   Minimal, calm, spacious. Warm paper + quiet ink + one muted
   gold accent. Inspired by the Forest Sangha / amaravati.org look.
   This prototype will be converted into a WordPress custom theme.
   Edit the variables below to reskin the whole site.
   ============================================================ */

:root {
  --paper:   #f6f3ec;   /* warm cream base */
  --paper-2: #e8ecdd;   /* soft sage-green tint band */
  --ink:     #26231f;
  --head:    #223c2d;   /* deep green — headings carry a subtle green cast */
  --muted:   #64655b;
  --gold:    #c0812a;   /* warm Buddhist saffron-gold — brand marks & labels */
  --gold-d:  #9a6414;
  --green:   #35624a;   /* calm temple green — the accent "touch" (links, rules, nav) */
  --green-d: #27503b;
  --maroon:  #6a2528;   /* deep monastic red — used sparingly for depth */
  --line:    #e3ddd0;
  --white:   #fffdf9;

  --serif: "EB Garamond", Georgia, "Times New Roman", serif;
  --sans:  "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --wrap: 1040px;
  --narrow: 720px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.75;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--serif); font-weight: 500; line-height: 1.18; color: var(--head); margin: 0 0 .5em; }
h1 { font-size: clamp(2.4rem, 5.2vw, 3.6rem); letter-spacing: .005em; }
h2 { font-size: clamp(1.7rem, 3.4vw, 2.35rem); }
h3 { font-size: 1.4rem; }

p { margin: 0 0 1.15rem; }
a { color: var(--green-d); text-decoration: none; border-bottom: 1px solid rgba(39,80,59,.32); padding-bottom: 1px; transition: color .15s, border-color .15s; }
a:hover { color: var(--ink); border-color: var(--ink); }
img { max-width: 100%; height: auto; display: block; }

.wrap { width: min(100% - 2.5rem, var(--wrap)); margin-inline: auto; }
.narrow { max-width: var(--narrow); margin-inline: auto; }
.section { padding: clamp(3.5rem, 8vw, 6.5rem) 0; }
.section--tint { background: var(--paper-2); }
.center { text-align: center; }
.lead { font-size: 1.2rem; line-height: 1.7; color: var(--muted); }

.eyebrow { font-family: var(--sans); font-weight: 600; letter-spacing: .22em; text-transform: uppercase;
  font-size: .72rem; color: var(--gold-d); margin: 0 0 1rem; }
.rule { width: 54px; height: 2px; background: var(--green); border: 0; margin: 1.5rem auto; }

.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: #fff; padding: .6rem 1rem; z-index: 1000; }
.skip:focus { left: 0; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }

/* ---------- Buttons ---------- */
.btn { display: inline-block; font-family: var(--sans); font-weight: 600; font-size: .95rem; letter-spacing: .02em;
  padding: .75rem 1.75rem; border: 1px solid var(--ink); color: var(--ink); background: transparent;
  text-decoration: none; border-radius: 0; transition: background .18s, color .18s; cursor: pointer; }
.btn:hover { background: var(--ink); color: var(--paper); }
.btn--light { border-color: #fff; color: #fff; }
.btn--light:hover { background: #fff; color: var(--ink); }

/* ---------- Header / nav ---------- */
.site-header { position: sticky; top: 0; z-index: 100; background: var(--paper); border-bottom: 1px solid var(--line); }
.nav { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem 0; }
.brand { display: flex; align-items: center; gap: .7rem; text-decoration: none; border: 0; color: var(--ink); }
.brand__logo { width: 40px; height: 40px; flex: 0 0 auto; }
.brand__name { font-family: var(--serif); font-weight: 500; font-size: 1.2rem; line-height: 1.1; }
.brand__sub { display: block; font-family: var(--sans); font-size: .62rem; font-weight: 600; letter-spacing: .18em;
  text-transform: uppercase; color: var(--gold-d); }

.nav__links { display: flex; align-items: center; gap: .1rem; list-style: none; margin: 0; padding: 0; }
.nav__links a { display: block; padding: .45rem .8rem; border: 0; text-decoration: none; color: var(--muted);
  font-weight: 500; font-size: .95rem; }
.nav__links a:hover, .nav__links a[aria-current="page"] { color: var(--ink); }
.nav__links a[aria-current="page"] { border-bottom: 2px solid var(--green); padding-bottom: calc(.45rem - 2px); }

.nav__toggle { display: none; background: none; border: 0; cursor: pointer; padding: .3rem; color: var(--ink); }
.nav__toggle svg { width: 26px; height: 26px; }

@media (max-width: 860px) {
  .nav__toggle { display: inline-flex; }
  .nav__links { position: absolute; inset: 100% 0 auto 0; flex-direction: column; align-items: stretch; gap: 0;
    background: var(--paper); border-bottom: 1px solid var(--line); padding: .25rem 1.25rem 1rem; display: none; }
  .nav__links.is-open { display: flex; }
  .nav__links a { padding: .85rem .3rem; border-bottom: 1px solid var(--line); }
  .nav__links a[aria-current="page"] { border-bottom: 1px solid var(--line); }
}

/* ---------- Hero ---------- */
.hero { position: relative; color: #fff; text-align: center; background: #33251f; overflow: hidden; }
.hero__media { position: absolute; inset: 0; }
.hero__media img { width: 100%; height: 100%; object-fit: cover; }
.hero__media::after { content: ""; position: absolute; inset: 0; background: rgba(30,22,18,.45); }

/* Ambient hero effects — barely-there glow + resonance ripples (gold + green) */
.hero__fx { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 1; }
.hero__fx::before {           /* the slow "breathing" glow */
  content: ""; position: absolute; left: 50%; top: 46%; transform: translate(-50%,-50%) scale(1);
  width: min(92vw, 900px); aspect-ratio: 1; border-radius: 50%; filter: blur(8px);
  background: radial-gradient(circle,
    rgba(60,110,82,.30) 0%, rgba(205,150,70,.14) 46%, transparent 68%);
  animation: heroGlow 9s ease-in-out infinite alternate; will-change: transform, opacity;
}
.ripple {                     /* concentric rings that expand and fade */
  position: absolute; left: 50%; top: 46%; width: 300px; height: 300px; margin: -150px 0 0 -150px;
  border-radius: 50%; border: 1.5px solid rgba(60,110,82,.42); opacity: 0;
  animation: heroRipple 12s linear infinite; will-change: transform, opacity;
}
.ripple:nth-child(2) { border-color: rgba(205,150,70,.26); animation-delay: 4s; }
.ripple:nth-child(3) { border-color: rgba(60,110,82,.34); animation-delay: 8s; }
@keyframes heroGlow {
  from { opacity: .55; transform: translate(-50%,-50%) scale(.9); }
  to   { opacity: 1;   transform: translate(-50%,-50%) scale(1.1); }
}
@keyframes heroRipple {
  0%   { transform: scale(.35); opacity: 0; }
  12%  { opacity: .85; }
  100% { transform: scale(2.6); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .hero__fx::before { animation: none; opacity: .85; }
  .ripple { animation: none; opacity: .3; }
  .ripple:nth-child(1) { transform: scale(1); }
  .ripple:nth-child(2) { transform: scale(1.7); }
  .ripple:nth-child(3) { transform: scale(2.3); }
}

.hero__inner { position: relative; z-index: 2; padding: clamp(5rem, 15vw, 10rem) 0; }
.hero h1 { color: #fff; }
.hero p { font-size: 1.2rem; color: #f2ebdd; max-width: 44ch; margin: 1rem auto 0; }
.hero .rule { background: rgba(255,255,255,.7); }
.hero__cta { margin-top: 2.25rem; display: flex; gap: .8rem; justify-content: center; flex-wrap: wrap; }

/* ---------- Blocks ---------- */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(1.75rem, 5vw, 4rem); align-items: center; }
@media (max-width: 760px) { .split { grid-template-columns: 1fr; } }
.grid { display: grid; gap: clamp(1.5rem, 4vw, 3rem); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

.verse { font-family: var(--serif); font-size: clamp(1.4rem, 3.2vw, 2rem); line-height: 1.4; color: var(--head);
  font-style: italic; max-width: 30ch; }
.feature h3 { margin-bottom: .35em; }
.feature p { color: var(--muted); }

/* Times — minimal ruled list */
.times { width: 100%; border-collapse: collapse; }
.times caption { text-align: left; font-family: var(--serif); font-size: 1.3rem; margin-bottom: .6rem; color: var(--head); }
.times td { padding: .85rem .2rem; border-bottom: 1px solid var(--line); }
.times tr:last-child td { border-bottom: 0; }
.times td:last-child { text-align: right; font-weight: 600; white-space: nowrap; }

/* What's happening cards */
.happenings { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.5rem; margin-top: 2.5rem; text-align: left; }
.hcard { background: var(--white); border: 1px solid var(--line); padding: 1.5rem; }
.hcard .date { font-family: var(--sans); font-weight: 600; font-size: .78rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--gold-d); margin: 0 0 .4rem; }
.hcard h3 { font-size: 1.25rem; margin-bottom: .35rem; }
.hcard p { color: var(--muted); margin-bottom: .6rem; }

/* Placeholder box for missing imagery */
.ph { display: grid; place-items: center; background: var(--paper-2); color: var(--muted); border: 1px solid var(--line);
  min-height: 260px; font-style: italic; text-align: center; padding: 1rem; }

/* ---------- Footer ---------- */
.site-footer { background: #1f382a; color: #c7d1bc; padding: 3.75rem 0 1.75rem; }
.footer__top { display: grid; grid-template-columns: 1.25fr 1fr; gap: clamp(2rem, 5vw, 4rem); align-items: start; }
@media (max-width: 720px) { .footer__top { grid-template-columns: 1fr; gap: 2rem; } }
.footer__brand { display: flex; gap: 1rem; align-items: flex-start; }
.footer__mark { width: 46px; height: 46px; flex: 0 0 auto; }
.footer__name { font-family: var(--serif); font-size: 1.4rem; color: #fff; margin: 0 0 .4rem; line-height: 1.15; }
.footer__tag { color: #9fac93; max-width: 36ch; margin: 0 0 .7rem; font-size: .95rem; }
.footer__visit h3 { font-family: var(--serif); color: #fff; font-size: 1.25rem; margin: 0 0 .6rem; }
.footer__visit p { color: #c7d1bc; margin: 0 0 .6rem; line-height: 1.65; }
.footer__visit strong { color: #fff; font-weight: 600; }
.site-footer a { color: #d8b25a; border-bottom: 1px solid rgba(216,178,90,.35); }
.site-footer a:hover { color: #fff; border-color: #fff; }
.footer__bar { border-top: 1px solid rgba(255,255,255,.13); margin-top: 2.75rem; padding-top: 1.5rem; text-align: center; }
.footer__legal { color: #8b9781; font-size: .8rem; margin: 0; }

.stack > * + * { margin-top: 1rem; }

/* ---------- Interior-page header ---------- */
.page-head { background: var(--paper-2); text-align: center; padding: clamp(3.5rem, 8vw, 5.5rem) 0; }
.page-head .lead { margin-inline: auto; }

/* ---------- Timeline (History milestones + Programmes) ---------- */
.timeline { position: relative; max-width: 640px; margin: 2.5rem auto 0; }
.tl-item { position: relative; padding: 0 0 2.25rem 2.5rem; }
.tl-item::before { content: ""; position: absolute; left: 6px; top: .5rem; bottom: 0; width: 2px; background: var(--line); }
.tl-item:last-child::before { display: none; }
.tl-dot { position: absolute; left: 0; top: .3rem; width: 15px; height: 15px; border-radius: 50%;
  background: var(--gold); border: 3px solid var(--paper-2); box-sizing: border-box; }
.tl-item:nth-child(even) .tl-dot { background: var(--green); }
.tl-year { font-family: var(--sans); font-weight: 700; letter-spacing: .1em; font-size: .78rem;
  text-transform: uppercase; color: var(--gold-d); margin: 0 0 .2rem; }
.tl-item h3 { margin: 0 0 .3rem; font-size: 1.2rem; }
.tl-item p { color: var(--muted); margin: 0; }

/* ---------- Gallery grid (History photos + Gallery page) ---------- */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .75rem; }
.gallery .ph { min-height: 160px; }

/* ---------- Gallery page: event albums + lightbox ---------- */
.album { margin-top: 3.5rem; }
.album:first-child { margin-top: 2.5rem; }
.album__head { text-align: center; max-width: 640px; margin: 0 auto 1.75rem; }
.album-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .85rem; }
@media (max-width: 860px) { .album-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .album-grid { grid-template-columns: 1fr; } }

.gallery__item { position: relative; display: block; aspect-ratio: 4/3; overflow: hidden;
  border: 1px solid var(--line); background: var(--paper-2); border-radius: 0; cursor: pointer;
  transition: transform .18s, box-shadow .18s; }
.gallery__item:hover, .gallery__item:focus-visible { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(38,35,31,.12); }
.gallery__item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery__item.is-placeholder { display: grid; place-items: center; color: var(--muted); font-style: italic;
  font-size: .9rem; text-align: center; padding: 1rem; cursor: default; }
.gallery__item.is-placeholder:hover, .gallery__item.is-placeholder:focus-visible { transform: none; box-shadow: none; }
.gallery__item.is-placeholder img { display: none; }
.gallery__item.is-placeholder::after { content: "Photo coming soon"; }

/* Lightbox */
.lightbox { position: fixed; inset: 0; z-index: 1000; display: none; background: rgba(20,17,14,.92);
  align-items: center; justify-content: center; padding: 2rem; }
.lightbox.is-open { display: flex; }
.lightbox img { max-width: min(92vw, 1100px); max-height: 84vh; width: auto; height: auto; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.lightbox__close, .lightbox__prev, .lightbox__next { position: absolute; background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.3); color: #fff; cursor: pointer; width: 44px; height: 44px;
  border-radius: 50%; display: grid; place-items: center; transition: background .15s; }
.lightbox__close:hover, .lightbox__prev:hover, .lightbox__next:hover { background: rgba(255,255,255,.2); }
.lightbox__close { top: 1.25rem; right: 1.25rem; }
.lightbox__prev { left: 1.25rem; top: 50%; transform: translateY(-50%); }
.lightbox__next { right: 1.25rem; top: 50%; transform: translateY(-50%); }
.lightbox__caption { position: absolute; left: 0; right: 0; bottom: 1.25rem; text-align: center; color: #e9e4d8; font-size: .9rem; }
@media (max-width: 640px) {
  .lightbox__prev, .lightbox__next { width: 38px; height: 38px; }
  .lightbox__close { top: .6rem; right: .6rem; }
}

/* ---------- Gallery archive cards (collapsed past/other events) ---------- */
.archive-cards { max-width: 760px; margin: 2.5rem auto 0; display: flex; flex-direction: column; gap: .75rem; }
.archive-card { background: var(--white); border: 1px solid var(--line); }
.archive-card summary { list-style: none; cursor: pointer; padding: 1.1rem 1.4rem; font-family: var(--serif);
  font-size: 1.15rem; color: var(--head); display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; }
.archive-card summary::-webkit-details-marker { display: none; }
.archive-card summary::after { content: "+"; font-family: var(--sans); font-size: 1.4rem; font-weight: 400;
  color: var(--gold-d); line-height: 1; transition: transform .18s; }
.archive-card[open] summary::after { content: "\2212"; }
.archive-card summary:hover { color: var(--ink); }
.archive-card summary:focus-visible { outline: 2px solid var(--green); outline-offset: -2px; }
.archive-card .album-grid { padding: 0 1.4rem 1.4rem; }

/* ---------- Learn & Practice: sermon video embeds ---------- */
.videos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; margin-top: 2.5rem; }
@media (max-width: 760px) { .videos { grid-template-columns: 1fr; } }
.video-slot { aspect-ratio: 16/9; background: var(--paper-2); border: 1px solid var(--line); overflow: hidden; position: relative; }
.video-slot iframe { width: 100%; height: 100%; border: 0; display: block; }
.video-slot.is-placeholder { display: grid; place-items: center; color: var(--muted); font-style: italic;
  font-size: .9rem; text-align: center; padding: 1rem; }
.video-slot.is-placeholder::before { content: "\25B6"; display: block; font-size: 1.6rem; color: var(--gold-d);
  margin-bottom: .5rem; font-style: normal; }

/* ---------- Names line (founders) ---------- */
.names { font-family: var(--serif); font-size: 1.3rem; color: var(--head); line-height: 1.7; }

/* ---------- News & Events (interactive feed) ---------- */
.filters { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; margin: 0 0 2.75rem; }
.filter { font-family: var(--sans); font-weight: 600; font-size: .9rem; padding: .42rem 1.15rem;
  border: 1px solid var(--line); background: transparent; color: var(--muted); border-radius: 999px; cursor: pointer;
  transition: background .15s, color .15s, border-color .15s; }
.filter:hover { color: var(--ink); }
.filter.is-active { background: var(--green); color: #fff; border-color: var(--green); }
.feed { max-width: 720px; margin: 0 auto; }
.item { display: grid; grid-template-columns: 92px 1fr; gap: 1.25rem; padding: 1.6rem 0; border-bottom: 1px solid var(--line); }
.item:first-child { padding-top: 0; }
@media (max-width: 560px) { .item { grid-template-columns: 1fr; gap: .35rem; } }
.item__date { font-family: var(--serif); color: var(--head); line-height: 1.05; }
.item__date .d { font-size: 1.7rem; display: block; }
.item__date .m { font-size: .78rem; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); }
.item__tag { display: inline-block; font-family: var(--sans); font-size: .68rem; font-weight: 700;
  letter-spacing: .09em; text-transform: uppercase; padding: .15rem .5rem; border-radius: 4px; margin: 0 .4rem .5rem 0; }
.tag--event { background: rgba(53,98,74,.14); color: var(--green-d); }
.tag--news { background: rgba(192,129,42,.18); color: var(--gold-d); }
.tag--upcoming { background: var(--green); color: #fff; }
.item h3 { margin: .1rem 0 .35rem; font-size: 1.25rem; }
.item__excerpt { color: var(--muted); margin: 0; }
.item__more { background: none; border: 0; color: var(--green-d); font-weight: 600; font-size: .95rem;
  cursor: pointer; padding: 0; margin-top: .55rem; border-bottom: 1px solid rgba(39,80,59,.35); }
.item__more:hover { color: var(--ink); border-color: var(--ink); }
.item__body { display: none; margin-top: .7rem; color: var(--ink); }
.item.is-open .item__body { display: block; }
.feed__more { text-align: center; margin-top: 2.25rem; }
.feed__empty { text-align: center; color: var(--muted); padding: 2rem 0; font-style: italic; }

/* ---------- Programmes: annual programme table ---------- */
.prog { width: 100%; border-collapse: collapse; margin-top: 2rem; }
.prog th { text-align: left; font-family: var(--sans); font-size: .72rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--gold-d); padding: .6rem .5rem; border-bottom: 2px solid var(--line); }
.prog td { padding: .85rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.prog tr:hover td { background: rgba(53,98,74,.05); }
.prog td:first-child { white-space: nowrap; color: var(--head); font-weight: 600; padding-right: 1.5rem; width: 1%; }
.prog .fest { display: inline-block; font-size: .64rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; background: var(--green); color: #fff; padding: .12rem .5rem; border-radius: 4px;
  margin-left: .5rem; vertical-align: middle; }
.prog .sub { display: block; color: var(--muted); font-size: .9rem; margin-top: .15rem; }

/* Sinhala text (bilingual content) */
.si { display: block; font-family: "Noto Sans Sinhala", "Iskoola Pota", "Nirmala UI", var(--sans);
  font-size: .95rem; color: var(--muted); margin-top: .25rem; line-height: 1.6; }

/* ---------- WordPress core alignment/caption support ---------- */
.alignleft { float: left; margin: 0 1.5rem 1rem 0; }
.alignright { float: right; margin: 0 0 1rem 1.5rem; }
.aligncenter { display: block; margin: 0 auto 1rem; }
.wp-caption-text { color: var(--muted); font-size: .85rem; text-align: center; }
.screen-reader-text { position: absolute; left: -9999px; }
