/* Watch a booking happen (templates/pages/watch.html + assets/js/story.js). Loaded only on that page.
   Colours and motion come from styles.css tokens; panels are frosted glass over the 3D view. */

.watch {
  position: relative; isolation: isolate; overflow: hidden;
  height: calc(100svh - var(--header-h) - env(safe-area-inset-top, 0px)); min-height: 36rem; max-height: 60rem;
  background: var(--navy); color: var(--white);
}
.watch__canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
.watch__canvas:active { cursor: grabbing; }
.watch :focus-visible { outline-color: var(--volt); }

/* Anything the script hides stays hidden, whatever display it normally has */
.watch [hidden] { display: none !important; }

/* The site's WhatsApp button would sit on top of Kasun's phone while the story is on screen */
body.watch-live .wa-float { opacity: 0; pointer-events: none; transition: opacity .2s ease; }

/* Frosted glass panels */
.glass {
  background: rgba(10, 23, 43, .72); color: var(--white);
  border: 1px solid rgba(255, 255, 255, .12); border-radius: 14px;
  box-shadow: 0 14px 34px -18px rgba(0, 0, 0, .6);
  -webkit-backdrop-filter: blur(14px) saturate(140%); backdrop-filter: blur(14px) saturate(140%);
}
@media (prefers-reduced-transparency: reduce) { .glass { background: rgba(10, 23, 43, .96); -webkit-backdrop-filter: none; backdrop-filter: none; } }

/* Intro and end cards */
.watch__intro, .watch__end {
  position: absolute; inset: 0; z-index: 9; display: grid; place-items: center; padding: 1.5rem var(--gutter);
  background: linear-gradient(180deg, rgba(10, 23, 43, .35), rgba(10, 23, 43, .7));
  transition: opacity .3s var(--ease-out);
}
.watch__intro.is-out, .watch__end.is-out { opacity: 0; pointer-events: none; }
.watch__intro-card, .watch__end-card { max-width: 34rem; text-align: center; }
.watch__kicker { display: inline-block; margin: 0 0 .75rem; padding: .25rem .8rem; border-radius: 999px; background: var(--volt); color: var(--navy); font-weight: 700; font-size: .85rem; letter-spacing: .04em; }
.watch__title {
  font-family: var(--font-display); font-style: var(--display-style); font-weight: var(--display-weight, 800);
  font-size: clamp(2rem, 1.2rem + 3.6vw, 3.6rem); line-height: 1.02; letter-spacing: -.01em; margin: 0 0 .9rem; text-wrap: balance;
  background: var(--silver); -webkit-background-clip: text; background-clip: text; color: transparent; padding-right: .12em; margin-right: -.12em;
}
.watch__sub { font-size: var(--fs-lead); color: var(--on-navy); margin: 0 auto 1.5rem; max-width: 40ch; }
.watch__hint { margin: 1.25rem 0 0; font-size: var(--fs-small); color: var(--on-navy-muted); }
.watch__end-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .75rem 1rem; }

/* Top bar */
.watch__top {
  position: absolute; z-index: 5; top: .75rem; left: .75rem; right: .75rem;
  display: flex; align-items: center; gap: .75rem 1rem; padding: .5rem .5rem .5rem .9rem; font-size: .92rem;
}
.watch__chapter { font-weight: 700; color: var(--volt); white-space: nowrap; }
.watch__clock { color: var(--on-navy); white-space: nowrap; }
.watch__tools { margin-left: auto; display: flex; gap: .35rem; }
.watch__tool {
  min-height: 2.25rem; padding: .35rem .8rem; border-radius: 999px; border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.06); color: var(--white); font-weight: 600; font-size: .85rem; cursor: pointer;
  transition: background-color .15s ease, transform var(--dur-press) var(--ease-out);
}
.watch__tool[aria-pressed="true"] { background: var(--volt); color: var(--navy); border-color: var(--volt); }
.watch__tool:active { transform: scale(.97); }
@media (hover: hover) and (pointer: fine) { .watch__tool:hover { background: rgba(255,255,255,.14); } .watch__tool[aria-pressed="true"]:hover { background: var(--volt-hi); } }

