/* THE CALENDAR'S OWN STYLES, SHARED BY EVERY PAGE THAT OPENS ONE.
 *
 * These were inline in index.html while the calendar's script was too. The script was
 * lifted into /js/stay.js so that /book could open a calendar, and these were left behind,
 * so /book rendered the thing as an unstyled block of buttons. The tests did not see it
 * because they queried the DOM and clicked cells, which worked perfectly; it simply looked
 * broken. A shared script with unshared styles is one file away from this every time.
 *
 * THE CONTRACT: the element the calendar opens from must be position:relative, because the
 * box is absolutely positioned against it. .ratecell is, below. Any page using a different
 * container has to say so itself.
 *
 * Variables used, which every page loading this must define:
 *   --ink  --ink2  --muted  --rule  --pad
 */

/* the calendar that opens from Arrive and Depart, and nowhere else */
.ratecell{position:relative}
.ratecell input[readonly]{cursor:pointer}
.cal{position:absolute;top:100%;left:0;z-index:60;background:#fff;
  border:1px solid var(--rule);padding:20px 22px 16px;
  width:min(540px,calc(100vw - 2*var(--pad)));
  box-shadow:0 20px 44px rgba(26,22,18,.14)}
.cal[hidden]{display:none}
.cal .mhead{display:flex;align-items:center;justify-content:space-between;margin-bottom:14px}
.cal .mhead .nav{border:1px solid var(--rule);background:none;width:28px;height:28px;
  cursor:pointer;font-family:"Cormorant Garamond",serif;font-size:17px;line-height:1;
  color:var(--ink);padding:0}
.cal .mhead .nav:disabled{color:#c9c2b8;cursor:default}
.cal .months{display:grid;grid-template-columns:1fr 1fr;gap:26px}
.cal .mname{font-family:"Cormorant Garamond",serif;font-size:17px;margin:0 0 10px;text-align:center}
/* minmax(0,1fr), NOT 1fr. A bare 1fr carries an automatic minimum of the item's
   min-content, and with aspect-ratio on the cells that minimum is bigger than a
   seventh of a narrow screen. The columns then refuse to shrink, come out uneven
   (60px, 40px, 60px...) and overflow the grid they are in, which on a phone pushed
   the whole page sideways. minmax(0,...) lets them shrink, which is what fr was for. */
.cal .grid{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:2px}
.cal .dow{font-size:9px;letter-spacing:.12em;text-transform:uppercase;color:var(--muted);
  text-align:center;padding:2px 0 5px}
.cal .d{position:relative;aspect-ratio:1;display:flex;align-items:center;
  justify-content:center;font-size:12.5px;border:1px solid transparent;background:none;
  color:var(--ink);cursor:pointer;font-family:"Jost",sans-serif;padding:0}
.cal .d:hover:not(:disabled){border-color:var(--ink)}
.cal .d.pad{visibility:hidden;cursor:default}
.cal .d:disabled{cursor:default;color:var(--muted)}
/* A TAKEN NIGHT IS STRUCK, NOT MERELY GREYED. Grey alone reads as "another month", and
   colour alone fails for the roughly one man in twelve who cannot separate these two. */
.cal .d.gone::after{content:"";position:absolute;left:16%;right:16%;top:50%;height:1px;
  background:var(--muted)}
.cal .d.past{color:#cfc8be}
.cal .d.pick{background:var(--ink);color:#fff;border-color:var(--ink)}
.cal .d.tween{background:rgba(138,106,65,.14)}
.cal .say{margin:14px 0 0;font-size:12.5px;color:var(--ink2);min-height:1.4em}
.cal .say.warn{color:#8c3b2e}
.cal .key{margin:10px 0 0;font-size:11px;color:var(--muted)}
.cal .key i{display:inline-block;width:11px;height:11px;border:1px solid var(--rule);
  margin-right:6px;vertical-align:-1px;position:relative}
.cal .key i::after{content:"";position:absolute;left:1px;right:1px;top:50%;height:1px;
  background:var(--muted)}
@media(max-width:700px){
  .cal{left:auto;right:auto;width:calc(100vw - 2*var(--pad))}
  .cal .months{grid-template-columns:1fr;gap:18px}
}

/* ---------------------------------------------------------------- the calendar as a page
   On the booking page the calendar is not a popover: it is step one, always open, so that
   choosing a stay is two clicks and the nights are on screen for both of them. Only the
   furniture changes; every rule above still applies. */
.cal.inline{position:static;width:auto;box-shadow:none;border:1px solid var(--rule);
  padding:clamp(16px,2.4vw,24px)}
.cal.inline .months{gap:clamp(18px,3vw,34px)}
.cal.inline .d{font-size:14px}
.cal.inline .say{font-size:14px;color:var(--ink);margin-top:16px}
@media(max-width:700px){
  .cal.inline{width:auto}
}
