/**
 * @file styles.css
 * @brief Black/white poster-matched styles for the Harbury PEB screening site.
 */

:root {
  color-scheme: dark;
  --bg: #000000;
  --fg: #ffffff;
  --fg-muted: rgba(255, 255, 255, 0.72);
  --accent-16: #d52e20;
  --rule: #ffffff;
  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1.25rem;
  --space-lg: 2rem;
  --space-xl: 3.5rem;
  --space-2xl: 5rem;
  --max: 42rem;
  --max-wide: 56rem;
  --font: "League Spartan", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  /* Notch / home-indicator insets (0 on browsers without them) */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

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

html {
  /* Avoid smooth scrolling on the root — it fights mobile momentum scrolling */
  scroll-behavior: auto;
  /* Match page black so overscroll/rubber-band never flashes a light edge */
  background: var(--bg);
  overscroll-behavior-y: none;
}

body {
  margin: 0;
  /* svh = stable small viewport; dvh jumps when mobile browser chrome shows/hides */
  min-height: 100svh;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-weight: 500;
  font-size: 1.05rem;
  line-height: 1.45;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: var(--fg);
  text-underline-offset: 0.2em;
}

a:hover {
  opacity: 0.85;
}

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

.skip-link {
  position: absolute;
  left: var(--space-md);
  top: -100%;
  z-index: 100;
  padding: var(--space-sm) var(--space-md);
  background: var(--fg);
  color: var(--bg);
  text-decoration: none;
  font-weight: 600;
}

.skip-link:focus {
  top: var(--space-md);
}

/* Fixed edge fades — content blends into black at the viewport edges */
.edge-fade {
  position: fixed;
  left: 0;
  right: 0;
  height: 9svh;
  min-height: 3.25rem;
  max-height: 6.5rem;
  pointer-events: none;
  z-index: 40;
}

.edge-fade--top {
  top: 0;
  background: linear-gradient(
    to bottom,
    var(--bg) 0%,
    rgba(0, 0, 0, 0.88) 28%,
    rgba(0, 0, 0, 0.45) 62%,
    transparent 100%
  );
}

.edge-fade--bottom {
  bottom: 0;
  background: linear-gradient(
    to top,
    var(--bg) 0%,
    rgba(0, 0, 0, 0.88) 28%,
    rgba(0, 0, 0, 0.45) 62%,
    transparent 100%
  );
}

/* —— Header / NEB brand —— */
.site-header {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 10;
  padding: calc(var(--space-md) + var(--safe-top)) calc(var(--space-md) + var(--safe-right)) 0;
}

.neb-brand {
  display: block;
  width: clamp(3.75rem, 14vw, 5.75rem);
  text-decoration: none;
  opacity: 0;
  animation: rise 0.9s var(--ease) 0.15s forwards;
}

.neb-brand img {
  width: 100%;
  height: auto;
}

/* —— Hero —— */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: flex-end;
  padding:
    calc(clamp(5.5rem, 18vw, 7rem) + var(--safe-top))
    calc(var(--space-md) + var(--safe-right))
    calc(var(--space-xl) + var(--safe-bottom))
    calc(var(--space-md) + var(--safe-left));
}

.hero__inner {
  width: min(100%, var(--max));
  margin: 0 auto 0 0;
  opacity: 0;
  animation: rise 0.9s var(--ease) 0.05s forwards;
}

.hero__brand {
  margin: 0;
  max-width: min(100%, 42rem);
}

.hero__lockup {
  display: flex;
  align-items: flex-start;
  gap: 0.14em;
  margin: 0;
  color: var(--fg);
  font-size: clamp(2.9rem, 12vw, 5.6rem);
}

.hero__lockup-rule {
  flex: 0 0 0.085em;
  width: 0.085em;
  height: 2.76em;
  background: var(--fg);
}

.hero__lockup-main {
  min-width: 0;
  flex: 1;
}

.hero__lockup-text {
  margin: 0 0 0.35em;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 1em;
  font-weight: 700;
  line-height: 0.92;
  letter-spacing: -0.015em;
}

.hero__lockup-text span {
  display: block;
}

.hero__tagline {
  margin: 0 0 var(--space-lg);
  padding-left: 0;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  /* Scales with lockup; sized so the line reads ~as wide as “Briefing” */
  font-size: 0.27em;
  font-weight: 500;
  font-style: italic;
  letter-spacing: 0.01em;
  line-height: 1.3;
  color: var(--fg);
  white-space: nowrap;
}

