/* Watching Paintings - website. Colours are the Roku app's. */

:root {
  --purple: #B46CFF;      /* artist, titles */
  --lilac: #CFA6FF;       /* title, list rows */
  --dim: #9A72D6;         /* date and source, hints */
  --mv: #C9A0FF;          /* movement line */
  --panel: rgba(14, 7, 22, 0.95);
  --rowFocus: #D9BEFF;
  --rowFocusText: #26083F;
  --band: rgba(0, 0, 0, 0.816);
  --cream: #D8CCA8;

  --padX: clamp(16px, 4.7vw, 90px);
  --fArtist: clamp(20px, min(2.2vw, 3.9vh), 46px);
  --fTitle: clamp(17px, min(1.75vw, 3.1vh), 36px);
  --fSmall: clamp(14px, min(1.4vw, 2.5vh), 28px);
  --fToast: clamp(16px, min(1.65vw, 2.9vh), 34px);
  --fRow: clamp(17px, min(1.6vw, 2.8vh), 32px);
  --rowH: clamp(46px, 5.6vh, 64px);
}

html, body {
  margin: 0;
  height: 100%;
  background: #000;
  overflow: hidden;
  overscroll-behavior: none;
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

[hidden] { display: none !important; }

button { font: inherit; }

/* ---------- the painting ---------- */

body.calm #stage { cursor: none; }

#stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  touch-action: none;
  background: #000;
  cursor: default;
}

#frame {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
  will-change: transform;
}

#frame img {
  position: absolute;
  display: block;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  -webkit-user-drag: none;
  user-select: none;
}

#frame img.detail {
  /* placed in painting coordinates by the script */
  width: auto;
  height: auto;
}

/* ---------- loading screen ---------- */

#splash {
  position: fixed;
  inset: 0;
  background: #0C0C0C;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 5;
}

.splash-box {
  width: min(91vw, 162vh);
  aspect-ratio: 1748 / 908;
  max-height: 84vh;
  border: clamp(3px, 0.6vw, 12px) solid var(--cream);
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.splash-words {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--cream);
  font-family: "Liberation Serif", "Times New Roman", Tinos, Georgia, serif;
  font-size: min(9vw, 11vh);
  line-height: 1.32;
}

.splash-words em { font-style: italic; }

#splashStatus {
  position: absolute;
  bottom: 4vh;
  left: 0;
  right: 0;
  text-align: center;
  color: var(--dim);
  font-size: var(--fSmall);
  white-space: pre-line;
  padding: 0 var(--padX);
}

/* ---------- caption and explanation ---------- */

#info {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 10;
  pointer-events: none;
}

#caption, #explain {
  background: var(--band);
  padding: clamp(10px, 2.2vh, 26px) var(--padX) clamp(12px, 2.6vh, 30px);
  pointer-events: none; /* taps go through to the painting, which decides what they do */
}

#artistLabel, #titleLabel, #dateLabel, #movementLabel, #explainTitle, #explainText { white-space: pre-wrap; }

#explain { padding-bottom: clamp(8px, 1.6vh, 20px); }

#artistLabel {
  color: var(--purple);
  font-weight: 700;
  font-size: var(--fArtist);
  line-height: 1.25;
}

#titleLabel {
  color: var(--lilac);
  font-size: var(--fTitle);
  line-height: 1.25;
  margin-top: 0.3em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

#dateLabel {
  color: var(--dim);
  font-size: var(--fSmall);
  margin-top: 0.55em;
}

#movementLabel {
  color: var(--mv);
  font-size: var(--fSmall);
  margin-top: 0.35em;
}

#movementLabel:empty { display: none; }

#explainTitle {
  color: var(--purple);
  font-weight: 700;
  font-size: var(--fTitle);
}

#explainText {
  color: var(--lilac);
  font-size: var(--fSmall);
  line-height: 1.35;
  margin-top: 0.5em;
  max-width: 76em;
}

/* ---------- messages ---------- */

