/* Hand-written overrides, loaded after the Webflow stylesheet.
   Applied to every page by ../apply_tweaks.py */

/* ---------- Books / Music switch (all screen sizes) ---------- */
.div-block-4,
.div-block-5 {
  flex-direction: column;
  align-items: center;
}

.shortcut { display: none !important; } /* old icon-only link */

.yf-switch {
  display: inline-flex;
  margin: 4px auto 14px;
  padding: 4px;
  border: 2px solid #1c1a17;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  font-family: Bitter, serif;
}

.yf-switch__opt {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 22px;
  border-radius: 999px;
  color: #1c1a17;
  font-size: 17px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  transition: background-color 0.15s, color 0.15s;
}

.yf-switch__opt svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  flex: none;
}

.yf-switch__opt:hover { background: rgba(28, 26, 23, 0.12); }

.yf-switch__opt.is-active,
.yf-switch__opt.is-active:hover {
  background: #1c1a17;
  color: #fff;
}

.yf-switch__opt:focus-visible {
  outline: 3px solid #d0a004;
  outline-offset: 2px;
}

/* dark (music) page */
.body.music .yf-switch {
  border-color: #fff;
  background: rgba(255, 255, 255, 0.08);
  font-family: "Geomanist webfont", sans-serif;
}
.body.music .yf-switch__opt { color: #fff; font-weight: 400; }
.body.music .yf-switch__opt:hover { background: rgba(255, 255, 255, 0.18); }
.body.music .yf-switch__opt.is-active,
.body.music .yf-switch__opt.is-active:hover {
  background: #fff;
  color: #14222b;
}

/* ---------- Album rows were wider than the window on laptops ---------- */
.tabs > .w-tab-content {
  align-self: stretch;
  min-width: 0;
}

/* ---------- Tablet & phone: un-fix the header so nothing overlaps ---------- */
@media screen and (max-width: 991px) {
  .section.books,
  .section-5 {
    position: static;
    background-image: none;
  }

  .div-block-7 {
    position: static;
    width: 100%;
    padding: 14px 16px 0;
    gap: 8px;
  }

  .button {
    position: static;
    display: inline-block;
    width: auto;
    max-width: 100%;
    margin: 0;
    padding: 8px 20px;
    font-size: 16px;
  }

  .link-2 {
    position: static;
    margin: 0;
    padding: 6px 0; /* bigger tap target */
  }

  .heading {
    margin: 10px 0 8px;
    padding: 0 16px;
    line-height: 1.15;
  }

  /* year tabs: wrap onto rows instead of running off both edges */
  .tabs > * { align-self: stretch; }

  .tabs-menu,
  .tabs-menu.books {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    width: auto;
    padding: 0 8px;
    font-size: 16px;
    line-height: 20px;
  }

  .tab-link-2020,
  .tab-link-2020.book-tab-year,
  .tab-link-2020.music-tab-year {
    flex: 0 0 auto;
    margin: 0 0 6px;
    padding: 10px 13px;
    border-bottom: 3px solid transparent;
  }

  .tab-link-2020.w--current { margin: 0 0 6px; }
  .tab-link-2020.book-tab-year.w--current { border-bottom-color: #876247; }
  .tab-link-2020.music-tab-year.w--current { border-bottom-color: #37b954; }
  .tab-link-2020.w--current > div { font-weight: 700; }

  .w-tab-content { padding-top: 10px; }

  .text-block-5 {
    padding: 0 16px 24px;
    text-align: center;
  }
}

/* ---------- Phone ---------- */
@media screen and (max-width: 767px) {
  .book-title,
  .bold-text-2,
  .heading .everyone {
    font-size: 30px;
    padding-top: 0;
  }

  /* books: two even columns of covers */
  ._10-books {
    width: 100%;
    max-height: none;
    padding: 0 12px;
    gap: 12px;
    align-items: flex-start;
  }

  .book-covers,
  .book-covers._3-books {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    max-height: none;
    margin: 0;
  }

  .div-block-3,
  .div-block-3._6-titles,
  .div-block-3.three-books {
    width: 100%;
    margin: 0;
    padding-bottom: 14px;
  }

  .book-cover {
    width: 100%;
    max-width: 100%;
    height: auto;
  }
}

/* ---------- Tablet & phone: albums ---------- */
@media screen and (max-width: 991px) {
  /* music: two columns of albums instead of one long strip */
  ._10-albums {
    flex-direction: row;
    align-items: flex-start;
    width: 100%;
    max-width: 720px;
    margin: 6px auto 0;
    padding: 0 12px;
    gap: 12px;
  }

  ._5-albums {
    flex: 1 1 0;
    flex-direction: column;
    min-width: 0;
    max-width: none;
    margin: 0;
  }

  ._5-albums .div-block,
  ._5-albums .div-block.music,
  ._5-albums .div-block.music.four-albums {
    width: 100%;
    max-width: none;
    margin: 0 0 4px;
  }

  ._5-albums .div-block > a { display: block; width: 100%; }

  ._5-albums img,
  ._5-albums img.album {
    display: block;
    width: 100%;
    height: auto;
    max-height: none;
  }

  ._5-albums .text-block,
  ._5-albums .text-block.music-label {
    margin: 6px 0 10px;
    font-size: 14px;
    line-height: 1.35;
  }
}

/* =====================================================================
   Data-driven pages (api/_lib/render.js)
   ===================================================================== */

/* rows with fewer than five items: keep the five-across spacing, centered */
.book-covers.yf-short { justify-content: center; gap: 3.75%; }
.book-titles.yf-short { justify-content: center; gap: 0; }
.book-titles.yf-short .div-block.book { flex: 0 0 20.4%; max-width: 20.4%; margin: 0; }
._5-albums.yf-short { justify-content: center; }

/* covers pulled from search services come in mixed sizes */
.book-cover { width: auto; max-width: 100%; }
._5-albums img.album { aspect-ratio: 1 / 1; object-fit: cover; width: 100%; }

.yf-message {
  max-width: 560px;
  margin: 40px auto;
  padding: 0 20px;
  font-family: Bitter, serif;
  font-size: 18px;
  line-height: 1.5;
  text-align: center;
  color: #1c1a17;
}
.yf-message a { color: #6b4a2f; }

/* phones and tablets: one two-column grid in rank order, whatever the row sizes */
@media screen and (max-width: 991px) {
  ._10-albums {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 12px;
  }
  ._5-albums,
  ._5-albums.yf-short { display: contents; }
}

@media screen and (max-width: 767px) {
  ._10-books {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 12px;
    align-items: end;
  }
  .book-covers,
  .book-covers.yf-short,
  .book-covers._3-books,
  ._5-books { display: contents; }
  .div-block-3 { padding-bottom: 0; }
}

/* =====================================================================
   Submit form (submit.html)
   ===================================================================== */
.yf-submit-page { min-height: 100vh; }

.yf-form {
  max-width: 620px;
  margin: 0 auto;
  padding: 20px 16px 64px;
  font-family: Bitter, serif;
  color: #1c1a17;
}

.yf-back { display: inline-block; padding: 8px 0; color: #6b4a2f; font-size: 15px; }
.yf-form__title { margin: 8px 0 6px; font-family: Bitter, serif; font-size: 34px; line-height: 1.15; font-weight: 700; }
.yf-form__lede { margin: 0 0 24px; font-size: 17px; line-height: 1.5; }

.yf-row { display: flex; gap: 12px; }
.yf-field { display: block; margin: 0 0 22px; flex: 1 1 auto; min-width: 0; }
.yf-field--year { flex: 0 0 110px; }
.yf-label { display: block; margin-bottom: 6px; font-size: 15px; font-weight: 700; }
.yf-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.yf-form input[type="text"],
.yf-form input[type="search"],
.yf-form select {
  width: 100%;
  height: 48px;
  margin: 0;
  padding: 0 14px;
  border: 2px solid #1c1a17;
  border-radius: 10px;
  background: #fff;
  color: #1c1a17;
  font-family: inherit;
  font-size: 17px;
  -webkit-appearance: none;
  appearance: none;
}
.yf-form select {
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%231c1a17' stroke-width='2'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px 8px;
}
.yf-form input:focus-visible,
.yf-form select:focus-visible,
.yf-btn:focus-visible,
.yf-result:focus-visible,
.yf-icon:focus-visible { outline: 3px solid #d0a004; outline-offset: 2px; }

.yf-form .yf-switch { margin: 0; }
.yf-form .yf-switch__opt { border: 0; background: transparent; cursor: pointer; font-family: inherit; }
.yf-form .yf-switch__opt.is-active { background: #1c1a17; color: #fff; }

.yf-search { display: flex; gap: 8px; }
.yf-search input { flex: 1 1 auto; min-width: 0; }

.yf-btn {
  height: 48px;
  padding: 0 20px;
  border: 2px solid #1c1a17;
  border-radius: 10px;
  font-family: inherit;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
}
.yf-btn--ghost { background: #fff; color: #1c1a17; }
.yf-btn--ghost:hover { background: #f1ece4; }
.yf-btn--primary { width: 100%; height: 54px; background: #d0a004; color: #fff; border-width: 3px; box-shadow: 1px 1px 3px #000; text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35); }
.yf-btn--primary:hover:not(:disabled) { background: #b88d03; }
.yf-btn:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }

.yf-status { min-height: 22px; margin: 8px 0 0; font-size: 15px; }
.yf-results, .yf-picks { margin: 0; padding: 0; list-style: none; }
.yf-results li + li { margin-top: 6px; }

.yf-result {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px 12px 8px 8px;
  border: 1px solid rgba(28, 26, 23, 0.25);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.85);
  color: #1c1a17;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}
.yf-result:hover:not(:disabled) { background: #fff; border-color: #1c1a17; }
.yf-result:disabled { cursor: default; opacity: 0.6; }
.yf-result__cover, .yf-pick__cover { flex: none; width: 44px; height: 62px; object-fit: cover; border-radius: 3px; background: #e6e0d6; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); }
#yf-form[data-kind="music"] .yf-result__cover, #yf-form[data-kind="music"] .yf-pick__cover { height: 44px; }
.yf-result__text, .yf-pick__text { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; font-size: 15px; line-height: 1.35; }
.yf-result__text strong, .yf-pick__text strong { font-size: 16px; overflow-wrap: anywhere; }
.yf-result__add { flex: none; padding: 6px 12px; border-radius: 999px; background: #1c1a17; color: #fff; font-size: 14px; font-weight: 700; }
.yf-result:disabled .yf-result__add { background: transparent; color: #1c1a17; }

.yf-picks__head { display: flex; justify-content: space-between; align-items: baseline; }
.yf-count { font-size: 15px; font-variant-numeric: tabular-nums; }
.yf-empty { margin: 0; padding: 18px; border: 2px dashed rgba(28, 26, 23, 0.35); border-radius: 10px; font-size: 16px; text-align: center; }
.yf-pick { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; background: rgba(255, 255, 255, 0.85); border: 1px solid rgba(28, 26, 23, 0.25); }
.yf-pick + .yf-pick { margin-top: 6px; }
.yf-pick__rank { flex: none; width: 22px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.yf-pick__actions { display: flex; flex: none; gap: 4px; }
.yf-icon { width: 40px; height: 40px; border: 1px solid rgba(28, 26, 23, 0.35); border-radius: 8px; background: #fff; color: #1c1a17; font-size: 18px; line-height: 1; cursor: pointer; }
.yf-icon:hover:not(:disabled) { border-color: #1c1a17; }
.yf-icon:disabled { opacity: 0.3; cursor: default; }
.yf-icon--remove { font-size: 22px; }

.yf-error { margin: 0 0 14px; padding: 12px 14px; border: 2px solid #a12a1a; border-radius: 10px; background: #fff3f0; color: #7a1d10; font-size: 16px; }

@media screen and (max-width: 479px) {
  .yf-form__title { font-size: 28px; }
  .yf-icon { width: 36px; height: 40px; }
  .yf-pick__cover { width: 36px; height: 52px; }
}
