/* Smart scheduling, Memories, People reminders, Share cards. */

/* ---------- smart scheduling (schedule.js) ---------- */
.sch { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.sch-sum { margin: 0; font-size: calc(15px * var(--text-k)); line-height: 1.4; overflow-wrap: anywhere; }
.sch-status:empty { display: none; }
.sch-status { margin: 0; }
.sch-edit > summary { cursor: pointer; color: var(--muted); font-size: calc(13px * var(--text-k)); padding: 4px 0; }
.sch-edit > summary:focus-visible { outline: 2px solid var(--a1); outline-offset: 2px; border-radius: 6px; }
.sch-fields { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.sch-fields .field { min-width: 0; }
.sch-split input { width: auto; min-height: 0; }
.sch-opts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.sch-opts[aria-busy="true"] { opacity: .55; }
.sch-opt { padding: 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.sch-opt.sch-top { border-color: var(--a1); box-shadow: var(--glow), var(--shadow); }
.sch-opt > .btn { align-self: flex-start; }
.sch-reason { margin: 0; font-size: calc(14px * var(--text-k)); line-height: 1.45; overflow-wrap: anywhere; }
.sch-lines { display: flex; flex-direction: column; gap: 6px; }
.sch-day { display: grid; grid-template-columns: minmax(0, 92px) minmax(0, 1fr); gap: 8px; align-items: center; }
.sch-day-label { display: flex; flex-direction: column; font: calc(11px * var(--text-k)) / 1.3 var(--mono); color: var(--muted); min-width: 0; }
.sch-day-label b { color: var(--text); }
.sch-bar { position: relative; height: 18px; border-radius: 6px; background: color-mix(in srgb, var(--text) 6%, transparent); overflow: hidden; }
.sch-bar i { position: absolute; top: 0; bottom: 0; }
.sch-free { background: color-mix(in srgb, var(--a1) 14%, transparent); }
.sch-bar .sch-busy { background: color-mix(in srgb, var(--text) 30%, transparent); top: 4px; bottom: 4px; border-radius: 3px; }
.sch-bar .sch-pinned { background: color-mix(in srgb, var(--a2) 45%, transparent); }
.sch-pick { background: linear-gradient(90deg, var(--a1), var(--a2)); border-radius: 4px; box-shadow: 0 0 calc(8px * var(--glow-k, 1)) var(--a1); }
.sch-scale { display: flex; justify-content: space-between; margin-left: 100px; font: calc(10px * var(--text-k)) var(--mono); color: var(--faint); }
.sch-foot { display: flex; gap: 8px; flex-wrap: wrap; justify-content: space-between; }
.sch-empty { padding: 14px; }
.sch-qa-hint { font-size: calc(13px * var(--text-k)); color: var(--a1); padding: 2px 4px; }
@media (max-width: 420px) { .sch-day { grid-template-columns: minmax(0, 76px) minmax(0, 1fr); } .sch-scale { margin-left: 84px; } }

/* ---------- Memories (memories.js) ---------- */
.mem-wait { background: linear-gradient(110deg, var(--glass) 30%, var(--glass-2) 50%, var(--glass) 70%); background-size: 200% 100%; animation: mem-shimmer 1.4s linear infinite; }
.mem-broken { opacity: .25; }
@keyframes mem-shimmer { to { background-position: -200% 0; } }
.mem-today-in { display: flex; gap: 16px; align-items: center; min-width: 0; }
.mem-today-pic { flex: none; width: 112px; height: 112px; padding: 0; border: 1px solid var(--edge); border-radius: 16px; overflow: hidden; cursor: pointer; background: var(--glass); box-shadow: var(--glow); }
.mem-today-pic img, .mem-tl-pic img, .mem-otd img, .mem-cell img, .mem-home-in img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mem-month { min-width: 9.5em; text-align: center; }
.mem-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.mem-wd { text-align: center; }
.mem-cell { position: relative; aspect-ratio: 1; padding: 0; border-radius: 10px; border: 1px solid var(--edge-2); background: var(--glass); overflow: hidden; cursor: pointer; color: var(--muted); min-width: 0; }
.mem-cell.blank { border: 0; background: none; cursor: default; }
.mem-cell:disabled { opacity: .35; cursor: default; }
.mem-cell:not(:disabled):hover { border-color: var(--a1); box-shadow: var(--glow); }
.mem-cell.today { border: 2px solid var(--a1); box-shadow: var(--glow); }
.mem-cell .mem-day { position: absolute; left: 5px; top: 3px; font-size: 11px; line-height: 1.2; }
.mem-cell.has .mem-day { color: #fff; text-shadow: 0 1px 4px rgb(0 0 0 / .8); }
.mem-cell .mem-mood { position: absolute; right: 3px; bottom: 1px; font-size: 13px; }
.mem-tl { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.mem-tl-head { margin-top: 6px; }
.mem-tl-item { display: flex; gap: 12px; align-items: flex-start; min-width: 0; }
.mem-tl-pic { flex: none; width: 72px; height: 72px; padding: 0; border-radius: 12px; border: 1px solid var(--edge-2); overflow: hidden; cursor: pointer; background: var(--glass); }
.mem-strip { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 4px; }
.mem-otd { flex: none; width: 104px; padding: 0; border: 0; background: none; cursor: pointer; display: flex; flex-direction: column; gap: 4px; scroll-snap-align: start; color: var(--muted); text-align: left; }
.mem-otd img { height: 104px; border-radius: 12px; border: 1px solid var(--edge); }
.mem-preview { display: grid; place-items: center; min-height: 140px; max-height: 42dvh; border-radius: 14px; border: 1px dashed var(--edge); overflow: hidden; background: var(--glass); }
.mem-preview img { width: 100%; max-height: 42dvh; object-fit: contain; display: block; }
.mem-pick { position: relative; }
.mem-pick:focus-within { outline: 2px solid var(--a1); outline-offset: 2px; }
.mem-moods .chip { font-size: 18px; padding: 4px 9px; }
.mem-home-in { display: flex; gap: 14px; align-items: center; width: 100%; padding: 0; border: 0; background: none; text-align: left; cursor: pointer; min-width: 0; }
.mem-home-in img { flex: none; width: 76px; height: 76px; border-radius: 14px; border: 1px solid var(--edge); }
.mem-clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 4px; }

/* viewer */
.mem-view { position: fixed; inset: 0; z-index: 80; display: flex; flex-direction: column; background: color-mix(in srgb, var(--bg) 94%, black); padding: calc(10px + env(safe-area-inset-top)) 12px calc(14px + env(safe-area-inset-bottom)); animation: fade .2s ease; }
.mem-view-bar { display: flex; gap: 8px; align-items: center; }
.mem-view-main { flex: 1; min-height: 0; display: flex; align-items: center; gap: 8px; margin: 10px 0; }
.mem-stage { flex: 1; min-width: 0; height: 100%; display: grid; place-items: center; touch-action: pan-y; transition: transform .2s; }
.mem-stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 14px; box-shadow: var(--glow), var(--shadow); user-select: none; -webkit-user-select: none; }
.mem-info { max-width: 720px; width: 100%; margin: 0 auto; }
@media (max-width: 640px) { .mem-nav { display: none; } }
body.mem-open, body.mem-reel-on { overflow: hidden; }

/* reel */
.mem-reel { position: fixed; inset: 0; z-index: 87; background: var(--bg); overflow: hidden; color: #fff; }
.mem-reel > .aurora { position: absolute; z-index: 0; }
body.mem-reel-on .mp-dock { z-index: 89; }
.mem-reel-bars { position: absolute; z-index: 3; left: 12px; right: 12px; top: calc(8px + env(safe-area-inset-top)); display: flex; gap: 4px; }
.mem-reel-bars span { flex: 1; height: 3px; border-radius: 3px; background: rgb(255 255 255 / .22); overflow: hidden; }
.mem-reel-bars i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--a1), var(--a2)); box-shadow: 0 0 8px var(--a1); }
.mem-reel-top { position: absolute; z-index: 3; left: 12px; right: 12px; top: calc(20px + env(safe-area-inset-top)); display: flex; gap: 8px; align-items: center; }
.mem-reel-top .btn { background: rgb(0 0 0 / .35); }
.mem-reel-stage { position: absolute; inset: 0; z-index: 1; cursor: pointer; }
.mem-slide { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 80px 24px calc(40px + env(safe-area-inset-bottom)); text-align: center; opacity: 0; transition: opacity .9s ease; }
.mem-slide.on { opacity: 1; }
.mem-slide h2 { font-size: clamp(32px, 8vw, 64px); line-height: 1.05; margin: 0; letter-spacing: -.02em; max-width: 16ch; }
.mem-orb { width: min(46vw, 240px); aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 35% 30%, var(--a3), var(--a1) 40%, var(--a2) 78%, transparent 80%);
  box-shadow: 0 0 calc(80px * var(--glow-k)) color-mix(in srgb, var(--a1) 60%, transparent); animation: breathe 4s ease-in-out infinite; }
