/* ==========================================================================
   Winterthur Events — timeline stylesheet
   ==========================================================================

   This plugin is the BRIDGE between the theme-agnostic religious-services
   plugin (which owns the data) and whatever theme a parish happens to run
   (which owns the branding). It therefore ships its own styling: it must
   not depend on the host theme defining classes for it, and the host theme
   must not need editing to make this plugin look right.

   THEMING CONTRACT
   ----------------
   Every colour and font below resolves through a CSS custom property with a
   built-in fallback:

       --color-carmine     primary / accent        (fallback #7A1F2B)
       --color-gold        ornament, hover rules   (fallback #B8893A)
       --color-lapis       links, times            (fallback #1E3A5F)
       --color-walnut      body text               (fallback #2B1810)
       --color-bronze      muted / marginalia      (fallback #8B7355)
       --color-parchment   page ground             (fallback #F4EBD9)
       --font-display      headings / dates        (fallback Cormorant stack)
       --font-body         times, labels, feasts   (fallback Source Serif stack)

   A theme that defines those properties brands this plugin automatically,
   with no code change on either side. A theme that defines none of them
   still gets a coherent result from the fallbacks.

   For a parish whose theme uses different token names, the single
   `.we-timeline` block below is the only thing that needs editing —
   remap the right-hand side and everything downstream follows.

   All classes are `we-` prefixed so they cannot collide with a host
   theme's own CSS. Deliberately plain CSS, no build step: this plugin
   deploys as a file copy.
   ========================================================================== */

