/* [story] My Story: the milestone cinematic (letterbox, caption, subtitle, polaroid, the still card for reduced motion) and the phone's
   My Story app. Only linked with STORY_ON=1 (server.js adds it after mob-d.css). Phone held sideways: the html.h5 rules at the end. */

/* ---------------- while it plays: the HUD (and the phone HUD) steps aside ---------------- */
/* everything on screen but the 3D view and the cinematic itself: the HUD, the cards and chips, the name labels, the phone HUD (html.h5) */
html.story-on body > :not(#office):not(.st-ov):not(.st-pol):not(script), html.story-on #office > :not(canvas) { opacity: 0 !important; pointer-events: none !important; transition: opacity .45s ease !important; }

.st-ov { position: fixed; inset: 0; z-index: 2000; cursor: pointer; overflow: hidden; touch-action: none; -webkit-user-select: none; user-select: none; }
.st-dip { position: absolute; inset: 0; background: #120b06; opacity: 0; pointer-events: none; }
.st-ov.st-in .st-dip { animation: st-dip .9s ease forwards; }
@keyframes st-dip { 0% { opacity: 0; } 30% { opacity: .92; } 100% { opacity: 0; } }
.st-bar { position: absolute; left: 0; right: 0; height: 12vh; background: #0d0805; transition: transform .6s cubic-bezier(.2,.8,.2,1); }
.st-top { top: 0; transform: translateY(-100%); }
.st-bot { bottom: 0; transform: translateY(100%); }
.st-ov.st-in .st-top, .st-ov.st-in .st-bot { transform: none; }
.st-ov.st-out .st-top { transform: translateY(-100%); }
.st-ov.st-out .st-bot { transform: translateY(100%); }
.st-ov.st-out .st-cap, .st-ov.st-out .st-sub, .st-ov.st-out .st-skip { opacity: 0 !important; transition: opacity .2s ease !important; }
/* once it ends, the fading overlay and the flying polaroid let every tap through to the HUD underneath */
.st-ov.st-out, .st-ov.st-out *, .st-pol.st-fly { pointer-events: none !important; }

/* the caption in the top bar: My Story · the milestone · the day */
.st-cap { position: absolute; top: 0; left: 0; right: 0; height: 12vh; display: flex; align-items: center; justify-content: center; gap: 10px; color: #F6E7CF; opacity: 0; transition: opacity .6s ease .45s; font: 600 13px var(--body, system-ui); letter-spacing: .02em; }
.st-ov.st-in .st-cap { opacity: 1; }
.st-cap .st-ic { display: inline-flex; color: #E9A26F; }
.st-cap .st-k { text-transform: uppercase; letter-spacing: .14em; font-size: 12px; color: #E9A26F; }
.st-cap .st-t { font: 650 19px var(--display, Georgia, serif); color: #FFF7EA; }
.st-cap .st-d { font-size: 13px; color: #CDB8A0; }
.st-cap .st-k::after, .st-cap .st-t::after { content: '\00B7'; margin-left: 10px; color: #8C735B; }

/* the subtitle: the narrator's line, large, over the bottom bar */
.st-sub { position: absolute; left: 50%; bottom: calc(12vh + 18px); transform: translateX(-50%) translateY(8px); width: min(880px, 86vw); margin: 0; text-align: center;
  font: italic 500 clamp(19px, 2.6vw, 30px)/1.3 var(--display, Georgia, serif); color: #FFF7EA; text-shadow: 0 2px 4px rgba(0,0,0,.85), 0 0 22px rgba(0,0,0,.55); opacity: 0; transition: opacity .7s ease, transform .7s ease; }
.st-ov.st-talk .st-sub { opacity: 1; transform: translateX(-50%); }
.st-skip { position: absolute; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(12vh / 2 - 22px); min-width: 88px; min-height: 44px; border-radius: 22px; border: 1px solid rgba(246,231,207,.35);
  background: rgba(0,0,0,.25); color: #F6E7CF; font: 600 13px var(--body, system-ui); cursor: pointer; opacity: 0; transition: opacity .5s ease .9s; }
.st-skip::after { content: ' (Esc)'; color: #B9A288; font-weight: 500; }
.st-ov.st-in .st-skip { opacity: .85; }

/* the polaroid: drops in at the top right, develops, then flies to the Phone button */
.st-pol { position: absolute; top: calc(12vh + 14px); right: max(24px, env(safe-area-inset-right, 0px)); width: 190px; padding: 10px 10px 34px; background: #FFFDF8; border-radius: 3px;
  box-shadow: 0 14px 34px -10px rgba(0,0,0,.65); transform: translateY(-140%) rotate(-9deg); transition: transform .7s cubic-bezier(.2,.9,.25,1.15), opacity .8s ease; }
.st-pol img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; background: #2a2018; filter: brightness(2.2) saturate(0) blur(3px); transition: filter 1.6s ease .5s; }
.st-pol.st-in { transform: rotate(4deg); }
.st-pol.st-in img { filter: none; }
.st-pol .st-pt { position: absolute; left: 0; right: 0; bottom: 8px; text-align: center; font: italic 600 14px var(--display, Georgia, serif); color: #3A2A1D; }
.st-pol.st-fly { position: fixed; z-index: 2001; margin: 0; transition: transform .85s cubic-bezier(.55,0,.35,1), opacity .85s ease; }
#bPhone.st-ping, #h5Phone.st-ping { animation: st-ping .9s ease; }
@keyframes st-ping { 0%, 100% { transform: none; } 35% { transform: scale(1.18); box-shadow: 0 0 0 6px rgba(196,87,46,.35); } }

/* reduced motion: no bars, no camera, no flight; a still card fades in and out */
.st-ov.st-still { background: rgba(18,11,6,.55); opacity: 0; transition: opacity .6s ease; }
.st-ov.st-still.st-in { opacity: 1; }
.st-ov.st-still.st-out { opacity: 0; }
.st-ov.st-still .st-bar, .st-ov.st-still .st-dip { display: none; }
.st-ov.st-still .st-cap { position: absolute; top: 50%; left: 50%; right: auto; height: auto; width: min(520px, 86vw); transform: translate(-50%, -100%); flex-direction: column; gap: 6px; padding: 26px 24px 18px;
  background: #2B1D13; border-radius: 16px 16px 0 0; transition: none; }
.st-ov.st-still .st-cap .st-k::after, .st-ov.st-still .st-cap .st-t::after { content: none; }
.st-ov.st-still .st-cap .st-ic { width: 48px; height: 48px; border-radius: 50%; align-items: center; justify-content: center; background: linear-gradient(145deg, #c4572e, #1f7a72); color: #FFF7EA; }
.st-ov.st-still .st-sub { top: 50%; bottom: auto; transform: translateX(-50%); width: min(520px, 86vw); padding: 4px 24px 26px; box-sizing: border-box; background: #2B1D13; border-radius: 0 0 16px 16px;
  font-size: 20px; text-shadow: none; opacity: 1; transition: none; }
.st-ov.st-still .st-skip { bottom: 24px; transition: none; }
@media (prefers-reduced-motion: reduce) { .st-ov *, .st-ov { transition: none !important; animation: none !important; } }

/* ---------------- the My Story app ---------------- */
.st-app { max-width: 560px; }
.st-head { display: flex; align-items: center; gap: 12px; margin: -4px -4px 12px; padding: 16px; border-radius: 12px; color: #FFF7EA; background: linear-gradient(120deg, #a8401f 0%, #c4572e 35%, #1f7a72 100%); }
.st-head h2 { margin: 0; color: #FFF7EA; font: 650 22px var(--display, Georgia, serif); }
.st-head p { margin: 2px 0 0; font-size: 13px; opacity: .92; }
.st-hic { display: inline-flex; width: 48px; height: 48px; flex: 0 0 48px; border-radius: 12px; align-items: center; justify-content: center; background: rgba(255,247,234,.16); }
.st-narr { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 14px; }
.st-nl { font: 600 13px var(--body, system-ui); color: var(--dim, #6B5443); }
.st-seg { display: inline-flex; border: 1px solid var(--line-strong, #C9B596); border-radius: 22px; overflow: hidden; }
.st-sb { min-height: 36px; padding: 0 14px; border: 0; background: var(--btn-bg, #FFFDF8); color: var(--fg, #2A1C12); font: 600 13px var(--body, system-ui); cursor: pointer; }
.st-sb + .st-sb { border-left: 1px solid var(--line, #E3D4BC); }
.st-sb.on { background: var(--note, #A8401F); color: var(--ink, #FFFDF8); }
.st-tl { list-style: none; margin: 0 0 6px; padding: 0 0 0 18px; position: relative; }
.st-tl::before { content: ''; position: absolute; left: 6px; top: 6px; bottom: 6px; border-left: 2px dotted var(--line-strong, #C9B596); }
.st-it { position: relative; display: flex; gap: 14px; align-items: flex-start; padding: 10px 0 16px; cursor: pointer; }
.st-it::before { content: ''; position: absolute; left: -17px; top: 22px; width: 10px; height: 10px; border-radius: 50%; background: var(--note, #A8401F); box-shadow: 0 0 0 3px var(--surface, #FBF5EA); }
.st-it.old::before { background: var(--line-strong, #C9B596); }
.st-pic { flex: 0 0 104px; width: 104px; padding: 6px 6px 18px; background: #FFFDF8; border-radius: 3px; box-shadow: 0 6px 16px -6px rgba(58,34,16,.45); transform: rotate(-2deg); }
.st-it:nth-child(2n) .st-pic { transform: rotate(2deg); }
.st-pic img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }
.st-pic.drawn { display: flex; align-items: center; justify-content: center; aspect-ratio: 1 / 1.17; box-sizing: border-box; color: #FFF7EA; background: linear-gradient(145deg, #c4572e, #1f7a72); padding: 0; }
.st-it.old .st-pic.drawn { background: linear-gradient(145deg, #9a8670, #5d6e6b); }
.st-tx { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.st-day { font: 600 12px var(--body, system-ui); letter-spacing: .06em; text-transform: uppercase; color: var(--note-text, #A8401F); }
.st-it.old .st-day { color: var(--dim, #6B5443); }
.st-it-t { font: 650 17px var(--display, Georgia, serif); color: var(--fg, #2A1C12); }
.st-line { font: italic 500 15px/1.35 var(--display, Georgia, serif); color: var(--dim, #6B5443); }
.st-hear { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; min-height: 36px; padding: 0 12px; border-radius: 18px; border: 1px solid var(--line-strong, #C9B596);
  background: var(--btn-bg, #FFFDF8); color: var(--fg, #2A1C12); font: 600 13px var(--body, system-ui); cursor: pointer; }
.st-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 22px 12px; color: var(--dim, #6B5443); }
.st-empty b { font: 650 18px var(--display, Georgia, serif); color: var(--fg, #2A1C12); }
.st-eic { color: var(--note, #A8401F); }
.st-left { margin-top: 6px; }
.st-left h3 { margin: 0 0 8px; }
.st-lg { display: flex; flex-wrap: wrap; gap: 8px; }
.st-lc { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 16px; border: 1px dashed var(--line-strong, #C9B596); color: var(--dim, #6B5443); font: 500 13px var(--body, system-ui); }
.st-share { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; }

/* ---------------- a phone held sideways (html.h5, set by h5.js) ---------------- */
html.h5 .st-bar, html.h5 .st-cap { height: 15vh; }
html.h5 .st-cap { gap: 8px; font-size: 12px; }
html.h5 .st-cap .st-t { font-size: 16px; }
html.h5 .st-cap .st-d { display: none; }
html.h5 .st-sub { bottom: calc(15vh + 8px); width: min(640px, 72vw); font-size: 19px; }
html.h5 .st-skip { bottom: calc(15vh / 2 - 22px); }
html.h5 .st-pol { top: calc(15vh + 6px); width: 128px; padding: 7px 7px 26px; }
html.h5 .st-pol .st-pt { font-size: 12px; bottom: 6px; }
html.h5 .st-ov.st-still .st-cap { width: min(460px, 80vw); padding: 14px 18px 8px; }
html.h5 .st-ov.st-still .st-sub { width: min(460px, 80vw); padding: 2px 18px 16px; font-size: 17px; }
html.h5 .st-sb { min-height: 44px; }
html.h5 .st-hear { min-height: 44px; }
html.h5 .st-pic { flex-basis: 84px; width: 84px; }
html.h5 .st-head { padding: 10px 12px; }
html.h5 .st-head h2 { font-size: 18px; }
html.h5 .st-hic { width: 40px; height: 40px; flex-basis: 40px; }
html.h5 .st-cap .st-t::after { content: none; }
