/* Shared design tokens, sky background, header and form controls. */

:root {
  color-scheme: light;

  --ink: #0f2338;
  --ink-2: #304559;
  --ink-3: #5a6e82;
  --line: rgba(15, 35, 56, 0.12);
  --line-strong: rgba(15, 35, 56, 0.24);
  --surface: rgba(255, 255, 255, 0.72);
  --surface-solid: rgba(255, 255, 255, 0.94);
  --field: rgba(255, 255, 255, 0.9);
  --tint: rgba(15, 35, 56, 0.055);
  --accent: #1d5fd1;
  --accent-ring: rgba(29, 95, 209, 0.28);
  --success: #23794f;
  --danger: #b83a2f;

  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 24px;
  --shadow-card: 0 30px 70px -30px rgba(15, 35, 56, 0.45), 0 2px 8px rgba(15, 35, 56, 0.06);

  --font: 'Onest', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
  --text-hero: clamp(2.375rem, 1.4rem + 3.6vw, 4.25rem);

  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --fast: 160ms;
  --gutter: clamp(16px, 4vw, 48px);
  --header-h: 72px;

  /* paints instantly while the poster and video load */
  --sky-fallback: linear-gradient(180deg, #2f8fb0 0%, #8cc9da 45%, #e4f1f4 72%, #3d5a2c 78%, #4f6b2e 100%);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100svh;
  font-family: var(--font);
  font-size: var(--text-base);
  line-height: 1.55;
  color: var(--ink);
  background: #9ccaf2;
  -webkit-font-smoothing: antialiased;
}

img,
svg,
video {
  display: block;
  max-width: 100%;
}

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

a {
  color: var(--accent);
  text-underline-offset: 3px;
}

:focus-visible {
  outline: 3px solid var(--accent-ring);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------------------------------------------------------------- sky background */

.sky {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: url('../img/sky-landscape.jpg') center / cover no-repeat, var(--sky-fallback);
}

@media (orientation: portrait) and (max-width: 900px) {
  .sky {
    background-image: url('../img/sky-portrait.jpg'), var(--sky-fallback);
  }
}

.sky__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 900ms var(--ease);
}

.sky__video.is-playing {
  opacity: 1;
}

/* soft light behind the copy so dark text stays readable over the sky */
.sky__veil {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 62% 58% at 20% 50%, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.18) 60%, transparent 78%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.14), transparent 30%);
  pointer-events: none;
}

/* ---------------------------------------------------------------- header */

.site-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: var(--header-h);
  padding: 0 var(--gutter);
  max-width: 1360px;
  margin: 0 auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
}

.brand__mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: var(--ink);
  color: #fff;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.site-nav__link {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  font-weight: 500;
  text-decoration: none;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}

.site-nav__link:hover {
  background: rgba(255, 255, 255, 0.5);
  color: var(--ink);
}

/* ---------------------------------------------------------------- glass surface */

.glass {
  background: var(--surface);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  backdrop-filter: blur(22px) saturate(150%);
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass {
    background: var(--surface-solid);
  }
}

/* ---------------------------------------------------------------- buttons */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--fast) var(--ease), transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}

.button:active {
  transform: translateY(1px);
}

.button--primary {
  background: var(--ink);
  color: #fff;
  box-shadow: 0 10px 24px -12px rgba(15, 35, 56, 0.7);
}

.button--primary:hover {
  background: #1a3754;
}

.button--ghost {
  background: rgba(255, 255, 255, 0.55);
  border-color: var(--line);
  color: var(--ink);
}

.button--ghost:hover {
  background: rgba(255, 255, 255, 0.85);
}

.button[disabled],
.button[aria-busy='true'] {
  opacity: 0.65;
  cursor: progress;
}

.button__arrow {
  transition: transform var(--fast) var(--ease);
}

.button:hover .button__arrow {
  transform: translateX(3px);
}

/* ---------------------------------------------------------------- fields */

.field {
  display: grid;
  gap: 6px;
}

.field__label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--ink-2);
}

.field__optional {
  color: var(--ink-3);
  font-weight: 400;
}

.input {
  width: 100%;
  min-height: 50px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--field);
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}

.input::placeholder {
  color: #8796a6;
}

.input:hover {
  border-color: var(--line-strong);
}

.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-ring);
}

.input[aria-invalid='true'] {
  border-color: var(--danger);
}

textarea.input {
  min-height: 96px;
  resize: vertical;
}

select.input {
  appearance: none;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1.5 6 6.5l5-5' stroke='%230f2338' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
}

.field__error {
  min-height: 0;
  font-size: 0.8125rem;
  color: var(--danger);
}

.field__error:empty {
  display: none;
}

/* segmented radio group (role, format) */
.segmented {
  display: grid;
  grid-auto-columns: 1fr;
  grid-auto-flow: column;
  gap: 4px;
  padding: 4px;
  border-radius: var(--radius);
  background: var(--tint);
}