.hero__details {
  margin: 0;
}

.hero__place {
  margin: 0 0 var(--space-sm);
  font-size: clamp(2.4rem, 10vw, 3.6rem);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.01em;
  color: var(--accent-16);
}

.hero__blurb {
  margin: 0 0 var(--space-md);
  font-size: clamp(1rem, 3.2vw, 1.2rem);
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: 0;
  max-width: 22rem;
}

.hero__venue,
.hero__when {
  margin: 0;
  font-size: clamp(1rem, 3.2vw, 1.2rem);
  font-weight: 500;
  letter-spacing: 0;
}

.hero__when {
  margin-bottom: var(--space-lg);
}

.hero__actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-md);
  opacity: 0;
  animation: rise 0.9s var(--ease) 0.35s forwards;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3.25rem;
  padding: 0.9rem 1.6rem;
  border: 2px solid var(--fg);
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  text-decoration: none;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), transform 0.2s var(--ease);
}

.btn--primary {
  background: var(--fg);
  color: var(--bg);
}

.btn--primary:hover {
  background: transparent;
  color: var(--fg);
  opacity: 1;
}

.btn--primary:active {
  transform: translateY(1px);
}

.hero__neb-link {
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.4);
  padding-bottom: 0.15rem;
}

.rating {
  position: absolute;
  right: calc(var(--space-md) + var(--safe-right));
  bottom: calc(var(--space-lg) + var(--safe-bottom));
  display: flex;
  align-items: center;
  gap: 0.65rem;
  max-width: min(14rem, calc(100% - 2 * var(--space-md) - var(--safe-left) - var(--safe-right)));
  color: var(--fg);
  text-align: left;
}

.rating__badge {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--accent-16);
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
}

.rating__text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.rating__title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.2;
}

.rating__detail {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--fg-muted);
  line-height: 1.25;
}

/* —— Sections —— */
.section {
  padding: var(--space-2xl) calc(var(--space-md) + var(--safe-right)) var(--space-2xl) calc(var(--space-md) + var(--safe-left));
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.section__inner {
  width: min(100%, var(--max-wide));
  margin: 0 auto;
}

.section__title {
  margin: 0 0 var(--space-sm);
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.section__lede {
  margin: 0 0 var(--space-lg);
  color: var(--fg-muted);
  font-weight: 500;
  max-width: 28rem;
}

.section__foot {
  margin: var(--space-lg) 0 0;
  font-size: 0.95rem;
  font-weight: 500;
}

.section__foot a {
  color: var(--fg-muted);
}

.section__empty {
  margin: 0;
  color: var(--fg-muted);
  font-weight: 500;
}

/* —— Screenings list —— */
.screenings {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-md);
}

.screening {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-md);
  align-items: center;
  padding: var(--space-md) 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  text-decoration: none;
  color: inherit;
  transition: opacity 0.2s var(--ease);
}

.screening:hover {
  opacity: 0.85;
}

.screening--past {
  opacity: 0.38;
  filter: grayscale(1);
}

.screening--past:hover {
  opacity: 0.5;
}

.screening--past .screening__cta {
  text-decoration: none;
  opacity: 0.9;
}

.screening__logo {
  width: 4.5rem;
  height: 4.5rem;
  display: grid;
  place-items: center;
  background: transparent;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  grid-row: 1 / span 2;
}

.screening__logo img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

.screening__body {
  min-width: 0;
  grid-column: 2;
}

.screening__name {
  margin: 0 0 0.2rem;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.2;
}

.screening__meta {
  margin: 0;
  color: var(--fg-muted);
  font-size: 0.95rem;
  font-weight: 500;
}

.screening__cta {
  margin: 0.35rem 0 0;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 0.18em;
  grid-column: 2;
}

/* —— Supporters —— */
.supporters {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
  align-items: center;
}

.supporter {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  text-decoration: none;
  color: inherit;
  text-align: center;
  padding: var(--space-sm);
  transition: opacity 0.2s var(--ease);
}

.supporter:hover {
  opacity: 0.8;
}

.supporter__logo {
  height: 5.5rem;
  width: 100%;
  max-width: 12rem;
  display: grid;
  place-items: center;
}

.supporter__logo img {
  max-height: 5.5rem;
  max-width: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

.supporter__logo--mono img {
  filter: brightness(0) invert(1);
}

.supporter__name {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-muted);
}

.supporter__mark {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.2;
  color: var(--fg);
  text-transform: none;
}

