:root {
  /* Core surfaces, from the Figma "Monthly View - Default" frame */
  --ink: #272e45;
  /* The page behind the calendar. Kept apart from --paper, which is doing five
     other jobs — the calendar shell, cards, popovers and nav buttons all stay
     white and read as a sheet sitting on a warm page. */
  --app-bg: #fffbf1;
  --paper: #ffffff;
  --grid-line: rgba(55, 55, 55, 0.4);
  --weekday-text: #f0de88;
  /* A warm neutral a couple of steps off paper. Months you aren't in should
     recede quietly — a dark panel reads as a blocked-out area, not context. */
  --offmonth-bg: #f2f0ec;
  /* How long a day takes to cross between current and non-current on scroll. */
  --month-fade: 300ms;
  --add-tile: #abb196;
  --card-title: #303030;
  /* Today's highlight borrows the weekday yellow and the IG Reel tint. */
  --today-line: #f0de88;
  --today-bg: #fff9e1;

  /* content-platform variants: accent (border + header), label, body tint */
  --yt: #a11515;
  --yt-label: #ffffff;
  --yt-tint: #ffecec;
  --reel: #ffc800;
  --reel-label: #313131;
  --reel-tint: #fff9e1;
  --feed: #0083ee;
  --feed-label: #ffffff;
  --feed-tint: #eef7ff;
  --livestream: #7c8c47;
  --livestream-label: #ffffff;
  --livestream-tint: #f2f5ea;
  /* A Book isn't a platform, so it gets a border colour rather than the
     accent/label/tint trio the content types share. */
  --book: #ffbdf9;
  --book-tint: #ffeffd;

  /* content-status variants: chip background + text */
  --idea-bg: #ececec;
  --idea-fg: #6a6a6a;
  --plan-bg: #f3d8fe;
  --plan-fg: #9e3fc8;
  --script-bg: #fff0bf;
  --script-fg: #f28e2c;
  --read-bg: #d1d9ff;
  --read-fg: #6365d2;
  --film-bg: #ffd0d0;
  --film-fg: #f3393b;
  --edit-bg: #ffe0c4;
  --edit-fg: #e7682c;
  --sched-bg: #c5fbff;
  --sched-fg: #2283cf;
  --done-bg: #b4f9bb;
  --done-fg: #0f8f1d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--app-bg);
  font-family: "soleil", sans-serif;
  color: var(--ink);
}

.page {
  display: flex;
  flex-direction: column;
  /* Fills the viewport with a 40px gutter, but stops growing past 1920px so cells
     don't get cavernous on a wide monitor. The top gutter belongs to .page-head,
     which is sticky and has to paint its own background up to the viewport edge. */
  padding: 0 40px 40px;
  max-width: 1920px;
  margin: 0 auto;
}

/* ---- Month heading ---------------------------------------------------- */

/* Sticky because the month name now changes as you scroll — a title that scrolls
   away can't report which month you're in, and the arrows would go with it. */
.page-head {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 40px 0 24px;
  /* Matches the page, not the calendar — it's sticky and paints its own
     background, so white here would put a bar across the top on scroll. */
  background: var(--app-bg);
}

.month-title {
  margin: 0;
  opacity: 0.97;
  color: var(--ink);
  font-family: "etna-condensed", sans-serif;
  font-weight: 600;
  font-size: 63.425px;
  line-height: 1.3;
  letter-spacing: -1.2685px;
}

/* The 40px above the title should read as 40px. Untrimmed, the line box stacks
   another ~17px of leading and ascent on top of the capitals — same reason the
   status pills are trimmed to cap height. */
@supports (text-box: trim-both cap alphabetic) {
  .month-title {
    text-box: trim-both cap alphabetic;
  }
}

/* The month's first letter is set in Feline, same treatment as Linkplant's headline. */
.month-title .initial {
  font-family: "feline", cursive;
  font-weight: 400;
  font-size: 63.633px;
}

