/* konta.md/calendar. Only the calendar page links this file; the tokens are site.css's. */

.cal-months {
  border-top: 0;
}

.cal-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Sentences run on across the width of the page; no last line left with a single word. */
.cal-page p {
  text-wrap: pretty;
}

.cal-page .band__head {
  margin-bottom: 1rem;
}

/* --------------------------------------------------------------------- toolbar */

.cal-view {
  display: inline-flex;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}

.cal-view[hidden] {
  display: none;
}

.cal-view__btn {
  font: inherit;
  font-size: 0.88rem;
  min-height: 38px;
  padding: 0.3rem 0.9rem;
  border: 0;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
}

.cal-view__btn + .cal-view__btn {
  border-left: 1px solid var(--rule-strong);
}

.cal-view__btn[aria-pressed='true'] {
  background: var(--accent);
  color: var(--bg);
  font-weight: 600;
}

.cal-months {
  padding-top: 0.75rem;
}

.cal-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1.25rem;
}

.cal-bar__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.5rem;
  margin-left: auto;
}

.cal-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 40px;
  padding: 0.35rem 0.7rem;
  font: inherit;
  font-size: 0.88rem;
  line-height: 1.2;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  text-decoration: none;
  cursor: pointer;
}

.cal-btn:hover {
  border-color: var(--accent);
  color: var(--ink);
}

.cal-btn:disabled {
  opacity: 0.45;
  cursor: default;
  border-color: var(--rule-strong);
}

.cal-btn[hidden] {
  display: none;
}

.cal-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cal-nav[hidden] {
  display: none;
}

.cal-nav__step {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--rule-strong);
  background: var(--surface);
  color: var(--ink);
  font: 600 1.35rem/1 var(--sans);
  cursor: pointer;
  padding: 0 0 0.12rem;
}

.cal-nav__step:hover:not(:disabled) {
  border-color: var(--accent);
}

.cal-nav__step:disabled {
  opacity: 0.35;
  cursor: default;
}

.cal-nav__title {
  margin: 0 0.25rem;
  min-width: 8.6em;
  text-align: center;
  font: 600 clamp(1.25rem, 1.05rem + 0.6vw, 1.5rem) / 1.2 var(--serif);
}

.cal-nav__title::first-letter {
  text-transform: uppercase;
}

/* The filter: a small menu, not a wall of choices. */
.cal-filter {
  position: relative;
}

.cal-filter > summary {
  list-style: none;
}

.cal-filter > summary::-webkit-details-marker {
  display: none;
}

.cal-filter > summary::after {
  content: '';
  width: 0.45em;
  height: 0.45em;
  margin-left: 0.15rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-0.15em) rotate(45deg);
}

.cal-filter[open] > summary::after {
  transform: translateY(0.1em) rotate(-135deg);
}

.cal-filter > summary strong {
  font-weight: 600;
  color: var(--accent);
}

.cal-filter__panel {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  width: min(30rem, calc(100vw - 2rem));
  padding: 0.9rem 1rem 0.6rem;
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: 10px;
  box-shadow: 0 10px 30px var(--shade);
}

.cal-filter fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.cal-chips {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
  gap: 0.15rem 0.75rem;
}

.cal-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 36px;
  font-size: 0.88rem;
  line-height: 1.25;
  cursor: pointer;
}

.cal-chip input {
  accent-color: var(--accent);
  width: 1rem;
  height: 1rem;
  margin: 0;
  flex: none;
}

.cal-filter__state {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--rule);
  color: var(--ink-2);
  font-size: 0.85rem;
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.cal-reset {
  font: inherit;
  color: var(--accent);
  background: none;
  border: 0;
  padding: 0.35rem 0;
  text-decoration: underline;
  cursor: pointer;
}

/* --------------------------------------------------------------------- months */

.cal-month {
  padding-block: 0.5rem 2.5rem;
  scroll-margin-top: 1rem;
}

.cal-month + .cal-month {
  border-top: 1px solid var(--rule);
  padding-top: 2rem;
}

.cal-month[hidden] {
  display: none;
}

.cal-js .cal-month + .cal-month {
  border-top: 0;
  padding-top: 0.5rem;
}

