/* युगों पार चित्रशाला: the story paintings on paper, printed like the rest of the site. 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;
  --display: 'Eczar', 'Mukta', serif;
  --paper-tex: url("brand/paper.jpg");
  --col: 1100px;
}

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

html { background: var(--paper); scroll-padding-top: 12px; }

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; }

.page {
  max-width: var(--col);
  margin: 0 auto;
  padding: 10px var(--gutter) calc(64px + env(safe-area-inset-bottom));
}

.g-title { margin: 6px 0 0; font-family: var(--display); font-size: clamp(30px, 8vw, 44px); font-weight: 800; line-height: 1.25; }
.g-lead { margin: 2px 0 0; max-width: 34em; font-size: 15px; line-height: 1.5; color: var(--ink-soft); }
.g-loading { margin: 40px 0; text-align: center; color: var(--ink-soft); }

/* Jump to a story: small stamps that scroll sideways on a phone. */
.g-jump { display: flex; gap: 8px; margin: 14px calc(-1 * var(--gutter)) 0; padding: 2px var(--gutter) 8px; overflow-x: auto; scrollbar-width: none; }
.g-jump::-webkit-scrollbar { display: none; }

.g-jump a {
  flex: none;
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 12px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--paper-hi);
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 3px 0 var(--ink);
}

.g-jump a:active { transform: translateY(3px); box-shadow: none; }

/* A story: heading with a rule, then its pictures in story order. */
.g-sec { margin-top: 26px; }

.g-sec h2 {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 10px;
  font-family: var(--display);
  font-size: clamp(21px, 5.6vw, 26px);
  font-weight: 800;
  line-height: 1.35;
}

.g-sec h2::after { content: ""; flex: 1; height: 2px; background: var(--ink); transform: translateY(-6px); }
.g-sec h2 small { order: 2; font-family: 'Mukta', sans-serif; font-size: 13px; font-weight: 600; color: var(--ink-soft); }

.g-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.g-grid.wide { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.g-item {
  position: relative;
  display: block;
  padding: 0;
  border: 2px solid var(--ink);
  border-radius: 6px;
  overflow: hidden;
  background: var(--paper-hi);
  cursor: zoom-in;
  -webkit-tap-highlight-color: transparent;
}

.g-item img { display: block; width: 100%; height: 100%; object-fit: cover; }
.g-item:active { transform: translateY(2px); }

.g-num {
  position: absolute;
  left: 5px;
  top: 5px;
  min-width: 22px;
  padding: 1px 6px 0;
  border-radius: 4px;
  background: rgba(29, 27, 24, 0.72);
  color: var(--paper-hi);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
  text-align: center;
}

@media (min-width: 640px) {
  .g-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
  .g-grid.wide { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 1000px) {
  .g-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

/* Social icons, 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);
}

.social { display: flex; justify-content: center; gap: 14px; color: var(--ink-soft); }
.social a { display: grid; place-items: center; width: 44px; height: 42px; color: inherit; }
.social svg { display: block; width: 21px; height: 21px; }

/* The viewer: one picture large on dark ink, swipe or arrows for the next. */
.viewer {
  width: 100vw;
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  border: 0;
  background: #141210;
  color: var(--paper-hi);
  overflow: hidden;
}

.viewer[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.viewer::backdrop { background: #141210; }

.v-top { display: flex; align-items: center; gap: 8px; padding: calc(8px + env(safe-area-inset-top)) 10px 6px 16px; }
.v-count { flex: 1; margin: 0; font-size: 14px; font-weight: 700; color: rgba(242, 236, 225, 0.75); }

.v-btn {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 8px;
  background: rgba(242, 236, 225, 0.1);
  color: var(--paper-hi);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.v-btn:active { background: rgba(242, 236, 225, 0.22); }
a.v-btn { text-decoration: none; }
.v-btn:disabled { opacity: 0.25; cursor: default; }

.v-stage { display: grid; place-items: center; min-height: 0; margin: 0; padding: 0 10px; overflow: hidden; touch-action: none; }

.v-stage img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
  cursor: zoom-in;
  transition: transform 0.22s ease;
  will-change: transform;
}

.viewer.zoomed .v-stage img { cursor: zoom-out; border-radius: 0; transition: transform 0.22s ease, transform-origin 0s; }

@media (prefers-reduced-motion: reduce) { .v-stage img { transition: none; } }

.v-bottom { display: flex; align-items: center; gap: 10px; padding: 8px 10px calc(10px + env(safe-area-inset-bottom)); }
.v-caption { flex: 1; display: grid; margin: 0; text-align: center; line-height: 1.4; }
.v-caption span { font-size: 12.5px; font-weight: 600; color: rgba(242, 236, 225, 0.65); }
.v-caption b { font-family: var(--display); font-size: clamp(16px, 4.4vw, 20px); font-weight: 700; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(64px + env(safe-area-inset-bottom));
  z-index: 60;
  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); }

/* 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; }
}

@media (prefers-reduced-motion: reduce) {
  .toast { transition: none; }
}