/* Month navigation isn't in the Figma frame — added so the calendar is actually usable. */
.month-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.nav-btn {
  height: 36px;
  min-width: 36px;
  padding: 0 10px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  font-family: inherit;
  font-weight: 600;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.nav-btn--text {
  font-size: 12px;
  letter-spacing: 0.48px;
  text-transform: uppercase;
}

.nav-btn:hover {
  background: var(--ink);
  color: var(--weekday-text);
}

/* ---- Calendar shell --------------------------------------------------- */

.calendar {
  border: 2px solid var(--ink);
  border-radius: 24px;
  /* clip, not hidden — both round off the day cells, but `hidden` makes this a scroll
     container and the sticky weekday row would stop sticking to the page. */
  overflow: clip;
  background: var(--paper);
}

.weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--ink);
  /* Follows the page down so the day names stay readable mid-month, parking
     directly under the sticky header. --head-h is measured in app.js. */
  position: sticky;
  top: var(--head-h, 0px);
  z-index: 5;
}

.weekday {
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  color: var(--weekday-text);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.56px;
  text-transform: uppercase;
}

.grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

/* ---- Day cell --------------------------------------------------------- */

.day {
  display: flex;
  flex-direction: column;
  min-height: 240px;
  border-right: 1px solid var(--grid-line);
  border-bottom: 1px solid var(--grid-line);
}

/* Last week keeps the container's own rounded border as its bottom edge. */
.day:nth-last-child(-n + 7) {
  border-bottom: none;
}

.day.is-offmonth {
  background: var(--offmonth-bg);
}

/* Days cross between current and non-current as the stream scrolls. Enabled a
   frame after boot (body.is-ready) so the first paint arrives already settled. */
.is-ready .day,
.is-ready .day-title,
.is-ready .card {
  transition: background-color var(--month-fade) ease, color var(--month-fade) ease,
    opacity var(--month-fade) ease;
}

/* Drop feedback has to be instant — a 300ms fade reads as lag mid-drag. */
.is-ready .day.is-drop-target {
  transition-duration: 0s;
}

/* Inset stroke rather than a real border — a border would nudge the grid by 2px. */
.day.is-today {
  background: var(--today-bg);
  box-shadow: inset 0 0 0 2px var(--today-line);
}

.day-head {
  height: 42px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 8px;
}

.day-title {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.48px;
  text-transform: uppercase;
  color: var(--ink);
  white-space: nowrap;
}

/* Dimmed rather than greyed out — these days are fully usable, you're just not
   standing in that month. */
.is-offmonth .day-title {
  color: var(--ink);
  opacity: 0.45;
}

/* Context, not this month's work: cards spilling in from a neighbouring month,
   and anything already behind us. Today itself stays at full strength. */
.is-offmonth .card,
.is-offmonth .content-slot,
.is-past .card {
  opacity: 0.45;
}

/* The Figma frame sized off-month day numbers up, which was fine when off-month
   was a fixed dark panel. Now that cells cross over on scroll a font-size change
   would snap mid-fade, so every day number stays the same size. */

/* Scroll drives the month change, so honour the OS motion setting for both. */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .is-ready .day,
  .is-ready .day-title,
  .is-ready .card {
    transition: none;
  }
}

.add-btn {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  padding: 0;
  border: none;
  border-radius: 3px;
  background: var(--add-tile);
  opacity: 0.8;
  display: grid;
  place-items: center;
  cursor: pointer;
  visibility: hidden;
}

.day:hover .add-btn,
.add-btn.is-open {
  visibility: visible;
}

.add-btn img {
  display: block;
  width: 10.6667px;
  height: 10.6667px;
}

.day-slot {
  flex: 1;
  min-height: 198px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
}

/* ---- content-platform card -------------------------------------------- */

.card {
  border: 1.5px solid var(--accent);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  background: var(--accent);
  border: 1px solid var(--accent);
}

.card-platform {
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.32px;
  text-transform: uppercase;
  color: var(--accent-label);
  white-space: nowrap;
}

