/* Master masthead, mini nav and Bikram Sambat calendar. Built by masthead.js. */
#sy-mh, .sy-cal {
  --mh-ink: #2a1c0e;
  --mh-text: #5d5146;
  --mh-gold: #7a5608;
  --mh-line: rgba(122, 86, 8, .16);
  --mh-sans: 'Outfit', 'Noto Sans', 'Noto Sans Devanagari', system-ui, sans-serif;
  --mh-serif: 'Cinzel', 'Noto Serif Devanagari', 'Noto Sans Devanagari', serif;
}

/* ---------- Masthead ---------- */
#sy-mh {
  position: relative;
  z-index: 901;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  column-gap: 24px;
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 14px 48px;
  background: #fff;
  color: var(--mh-ink);
  font-family: var(--mh-sans);
}
#sy-mh[hidden] { display: none; }
/* The hairline runs the full page width, also on screens wider than the masthead */
#sy-mh::after {
  content: ""; position: absolute; left: 50%; bottom: 0; width: 100vw; height: 1px;
  transform: translateX(-50%); background: var(--mh-line); pointer-events: none;
}
#sy-mh p { margin: 0; }
/* Left and right mirror each other: one strong line in the heading serif, one quiet line, centred on the logo */
.sy-mh-side { display: flex; flex-direction: column; justify-content: center; gap: 2px; min-width: 0; align-self: center; }
.sy-mh-left { grid-column: 1; grid-row: 1; align-items: flex-start; text-align: left; }
.sy-mh-right { grid-column: 3; grid-row: 1; align-items: flex-end; text-align: right; }
#sy-mh .sy-mh-main { font-family: var(--mh-serif); font-size: 18px; font-weight: 600; line-height: 1.5; letter-spacing: .01em; color: var(--mh-ink); }
#sy-mh .sy-mh-sub { display: flex; flex-wrap: wrap; align-items: center; column-gap: 8px; font-size: 15px; font-weight: 400; line-height: 1.5; color: var(--mh-text); }
.sy-mh-left .sy-mh-sub { justify-content: flex-start; }
.sy-mh-right .sy-mh-sub { justify-content: flex-end; }
.sy-mh-dot { color: rgba(122, 86, 8, .55); }
.sy-mh-clock { font-variant-numeric: tabular-nums; }
#sy-mh .sy-mh-piece { white-space: nowrap; }

.sy-mh-logo {
  grid-column: 2; grid-row: 1;
  display: flex; align-items: center; justify-content: center; gap: 14px;
  text-decoration: none;
  border-radius: 6px;
}
#sy-mh img { display: block; max-width: none; background: none !important; animation: none !important; filter: none; }
#sy-mh .sy-mh-emblem { height: 96px; width: auto; }
/* The wordmark file has wide transparent sides (17% and 16% of its width). Negative margins trim them so spacing and centering follow what is visible. */
#sy-mh .sy-mh-word, #root .nb-logo2-img { height: var(--w-h) !important; width: auto !important; max-width: none !important; margin: 0 calc(var(--w-h) * -1.01) 0 calc(var(--w-h) * -1.06) !important; flex-shrink: 0 !important; }
#sy-mh .sy-mh-word { --w-h: 64px; }
#root .nb-logo2-img { --w-h: 42px; }

