/* ============================================================
   calendar.css — cassette mixtape, olive + blush on warm paper
   ============================================================ */

/* ============================================================ GATE */
.gate { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.gate-card {
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  background: var(--paper-2); border: 1px solid var(--line); border-radius: 16px;
  padding: 44px 36px; max-width: 340px; width: 100%; box-shadow: var(--shadow-2); text-align: center;
}
.gate-title { font-size: clamp(24px, 3vw, 30px); color: var(--ink); }
.gate-input {
  width: 100%; font-family: "Space Mono", monospace; font-size: 14px; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line); border-radius: 30px;
  padding: 12px 18px; text-align: center; outline: none;
}
.gate-input:focus { border-color: var(--olive); }
.gate-error { font-size: 12px; color: var(--blush-deep); }
.gate-btn {
  font-family: inherit; font-weight: 700; font-size: 12px; letter-spacing: .05em;
  color: var(--paper); background: var(--olive); border: none; border-radius: 30px;
  padding: 12px 26px; cursor: pointer; box-shadow: var(--shadow-1); transition: transform .15s ease;
}
.gate-btn:hover { transform: translateY(-1px); }

/* ---------- editable affordance ---------- */
[contenteditable] { outline: none; border-radius: 4px; transition: box-shadow .15s ease, background .15s ease; }
[contenteditable]:hover { box-shadow: 0 0 0 1px var(--line); }
[contenteditable]:focus { box-shadow: 0 0 0 2px var(--olive); background: oklch(1 0 0 / 0.4); }
[contenteditable]:empty::before { content: attr(data-placeholder); color: var(--olive-dim); opacity: .7; }