/* Tracker */
.watch__tracker {
  position: absolute; z-index: 5; left: .75rem; bottom: .75rem; list-style: none;
  display: flex; gap: .25rem; padding: .35rem; max-width: calc(100% - 1.5rem); overflow-x: auto; scrollbar-width: none;
}
.watch__tracker::-webkit-scrollbar { display: none; }
.watch__tracker button {
  display: inline-flex; align-items: center; gap: .45rem; min-height: 2.4rem; padding: .35rem .85rem .35rem .45rem; white-space: nowrap;
  border: 0; border-radius: 999px; background: transparent; color: var(--on-navy); font-weight: 600; font-size: .88rem; cursor: pointer;
  transition: background-color .15s ease, color .15s ease, transform var(--dur-press) var(--ease-out);
}
.watch__tracker button:active { transform: scale(.97); }
.watch__n { display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: 50%; background: rgba(255,255,255,.12); font-size: .78rem; font-family: var(--font-brand); font-style: italic; }
.watch__tracker .is-done { color: var(--white); }
.watch__tracker .is-done .watch__n { background: var(--volt); color: var(--navy); }
.watch__tracker .is-current { background: rgba(200, 242, 58, .16); color: var(--white); }
.watch__tracker .is-current .watch__n { background: var(--volt); color: var(--navy); }

/* Caption: top centre, where the eye goes first */
.watch__caption {
  position: absolute; z-index: 5; left: 50%; top: 4.25rem; transform: translateX(-50%); margin: 0;
  width: max-content; max-width: min(44rem, calc(100% - 1.5rem));
  padding: .8rem 1.2rem; font-size: 1.05rem; line-height: 1.45; text-align: center; text-wrap: pretty;
}

/* Chapter title: centre screen for a moment at each chapter start */
.watch__chaptertitle {
  position: absolute; z-index: 6; left: 50%; top: 42%; transform: translate(-50%, -50%);
  display: flex; align-items: center; gap: .9rem; pointer-events: none; opacity: 0;
}
.watch__chaptertitle.is-show { animation: chapter-title 2.6s var(--ease-out) both; }
.watch__chaptertitle-num {
  display: grid; place-items: center; width: 3.2rem; height: 3.2rem; border-radius: 50%; flex: none;
  background: var(--volt); color: var(--navy); font-family: var(--font-brand); font-style: italic; font-weight: 700; font-size: 1.6rem;
}
.watch__chaptertitle strong {
  font-family: var(--font-display); font-style: var(--display-style); font-weight: var(--display-weight, 800); font-size: clamp(2.4rem, 1.6rem + 4vw, 4.6rem); line-height: 1;
  color: var(--white); text-shadow: 0 6px 30px rgba(0,0,0,.55), 0 1px 2px rgba(0,0,0,.6);
}
@keyframes chapter-title { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.96); } 12% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -54%); } }

