/* Razor chrome only. Everything inside #root is styled by Tailwind in the React island;
   these tokens are duplicated in client/src/styles/app.css so both halves agree. */
:root {
  /* Mirror of the @theme block in client/src/styles/app.css. Both must agree, or
     the header ends up one colour and the page body another. */
  --surface:        #0A0C0A;
  --surface-raised: #121612;
  --line:           #1F271F;
  --accent:         #00E676;
  --accent-bright:  #5BFFAB;
  --accent-dim:     #00A85A;
  --ink:            #FFFFFF;
  --ink-mute:       #9AA69A;
  --sans: "Inter", ui-sans-serif, system-ui, sans-serif;
  --display: "Poppins", "Inter", ui-sans-serif, system-ui, sans-serif;
}

/* Mirror of the light block in app.css — the header and the body must switch together. */
:root[data-theme="light"] {
  --surface:        #F5F7F5;
  --surface-raised: #FFFFFF;
  --line:           #DCE3DD;
  --accent:         #007A42;
  --accent-bright:  #00A85A;
  --accent-dim:     #16804B;
  --ink:            #0B120D;
  --ink-mute:       #56645A;
}

/* The moving background is a dark silk field; behind a light page it reads as a stain.
   Light theme is flat and quiet instead. */
:root[data-theme="light"] .rr-shader { display: none; }

/* Reserve the switcher's width before its script loads, so the header does not jump. */
.rr-theme { display: inline-flex; min-width: 66px; height: 32px; }

* { box-sizing: border-box; }

html.rr { background: var(--surface); }

.rr-body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.rr-skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--surface);
  padding: 0.6rem 1rem;
  z-index: 100;
}
.rr-skip:focus { left: 0; }

.rr-header {
  /* Stays at the top through any scroll, on every page. `sticky` rather than `fixed` so it
     still occupies layout space and never covers the first line of content. */
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 0.9rem clamp(1rem, 4vw, 3rem);
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

/* The glow lives in the SVG filter, so the mark needs no plate behind it — that is what
   keeps the corners transparent instead of showing a grey square. */
.rr-eye { overflow: visible; }

.rr-wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--accent);
  text-decoration: none;
  font-family: var(--display);
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  text-shadow: 0 0 18px color-mix(in srgb, var(--accent) 55%, transparent);
}

/* Never more than two rows: the narrower the window, the smaller the words (and the space
   between them, which is in em). The rows keep their usual distance apart. */
.rr-nav {
  display: flex;
  gap: 1.4rem 1.1em;
  margin-inline-end: auto;
  flex-wrap: wrap;
  font-size: clamp(0.65rem, calc((100vw - 800px) / 46), 0.92rem);
}
/* A narrow desktop: a little less space around the menu, so the words need not shrink as far. */
@media (min-width: 1281px) and (max-width: 1600px) {
  .rr-header { gap: 1rem; }
}

/* The burger. Hidden while the menu fits beside the eye; from 1280px down (a phone, a tablet,
   or a desktop zoomed to 150% and more) the menu folds behind it and opens as a panel under
   the header. Signed out there is only the one link, which stays as it is. */
.rr-burger { display: none; }
@media (max-width: 1280px) {
  .rr-header { flex-wrap: wrap; row-gap: 0; gap: 0.75rem; }
  .rr-tools { margin-inline-start: auto; }
  .rr-burger {
    display: grid;
    place-content: center;
    gap: 4px;
    width: 40px;
    height: 40px;
    flex: none;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
  }
  .rr-burger:hover { border-color: var(--accent); color: var(--accent); }
  .rr-burger span { display: block; width: 18px; height: 2px; border-radius: 2px; background: currentColor; transition: transform 180ms ease, opacity 180ms ease; }
  .rr-header.is-open .rr-burger span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  .rr-header.is-open .rr-burger span:nth-child(2) { opacity: 0; }
  .rr-header.is-open .rr-burger span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

  .rr-nav--menu { display: none; }
  .rr-header.is-open .rr-nav--menu {
    order: 3;
    flex: 0 0 100%;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
    gap: 0 1.25rem;
    margin: 0.75rem 0 0;
    padding: 0.5rem 0 0.25rem;
    border-top: 1px solid var(--line);
    font-size: 1rem;
    max-height: calc(100dvh - 6rem);
    overflow-y: auto;
  }
  .rr-header.is-open .rr-nav--menu a { padding: 0.7rem 0.25rem; border-bottom: 1px solid var(--line); }
  .rr-header.is-open .rr-nav--menu a.is-current { border-bottom-color: var(--accent); }
}

