/*
 * The Sidebar: parts/sidebar.html renders `ristovolanen/sidebar` (mu-plugins/ristovolanen/sidebar.php)
 * inside aside.rv-sidebar, whose width and the desktop/mobile switch live in shell.css.
 * Each section is `section.rv-sidebar__section` with an h2 `.rv-sidebar__heading`; the Arkisto is
 * a nested year/month list of <details>. Mobile values first, one breakpoint at 782px (shell.css).
 */

.rv-sidebar {
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.rv-sidebar__section {
  min-width: 0;
}

/* Section heading: small caps-style label over a 3px rule. */
.rv-sidebar__heading {
  margin: 0 0 4px;
  padding-top: 12px;
  border-top: 3px solid var(--wp--preset--color--primary);
  font-family: var(--wp--preset--font-family--roboto);
  font-size: 15px;
  line-height: normal;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--wp--preset--color--primary);
}

.rv-sidebar__list,
.rv-arkisto,
.rv-arkisto__months {
  list-style: none;
  margin: 0;
  padding: 0;
}

.rv-sidebar__link {
  display: flex;
  align-items: center;
  min-height: 44px;
  font-size: 17px;
  line-height: normal;
}

/* ---- Kirjat ---- */

.rv-sidebar__section--kirjat .rv-sidebar__heading {
  margin-bottom: 16px;
}

.rv-sidebar-kirjat {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 16px;
  align-items: start;
}

.rv-sidebar-kirja {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.rv-sidebar-kirja__cover-wrap {
  height: 200px;
  box-sizing: border-box;
  background: var(--wp--preset--color--surface);
  border: 1px solid var(--wp--preset--color--surface-border);
  overflow: hidden;
}

.rv-sidebar-kirja__cover {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.rv-sidebar-kirja__name {
  font-size: 16px;
  line-height: 21px;
}

.rv-sidebar-kirja__order,
.rv-sidebar__more {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 17px;
  font-weight: 600;
}

.rv-sidebar__more {
  margin-top: 10px;
  font-size: 16px;
}

/* ---- Keskustelun seuranta ---- */

.rv-sidebar__list--keskustelut {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rv-sidebar__link--title {
  font-weight: 600;
}

.rv-sidebar__source {
  font-size: 15px;
  line-height: 1.4;
  color: var(--wp--preset--color--muted);
  overflow-wrap: anywhere;
}

/* ---- Arkisto ---- */

.rv-arkisto {
  font-size: 17px;
}

.rv-arkisto__summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  cursor: pointer;
  font-weight: 600;
  color: var(--wp--preset--color--primary);
  text-decoration: underline;
  list-style: none;
}

.rv-arkisto__summary::-webkit-details-marker {
  display: none;
}

/* The chevron: ▸ closed, ▾ open. Decorative, so its alternative text is empty. */
.rv-arkisto__summary::before {
  content: '▸' / '';
  display: inline-block;
  width: 1ch;
}

.rv-arkisto__year[open] > .rv-arkisto__summary::before {
  content: '▾' / '';
}

.rv-arkisto__summary:hover {
  color: var(--wp--preset--color--link-hover);
}

.rv-arkisto__summary:focus-visible {
  outline: 3px solid var(--wp--preset--color--primary);
  outline-offset: 2px;
}

.rv-arkisto__months {
  padding-left: 20px;
}

.rv-arkisto__month {
  display: flex;
  align-items: center;
  min-height: 44px;
}

@media (min-width: 782px) {
  .rv-sidebar {
    gap: 36px;
  }

  .rv-sidebar__heading {
    margin-bottom: 12px;
  }

  .rv-sidebar__section--kirjat .rv-sidebar__heading {
    margin-bottom: 16px;
  }

  /* Links keep the 44px hit area on desktop too (spec: every control >= 44x44), unlike the mockup's 6px padding. */

  .rv-sidebar-kirjat {
    grid-template-columns: repeat(2, 148px);
    column-gap: 24px;
  }

  .rv-sidebar-kirja__cover-wrap {
    height: 210px;
  }

  .rv-sidebar__list--keskustelut {
    gap: 14px;
  }

  .rv-sidebar__more {
    margin-top: 4px;
  }
}
