/**
 * Styles for Fondu Dream Box (Сундучок Мечт).
 * Adapted from the legacy WordPress theme (twentyten/style.css).
 */

/* ─── Intro lead: text + sunduk image (legacy WP post content) ─────────── */

.dream-box-lead {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: flex-start;
  gap: 1rem 1.25rem;
  margin: 0 0 1.25rem;
}

.dream-box-lead__text {
  flex: 1 1 auto;
  min-width: 0;
  text-align: justify;
  padding: 1rem;
  margin-right: -50px;
  z-index: 1;
}

.dream-box-lead__text p {
  margin: 0 0 0.65rem;
}

.dream-box-lead__emphasis {
  color: #800000;
}

.dream-box-lead__list {
  margin: 0.35rem 0 0;
  padding-left: 1.35rem;
}

.dream-box-lead__list li {
  margin-bottom: 0.35rem;
}

.dream-box-lead__figure {
  flex: 0 0 auto;
  width: min(400px, 42%);
  max-width: 400px;
}

.dream-box-lead__figure img {
  display: block;
  width: 100%;
  height: auto;
  margin-left: -25px;
}

/* ─── Category navigation: grid (chest image + link per column) ─────────── */

.dream-box-visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.dream-box-category-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem 1rem;
  margin: 12px 0 16px;
  align-items: start;
}

.dream-box-category-grid__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-width: 0;
}

a.dream-box-category-filter {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 218px;
  margin: 0 auto;
  text-decoration: none;
  color: inherit;
}

a.dream-box-category-filter:hover .dream-box-cat-link,
a.dream-box-category-filter:focus-visible .dream-box-cat-link {
  text-decoration: underline;
}

a.dream-box-category-filter:focus-visible {
  outline: 2px solid #8b4513;
  outline-offset: 2px;
}

a.dream-box-category-filter.is-active .dream-box-cat-link {
  background: #fbf2b9;
}

/* Chest image links — legacy sm*.jpg sprites (dim right, bright left), cf. twentyten a.sund. */
.dream-box-chest {
  display: block;
  width: 100%;
  max-width: 218px;
  height: 184px;
  margin: 0 auto 8px;
  background-position: bottom right;
  background-repeat: no-repeat;
  background-size: auto;
  border: 0;
  box-sizing: border-box;
  /* Instant sprite swap; block inherited transitions on parent <a>. */
  transition: none;
}

a.dream-box-category-filter:hover .dream-box-chest,
a.dream-box-category-filter:focus-visible .dream-box-chest,
.dream-box-chest.is-active {
  background-position: bottom left;
  outline: none;
}

.dream-box-chest--maybe {
  background-image: url("../images/sm2.jpg");
}

.dream-box-chest--yes {
  background-image: url("../images/sm1.jpg");
}

.dream-box-chest--no {
  background-image: url("../images/sm3.jpg");
}

.dream-box-cat-link {
  display: inline-block;
  font-weight: bold;
  color: #5a3010;
  text-decoration: none;
  padding: 6px 4px 4px;
  max-width: 100%;
  border: 2px dotted #8b4513;
  width: 100%;
  max-width: 218px;
  box-sizing: border-box;
}

.dream-box-cat-link.is-active {
  background: #fbf2b9;
}

@media (max-width: 720px) {
  .dream-box-lead {
    flex-direction: column;
    gap: 1rem;
  }

  .dream-box-lead__text {
    margin-right: 0;
  }

  .dream-box-lead__figure {
    order: -1;
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
  }

  .dream-box-lead__figure img {
    margin-left: 0;
  }

  .dream-box-category-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
  }

  a.dream-box-category-filter {
    max-width: none;
  }

  .dream-box-chest {
    width: 100%;
    max-width: 110px;
    height: 93px;
    margin-bottom: 4px;
    /* Sprite is two chests side-by-side; scale both halves proportionally. */
    background-size: 200% auto;
  }

  .dream-box-cat-link {
    font-size: 0.72rem;
    line-height: 1.25;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px 2px;
    max-width: none;
  }

  #all_boxes {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .dream-box-category-grid {
    gap: 0.35rem;
  }

  .dream-box-chest {
    max-width: 88px;
    height: 74px;
    margin-bottom: 3px;
  }

  .dream-box-cat-link {
    font-size: 0.65rem;
    line-height: 1.2;
    min-height: 40px;
    padding: 3px 1px;
  }
}

/* ─── Category heading alignment ─────────────────────────────────────────── */

.wpsc_category_boundary {
  margin: 12px 0 8px;
  padding: 6px 0;
  font-size: 1.15rem;
  font-weight: bold;
  color: #5a3010;
  border-bottom: 2px dotted #8b4513;
}

.dream-box-heading--center {
  text-align: center;
}
.dream-box-heading--right {
  text-align: right;
}

/* ─── All boxes container ─────────────────────────────────────────────────── */

#all_boxes {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
}

/* ─── Item card ───────────────────────────────────────────────────────────── */

#all_boxes .card.dream-box-card {
  display: inline-block;
  vertical-align: top;
  border: 2px solid #d5be7b;
  min-height: 155px;
  height: auto;
  /* width: 350px; */
  margin: 0 5px 8px 5px;
  padding: 0;
  color: #000;
  background: transparent;
}

.card .imgh {
  display: inline-block;
  vertical-align: top;
  position: relative;
  width: 154px;
  min-height: 155px;
  margin: 0;
  padding: 0;
}

