/* Open Library Theme — 2026-08-29 v58
 * Advanced Search alignment fix.
 * html_select_date_a11y emits label/select siblings, so place them explicitly
 * into 3 columns: Year, Month, Day.
 */
:root{
  --ol58-red:#dc2636;
  --ol58-line:#dfe4eb;
  --ol58-ink:#172133;
  --ol58-muted:#667085;
}

/* Slightly tighter, balanced cards */
html body .openlib_search_advanced__grid{
  grid-template-columns:minmax(230px,.95fr) minmax(310px,1.05fr) minmax(310px,1.05fr)!important;
  gap:14px!important;
  padding:16px!important;
  align-items:stretch!important;
}
html body .openlib_search_advanced__field,
html body .openlib_search_advanced__dates>.from,
html body .openlib_search_advanced__dates>.to{
  min-height:138px!important;
  padding:14px!important;
  border-color:var(--ol58-line)!important;
  border-radius:12px!important;
}

/* Author field */
html body .openlib_search_advanced__field>label{
  margin:0 0 9px!important;
  font-size:12px!important;
  font-weight:800!important;
  line-height:1.25!important;
}
html body .openlib_search_advanced__field>input{
  height:42px!important;
  min-height:42px!important;
}

/* Date fieldsets: title, then labels in one row, controls in one row */
html body .openlib_search_advanced__dates>.from fieldset,
html body .openlib_search_advanced__dates>.to fieldset{
  display:grid!important;
  grid-template-columns:repeat(3,minmax(0,1fr))!important;
  grid-template-rows:auto auto 42px!important;
  column-gap:10px!important;
  row-gap:6px!important;
  align-items:end!important;
  width:100%!important;
  margin:0!important;
  padding:0!important;
  border:0!important;
}
html body .openlib_search_advanced__dates>.from legend,
html body .openlib_search_advanced__dates>.to legend{
  grid-column:1/-1!important;
  grid-row:1!important;
  margin:0 0 4px!important;
  padding:0!important;
  font-size:12px!important;
  font-weight:800!important;
  line-height:1.25!important;
}

/* html_select_date_a11y outputs 3 label siblings followed/interleaved with 3 selects.
 * nth-of-type counts labels/selects independently, so this stays stable. */
html body .openlib_search_advanced__dates fieldset>label{
  display:block!important;
  align-self:end!important;
  width:100%!important;
  min-width:0!important;
  margin:0!important;
  padding:0!important;
  color:var(--ol58-muted)!important;
  font-size:10.5px!important;
  font-weight:600!important;
  line-height:1.2!important;
}
html body .openlib_search_advanced__dates fieldset>label:nth-of-type(1){grid-column:1!important;grid-row:2!important;}
html body .openlib_search_advanced__dates fieldset>label:nth-of-type(2){grid-column:2!important;grid-row:2!important;}
html body .openlib_search_advanced__dates fieldset>label:nth-of-type(3){grid-column:3!important;grid-row:2!important;}

html body .openlib_search_advanced__dates fieldset>select{
  box-sizing:border-box!important;
  display:block!important;
  width:100%!important;
  min-width:0!important;
  height:42px!important;
  min-height:42px!important;
  margin:0!important;
  padding:0 30px 0 10px!important;
  border:1px solid #d6dbe3!important;
  border-radius:9px!important;
  background-color:#fff!important;
  color:var(--ol58-ink)!important;
  font-size:12px!important;
}
html body .openlib_search_advanced__dates fieldset>select:nth-of-type(1){grid-column:1!important;grid-row:3!important;}
html body .openlib_search_advanced__dates fieldset>select:nth-of-type(2){grid-column:2!important;grid-row:3!important;}
html body .openlib_search_advanced__dates fieldset>select:nth-of-type(3){grid-column:3!important;grid-row:3!important;}

/* Dark mode */
html[data-openlib-color-mode="dark"] body .openlib_search_advanced__dates fieldset>label{
  color:#aeb7c4!important;
}
html[data-openlib-color-mode="dark"] body .openlib_search_advanced__dates fieldset>select{
  border-color:#3b4654!important;
  background:#121822!important;
  color:#f2f4f7!important;
}

/* Responsive */
@media(max-width:1100px){
  html body .openlib_search_advanced__grid{
    grid-template-columns:1fr 1fr!important;
  }
  html body .openlib_search_advanced__field{
    grid-column:1/-1!important;
    min-height:0!important;
  }
}
@media(max-width:767px){
  html body .openlib_search_advanced__grid{
    grid-template-columns:1fr!important;
    gap:11px!important;
    padding:12px!important;
  }
  html body .openlib_search_advanced__field{
    grid-column:auto!important;
  }
  html body .openlib_search_advanced__dates>.from fieldset,
  html body .openlib_search_advanced__dates>.to fieldset{
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
  }
}
@media(max-width:520px){
  html body .openlib_search_advanced__dates>.from fieldset,
  html body .openlib_search_advanced__dates>.to fieldset{
    grid-template-columns:1fr!important;
    grid-template-rows:auto!important;
    row-gap:6px!important;
  }
  html body .openlib_search_advanced__dates fieldset>legend{
    grid-column:1!important;
    grid-row:auto!important;
  }
  html body .openlib_search_advanced__dates fieldset>label,
  html body .openlib_search_advanced__dates fieldset>select{
    grid-column:1!important;
    grid-row:auto!important;
  }
}