.card-body {
  min-height: 48px;
  padding: 4px 8px 8px;
  background: var(--accent-tint);
}

.card-title {
  font-family: "meursault-variable", serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 20px;
  letter-spacing: -0.48px;
  color: var(--card-title);
  outline: none;
  overflow-wrap: anywhere;
}

.card-title:empty::before {
  content: attr(data-placeholder);
  color: #9a9a9a;
}

/* ---- Drag and drop ----------------------------------------------------- */

.card-head {
  cursor: grab;
}

.card.is-dragging {
  opacity: 0.4;
}

.day.is-drop-target {
  background: #f2f4ff;
  box-shadow: inset 0 0 0 2px var(--ink);
}

/* Cmd held: the drop will duplicate rather than move. The cursor already shows a
   + badge, but that sits under the pointer — the cell needs to say it too, since
   moving and copying look identical until it's too late. */
.is-copy-drag .day.is-drop-target {
  background: var(--livestream-tint);
  box-shadow: inset 0 0 0 2px var(--livestream);
}

.is-copy-drag .day.is-drop-target .content-slot-fill {
  border-color: var(--livestream);
  color: var(--livestream);
}

.card--youtube {
  --accent: var(--yt);
  --accent-label: var(--yt-label);
  --accent-tint: var(--yt-tint);
}

.card--ig-reel {
  --accent: var(--reel);
  --accent-label: var(--reel-label);
  --accent-tint: var(--reel-tint);
}

.card--ig-feed {
  --accent: var(--feed);
  --accent-label: var(--feed-label);
  --accent-tint: var(--feed-tint);
}

.card--livestream {
  --accent: var(--livestream);
  --accent-label: var(--livestream-label);
  --accent-tint: var(--livestream-tint);
}

/* ---- Pills (content-status + content-type-selector) -------------------- */

.pill {
  padding: 4px 8px;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.32px;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  /* Figma trims these labels to cap height. The explicit line-height is the
     fallback (Soleil's cap height at 14px) for browsers without text-box. */
  line-height: 10px;
}

@supports (text-box: trim-both cap alphabetic) {
  .pill {
    line-height: normal;
    text-box: trim-both cap alphabetic;
  }
}

.pill--idea   { background: var(--idea-bg);   color: var(--idea-fg); }
.pill--plan   { background: var(--plan-bg);   color: var(--plan-fg); }
.pill--script { background: var(--script-bg); color: var(--script-fg); }
.pill--read   { background: var(--read-bg);   color: var(--read-fg); }
.pill--film   { background: var(--film-bg);   color: var(--film-fg); }
.pill--edit   { background: var(--edit-bg);   color: var(--edit-fg); }
.pill--sched  { background: var(--sched-bg);  color: var(--sched-fg); }
.pill--done   { background: var(--done-bg);   color: var(--done-fg); }

.pill--type-livestream { background: var(--livestream); color: var(--livestream-label); }
.pill--type-book { background: var(--book); color: var(--card-title); }

/* ---- Book cards -------------------------------------------------------- */
/* Slot geometry with a solid border rather than dashes, so a Book reads as
   something real sitting where a placeholder would. No head, no status. */

.card--book {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 26px 0 10px;
  border: 1.5px solid var(--book);
  border-radius: 12px;
  background: var(--book-tint);
  /* The base .card clips its head bar; a Book has neither. */
  overflow: visible;
  position: relative;
}

.card-book-emoji {
  flex-shrink: 0;
  font-size: 15px;
  line-height: 1;
}

.card-book-title {
  flex: 1;
  min-width: 0;
  padding: 6px 0;
  font-size: 14px;
  line-height: 1.3;
}

/* Sits on the title's line, hard right. Reveal-on-hover matches the slot's ×. */
.card-book-remove {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  z-index: 1;
  width: 18px;
  height: 18px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  display: grid;
  place-items: center;
  cursor: pointer;
  visibility: hidden;
}

