/*
 * Salah — Dashboard Worship
 *
 * Owns the three-card worship dashboard:
 * - Today’s Prayers / Contextual Worship / Dhikr Counter proportions
 * - Contextual Worship presentation
 * - Context navigation controls
 * - Long contextual routines
 * - Dhikr Counter Qur’anic reminder
 */


/* ============================================================
   DESKTOP DASHBOARD BALANCE
   ============================================================ */

.dashboard-grid {
  grid-template-columns: .96fr 1.12fr .72fr;
}


/* ============================================================
   CONTEXTUAL WORSHIP
   ============================================================ */

.focus-panel {
  min-width: 0;
}

#contextual-worship-root {
  min-width: 0;
}


/* ---------- Header ---------- */

.contextual-worship-head {
  align-items: flex-start;
  margin-bottom: 10px;
}

.contextual-worship-head > div:first-child {
  min-width: 0;
  flex: 1;
}

.contextual-worship-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.contextual-worship-title-row h2 {
  min-width: 0;
  margin: 0;
  font-size: 27px;
  line-height: 1.15;
}


/* ---------- Previous / next arrows ---------- */

.contextual-worship-arrow {
  flex: 0 0 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;

  width: 30px;
  height: 30px;
  padding: 0;

  border: 1px solid rgba(14,59,46,.09);
  border-radius: 50%;

  background: #f1ede4;
  color: #0e3b2e;

  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 20px;
  font-weight: 500;
  line-height: 1;

  cursor: pointer;

  transition:
    background .16s ease,
    color .16s ease,
    border-color .16s ease,
    transform .16s ease;
}

.contextual-worship-arrow:hover {
  background: #0e3b2e;
  color: #fff;
  border-color: #0e3b2e;
}

.contextual-worship-arrow:active {
  transform: scale(.95);
}

.contextual-worship-arrow:focus-visible,
.contextual-return-button:focus-visible {
  outline: 2px solid rgba(201,169,106,.72);
  outline-offset: 2px;
}


/* ---------- Right-side state ---------- */

.contextual-worship-status {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex: 0 0 auto;
}

.contextual-worship-status .day-chip {
  white-space: nowrap;
}

.contextual-friday-chip {
  background: rgba(201,169,106,.16);
  color: #8b6727;
  font-weight: 700;
}


/* ---------- Return-to-live-context button ---------- */

.contextual-return-button {
  border: 1px solid rgba(14,59,46,.09);
  border-radius: 999px;

  background: #f1ede4;
  color: #0e3b2e;

  padding: 6px 10px;

  font-size: 9px;
  line-height: 1;
  font-weight: 700;

  cursor: pointer;
  white-space: nowrap;

  transition:
    background .16s ease,
    color .16s ease,
    border-color .16s ease;
}

.contextual-return-button:hover {
  background: #0e3b2e;
  color: #fff;
  border-color: #0e3b2e;
}


/* ---------- Intro ---------- */

.contextual-worship-intro {
  margin: 0 0 10px;
}

.contextual-worship-subtitle {
  margin: 0 0 5px;

  color: #59645e;

  font-size: 11px;
  line-height: 1.45;
  font-weight: 500;
}

.contextual-worship-disclaimer {
  margin: 0;

  color: #7a817d;

  font-size: 9px;
  line-height: 1.45;
}


/* ---------- Madhhab contextual note ---------- */

.contextual-madhhab-note {
  display: flex;
  gap: 7px;
  align-items: flex-start;

  margin: 0 0 10px;
  padding: 8px 10px;

  border: 1px solid rgba(14,59,46,.07);
  border-radius: 10px;

  background: rgba(241,237,228,.52);

  color: #66706c;

  font-size: 9px;
  line-height: 1.4;
}

.contextual-madhhab-note strong {
  flex: 0 0 auto;

  color: #0e3b2e;
  font-size: 9px;
}

.contextual-madhhab-note span {
  min-width: 0;
}


/* ---------- Friday note ---------- */

.contextual-friday-note {
  display: flex;
  gap: 7px;
  align-items: flex-start;

  margin: 0 0 10px;
  padding: 8px 10px;

  border: 1px solid rgba(201,169,106,.18);
  border-radius: 10px;

  background: rgba(201,169,106,.08);

  color: #75694f;

  font-size: 9px;
  line-height: 1.4;
}