.cal-month__head {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.cal-month__head h2::first-letter {
  text-transform: uppercase;
}

/* With the month named in the navigation, its heading stays for the outline only. */
.cal-js .cal-month__head h2 {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.cal-js .cal-month__head {
  margin-bottom: 0;
}

.cal-now {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--gold);
}

.cal-js .cal-now {
  display: none;
}

/* The month as the page's centre: a full-width grid of days, each with what falls on it. */
.cal-grid {
  width: 100%;
  border-collapse: separate;
  border-spacing: 4px;
  table-layout: fixed;
  font-variant-numeric: tabular-nums;
  margin: 0 -4px;
  width: calc(100% + 8px);
}

.cal-grid caption {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.cal-grid th {
  font-weight: 600;
  color: var(--ink-3);
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 0.25rem 0.5rem;
  text-align: left;
}

.cal-grid abbr {
  text-decoration: none;
}

.cal-wd-long {
  display: none;
}

.cal-grid td {
  position: relative;
  vertical-align: top;
  height: 7.25rem;
  padding: 0.4rem 0.45rem 0.45rem;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--rule);
  overflow: hidden;
}

.cal-grid td:empty {
  background: transparent;
  border-color: transparent;
}

.cal-day__n {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.9rem;
  height: 1.9rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink);
  text-decoration: none;
}

a.cal-day__n:hover {
  background: var(--sunken);
}

.cal-day--off {
  background: color-mix(in srgb, var(--down) 6%, var(--surface)) !important;
}

.cal-day--off .cal-day__n {
  color: var(--down);
}

.cal-day--worked {
  border-style: dashed !important;
}

.cal-day--today {
  border: 2px solid var(--accent) !important;
}

.cal-day--today .cal-day__n {
  background: var(--accent);
  color: var(--bg);
}

.cal-labels {
  list-style: none;
  margin: 0.2rem 0 0;
  padding: 0;
  display: grid;
  gap: 2px;
}

.cal-label {
  font-size: 0.72rem;
  line-height: 1.35;
  padding: 0.05rem 0.35rem;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: var(--sunken);
  color: var(--ink);
  border-left: 2px solid var(--gold-rule);
}

.cal-label[hidden],
.cal-label--over {
  display: none;
}

.cal-label--deadline {
  font-weight: 600;
}

.cal-label--off {
  border-left-color: var(--down);
  color: var(--down);
  background: transparent;
  padding-left: 0.3rem;
}

.cal-label--law {
  border-left-color: var(--accent);
  color: var(--accent);
}

.cal-label--worked {
  border-left-color: var(--rule-strong);
}

.cal-label--local {
  border-left-color: var(--down);
  color: var(--ink-2);
  background: transparent;
  font-style: italic;
}

.cal-day--local {
  background-image: repeating-linear-gradient(135deg, transparent 0 7px, color-mix(in srgb, var(--down) 7%, transparent) 7px 8px);
}

.cal-label--more {
  background: transparent;
  border-left-color: transparent;
  color: var(--ink-2);
}

.cal-dot {
  display: none;
}

.cal-note {
  margin-top: 0.75rem;
  font-size: 0.88rem;
  color: var(--ink-2);
}

.cal-empty {
  color: var(--ink-2);
}

/* Under the grid, the month in full: every date with its acts. As a calendar the day panel says
   it instead; as a list, it is all there is. */
.cal-month__list {
  margin-top: 2rem;
}

.cal-js .cal-month__list {
  display: none;
}

/* Under the calendar: the day picked in it, or the whole month. */
.cal-stage__months {
  min-width: 0;
}

.cal-panel {
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  scroll-margin-top: 1rem;
}

.cal-panel[hidden] {
  display: none;
}

.cal-panel__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.cal-panel__controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.cal-panel__title {
  font-family: var(--serif);
  font-size: 1.35rem;
}

.cal-panel__title::first-letter {
  text-transform: uppercase;
}

.cal-panel__empty {
  color: var(--ink-2);
}

.cal-panel__empty[hidden] {
  display: none;
}

.cal-panel .cal-dates {
  gap: 1.25rem;
}

.cal-panel .cal-date {
  list-style: none;
}

/* As a grid: cards side by side. As a list: one under the other, the width of the page. */
.cal-panel .cal-items {
  grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr));
  align-items: start;
}

.cal-panel--list .cal-items {
  grid-template-columns: minmax(0, 1fr);
}

.cal-item--focus {
  box-shadow: 0 0 0 2px var(--accent);
}

.cal-js .cal-grid td.cal-day {
  cursor: pointer;
}

.cal-js .cal-grid td.cal-day:hover {
  border-color: var(--accent);
}

.cal-day--selected {
  box-shadow: inset 0 0 0 2px var(--gold-rule);
}

.cal-label {
  cursor: pointer;
}

