/* Calendar page. The painting is dark on the left on purpose: the calendar is lettered straight onto it in
   lamp-light cream, with no card around it. Colours and type come from tokens.css. */

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body.cal {
  --gx: clamp(28px, 7vw, 120px); --cream: #f3e6c8; --dim: rgba(243, 230, 200, .6); --amber: #ffb45c;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  margin: 0; overflow: hidden; background: #0b111a; color: var(--cream);
  font-family: var(--font); font-size: var(--fs-body); line-height: var(--lh-body);
}
button, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }

#gl, #fx { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#gl { z-index: 0; transition: opacity .6s ease; opacity: 0; }
#fx { z-index: 1; mix-blend-mode: screen; }
.scrim { position: fixed; inset: 0; z-index: 2; pointer-events: none;
  background: linear-gradient(90deg, rgba(6, 10, 18, var(--scrim, .22)) 0%, rgba(6, 10, 18, calc(var(--scrim, .22) * .65)) 34%, transparent 62%); }

/* speech bubble: placed with `translate`, so `transform` is free to animate the entrance from its corner */
.say {
  position: fixed; z-index: 6; left: 0; top: 0; max-width: 260px; pointer-events: none;
  background: rgba(14, 20, 30, .9); color: var(--cream); border: 1px solid rgba(255, 180, 92, .45); border-radius: 10px;
  padding: 3px 12px; font-size: 1rem; box-shadow: 0 0 18px rgba(255, 170, 70, .25);
  opacity: 0; transform: scale(.96); transform-origin: 0 100%; transition: opacity .16s var(--ease-out), transform .16s var(--ease-out);
}
.say.on { opacity: 1; transform: none; }

.spark { position: fixed; z-index: 6; left: 0; top: 0; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; pointer-events: none;
  background: #fff3b8; box-shadow: 0 0 10px 3px rgba(255, 215, 110, .9); }

.home { position: fixed; z-index: 5; top: 16px; left: var(--gx); color: var(--dim); text-decoration: none; letter-spacing: .02em; transition: color .15s ease, text-shadow .15s ease; }

/* ---------- the calendar, lettered onto the painting ---------- */
.panel {
  position: fixed; z-index: 3; left: var(--gx); top: 0; bottom: 0; width: min(500px, calc(100vw - var(--gx) - 24px));
  padding: clamp(88px, 12vh, 130px) 0 84px; pointer-events: none;
}
.panel > * { pointer-events: auto; }

.head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 26px; }
.head h1 { margin: 0; flex: 1; font-weight: 400; font-size: clamp(2rem, 4.4vw, 2.9rem); line-height: 1.1; letter-spacing: .01em; text-shadow: 0 0 26px rgba(255, 180, 92, .38); }
.nav { width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(243, 230, 200, .25); background: transparent; font-size: 1.5rem; line-height: 1; padding: 0 0 3px; color: var(--cream);
  transition: transform .12s var(--ease-out), border-color .15s ease, box-shadow .15s ease; }
.nav:active, .jump:active, .day:active { transform: scale(.97); }

.dow, .days { display: grid; grid-template-columns: repeat(7, 1fr); }
.days { row-gap: 4px; }
.dow { font-size: .82rem; color: var(--dim); text-align: center; padding-bottom: 10px; margin-bottom: 8px; border-bottom: 1px solid rgba(243, 230, 200, .14); letter-spacing: .06em; text-transform: uppercase; }
.dow span:first-child { color: rgba(255, 180, 92, .8); }

.day { position: relative; height: min(60px, 6.2vh); aspect-ratio: 1; justify-self: center; border: 0; background: transparent; border-radius: 50%; padding: 0; display: grid; place-items: center; font-size: 1.18rem; color: var(--cream);
  transition: transform .12s var(--ease-out), background .2s ease, box-shadow .2s ease; }
.day .n { position: relative; z-index: 2; text-shadow: 0 0 12px rgba(0, 0, 0, .6); }
.day.sun .n, .day.hol .n { color: var(--amber); }
.day.sel { box-shadow: inset 0 0 0 1px rgba(243, 230, 200, .4); }
.day.blank { pointer-events: none; }

/* a month's days rise in row by row, only when the month changes */
.days.enter .day { animation: rise 240ms var(--ease-out) backwards; animation-delay: calc(var(--r, 0) * 26ms); }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } }

/* today wears a lantern ring that flickers like the street lamp */
.day.today::after { content: ""; position: absolute; inset: 5px; border-radius: 50%; border: 1.5px solid var(--amber);
  box-shadow: 0 0 16px rgba(255, 170, 70, .65), inset 0 0 10px rgba(255, 170, 70, .3); animation: lantern 3.4s ease-in-out infinite; }
.day.today .n { font-weight: 700; }
@keyframes lantern { 0%, 100% { opacity: 1; } 18% { opacity: .78; } 24% { opacity: 1; } 52% { opacity: .86; } 60% { opacity: 1; } 80% { opacity: .72; } }