.mem-slide-photo { padding: 0; justify-content: flex-end; }
.mem-blur { position: absolute; inset: -40px; background: center / cover no-repeat; filter: blur(30px) brightness(.45) saturate(1.3); }
.mem-kb { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; transform-origin: calc(50% + var(--kx)) calc(50% + var(--ky)); animation: mem-kb var(--kd, 4s) ease-out forwards; }
@keyframes mem-kb { from { transform: scale(1); } to { transform: scale(var(--ks, 1.1)) translate(var(--kx), var(--ky)); } }
.mem-cap { position: relative; z-index: 1; width: 100%; padding: 60px 22px calc(34px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, rgb(0 0 0 / .78)); display: flex; flex-direction: column; gap: 6px; align-items: flex-start; text-align: left; }
.mem-cap b { font-size: clamp(22px, 5vw, 34px); line-height: 1.15; text-shadow: 0 0 calc(18px * var(--glow-k)) color-mix(in srgb, var(--a1) 70%, transparent); }
.mem-cap p { margin: 0; font-size: 16px; max-width: 60ch; color: rgb(255 255 255 / .85); }
.mem-cap .label { color: var(--a3); }
.mem-story { font-size: clamp(20px, 4.4vw, 30px); line-height: 1.4; max-width: 30ch; min-height: 6em; margin: 0; text-align: left; }
.mem-story::after { content: "▍"; color: var(--a1); animation: blink 1s steps(1) infinite; }
.mem-reel.paused .mem-kb, .mem-reel.paused .mem-orb { animation-play-state: paused; }
.mem-reel.still .mem-kb, .mem-reel.still .mem-orb, .mem-reel.still .mem-story::after { animation: none; }
.mem-reel.still .mem-slide { transition-duration: .01s; }
:root[data-motion="calm"] .mem-kb, :root[data-motion="calm"] .mem-orb, :root[data-motion="calm"] .mem-wait, :root[data-motion="calm"] .mem-story::after { animation: none; }
:root[data-motion="calm"] .mem-slide { transition-duration: .01s; }

