/* युगों पार पंचांग: a tear-off day page printed on paper like the logo. Phones first. */

:root {
  --paper: #e5decf;
  --paper-hi: #f2ece1;
  --ink: #1d1b18;
  --ink-soft: #5b5348;
  --rule: rgba(29, 27, 24, 0.16);
  --vermilion: #c64024;
  --vermilion-ink: #a8321b;
  --turmeric: #e3a33b;
  --turmeric-ink: #82530c;
  --display: 'Eczar', 'Mukta', serif;
  --paper-tex: url("brand/paper.jpg");
  --speck: url("brand/speck.png");
  --col: 600px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { background: var(--paper); }

body {
  margin: 0;
  font-family: 'Mukta', system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper) var(--paper-tex) repeat;
  background-size: 300px;
  -webkit-font-smoothing: antialiased;
}

:focus-visible { outline: 2px solid var(--vermilion); outline-offset: 3px; }

.print {
  -webkit-mask: var(--speck) 0 0 / 180px repeat;
  mask: var(--speck) 0 0 / 180px repeat;
}

/* Square stamps with a hard ink shadow, pressed down when tapped. */
.stamp {
  font: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 42px;
  padding: 0 14px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--paper-hi);
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--ink);
  transition: transform 0.06s, box-shadow 0.06s;
  -webkit-tap-highlight-color: transparent;
}

.stamp:active { transform: translateY(3px); box-shadow: 0 0 0 var(--ink); }
.stamp.sq { width: 42px; padding: 0; }
.stamp.red { background: var(--vermilion); }
.stamp:disabled { opacity: 0.5; cursor: default; }

.linkish {
  font: inherit;
  padding: 4px 6px;
  border: 0;
  background: none;
  color: var(--ink);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 4px;
  cursor: pointer;
}

.center { margin: 0; text-align: center; }

/* ---------- Top bar (sizes come from top.css, shared with the home page) ---------- */

.city-btn { max-width: 40vw; }
.city-btn span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- Page ---------- */

.page {
  max-width: var(--col);
  margin: 0 auto;
  padding: 14px var(--gutter) calc(132px + env(safe-area-inset-bottom));
  overflow-x: hidden;
  overflow-x: clip;
}

.loading { margin: 48px 0; text-align: center; color: var(--ink-soft); }

/* ---------- Day page ---------- */

.day { position: relative; }

.leaf { margin: 0 -10px; padding: 0 10px 12px; border-radius: 6px; }

/* Changing the day: the old page tears off to the left, or the earlier page comes back on top. */
.leaf.gone { position: absolute; top: 0; left: 0; right: 0; pointer-events: none; }
.leaf.under { z-index: 1; }
.leaf.tear, .leaf.putback {
  z-index: 2;
  background: var(--paper) var(--paper-tex) repeat;
  background-size: 300px;
  box-shadow: 0 12px 32px rgba(29, 27, 24, 0.28);
  transform-origin: 30% 0;
}
.leaf.tear { animation: tear 0.34s cubic-bezier(0.55, 0, 0.85, 0.35) forwards; }
.leaf.putback { position: relative; animation: putback 0.32s cubic-bezier(0.2, 0.8, 0.3, 1); }

@keyframes tear { to { transform: translate(-112%, 36px) rotate(-9deg); } }
@keyframes putback { from { transform: translate(-112%, 36px) rotate(-9deg); } }

.dhead { text-align: center; padding-top: 4px; }

.dkick { margin: 0; min-height: 30px; font-size: 15px; font-weight: 700; line-height: 30px; color: var(--vermilion-ink); }
.dkick .linkish { margin-left: 4px; font-size: 14px; }

.dmonth { margin: 0; font-family: var(--display); font-size: 19px; font-weight: 700; line-height: 1.3; }

.dnumrow { display: grid; grid-template-columns: 42px minmax(0, 1fr) 42px; align-items: center; }

