/* Room landing pages (/rooms/<slug>/), in the look of the skill pages
   (/people-finder, /viral-video): a centred hero, round sky-blue glass buttons,
   a window with a navy command bar that stays light in dark mode, and the
   Rooms app's member avatars. Loads after /styles.css, which brings the
   header, fonts and the light/dark tokens. */
.room { --room-w: 1080px; --sec: clamp(56px, 7vw, 96px); overflow-x: clip; }
.room-wrap { width: 100%; max-width: var(--room-w, 1080px); margin: 0 auto; padding-inline: max(16px, env(safe-area-inset-left, 0px)); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
.room :is(h1, h2, h3, p, figure, blockquote) { margin: 0; }
.room :is(h1, h2) { font-family: var(--font-display); font-weight: var(--display-weight, 300); color: var(--display); letter-spacing: -0.02em; text-wrap: balance; }
.room h2 { font-size: clamp(30px, 4vw, 48px); line-height: 1.1; text-align: center; }
.room h3 { font-family: var(--font-display); font-weight: 400; color: var(--ink); letter-spacing: -0.01em; }
.room a:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 3px; }
.room section { padding-block: var(--sec); }
.room section + section { border-top: 0; }
/* A header link lands its heading about 24px under the sticky header: the
   section's own top padding is taken back off the site's 72px scroll margin. */