/* ============================================================ INTRO */
.intro {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 30px;
  align-items: center;
  padding: 50px 0 32px;
}
.intro-mark { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.intro-kicker {
  font-size: 10px; letter-spacing: .22em; color: var(--olive); font-weight: 700;
  writing-mode: vertical-rl; transform: rotate(180deg); height: 150px;
  border-left: 2px solid var(--blush); padding-left: 8px;
}
.intro-mark { flex-direction: row; align-items: center; }

.intro-title {
  font-size: clamp(34px, 5.2vw, 60px); line-height: .94; font-weight: 800;
  letter-spacing: -.025em; white-space: pre-wrap;
}
.intro-hand {
  font-size: clamp(20px, 2.3vw, 25px); line-height: 1.32; color: var(--ink-soft);
  max-width: 62ch; margin-top: 14px;
}
.intro-meta {
  margin-top: 18px; font-size: 11px; letter-spacing: .12em; color: var(--olive);
  text-transform: uppercase; display: flex; gap: 10px; align-items: center;
}
.intro-meta b { color: var(--ink); }
.intro-meta .dot { opacity: .5; }

.polaroid {
  background: #fff; padding: 11px 11px 0; box-shadow: var(--shadow-1);
  transform: rotate(2.4deg); width: 210px; border: 1px solid var(--line);
  flex-shrink: 0;
}
.polaroid figcaption { text-align: center; padding: 9px 0 13px; font-size: 21px; color: var(--ink-soft); }

/* ============================================================ MONTH TABS */
.monthtabs {
  display: flex; flex-wrap: wrap; gap: 8px; padding: 6px 0 8px;
  border-top: 1.5px solid var(--line); border-bottom: 1.5px solid var(--line);
}
.monthtab {
  display: flex; align-items: center; gap: 8px; font-family: inherit; cursor: pointer;
  background: transparent; border: 1px solid var(--line); border-radius: 30px;
  padding: 8px 14px; font-size: 11px; letter-spacing: .05em; color: var(--ink-soft);
  transition: background .15s ease, color .15s ease, border-color .15s ease;
  white-space: nowrap; flex-wrap: nowrap;
}
.monthtab-label { white-space: nowrap; }
.monthtab-count { font-size: 10px; opacity: .7; white-space: nowrap; }
.monthtab:hover { border-color: var(--olive-dim); color: var(--ink); }
.monthtab.is-current { border-color: var(--blush-deep); }
.monthtab.is-active { background: var(--olive); border-color: var(--olive); color: var(--paper); }
.monthtab.is-active .monthtab-count { opacity: .85; }

/* ============================================================ SEASONS */
.season { margin-top: 44px; }
.season-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 18px; padding-bottom: 13px; border-bottom: 1.5px solid var(--line); }
.season-glyph { font-size: 22px; color: var(--blush-deep); line-height: 1; }
.season-name { font-size: clamp(24px, 3vw, 34px); font-weight: 800; letter-spacing: -.015em; }
.season-note { font-size: clamp(19px, 2vw, 23px); color: var(--olive); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.season-rule { flex: 1; align-self: center; height: 0; border-top: 1.5px dotted var(--line); margin: 0 4px; }
.season-count { font-size: 11px; letter-spacing: .14em; color: var(--olive); font-weight: 700; white-space: nowrap; }

/* ============================================================ GRID + TILES */
.windowpane {
  position: relative; overflow: hidden; background: linear-gradient(135deg, var(--olive), var(--blush));
  border-radius: var(--tile-radius); box-shadow: var(--shadow-1);
}
/* while the photo slot is empty, or while explicitly editing it, let clicks/drops
   reach the photo layer instead of the tiles sitting on top of it            */
.windowpane:not(:has(image-slot[data-filled])) .tile,
.windowpane.is-editing-photo .tile { pointer-events: none; }
.windowpane.is-editing-photo .grid { opacity: .001; }
.windowpane.is-editing-photo { outline: 2px dashed var(--blush-deep); outline-offset: -2px; overflow: visible; padding-bottom: 44px; }
.photo-edit-btn {
  position: absolute; top: 8px; right: 8px; z-index: 3; font-family: inherit;
  font-size: 10px; letter-spacing: .06em; font-weight: 700; color: var(--ink);
  background: oklch(1 0 0 / .82); border: none; border-radius: 20px; padding: 6px 11px;
  cursor: pointer; box-shadow: var(--shadow-1); backdrop-filter: blur(3px);
}
.photo-edit-btn:hover { background: var(--paper); }
.windowpane-photo {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block;
  --slot-object-fit: cover;
}
.windowpane-photo img { object-fit: cover; }

.grid {
  position: relative; z-index: 1;
  display: grid;
  grid-template-columns: repeat(var(--cols, 6), 1fr);
  grid-auto-rows: 150px;
  gap: 0;
}
.windowpane.is-kickoff .grid { grid-auto-rows: min(70vh, 620px); }

.tile {
  position: relative; border: none; padding: 0; cursor: pointer;
  color: var(--paper); text-align: left;
  font-family: "Space Mono", monospace;
  outline: 1px solid oklch(1 0 0 / .22); outline-offset: -1px;
  background: oklch(1 0 0 / .04); /* uniform — never discolors the shared photo per-window */
  transition: transform .18s ease, box-shadow .25s ease, backdrop-filter .3s ease;
  container-type: size;
}
.tile-scrim { position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to top, oklch(0.2 0.02 110 / .32) 0%, transparent 55%); }

.tile-stamp {
  position: absolute; top: 7px; left: 8px; z-index: 2; font-size: 10px; letter-spacing: .1em;
  font-weight: 700; color: var(--paper); background: oklch(0.18 0.02 110 / .34);
  padding: 2px 7px; border-radius: 20px; backdrop-filter: blur(2px);
}
.tile-foot {
  position: absolute; left: 8px; right: 8px; bottom: 8px; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
}
.tile-date, .tile-open {
  font-size: 10px; letter-spacing: .07em; font-weight: 700; color: var(--paper);
  text-shadow: 0 1px 2px oklch(0.18 0.02 110 / .6);
}
.tile-tag { font-size: 9px; letter-spacing: .1em; font-weight: 700; padding: 3px 7px; border-radius: 20px; white-space: nowrap; }
.tile-tag.fresh { background: var(--paper); color: var(--olive-deep); }
.tile-tag.played { background: oklch(0.18 0.02 110 / .42); color: var(--paper); border: 1px solid oklch(1 0 0 / .3); }
.tile-lock { font-size: 10px; color: var(--blush); }