.dnum {
  margin: 0;
  padding-top: 0.08em;
  font-family: var(--display);
  font-size: clamp(104px, 31vw, 144px);
  font-weight: 800;
  line-height: 0.92;
  letter-spacing: -0.035em;
}

.dnum.red { color: var(--vermilion); }

.hdate {
  margin: 6px 0 0;
  font-family: var(--display);
  font-size: clamp(25px, 7vw, 31px);
  font-weight: 800;
  line-height: 1.3;
  color: var(--vermilion);
}

.samvat { margin: 2px 0 0; font-size: 13.5px; font-weight: 600; color: var(--ink-soft); }

.dahead {
  margin: 8px 0 0;
  padding: 4px 8px;
  border: 0;
  background: none;
  font: inherit;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: underline dotted;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 5px;
  cursor: pointer;
}

.dahead b { font-family: var(--display); font-weight: 800; color: var(--vermilion-ink); }

/* Festivals, stamped onto the page. */
.dfests { display: grid; gap: 12px; justify-items: center; margin: 12px 0 0; text-align: center; }
.dfest { display: grid; gap: 4px; justify-items: center; max-width: 30em; }

.dstamp {
  display: inline-block;
  margin: 3px 0 4px;
  padding: 3px 14px 0;
  border: 2.5px solid currentColor;
  border-radius: 6px;
  outline: 1.5px solid currentColor;
  outline-offset: 2.5px;
  color: var(--ink);
  font-family: var(--display);
  font-size: 21px;
  font-weight: 800;
  line-height: 1.45;
  transform: rotate(-2deg);
}

.dstamp.big { color: var(--vermilion); font-size: 25px; }
.dstamp.ekadashi { color: var(--turmeric-ink); }

.dx { margin: 0; font-size: 14.5px; font-weight: 700; }
.dsky { margin: 0; font-size: 13.5px; line-height: 1.55; color: var(--ink-soft); }
.dlink { font-weight: 700; color: var(--vermilion-ink); text-underline-offset: 4px; }

/* The five limbs: plain ruled rows. */
.limbs { margin: 12px 0 0; border-top: 2px solid var(--ink); }

.lrow {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 0 8px;
  padding: 6px 2px 7px;
  border-bottom: 1px solid var(--rule);
}

.lrow dt { font-size: 13.5px; font-weight: 700; color: var(--ink-soft); }
.lrow dd { display: contents; }
.lrow b { min-width: 0; font-family: var(--display); font-size: 19px; font-weight: 700; line-height: 1.3; }
.lt { display: grid; justify-items: end; text-align: right; font-size: 14.5px; font-weight: 700; line-height: 1.35; }
.lt small { font-size: 12.5px; font-weight: 600; color: var(--ink-soft); }

/* The sky scene: full-bleed, painted flat, with a paper grain over it. */
.scene {
  position: relative;
  margin: 16px calc(-1 * var(--gutter)) 0;
  height: clamp(176px, 46vw, 240px);
  overflow: hidden;
  background: #1b1f47;
}

.scene svg { display: block; width: 100%; height: 100%; }

.scene::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--paper-tex) repeat;
  background-size: 300px;
  mix-blend-mode: multiply;
  opacity: 0.5;
  pointer-events: none;
}

.scap {
  position: absolute;
  z-index: 1;
  top: 10px;
  left: var(--gutter);
  margin: 0;
  padding: 3px 11px 2px;
  border-radius: 999px;
  background: rgba(29, 27, 24, 0.72);
  color: var(--paper-hi);
  font-size: 12.5px;
  font-weight: 700;
}

.slabels {
  position: absolute;
  z-index: 1;
  left: var(--gutter);
  right: var(--gutter);
  bottom: 6px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--paper-hi);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.slabels span { display: grid; }
.slabels span:last-child { text-align: right; }
.slabels small { font-size: 11px; font-weight: 600; opacity: 0.85; }

