/*
 * Velros Network: base resets, public-page scaffolding, markdown, forms.
 * Design tokens (colors, fonts) are defined once in app/assets/tailwind/application.css
 * and consumed here via var(); this file holds plain CSS that does not need Tailwind.
 */

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
textarea,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

::selection {
  background: var(--accent-mint);
  color: var(--bg-contrast);
}

/* ═══ Public header ═══ */

.public-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 50;
  width: 100%;
  height: var(--public-header-height);
  border-bottom: 1px solid var(--border-contrast);
  background: color-mix(in srgb, var(--bg-contrast) 86%, transparent);
  color: var(--fg-on-contrast);
  backdrop-filter: blur(18px);
}

.public-header__link {
  color: var(--fg-on-contrast-muted);
  font-size: 1rem;
  transition: color 0.18s;
}

.public-header__link:hover {
  color: var(--fg-on-contrast);
}

/* ═══ Public / marketing page scaffolding ═══ */

.page-public {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 8rem 1.5rem 5rem;
}

.page-public--after-cinema {
  padding-top: 5rem;
}

.section {
  border-top: 1px solid var(--border);
}

.section-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 5.5rem 1.5rem;
}

.page-title {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 400;
  letter-spacing: -0.015em;
  line-height: 1.08;
  margin: 0 0 0.5rem;
}

.section-label-blue {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent-brass);
  margin-bottom: 0.75rem;
}

/* ═══ Forms ═══ */

.form-stack {
  display: grid;
  gap: 1.1rem;
}

.input {
  width: 100%;
  border: 1px solid var(--border-hover);
  border-radius: 8px;
  background: var(--bg-elevated);
  padding: 0.8rem 1rem;
  color: var(--foreground);
  font-size: 1rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input::placeholder {
  color: var(--fg-muted);
}

.input:focus {
  outline: none;
  border-color: var(--foreground);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--foreground) 8%, transparent);
}

/* ═══ Markdown (lightpaper render) ═══ */

.markdown-body {
  color: var(--fg-secondary);
  line-height: 1.7;
}

.markdown-body > :first-child { margin-top: 0; }
.markdown-body > :last-child { margin-bottom: 0; }

.markdown-body p { margin: 0.85rem 0; }

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  font-family: var(--font-heading);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.012em;
  color: var(--foreground);
  margin: 2.25rem 0 0.85rem;
  scroll-margin-top: 6rem;
}

.markdown-body h1 { font-size: 2rem; }
.markdown-body h2 { font-size: 1.6rem; }
.markdown-body h3 { font-size: 1.25rem; }
.markdown-body h4 { font-size: 1.05rem; }

.markdown-body ul,
.markdown-body ol { margin: 0.85rem 0; padding-left: 1.4rem; }
.markdown-body ul { list-style: disc; }
.markdown-body ol { list-style: decimal; }
.markdown-body li { margin: 0.35rem 0; }