#toast {
  position: fixed;
  left: calc(3.1vw + 30px);
  top: calc(5.5vh + 10px);
  max-width: 80vw;
  color: var(--purple);
  font-size: var(--fToast);
  text-shadow: 3px 3px 0 rgba(0, 0, 0, 0.69), 0 0 6px rgba(0, 0, 0, 0.6);
  z-index: 20;
  pointer-events: none;
  white-space: pre-wrap;
}

#note {
  position: fixed;
  left: 3.1vw;
  bottom: 4.6vh;
  max-width: min(68vw, 1300px);
  background: rgba(0, 0, 0, 0.784);
  padding: clamp(10px, 1.7vh, 18px) clamp(14px, 1.6vw, 30px);
  z-index: 15;
  pointer-events: none;
}

#noteLabel { color: var(--purple); font-size: var(--fTitle); }
#noteDetail { color: var(--dim); font-size: var(--fSmall); margin-top: 0.4em; }

/* ---------- menu button ---------- */

#menuBtn {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  width: clamp(44px, 5.4vh, 60px);
  height: clamp(44px, 5.4vh, 60px);
  border-radius: 50%;
  border: none;
  background: rgba(14, 7, 22, 0.72);
  color: var(--lilac);
  font-size: clamp(20px, 2.6vh, 28px);
  line-height: 1;
  cursor: pointer;
  z-index: 25;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s;
}

#menuBtn.show { opacity: 1; pointer-events: auto; }

/* ---------- panels: menu, favourites, browse ---------- */

#panelWrap {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.25);
}

#panel {
  background: var(--panel);
  width: min(94vw, 1400px);
  max-height: 90vh;
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  padding: clamp(14px, 2.6vh, 34px) clamp(14px, 3vw, 60px) clamp(12px, 2vh, 26px);
}

#panel.narrow { width: min(94vw, 960px); }

#panelHead {
  display: flex;
  align-items: center;
  gap: 12px;
}

#panelTitle {
  flex: 1;
  color: var(--purple);
  font-weight: 700;
  font-size: var(--fTitle);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: pre;
}

#panel.big #panelTitle { font-size: var(--fArtist); }

#panelHead button {
  flex: none;
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  color: var(--lilac);
  font-size: 26px;
  cursor: pointer;
  border-radius: 6px;
}

#panelHead button:hover, #panelHead button:focus-visible {
  background: var(--rowFocus);
  color: var(--rowFocusText);
  outline: none;
}

#panelBack { font-size: 34px !important; line-height: 1; }

#panelHint {
  color: var(--dim);
  font-size: var(--fSmall);
  margin: 0.4em 0 0.7em;
}

#panelHint:empty { display: none; }

#panelList {
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  flex: 1;
  min-height: 0;
}

.row {
  display: block;
  width: 100%;
  min-height: var(--rowH);
  box-sizing: border-box;
  padding: 0.35em 0.6em;
  margin: 0 0 4px;
  border: none;
  background: transparent;
  color: var(--lilac);
  font-size: var(--fRow);
  text-align: left;
  cursor: pointer;
  border-radius: 4px;
  line-height: 1.3;
  white-space: pre-wrap;
}

.row:focus { outline: none; }

.row:focus-visible, .row.kbd:focus, .row.sel {
  background: var(--rowFocus);
  color: var(--rowFocusText);
}

@media (hover: hover) {
  .row:hover { background: var(--rowFocus); color: var(--rowFocusText); }
}

.row.sep {
  cursor: default;
  color: var(--dim);
  text-align: center;
  pointer-events: none;
}

/* ---------- first visit ---------- */

#hint {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
}

#hintBox {
  background: var(--panel);
  width: min(92vw, 900px);
  box-sizing: border-box;
  padding: clamp(18px, 3.4vh, 40px) clamp(18px, 3.4vw, 54px);
}

#hintTitle {
  color: var(--purple);
  font-weight: 700;
  font-size: var(--fArtist);
  margin-bottom: 0.6em;
}

#hintText {
  color: var(--lilac);
  font-size: var(--fRow);
  line-height: 1.5;
}

#hintText div { margin: 0.25em 0; }

#hintGo {
  color: var(--dim);
  font-size: var(--fSmall);
  margin-top: 1.2em;
}