.srashi { margin: 8px 0 0; text-align: center; font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.srashi b { color: var(--ink); }

/* Next big festival on the festival tab. */
.feature { display: block; margin: 14px 0 0; color: var(--ink); text-decoration: none; -webkit-tap-highlight-color: transparent; }
.feature .scene { margin-top: 0; }
.feature:active .scene { filter: brightness(0.92); }

.ftitle {
  position: absolute;
  z-index: 1;
  top: 22%;
  left: 0;
  right: 0;
  margin: 0;
  padding: 0 var(--gutter);
  text-align: center;
  font-family: var(--display);
  font-size: clamp(30px, 8.6vw, 40px);
  font-weight: 800;
  line-height: 1.25;
  color: var(--paper-hi);
  text-shadow: 0 2px 0 rgba(29, 27, 24, 0.55);
}

.fwhen { margin: 8px 0 0; font-size: 14px; font-weight: 600; color: var(--ink-soft); }
.fwhen b { color: var(--ink); }

/* ---------- Month ---------- */

.mhead { display: grid; grid-template-columns: 42px minmax(0, 1fr) 42px; align-items: center; gap: 8px; padding-top: 8px; }
.mtitle { text-align: center; }
.mtitle h2 { margin: 0; font-family: var(--display); font-size: 25px; font-weight: 800; line-height: 1.3; }
.mtitle p { margin: 0; font-size: 13.5px; font-weight: 600; color: var(--vermilion-ink); }

.weekdays, .grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.weekdays { margin: 16px 0 0; padding-bottom: 6px; border-bottom: 2px solid var(--ink); }
.weekdays span { text-align: center; font-size: 12.5px; font-weight: 700; color: var(--ink-soft); }
.weekdays span:first-child { color: var(--vermilion-ink); }

.grid { border-bottom: 2px solid var(--ink); }

.cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  min-width: 0;
  height: 62px;
  padding: 6px 1px 4px;
  border: 0;
  border-top: 1px solid var(--rule);
  background: none;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.grid > :nth-child(-n + 7) { border-top: 0; }
.cell.blank { cursor: default; }

.cd {
  display: grid;
  place-items: center;
  min-width: 34px;
  height: 32px;
  padding: 3px 3px 0;
  border-radius: 5px;
  font-family: var(--display);
  font-size: 21px;
  font-weight: 800;
  line-height: 1;
}

.ct { max-width: 100%; overflow: hidden; font-size: 11px; font-weight: 600; color: var(--ink-soft); white-space: nowrap; text-overflow: ellipsis; }
.cf { display: none; }

.cell.fest .cd { color: var(--vermilion); }
.cell.big .cd { background: var(--vermilion); color: var(--ink); }
.cell.ek .ct, .cell.pu .ct { font-weight: 800; color: var(--turmeric-ink); }
.cell.am .ct { font-weight: 800; color: var(--ink); }
.cell.today .cd { box-shadow: 0 0 0 2.5px var(--ink); }
.cell:active .cd { transform: translateY(1px); }

.legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; margin: 12px 0 0; font-size: 12.5px; font-weight: 600; color: var(--ink-soft); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

.lg {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 21px;
  padding-top: 2px;
  border-radius: 4px;
  font-family: var(--display);
  font-size: 13px;
  font-style: normal;
  font-weight: 800;
  line-height: 1;
  color: var(--ink);
}

.lg.big { background: var(--vermilion); }
.lg.fest { color: var(--vermilion); }
.lg.today { box-shadow: 0 0 0 2px var(--ink); }

#to-today { margin-top: 8px; }

/* ---------- Ruled festival rows (month and festival tabs) ---------- */

.sec-h {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 26px 0 2px;
  font-family: var(--display);
  font-size: 19px;
  font-weight: 800;
  line-height: 1.4;
}

.sec-h::after { content: ""; flex: 1; height: 2px; background: var(--ink); }

.flist { list-style: none; margin: 0; padding: 0; }

.frow {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  width: 100%;
  padding: 10px 2px;
  border: 0;
  border-bottom: 1px solid var(--rule);
  background: none;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.frow:active { background: rgba(29, 27, 24, 0.05); }

.fd { display: grid; justify-items: center; }

.fd b {
  display: grid;
  place-items: center;
  min-width: 38px;
  height: 34px;
  padding-top: 3px;
  border-radius: 5px;
  font-family: var(--display);
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
}

.fd small { font-size: 12px; font-weight: 700; color: var(--ink-soft); }
.frow.festival .fd b, .frow.eclipse .fd b { color: var(--vermilion); }
.frow.big .fd b { background: var(--vermilion); color: var(--ink); }

.fb { display: grid; gap: 1px; padding-top: 2px; }
.fn { font-family: var(--display); font-size: 18px; font-weight: 700; line-height: 1.35; }
.ft { font-size: 13.5px; font-weight: 600; color: var(--ink-soft); }
.frow.ekadashi .ft { color: var(--turmeric-ink); }
.fx { font-size: 13.5px; font-weight: 700; }

.empty { margin: 0; padding: 18px 2px; list-style: none; text-align: center; color: var(--ink-soft); }

/* ---------- Festival tab ---------- */

.ph { margin: 0; padding-top: 10px; font-family: var(--display); font-size: 25px; font-weight: 800; line-height: 1.3; }
.psub { margin: 0; font-size: 13.5px; font-weight: 600; color: var(--ink-soft); }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; }

.filters button {
  font: inherit;
  min-height: 36px;
  padding: 0 14px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--paper-hi);
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.filters [aria-pressed="true"] { background: var(--ink); color: var(--paper-hi); }

.notes {
  margin-top: 34px;
  padding-top: 14px;
  border-top: 2px solid var(--ink);
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-soft);
}

