/* Boros Adventi Kalendárium */
.bak-root, .bak-root * { box-sizing: border-box; }
.bak-root {
  --bak-wine: #6d1a2b;
  --bak-wine-dark: #3d0c17;
  --bak-gold: #d9b26a;
  --bak-gold-light: #f3dfae;
  --bak-cream: #fbf6ec;
  --bak-ink: #2b1a1d;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--bak-ink);
  line-height: 1.5;
}
.bak-serif { font-family: Georgia, "Times New Roman", serif; }

/* Téma-stílusok semlegesítése a kalendárium gombjain */
.bak-root button { text-transform: none; letter-spacing: normal; min-height: 0; min-width: 0; margin: 0; text-shadow: none; line-height: 1.2; }
.bak-root .bak-door, .bak-root .bak-door:hover, .bak-root .bak-door:focus { background: none; border: 0; box-shadow: none; padding: 0; }
.bak-root img { max-width: 100%; height: auto; border: 0; box-shadow: none; }
.bak-root .bak-behind img { height: 100%; }
.bak-header p, .bak-header h2 { max-width: none; }

/* ---------- Trigger buttons ---------- */
.bak-open-btn {
  display: inline-flex; align-items: center; gap: .5em;
  background: linear-gradient(135deg, var(--bak-wine, #6d1a2b), #8e2a3e);
  color: #fff; border: 2px solid #d9b26a; border-radius: 999px;
  padding: .75em 1.4em; font-size: 1rem; font-weight: 600; cursor: pointer;
  box-shadow: 0 6px 18px rgba(61, 12, 23, .35);
  transition: transform .15s ease, box-shadow .15s ease;
  font-family: inherit; line-height: 1.2;
}
.bak-open-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(61, 12, 23, .45); }
.bak-open-btn:focus-visible { outline: 3px solid #f3dfae; outline-offset: 3px; }
.bak-floating {
  position: fixed; right: 20px; bottom: 20px; z-index: 99998;
}
.bak-floating .bak-badge {
  position: absolute; top: -6px; right: -6px; background: #d9b26a; color: #3d0c17;
  font-size: .75rem; font-weight: 700; border-radius: 999px; min-width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center; padding: 0 6px;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
}

/* ---------- Modal ---------- */
.bak-overlay {
  position: fixed; inset: 0; z-index: 99999; background: rgba(25, 6, 11, .72);
  display: flex; align-items: center; justify-content: center; padding: 16px;
  opacity: 0; visibility: hidden; transition: opacity .25s ease, visibility .25s;
  backdrop-filter: blur(3px);
}
.bak-overlay.bak-show { opacity: 1; visibility: visible; }
.bak-modal {
  position: relative; width: 100%; max-width: 980px; max-height: calc(100vh - 32px);
  overflow: auto; border-radius: 18px;
  background:
    radial-gradient(circle at 15% 10%, rgba(217,178,106,.18), transparent 40%),
    radial-gradient(circle at 85% 90%, rgba(217,178,106,.12), transparent 40%),
    linear-gradient(160deg, #5a1424, #3d0c17 70%);
  box-shadow: 0 30px 80px rgba(0,0,0,.5);
  padding: 28px 24px 24px; color: var(--bak-cream);
  transform: translateY(16px) scale(.98); transition: transform .3s ease;
}
.bak-overlay.bak-show .bak-modal { transform: none; }
.bak-close {
  position: absolute; top: 12px; right: 12px; width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid rgba(243,223,174,.5); background: rgba(0,0,0,.2); color: var(--bak-gold-light);
  font-size: 22px; line-height: 1; cursor: pointer; z-index: 3;
}
.bak-close:hover { background: rgba(0,0,0,.4); }

.bak-header { text-align: center; margin: 0 40px 20px; }
.bak-title { font-family: Georgia, serif; font-size: clamp(1.5rem, 3.5vw, 2.2rem); margin: 0; color: var(--bak-gold-light); font-weight: normal; letter-spacing: .02em; }
.bak-subtitle { margin: 6px 0 0; color: rgba(251,246,236,.8); font-size: .95rem; }
.bak-progress { margin-top: 10px; font-size: .85rem; color: var(--bak-gold); }

/* ---------- Inline container ---------- */
.bak-inline {
  border-radius: 18px; padding: 28px 24px 24px; color: var(--bak-cream);
  background: linear-gradient(160deg, #5a1424, #3d0c17 70%);
}

/* ---------- Grid ---------- */
.bak-grid {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px;
}
@media (max-width: 760px) { .bak-grid { grid-template-columns: repeat(4, 1fr); gap: 10px; } }
@media (max-width: 460px) { .bak-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; } .bak-modal { padding: 22px 14px 16px; } }

.bak-cell { perspective: 900px; aspect-ratio: 1 / 1.1; position: relative; }
.bak-door {
  position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; background: none;
  cursor: pointer; font: inherit; color: inherit;
}
.bak-door:focus-visible { outline: 3px solid var(--bak-gold-light); outline-offset: 3px; border-radius: 10px; }
.bak-behind {
  position: absolute; inset: 0; border-radius: 10px; overflow: hidden;
  background: #fbf6ec; display: flex; align-items: center; justify-content: center;
  box-shadow: inset 0 0 0 2px rgba(217,178,106,.6), inset 0 4px 14px rgba(0,0,0,.25);
}
.bak-behind img { width: 100%; height: 100%; object-fit: contain; padding: 8%; }
.bak-behind-num {
  position: absolute; left: 6px; bottom: 4px; font-family: Georgia, serif; font-size: .8rem; color: var(--bak-wine);
  background: rgba(255,255,255,.85); padding: 0 6px; border-radius: 6px;
}
.bak-front {
  position: absolute; inset: 0; border-radius: 10px;
  background:
    linear-gradient(145deg, rgba(255,255,255,.08), rgba(0,0,0,.12)),
    linear-gradient(160deg, #8e2a3e, #6d1a2b);
  border: 2px solid rgba(217,178,106,.75);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  transform-origin: left center; transition: transform .7s cubic-bezier(.3,.7,.3,1), box-shadow .2s;
  backface-visibility: hidden; box-shadow: 0 4px 10px rgba(0,0,0,.3);
}
.bak-front::after { /* kis kilincs */
  content: ""; position: absolute; right: 8px; top: 50%; width: 6px; height: 6px; margin-top: -3px;
  border-radius: 50%; background: var(--bak-gold);
}
.bak-num { font-family: Georgia, serif; font-size: clamp(1.4rem, 3.6vw, 2.2rem); color: var(--bak-gold-light); line-height: 1; }
.bak-lock { font-size: .7rem; margin-top: 6px; color: rgba(243,223,174,.7); letter-spacing: .05em; text-transform: uppercase; }
.bak-door:hover .bak-front { box-shadow: 0 8px 18px rgba(0,0,0,.45); }
.bak-cell.bak-locked .bak-front { filter: saturate(.55) brightness(.8); }
.bak-cell.bak-locked .bak-door { cursor: not-allowed; }
.bak-cell.bak-today .bak-front { box-shadow: 0 0 0 3px var(--bak-gold), 0 0 22px rgba(217,178,106,.75); animation: bak-pulse 2s ease-in-out infinite; }
@keyframes bak-pulse { 50% { box-shadow: 0 0 0 3px var(--bak-gold-light), 0 0 32px rgba(243,223,174,.9); } }
.bak-cell.bak-opened .bak-front { transform: rotateY(-105deg); box-shadow: none; animation: none; }
.bak-cell.bak-shake { animation: bak-shake .45s ease; }
@keyframes bak-shake { 20%,60% { transform: translateX(-5px); } 40%,80% { transform: translateX(5px); } }

.bak-toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px);
  background: #fbf6ec; color: #3d0c17; padding: 10px 18px; border-radius: 999px; z-index: 100001;
  font-size: .95rem; box-shadow: 0 8px 24px rgba(0,0,0,.35); opacity: 0; transition: all .25s ease;
  pointer-events: none; max-width: calc(100vw - 32px); text-align: center;
}
.bak-toast.bak-show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Detail (bor kártya) ---------- */
.bak-detail-overlay { z-index: 100000; }
.bak-detail {
  position: relative; width: 100%; max-width: 760px; max-height: calc(100vh - 32px); overflow: auto;
  background: var(--bak-cream); color: var(--bak-ink); border-radius: 18px;
  box-shadow: 0 30px 80px rgba(0,0,0,.5); display: grid; grid-template-columns: 40% 1fr;
  transform: translateY(16px) scale(.98); transition: transform .3s ease;
}
.bak-overlay.bak-show .bak-detail { transform: none; }
.bak-detail .bak-close { color: var(--bak-wine); border-color: rgba(109,26,43,.3); background: rgba(255,255,255,.7); }
.bak-detail-img {
  background: radial-gradient(circle at 50% 40%, #fff, #efe3cc);
  display: flex; align-items: center; justify-content: center; padding: 24px; min-height: 260px;
  border-radius: 18px 0 0 18px;
}
.bak-detail-img img { max-width: 100%; max-height: 380px; object-fit: contain; }
.bak-detail-body { padding: 30px 30px 26px; }
.bak-day-label { display: inline-block; font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; color: var(--bak-wine); background: rgba(217,178,106,.3); padding: 3px 10px; border-radius: 999px; }
.bak-wine-name { font-family: Georgia, serif; font-size: 1.7rem; margin: 10px 0 2px; color: var(--bak-wine-dark); font-weight: normal; line-height: 1.2; }
.bak-wine-sub { color: #7a5a5f; font-size: .95rem; margin: 0 0 14px; }
.bak-wine-desc { margin: 0 0 18px; }
.bak-wine-desc p { margin: 0 0 .6em; }
.bak-pairing { background: #fff; border-left: 4px solid var(--bak-gold); border-radius: 0 10px 10px 0; padding: 12px 14px; }
.bak-pairing h4 { margin: 0 0 4px; font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; color: var(--bak-wine); }
.bak-pairing p { margin: 0; }
.bak-root .bak-link, .bak-root .bak-link:visited {
  display: block; margin-top: 18px; padding: 12px 16px; border-radius: 10px; text-align: center;
  background: linear-gradient(135deg, #6d1a2b, #8e2a3e); color: #fff; font-weight: 600; text-decoration: none;
  border: 2px solid #d9b26a; box-shadow: 0 4px 12px rgba(61,12,23,.25);
}
.bak-root .bak-link:hover { color: #fff; filter: brightness(1.1); }
.bak-root .bak-link::after { content: " →"; }
.bak-detail-nav { display: flex; gap: 8px; margin-top: 20px; }
.bak-detail-nav button {
  flex: 1; padding: 10px; border-radius: 10px; border: 1px solid rgba(109,26,43,.3); background: #fff; color: var(--bak-wine);
  cursor: pointer; font: inherit; font-weight: 600;
}
.bak-detail-nav button:hover:not(:disabled) { background: #f6ecd8; }
.bak-detail-nav button:disabled { opacity: .4; cursor: default; }
@media (max-width: 640px) {
  .bak-detail { grid-template-columns: 1fr; }
  .bak-detail-img { border-radius: 18px 18px 0 0; min-height: 200px; }
  .bak-detail-img img { max-height: 220px; }
  .bak-detail-body { padding: 20px 20px 22px; }
}

.bak-admin-bar {
  margin-top: 16px; padding: 8px 12px; border: 1px dashed rgba(243,223,174,.5); border-radius: 10px;
  font-size: .8rem; color: var(--bak-gold-light); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center;
}
.bak-admin-bar button { font: inherit; padding: 3px 10px; border-radius: 6px; border: 1px solid var(--bak-gold); background: transparent; color: var(--bak-gold-light); cursor: pointer; }

@media (prefers-reduced-motion: reduce) {
  .bak-front, .bak-overlay, .bak-modal, .bak-detail { transition: none; }
  .bak-cell.bak-today .bak-front, .bak-cell.bak-shake { animation: none; }
}