/* Calendar control: gold icon and label, 40 px tap target. The negative margin keeps the text line at its own height. */
.sy-mh-cal {
  appearance: none; background: none; border: 0; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 40px; padding: 0 8px; border-radius: 8px;
  font: 600 15px/1.5 var(--mh-sans);
  color: var(--mh-gold);
  white-space: nowrap;
  transition: opacity .25s ease, color .2s ease, background-color .2s ease;
}
.sy-mh-cal svg { flex: none; display: block; }
.sy-mh-cal:hover { background: #faf6ee; color: var(--mh-ink); }
.sy-mh-cal[aria-expanded="true"] { background: #faf6ee; color: var(--mh-ink); }
.sy-mh-cal-inline { margin: -9px -8px -9px -4px; }
.sy-mh-cal-row { display: none; }
.sy-mh-phone { display: none; }
#sy-mh a:focus-visible, #sy-mh button:focus-visible, .sy-cal button:focus-visible { outline: 2px solid var(--mh-gold); outline-offset: 2px; }

/* ---------- The nav bar: sticky under the masthead. Its negative margin keeps every page's own layout. ---------- */
html.sy-mh-on #root nav.nb { display: contents !important; }
html.sy-mh-on #root .nb-bar {
  position: sticky !important;
  top: 0 !important;
  left: auto !important;
  right: auto !important;
  width: 100% !important;
  margin-bottom: calc(-1 * var(--nb-h)) !important;
}
html.sy-mh-on:not(.sy-mh-mini) #root .nb-bar { box-shadow: none !important; }

/* Mini nav logo: well sized, nothing behind it */
#root .nb-logo { gap: 10px !important; overflow: visible !important; }
#root .nb-logo-img, #root .nb-logo2-img, #root .nb-logo:hover .nb-logo-img, #root .nb-logo:hover .nb-logo2-img {
  filter: none !important;
  background: none !important;
  box-shadow: none !important;
  animation: none !important;
  border-radius: 0 !important;
}
#root .nb-logo-img { height: 50px !important; width: auto !important; max-width: none !important; }
#root .nb-logo:hover .nb-logo-img, #root .nb-logo:hover .nb-logo2-img { transform: none !important; }
html[lang] #root .nb-bar .nb-lk { font-size: 15px !important; }
#root .nb-inner { min-height: 50px; }

/* At the top: no small logo, links at the page centre */
html.sy-mh-on #root .nb-logo { transition: opacity .3s ease, visibility .3s ease; }
html.sy-mh-on:not(.sy-mh-mini) #root .nb-logo { opacity: 0; visibility: hidden; pointer-events: none; }
html.sy-mh-on:not(.sy-mh-mini) #root .nb-links { transform: translateX(var(--sy-links-dx, 0px)); }
html.sy-mh-ready #root .nb-links { transition: transform .35s cubic-bezier(.2, .7, .2, 1); }

/* ---------- Tablet: the hamburger row holds the calendar control ---------- */
@media (max-width: 1199px) {
  #sy-mh { padding: 12px 24px; column-gap: 16px; }
  #sy-mh .sy-mh-emblem { height: 78px; }
  #sy-mh .sy-mh-word { --w-h: 50px; }
  .sy-mh-logo { gap: 10px; }
  #sy-mh .sy-mh-main { font-size: 17px; }
  .sy-mh-cal-inline, .sy-mh-cal-dot { display: none; }
  /* Sits on the hamburger row, in line with its vertical centre */
  .sy-mh-cal-row {
    display: inline-flex;
    position: absolute; left: 16px; top: calc(100% + 16px); min-height: 44px;
    font-size: 16px;
  }
  html.sy-mh-mini .sy-mh-cal-row { opacity: 0; visibility: hidden; pointer-events: none; }
  #root .nb-logo-img { height: 48px !important; }
  #root .nb-logo2-img { --w-h: 40px; }
}

/* ---------- Phone ---------- */
@media (max-width: 767px) {
  #sy-mh { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 16px 10px; }
  .sy-mh-side { display: none; }
  .sy-mh-phone { display: block; text-align: center; max-width: 100%; }
  #sy-mh .sy-mh-emblem { height: 64px; }
  #sy-mh .sy-mh-word { --w-h: 44px; }
  #sy-mh .sy-mh-phone .sy-mh-main { font-size: 16px; line-height: 1.5; }
  #sy-mh .sy-mh-phone .sy-mh-sub { display: block; font-size: 14px; line-height: 1.5; }
  .sy-mh-cal-row { left: 12px; top: calc(100% + 14px); font-size: 15px; }
  #root .nb-logo { gap: 8px !important; }
  #root .nb-logo-img { height: 46px !important; }
  #root .nb-logo2-img { --w-h: 36px; }
}
@media (max-width: 380px) {
  #root .nb-logo-img { height: 42px !important; }
  #root .nb-logo2-img { --w-h: 32px; }
}

