/* THE LAST LECTURE: the menu of lecture rooms at the site's bare address (r32, r32b, 14 Oct 2569).
   A dark corridor of lecture room doors, turned like choosing a character in a game. Professor Prasert's door is
   open, its light on and rain tree flowers falling inside, his standee in front; the grey rooms wait for their
   lecturers. Choosing his door fills the screen with its light, then his lecture opens. One look on purpose: the wine
   of the sign in page and the event's posters, whatever the device's light or dark setting.
   One screen (r32d, as Alpha asked): the page fits the screen and never moves up and down, so a swipe sideways only
   turns the rooms. The rooms take the height the other parts leave them; on a shorter screen the quieter lines step
   aside first. Only a screen too short for the rooms (a phone turned sideways) scrolls up and down. */
@font-face { font-family: 'Bai Jamjuree'; src: url(/static/assets/fonts/BaiJamjuree-Regular.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Bai Jamjuree'; src: url(/static/assets/fonts/BaiJamjuree-Medium.woff2) format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Bai Jamjuree'; src: url(/static/assets/fonts/BaiJamjuree-SemiBold.woff2) format('woff2'); font-weight: 600; font-display: swap; }

:root {
  --wine: #3A0710;
  --night: #1E0308;
  --maroon: #791B2B;
  --rose: #6A1424;
  --gold: #BF9040;
  --gold-light: #E3C27A;
  --gold-pale: #F0D9A4;
  --cream: #F3E9D8;
  --cream-dim: rgba(243, 233, 216, .74);
  --light: #FFFBF2;
  --grey: #B9B5BC;
  /* a room's size: the drawing is 400 x 470. A browser that cannot measure the stage sizes the rooms by the screen;
     the others size them by the stage (below, the rooms fill the height the page leaves them) */
  --rw: min(84vw, calc(48svh * 400 / 470), 400px);
  --rh: calc(var(--rw) * 470 / 400);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
/* the page does not bounce or pull when a finger moves up and down: there is nothing above or below to show */
html { height: 100%; background: var(--night); overscroll-behavior: none; }
body {
  margin: 0;
  min-height: 100%;
  font-family: 'Bai Jamjuree', 'Noto Sans Thai', system-ui, sans-serif;
  color: var(--cream);
  background: radial-gradient(110% 80% at 50% 58%, var(--rose) 0%, var(--wine) 46%, var(--night) 100%) var(--night);
  overflow-x: hidden;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}

/* exactly the screen's height (the screen with the browser's bars showing); taller only when the parts cannot fit */
.hall {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(6px, 1.4vh, 16px);
  padding: max(18px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  overflow: hidden;
}

/* ---------------------------------------------------------------- the name of the series and the one instruction */
.hall-head { position: relative; z-index: 3; display: grid; justify-items: center; gap: 2px; text-align: center; }
.word { display: block; width: clamp(170px, 20vw, 260px); height: auto; filter: drop-shadow(0 6px 16px rgba(0, 0, 0, .35)); }
.hall-head h1 { margin: 6px 0 0; font-size: clamp(22px, 2.4vw, 30px); font-weight: 600; line-height: 1.25; color: var(--cream); text-wrap: balance; }
.lead { margin: 0; font-size: 15px; line-height: 1.5; color: var(--cream-dim); text-wrap: balance; }

/* ---------------------------------------------------------------- the rooms on their ring, the plate of the one in front */
.hall-head, .hall-foot { flex: none; }
.select { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: clamp(6px, 1.4vh, 14px); width: 100%;
  flex: 1 1 auto; min-height: 0; }
.pick { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; width: 100%; flex: 1 1 auto; min-height: 0; }
.stage {
  position: relative;
  z-index: 1;
  width: min(100%, 1040px);
  height: calc(var(--rh) + 26px);
  margin-top: 4px;
  touch-action: pan-y;               /* without the script the rooms stand still, and the page scrolls as usual */
  -webkit-user-select: none;
  user-select: none;
}
/* the rooms turn under the finger, and nothing else moves: no scrolling, no bounce (two fingers may still zoom) */
.stage.is-ring { touch-action: none; touch-action: pinch-zoom; }
/* a screen too short for the page (the script marks it, or a phone turned sideways below): up and down scrolls */
.scrolls .stage.is-ring { touch-action: pan-y; }
@supports (container-type: size) {
  /* the stage takes the height the other parts leave it, between a floor and the full size of a room; the rooms fill
     it. When even the floor does not fit, the page grows and scrolls instead of squeezing the rooms smaller */
  .stage {
    container-type: size;
    flex: 1 1 0;
    height: auto;
    min-height: 180px;
    max-height: calc(min(400px, 0.92 * min(100vw - 32px, 1040px)) * 470 / 400 + 26px);
  }
  .room, .turn {
    --rw: min(92cqw, calc((100cqh - 26px) * 400 / 470), 400px);
    --rh: calc(var(--rw) * 470 / 400);
  }
}
.ring { position: absolute; inset: 0; }
.room {
  position: absolute;
  left: 50%;
  bottom: 0;
  display: block;
  width: var(--rw);
  height: var(--rh);
  transform: translateX(-50%);
  transform-origin: 50% 100%;
  color: inherit;
  text-decoration: none;
  outline: none;
  border-radius: 20px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  opacity: calc(1 - var(--dim, 0) * .55);
}
.room.locked { cursor: default; }
.stage.is-ring .room { will-change: transform, opacity; }
.room:focus-visible { box-shadow: 0 0 0 3px var(--gold-light); }
.door-art { position: relative; display: block; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
/* the open room in layers: the light and the door drawn once, only the falling flowers drawn again and again */
.room .light, .room .petals-art { position: absolute; left: 0; top: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.room .light { will-change: opacity; animation: breathe 6s ease-in-out infinite; }
.room .standee { position: absolute; left: 56.69%; bottom: 5.11%; width: 20.63%; height: auto; pointer-events: none;
  filter: drop-shadow(0 0 5px rgba(255, 231, 176, .7)); will-change: transform; }

/* the logo's 137 lobe ring turns slowly behind the light of the open room */
.aura { position: absolute; left: 50%; top: 63.8%; width: 168%; aspect-ratio: 1; transform: translate(-50%, -50%); pointer-events: none;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 56%, transparent 78%); mask-image: linear-gradient(to bottom, #000 0%, #000 56%, transparent 78%); }
.aura svg { display: block; width: 100%; height: 100%; animation: turn 300s linear infinite; }
@keyframes turn { to { transform: rotate(360deg); } }

/* the light breathes, a little faster under the finger or the pointer */
@keyframes breathe { 0%, 100% { opacity: .7; } 50% { opacity: 1; } }
.room.open:hover .light, .room.open:focus-visible .light, .room.going .light { animation-duration: 2.4s; }

/* a waiting room tapped: it shakes its head */
.room.no .door-art { animation: no .42s ease-in-out; }
@keyframes no { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-7px); } 45% { transform: translateX(6px); } 70% { transform: translateX(-4px); } }

/* the arrows either side */
.turn {
  position: absolute;
  top: 52%;
  z-index: 200;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid rgba(227, 194, 122, .55);
  border-radius: 50%;
  background: rgba(42, 5, 12, .55);
  color: var(--gold-light);
  cursor: pointer;
  transform: translateY(-50%);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  transition: background .2s ease, border-color .2s ease;
}
.turn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.turn:hover { background: rgba(121, 27, 43, .8); border-color: var(--gold-light); }
.turn:focus-visible { outline: 3px solid var(--gold-light); outline-offset: 2px; }
.turn.prev { left: max(0px, calc(50% - var(--rw) / 2 - 150px)); }
.turn.next { right: max(0px, calc(50% - var(--rw) / 2 - 150px)); }

/* which room is in front, and the hint that the rooms turn */
.dots { position: relative; z-index: 2; display: flex; gap: 8px; align-items: center; justify-content: center; margin-top: 2px; }
.dots button { width: 9px; height: 9px; padding: 0; border: 0; border-radius: 999px; background: rgba(243, 233, 216, .35); cursor: pointer; transition: width .3s ease, background .3s ease; }
.dots button[aria-current="true"] { width: 26px; background: var(--gold-light); }
.dots button:focus-visible { outline: 2px solid var(--gold-light); outline-offset: 3px; }
.hint { position: relative; z-index: 2; display: inline-flex; align-items: center; gap: 10px; margin: 0; padding: 7px 14px; border-radius: 999px;
  background: rgba(243, 233, 216, .08); color: var(--cream); font-size: 13.5px; line-height: 1.3; transition: opacity .5s ease, transform .5s ease; }
.hint.gone { opacity: 0; transform: translateY(4px); pointer-events: none; }
.hint .swipe { position: relative; width: 34px; height: 12px; flex: none; }
.hint .swipe::before { content: ''; position: absolute; left: 2px; right: 2px; top: 5px; height: 2px; border-radius: 2px; background: rgba(227, 194, 122, .35); }
.hint .swipe i { position: absolute; top: 1px; left: 0; width: 10px; height: 10px; border-radius: 50%; background: var(--gold-light);
  box-shadow: 0 0 10px rgba(240, 210, 140, .8); animation: swipe 1.8s ease-in-out infinite; }
@keyframes swipe { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(24px); } }
.hint .t-mouse { display: none; }
@media (hover: hover) and (pointer: fine) { .hint .t-touch { display: none; } .hint .t-mouse { display: inline; } }

/* ---------------------------------------------------------------- the plate of the room in front */
/* the plate keeps one height whichever room is in front (the address keeps its place), so the rooms never resize */
.plate { position: relative; z-index: 2; display: grid; justify-items: center; gap: 1px; margin-top: 2px; text-align: center; }
.plate > * { transition: opacity .25s ease; }
.plate.swap > * { opacity: 0; }
.plate-date { font-size: 13.5px; font-weight: 600; color: var(--gold-light); }
.plate-name { font-size: clamp(20px, 2.1vw, 24px); font-weight: 600; line-height: 1.35; color: var(--light); text-wrap: balance; }
.plate-line { font-size: 15px; line-height: 1.5; color: var(--cream-dim); text-wrap: balance; }
.enter {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 12px 22px 12px 28px;
  border-radius: 999px;
  background: var(--gold-light);
  color: var(--wine);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  box-shadow: 0 0 0 1px rgba(255, 240, 200, .35) inset, 0 10px 28px rgba(0, 0, 0, .35), 0 0 34px rgba(240, 210, 140, .22);
  transition: background .2s ease, box-shadow .2s ease;
}
.enter svg { width: 18px; height: 18px; flex: none; transition: transform .25s ease; }
a.enter:hover, a.enter:focus-visible { background: var(--gold-pale); box-shadow: 0 0 0 1px rgba(255, 240, 200, .5) inset, 0 10px 28px rgba(0, 0, 0, .35), 0 0 46px rgba(240, 210, 140, .4); }
a.enter:hover svg, a.enter:focus-visible svg { transform: translateX(4px); }
a.enter:focus-visible { outline: 3px solid var(--gold-light); outline-offset: 3px; }
.enter.off { padding: 12px 24px; background: rgba(185, 181, 188, .16); color: var(--grey); box-shadow: 0 0 0 1px rgba(185, 181, 188, .35) inset; }
.enter.off svg { width: 17px; height: 17px; }
.addr { margin-top: 9px; font-size: 13px; letter-spacing: .02em; color: var(--cream-dim); }
.addr b { font-weight: 600; color: var(--gold-light); }
.addr.off { visibility: hidden; }

/* ---------------------------------------------------------------- the line of the event, quietly at the foot */
.hall-foot { position: relative; z-index: 1; margin-top: auto; padding-top: 8px; font-size: 11px; font-weight: 600; letter-spacing: .3em; text-align: center; text-wrap: balance; color: var(--gold); opacity: .9; }

/* ---------------------------------------------------------------- the light that fills the screen on the way in */
.flash {
  position: fixed;
  inset: 0;
  z-index: 1000;
  pointer-events: none;
  background: radial-gradient(circle at var(--x, 50%) var(--y, 60%), #FFFFFF 0, var(--light) 40%, #F7F1E4 100%);
  clip-path: circle(0 at var(--x, 50%) var(--y, 60%));
  transition: clip-path .62s cubic-bezier(.6, 0, .35, 1);
}
.flash.on { clip-path: circle(150vmax at var(--x, 50%) var(--y, 60%)); }

/* a wide screen: the rooms in the middle and the plate beside them, like choosing a character in a game */
@media (min-width: 1000px) {
  :root { --rw: min(calc(50svh * 400 / 470), 400px); }
  .word { width: clamp(140px, min(20vw, 30svh), 260px); }
  .select { display: grid; grid-template-columns: minmax(0, 1fr) 390px; grid-template-rows: minmax(0, 1fr); align-items: center; column-gap: 8px;
    width: min(100%, 1240px); margin-top: 6px; }
  .pick { min-width: 0; align-self: stretch; }
  .plate { justify-items: start; text-align: left; padding-left: 18px; border-left: 1px solid rgba(227, 194, 122, .28); }
  .plate-name { font-size: 25px; }
  .turn { width: 52px; height: 52px; }
}
@media (min-width: 1000px) and (max-height: 699px) {
  .hall-foot { display: none; }
}
/* a phone, or a window of middling height: the quieter lines step aside first, so the rooms keep their size */
@media (max-width: 999px) and (max-height: 759px) {
  .lead, .addr, .hall-foot { display: none; }
}
@media (max-width: 999px) and (max-height: 619px) {
  .word { width: 130px; }
  .hall-head h1 { font-size: 20px; margin-top: 2px; }
  .plate-line { display: none; }
  .hint { padding: 5px 12px; font-size: 13px; }
  .enter { margin-top: 8px; padding: 10px 20px 10px 24px; }
  .enter.off { padding: 10px 22px; }
}
/* a screen too short for the rooms (a phone turned sideways): the page scrolls up and down, and a finger on the rooms
   moving up and down scrolls it too */
@media (max-height: 479px) {
  :root { --rw: min(calc(70svh * 400 / 470), 330px); }
  .lead { display: none; }
  .stage.is-ring { touch-action: pan-y; }
}
@supports (container-type: size) {
  @media (max-height: 479px) {
    .stage { flex: none; height: calc(min(330px, 0.92 * min(100vw - 32px, 1040px), 70svh * 400 / 470) * 470 / 400 + 26px); }
  }
}
@media (max-width: 520px) {
  .hall { gap: 6px; padding-top: max(14px, env(safe-area-inset-top)); }
  .lead { font-size: 14.5px; }
  .enter { font-size: 16.5px; }
  .turn { width: 42px; height: 42px; top: 50%; }
  .turn.prev { left: -4px; }
  .turn.next { right: -4px; }
  .hall-foot { font-size: 10.5px; letter-spacing: .22em; }
}
@media (prefers-reduced-motion: reduce) {
  .aura svg, .room .light, .hint .swipe i { animation: none; }
  .flash, .hint, .plate > *, .dots button { transition: none; }
  .room.no .door-art { animation: none; }
}
