/* app-parent.css: the parent overview — a caption over the child's name, the
   two month metrics, a week of day chips, and the day sheet. Loaded last, so
   the rules here repaint the parent block that still sits in app.css.
   Sugar Paper only; see STYLE.md. */

.parent-shell {
  gap: 12px;
}

/* ---- header ------------------------------------------------------------- */

.parent-head {
  display: flex;
  flex: none;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-align: center;
}

.parent-caption {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
}

.parent-head .serif-title {
  font-size: 29px;
}

.parent-refresh-link[disabled] {
  opacity: 0.5;
  cursor: default;
}

/* ---- week switcher ------------------------------------------------------ */

.parent-week-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: none;
  padding: 0 4px;
}

.parent-week-label {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  font-weight: 800;
  text-align: center;
  color: var(--ink);
}

.parent-week-nav .circle-btn {
  width: 42px;
  height: 42px;
}

.parent-week-nav .circle-btn svg {
  width: 17px;
  height: 17px;
  stroke-width: 2.4;
}

/* ---- month metrics ------------------------------------------------------ */

.parent-overview {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: none;
  min-height: 0;
}

.parent-metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
  margin-top: 0;
}

.parent-metric-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  min-height: 0;
  padding: 18px 10px 16px;
  overflow: hidden;
  text-align: center;
}

/* The pastel bar across the top of each card (iOS monthStat's overlay). */
.parent-metric-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 96px;
  height: 5px;
  border-radius: 0 0 5px 5px;
  transform: translateX(-50%);
  background: var(--wash);
}

.parent-metric-card[data-tone="powder"]::before { background: var(--powder); }
.parent-metric-card[data-tone="mint"]::before { background: var(--mint); }

.parent-metric-sticker {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow-sticker);
  font-size: 21px;
  transform: rotate(3deg);
}

.parent-metric-value {
  color: var(--ink);
  font-size: 27px;
  font-weight: 900;
  letter-spacing: -0.01em;
  line-height: 1.05;
}

.parent-metric-label {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
}

/* ---- the week ----------------------------------------------------------- */

.parent-week-stage {
  position: relative;
  flex: none;
}

.parent-week-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 14px 18px;
}

.parent-weekday-header,
.parent-row {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
}

.parent-weekday-strip,
.parent-week-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 5px;
  margin-top: 0;
}

.parent-weekday-label {
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-align: center;
  text-transform: lowercase;
}

.parent-row-label {
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}

.parent-day {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 2px;
  min-height: 66px;
  padding: 10px 2px;
  border: 0;
  border-radius: 16px;
  background: var(--wash);
  box-shadow: none;
  transition: transform 120ms ease;
}

.parent-day:active {
  transform: scale(0.94);
}

.parent-day-date {
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
  color: var(--ink);
}

.parent-day-mark {
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
}

.parent-day.is-active {
  box-shadow: inset 0 0 0 2px var(--ink);
  transform: none;
}

/* Status tints — the five pastels, not a second palette. */
.parent-day-none {
  background: var(--wash);
  color: rgba(61, 56, 53, 0.42);
}

.parent-day-scheduled {
  background: var(--powder);
  color: var(--ink);
}

.parent-day-attended,
.parent-day-complete {
  background: var(--mint);
  color: var(--sage);
}

.parent-day-skipped,
.parent-day-zero,
.parent-day-missed {
  background: var(--pink);
  color: var(--danger);
}

.parent-day-partial {
  background: var(--butter);
  color: var(--caution);
}

.parent-inline-loading {
  flex: none;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.parent-state {
  gap: 14px;
}

/* ---- persistent error banner -------------------------------------------- */

/* Shown whenever the last request failed, even while an older week is still on
   screen underneath — a failed refresh must never look like a successful one
   (iOS ParentOverviewView keeps its ErrorBanner up over stale content for the
   same reason). Unlike the toast this does not auto-dismiss. */
.parent-error-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: none;
  padding: 14px 16px;
  background: var(--pink);
  box-shadow: var(--shadow-feather);
}

.parent-error-banner-text {
  margin: 0;
  flex: 1;
  min-width: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}

.parent-error-banner-retry {
  flex: none;
  min-height: 40px;
  min-width: 96px;
  padding: 0 16px;
  font-size: 13px;
}

/* ---- the day sheet ------------------------------------------------------- */

.parent-sheet-overlay {
  position: fixed;
  inset: 0;
  /* Above the floating tab bar (z 40): this is a modal, not a panel that
     tucks under the chrome. */
  z-index: 45;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  align-items: end;
  justify-items: center;
  padding: calc(var(--safe-top) + 14px) 12px calc(var(--safe-bottom) + 12px);
}

.parent-sheet-scrim {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  background: rgba(61, 56, 53, 0.24);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.parent-detail-sheet {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: min(100%, 430px);
  max-height: 100%;
  overflow-y: auto;
  padding: 16px 18px 20px;
  box-shadow: var(--shadow-sticker);
  animation: parentSheetIn 240ms cubic-bezier(0.32, 0.72, 0, 1) both;
}

@keyframes parentSheetIn {
  from {
    opacity: 0;
    transform: translateY(22px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .parent-detail-sheet {
    animation: none;
  }
}

.parent-sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.parent-sheet-title {
  margin: 0;
  flex: 1;
  min-width: 0;
  font-size: 23px;
  /* app.css still carries `capitalize` for this class; unset it explicitly. */
  text-transform: none;
}

/* The server's Russian date is all lower case; only the first letter is
   capitalised in Russian — `capitalize` would upper-case the month too. */
.parent-sheet-title::first-letter {
  text-transform: uppercase;
}

.parent-sheet-close {
  flex: none;
  margin-top: 2px;
}

.parent-sheet-close svg {
  width: 15px;
  height: 15px;
  stroke-width: 2.4;
}

.parent-detail-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.parent-detail-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 13px 14px;
  border: 0;
  border-radius: var(--radius-tile);
  background: var(--wash);
}

.parent-detail-heading {
  color: var(--ink-soft);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.parent-detail-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
}

.parent-detail-label {
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 700;
}

.parent-detail-value {
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 800;
  text-align: right;
}

.parent-detail-value-with-icon {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.parent-detail-icon {
  font-size: 15px;
  line-height: 1;
}

.parent-detail-value.is-green { color: var(--success); }
.parent-detail-value.is-orange { color: var(--caution); }
.parent-detail-value.is-red { color: var(--danger); }

/* Narrower than the 375 px design width: only the gaps give, never the row
   label — "УРОКИ" clipping to "УРОК" is worse than a tighter strip. */
@media (max-width: 360px) {
  .parent-weekday-strip,
  .parent-week-strip {
    gap: 4px;
  }

  .parent-day {
    min-height: 60px;
  }
}
