/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* Reserves the scrollbar gutter so the .is-clipped scroll lock the modals apply
   does not shift the page sideways on classic-scrollbar platforms. Ignored by
   older Safari, which then behaves exactly as before */
html {
  scrollbar-gutter: stable;
}

/* Keeps the footer pinned to the bottom on short pages. The dvh line repeats the
   vh line because on mobile 100vh is the RETRACTED-URL-bar height, so this floor
   was ~86px taller than the visible viewport and pushed the footer below the fold
   even on pages with nothing to scroll. Browsers without dvh drop that
   declaration and keep the vh one */
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

main {
  flex: 1;
}

/* The landing page's purple accent, taken from the recoloured Storyset art. The
   light value (#8e24aa) is darkened from the art's #BA68C8 to clear 4.5:1 on
   white, and the dark value (#ce93d8) is lightened to clear it on Bulma's dark
   background. Kept as hue, saturation and lightness because that's how Bulma
   takes a color: the use-case section below feeds these to Bulma's primary.
   invert-l is the lightness of text on a purple fill */
:root {
  --rvi-accent-h: 288deg;
  --rvi-accent-s: 65%;
  --rvi-accent-l: 40%;
  --rvi-accent-invert-l: 100%;
  --rvi-accent: hsl(var(--rvi-accent-h), var(--rvi-accent-s), var(--rvi-accent-l));
}

@media (prefers-color-scheme: dark) {
  :root {
    --rvi-accent-h: 291deg;
    --rvi-accent-s: 47%;
    --rvi-accent-l: 71%;
    --rvi-accent-invert-l: 10%;
  }
}

/* The audience word the landing heading rotates (rotating_word controller). It
   sits on its own line so a longer word never reflows the line above it */