.contextual-friday-note strong {
  flex: 0 0 auto;
  color: #8b6727;
}


/* ============================================================
   WORSHIP ROUTINE
   ============================================================ */

/*
 * The dashboard card should remain visually balanced even when
 * a context contains a long routine such as ʿIshāʾ.
 *
 * Only the routine list scrolls.
 * Header / context / madhhab guidance remain visible.
 */

.contextual-worship-items {
  position: relative;
  min-width: 0;

  max-height: 510px;
  overflow-y: auto;
  overflow-x: hidden;

  padding-right: 5px;
  padding-bottom: 10px;

  scrollbar-width: thin;
  scrollbar-color:
    rgba(14,59,46,.22)
    transparent;

  overscroll-behavior: contain;
}

.contextual-worship-items::-webkit-scrollbar {
  width: 5px;
}

.contextual-worship-items::-webkit-scrollbar-track {
  background: transparent;
}

.contextual-worship-items::-webkit-scrollbar-thumb {
  background: rgba(14,59,46,.20);
  border-radius: 999px;
}

.contextual-worship-items::-webkit-scrollbar-thumb:hover {
  background: rgba(14,59,46,.32);
}

.contextual-worship-items .timeline {
  padding-bottom: 3px;
}

.contextual-worship-items .timeline-item {
  min-width: 0;
}

.contextual-worship-items .timeline-item > div {
  min-width: 0;
}

.contextual-worship-items .timeline-item b {
  font-size: 10px;
  line-height: 1.3;
}

.contextual-worship-items .timeline-item small {
  font-size: 8px;
  line-height: 1.35;
}


/*
 * Gentle visual cue that the routine area is independently
 * scrollable. It stays subtle enough not to obscure content.
 */

.contextual-worship-items {
  -webkit-mask-image:
    linear-gradient(
      to bottom,
      #000 0,
      #000 calc(100% - 18px),
      transparent 100%
    );

  mask-image:
    linear-gradient(
      to bottom,
      #000 0,
      #000 calc(100% - 18px),
      transparent 100%
    );
}


/* ============================================================
   DHIKR COUNTER — QUR’ANIC REMINDER
   ============================================================ */

.counter-verse {
  margin: 16px 4px 0;
  padding: 14px 4px 0;

  border-top: 1px solid rgba(255,255,255,.12);

  text-align: center;
}

.counter-verse-arabic {
  display: block;

  margin: 0 0 5px;

  color: #f3e4b9;

  font-family: serif;
  font-size: 17px;
  line-height: 1.7;
  font-weight: 400;
}

.counter-verse-english {
  display: block;

  margin: 0 auto;

  max-width: 240px;

  color: rgba(255,255,255,.78);

  font-size: 8.5px;
  line-height: 1.5;
}

.counter-verse-source {
  display: block;

  margin-top: 4px;

  color: rgba(255,255,255,.48);

  font-size: 7.5px;
  line-height: 1.4;
}


/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 1000px) {
  .dashboard-grid {
    grid-template-columns: 1fr 1fr;
  }

  .counter-panel {
    grid-column: 1 / -1;
  }

  /*
   * Once the dashboard changes shape there is less reason to
   * constrain Contextual Worship to the desktop card height.
   */
  .contextual-worship-items {
    max-height: 560px;
  }
}

@media (max-width: 760px) {
  .contextual-worship-title-row {
    gap: 6px;
  }

  .contextual-worship-title-row h2 {
    font-size: 24px;
  }

  .contextual-worship-arrow {
    flex-basis: 28px;
    width: 28px;
    height: 28px;
    font-size: 18px;
  }

  .contextual-worship-status {
    gap: 5px;
  }

  .contextual-madhhab-note,
  .contextual-friday-note {
    display: block;
  }

  .contextual-madhhab-note strong,
  .contextual-friday-note strong {
    display: block;
    margin-bottom: 3px;
  }
}

@media (max-width: 620px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .counter-panel {
    grid-column: auto;
  }

  /*
   * On a phone the card itself is the page column, so don't
   * create an unnecessarily cramped nested scroll region.
   */
  .contextual-worship-items {
    max-height: none;
    overflow: visible;
    padding-right: 0;
    padding-bottom: 0;

    -webkit-mask-image: none;
    mask-image: none;
  }
}