/* a day with a note keeps a small firefly */
.day.noted::before { content: ""; position: absolute; top: 14%; right: 20%; width: 5px; height: 5px; border-radius: 50%; z-index: 3;
  background: #ffefaa; box-shadow: 0 0 8px 2px rgba(255, 215, 110, .85); animation: float 4.2s ease-in-out infinite; }
@keyframes float { 0%, 100% { transform: translate(0, 0); opacity: 1; } 35% { transform: translate(-3px, -4px); opacity: .55; } 70% { transform: translate(2px, -1px); opacity: 1; } }

.holidays { list-style: none; margin: 20px 0 0; padding: 0; font-size: .92rem; color: var(--dim); min-height: 1.5em; }

/* one fixed slot for the hint and the note editor, so nothing above it moves when the editor opens */
.slot { position: relative; height: 104px; margin-top: 14px; }
.hint, .note { position: absolute; inset: 0 0 auto 0; margin: 0; transition: opacity .16s var(--ease-out), visibility 0s linear .16s; }
.hint { font-size: .88rem; color: var(--dim); font-style: italic; opacity: 0; visibility: hidden; }
.hint.on, .note.on { opacity: 1; visibility: visible; transition-delay: 0s; }
.note { opacity: 0; visibility: hidden; }
.nh { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; color: var(--amber); font-size: .95rem; }
.nh button { background: none; border: 0; margin: -10px -8px; padding: 10px 8px; color: var(--dim); font-size: .85rem; text-decoration: underline; text-underline-offset: 3px; transition: color .15s ease; }
.note textarea { display: block; width: 100%; margin-top: 4px; resize: none; background: transparent; border: 0; border-bottom: 1px solid rgba(255, 180, 92, .5); color: var(--cream); font-size: 1.05rem; line-height: 1.4; padding: 4px 0 6px; text-shadow: 0 0 12px rgba(0, 0, 0, .5); transition: border-color .2s ease, box-shadow .2s ease; }
.note textarea::placeholder { color: var(--dim); }
.note textarea:focus { outline: none; border-bottom-color: var(--amber); box-shadow: 0 8px 16px -10px rgba(255, 170, 70, .55); }

/* ---------- clock and weather, bottom left ---------- */
.meta { position: fixed; z-index: 4; left: var(--gx); bottom: 28px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 18px; color: var(--dim); font-size: .95rem; }
.meta p { margin: 0; }
.clock #time { color: var(--cream); font-size: 1.3rem; letter-spacing: .04em; text-shadow: 0 0 14px rgba(255, 180, 92, .4); }
.jump { background: none; border: 1px solid rgba(243, 230, 200, .25); border-radius: 999px; padding: 4px 16px; color: var(--cream);
  transition: transform .12s var(--ease-out), border-color .15s ease, box-shadow .15s ease; }
.nojs { position: fixed; z-index: 7; top: 60px; left: 16px; background: #0b111a; padding: 8px 14px; border-radius: 6px; }

/* hover only where there is a real pointer; on touch it would stick after a tap */
@media (hover: hover) and (pointer: fine) {
  .home:hover { color: var(--cream); text-shadow: 0 0 14px rgba(255, 180, 92, .5); }
  .nav:hover, .jump:hover { border-color: var(--amber); box-shadow: 0 0 16px rgba(255, 170, 70, .4); }
  .day:hover { background: radial-gradient(circle, rgba(255, 190, 100, .24), transparent 72%); }
  .nh button:hover { color: var(--cream); }
}

/* ---------- small screens: the calendar scrolls over the painting ---------- */
@media (max-width: 760px) {
  body.cal { overflow: auto; }
  .scrim { background: linear-gradient(180deg, transparent 38%, rgba(6, 10, 18, .8) 62%); }
  .day { height: 48px; }
  .panel { position: relative; left: auto; top: auto; bottom: auto; width: auto; margin: 54vh 16px 0; padding: 0 0 24px; }
  .meta { position: relative; left: auto; bottom: auto; margin: 0 16px 28px; }
  .home { left: 16px; }
}
@media (max-height: 760px) and (min-width: 761px) { .panel { padding-top: 72px; } .head { margin-bottom: 16px; } .head h1 { font-size: 2.2rem; } .day { font-size: 1.05rem; } .holidays { margin-top: 12px; } .slot { height: 90px; margin-top: 8px; } .dow { padding-bottom: 8px; margin-bottom: 4px; } }

/* reduced motion keeps the fades that help, and drops movement */
@media (prefers-reduced-motion: reduce) {
  .day.today::after, .day.noted::before { animation: none; }
  .days.enter .day { animation: none; }
  .nav:active, .jump:active, .day:active { transform: none; }
  #gl { transition: none; }
  .say { transform: none; }
}