/* ---------- Calendar panel ---------- */
.sy-cal {
  position: fixed;
  z-index: 1200;
  top: var(--sy-cal-top, 80px);
  right: max(24px, calc((100vw - 1600px) / 2 + 48px));
  box-sizing: border-box;
  width: min(920px, calc(100vw - 48px));
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px 22px 20px;
  background: #fff;
  border: 1px solid var(--mh-line);
  border-radius: 12px;
  box-shadow: 0 18px 50px rgba(42, 28, 14, .16);
  color: var(--mh-ink);
  font-family: var(--mh-sans);
  outline: none;
}
.sy-cal[hidden], .sy-cal-scrim[hidden] { display: none; }
.sy-cal p { margin: 0; }
.sy-cal-scrim { display: none; }

.sy-cal-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 12px; }
.sy-cal-title { min-width: 0; }
.sy-cal-month { font-size: 22px; font-weight: 600; line-height: 1.25; color: var(--mh-ink); }
.sy-cal-span { font-size: 14px; line-height: 1.4; color: var(--mh-text); }
.sy-cal-acts { display: flex; align-items: center; gap: 2px; flex: none; }
.sy-cal-nav, .sy-cal-today {
  appearance: none; background: none; border: 0; cursor: pointer;
  color: var(--mh-gold); font-family: inherit; border-radius: 8px;
}
.sy-cal-nav { width: 40px; height: 40px; font-size: 26px; line-height: 1; padding: 0 0 3px; }
.sy-cal-x { color: var(--mh-text); margin-left: 6px; }
.sy-cal-today { min-height: 40px; padding: 0 10px; font-size: 15px; font-weight: 600; }
.sy-cal-nav:hover, .sy-cal-today:hover { background: #faf6ee; }

.sy-cal-body { display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 26px; align-items: start; }
.sy-cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.sy-cal-wk { padding: 2px 6px 6px; font-size: 14px; font-weight: 600; color: var(--mh-text); }
.sy-cal-day {
  appearance: none; background: none; border: 0; margin: 0; cursor: pointer;
  display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; align-items: baseline; gap: 1px 4px;
  min-width: 0; min-height: 58px; padding: 6px 4px 5px 6px; border-radius: 8px;
  font-family: inherit; text-align: left; color: var(--mh-ink);
  transition: background-color .15s ease;
}
.sy-cal-day:hover { background: #faf6ee; }
.sy-cal-bs { font-size: 18px; font-weight: 600; line-height: 1.2; }
.sy-cal-ad { font-size: 13px; line-height: 1.2; color: var(--mh-text); white-space: nowrap; }
.sy-cal-tithi { grid-column: 1 / -1; font-size: 13px; line-height: 1.3; color: var(--mh-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sy-cal-day.is-moon .sy-cal-tithi { color: var(--mh-gold); font-weight: 600; }
.sy-cal-day.is-sel { box-shadow: inset 0 0 0 2px var(--mh-gold); }
.sy-cal-day.is-today { background: var(--mh-gold); color: #fff; }
.sy-cal-day.is-today .sy-cal-ad, .sy-cal-day.is-today .sy-cal-tithi { color: #fff; }
.sy-cal-day.is-today.is-sel { box-shadow: inset 0 0 0 2px #fff, 0 0 0 2px var(--mh-gold); }

.sy-cal-detail { min-width: 0; border-left: 1px solid var(--mh-line); padding-left: 22px; }
.sy-cal-dbs { font-size: 19px; font-weight: 600; line-height: 1.3; }
.sy-cal-dad { font-size: 15px; line-height: 1.4; color: var(--mh-text); margin-top: 2px !important; }
.sy-cal-facts { margin: 14px 0 0; display: grid; gap: 10px; }
.sy-cal-fact dt { font-size: 14px; color: var(--mh-text); line-height: 1.3; }
.sy-cal-fact dd { margin: 0; font-size: 16px; font-weight: 600; line-height: 1.35; }
.sy-cal-vhead { margin-top: 14px !important; font-size: 14px; color: var(--mh-text); }
.sy-cal-vrats { list-style: none; margin: 2px 0 0; padding: 0; display: grid; gap: 8px; }
.sy-cal-vname { display: block; font-size: 16px; font-weight: 600; line-height: 1.35; color: var(--mh-gold); }
.sy-cal-vnote { display: block; font-size: 14px; line-height: 1.4; color: var(--mh-text); }
.sy-cal-note { margin-top: 14px !important; font-size: 13px; line-height: 1.45; color: var(--mh-text); }

@media (max-width: 999px) {
  .sy-cal { width: calc(100vw - 32px); right: 16px; }
  .sy-cal-body { display: block; }
  .sy-cal-detail { border-left: 0; border-top: 1px solid var(--mh-line); margin-top: 12px; padding: 14px 6px 0; }
  .sy-cal-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 16px; }
}
@media (max-width: 767px) {
  .sy-cal-scrim { display: block; position: fixed; inset: 0; z-index: 1190; background: rgba(42, 28, 14, .4); }
  .sy-cal-scrim[hidden] { display: none; }
  .sy-cal {
    top: auto; left: 0; right: 0; bottom: 0; width: 100%;
    max-height: 90vh; max-height: 90dvh;
    padding: 14px 12px calc(18px + env(safe-area-inset-bottom, 0px));
    border: 0; border-radius: 16px 16px 0 0;
    box-shadow: 0 -10px 40px rgba(42, 28, 14, .2);
  }
  .sy-cal-top { padding: 0 4px 10px; }
  .sy-cal-month { font-size: 20px; }
  .sy-cal-today { padding: 0 8px; }
  .sy-cal-nav { width: 38px; }
  .sy-cal-x { margin-left: 2px; }
  .sy-cal-body { display: block; }
  .sy-cal-wk { padding: 2px 0 6px; text-align: center; font-size: 13px; }
  .sy-cal-day { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-height: 52px; padding: 4px 2px; text-align: center; }
  .sy-cal-tithi { display: none; }
  .sy-cal-detail { border-left: 0; border-top: 1px solid var(--mh-line); margin-top: 12px; padding: 14px 6px 0; }
  .sy-cal-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  html.sy-mh-ready #root .nb-links, html.sy-mh-on #root .nb-logo, .sy-mh-cal, .sy-cal-day { transition: none !important; }
}

/* The home hero fills what is left of the first screen, so its thumbnails stay in view */
html.sy-mh-on #root .hero-root { height: max(440px, calc(100vh - var(--sy-mh-h, 124px) - 68px)) !important; min-height: 0 !important; }

/* Phone: the sound button keeps its place under the bar, so it must not sit on the masthead text */
@media (max-width: 767px) {
  html.sy-mh-on:not(.sy-mh-mini) #lyr-sound { top: calc(var(--sy-mh-h, 131px) + 84px) !important; }
  html.sy-mh-ready #lyr-sound { transition: top .3s ease; }
}

/* Latin digits inside the serif lines */
#sy-mh .sy-mh-num { font-family: var(--mh-sans); font-variant-numeric: lining-nums; }
/* Narrow tablet: date and time take a line each, so nothing crowds the logo */
@media (max-width: 899px) {
  .sy-mh-left .sy-mh-dot { display: none; }
  .sy-mh-left .sy-mh-piece { flex-basis: 100%; }
}

/* The drawer sets overflow:hidden on body. The page scrolls on html, so that would only make body a scroll box and send the sticky bar off screen. */
html.sy-mh-on body[style*="overflow: hidden"] { overflow-x: clip !important; overflow-y: visible !important; }