.rr-nav a {
  color: var(--ink-mute);
  text-decoration: none;
  white-space: nowrap;
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
  transition: color 160ms ease, border-color 160ms ease;
}
.rr-nav a:hover { color: var(--ink); }
.rr-nav a.is-current { color: var(--accent); border-bottom-color: var(--accent); }
/* Signed out: the one way back, to the welcome page. */
.rr-nav a.rr-back {
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 600;
}
.rr-nav a.rr-back:hover { background: var(--accent); color: var(--surface, #0A0C0A); }

.rr-account {
  color: var(--surface);
  background: var(--accent);
  border-radius: 999px;
  padding: 0.45rem 1.1rem;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
}
.rr-account:hover { background: var(--accent-bright); }

/* Language picker sits beside the account button, not in the nav — it is a setting for the
   page you are already on, not another place to go. */
.rr-tools {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.rr-lang {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  padding: 0.15rem;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.rr-lang a {
  color: var(--ink-mute);
  text-decoration: none;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0.28rem 0.5rem;
  border-radius: 999px;
  transition: color 160ms ease, background 160ms ease;
}
.rr-lang a:hover { color: var(--ink); }
.rr-lang a.is-current { color: var(--surface); background: var(--accent); }

#main { flex: 1; }
/* A full screen, not 60vh: with 60vh the footer was on screen at first paint and got pushed
   down when the island mounted, a layout shift on every page. */
.rr-stage { min-height: 100vh; }

/* The canvas sits behind everything and takes no input. The body keeps its solid colour
   as the fallback, so a machine without WebGL simply sees the flat theme. */
.rr-shader {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.5;
}

/* A scrim over the field, even from top to bottom: the green light runs behind the whole
   page, not just the strip under the header (it used to fade to solid black below the fold).
   Text contrast is still the constraint: panels and cards keep their own solid fill, and the
   scrim dims the crests enough that loose small type does not swim. */
.rr-shader::after {
  content: "";
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--surface) 45%, transparent);
}

/* Content above the field. Without a stacking context the canvas would paint over it. */
.rr-body.has-shader { background: transparent; }

/* Only these two need lifting above the canvas. The header is left alone on purpose:
   it is already `position: sticky`, and overriding that with `relative` is exactly what
   made it scroll away. */
.rr-body.has-shader > main,
.rr-body.has-shader > .rr-footer { position: relative; z-index: 1; }

.rr-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 2.5rem clamp(1rem, 4vw, 3rem) 2rem;
  border-top: 1px solid var(--line);
  color: var(--ink-mute);
  font-size: 0.8rem;
  text-align: center;
}
.rr-footer a { color: var(--ink-mute); text-decoration: none; transition: color .15s; }
.rr-footer a:hover, .rr-footer a.is-current { color: var(--accent); }
.rr-footer-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .4rem 1.25rem; margin: 0; }
.rr-footer-lang select {
  appearance: none; background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%2399a399' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right center;
  border: 0; padding: 0 1rem 0 0; color: var(--ink-mute); font: inherit; cursor: pointer;
}
.rr-footer-lang select:hover { color: var(--accent); }
.rr-footer-lang option { background: var(--surface-raised); color: var(--ink); }
.rr-footer .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.rr-halls { margin: .25rem 0 .75rem; padding-left: 1.1rem; color: var(--ink-mute); }
.rr-halls strong { color: var(--ink); font-weight: 600; }

/* The footer pages: tabs across the top, a lede, blog posts as cards, code in panels. */
/* The same row above the help page, which is a React page with its own width. */
.rr-info-strip { max-width: 72ch; margin: 0 auto; padding: 2.5rem clamp(1rem, 4vw, 2rem) 0; }
.rr-info-strip .rr-info-tabs { margin-bottom: 0; }
.rr-info-tabs { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 2rem; }
.rr-info-tabs a {
  padding: .35rem .9rem; border: 1px solid var(--line); border-radius: 999px;
  color: var(--ink-mute); font-size: .85rem; text-decoration: none;
}
.rr-info-tabs a:hover { border-color: var(--accent); color: var(--accent); }
.rr-info-tabs a.is-current { background: var(--accent); border-color: var(--accent); color: var(--surface); }
/* On a phone the ten tabs wrapped into four rows and pushed the page half a screen down: one
   row that scrolls sideways instead, like the header's, fading out at the edge to say so. */