.card--book:hover .card-book-remove,
.card-book-remove:focus-visible {
  visibility: visible;
}

.card-book-remove:hover {
  background: var(--book);
}

.card-book-remove img {
  width: 10px;
  height: 10px;
}
.pill--type-youtube { background: var(--yt);   color: var(--yt-label); }
.pill--type-ig-reel { background: var(--reel); color: var(--reel-label); }
.pill--type-ig-feed { background: var(--feed); color: var(--feed-label); }

/* ---- Content slots ----------------------------------------------------- */
/* Placeholders for posts Pam's schedule says are due but that haven't been made
   yet. Two kinds so far — .content-slot-video and .content-slot-review — sharing
   this geometry and differing only in the colour they preview on hover. */

/* Half a single-line card (85px: 34 head + 48 body + 3 border), so a slot reads
   as lighter than the real thing sitting under it. */
.content-slot {
  position: relative;
  min-height: 42px;
  flex-shrink: 0;
}

.content-slot-fill {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  /* Symmetric so the label stays centred while clearing the X on the right. */
  padding: 0 26px;
  border: 1.5px dashed #c9c9c9;
  border-radius: 12px;
  background: transparent;
  color: #9a9a9a;
  font-family: inherit;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.32px;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 140ms ease, color 140ms ease, background-color 140ms ease;
}

/* Hover previews the card each slot makes. */
.content-slot-video .content-slot-fill:hover,
.content-slot-video .content-slot-fill:focus-visible {
  border-color: var(--yt);
  color: var(--yt);
  background: var(--yt-tint);
}

.content-slot-review .content-slot-fill:hover,
.content-slot-review .content-slot-fill:focus-visible,
.content-slot-photo .content-slot-fill:hover,
.content-slot-photo .content-slot-fill:focus-visible {
  border-color: var(--feed);
  color: var(--feed);
  background: var(--feed-tint);
}

/* The reel accent is a bright yellow, so the label borrows the card's own dark
   label colour — yellow text on the cream tint would be unreadable. */
.content-slot-reel .content-slot-fill:hover,
.content-slot-reel .content-slot-fill:focus-visible {
  border-color: var(--reel);
  color: var(--reel-label);
  background: var(--reel-tint);
}

/* Sits on the label's line, hard right. Reveal-on-hover matches the day's add button. */
.content-slot-remove {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  z-index: 1;
  width: 18px;
  height: 18px;
  padding: 0;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  opacity: 0;
  transition: opacity 140ms ease;
}

.content-slot:hover .content-slot-remove,
.content-slot-remove:focus-visible {
  opacity: 1;
}

.content-slot-remove:hover {
  background: #ececec;
}

.content-slot-remove img {
  display: block;
  width: 10.6667px;
  height: 10.6667px;
}

/* Dragging a card onto the day is the other way to fill a slot. */
.day.is-drop-target .content-slot-fill {
  border-color: var(--ink);
  color: var(--ink);
}

/* ---- Popovers (change-status + add-new-content) ------------------------ */

.popover {
  position: absolute;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  border-radius: 8px;
  background: var(--paper);
  border: 1px solid rgba(39, 46, 69, 0.15);
  box-shadow: 0 8px 24px rgba(39, 46, 69, 0.18);
}

/* Scoped to the popovers — the status chip on a card is a .pill too, and it
   shouldn't flicker every time the cursor crosses a card. */
.popover .pill {
  transition: opacity 140ms ease;
}

.popover .pill:hover {
  opacity: 0.72;
}

.popover .pill:active {
  opacity: 0.55;
}

.popover--status {
  align-items: flex-end;
}

.popover--type {
  align-items: flex-start;
}

.popover-sep {
  width: 100%;
  height: 1px;
  margin: 2px 0;
  background: rgba(39, 46, 69, 0.12);
}

/* Delete has no Figma equivalent — the design has no delete affordance, so it
   lives at the bottom of the status popover rather than adding new chrome. */
.pill--delete {
  background: #ffecec;
  color: #a11515;
}