.card .imgh img.dream-box-thumb {
  border: 2px solid #fff;
  max-width: 150px;
  max-height: 150px;
  margin: 0;
  padding: 0;
  display: block;
}

.card .imgh .id {
  position: absolute;
  top: 0;
  right: 0;
  padding: 3px;
  font-size: 11px;
  font-weight: bold;
  color: #236b17;
  background: #fff9d9;
  border-radius: 10px;
  text-shadow: 0 0 10px #000;
  z-index: 1;
}

.card .imgh a.no_box {
  display: block;
  font-size: 10px;
  padding: 2px 4px;
  text-align: center;
  word-break: break-all;
}

.dream-box-no-image {
  display: block;
  padding: 5px;
  font-size: 11px;
  color: #999;
}

.card .oth {
  display: inline-block;
  vertical-align: top;
  width: 188px;
  padding: 4px 4px 4px 6px;
  position: relative;
  font-size: 12px;
  line-height: 1.4;
}

#all_boxes .oth h2 {
  background: none;
  position: static;
  width: 187px;
  font-size: 13px !important;
  font-weight: bold;
  font-style: italic;
  line-height: 1.3;
  margin: 0 0 4px 0;
  padding: 2px 0;
  color: #151e25;
}

.dream-box-artist {
  color: #444;
  font-style: italic;
}

.dream-box-description {
  margin: 4px 0;
  font-size: 11px;
  color: #555;
}

.dream-box-verdict {
  margin: 4px 0;
  font-size: 11px;
  color: #7b3b00;
}

.wozadded {
  font-size: 85%;
  color: #888;
}

.loader {
  color: #236b17;
  font-weight: bold;
}

/* ─── Order button ────────────────────────────────────────────────────────── */

.dream-box-order-wrap {
  margin-top: 6px;
}

a.dream-box-order-btn {
  display: inline-block;
  padding: 4px 10px;
  background: #8b4513;
  color: #fff;
  text-decoration: none;
  border-radius: 3px;
  font-size: 12px;
  font-weight: bold;
}

a.dream-box-order-btn:hover {
  background: #6b3010;
}

/* ─── Orders closed notice ────────────────────────────────────────────────── */

.dream-box-orders-closed {
  padding: 10px 15px;
  border: 2px solid #c00;
  background: #fff0f0;
  margin: 10px 0;
  font-size: 14px;
  text-align: center;
}

/* ─── Submission form ─────────────────────────────────────────────────────── */

.dream-box-submit-title {
  margin: 20px 0 10px;
  padding: 10px 12px;
  text-align: center;
  font-size: 0.95rem;
  font-weight: bold;
  line-height: 1.35;
  color: #800000;
  background: linear-gradient(200deg, #eadfca 0%, #fdf7d8 100%);
  border: 0;
}

.fondu-dream-box-form {
  max-width: 600px;
}

.dream-box-login-notice {
  font-style: italic;
  color: #666;
  margin: 15px 0;
}

/* ─── Intro page: gradient note + legend + dialog CTA (legacy WP) ─────────── */

.dream-box-intro-gradient {
  text-align: center;
  margin: 16px 0 12px;
  padding: 12px 10px;
  background: linear-gradient(200deg, #eadfca 0%, #fdf7d8 100%);
}

.dream-box-legend {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem 1rem;
  margin: 12px 0 16px;
}

.dream-box-legend__item {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #d5be7b;
  background: #fffef8;
  box-sizing: border-box;
}

.dream-box-legend__title {
  margin: 0 0 8px;
  font-weight: bold;
  font-size: 1rem;
  color: #5a3010;
  text-align: center;
}

.dream-box-legend__text {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.45;
  color: #333;
  text-align: left;
}

.dream-box-dialog-cta {
  padding: 10px 0;
  margin: 0 0 8px;
}

/* ─── Moderator bar ───────────────────────────────────────────────────────── */

.dream-box-mod-bar {
  background: #fffbe6;
  border: 1px solid #d5be7b;
  padding: 6px 10px;
  margin-bottom: 12px;
  font-size: 12px;
}

.dream-box-mod-bar .button {
  margin-right: 6px;
}

/* ─── Pagination ──────────────────────────────────────────────────────────── */

div.wpsc_page_numbers,
.pager {
  background-color: #fbf2b9;
  padding: 3px 6px;
  margin: 8px 0;
}

/* ─── Category description ────────────────────────────────────────────────── */

.dream-box-category-desc {
  font-size: 13px;
  color: #555;
  margin: 6px 0 12px;
}

.dream-box-empty {
  color: #888;
  font-style: italic;
  padding: 20px 0;
}

/* ─── Admin table ─────────────────────────────────────────────────────────── */

.dream-box-admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.dream-box-admin-table th,
.dream-box-admin-table td {
  border: 1px solid #d5be7b;
  padding: 6px 8px;
  vertical-align: top;
}

.dream-box-admin-table th {
  background: #fbf2b9;
  font-weight: bold;
}

.dream-box-admin-unpublished td {
  background: #fff0f0;
}

.dream-box-admin-links {
  margin-bottom: 12px;
}

.dream-box-wp-id {
  color: #888;
}

/* Legend: single column on mobile (must follow base .dream-box-legend rule). */
@media (max-width: 720px) {
  .dream-box-legend {
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }
}