/* A phone has no room for labels: the day, a dot when something is due, and the list below. */
@media (max-width: 760px) {
  .cal-grid {
    border-spacing: 2px;
    margin: 0 -2px;
    width: calc(100% + 4px);
  }

  .cal-grid th {
    text-align: center;
    padding: 0.2rem 0;
    letter-spacing: 0;
  }

  .cal-grid td {
    height: 2.9rem;
    padding: 0.2rem 0;
    text-align: center;
    border-color: transparent;
    background: transparent;
  }

  .cal-labels {
    display: none;
  }

  .cal-dot {
    display: block;
    position: absolute;
    left: 50%;
    bottom: 0.3rem;
    width: 5px;
    height: 5px;
    margin-left: -2.5px;
    border-radius: 50%;
    background: var(--gold);
  }

  .cal-dot[hidden] {
    display: none;
  }

  .cal-nav__title {
    min-width: 0;
    flex: 1;
    font-size: 1.25rem;
    margin: 0;
  }

  .cal-nav {
    width: 100%;
    gap: 0.35rem;
  }

  .cal-nav__step {
    width: 36px;
    height: 36px;
  }

  .cal-bar {
    gap: 0.6rem;
    margin-bottom: 0.75rem;
  }

  .cal-bar__actions {
    gap: 0.35rem;
  }

  .cal-btn {
    min-height: 34px;
    padding: 0.25rem 0.6rem;
    font-size: 0.82rem;
  }

  .cal-filter {
    position: static;
  }

  .cal-bar__actions {
    position: relative;
  }
}

@media (min-width: 1100px) {
  .cal-wd-short {
    display: none;
  }

  .cal-wd-long {
    display: inline;
  }
}

/* The month's dates, as a list. */
.cal-dates {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1.5rem;
}

.cal-date {
  scroll-margin-top: 1rem;
}

.cal-date[hidden] {
  display: none;
}

.cal-date > h3 {
  font-family: var(--serif);
  font-size: 1.15rem;
  margin-bottom: 0.6rem;
}

.cal-wd {
  font-family: var(--sans);
  font-weight: 400;
  font-size: 0.95rem;
  color: var(--ink-3);
  margin-left: 0.35rem;
}

.cal-date:target > h3 {
  color: var(--accent);
}

.cal-items {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.6rem;
}

.cal-item {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--gold-rule);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  display: grid;
  gap: 0.3rem;
}

.cal-item[hidden] {
  display: none;
}

.cal-item h4 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
  overflow-wrap: break-word;
}

.cal-item p {
  font-size: 0.92rem;
  line-height: 1.5;
}

.cal-form {
  display: inline-block;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  padding: 0.05rem 0.45rem;
  margin-right: 0.2rem;
  border-radius: 4px;
  background: var(--sunken);
  border: 1px solid var(--rule);
  color: var(--ink);
  vertical-align: 0.08em;
}

.cal-meta {
  color: var(--ink-2);
}

.cal-meta::first-letter {
  text-transform: uppercase;
}

.cal-who {
  color: var(--ink);
}

.cal-moved {
  color: var(--ink-2);
  font-style: italic;
}

.cal-act {
  color: var(--ink-2);
}

.cal-moved--day {
  font-size: 0.92rem;
  margin: -0.3rem 0 0.6rem;
}

.cal-act a,
.cal-moved a,
.cal-changes a {
  overflow-wrap: anywhere;
}

.cal-state {
  white-space: nowrap;
  color: var(--gold);
  font-weight: 500;
}

.cal-kind {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
}

.cal-item--off {
  border-left-color: var(--down);
  background: color-mix(in srgb, var(--down) 4%, var(--surface));
}

.cal-item--worked {
  border-left-color: var(--rule-strong);
}

.cal-item--law {
  border-left-color: var(--accent);
}

.cal-item--local {
  border-left-color: var(--down);
  border-left-style: dashed;
}

/* --------------------------------------------------------------------- changes */

.cal-scroll {
  overflow-x: auto;
  margin-top: 1.5rem;
  -webkit-overflow-scrolling: touch;
}

.cal-changes {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  min-width: 38rem;
}

.cal-changes th {
  text-align: left;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 0.5rem 0.75rem 0.5rem 0;
  border-bottom: 1px solid var(--rule-strong);
}

.cal-changes td {
  vertical-align: top;
  padding: 0.85rem 0.75rem 0.85rem 0;
  border-bottom: 1px solid var(--rule);
}