@media (max-width: 640px) {
  .rr-info-tabs {
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
    margin-bottom: 1.25rem; padding-bottom: .25rem;
    -webkit-mask-image: linear-gradient(to right, #000 85%, transparent);
    mask-image: linear-gradient(to right, #000 85%, transparent);
  }
  .rr-info-tabs::-webkit-scrollbar { display: none; }
  .rr-info-tabs a { white-space: nowrap; flex-shrink: 0; }
}
.rr-legal .rr-info-lede { font-size: 1.1rem; color: var(--ink); margin-bottom: 1.5rem; }
.rr-info-post {
  margin: 1.25rem 0; padding: 1.25rem 1.5rem; border: 1px solid var(--line); border-radius: 1rem;
  background: var(--surface-raised);
}
.rr-info-post h2 { margin-top: .25rem; }
/* A cinema's photo across the top of its card, cut to one shape whatever its source size. */
.rr-venue-photo {
  display: block; width: calc(100% + 3rem); max-width: none; aspect-ratio: 16 / 7; object-fit: cover;
  margin: -1.25rem -1.5rem 1rem; border-radius: 1rem 1rem 0 0; border-bottom: 1px solid var(--line);
}
.rr-legal .rr-info-meta { font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; margin: 0; }
.rr-info pre {
  overflow-x: auto; padding: 1rem 1.25rem; border: 1px solid var(--line); border-radius: .75rem;
  background: var(--surface-raised); color: var(--ink); font-size: .8rem; line-height: 1.6;
}
.rr-info-cta {
  display: inline-block; padding: .6rem 1.4rem; border-radius: 999px; background: var(--accent);
  color: var(--surface) !important; font-weight: 600; text-decoration: none;
}

.rr-noscript { padding: 4rem clamp(1rem, 4vw, 3rem); }
.rr-noscript h1 { font-family: var(--display); font-weight: 400; }

:where(a, button, input, select, textarea):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

@media (max-width: 900px) {
  /* Two rows: the eye and the tools on top, the nav beneath. The header has to be allowed to
     wrap for the nav's `width: 100%` to put it on a row of its own — without this the nav
     was squeezed beside the eye and stacked its links into a column half a screen tall. */
  .rr-header { gap: 0.6rem; padding-inline: 1rem; }
  .rr-nav:not(.rr-nav--menu) { order: 3; width: 100%; padding-bottom: 0.25rem; }   /* signed out: "← Watching PRO" */

  .rr-tools { gap: 0.5rem; }
  .rr-lang a { padding: 0.24rem 0.38rem; font-size: 0.68rem; }
  .rr-account { padding: 0.45rem 0.8rem; font-size: 0.8rem; }
  .rr-wordmark span { display: none; }   /* the eye is enough at this width */
}

@media (max-width: 520px) {
  main { padding-inline: 0.9rem; }

  /* Keep the eye and the tools on one row down to the narrowest phones; a few pixels of
     padding decide whether the header is two rows or three. */
  .rr-tools { gap: 0.35rem; }
  .rr-lang { padding: 0.1rem; gap: 0; }
  .rr-lang a { padding: 0.22rem 0.32rem; }
  .rr-account { padding: 0.42rem 0.7rem; }
}


/* ---- Error page ----------------------------------------------------------------------
   Razor only, no React: the moment you most need this page is the moment the bundle failed
   to load, so it must not depend on it. The beam below is the same green used by the search
   fields, written again here because that one lives in the Tailwind bundle.
   ------------------------------------------------------------------------------------ */
.rr-error {
  max-width: 34rem;
  margin: 0 auto;
  padding: clamp(3rem, 12vh, 7rem) 1.25rem;
  text-align: center;
}

.rr-error-code {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(4.5rem, 18vw, 8rem);
  line-height: 0.9;
  letter-spacing: -0.04em;
  margin: 0;
  color: transparent;
  -webkit-text-stroke: 1.5px color-mix(in srgb, var(--accent) 45%, transparent);
}

.rr-error-eye {
  display: block;
  margin: 1.25rem auto 0;
  color: var(--accent);
  filter: drop-shadow(0 0 18px color-mix(in srgb, var(--accent) 55%, transparent));
}

.rr-error h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.4rem, 4vw, 1.9rem);
  margin: 1.5rem 0 0;
  color: var(--ink);
}

