:root {
  color-scheme: light;
  --bg: #f1f5f2;
  --panel: #fffdfa;
  --panel-muted: #f4f8f5;
  --text: #12201b;
  --muted: #64766c;
  --line: #c4d3ca;
  --service: #2469df;
  --feast: #cc3340;
  --fast: #dcaefe;
  --fast-ink: #5d356f;
  --feast-soft: #ffd9dd;
  --rest: #96a69d;
  --selected: #0f8254;
  --selected-soft: #e5f5ed;
  --shadow: 0 20px 52px rgba(26, 52, 41, 0.11);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(135deg, #faf5ef, #eff6f2 48%, #f4f6fb);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  font: inherit;
}

.app {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: clamp(12px, 3vw, 28px);
}

.toolbar,
.summary,
.calendar-shell {
  background: rgba(255, 253, 250, 0.94);
  border: 1px solid var(--line);
}

.toolbar {
  display: grid;
  grid-template-columns: 60px 1fr 60px;
  gap: 18px;
  align-items: center;
  padding: 18px 20px 15px;
  border-radius: 8px 8px 0 0;
  box-shadow: var(--shadow);
}

.icon-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  border: 0;
  border-radius: 8px;
  background: #e7f0ea;
  color: var(--selected);
  font-size: 38px;
  line-height: 1;
  padding: 0 0 5px;
  transition: background 140ms ease, transform 140ms ease;
}

.icon-button:hover {
  background: #dcebe2;
}

.icon-button:active {
  transform: translateY(1px);
}

.icon-button:disabled {
  cursor: wait;
  opacity: 0.72;
  transform: none;
}

.month-title {
  min-width: 0;
  text-align: center;
}

h1 {
  margin: 0;
  font-size: 38px;
  line-height: 1.1;
  letter-spacing: 0;
}

.month-title p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.summary {
  padding: 11px 20px 13px;
  border-top: 0;
  box-shadow: none;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  color: #34473e;
  font-size: 13px;
}

.mark {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  line-height: 1;
}

.mark.service {
  width: 16px;
  height: 16px;
}

.mark.feast {
  width: 16px;
  height: 16px;
}

.mark img,
.badge img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.mark.fast {
  width: 15px;
  height: 12px;
  border: 1px solid #c78cf2;
  border-radius: 3px;
  background: var(--fast);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.32);
}

.calendar-shell {
  position: relative;
  display: grid;
  grid-template-columns: minmax(560px, 1fr) minmax(320px, 380px);
  gap: 0;
  border-top: 0;
  border-radius: 0 0 8px 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 2px;
  background: var(--line);
  padding: 2px;
  align-content: start;
}

.weekday,
.day {
  min-width: 0;
  background: var(--panel);
}

.weekday {
  min-height: 46px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  background: #f7f2ea;
}

.day {
  position: relative;
  min-height: 104px;
  border: 0;
  padding: 12px 10px;
  text-align: left;
  color: var(--text);
  transition: background 140ms ease;
}

.day:disabled {
  cursor: wait;
}

.day:hover {
  background: #faf6ee;
}

.day.has-fast:not(.outside) {
  background: #e4bbff;
}

.day.has-fast:not(.outside):hover {
  background: #dca9fd;
}

.day.has-fast:not(.outside) .date-number {
  color: var(--fast-ink);
}

.day.has-feast:not(.outside) {
  background: var(--feast-soft);
  outline: 3px solid var(--feast);
  outline-offset: -3px;
}

.day.has-feast:not(.outside):hover {
  background: #ffcbd2;
}

.day.has-feast:not(.outside) .date-number {
  color: #c1122b;
}

.day.outside {
  color: #9ba9a2;
  background: #f2f6f3;
}

.day.selected {
  background: var(--selected-soft);
  outline: 3px solid var(--selected);
  outline-offset: -3px;
}

.day.selected.has-fast:not(.has-feast) {
  background: linear-gradient(135deg, var(--selected-soft) 0 44%, #e4bbff 44% 100%);
}

.day.selected.has-feast {
  background: linear-gradient(135deg, var(--selected-soft) 0 44%, var(--feast-soft) 44% 100%);
  outline-color: var(--selected);
}

.day.today:not(.selected) {
  box-shadow: inset 0 0 0 1px #91b5a3;
}

.day.sunday:not(.outside) .date-number {
  color: #a52636;
}

.date-number {
  font-weight: 750;
  font-size: 22px;
  line-height: 1;
}

.badges {
  position: absolute;
  left: 10px;
  bottom: 11px;
  display: flex;
  gap: 5px;
}

.badge {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  line-height: 1;
}

.badge.service {
  width: 17px;
  height: 17px;
}

.badge.holiday-service {
  width: 17px;
  height: 17px;
}

.loading-day {
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0)) -160px 0 / 160px 100% no-repeat,
    var(--panel-muted);
  animation: loading-shimmer 1.15s ease-in-out infinite;
}

