/* Door calendar. Layers on styles.css: same tokens, same buttons, same wrap. */

/* The admin-only controls are buttons, and .btn sets display, which beats the
   browser's own rule for [hidden]. Without this they stay on screen for
   everyone. */
[hidden] { display: none !important; }

/* Head */
.cal-head { padding: 44px 0 28px; }
.cal-head-inner {
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 40px; align-items: end;
  border-bottom: 1px solid var(--border); padding-bottom: 28px;
}
.cal-head h1 { font-size: clamp(2.1rem, 5vw, 3.2rem); margin-bottom: .25em; }
.cal-head .lede { max-width: 46ch; margin: 0; }

.cal-meter { }
.cal-meter-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.cal-meter-count { font: 700 1.15rem var(--display); color: var(--navy); font-variant-numeric: tabular-nums; }
.cal-meter-label { font-size: .85rem; color: var(--muted); }
.cal-bar { height: 8px; margin-top: 8px; border-radius: 999px; background: #E6E2D8; overflow: hidden; }
.cal-bar i { display: block; height: 100%; width: 0; background: var(--gold); border-radius: 999px; transition: width .5s ease; }
.cal-meter-note { font-size: .9rem; color: var(--muted); margin: 10px 0 0; }

/* Rail */
.cal-doors { padding: 28px 0 56px; }
.cal-rail { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 22px; }
.cal-rail .spacer { flex: 1 1 auto; }
.cal-admin-tag {
  display: inline-flex; align-items: center; min-height: 32px; padding: 0 12px;
  border: 1px solid var(--gold); border-radius: 999px;
  font-size: .75rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #8A6508;
}
.cal-rail .btn { padding: 8px 18px; min-height: 40px; }
.cal-rail .btn[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); color: var(--white); }

/* The doors */
.doors { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 14px; }
@media (max-width: 520px) { .doors { grid-template-columns: repeat(3, 1fr); gap: 10px; } }

.door {
  position: relative; aspect-ratio: 1 / 1; min-width: 0; padding: 0;
  border: 0; background: none; cursor: pointer; perspective: 900px;
  border-radius: var(--radius); font: inherit; text-align: left;
}
.door-inside {
  position: absolute; inset: 0; overflow: hidden;
  background: var(--white); border: 1px solid var(--border); border-radius: var(--radius);
  display: flex; flex-direction: column; gap: 5px; padding: 12px 13px;
}
.door-day {
  font-size: .68rem; letter-spacing: .12em; text-transform: uppercase;
  font-weight: 700; color: #8A6508;
}
.door-title { font: 700 1rem/1.2 var(--display); color: var(--navy); }
.door-snip {
  font-size: .82rem; line-height: 1.4; color: var(--body); overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
}
.door-more { margin-top: auto; font-size: .76rem; font-weight: 700; color: var(--teal); }