.rotating-word {
  display: block;
  color: var(--rvi-accent);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.rotating-word.is-leaving {
  opacity: 0;
  transform: translateY(-0.25em);
}

/* The landing page's use-case section is built from Bulma classes. These are
   the things Bulma has no class for.

   1. The purple accent instead of Bulma's turquoise. Bulma 1 builds is-primary,
   has-text-primary-on-scheme and message is-primary from these variables, so
   redefining them here turns the selected tab, the card labels and the summary
   card purple, in this section only. Bulma draws a message's left border 20%
   darker than its color; the zero delta keeps it the accent itself */
.use-cases {
  --bulma-primary-h: var(--rvi-accent-h);
  --bulma-primary-s: var(--rvi-accent-s);
  --bulma-primary-l: var(--rvi-accent-l);
  --bulma-primary-invert-l: var(--rvi-accent-invert-l);
  --bulma-primary-on-scheme-l: var(--rvi-accent-l);
}

/* Bulma sets this delta on .message itself, so it has to be overridden there
   rather than inherited from .use-cases */
.use-cases .message {
  --bulma-message-border-l-delta: 0%;
}

/* 2. No jumping between tabs. With JavaScript (use_case_tabs adds is-enhanced),
   every panel sits in the same grid cell, so the section is always as tall as
   its tallest panel. Inactive panels keep their space with visibility: hidden,
   which also takes them out of the tab order and the accessibility tree as
   [hidden] would. The panels' is-flex (display: flex !important) is what keeps
   a [hidden] panel in the layout at all */
.use-cases.is-enhanced .use-case-panels {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.use-cases.is-enhanced .use-case-panels > * {
  grid-area: 1 / 1;
}

.use-case-panels > [hidden] {
  visibility: hidden;
}

/* 3. The same minimum height as the three illustrated rows below. Those take
   their height from a square illustration filling a one-third column, up to
   520px wide, plus the column's 0.75rem padding top and bottom. This zero-width
   flex item reproduces that: a padding percentage is a share of the row's
   width, and a third of the row less the column's side padding is the
   illustration's width, so its height too. From 769px only, where Bulma's
   .columns is a flex row; below that the columns stack and the item would only
   add a blank gap */
@media (min-width: 769px) {
  .use-cases::before {
    content: "";
    flex: 0 0 0;
    padding-top: calc(min(520px, 33.3333% - 1.5rem) + 1.5rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .rotating-word {
    transition: none;
  }
}

/* The landing page demo video. The frame is mostly white UI, so the border and
   shadow are what keep it from reading as a bare bright rectangle in dark mode.
   The play button sits over the poster until the demo_video controller hides it */
.demo-video {
  position: relative;
  border: 1px solid var(--bulma-border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.demo-video video {
  display: block;
  width: 100%;
  height: auto;
}

.demo-video-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 1.5rem 0.875rem 1.125rem;
  border: none;
  border-radius: 999px;
  background: rgba(20, 20, 20, 0.8);
  color: #fff;
  font-size: 1.25rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.15s ease;
}

.demo-video-play:hover {
  background: rgba(0, 0, 0, 0.92);
  transform: translate(-50%, -50%) scale(1.04);
}

.demo-video-play:focus-visible {
  outline: 3px solid #00D1B2;
  outline-offset: 3px;
}

/* An author display rule beats the UA's [hidden] { display: none } */
.demo-video-play[hidden] {
  display: none;
}

.demo-video-play .material-symbols-outlined {
  font-size: 2rem;
}

@media (max-width: 768px) {
  .demo-video-play {
    font-size: 1rem;
    padding: 0.625rem 1.125rem 0.625rem 0.875rem;
  }

  .demo-video-play .material-symbols-outlined {
    font-size: 1.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .demo-video-play {
    transition: none;
  }

  .demo-video-play:hover {
    transform: translate(-50%, -50%);
  }
}

/* These rules keep the logo proportioned */
.navbar {
  min-height: 100px;
}

.navbar-brand .navbar-item img {
  max-height: 80px;
  width: auto;
  object-fit: contain;
}

.navbar-item.is-active {
  background-color: transparent !important;
  color: var(--bulma-text-strong) !important;
  font-weight: bold;
}

a {
  color: #00796b;
}

@media (prefers-color-scheme: dark) {
  a {
    color: #00D1B2;
  }
}

/* Hides a form's honeypot field. Pushed off-screen rather than hidden
   with display:none or visibility:hidden. Nothing here is ever painted */
.honeypot-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.card-full-height {
  height: 100%;
}

.processing-spinner {
  text-align: center;
  margin: 20px 0;
}

.spinner {
  border: 4px solid #f3f3f3;
  border-top: 4px solid #3498db;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 2s linear infinite;
  margin: 0 auto;
}

@media (prefers-color-scheme: dark) {
  .spinner {
    border-color: #444;
    border-top-color: #3498db;
  }
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Centers the interview session screen and makes its record control a circle.
   The 100px matches the .navbar min-height above. Geometry only, by design —
   the record button's colour comes from the is-warning/is-danger the Stimulus
   controller swaps on it. Note those filled variants render the same in light
   and dark, so if the disabled state needs more contrast on a dark scheme it
   wants its own rule here rather than a tweak to these.
   The dvh line repeats the vh line as a fallback for browsers without dvh
   support. dvh tracks the mobile URL bar, so this no longer reserves the
   retracted bar's height on top of the visible viewport. It still does NOT
   account for main's 3rem section padding or the ~256px footer, so this page
   keeps scrolling on a short phone — that under-count is a known accepted
   limitation, not an oversight */
.session-hero {
  min-height: calc(100vh - 100px);
  min-height: calc(100dvh - 100px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.session-answer-box {
  width: 480px;
  max-width: 100%;
  margin: 0 auto;
}

/* Pause (small) beside Done (large). 88 + 140 + gap fits a 320px phone. */
.answer-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.75rem;
}

.answer-control {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.answer-control-caption {
  font-weight: 600;
  color: var(--bulma-text-strong);
}

.answer-button,
.answer-pause-button {
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.answer-button {
  width: 140px;
  height: 140px;
}

.answer-pause-button {
  width: 88px;
  height: 88px;
}

/* Wins over Bulma's .button .icon (1.5em) on source order only — adding
   is-large to this span would out-specify it and silently shrink the glyph. */
.answer-button .icon {
  margin: 0;
  height: 4rem;
  width: 4rem;
}

.answer-button .material-symbols-outlined {
  font-size: 4rem;
}

.answer-pause-button .icon {
  margin: 0;
  height: 2.5rem;
  width: 2.5rem;
}

.answer-pause-button .material-symbols-outlined {
  font-size: 2.5rem;
}

/* Live input level. The fill is scaled, not resized, so a repaint every frame
   stays on the compositor. */
.mic-meter {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 240px;
  margin: 1.25rem auto 0;
}

.mic-meter-icon {
  font-size: 1.25rem;
  color: var(--bulma-success);
}

.mic-meter-track {
  flex: 1;
  height: 8px;
  border-radius: 9999px;
  background: var(--bulma-border);
  overflow: hidden;
}

.mic-meter-fill {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--bulma-success);
  transform: scaleX(0);
  transform-origin: left center;
}

/* Paused: a striped, empty track and a warning-colored mic_off glyph, so the
   meter reads as "off" at a glance rather than as "quiet". */
.mic-meter.is-paused .mic-meter-icon {
  color: var(--bulma-warning);
}

.mic-meter.is-paused .mic-meter-track {
  background: repeating-linear-gradient(
    -45deg,
    var(--bulma-border),
    var(--bulma-border) 6px,
    transparent 6px,
    transparent 12px
  );
}