/* hover (only meaningful for unlocked) */
.tile-open:hover, .tile-played:hover { transform: scale(1.015); }
.tile-open:hover .tile-tag.fresh { background: var(--blush); }

/* fresh tiles get a soft breathing dot */
.tile-open .tile-tag.fresh { animation: breathe 2.6s ease-in-out infinite; }

/* locked: a frosted pane over the same shared picture — the window is shut */
.tile-locked { cursor: default; }
.tile-locked::before {
  content: ""; position: absolute; inset: 0;
  background: oklch(0.3 0.025 110 / .62);
  border: 1.5px solid oklch(1 0 0 / .55);
  backdrop-filter: blur(7px) brightness(.62) saturate(.8);
  -webkit-backdrop-filter: blur(7px) brightness(.62) saturate(.8);
}
.tile-locked .tile-scrim { background: oklch(0.16 0.02 110 / .38); }
.tile-locked .tile-stamp { background: oklch(0.16 0.02 110 / .45); color: oklch(1 0 0 / .8); }
.tile-daysleft {
  position: absolute; right: 8px; bottom: 30px; z-index: 1;
  font-family: "Bricolage Grotesque", sans-serif; font-weight: 800; font-size: clamp(18px, 34cqh, 80px);
  color: oklch(0.82 0.14 355); opacity: .8; line-height: 1; pointer-events: none;
  text-shadow: 0 1px 3px oklch(0.18 0.02 110 / .4);
}
.tile.is-shake { animation: shake .42s cubic-bezier(.36,.07,.19,.97); }
.tile-filler { pointer-events: none; }

.footer { text-align: center; margin-top: 50px; font-size: 20px; color: var(--olive-dim); }