.room section[id] { scroll-margin-top: calc(84px - var(--sec)); }
.room .room-hero { scroll-margin-top: 0; }
.room .room-lede { max-width: 620px; margin: 16px auto 0; text-align: center; font-size: 17px; line-height: 1.55; color: var(--muted); text-wrap: pretty; }
.room-band { background: var(--canvas-subtle); }
:root[data-theme="dark"] .room-band { --muted: #A08AB4; background: linear-gradient(180deg, var(--canvas) 0%, #141A3C 22%, #141A3C 78%, var(--canvas) 100%); }

/* ---------- buttons: fully round, sky-blue glass with a soft glow, as on the skill pages ---------- */
.room .btn, .site-header .btn { border-radius: 999px; }
.room .btn { min-height: 48px; }
.room .btn-primary, .site-header .btn-primary {
  background: linear-gradient(180deg, rgba(214, 242, 255, .96), rgba(143, 211, 255, .88));
  color: #12061A; border: 1px solid rgba(255, 255, 255, .6);
  -webkit-backdrop-filter: blur(12px) saturate(140%); backdrop-filter: blur(12px) saturate(140%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .75), inset 0 -1px 0 rgba(45, 16, 67, .08), 0 6px 18px rgba(110, 190, 255, .30), 0 0 28px rgba(174, 229, 255, .28);
}
.room .btn-ghost {
  background: rgba(174, 229, 255, .08); color: var(--ink); border: 1px solid rgba(174, 229, 255, .34);
  -webkit-backdrop-filter: blur(12px) saturate(140%); backdrop-filter: blur(12px) saturate(140%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12);
}
:root[data-theme="light"] :is(.room, .site-header) .btn-primary { border-color: rgba(60, 140, 210, .30); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8), 0 6px 18px rgba(70, 160, 235, .28), 0 0 28px rgba(143, 211, 255, .35); }
:root[data-theme="light"] .room .btn-ghost { background: rgba(174, 229, 255, .20); color: #12061A; border-color: rgba(60, 140, 210, .30); }
@media (hover: hover) and (pointer: fine) {
  .room .btn, .site-header .btn-primary { transition: background-color .25s ease, box-shadow .25s ease, transform .2s ease; }
  :is(.room, .site-header) .btn-primary:hover { background: linear-gradient(180deg, rgba(226, 246, 255, 1), rgba(160, 219, 255, .94)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .85), inset 0 -1px 0 rgba(45, 16, 67, .08), 0 8px 22px rgba(110, 190, 255, .38), 0 0 40px rgba(174, 229, 255, .42); transform: translateY(-1px); }
  .room .btn-ghost:hover { background: rgba(174, 229, 255, .16); }
  .room-text-link:hover, .room-footer a:hover { text-decoration: underline; text-underline-offset: 4px; }
}
.room-ctas { position: relative; isolation: isolate; display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 26px; }
.room-ctas::before { content: ""; position: absolute; z-index: -1; left: 50%; top: 50%; width: min(560px, 100%); height: 140px; transform: translate(-50%, -50%); background: radial-gradient(closest-side, rgba(143, 211, 255, .26), rgba(143, 211, 255, 0)); pointer-events: none; }
.room-text-link { color: var(--accent-text); font-size: 15px; text-decoration: none; }

/* ---------- hero ---------- */
.room .room-hero { padding: clamp(40px, 6vw, 72px) 0 var(--sec); text-align: center; }
.room-hero h1 { max-width: 980px; margin: 0 auto; font-size: clamp(38px, 5.4vw, 72px); line-height: 1.05; }
/* The subtitle keeps the look of Marco's first draft: smaller, tighter, lavender. */
.room-hero h1 .room-l2 { display: block; margin-top: 12px; color: #b9a0ef; font-size: clamp(23px, 3vw, 39px); font-weight: 400; line-height: 1.1; letter-spacing: -0.04em; }
:root[data-theme="light"] .room-hero h1 .room-l2 { color: #7B5BC4; }
.room .room-hero .room-lede { max-width: 640px; font-size: clamp(16px, 1.4vw, 19px); color: var(--body); }

/* ---------- the room window: a room as the Rooms app shows it (RoomHeader.tsx:
   title, facts, tabs; the discussion as gradient-avatar messages), light in both
   follows the page theme the way the app does ---------- */
.room-window { max-width: 960px; margin: 40px auto 0; overflow: hidden; text-align: left; border: 1px solid var(--hairline); border-radius: 16px; background: var(--card); color: var(--body); box-shadow: 0 1px 2px rgba(18, 6, 26, .06), 0 24px 60px rgba(45, 16, 67, .16); }
.room-app-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 20px clamp(16px, 3vw, 28px) 12px; }
.room-app-name { color: var(--display); font: 400 clamp(20px, 2.4vw, 26px)/1.2 var(--font-display); letter-spacing: -0.01em; }
.room-app-facts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 6px; color: var(--muted); font-size: 13px; }
.room-app-facts .room-stack { --size: 20px; }
.room-live { display: inline-flex; align-items: center; gap: 6px; color: #059669; }
:root[data-theme="dark"] .room-live { color: #6EE7B7; }
.room-more-count { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; margin-left: -5px; padding: 0 5px; border-radius: 999px; background: var(--tonal); box-shadow: 0 0 0 2px var(--card); color: var(--ink); font-size: 10px; font-weight: 600; }
.room-live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #10B981; box-shadow: 0 0 0 0 rgba(16, 185, 129, .45); }
.room-tabs { display: flex; gap: 22px; padding: 0 clamp(16px, 3vw, 28px); border-bottom: 1px solid var(--hairline); color: var(--muted); font-size: 14px; overflow: hidden; white-space: nowrap; }
.room-tabs span { padding: 8px 0 10px; border-bottom: 2px solid transparent; }
.room-tabs .is-on { color: var(--ink); border-bottom-color: var(--accent-text); }
.room-tabs b { margin-left: 4px; padding: 1px 6px; border-radius: 999px; background: var(--state-hover); color: var(--muted); font-size: 11px; font-weight: 500; }
.room-composer { margin-top: 4px; padding: 10px 14px; border-radius: var(--radius-ctl); background: var(--canvas-subtle); color: var(--muted); font-size: 13px; }
.room-body { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
.room-feed { display: flex; flex-direction: column; gap: 14px; margin: 0; padding: clamp(18px, 2.5vw, 24px) clamp(16px, 3vw, 28px); list-style: none; border-right: 1px solid var(--hairline); }
.room-msg { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; position: relative; }
/* "Typing…": the agent's three dots, in the slot its message then takes. */
.room-typing { position: absolute; top: 0; left: 38px; display: none; gap: 4px; padding: 9px 12px; border-radius: 12px; background: var(--state-hover); }
.room-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.room-msg .room-avatar { --size: 28px; }
.room-msg-head { display: flex; align-items: baseline; gap: 8px; }
.room-msg-head strong { color: var(--ink); font-size: 14px; font-weight: 600; }
.room-msg-head b { display: inline-grid; place-items: center; min-width: 20px; height: 20px; border-radius: 6px; background: var(--accent-subtle); color: var(--accent-text); font: 600 11px/1 var(--font-mono); }
.room-msg p:last-child { margin-top: 2px; color: var(--body); font-size: 14px; line-height: 1.45; }
.room-stack { display: inline-flex; }
.room-stack .room-avatar + .room-avatar { margin-left: calc(var(--size, 32px) * -.25); }
.room-stack .room-avatar { --size: inherit; }

/* The Rooms app's member avatar: a gradient disc with one white letter, ringed
   in the surface colour. data-g picks the member's gradient, the same one the
   app gives them (AVATAR_GRADIENTS in frontend/src/console/RoomList.tsx, by a
   hash of their subject id); tests/test_room_atlas.py keeps the list equal. */
.room-avatar { --size: 32px; display: inline-flex; flex: none; align-items: center; justify-content: center; width: var(--size); height: var(--size); border-radius: 50%; background: linear-gradient(135deg, var(--from), var(--to)); box-shadow: 0 0 0 2px var(--card); color: #fff; font: 600 calc(var(--size) * .42)/1 var(--font-body); user-select: none; }
.room-avatar[data-g="0"] { --from: #8B5CF6; --to: #D946EF; }
.room-avatar[data-g="1"] { --from: #0EA5E9; --to: #6366F1; }
.room-avatar[data-g="2"] { --from: #10B981; --to: #0D9488; }
.room-avatar[data-g="3"] { --from: #F59E0B; --to: #EA580C; }
.room-avatar[data-g="4"] { --from: #F43F5E; --to: #DB2777; }
.room-avatar[data-g="5"] { --from: #06B6D4; --to: #2563EB; }
.room-avatar[data-g="6"] { --from: #65A30D; --to: #15803D; }
.room-avatar[data-g="7"] { --from: #FB923C; --to: #DC2626; }
.room-avatar.is-lg { --size: 56px; }
.room-person { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.room-person strong { display: block; color: var(--ink); font-weight: 600; line-height: 1.3; }
.room-person small { color: var(--muted); font-size: 13px; }

.room-route { padding: clamp(18px, 2.5vw, 24px) clamp(16px, 3vw, 28px); background: var(--canvas-subtle); }
.room-route figcaption { margin-bottom: 14px; color: var(--muted); font: 500 12px/1.4 var(--font-body); letter-spacing: .04em; text-transform: uppercase; }
.room-route ol { display: grid; grid-template-columns: minmax(96px, .9fr) minmax(110px, 1fr); align-items: center; gap: 10px 14px; margin: 0; padding: 0; list-style: none; }
.room-route li { display: contents; }
.route-state { grid-column: 2; padding: 6px; border: 1px solid var(--hairline); border-radius: 10px; background: var(--card); color: var(--ink); text-align: center; white-space: nowrap; font: 500 clamp(15px, 1.8vw, 20px)/1.3 var(--font-mono); letter-spacing: .08em; }
.route-end { border-color: rgba(60, 140, 210, .45); background: var(--chosen); }
.route-move { grid-column: 1; color: var(--body); font-size: 13px; line-height: 1.25; }
.route-move b { display: inline-grid; place-items: center; min-width: 20px; height: 20px; margin-right: 6px; border-radius: 6px; background: var(--accent-subtle); color: var(--accent-text); font: 600 11px/1 var(--font-mono); }

/* The window plays the route on a loop from the starting row: each message
   is typed, then posts one move as its row appears on the right, the sorted row lights up, then the room resets. Only
   transform and opacity move; with reduced motion everything simply shows. */
@media (prefers-reduced-motion: no-preference) {
  .room-typing { display: inline-flex; }
  .room-typing i { animation: room-dot 1s ease-in-out infinite; }
  .room-typing i:nth-child(2) { animation-delay: .15s; }
  .room-typing i:nth-child(3) { animation-delay: .3s; }
  .room-msg:nth-child(1) .room-avatar { animation: room-who1 11s cubic-bezier(.2, .8, .2, 1) infinite both; }
  .room-msg:nth-child(2) .room-avatar { animation: room-who2 11s cubic-bezier(.2, .8, .2, 1) infinite both; }
  .room-msg:nth-child(3) .room-avatar { animation: room-who3 11s cubic-bezier(.2, .8, .2, 1) infinite both; }
  .room-msg:nth-child(1) .room-typing { animation: room-type1 11s linear infinite both; }
  .room-msg:nth-child(2) .room-typing { animation: room-type2 11s linear infinite both; }
  .room-msg:nth-child(3) .room-typing { animation: room-type3 11s linear infinite both; }
  .room-msg:nth-child(1) > div, .room-route li:nth-child(2) > * { animation: room-step2 11s cubic-bezier(.2, .8, .2, 1) infinite both; }
  .room-msg:nth-child(2) > div, .room-route li:nth-child(3) > * { animation: room-step3 11s cubic-bezier(.2, .8, .2, 1) infinite both; }
  .room-msg:nth-child(3) > div, .room-route li:nth-child(4) > * { animation: room-step4 11s cubic-bezier(.2, .8, .2, 1) infinite both; }
  .route-end { animation: room-step4 11s cubic-bezier(.2, .8, .2, 1) infinite both, room-solved 11s ease-out infinite both; }
  .room-live::before { animation: room-pulse 2s ease-out infinite; }
}
@keyframes room-who1 { 0% { opacity: 0; transform: translateY(8px); } 3%, 88% { opacity: 1; transform: none; } 94%, 100% { opacity: 0; transform: none; } }
@keyframes room-who2 { 0%, 14% { opacity: 0; transform: translateY(8px); } 17%, 88% { opacity: 1; transform: none; } 94%, 100% { opacity: 0; transform: none; } }
@keyframes room-who3 { 0%, 33% { opacity: 0; transform: translateY(8px); } 36%, 88% { opacity: 1; transform: none; } 94%, 100% { opacity: 0; transform: none; } }
@keyframes room-type1 { 0%, 3% { opacity: 0; } 4%, 8% { opacity: 1; } 9%, 100% { opacity: 0; } }
@keyframes room-type2 { 0%, 16% { opacity: 0; } 17%, 27% { opacity: 1; } 28%, 100% { opacity: 0; } }
@keyframes room-type3 { 0%, 35% { opacity: 0; } 36%, 46% { opacity: 1; } 47%, 100% { opacity: 0; } }
@keyframes room-step2 { 0%, 8% { opacity: 0; transform: translateY(8px); } 13%, 88% { opacity: 1; transform: none; } 94%, 100% { opacity: 0; transform: none; } }
@keyframes room-step3 { 0%, 27% { opacity: 0; transform: translateY(8px); } 32%, 88% { opacity: 1; transform: none; } 94%, 100% { opacity: 0; transform: none; } }
@keyframes room-step4 { 0%, 46% { opacity: 0; transform: translateY(8px); } 51%, 88% { opacity: 1; transform: none; } 94%, 100% { opacity: 0; transform: none; } }
@keyframes room-solved { 0%, 52% { box-shadow: 0 0 0 0 rgba(70, 160, 235, .5); } 62%, 100% { box-shadow: 0 0 0 12px rgba(70, 160, 235, 0); } }
@keyframes room-dot { 0%, 80%, 100% { opacity: .35; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@keyframes room-pulse { 0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, .45); } 100% { box-shadow: 0 0 0 7px rgba(16, 185, 129, 0); } }

/* ---------- owner ---------- */
/* A small caps label, also when the element is an h2 (the owner section's). */
.room .room-label { color: var(--muted); font: 500 12px/1.4 var(--font-body); letter-spacing: .04em; text-align: left; text-transform: uppercase; }
.room-owner { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 40px; align-items: start; }
.room-owner .room-person { margin-top: 14px; }
.room-quote { padding-left: 24px; border-left: 2px solid var(--hairline-strong); }
.room-quote blockquote { color: var(--ink); font: 300 clamp(22px, 2.4vw, 30px)/1.35 var(--font-display); letter-spacing: -0.01em; }
.room-quote figcaption { margin-top: 12px; color: var(--muted); font-size: 13px; }

/* ---------- findings and open problems ---------- */
.room-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 36px; }
.room-card { padding: clamp(20px, 2.5vw, 28px); border: 1px solid var(--hairline); border-radius: 16px; background: var(--card); box-shadow: 0 1px 2px rgba(18, 6, 26, .04), 0 12px 32px rgba(45, 16, 67, .08); }
.room-figure { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 10px; padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--card-divider); color: var(--accent-text); font: 300 clamp(36px, 4vw, 52px)/1 var(--font-display); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.room-figure span { color: var(--muted); font: 400 13px/1.4 var(--font-body); letter-spacing: 0; }
.room-card h3 { font-size: 21px; line-height: 1.2; }
.room-card > p:not(.room-figure) { margin-top: 8px; color: var(--muted); font-size: 15px; line-height: 1.5; }
.room-figure-sm { font-size: clamp(30px, 3.2vw, 42px); }
.room-figure .room-figure-math { math-style: normal; font-size: .72em; letter-spacing: 0; }
/* Formulas are native MathML: no library to load. A wide one scrolls inside its card on phones. */
.room math { color: inherit; }
.room-card math[display="block"] { margin: 14px 0 4px; padding-block: 6px; overflow-x: auto; color: var(--ink); font-size: 17px; }
.room-repeat { text-decoration: overline; }
.room .room-lede p + p { margin-top: 12px; }
.room div.room-lede { max-width: 720px; }
.room-problems { max-width: 900px; margin: 36px auto 0; padding: 0; list-style: none; border: 1px solid var(--hairline); border-radius: 16px; background: var(--card); overflow: hidden; }
.room-problems li { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); align-items: center; gap: 6px 28px; padding: 18px clamp(16px, 2.5vw, 28px); }
.room-problems li + li { border-top: 1px solid var(--card-divider); }
.room-problems .is-priority { background: var(--chosen); }
.room-problems h3 { font-size: 20px; line-height: 1.2; }
.room-problems p { color: var(--muted); font-size: 15px; line-height: 1.5; }
.room .room-problems .room-label { display: block; margin-bottom: 4px; color: var(--accent-text); }
.room-more { margin-top: 18px; text-align: center; }

/* ---------- atlas ---------- */
.atlas-frame { display: block; width: 100%; height: clamp(550px, 78vh, 820px); margin-top: 28px; border: 1px solid var(--hairline); border-radius: 16px; background: var(--canvas); box-shadow: 0 1px 2px rgba(18, 6, 26, .06), 0 24px 60px rgba(45, 16, 67, .16); }

/* ---------- closing card: the skill pages' navy card ---------- */
.room-final { max-width: 900px; margin: 0 auto; padding: clamp(32px, 5vw, 56px) 24px; border: 1px solid rgba(174, 229, 255, .20); border-radius: 24px; background: #122A66; text-align: center; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 24px 60px rgba(11, 29, 74, .25), 0 0 80px rgba(70, 140, 255, .10); }
.room-final h2 { color: #EFFAFF; }
.room-final h2 .room-l2 { display: block; color: #AEE5FF; }
.room .room-final .room-lede { color: #C9D6EE; }
.room-final .btn-ghost, :root[data-theme="light"] .room-final .btn-ghost { color: #EFFAFF; background: rgba(174, 229, 255, .10); border-color: rgba(174, 229, 255, .34); }
.room-final .btn:focus-visible { outline: 2px solid #AEE5FF; outline-offset: 2px; }

.room-footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 14px; padding-block: 20px 25px; border-top: 1px solid var(--hairline); color: var(--muted); font-size: 13px; }
.room-footer a { text-decoration: none; }

@media (max-width: 760px) {
  .room-body { grid-template-columns: 1fr; }
  .room-feed { border-right: 0; border-bottom: 1px solid var(--hairline); }
  .room-owner { grid-template-columns: 1fr; gap: 24px; }
  .room-quote { padding-left: 16px; }
  .room-cards { grid-template-columns: 1fr; }
  .room-problems li { grid-template-columns: 1fr; }
}