[data-field][aria-invalid='true'] .segmented {
  box-shadow: inset 0 0 0 1px var(--danger);
}

.segmented__option {
  position: relative;
}

.segmented__option input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.segmented__option span {
  display: grid;
  place-items: center;
  min-height: 42px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--ink-2);
  text-align: center;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}

.segmented__option input:checked + span {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(15, 35, 56, 0.12), 0 4px 12px -6px rgba(15, 35, 56, 0.25);
}

.segmented__option input:focus-visible + span {
  outline: 3px solid var(--accent-ring);
}

/* checkbox with text */
.check {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 10px;
  align-items: start;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--ink-3);
  cursor: pointer;
}

.check input {
  appearance: none;
  width: 22px;
  height: 22px;
  margin: 0;
  border: 1.5px solid var(--line-strong);
  border-radius: 7px;
  background: var(--field);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease);
}

.check input::after {
  content: '';
  width: 10px;
  height: 6px;
  border: 2px solid #fff;
  border-top: 0;
  border-right: 0;
  transform: translateY(-1px) rotate(-45deg) scale(0);
  transition: transform var(--fast) var(--ease);
}

.check input:checked {
  background: var(--ink);
  border-color: var(--ink);
}

.check input:checked::after {
  transform: translateY(-1px) rotate(-45deg) scale(1);
}

.check input[aria-invalid='true'] {
  border-color: var(--danger);
}

/* toggle chips (subjects, audiences) */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease), color var(--fast) var(--ease), transform var(--fast) var(--ease);
}

.chip:hover {
  border-color: var(--line-strong);
  background: #fff;
}

.chip:active {
  transform: scale(0.97);
}

.chip__tick {
  display: none;
  width: 14px;
  height: 14px;
}

.chip[aria-pressed='true'],
.chip[aria-checked='true'] {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.chip[aria-pressed='true'] .chip__tick,
.chip[aria-checked='true'] .chip__tick {
  display: block;
}

/* ---------------------------------------------------------------- confirmation code */

.code-input {
  max-width: 260px;
  font-size: 1.625rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.4em;
  text-align: center;
}

.code-input::placeholder {
  letter-spacing: 0.4em;
  color: #c3ccd6;
}

.link-button {
  justify-self: start;
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--accent);
  font-weight: 500;
  cursor: pointer;
}

.link-button:disabled {
  color: var(--ink-3);
  cursor: default;
}

.dev-code {
  margin: 4px 0 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: #fff7dc;
  border: 1px solid #f0d98c;
  font-size: 0.875rem;
  color: #5d4a10;
}

/* ---------------------------------------------------------------- footer */

.site-footer {
  position: relative;
  z-index: 1;
  background: rgba(255, 255, 255, 0.88);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
  border-top: 1px solid rgba(255, 255, 255, 0.8);
  font-size: 0.875rem;
  color: var(--ink-2);
}

.site-footer p {
  margin: 0;
}

.site-footer__inner,
.site-footer__bottom {
  max-width: 1360px;
  margin: 0 auto;
  padding-inline: var(--gutter);
}

.site-footer__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.2fr);
  gap: 32px clamp(24px, 4vw, 64px);
  padding-block: 40px 32px;
}

.site-footer__brand p {
  max-width: 28ch;
  margin-top: 14px;
  color: var(--ink-3);
}

.site-footer__title {
  margin-bottom: 12px !important;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.site-footer__links {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-footer__links a {
  color: var(--ink);
  text-decoration: none;
}

.site-footer__links a:hover,
.site-footer__links a[aria-current='page'] {
  text-decoration: underline;
}

.site-footer__requisites {
  display: grid;
  gap: 6px;
}

.site-footer__bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 32px;
  padding-block: 18px 28px;
  border-top: 1px solid var(--line);
  font-size: 0.8125rem;
  color: var(--ink-3);
}

/* config values that still have to be filled in (see assets/js/lib/legal.js) */
.is-placeholder {
  padding: 0 4px;
  border-radius: 4px;
  background: rgba(255, 196, 0, 0.28);
  color: #6b5200;
}

@media (max-width: 900px) {
  .site-footer__inner {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }
}

/* ---------------------------------------------------------------- toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 50;
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  font-size: 0.9375rem;
  box-shadow: var(--shadow-card);
  transform: translate(-50%, 16px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms var(--ease), transform 220ms var(--ease);
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------------------------------------------------------------- motion */

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
}

.rise {
  animation: rise 700ms var(--ease) both;
}

.rise--delay-1 {
  animation-delay: 90ms;
}

.rise--delay-2 {
  animation-delay: 180ms;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-delay: 0ms !important;
    transition-duration: 1ms !important;
  }
}

@media (max-width: 560px) {
  :root {
    --header-h: 64px;
  }

  .site-nav__link--secondary {
    display: none;
  }
}