.notes p { margin: 0 0 8px; }
.notes b { color: var(--ink); }
.notes a { color: var(--vermilion-ink); font-weight: 700; text-decoration: none; }
.notes-links { margin-top: 12px; }

/* Email, Instagram, YouTube, Facebook as icons; each a 44 px tap target. */
.social { display: flex; justify-content: center; gap: 6px; }
.social a { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 8px; color: var(--ink); }
.social svg { display: block; }

/* ---------- Bottom tabs ---------- */

/* The dock: social icons and the tabs, fixed at the bottom so both are always on screen. */
.dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--paper) var(--paper-tex) repeat;
  background-size: 300px;
  border-top: 3px solid var(--ink);
}

.dock .social { gap: 14px; padding: 2px 0 0; border-bottom: 1px solid var(--rule); color: var(--ink-soft); }
.dock .social a { width: 40px; height: 36px; }
.dock .social svg { width: 20px; height: 20px; }

.tabs { position: relative; }

.tabs-in { display: grid; grid-template-columns: repeat(3, 1fr); max-width: var(--col); margin: 0 auto; }

.tab {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 1px;
  padding: 8px 0 7px;
  border: 0;
  background: none;
  color: var(--ink-soft);
  font: inherit;
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.3;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.tab svg { width: 24px; height: 24px; }
.tab[aria-selected="true"] { color: var(--ink); }
.tab[aria-selected="true"] .acc { fill: var(--vermilion); }

.tab[aria-selected="true"]::before {
  content: "";
  position: absolute;
  top: -3px;
  left: 26%;
  right: 26%;
  height: 5px;
  border-radius: 0 0 3px 3px;
  background: var(--vermilion);
}

/* ---------- Share card sheet ---------- */

.card-wrap { display: grid; place-items: center; min-height: 200px; }

.card-img {
  display: block;
  height: min(56vh, 125vw - 40px);
  aspect-ratio: 4 / 5;
  width: auto;
  max-width: 100%;
  border: 2px solid var(--ink);
  border-radius: 8px;
  box-shadow: 0 4px 0 var(--ink);
}

.share-actions { display: flex; justify-content: center; gap: 10px; margin-top: 16px; }
.share-actions .stamp { flex: 1; max-width: 220px; }
#text-share { margin-top: 6px; font-size: 14px; }
.save-tip { margin: 10px 0 0; text-align: center; font-size: 13px; color: var(--ink-soft); }
@media (pointer: fine) { .save-tip { display: none; } }

/* ---------- City sheet ---------- */

.sheet {
  width: min(520px, 100vw);
  max-width: 100vw;
  max-height: 88vh;
  margin: auto auto 0;
  padding: 14px 14px calc(16px + env(safe-area-inset-bottom));
  border: 0;
  border-top: 3px solid var(--ink);
  border-radius: 14px 14px 0 0;
  background: var(--paper) var(--paper-tex) repeat;
  background-size: 300px;
  color: var(--ink);
  box-shadow: 0 -10px 40px rgba(29, 27, 24, 0.3);
}

.sheet::backdrop { background: rgba(29, 27, 24, 0.5); }
.sheet[open] { animation: rise 0.25s ease-out; }

@keyframes rise { from { transform: translateY(40px); opacity: 0; } }

.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.sheet-head h2 { margin: 0; font-family: var(--display); font-size: 22px; font-weight: 800; }

.x {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--paper-hi);
  color: var(--ink);
  cursor: pointer;
}