.door-face {
  position: absolute; inset: 0; transform-style: preserve-3d;
  transform-origin: left center; transition: transform .75s cubic-bezier(.22, .9, .25, 1);
}
.door-front, .door-back {
  position: absolute; inset: 0; border-radius: var(--radius);
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.door-front {
  background: linear-gradient(150deg, #16335F 0%, var(--navy) 100%);
  border: 1px solid #08172F;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), 0 2px 4px rgba(11, 34, 69, .22);
}
.door-front::before {
  content: ""; position: absolute; inset: 8px; border-radius: 5px;
  border: 1px solid rgba(201, 147, 10, .55);
}
.door-front::after {
  content: ""; position: absolute; right: 9px; top: 50%; width: 6px; height: 6px;
  margin-top: -3px; border-radius: 50%; background: var(--gold);
}
.door-num {
  font: 700 clamp(1.5rem, 4vw, 2rem) var(--display); color: #FBF6E6;
  font-variant-numeric: tabular-nums;
}
.door-when {
  font-size: .64rem; letter-spacing: .1em; text-transform: uppercase;
  font-weight: 700; color: rgba(251, 246, 230, .72);
}
.door-back {
  transform: rotateY(180deg);
  background: #081525; border: 1px solid #081525;
  box-shadow: inset 0 0 22px rgba(0, 0, 0, .55);
}
.door-lock {
  position: absolute; left: 9px; top: 9px; width: 15px; height: 15px;
  color: #EBD9A8; opacity: .65; pointer-events: none;
}

.door.is-open { z-index: 3; }
.door.is-open .door-face { transform: rotateY(-118deg); box-shadow: -14px 6px 22px rgba(11, 34, 69, .3); }
.door:not(.is-open):hover .door-face { transform: rotateY(-9deg); }
.door.is-locked:not(.is-open) .door-front { filter: saturate(.5) brightness(.88); }
.door.is-locked:not(.is-open):hover .door-face { transform: none; }
.door.nudge .door-face { animation: door-nudge .42s ease; }
@keyframes door-nudge {
  0%, 100% { transform: rotateY(0); }
  30% { transform: rotateY(-7deg); }
  60% { transform: rotateY(-2deg); }
}
.door.is-open .door-lock { display: none; }

.cal-note { font-size: .9rem; color: var(--muted); margin: 22px 0 0; }

/* Behind-the-door panel */
.cal-scrim {
  position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center;
  background: rgba(11, 34, 69, .55); padding: 20px 16px;
}
.cal-sheet {
  width: min(560px, 100%); max-height: 100%; overflow: auto;
  background: var(--white); border: 1px solid var(--border); border-top: 5px solid var(--gold);
  border-radius: var(--radius); padding: 26px 24px 22px;
  box-shadow: 0 24px 60px rgba(11, 34, 69, .3);
}
.cal-sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.cal-sheet-day {
  font-size: .76rem; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; color: #8A6508;
}
.cal-sheet h2 { margin: 6px 0 0; font-size: clamp(1.4rem, 3.4vw, 1.9rem); }
.cal-sheet-body { margin-top: 14px; white-space: pre-wrap; }
.cal-sheet-action {
  margin-top: 16px; padding: 14px 16px; border-radius: var(--radius);
  background: var(--bg); border: 1px solid var(--border); border-left: 4px solid var(--gold);
}
.cal-sheet-action p { margin: 5px 0 0; }
.cal-close {
  flex: 0 0 auto; width: 38px; height: 38px; border-radius: 50%; cursor: pointer; line-height: 1;
  border: 1px solid var(--border); background: var(--bg); color: var(--navy); font-size: 1.3rem;
}
.cal-close:hover { border-color: var(--navy); }
.cal-sheet-foot { margin-top: 20px; display: flex; gap: 10px; flex-wrap: wrap; }

/* Toast */
.cal-toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 24px; z-index: 60;
  background: var(--navy); color: var(--white); font-weight: 700; font-size: .95rem;
  padding: 11px 18px; border-radius: 999px; box-shadow: 0 10px 26px rgba(11, 34, 69, .3);
  max-width: min(90vw, 420px); text-align: center;
}

/* Shop nudge */
.cal-cta { background: var(--white); border-top: 1px solid var(--border); padding: 40px 0; text-align: center; }
.cal-cta p { max-width: 54ch; margin: 0 auto 18px; }

/* Editor (admins only) */
.cal-editor { background: var(--bg); border-top: 1px solid var(--border); padding: 40px 0 56px; }
.cal-editor-panel {
  background: var(--white); border: 1px solid var(--border); border-top: 4px solid var(--gold);
  border-radius: var(--radius); padding: 24px 22px;
}
.cal-save {
  display: inline-flex; align-items: center; gap: 8px; margin: 10px 0 0;
  font-size: .85rem; font-weight: 700; color: var(--muted);
}
.cal-save .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); }
.cal-save.is-bad { color: #A3302C; }
.cal-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-top: 20px; }
.cal-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cal-field label, .cal-field > span { font-weight: 700; font-size: .9rem; color: var(--navy); }
.cal-editor input[type="text"],
.cal-editor input[type="date"],
.cal-editor input[type="number"],
.cal-editor select,
.cal-editor textarea {
  width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--white);
  font: 1rem var(--text); color: var(--body);
}
.cal-editor textarea { min-height: 76px; line-height: 1.5; resize: vertical; }
.cal-check { flex-direction: row; align-items: center; gap: 10px; }
.cal-check input { width: 18px; height: 18px; min-height: 0; accent-color: var(--gold); }

.cal-doors-edit { display: flex; flex-direction: column; gap: 12px; margin-top: 22px; }
.cal-door-edit {
  display: grid; grid-template-columns: 46px 1fr; gap: 12px; align-items: start;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); padding: 14px;
}
.cal-door-edit .n { font: 700 1rem var(--display); color: #8A6508; padding-top: 10px; font-variant-numeric: tabular-nums; }
.cal-door-edit .stack { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
@media (max-width: 520px) {
  .cal-door-edit { grid-template-columns: 1fr; }
  .cal-door-edit .n { padding-top: 0; }
}
.cal-editor-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.cal-hint { font-size: .9rem; color: var(--muted); }

@media (max-width: 900px) {
  .cal-head-inner { grid-template-columns: 1fr; gap: 24px; align-items: start; }
}
@media (prefers-reduced-motion: reduce) {
  .door-face, .cal-bar i { transition: none; }
  .door.nudge .door-face { animation: none; }
}
