/*
  Circuit Princess OS — independent desktop widgets

  Canonical home for each widget's layout, surface, and controls. Viewport-wide
  mobile adaptations belong in mobile.css; app-window container behavior stays
  with the relevant program. A widget should own its own space and must not
  depend on another widget's content height. Keep shared OS roles in global.css.

  Migration starts after program-window ownership is established and verified.
*/

/* Widget settings and independent desktop cards. */
.widget-option {
  display: block;
  margin: 8px 0;
  padding: 10px;
  border: 2px inset #eee;
}

.widget-dock {
  position: absolute;
  inset: 0;
  display: contents;
  max-height: none;
  overflow: visible;
  padding: 0;
  pointer-events: none;
}

.desktop-widget {
  position: relative;
  overflow: hidden;
  padding: 12px;
  border: 1px solid #8e805d;
  border-radius: 10px;
  background: #fff7d9;
  color: #2c2331;
  pointer-events: auto;
}

.desktop-widget b,
.desktop-widget time {
  display: block;
}

.moon-widget {
  border-color: #c6a9d5;
  background:
    radial-gradient(circle at 87% 9%, #8b6bac 0 2px, transparent 3px),
    radial-gradient(circle at 77% 16%, #fff7ce 0 1px, transparent 2px),
    linear-gradient(145deg, #272039, #443155 60%, #312848);
  background-size: 29px 29px, 19px 19px, auto;
  color: #fff3da;
}

/* Calendar widget. */
.calendar-heading,
.calendar-heading nav,
.calendar-footer,
.note-heading,
.note-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.calendar-heading h2 {
  margin: 2px 0 0;
  color: inherit;
  font: 700 19px Georgia, serif;
}

.widget-kicker {
  display: block;
  font: 700 9px/1.2 system-ui, sans-serif;
  letter-spacing: .14em;
  opacity: .78;
}

.calendar-heading nav { gap: 4px; }

.calendar-heading nav button {
  min-width: 30px;
  min-height: 30px;
  padding: 2px 7px;
  border: 1px solid currentColor;
  border-radius: 6px;
  background: #fff2;
  color: inherit;
  font-weight: 700;
}

.calendar-heading nav button[data-calendar-today] { font-size: 10px; }

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 3px;
  margin-top: 10px;
  text-align: center;
}

.calendar-weekday {
  display: grid;
  place-items: center;
  min-height: 20px;
  font-size: 10px;
  font-weight: 800;
  opacity: .72;
}

.calendar-day {
  position: relative;
  display: grid;
  grid-template-rows: 1fr 5px;
  place-items: center;
  aspect-ratio: 1;
  min-width: 0;
  padding: 2px 0;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
}

.calendar-day-markers {
  display: flex;
  align-items: center;
  gap: 1px;
  height: 5px;
  font-size: 8px;
  line-height: 5px;
  font-style: normal;
}

.calendar-day-markers b { font-weight: 900; }
.calendar-day.has-publications .calendar-day-markers b:first-child { color: #ffd878; }
.calendar-day.has-events .calendar-day-markers b:last-child { color: #ff9fcb; }

.calendar-day:hover,
.calendar-day:focus-visible {
  border-color: currentColor;
  background: #ffffff24;
}

.calendar-day.is-today {
  border-color: #ffd878;
  font-weight: 900;
  box-shadow: 0 0 0 1px #ffd87866;
}

.calendar-day.is-selected {
  border-color: #fff0bd;
  background: #ffd878;
  color: #30243a;
  font-weight: 900;
}

.calendar-footer {
  flex-wrap: wrap;
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px solid #ffffff38;
  font-size: 10px;
}

.calendar-published-summary,
.calendar-milestone {
  flex: 1 0 100%;
  padding: 3px 5px;
  border-radius: 5px;
  background: #ffffff18;
}

.calendar-milestone { color: #ffe3a1; }
.calendar-footer span { font-weight: 700; }

/* Sticky-note widget. */
.note-widget {
  padding: 12px 13px 10px;
  transform: rotate(-.5deg);
  border-color: #b59142;
  background: #fff1ad;
}

.note-heading { margin-bottom: 8px; }

.note-heading > div > b {
  display: block;
  margin-top: 2px;
  font: 700 15px Georgia, serif;
}

.note-color-label {
  display: grid;
  gap: 2px;
  font-size: 9px;
  font-weight: 700;
}

.note-color-label select {
  max-width: 94px;
  min-height: 28px;
  padding: 2px 4px;
  border: 1px solid #8d7844;
  border-radius: 5px;
  background: #fff9dc;
  color: #2c2331;
  font: inherit;
}

.note-widget textarea {
  display: block;
  box-sizing: border-box;
  width: 100%;
  height: 94px;
  min-height: 70px;
  padding: 0 8px;
  resize: vertical;
  border: 1px dashed #9b7b3e;
  border-radius: 4px;
  background: repeating-linear-gradient(to bottom, #fff8d8 0, #fff8d8 23px, #e7d59a 23px, #e7d59a 24px);
  background-origin: content-box;
  background-size: 100% 24px;
  color: #382b23;
  font: 14px/24px "Comic Sans MS", cursive;
  outline-offset: 2px;
}

.note-widget textarea::placeholder { color: #786643; opacity: .8; }

.note-footer {
  margin-top: 6px;
  color: #59482a;
  font-size: 9px;
}

.note-footer [data-note-count] { font-variant-numeric: tabular-nums; }

.note-widget[data-note-color=rose] { border-color: #bd7890; background: #ffe0e6; }
.note-widget[data-note-color=rose] textarea { border-color: #c07791; background: repeating-linear-gradient(to bottom, #fff1f3 0, #fff1f3 23px, #edb8c4 23px, #edb8c4 24px); }
.note-widget[data-note-color=mint] { border-color: #68966d; background: #dff5df; }
.note-widget[data-note-color=mint] textarea { border-color: #78a47a; background: repeating-linear-gradient(to bottom, #effbef 0, #effbef 23px, #b9dcb9 23px, #b9dcb9 24px); }
.note-widget[data-note-color=lavender] { border-color: #8572b6; background: #ece4ff; }
.note-widget[data-note-color=lavender] textarea { border-color: #9582c2; background: repeating-linear-gradient(to bottom, #f7f2ff 0, #f7f2ff 23px, #d6c9ef 23px, #d6c9ef 24px); }

/* The decorative tape and star belong to the sticky note, not its container. */
.note-widget { position: relative; isolation: isolate; border-radius: 2px 3px 4px 2px; transform: rotate(-1deg); }
.note-widget::before { position: absolute; z-index: 2; top: -6px; left: 50%; width: 46px; height: 13px; border: 1px solid #ffffff6b; border-radius: 1px; background: #eab3bdc9; content: ""; transform: translateX(-50%) rotate(-3deg); pointer-events: none; }
.note-widget::after { position: absolute; top: 7px; right: 9px; color: #b77980; font: 14px Georgia, serif; content: "✦"; opacity: .68; pointer-events: none; }
.note-widget[data-note-color=sunshine]::before { background: #e8c96dc9; }
.note-widget[data-note-color=rose]::before { background: #dc91a9c9; }
.note-widget[data-note-color=mint]::before { background: #8dbb91c9; }
.note-widget[data-note-color=lavender]::before { background: #a898d0c9; }
.note-heading > div { min-width: 0; }
.note-heading > div > b { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-widget[data-note-color=midnight] { border-color: #8e83b5; background: #29243f; color: #f5edff; }
.note-widget[data-note-color=midnight] textarea { border-color: #8e83b5; background: repeating-linear-gradient(to bottom, #322c49 0, #322c49 23px, #57506f 23px, #57506f 24px); color: #f5edff; }
.note-widget[data-note-color=midnight] textarea::placeholder { color: #c8badc; }
.note-widget .note-footer { display: flex; justify-content: space-between; gap: 6px; margin-top: 6px; }
.note-widget .note-footer button { padding: 4px 7px; font-size: 11px; }
body[data-theme-style=y2k] .desktop-widget { border-color: #e99fc5; border-radius: 18px; }
body[data-theme-style=y2k] .moon-widget { background: radial-gradient(circle at 85% 12%, #fff 0 2px, transparent 3px), linear-gradient(145deg, #7652c7, #b45dc6 55%, #7652c7); color: #fff; }
body[data-theme-style=pink98] .desktop-widget { border: 2px outset #fff0f5; border-radius: 2px; background: #fff0f5dd; color: #351521; }
body[data-theme-style=pink98] .moon-widget { background: radial-gradient(circle at 85% 12%, #fff1a8 0 2px, transparent 3px), linear-gradient(145deg, #352130, #57374d); color: #ffe2ec; }
body[data-theme-style=pink98] .note-widget textarea { color: #351521; }
body[data-theme-style=pinkxp] .desktop-widget { border-color: #e5aec6; border-radius: 12px; }
body[data-theme-style=pinkxp] .moon-widget { background: radial-gradient(circle at 85% 12%, #fff 0 2px, transparent 3px), linear-gradient(145deg, #63446d, #a16188 58%, #533d76); color: #fff1fa; }

/* Widgets are intentionally hidden in the uncluttered mobile desktop. */