/* ---------- People reminders (people.js) ---------- */
.ppl-card { margin-bottom: var(--gap); }
.ppl-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 18px; }
.ppl-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.ppl-row { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 12px; cursor: pointer; min-width: 0; border: 1px solid transparent; }
.ppl-row:hover, .ppl-row:focus-visible { background: var(--glass-2); border-color: var(--edge-2); }
.ppl-count { flex: none; width: 46px; height: 46px; border-radius: 12px; display: grid; place-content: center; text-align: center; line-height: 1; border: 1px solid var(--edge); font-size: 20px; }
.ppl-count b { font: 700 18px var(--mono); }
.ppl-count small { font: 600 9px var(--mono); letter-spacing: .08em; color: var(--muted); text-transform: uppercase; }
.ppl-count.soon { background: linear-gradient(135deg, var(--a1), var(--a2)); border-color: transparent; color: var(--bg); box-shadow: var(--glow); }
.ppl-count.soon small { color: var(--bg); }
.ppl-rem { padding: 12px; border-radius: 14px; border: 1px solid var(--edge-2); background: var(--glass); }
.ppl-bday { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1fr) minmax(0, 1.3fr); gap: 8px; }
.ppl-bday > *, .ppl-rem select { min-width: 0; width: 100%; }
.ppl-due { color: var(--warn); }
.ppl-gifts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.ppl-gifts li { display: flex; gap: 8px; align-items: center; padding: 6px 10px; border-radius: 10px; background: var(--glass-2); font-size: calc(13.5px * var(--text-k)); }

/* ---------- Share cards (share.js) ---------- */
.shr-frame { border-radius: 16px; overflow: hidden; border: 1px solid var(--edge); background: var(--glass); aspect-ratio: 4 / 5; max-height: 56dvh; margin: 0 auto; width: min(100%, calc(56dvh * .8)); }
.shr-img { width: 100%; height: 100%; object-fit: contain; display: block; }
.shr-img:not([src]) { visibility: hidden; }