/* Promise ticks: bottom left, above the tracker */
.watch__promise {
  position: absolute; z-index: 5; bottom: 4.25rem; left: .75rem; list-style: none; padding: .5rem .25rem; margin: 0;
  display: grid; gap: .1rem; font-size: .82rem; max-width: 18rem;
}
.watch__promise li { display: flex; align-items: center; gap: .5rem; padding: .3rem .6rem; color: var(--on-navy-muted); opacity: .55; transition: opacity .3s var(--ease-out), color .3s ease; }
.watch__promise li::before { content: ""; flex: none; width: 1rem; height: 1rem; border-radius: 50%; border: 1.5px solid rgba(255,255,255,.35); }
.watch__promise li.is-on { opacity: 1; color: var(--white); }
.watch__promise li.is-on::before { border-color: var(--volt); background: var(--volt) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%230a172b' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 10.5 3.2 3.2L15 6.8'/%3E%3C/svg%3E") center / 70% no-repeat; }

/* Kasun's phone */
.watch__phone { position: absolute; z-index: 5; right: .75rem; top: 4.25rem; bottom: .75rem; width: 19rem; display: grid; align-content: end; gap: .4rem; }
.watch__phonelabel { margin: 0; text-align: center; font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--volt); text-shadow: 0 1px 2px rgba(0,0,0,.6); }
.phone.is-new { animation: phone-new .8s var(--ease-out); }
@keyframes phone-new { 0% { transform: translateY(10px) scale(.97); box-shadow: 0 0 0 0 rgba(200,242,58,.9), 0 24px 50px -24px rgba(0,0,0,.7); } 100% { transform: none; box-shadow: 0 0 0 14px rgba(200,242,58,0), 0 24px 50px -24px rgba(0,0,0,.7); } }
.phone {
  position: relative; width: 100%; max-height: 100%; min-height: 24rem; border-radius: 26px; overflow: hidden;
  background: var(--white); color: var(--ink); border: 6px solid #0b1424; box-shadow: 0 24px 50px -24px rgba(0,0,0,.7);
}
.phone__status { display: flex; justify-content: space-between; padding: .5rem .9rem; background: var(--navy); color: var(--volt); font-weight: 700; font-size: .78rem; }
.screen { position: absolute; inset: 2.1rem 0 0; padding: .9rem; opacity: 0; transform: translateY(8px); transition: opacity var(--dur-ui) var(--ease-out), transform var(--dur-ui) var(--ease-out); pointer-events: none; font-size: .86rem; }
.screen.is-on { position: relative; opacity: 1; transform: none; }
.screen__h { font-family: var(--font-display); font-style: var(--display-style); font-weight: 700; font-size: 1.1rem; margin: 0 0 .35rem; line-height: 1.2; }
.screen__meta { margin: 0 0 .75rem; color: var(--muted); font-size: .82rem; }
.screen__search { display: flex; align-items: center; gap: .5rem; padding: .55rem .75rem; border: 1.5px solid #c3cad6; border-radius: 10px; margin-bottom: .6rem; }
.screen__chips { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: .7rem; }
.screen__chips span { padding: .2rem .6rem; border-radius: 999px; background: var(--navy); color: var(--white); font-size: .72rem; font-weight: 600; }
.screen__result { display: flex; align-items: flex-start; gap: .6rem; padding: .55rem .6rem; border-radius: 10px; border: 1.5px solid #e3e5e9; margin-bottom: .45rem; }
.screen__result.is-pick { border-color: var(--navy); background: var(--paper); }
.screen__result div { display: grid; gap: .05rem; min-width: 0; flex: 1; }
.screen__result strong { font-size: .88rem; line-height: 1.2; }
.screen__result small { color: var(--muted); font-size: .74rem; line-height: 1.3; }
.screen__avatar { flex: none; width: 2rem; height: 2rem; border-radius: 50%; display: grid; place-items: center; background: var(--volt); color: var(--navy); font-family: var(--font-brand); font-style: italic; font-weight: 700; }
.screen__badge { flex: none; align-self: center; padding: .15rem .5rem; border-radius: 999px; background: #e7f6e7; color: #006300; font-size: .7rem; font-weight: 700; white-space: nowrap; }
.screen__badge--held { white-space: normal; display: inline-block; margin: .4rem 0; }
.screen__cta { margin-top: .5rem; padding: .65rem; border-radius: 10px; background: var(--volt); color: var(--navy); font-weight: 700; text-align: center; }
.screen__slots { display: flex; gap: .4rem; margin-bottom: .6rem; }
.screen__slots span { flex: 1; text-align: center; padding: .55rem 0; border-radius: 9px; border: 1.5px solid #e3e5e9; font-weight: 600; }
.screen__slots .is-on { background: var(--volt); border-color: var(--volt); color: var(--navy); }
.screen__hold { display: flex; justify-content: space-between; gap: .5rem; margin: 0 0 .5rem; padding: .5rem .6rem; border-radius: 9px; background: #fff4d6; color: #5c4200; font-size: .78rem; }
.screen__lines { display: grid; grid-template-columns: 1fr auto; gap: .35rem .75rem; margin: 0 0 .6rem; }
.screen__lines dd { margin: 0; text-align: right; }
.screen__lines .is-total { font-weight: 700; padding-top: .35rem; border-top: 1px solid #e3e5e9; }
.screen__done { display: grid; gap: .3rem; margin-top: .6rem; padding: .7rem; border-radius: 10px; background: #e7f6e7; color: #145c35; }
.screen__done small { color: #2f6b45; }
.screen__notice { display: grid; gap: .2rem; padding: .7rem; border-radius: 12px; background: var(--navy); color: var(--white); margin-bottom: .6rem; }
.screen__notice span { color: var(--on-navy); font-size: .8rem; }
.screen__link { color: var(--volt) !important; font-weight: 700; }
.screen__status { list-style: none; display: grid; gap: .35rem; }
.screen__status li { padding: .45rem .6rem; border-radius: 9px; background: var(--paper); }
.screen__timer { display: flex; justify-content: space-between; align-items: baseline; margin: 0 0 .6rem; padding: .6rem .7rem; border-radius: 10px; background: var(--navy); color: var(--on-navy); }
.screen__timer strong { font-size: 1.5rem; color: var(--volt); }
.screen__stars { display: flex; gap: .25rem; font-size: 1.8rem; color: #d3d7de; margin: .25rem 0 .6rem; }
.screen__stars .is-on { color: #eda100; }
.screen__quote { margin: 0 0 .5rem; font-style: italic; }
[data-screen] [hidden] { display: none; }

/* Detail card and camera button */
.watch__card { position: absolute; z-index: 7; left: .75rem; top: 4.25rem; width: min(22rem, calc(100% - 1.5rem)); padding: .9rem 2.4rem .9rem 1rem; }
.watch__card h3 { margin: 0 0 .3rem; font-family: var(--font-display); font-style: var(--display-style); font-size: 1.15rem; color: var(--volt); }
.watch__card p { margin: 0; font-size: .9rem; color: var(--on-navy); }
.watch__close { position: absolute; top: .4rem; right: .4rem; width: 2rem; height: 2rem; border: 0; border-radius: 50%; background: rgba(255,255,255,.1); color: var(--white); font-size: 1.2rem; cursor: pointer; }
.watch__followcam { position: absolute; z-index: 5; left: 50%; bottom: 4rem; transform: translateX(-50%); }
.watch__backstory { position: absolute; z-index: 7; left: .75rem; bottom: .75rem; }

/* Floating labels */
.watch__labels { position: absolute; inset: 0; z-index: 3; pointer-events: none; overflow: hidden; }
.watch__label {
  position: absolute; left: 0; top: 0; transform: translate(-50%, -100%); white-space: nowrap;
  padding: .2rem .55rem; border-radius: 999px; background: rgba(10,23,43,.78); color: var(--white); font-size: .74rem; font-weight: 600;
  border: 1px solid rgba(255,255,255,.14); transition: opacity .2s ease;
}
.watch__label.is-hot { background: var(--volt); color: var(--navy); border-color: var(--volt); }
.watch__label.is-hidden { opacity: 0; }

.watch__nowebgl { position: absolute; inset: 0; z-index: 8; display: grid; place-items: center; align-content: center; gap: 1rem; padding: 2rem var(--gutter); text-align: center; background: var(--navy); }

/* Phones: the phone becomes a bottom sheet, the promise list goes */
/* Phones: a split screen instead of panels over the city.
   Rows: top bar, caption, the 3D view, Kasun's phone, the chapter tracker. The labels, chapter title,
   detail card and camera button share the 3D view's row, so they only ever sit over the city. */
@media (max-width: 52rem) {
  .watch {
    height: calc(100svh - var(--header-h)); min-height: 34rem; max-height: none;
    display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(10rem, 1fr) auto auto;
    gap: .4rem; padding: .4rem .5rem .5rem;
  }
  .watch > .watch__top, .watch > .watch__caption, .watch > .watch__phone, .watch > .watch__tracker,
  .watch > .watch__canvas, .watch > .watch__labels, .watch > .watch__chaptertitle, .watch > .watch__card, .watch > .watch__followcam {
    position: relative; inset: auto; left: auto; right: auto; top: auto; bottom: auto; transform: none; width: auto; max-width: none;
  }
  .watch__top { grid-row: 1; font-size: .84rem; gap: .5rem; }
  .watch__clock { display: none; }
  .watch__caption { grid-row: 2; font-size: .86rem; padding: .5rem .8rem; text-align: left; }
  .watch > .watch__canvas { grid-row: 3; grid-column: 1; width: 100%; height: 100%; min-width: 0; min-height: 0; border-radius: 14px; }
  .watch > .watch__labels { grid-row: 3; grid-column: 1; overflow: hidden; border-radius: 14px; }
  .watch__chaptertitle { grid-row: 3; grid-column: 1; place-self: center; }
  .watch__chaptertitle.is-show { animation-name: chapter-title-sm; }
  .watch__chaptertitle strong { font-size: 2.4rem; }
  .watch__chaptertitle-num { width: 2.6rem; height: 2.6rem; font-size: 1.3rem; }
  .watch__card { grid-row: 3; grid-column: 1; align-self: end; margin: .5rem; width: auto; }
  .watch__followcam { grid-row: 3; grid-column: 1; align-self: start; justify-self: center; margin-top: .5rem; }
  .watch__promise { display: none; }
  .watch__phone { grid-row: 4; display: block; }
  .watch__phonelabel { display: none; }
  .phone { min-height: 0; height: 15.5rem; max-height: 34svh; overflow-y: auto; border-width: 0; border-radius: 14px; overscroll-behavior: contain; }
  .phone__status { position: sticky; top: 0; z-index: 1; }
  .screen { inset: 2rem 0 0; font-size: .82rem; padding: .6rem .75rem .75rem; }
  .screen__result { padding: .45rem .55rem; margin-bottom: .35rem; }
  .watch__tracker { grid-row: 5; max-width: none; }
  .watch__tracker button { padding-right: .6rem; font-size: .82rem; }
  .watch__label { font-size: .68rem; }
  .watch__backstory { left: .5rem; bottom: .5rem; }
  .watch__intro, .watch__end { background: rgba(10, 23, 43, .9); }
  .watch__intro { background: linear-gradient(180deg, rgba(10, 23, 43, .45), rgba(10, 23, 43, .8)); }
}
@keyframes chapter-title-sm { 0% { opacity: 0; transform: scale(.96); } 12% { opacity: 1; transform: none; } 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(-6px); } }
@media (prefers-reduced-motion: reduce) {
  .screen, .watch__intro, .watch__end, .watch__label, .watch__promise li { transition: none; }
  .watch__chaptertitle.is-show { animation: none; opacity: 1; }
  .phone.is-new { animation: none; }
}