/* ============================================================ MODAL */
.modal-veil {
  position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: oklch(0.18 0.02 110 / .55); backdrop-filter: blur(6px);
  animation: veil .2s ease;
}
.modal-card {
  position: relative; width: min(760px, 100%); background: var(--paper);
  border-radius: 16px; box-shadow: var(--shadow-2); overflow: hidden; border: 1px solid var(--line);
  animation: pop .28s cubic-bezier(.2,.85,.25,1);
}
.modal-x {
  position: absolute; top: 12px; right: 12px; z-index: 3; width: 30px; height: 30px;
  border-radius: 50%; border: none; cursor: pointer; font-family: inherit; font-size: 12px;
  background: oklch(1 0 0 / .85); color: var(--ink); box-shadow: var(--shadow-1);
}
.modal-x:hover { background: var(--blush); }
.modal-spine {
  background: var(--olive); color: var(--paper); padding: 13px 22px;
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px; letter-spacing: .18em; font-weight: 700;
}
.modal-spine-date { font-weight: 400; letter-spacing: .06em; opacity: .85; }
.modal-grid { display: grid; grid-template-columns: 1.08fr 1fr; }
.modal-player { background: #000; display: flex; align-items: center; justify-content: center; }
.modal-player iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; display: block; }
.modal-noembed { display: flex; flex-direction: column; align-items: center; gap: 12px; color: var(--paper); padding: 40px; font-size: 12px; letter-spacing: .04em; }
.modal-meta { padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.modal-label { font-size: 10px; letter-spacing: .2em; color: var(--olive); font-weight: 700; }
.modal-songtitle { font-size: clamp(26px, 3vw, 33px); font-weight: 800; line-height: 1.04; letter-spacing: -.01em; margin-top: 4px; }
.modal-artist { font-size: 14px; color: var(--ink-soft); margin-top: 6px; }
.modal-note { font-size: clamp(21px, 2.4vw, 25px); color: var(--ink-soft); line-height: 1.3; }
.btn-play {
  align-self: flex-start; margin-top: auto; background: var(--blush); color: var(--ink);
  text-decoration: none; padding: 12px 20px; border-radius: 30px; font-weight: 700;
  font-size: 12px; letter-spacing: .05em; box-shadow: var(--shadow-1); transition: transform .15s ease;
}
.btn-play:hover { transform: translateY(-2px); }
.modal-empty { padding: 46px 32px 50px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.modal-empty h3 { font-size: 24px; font-weight: 800; }
.modal-empty p { font-size: 13px; color: var(--ink-soft); line-height: 1.6; max-width: 46ch; }
.modal-empty code { background: var(--paper-2); padding: 1px 6px; border-radius: 4px; font-size: 12px; }

/* ============================================================ PREVIEW BAR */
.previewbar {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 40;
  background: var(--ink); color: var(--paper); border-radius: 40px; padding: 9px 16px 9px 11px;
  display: flex; align-items: center; gap: 14px; box-shadow: var(--shadow-2);
  font-size: 11px; max-width: calc(100vw - 28px);
}
.pv-tag { background: var(--blush); color: var(--ink); padding: 4px 9px; border-radius: 20px; font-weight: 700; letter-spacing: .16em; font-size: 9px; }
.pv-toggle { background: none; border: 1px solid oklch(1 0 0 / .25); color: var(--paper); border-radius: 20px; padding: 6px 11px; cursor: pointer; font-family: inherit; font-size: 10px; letter-spacing: .04em; white-space: nowrap; }
.pv-toggle.on { background: var(--olive); border-color: var(--olive); }
.pv-scrub { display: flex; align-items: center; gap: 11px; min-width: 0; }
.pv-readout { white-space: nowrap; opacity: .9; }
.pv-readout b { color: var(--blush); opacity: 1; }
.pv-scrub input[type=range] { -webkit-appearance: none; appearance: none; width: clamp(120px, 26vw, 280px); height: 4px; border-radius: 4px; background: oklch(1 0 0 / .22); outline: none; }
.pv-scrub input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--blush); cursor: pointer; box-shadow: 0 1px 4px oklch(0 0 0 / .4); }
.pv-scrub input[type=range]::-moz-range-thumb { width: 16px; height: 16px; border: none; border-radius: 50%; background: var(--blush); cursor: pointer; }

/* ============================================================ KEYFRAMES */
@keyframes breathe { 0%,100% { opacity: 1; } 50% { opacity: .58; } }
@keyframes shake { 10%,90% { transform: translateX(-1px); } 20%,80% { transform: translateX(2px); } 30%,50%,70% { transform: translateX(-4px); } 40%,60% { transform: translateX(4px); } }
@keyframes veil { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }

/* ============================================================ RESPONSIVE */
@media (max-width: 760px) {
  #root { padding: 0 16px 150px; }
  .intro { grid-template-columns: 1fr; gap: 18px; padding: 32px 0 22px; }
  .intro-kicker { writing-mode: horizontal-tb; transform: none; height: auto; border-left: none; border-top: 2px solid var(--blush); padding: 6px 0 0; text-align: center; }
  .intro-kicker span { display: block; white-space: nowrap; }
  .intro-kicker .dot { display: none; }
  .intro-mark { flex-direction: column; align-items: center; justify-content: center; width: 100%; margin: 0 auto; text-align: center; }
  .polaroid { display: none; }
  .intro [contenteditable="false"] { user-select: none; -webkit-user-select: none; cursor: default; }
  .intro [contenteditable="false"]:hover, .intro [contenteditable="false"]:focus { box-shadow: none; background: none; }
  .windowpane-photo { display: none !important; }
  .tile-daysleft { font-size: clamp(13px, 24cqh, 42px); right: 6px; bottom: 26px; }
  .modal-grid { grid-template-columns: 1fr; }
  .grid { grid-auto-rows: 100px; gap: 0; }
  .season-note { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .tile-open .tile-tag.fresh { animation: none; }
  * { animation-duration: .001ms !important; }
}