.cal-changes td:first-child {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.cal-changes td p {
  margin-top: 0.3rem;
  color: var(--ink-2);
  font-size: 0.9rem;
}

.cal-changes tr:target td {
  background: var(--sunken);
}

.cal-values {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.cal-pending {
  margin-top: 2rem;
}

.cal-pending h3 {
  margin-bottom: 0.4rem;
}

.cal-pending ul {
  margin: 0.6rem 0 0;
  padding-left: 1.2rem;
  color: var(--ink-2);
}

/* --------------------------------------------------------------------- feeds */

.cal-subscribe {
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 900px) {
  .cal-subscribe {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    column-gap: 3rem;
    align-items: start;
  }
}

.cal-subscribe h2 + p {
  margin-top: 0.75rem;
}

/* The card holds the menu (or, without script, the list) and the steps in each calendar app. */
/* Drawn like the contact form: its card and white fields (site.css, --form-*), Mauve on dark. */
.cal-feed-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  padding: 1.1rem 1.2rem 1.2rem;
  border-radius: 10px;
  background: var(--form-card);
}

.cal-pick {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.4rem;
}

.cal-pick[hidden] {
  display: none;
}

.cal-pick__label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-2);
}

.cal-pick__label + * {
  margin-bottom: 0.6rem;
}

.cal-pick__select,
.cal-pick__url {
  width: 100%;
  min-height: 44px;
  padding: 0.4rem 0.7rem;
  color: var(--ink);
  background: var(--form-field);
  border: 1px solid var(--form-field);
  border-radius: var(--radius);
}

.cal-pick__select {
  font: inherit;
  cursor: pointer;
}

.cal-pick__address {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.cal-pick__url {
  flex: 1 1 15rem;
  width: auto;
  min-width: 0;
  font-family: monospace;
  font-size: 0.88rem;
}

.cal-pick__copy {
  min-height: 44px;
}

.cal-pick__copy svg {
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
}

.cal-pick__status:empty {
  display: none;
}

.cal-pick__status {
  margin: 0;
  font-size: 0.88rem;
  color: var(--ok);
}

.cal-pick__open {
  justify-self: start;
}

.cal-howto {
  margin: 0;
  padding-left: 1.2rem;
  font-size: 0.9rem;
  color: var(--ink-2);
}

.cal-feeds {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.6rem;
}

.cal-feeds[hidden] {
  display: none;
}

.cal-feeds li {
  display: grid;
  gap: 0.1rem;
}

.cal-feeds a {
  font-weight: 600;
}

.cal-feeds code {
  font-size: 0.82rem;
  color: var(--ink-2);
  overflow-wrap: anywhere;
  user-select: all;
}

.cal-built code {
  font-size: 0.9em;
}

/* --------------------------------------------------------------------- print */

@media print {
  :root {
    --bg: #fff;
    --surface: #fff;
    --sunken: #f3f3f3;
    --ink: #000;
    --ink-2: #333;
    --ink-3: #555;
    --rule: #bbb;
    --rule-strong: #888;
    --accent: #000;
    --gold: #000;
    --gold-rule: #555;
    --down: #000;
  }

  body {
    font-size: 10.5pt;
    background: #fff;
    color: #000;
  }

  .masthead,
  .notice,
  .cal-bar,
  .foot,
  .skip,
  #abonare,
  .cal-now {
    display: none !important;
  }

  .band,
  .hero {
    padding-block: 0.5rem !important;
    background: #fff !important;
  }

  /* On paper the month's name comes back, since the navigation is not printed. */
  .cal-js .cal-month__head h2 {
    position: static;
    width: auto;
    height: auto;
    clip: auto;
    margin-bottom: 0.4rem;
  }

  .cal-month {
    padding-block: 0.5rem;
  }

  .cal-grid td {
    height: 5.2rem;
    break-inside: avoid;
  }

  .cal-label {
    font-size: 7pt;
  }

  .cal-month__list,
  .cal-js .cal-month__list {
    display: block !important;
    break-before: page;
  }

  .cal-panel,
  .cal-view {
    display: none !important;
  }

  .cal-item {
    break-inside: avoid;
    border-left-width: 2px;
    padding: 0.4rem 0.6rem;
  }

  .cal-date > h3 {
    break-after: avoid;
  }

  .cal-scroll {
    overflow: visible;
  }

  .cal-changes {
    min-width: 0;
  }

  a {
    color: #000;
    text-decoration: none;
  }

  /* An act on paper is useless without where to read it. */
  .cal-act a[href^='http']::after,
  .cal-changes a[href^='http']::after {
    content: ' (' attr(href) ')';
    font-size: 0.8em;
    overflow-wrap: anywhere;
  }
}