.city-search {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
}

.city-search:focus { outline: none; border-color: var(--vermilion); }

.city-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; max-height: 40vh; overflow: auto; }

.city-list button {
  width: 100%;
  min-height: 42px;
  padding: 0 10px;
  border: 1.5px solid rgba(29, 27, 24, 0.3);
  border-radius: 8px;
  background: var(--paper-hi);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.city-list button[aria-current="true"] { border: 2px solid var(--ink); background: var(--vermilion); font-weight: 800; }

.system { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0 0; padding: 0; border: 0; }
.system legend { padding: 0; margin-bottom: 6px; font-size: 13px; font-weight: 700; color: var(--ink-soft); }

.seg {
  position: relative;
  display: grid;
  padding: 8px 10px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--paper-hi);
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--ink);
}

.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg small { font-size: 11.5px; font-weight: 600; color: var(--ink-soft); }
.seg:has(input:checked) { background: var(--turmeric); }
.seg:has(input:focus-visible) { outline: 2px solid var(--vermilion); outline-offset: 3px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(124px + env(safe-area-inset-bottom));
  z-index: 40;
  width: max-content;
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--paper-hi);
  font-weight: 700;
  box-shadow: 0 4px 0 var(--vermilion);
  opacity: 0;
  transform: translate(-50%, 12px);
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Bigger screens ---------- */

@media (min-width: 600px) {
  .cell { height: 84px; }
  .scene { margin-inline: 0; border-radius: 10px; }
  .feature .scene { margin-inline: 0; }
  .cf { display: block; max-width: 100%; max-height: 2.5em; overflow: hidden; margin-top: 1px; font-size: 11px; font-weight: 700; line-height: 1.25; text-align: center; color: var(--vermilion-ink); }
  .sheet { margin: auto; border: 3px solid var(--ink); border-radius: 14px; }
  .city-list { grid-template-columns: 1fr 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .sheet[open] { animation: none; }
  .stamp, .toast { transition: none; }
}

/* Footer on every tab: the social icons and the tagline. */
.site-foot { margin-top: 14px; padding-top: 10px; border-top: 1.5px solid var(--rule); text-align: center; color: var(--ink-soft); }
.site-foot p { margin: 2px 0 0; font-size: 13px; }
.site-foot p a { color: var(--vermilion-ink); font-weight: 700; text-decoration: none; }

/* Narrow phones: the यु mark alone next to the back button, so the header stays on one line. */
@media (max-width: 379px) {
  .brand-word { display: none; }
}