.rr-error-body {
  margin: 0.6rem auto 0;
  max-width: 44ch;
  color: var(--ink-mute);
  line-height: 1.6;
}

.rr-error-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
  margin-top: 1.75rem;
}

.rr-error-primary,
.rr-error-secondary {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 0.6rem 1.2rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  overflow: hidden;
}

.rr-error-primary { background: var(--accent); color: var(--surface); }
.rr-error-primary:hover { background: var(--accent-bright); }

.rr-error-secondary {
  border: 1px solid var(--line);
  color: var(--ink-mute);
}
.rr-error-secondary:hover { color: var(--ink); border-color: var(--accent-dim); }

/* The same travelling beam as the search fields, under the primary action. */
.rr-error-primary::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 45%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--ink), transparent);
  animation: rr-error-beam 2.6s linear infinite;
}

@keyframes rr-error-beam {
  from { transform: translateX(-100%); }
  to   { transform: translateX(222%); }
}

/* A reference nobody needs until they are reporting the problem, so it stays quiet. */
.rr-error-trace {
  margin-top: 2.5rem;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: color-mix(in srgb, var(--ink-mute) 55%, transparent);
  word-break: break-all;
}

@media (prefers-reduced-motion: reduce) {
  .rr-error-primary::after { animation: none; width: 100%; transform: none; opacity: 0.5; }
}

/* ---- Legal pages (privacy policy) ------------------------------------------------------
   Plain, readable text on the page background. Server-rendered, so no React styles apply. */
.rr-legal {
  max-width: 72ch;
  margin: 0 auto;
  padding: 3rem clamp(1rem, 4vw, 2rem) 4rem;
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.65;
}
.rr-legal h1 { font-family: var(--display); font-size: clamp(1.8rem, 4vw, 2.4rem); margin: 0 0 .25rem; }
.rr-legal h2 { font-family: var(--display); font-size: 1.15rem; margin: 2rem 0 .5rem; color: var(--accent); }
.rr-legal p { margin: 0 0 .75rem; color: var(--ink-mute); }
.rr-legal .rr-legal-meta { font-size: .85rem; }
.rr-legal a { color: var(--accent); }
.rr-footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem 1.1rem; max-width: 60rem; }

/* The round profile picture at the top right; the eye logo until one is uploaded. */
.rr-avatar {
  display: inline-flex;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  overflow: hidden;
  border: 2px solid var(--accent-dim);
  background: var(--surface-raised);
  flex-shrink: 0;
}
.rr-avatar:hover { border-color: var(--accent); }
.rr-avatar img { width: 100%; height: 100%; object-fit: cover; }
/* Follow requests waiting: a small count on the header picture (set by main.tsx). */
.rr-avatar { position: relative; overflow: visible; }
.rr-avatar img { border-radius: 999px; }
/* The message button beside the picture (React, mounted by main.tsx): same circle, same
   count. The slot keeps its width before the script arrives, so nothing jumps. */
.rr-inbox-slot { display: inline-flex; width: 36px; height: 36px; flex-shrink: 0; }
.rr-inbox {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 2px solid var(--accent-dim);
  background: var(--surface-raised);
  color: var(--ink, #E8F2EA);
  cursor: pointer;
}
.rr-inbox:hover { border-color: var(--accent); color: var(--accent); }
.rr-inbox:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Signed in, the message button and the picture join the tools: on the narrowest phones the
   language links step aside (the footer's language menu stays) so the eye keeps its row. */
@media (max-width: 419px) {
  body[data-signed-in] .rr-lang { display: none; }
}
.rr-avatar[data-count]::after,
.rr-inbox[data-count]::after {
  content: attr(data-count);
  position: absolute;
  top: -4px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: #ff3b30;
  color: #fff;
  font: 700 11px/18px Inter, system-ui, sans-serif;
  text-align: center;
}