/* —— Footer —— */
.site-footer {
  padding:
    var(--space-xl)
    calc(var(--space-md) + var(--safe-right))
    calc(var(--space-2xl) + var(--safe-bottom))
    calc(var(--space-md) + var(--safe-left));
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.site-footer__inner {
  width: min(100%, var(--max-wide));
  margin: 0 auto;
  color: var(--fg-muted);
  font-size: 0.95rem;
  font-weight: 500;
}

.site-footer p {
  margin: 0 0 var(--space-sm);
  max-width: 28rem;
}

.site-footer a {
  color: var(--fg);
}

.site-footer__copy {
  opacity: 0.7;
}

/* —— Motion —— */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(0.75rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Scroll reveals — sections ease in as they enter the viewport */
.reveal {
  opacity: 0;
  transform: translateY(1.25rem);
  transition:
    opacity 0.7s var(--ease),
    transform 0.7s var(--ease);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-stagger > * {
  opacity: 0;
  transform: translateY(0.75rem);
  transition:
    opacity 0.55s var(--ease),
    transform 0.55s var(--ease);
}

.reveal.is-visible .reveal-stagger > *:nth-child(1) {
  transition-delay: 0.08s;
}
.reveal.is-visible .reveal-stagger > *:nth-child(2) {
  transition-delay: 0.16s;
}
.reveal.is-visible .reveal-stagger > *:nth-child(3) {
  transition-delay: 0.24s;
}
.reveal.is-visible .reveal-stagger > *:nth-child(4) {
  transition-delay: 0.32s;
}
.reveal.is-visible .reveal-stagger > *:nth-child(5) {
  transition-delay: 0.4s;
}

.reveal.is-visible .reveal-stagger > * {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .neb-brand,
  .hero__inner,
  .hero__actions {
    animation: none;
    opacity: 1;
  }

  .reveal,
  .reveal-stagger > * {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .btn,
  .screening,
  .supporter {
    transition: none;
  }
}

/* —— Larger screens —— */
@media (min-width: 640px) {
  .site-header {
    padding: calc(var(--space-lg) + var(--safe-top)) calc(var(--space-lg) + var(--safe-right)) 0;
  }

  .hero {
    padding:
      calc(clamp(6rem, 12vw, 8rem) + var(--safe-top))
      calc(var(--space-lg) + var(--safe-right))
      calc(var(--space-2xl) + var(--safe-bottom))
      calc(var(--space-lg) + var(--safe-left));
    align-items: center;
  }

  .hero__inner {
    margin: 0;
  }

  .hero__brand {
    max-width: 44rem;
  }

  .hero__actions {
    flex-direction: row;
    align-items: center;
    gap: var(--space-lg);
  }

  .rating {
    right: calc(var(--space-lg) + var(--safe-right));
    bottom: calc(var(--space-xl) + var(--safe-bottom));
  }

  .rating__badge {
    width: 2.75rem;
    height: 2.75rem;
    font-size: 1.05rem;
  }

  .section {
    padding: var(--space-2xl) calc(var(--space-lg) + var(--safe-right)) var(--space-2xl) calc(var(--space-lg) + var(--safe-left));
  }

  .supporters {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-xl);
  }

  .screening {
    grid-template-columns: 5.5rem 1fr auto;
    gap: var(--space-lg);
  }

  .screening__logo {
    width: 5.5rem;
    height: 5.5rem;
    grid-row: auto;
  }

  .screening__body {
    grid-column: auto;
  }

  .screening__cta {
    justify-self: end;
    align-self: center;
    margin: 0;
    white-space: nowrap;
    grid-column: auto;
  }
}

@media (min-width: 960px) {
  .hero__inner {
    width: min(100%, 72rem);
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(16rem, 0.85fr);
    gap: clamp(2rem, 5vw, 4.5rem);
    align-items: center;
  }

  .hero__brand {
    max-width: 46rem;
  }

  .hero__lockup {
    font-size: clamp(3.6rem, 5.6vw, 5.6rem);
  }

  .hero__tagline {
    margin-bottom: 0;
  }

  .hero__details {
    padding-top: 0.25rem;
  }

  .hero__place {
    font-size: clamp(2.75rem, 4.5vw, 3.75rem);
  }

  .hero__actions {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-md);
  }

  .btn {
    min-height: 3.5rem;
    padding: 1rem 2rem;
    font-size: 1.1rem;
  }
}

@media (min-width: 1200px) {
  .hero__actions {
    flex-direction: row;
    align-items: center;
    gap: var(--space-lg);
  }
}