.loading-day.outside {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.52), rgba(255, 255, 255, 0)) -160px 0 / 160px 100% no-repeat,
    #edf3ef;
}

.loading-day .date-number {
  color: #94a49b;
}

.loading-marks {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 12px;
  display: grid;
  gap: 7px;
}

.loading-line {
  display: block;
  height: 10px;
  width: 100%;
  border-radius: 999px;
  background:
    linear-gradient(90deg, #e7eee9 0%, #f8fbf8 45%, #e3ebe6 100%);
  background-size: 220% 100%;
  animation: loading-line 1.05s ease-in-out infinite;
}

.loading-line.title {
  width: 44%;
  height: 16px;
  margin-bottom: 8px;
}

.loading-line.wide {
  width: 88%;
}

.loading-line.medium {
  width: 66%;
}

.loading-line.narrow {
  width: 48%;
}

.loading-line.short {
  width: 46%;
}

.loading-line.tiny {
  width: 26%;
}

.loading-card {
  border-left-color: #b5c7bc;
  min-height: 92px;
}

@keyframes loading-shimmer {
  to {
    background-position: calc(100% + 160px) 0, 0 0;
  }
}

@keyframes loading-line {
  0% {
    background-position: 100% 0;
  }

  100% {
    background-position: -120% 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .loading-day,
  .loading-line {
    animation: none;
  }
}

.details {
  border-left: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(241, 247, 243, 0.95), rgba(247, 244, 238, 0.95));
  min-width: 0;
  padding-bottom: 10px;
}

.details-date {
  padding: 26px 22px 14px;
  font-weight: 800;
  font-size: 23px;
  line-height: 1.2;
}

.details-body {
  padding: 0 22px 22px;
  display: grid;
  gap: 12px;
}

.info-block {
  border: 1px solid var(--line);
  border-left: 4px solid #95ab9e;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 8px;
  padding: 15px 16px;
}

.info-block h2 {
  margin: 0 0 7px;
  font-size: 16px;
  letter-spacing: 0;
}

.info-block p {
  margin: 0;
  color: var(--muted);
  white-space: pre-line;
}

.service-block {
  border-left-color: var(--service);
}

.feast-block {
  border-left-color: var(--feast);
}

.church-day-block {
  border-left-color: #587b93;
}

.saints-block {
  border-left-color: #8666ae;
}

.fast-block {
  border-left-color: var(--fast);
}

.fast-free-block {
  border-left-color: var(--rest);
}

.service-list {
  display: grid;
  gap: 10px;
}

.service-item {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.service-item:first-child {
  border-top: 0;
  padding-top: 0;
}

.service-item h3 {
  margin: 0 0 4px;
  font-size: 15px;
  letter-spacing: 0;
}

.service-item.holiday h3 {
  color: #9f1239;
}

.service-item .note {
  margin-top: 4px;
  color: #42554a;
}

.service-item.demo h3 {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.demo-flag {
  border: 1px solid #9db6aa;
  border-radius: 999px;
  background: #edf5f0;
  color: #315d49;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  text-transform: uppercase;
}

.error {
  color: #9f1239;
}

@media (max-width: 920px) {
  .app {
    padding: 0;
  }

  .toolbar,
  .summary,
  .calendar-shell {
    border-left: 0;
    border-right: 0;
    border-radius: 0;
  }

  .toolbar {
    grid-template-columns: 48px 1fr 48px;
    gap: 10px;
    padding: 12px;
  }

  .icon-button {
    width: 48px;
    height: 48px;
    font-size: 32px;
  }

  h1 {
    font-size: 27px;
  }

  .calendar-shell {
    grid-template-columns: 1fr;
  }

  .details {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .summary {
    padding: 10px 14px;
  }

  .day {
    min-height: 54px;
    padding: 7px;
  }

  .badges {
    left: auto;
    right: 5px;
    top: 6px;
    bottom: auto;
    gap: 3px;
  }

  .badge {
    transform-origin: center;
  }

  .badge.service {
    width: 14px;
    height: 14px;
  }

  .badge.holiday-service {
    width: 14px;
    height: 14px;
  }

  .date-number {
    font-size: 17px;
  }

  .details-date {
    padding: 20px 18px 10px;
    font-size: 21px;
  }

  .details-body {
    padding: 0 18px 18px;
  }
}

@media (min-width: 761px) and (max-width: 920px) {
  .app {
    padding: 14px;
  }

  .day {
    min-height: 76px;
  }
}