.markdown-body a {
  color: var(--accent-brass);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.markdown-body strong { font-weight: 600; color: var(--foreground); }
.markdown-body em { font-style: italic; }

.markdown-body blockquote {
  margin: 1.25rem 0;
  padding: 0.5rem 0 0.5rem 1.1rem;
  border-left: 3px solid var(--accent-mint);
  color: var(--foreground);
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-style: italic;
}

.markdown-body code {
  font-family: var(--font-mono);
  font-size: 1em;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.1em 0.4em;
}

.markdown-body pre {
  margin: 1.1rem 0;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  background: var(--bg-contrast);
  color: var(--fg-on-contrast);
  border-radius: 12px;
}

.markdown-body pre code {
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
}

.markdown-body hr {
  margin: 2rem 0;
  border: 0;
  border-top: 1px solid var(--border);
}

.markdown-body table {
  margin: 1.1rem 0;
  width: 100%;
  border-collapse: collapse;
  font-size: 1rem;
}

.markdown-body th,
.markdown-body td {
  border: 1px solid var(--border);
  padding: 0.55rem 0.8rem;
  text-align: left;
}

.markdown-body th {
  background: var(--bg-surface);
  font-weight: 600;
  color: var(--foreground);
}

/* ═══ Lightpaper table of contents ═══ */

.toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc li {
  margin: 0;
}

.toc > ul > li > a {
  display: block;
  padding: 0.4rem 0;
  border-left: 2px solid var(--border);
  padding-left: 0.85rem;
  color: var(--fg-muted);
  line-height: 1.35;
  transition: color 0.15s, border-color 0.15s;
}

.toc a:hover {
  color: var(--foreground);
  border-color: var(--foreground);
}

/* nested (h3) links, if any: dim and indented */
.toc ul ul a {
  display: block;
  padding: 0.25rem 0 0.25rem 1.6rem;
  color: var(--fg-muted);
  font-size: 1rem;
}

/* ═══ Reveal-on-scroll (progressive enhancement) ═══
   The hiding style only applies once the Stimulus controller arms it, so the
   page is fully visible without JS or with reduced-motion. */
.reveal--armed {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}
.reveal--armed.is-visible {
  opacity: 1;
  transform: none;
  filter: blur(0);
}

/* ═══ Stage entrance: staggered on-load rise (hero) ═══ */
@media (prefers-reduced-motion: no-preference) {
  .enter-stagger > * {
    opacity: 0;
    animation: stage-rise 1s cubic-bezier(0.16, 1, 0.3, 1) both;
  }
  .enter-stagger > *:nth-child(1) { animation-delay: 0.06s; }
  .enter-stagger > *:nth-child(2) { animation-delay: 0.16s; }
  .enter-stagger > *:nth-child(3) { animation-delay: 0.26s; }
  .enter-stagger > *:nth-child(4) { animation-delay: 0.34s; }
  .enter-stagger > *:nth-child(5) { animation-delay: 0.42s; }
}
@keyframes stage-rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}

/* ═══ Framed cinematic film band (Variant B: media as a deliberate asset) ═══ */
.film-band {
  position: relative;
  overflow: hidden;
  height: clamp(360px, 52vh, 560px);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.film-band__meta {
  position: absolute;
  left: 1.75rem;
  bottom: 1.6rem;
  z-index: 2;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1rem;
  color: var(--fg-on-contrast);
}
.film-band__meta span { color: var(--fg-on-contrast-muted); font-weight: 500; }
.film-band__watch {
  position: absolute;
  right: 1.75rem;
  bottom: 1.4rem;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-weight: 600;
  font-size: 1rem;
  color: var(--fg-on-contrast);
}
.film-band__ring {
  width: 2.6rem;
  height: 2.6rem;
  border: 1px solid color-mix(in srgb, var(--fg-on-contrast) 50%, transparent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.film-band__play {
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 8px solid var(--fg-on-contrast);
  margin-left: 2px;
}

/* ═══ Cinematic hero (Variant A: 11x-borrowed warm-dark) ═══
   Full-bleed warm film plate behind the headline. Premium video/3D footage
   drops into .cinema__plate later; the gradient + grain is the placeholder.
   Hex lives here (CSS is not scanned by the no-raw-hex guardrail). */
.cinema {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  min-height: clamp(620px, 86vh, 920px);
  padding-top: calc(var(--public-header-height) + 3rem);
  background: #0b0907;
}
.cinema__plate {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 90% at 78% 16%, #e0a259 0%, #a4632b 22%, #5e3717 46%, #2a180c 70%, #0b0907 100%),
    linear-gradient(180deg, rgba(11, 9, 7, 0) 42%, rgba(11, 9, 7, 0.5) 78%, #0b0907 100%);
  transform-origin: 72% 26%;
  animation: cinema-kb 26s ease-in-out infinite alternate;
}
.cinema__grain {
  position: absolute;
  inset: 0;
  opacity: 0.1;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.cinema__vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 120% at 50% 40%, rgba(0, 0, 0, 0) 55%, rgba(0, 0, 0, 0.45) 100%);
}
.cinema__inner {
  position: relative;
  z-index: 2;
}
@keyframes cinema-kb {
  from { transform: scale(1); }
  to { transform: scale(1.12); }
}
@media (prefers-reduced-motion: reduce) {
  .cinema__plate { animation: none; }
}