.we-timeline {
  /* ---- Theming contract: remap these for a different theme ---- */
  --we-accent:    var(--color-carmine,   #7A1F2B);
  --we-ornament:  var(--color-gold,      #B8893A);
  --we-link:      var(--color-lapis,     #1E3A5F);
  --we-text:      var(--color-walnut,    #2B1810);
  --we-muted:     var(--color-bronze,    #8B7355);
  --we-surface:   var(--color-parchment, #F4EBD9);
  --we-font-display: var(--font-display, 'Cormorant Garamond', Georgia, serif);
  --we-font-body:    var(--font-body, 'Source Serif 4', Georgia, serif);

  position: relative;
  list-style: none;
  padding: 0;
  margin: 0;
}

/* The hairline gilded thread — a gold dotted line at low opacity. */
.we-timeline::before {
  content: "";
  position: absolute;
  left: 8rem;
  top: 1.25rem;
  bottom: 1.25rem;
  width: 1px;
  background-image: linear-gradient(
    to bottom,
    var(--we-ornament) 0,
    var(--we-ornament) 4px,
    transparent 4px,
    transparent 10px
  );
  background-size: 1px 10px;
  background-repeat: repeat-y;
  opacity: 0.4;
}

.we-timeline__entry {
  display: grid;
  grid-template-columns: 7rem 2rem 1fr;
  gap: 0;
  align-items: start;
  padding: 1.5rem 0;
  position: relative;
}

/* ---- Date column ---- */

.we-timeline__date {
  text-align: right;
  font-family: var(--we-font-display);
  padding-right: 1.25rem;
  padding-top: 0.25rem;
}

.we-timeline__date-num {
  display: block;
  font-family: var(--we-font-display);
  font-size: 2.75rem;
  color: var(--we-accent);
  line-height: 0.95;
  font-weight: 500;
}

.we-timeline__date-meta {
  display: block;
  margin-top: 0.5rem;
  font-family: var(--we-font-body);
  font-size: 0.6875rem;
  letter-spacing: 0.22em;
  color: var(--we-muted);
  text-transform: uppercase;
}

/* ---- Node on the thread ---- */

.we-timeline__marker {
  position: relative;
  display: flex;
  justify-content: center;
  padding-top: 1.05rem;
}

.we-timeline__node {
  width: 9px;
  height: 9px;
  background: var(--we-accent);
  border-radius: 50%;
  position: relative;
  z-index: 2;
  /* The surface-coloured ring lifts the dot off the dotted line so it
     reads as a node ON the line rather than a paint dot. */
  box-shadow: 0 0 0 3px var(--we-surface);
}

/* A service held somewhere other than the parish's usual venue. */
.we-timeline__entry--custom .we-timeline__node {
  background: var(--we-link);
}

/* ---- Service block ---- */

/* One flex column with a single gap, so every stacked line (time, name,
   feasts, location, stream link) sits the same distance from its
   neighbour rather than drifting with per-child margins. */
.we-timeline__service {
  padding-left: 1.5rem;
  padding-top: 0.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.we-timeline__meta {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.we-timeline__time {
  font-family: var(--we-font-body);
  font-size: 1.0625rem;
  color: var(--we-link);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  display: inline-block;
}

.we-timeline__name {
  font-family: var(--we-font-display);
  font-size: 1.375rem;
  color: var(--we-text);
  font-weight: 500;
  line-height: 1.3;
  margin: 0;
}

/* ---- In-church / online mode icons ---- */

.we-timeline__modes {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.we-timeline__mode-icon {
  display: inline-block;
  width: 1.1rem;
  height: 1.1rem;
  object-fit: contain;
  opacity: 0.75;
  filter: none;
}

.we-timeline__mode-icon--online {
  opacity: 0.85;
}

/* ---- "Watch online" affordance ---- */

.we-timeline__stream {
  font-family: var(--we-font-body);
  font-size: 0.875rem;
  line-height: 1.4;
}

.we-timeline__stream-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--we-link);
  font-weight: 600;
  letter-spacing: 0.015em;
  text-decoration: none;
  transition: color 0.2s ease;
}

.we-timeline__stream-link:hover,
.we-timeline__stream-link:focus-visible {
  color: var(--we-accent);
  outline: none;
}

/* Wrapper carries the size so we never fight a theme's CSS reset on the
   <svg> element itself. */
.we-timeline__stream-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1em;
  height: 1em;
  flex-shrink: 0;
  line-height: 0;
  color: currentColor;
}

.we-timeline__stream-icon svg {
  display: block;
  width: 1em;
  height: 1em;
}

/* ---- Feast links ---- */

.we-timeline__feasts {
  font-family: var(--we-font-body);
  font-style: italic;
  font-size: 0.875rem;
  color: var(--we-muted);
  line-height: 1.55;
}

.we-timeline__feasts a {
  color: var(--we-muted);
  text-decoration: underline;
  text-decoration-color: var(--we-muted);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

.we-timeline__feasts a:hover {
  color: var(--we-accent);
  text-decoration-color: var(--we-ornament);
}

.we-timeline__feasts-sep {
  margin: 0 0.4rem;
  opacity: 0.5;
}

/* ---- Location lines ----
   Default = quiet ("as usual"). Custom = unmistakable ("somewhere else").
   Same information hierarchy on every theme. */

.we-timeline__loc-default {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  font-family: var(--we-font-body);
  font-style: italic;
  font-size: 0.8125rem;
  color: var(--we-muted);
  opacity: 0.85;
}

.we-timeline__loc-custom {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-family: var(--we-font-display);
  font-style: italic;
  font-size: 1.0625rem;
  color: var(--we-accent);
  line-height: 1.45;
}

/* Map-pin mark — a CSS-masked SVG so it inherits currentColor, reading
   muted on the default line and accent on the custom one. Kept at 0.9em
   so it feels like a typographic mark, not a badge. */
.we-timeline__loc-default::before,
.we-timeline__loc-custom::before {
  content: "";
  display: inline-block;
  width: 0.9em;
  height: 0.9em;
  flex-shrink: 0;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z'/></svg>") center / contain no-repeat;
          mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z'/></svg>") center / contain no-repeat;
  transform: translateY(0.12em);
}

/* Hairline underline lifting to the ornament colour on hover, rather than
   a coloured link that would clash with the typeset register. */
.we-timeline__loc-link {
  color: inherit;
  text-decoration: underline;
  /* Fallback first for browsers without color-mix(); they ignore the
     second declaration and keep this one. */
  text-decoration-color: rgba(139, 115, 85, 0.55);
  text-decoration-color: color-mix(in srgb, var(--we-muted) 55%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

.we-timeline__loc-link:hover,
.we-timeline__loc-link:focus-visible {
  color: var(--we-accent);
  text-decoration-color: var(--we-ornament);
}

/* ---- Empty state ----
   Previously this used the theme's Tailwind utilities, which was the last
   build-time dependency on the host theme. Now self-contained. */

.we-timeline-empty {
  text-align: center;
  font-style: italic;
  color: var(--color-bronze, #8B7355);
  padding: 2rem 0;
  margin: 0;
}

/* ---- Narrow screens ---- */

@media (max-width: 640px) {
  .we-timeline::before {
    left: 4.75rem;
  }
  .we-timeline__entry {
    grid-template-columns: 4rem 1.5rem 1fr;
    padding: 1.25rem 0;
  }
  .we-timeline__date {
    padding-right: 0.75rem;
  }
  .we-timeline__date-num { font-size: 2rem; }
  .we-timeline__service  { padding-left: 1rem; }
  .we-timeline__name     { font-size: 1.125rem; }
  .we-timeline__feasts   { font-size: 0.8125rem; }
}

/* =====================================================================
   Hero "next service" block — [winterthur_events view="next"]
   =====================================================================
   Reads the same theme tokens as .we-timeline, with the same fallbacks,
   so it stays coherent on a theme that defines none of them. Deliberately
   borderless: the theme's design language reserves bordered cards for one
   "illuminated" moment per page, and the hero is open typeset.
   ================================================================== */

.we-next {
  --we-accent:    var(--color-carmine,   #7A1F2B);
  --we-ornament:  var(--color-gold,      #B8893A);
  --we-link:      var(--color-lapis,     #1E3A5F);
  --we-text:      var(--color-walnut,    #2B1810);
  --we-muted:     var(--color-bronze,    #8B7355);
  --we-surface:   var(--color-parchment, #F4EBD9);
  --we-font-display: var(--font-display, 'Cormorant Garamond', Georgia, serif);
  --we-font-body:    var(--font-body, 'Source Serif 4', Georgia, serif);

  font-family: var(--we-font-body);
  color: var(--we-text);
}

.we-next__label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--we-muted);
  margin-bottom: 0.75rem;
}

.we-next__name {
  font-family: var(--we-font-display);
  font-weight: 500;
  font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.25rem);
  line-height: 1.15;
  color: var(--we-accent);
  margin: 0;
}

.we-next__when {
  margin-top: 0.5rem;
  font-size: 1.125rem;
  color: var(--we-text);
}

.we-next__sep {
  color: var(--we-muted);
  margin: 0 0.35rem;
}

.we-next__time {
  color: var(--we-link);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Default venue: a quiet line the eye can skip, because the reader
   assumes the usual place unless told otherwise. */
.we-next__loc {
  margin: 0.75rem 0 0;
  font-size: 0.875rem;
  font-style: italic;
  color: var(--we-muted);
  max-width: 32rem;
}

/* Custom venue: the one case that must stop the reader. Marked with the
   gold ornament and a rule rather than a filled box — same information
   hierarchy as the timeline, same restraint. */
.we-next__loc--custom {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
  font-style: normal;
  color: var(--we-text);
  border-left: 2px solid var(--we-ornament);
  /* Fallback first, enhancement second — a browser without color-mix
     keeps the literal rgba, one with it takes the token-derived value. */
  background: rgba(244, 235, 217, 0.55);
  background: color-mix(in srgb, var(--we-surface) 55%, transparent);
  padding: 0.625rem 0.75rem;
  border-radius: 2px;
}

.we-next__loc--custom strong {
  color: var(--we-accent);
  font-weight: 600;
}

.we-next__loc-mark {
  color: var(--we-ornament);
  flex-shrink: 0;
}

.we-next__loc-link {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: rgba(139, 115, 85, 0.45);
  text-underline-offset: 3px;
}

.we-next__loc-link:hover,
.we-next__loc-link:focus-visible {
  color: var(--we-accent);
}

/* Hero with nothing scheduled. Quiet and matter-of-fact — it is an
   answer, not an error, so it carries no icon and no alarm colour. */
.we-next-empty {
  margin: 0;
  font-family: var(--we-font-display, 'Cormorant Garamond', Georgia, serif);
  font-size: 1.375rem;
  font-style: italic;
  line-height: 1.4;
  color: var(--we-muted, #8B7355);
}
