/* =====================================================================
   Steward design layer — Orthodox character + interactive touches.
   Everything here is additive; delete this file and design.js to remove it.
   ===================================================================== */
:root {
  --gold: #B8923A;
  --gold-soft: #D9BC73;
  --gold-deep: #8F6D1F;
}

/* ---------- Lamp-lit (dark) mode: a church interior at vespers ---------- */
html[data-theme="dark"] {
  color-scheme: dark;
  /* dark walnut, taken from the Plitt Directory's moon theme: espresso ground, walnut cards, bone text, light-walnut accent */
  --cream-bg: #211A12;
  --cream-panel: #2C2419;
  --cream-card: #271F16;
  --cream-light: #3A3024;
  --brown: #C09873;
  --brown-deep: #ECE3D0;
  --brown-mid: #C0987374;
  --brown-soft: #B0A38D;
  --brown-line: #41392F;
  --brown-text: #D9CFBC;
  --shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
  --gold: #C09873;
  --gold-soft: #8F7557;
  --gold-deep: #D8B995;
}
html[data-theme="dark"] .leaflet-tile-pane {
  filter: invert(1) hue-rotate(180deg) brightness(0.9) contrast(0.86) sepia(0.3) saturate(0.8);
}
html[data-theme="dark"] .leaflet-container { background: #211A12; }
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea { color-scheme: dark; }
html[data-theme="dark"] .leaflet-control-zoom a { background: var(--cream-panel); color: var(--brown-deep); border-color: var(--brown-line); }
html[data-theme="dark"] .leaflet-popup-content-wrapper,
html[data-theme="dark"] .leaflet-popup-tip { background: var(--cream-panel); color: var(--brown-deep); }
html[data-theme="dark"] .leaflet-control-attribution { background: rgba(33, 26, 18, .75); color: var(--brown-soft); }
html[data-theme="dark"] .leaflet-control-attribution a { color: var(--brown); }

/* soft candlelight that follows the cursor (dark mode only) */
.candle-glow { position: fixed; inset: 0; pointer-events: none; z-index: 5; opacity: 0; transition: opacity .6s ease; }
html[data-theme="dark"] .candle-glow {
  opacity: 1;
  background: radial-gradient(520px circle at var(--mx, 50%) var(--my, 18%), rgba(236, 190, 140, .11), rgba(230, 170, 110, .04) 45%, transparent 70%);
  mix-blend-mode: screen;
}

/* ---------- Parchment grain ---------- */
body {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .36  0 0 0 0 .2  0 0 0 0 .12  0 0 0 .07 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
html[data-theme="dark"] body { background-image: none; }

/* ---------- Today's feast (Orthodox calendar) ---------- */
.feast-bar {
  background: var(--brown-deep);
  color: #EFE5D5;
  font-size: 12.5px;
  letter-spacing: .04em;
  text-align: center;
  padding: 6px 14px;
  line-height: 1.4;
}
html[data-theme="dark"] .feast-bar { background: #17120c; color: #D9CFBC; border-bottom: 1px solid var(--brown-line); }
html[data-theme="dark"] .feast-bar strong, html[data-theme="dark"] .feast-bar .feast-greet { color: #ECE3D0; }
html[data-theme="dark"] .feast-bar .feast-cross { fill: #C09873; }
.feast-bar[hidden] { display: none; }
.feast-bar .feast-cross { display: inline-block; width: 8px; height: 13px; vertical-align: -2px; margin-right: 8px; fill: var(--gold-soft); }
.feast-bar strong { font-weight: 600; color: #F3DC9A; }
.feast-bar .feast-sep { opacity: .45; margin: 0 8px; }
.feast-bar .feast-greet { font-style: italic; color: #F3DC9A; margin-right: 8px; }

/* ---------- Byzantine meander + illuminated initial ---------- */
.meander, .site-footer::before, .page-hero + .page-section::before, .page-section + .page-section::before {
  content: "";
  display: block;
  height: 12px;
  margin: 0 auto 22px;
  max-width: 340px;
  opacity: .6;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='28' height='12' viewBox='0 0 28 12'><path d='M0 6H28' stroke='%23B8923A' stroke-width='1' opacity='.55'/><path d='M14 1.8l4.2 4.2-4.2 4.2-4.2-4.2z' fill='%23B8923A'/><path d='M14 4.4l1.6 1.6-1.6 1.6-1.6-1.6z' fill='%23FBEEE3'/></svg>") repeat-x center / 28px 12px;
}
.site-footer::before { margin-bottom: 14px; max-width: 520px; }
.page-hero + .page-section > p:first-of-type::first-letter {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  font-size: 3.5em;
  line-height: .82;
  float: left;
  margin: .04em .12em 0 0;
  padding: .02em .1em .04em;
  color: var(--brown);
  border: 1px solid var(--gold-soft);
  border-radius: 3px;
  background: linear-gradient(145deg, rgba(184, 146, 58, .2), rgba(184, 146, 58, .04));
}

/* ---------- Arch-topped photo cards, gold-leaf edges ---------- */
.browse-card { border-radius: 16px 16px var(--radius-md) var(--radius-md); border-color: var(--brown-line); position: relative; }
.browse-card-photo {
  border-radius: 50% 50% 10px 10px / 26% 26% 10px 10px;
  overflow: hidden;
  box-shadow: 0 0 0 2px var(--cream-panel), 0 0 0 3px var(--gold-soft);
  margin: 8px 8px 0;
}
.browse-card:hover .browse-card-photo { box-shadow: 0 0 0 2px var(--cream-panel), 0 0 0 3px var(--gold); }
.browse-card-fav { top: 14px; right: 14px; }
.listing-card { border-left: 3px solid transparent; }
.listing-card.selected, .listing-card:hover { border-left-color: var(--gold); }
.leaflet-popup-content-wrapper {
  border-radius: 34px 34px 12px 12px / 22px 22px 12px 12px;
  border: 1px solid var(--gold-soft);
  box-shadow: 0 6px 20px rgba(67, 48, 31, .25);
}
.leaflet-popup-content { margin: 14px 18px 12px; text-align: center; }

/* ---------- "Parish verified" seal ---------- */
.seal {
  position: relative; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 19px; height: 19px; margin-left: 6px; vertical-align: middle; overflow: hidden; border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, #F6E3A6, #CDA84F 55%, #9A7424);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .55), 0 1px 3px rgba(60, 35, 10, .45);
}
.seal svg { width: 8px; height: 13px; fill: #43301F; position: relative; z-index: 1; }
.seal::after {
  content: ""; position: absolute; top: -40%; bottom: -40%; left: -90%; width: 45%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .75), transparent);
  transform: rotate(20deg); animation: sealShine 5s ease-in-out infinite;
}
@keyframes sealShine { 0%, 65% { left: -90%; } 100% { left: 150%; } }
.seal-pill {
  display: inline-flex; align-items: center; gap: 2px; padding: 3px 12px 3px 6px; border-radius: 999px; font-size: 12.5px;
  color: var(--gold-deep); border: 1px solid var(--gold-soft); background: rgba(184, 146, 58, .1);
}
.seal-pill .seal { margin-left: 0; margin-right: 6px; }
.map-popup .seal { margin: 0 0 0 6px; }

/* ---------- Map pins: cross for parishes, olive branch for goods ---------- */
.pin-icon { transition: box-shadow .18s ease, transform .18s ease; }
.pin-icon:hover { box-shadow: 0 0 0 5px rgba(184, 146, 58, .38), 0 2px 8px rgba(67, 48, 31, .4); }
.pin-icon .glyph { display: inline-flex; }
.pin-icon .glyph svg { width: 14px; height: 15px; fill: var(--cream-light); stroke: none; }
.pin-icon .glyph svg.olive { fill: none; stroke: var(--cream-light); stroke-width: 1.7; stroke-linecap: round; }
.pin-icon .glyph svg.olive .leaf { fill: var(--cream-light); stroke: none; }
html[data-theme="dark"] .pin-icon { border-color: #211A12; }

/* ---------- Header: theme toggle ---------- */
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; padding: 0; flex-shrink: 0;
  border-radius: 50%; border: 1px solid var(--brown-line); background: var(--cream-panel); color: var(--brown); cursor: pointer;
  transition: border-color .15s, background .15s;
}
.theme-toggle:hover { border-color: var(--brown); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .ico-moon { display: none; }
html[data-theme="dark"] .theme-toggle .ico-sun { display: none; }
html[data-theme="dark"] .theme-toggle .ico-moon { display: inline; }
.page-nav-links .theme-toggle { width: 32px; height: 32px; }
.page-nav-links .theme-toggle svg { width: 16px; height: 16px; }

/* ---------- Light a candle ---------- */
.candle-row { display: inline-flex; align-items: center; gap: 10px; margin: 0 10px 10px 0; vertical-align: top; }
.candle-btn {
  display: inline-flex; align-items: center; gap: 9px; padding: 8px 16px 8px 12px; border-radius: 999px; cursor: pointer;
  font: inherit; font-size: 14px; color: var(--brown); background: transparent; border: 1px solid var(--brown-line);
  transition: border-color .15s, background .15s;
}
.candle-btn:hover { border-color: var(--gold); background: rgba(184, 146, 58, .08); }
.candle-icon { position: relative; width: 12px; height: 22px; flex-shrink: 0; }
.candle-icon::before { /* the candle */
  content: ""; position: absolute; left: 2px; right: 2px; bottom: 0; height: 11px; border-radius: 2px 2px 1px 1px;
  background: linear-gradient(90deg, #E9D4A4, #F8EBC8 55%, #D6BC84);
}
.candle-flame {
  position: absolute; left: 50%; bottom: 10px; width: 8px; height: 12px; margin-left: -4px; border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%;
  background: radial-gradient(circle at 50% 72%, #FFF6CF, #F7BE45 55%, #E5831E); transform-origin: 50% 90%;
  opacity: 0; transform: scale(.3);
  transition: opacity .35s ease, transform .35s ease;
}
.candle-row.lit .candle-flame { opacity: 1; transform: scale(1); animation: flicker 1.7s infinite ease-in-out; box-shadow: 0 0 14px 4px rgba(247, 190, 69, .5); }
.candle-row.lit .candle-btn { border-color: var(--gold); color: var(--gold-deep); }
.candle-count { font-size: 13px; color: var(--brown-soft); }
@keyframes flicker {
  0%, 100% { transform: scale(1, 1) rotate(-2deg); }
  25% { transform: scale(.93, 1.08) rotate(2deg); }
  55% { transform: scale(1.05, .95) rotate(-1deg); }
  80% { transform: scale(.97, 1.05) rotate(1.5deg); }
}

/* ---------- Pilgrimage trail (map) ---------- */
.trail-control { background: var(--cream-panel); border: 1px solid var(--brown-line); border-radius: 12px; box-shadow: var(--shadow); padding: 4px; }
.trail-btn {
  display: flex; align-items: center; gap: 7px; padding: 7px 12px; border: 0; background: transparent; cursor: pointer;
  font: inherit; font-size: 13px; color: var(--brown); border-radius: 9px; white-space: nowrap;
}
.trail-btn:hover { background: rgba(184, 146, 58, .12); }
.trail-btn svg { width: 14px; height: 14px; }
.trail-label { padding: 7px 12px; font-size: 13px; color: var(--brown-deep); display: none; align-items: center; gap: 10px; }
.trail-control.active .trail-btn { display: none; }
.trail-control.active .trail-label { display: flex; }
.trail-label button { border: 0; background: none; color: var(--brown); font: inherit; font-size: 12.5px; text-decoration: underline; cursor: pointer; padding: 0; }
.trail-stop {
  width: 22px; height: 22px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #F6E3A6, #CDA84F 60%, #9A7424);
  color: #4a2b14; font: 700 11px/22px 'Lora', serif; text-align: center; box-shadow: 0 1px 4px rgba(0, 0, 0, .45); border: 1.5px solid #fff8;
}

/* ---------- The olive tree in the header ---------- */
.header-tree {
  /* zero-height box so the tree never changes the header's height; the drawing hangs above the baseline */
  position: relative; flex-shrink: 0; width: 66px; height: 0; margin: 0 0 var(--tree-drop, 2.5px) 2px; padding: 0; align-self: flex-end;
  border: 0; background: transparent; cursor: pointer; -webkit-tap-highlight-color: transparent; overflow: visible;
}
.header-tree canvas {
  position: absolute; left: 0; bottom: 0; display: block; width: 66px; height: 56px; transition: transform .25s ease; transform-origin: 50% 100%;
}
.header-tree:hover canvas, .header-tree:focus-visible canvas { transform: scale(1.08); }
.header-tree:focus-visible { outline: none; }
.header-tree:focus-visible canvas { filter: drop-shadow(0 0 3px var(--gold)); }
.header-tree-tip {
  position: absolute; left: 33px; top: 12px; z-index: 20; width: max-content; max-width: 250px; padding: 8px 12px;
  background: var(--cream-panel); color: var(--brown-deep); border: 1px solid var(--gold-soft); border-radius: 12px;
  box-shadow: 0 6px 18px rgba(67, 48, 31, .25); font-size: 12.5px; line-height: 1.4; text-align: center; white-space: normal;
  transform: translate(-50%, 4px); opacity: 0; pointer-events: none; transition: opacity .18s ease, transform .18s ease;
}
.header-tree:hover .header-tree-tip, .header-tree:focus-visible .header-tree-tip { opacity: 1; transform: translate(-50%, 0); }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Preview ribbon (only shown with ?demo=1 on localhost) ---------- */
body.demo-mode::after {
  content: "Preview · sample data"; position: fixed; left: 12px; bottom: 12px; z-index: 9999; padding: 5px 12px;
  background: #43301F; color: #F3DC9A; font: 600 11px/1.2 'Lora', serif; letter-spacing: .08em; text-transform: uppercase;
  border-radius: 999px; box-shadow: 0 2px 8px rgba(0, 0, 0, .35); pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .seal::after, .candle-row.lit .candle-flame { animation: none; }
}
@media (max-width: 640px) {
  .header-tree { width: 52px; margin: 0 0 var(--tree-drop, 2.5px) 0; }
  .header-tree canvas { width: 52px; height: 45px; }
  .header-tree-tip { display: none; }   /* no hover on touch; and it must not widen the page */
  .feast-bar { font-size: 11.5px; padding: 5px 10px; }
}

/* phone: lamp button sits at the top-right so the header stays two rows */
@media (max-width: 640px) {
  .site-header { position: relative; justify-content: flex-start; }
  .header-actions .theme-toggle { position: absolute; top: 16px; right: 16px; }
}

/* medium widths: when the header wraps, keep the tree snug against the logo */
@media (max-width: 860px) {
  .site-header { justify-content: flex-start; }
  .header-actions { margin-left: auto; }
}


/* ---------- Beeswax candles: take the olive tree's place in lamp-lit mode ---------- */
.header-candles { display: none; position: absolute; left: 0; bottom: 0; width: 66px; height: 56px; pointer-events: none; transform-origin: 0 100%; }
html[data-theme="dark"] .header-tree canvas { display: none; }
html[data-theme="dark"] .header-candles { display: block; }
.header-candles::after { /* a thin brass rail they stand on */
  content: ""; position: absolute; left: 3px; right: 3px; bottom: 0; height: 3px; border-radius: 2px;
  background: linear-gradient(90deg, #6F5640, #C09873 50%, #6F5640); box-shadow: 0 1px 4px rgba(0, 0, 0, .55);
}
.header-candles::before { /* faint warm glow behind the flames */
  content: ""; position: absolute; left: 0; right: 0; bottom: 8px; height: 46px;
  background: radial-gradient(60% 70% at 50% 85%, rgba(230, 160, 85, .20), transparent 75%);
}
.bw { position: absolute; bottom: 3px; width: var(--w, 6px); height: var(--h); left: var(--x); }
.bw .body {
  position: absolute; inset: 0; border-radius: 3px 3px 1px 1px;           /* tapered beeswax: honey, a little translucent */
  background: linear-gradient(90deg, #98733D, #CDA86A 45%, #AC8548);
  box-shadow: inset 0 2px 3px rgba(255, 224, 160, .35);
}
.bw .body::after { /* melted rim at the top */
  content: ""; position: absolute; left: -1px; right: -1px; top: -1px; height: 4px; border-radius: 50%; background: #D9BC84; opacity: .8;
}
.bw .wick { position: absolute; left: 50%; bottom: 100%; width: 1px; height: 3px; background: #2d2218; transform: translateX(-50%); }
.bw .flame {
  position: absolute; left: 50%; bottom: calc(100% + 2px); width: var(--fw, 6px); height: var(--fh, 11px); margin-left: calc(var(--fw, 6px) / -2);
  border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%; transform-origin: 50% 92%;
  background: radial-gradient(circle at 50% 76%, #FFF2D6, #F0B368 55%, #D9772F);
  box-shadow: 0 0 7px 2px rgba(232, 150, 70, .38), 0 0 18px 6px rgba(232, 150, 70, .14);
  animation: igniteFlame .8s ease-out backwards var(--ignite, 0s), candleFlicker var(--d, 1.7s) infinite ease-in-out var(--delay, 0s);
}
.header-tree:hover .bw .flame, .header-tree:focus-visible .bw .flame { box-shadow: 0 0 10px 3px rgba(240, 165, 85, .55), 0 0 24px 8px rgba(232, 150, 70, .22); }
.header-tree.flare .bw .flame { animation: igniteFlame .5s ease-out both, candleFlicker .5s infinite ease-in-out; }
@keyframes candleFlicker {
  0%, 100% { transform: scale(1, 1) rotate(-2deg); }
  22% { transform: scale(.92, 1.1) rotate(2.5deg); }
  50% { transform: scale(1.06, .94) rotate(-1deg); }
  78% { transform: scale(.96, 1.06) rotate(1.5deg); }
}
@keyframes igniteFlame { 0% { opacity: 0; transform: scale(.1); } 60% { opacity: 1; transform: scale(1.25); } 100% { opacity: 1; transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .bw .flame { animation: none; } }
@media (max-width: 640px) { .header-candles { transform: scale(.79); } }
