/*
 * main.css - the whole site's styles.
 *
 * Build tokens: /assets/oswald-latin-var.571f3457.woff2 and /images/background_black.7bf1bf58.960.webp are substituted by build/build.mjs, because
 * both assets have content-hashed filenames that only exist at build time.
 *
 * DESIGN LANGUAGE - taken from the band logo: hand-drawn condensed caps in bone-white ink on
 * mottled dark concrete. Deliberately monochrome. The only colour on the page comes from the
 * photographs, which is what makes them land. Buttons and links separate themselves by weight,
 * rule, and spacing - never by hue.
 *
 * Mobile-first: base rules target a phone, and min-width queries add complexity for bigger
 * screens. The old stylesheet did the reverse and ended up overriding desktop positioning with
 * absolute positioning on mobile, which is why the header used to overlap the page.
 */

/*********************************  FONT  ************************************/

/*
 * Oswald, Latin subset, as a VARIABLE font: one 21KB file covers weights 200-700, so the whole
 * type system costs a single request. Self-hosted rather than loaded from Google Fonts - no
 * third-party connection, no extra DNS lookup on the critical path.
 * swap: show fallback text immediately rather than blocking the first paint on the font.
 */
@font-face {
  font-family: 'Oswald';
  src: url('/assets/oswald-latin-var.571f3457.woff2') format('woff2');
  font-weight: 200 700;
  font-style: normal;
  font-display: swap;
}

/*********************************  TOKENS  ************************************/

:root {
  /* Ink: bone white, matching the logo's lettering. Pure #fff is harsher than the logo reads. */
  --ink: #edeae4;
  /* Secondary text - cities, dates, captions. 5.7:1 on --ground, so it clears WCAG AA. */
  --ink-dim: #8a8a88;
  /* Hairlines and disabled states only. Too low-contrast for text, by design. */
  --ink-faint: #55534f;

  --ground: #0b0b0b;
  --ground-raised: #131211;

  --rule: rgba(237, 234, 228, 0.14);
  --rule-strong: rgba(237, 234, 228, 0.34);

  --display: 'Oswald', 'Arial Narrow', 'Helvetica Neue Condensed', sans-serif;
  --body: system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;

  --wrap: 1100px;
  /* Page gutter scales with the viewport so it stays proportionate from phone to desktop. */
  --gutter: clamp(1rem, 4vw, 2.5rem);

  --tap: 44px; /* Minimum comfortable touch target. */
}

/*********************************  RESET  ************************************/

*,
*::before,
*::after {
  box-sizing: border-box;
}

body,
h1,
h2,
p,
figure,
fieldset,
legend {
  margin: 0;
  padding: 0;
}

fieldset {
  border: 0;
}

img,
picture,
svg {
  display: block;
  max-width: 100%;
}

/*********************************  BASE  ************************************/

/*
 * Smooth in-page scrolling for the nav's #anchor links. This is CSS now - the old main.js
 * implemented it in JavaScript to compensate for a fixed header, and the header is no longer
 * fixed. The reduced-motion block at the end of this file switches it back to instant.
 */
html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--ground);
  /*
   * The concrete texture from the logo, tiled at low opacity. It sits on the body rather than a
   * pseudo-element so it can't intercept clicks, and it's a ~15KB image reused site-wide.
   */
  background-image: url('/images/background_black.7bf1bf58.960.webp');
  background-size: 600px auto;
  background-repeat: repeat;
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--body);
  font-size: 1rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  /*
   * Safety net for long unbreakable strings. "badfriendsdsm@gmail.com" has no space to wrap at,
   * so on a narrow screen it would push the whole page sideways. break-word only engages when the
   * word would actually overflow, so normal text is untouched.
   */
  overflow-wrap: break-word;
}

/* A translucent wash over the texture keeps it as atmosphere rather than noise behind text. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(11, 11, 11, 0.82);
  pointer-events: none;
  z-index: -1;
}

a {
  color: var(--ink);
  text-decoration-color: var(--rule-strong);
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-color: var(--ink);
}

/* One visible focus style everywhere. The old stylesheet had none, making keyboard use guesswork. */
:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

main {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

section {
  margin-block: clamp(2.5rem, 7vw, 4.5rem);
}

/* Section eyebrow: small, spaced caps with a rule running off to the right. */
.section-label {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
  font-family: var(--display);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--rule);
}

.section-label--page {
  font-size: 1.1rem;
  color: var(--ink);
}

/* Visible only to keyboard users, and only once focused. */
.skip-link {
  position: absolute;
  left: -9999px;
  z-index: 999;
  padding: 0.75rem 1.25rem;
  background: var(--ink);
  color: var(--ground);
  font-family: var(--display);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.skip-link:focus {
  left: var(--gutter);
  top: 0.5rem;
}

/*********************************  HEADER / NAV  ************************************/

.site-header {
  /* Positioning context for the mobile dropdown, which is absolutely positioned below it. */
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0.75rem var(--gutter);
  border-bottom: 1px solid var(--rule);
}

.brand {
  flex-shrink: 0;
  line-height: 0;
}

.brand-img {
  width: 120px;
  height: auto;
}

.nav-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: var(--tap);
  padding: 0 0.5rem;
  background: none;
  border: 1px solid var(--rule);
  color: var(--ink);
  font-family: var(--display);
  font-size: 0.8rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
}

/* Three bars drawn with a gradient - no icon font, no extra element per bar. */
.nav-toggle-bars {
  width: 18px;
  height: 12px;
  background: linear-gradient(
    to bottom,
    currentColor 0 2px,
    transparent 2px 5px,
    currentColor 5px 7px,
    transparent 7px 10px,
    currentColor 10px 12px
  );
}

.site-nav {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  left: 0;
  z-index: 20;
  flex-direction: column;
  padding: 0.5rem var(--gutter) 1rem;
  background: var(--ground-raised);
  border-bottom: 1px solid var(--rule);
}

/* Toggled by src/scripts/site.js via a class, never by writing inline styles. */
.site-nav.is-open {
  display: flex;
}

.site-nav a {
  display: flex;
  align-items: center;
  min-height: var(--tap);
  font-family: var(--display);
  font-size: 1rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
}

.nav-social {
  display: flex;
  gap: 1.25rem;
  padding-top: 0.75rem;
}

.nav-social a {
  min-height: var(--tap);
  min-width: var(--tap);
  justify-content: center;
  border-bottom: 0;
  color: var(--ink-dim);
}

.nav-social a:hover {
  color: var(--ink);
}

@media (min-width: 800px) {
  .nav-toggle {
    display: none;
  }

  .site-nav {
    display: flex;
    position: static;
    flex-direction: row;
    align-items: center;
    gap: 1.75rem;
    padding: 0;
    background: none;
    border-bottom: 0;
  }

  .site-nav a {
    min-height: auto;
    font-size: 0.85rem;
    border-bottom: 0;
  }

  .nav-social {
    padding-top: 0;
    gap: 0.9rem;
  }

  .nav-social a {
    min-height: auto;
    min-width: auto;
  }

  .brand-img {
    width: 150px;
  }
}

/*********************************  HERO  ************************************/

.hero {
  margin-block: clamp(2rem, 6vw, 3.5rem) clamp(1.5rem, 4vw, 2rem);
}

/*
 * The band name as real, crawlable text. The old homepage had no <h1> at all - "Bad Friends"
 * existed only as a logo alt attribute, so search engines had no heading to rank.
 * clamp() scales it continuously instead of stepping at breakpoints.
 */
.hero-title {
  font-family: var(--display);
  font-size: clamp(3rem, 16vw, 8rem);
  font-weight: 600;
  line-height: 0.86;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}

.hero-tagline {
  margin-top: 0.75rem;
  font-family: var(--display);
  font-size: clamp(0.85rem, 2.6vw, 1.05rem);
  font-weight: 300;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

/*********************************  SHOWS  ************************************/

/*
 * Dense tour-roster rows: date block, then event and city, then an arrow when there's a link.
 * Rows are separated by hairlines rather than boxes so a long list stays scannable.
 */
.show {
  display: grid;
  /*
   * Three things here stop a narrow screen overflowing, and all three are needed:
   *
   * 1. min(4.25rem, 26%) on the date column. A bare rem value scales with the visitor's default
   *    text size, so at 24px root it claimed 138px of a 280px screen and left nothing for the
   *    venue. The percentage caps it against the ROW, not the root font.
   * 2. minmax(0, 1fr), not 1fr. `1fr` means minmax(auto, 1fr), and that `auto` floor refuses to
   *    shrink below the column's longest word.
   * 3. min-width: 0 on .show-what (below). A grid ITEM has its own automatic minimum size, so
   *    even a zero-min TRACK gets pushed wide by the item inside it. Fixing the track alone is
   *    the classic half-fix - it looks right until the text gets long or big.
   */
  grid-template-columns: min(4.25rem, 26%) minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 0 1rem;
  min-height: var(--tap);
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--rule);
  color: var(--ink);
  text-decoration: none;
}

a.show:hover,
a.show:focus-visible {
  background: var(--ground-raised);
  /* Bleed the hover surface into the gutter so it reads as a full-width row. */
  box-shadow: -0.75rem 0 0 var(--ground-raised), 0.75rem 0 0 var(--ground-raised);
}

.show-when {
  display: flex;
  flex-direction: column;
  font-family: var(--display);
  line-height: 1.05;
}

.show-dow {
  font-size: 0.7rem;
  font-weight: 300;
  letter-spacing: 0.16em;
  color: var(--ink-dim);
}

.show-date {
  font-size: 1.35rem;
  font-weight: 500;
  /* Tabular figures keep the date column aligned down the list. */
  font-variant-numeric: tabular-nums;
}

.show-what {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  /* See point 3 in .show: without this the grid item refuses to shrink below its min-content
     width and pushes the row (and the whole page) sideways, whatever the track is set to. */
  min-width: 0;
}

.show-name {
  /* `anywhere` rather than `break-word`: only `anywhere` also reduces the element's min-content
     width, which is what lets the grid column above actually shrink. */
  overflow-wrap: anywhere;
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.15;
}

.show-where {
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  color: var(--ink-dim);
}

.show-go {
  align-self: center;
  font-size: 1.1rem;
  color: var(--ink-dim);
  transition: transform 0.15s ease;
}

a.show:hover .show-go {
  transform: translateX(3px);
  color: var(--ink);
}

/* Shows with no event link yet: same row, muted, no arrow, no hover affordance. */
.show--nolink .show-name {
  color: var(--ink);
}

.show--nolink .show-dow,
.show--nolink .show-where {
  color: var(--ink-faint);
}

/*
 * Cancelled or postponed. The palette has no hue to signal with, so this reads through a struck
 * name plus an explicit word - which is clearer than colour anyway, and survives being printed,
 * screenshotted, or read aloud by a screen reader.
 */
.show--off .show-name {
  text-decoration: line-through;
  text-decoration-thickness: 1px;
  color: var(--ink-dim);
}

.show-flag {
  margin-top: 0.2rem;
  font-family: var(--display);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink);
  border: 1px solid var(--rule-strong);
  padding: 0.05rem 0.4rem;
  align-self: start;
}

/* The next gig, given hero treatment: bigger, bracketed by heavier rules. */
.show--next {
  grid-template-columns: min(5.75rem, 32%) minmax(0, 1fr) auto;
  padding: 1.4rem 0;
  border-top: 2px solid var(--rule-strong);
  border-bottom: 2px solid var(--rule-strong);
}

.show--next .show-dow {
  font-size: 0.8rem;
}

.show--next .show-date {
  font-size: 2.1rem;
  font-weight: 600;
}

.show--next .show-name {
  font-size: 1.5rem;
  font-weight: 600;
}

.show--next .show-where {
  font-size: 0.95rem;
}

@media (min-width: 700px) {
  .show--next {
    grid-template-columns: min(7.5rem, 32%) minmax(0, 1fr) auto;
  }

  .show--next .show-date {
    font-size: 2.75rem;
  }

  .show--next .show-name {
    font-size: 2rem;
  }
}

.shows-empty {
  padding: 1rem 0;
  color: var(--ink-dim);
}

/* Past shows: a native <details>, so the disclosure works with zero JavaScript. */
.past {
  margin-top: 2rem;
}

.past-toggle {
  display: flex;
  align-items: center;
  min-height: var(--tap);
  font-family: var(--display);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-dim);
  cursor: pointer;
}

.past-toggle:hover {
  color: var(--ink);
}

/* Played shows are reference material, not a call to action - so they sit back visually. */
.past-list {
  opacity: 0.62;
}

/*********************************  VIDEO FACADE  ************************************/

/*
 * A poster image plus a play button that swaps in the real YouTube iframe on click.
 * A YouTube embed costs the better part of a megabyte of player JavaScript before anyone presses
 * play; a poster frame costs about 15KB.
 */
.vfacade {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  background: var(--ground-raised);
  border: 1px solid var(--rule);
  cursor: pointer;
  /* Reserve 16:9 up front so nothing shifts as the poster loads. */
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.vfacade picture,
.vfacade img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.vfacade img {
  transition: opacity 0.2s ease, transform 0.4s ease;
  opacity: 0.78;
}

.vfacade:hover img,
.vfacade:focus-visible img {
  opacity: 1;
  transform: scale(1.02);
}

.vfacade-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.vfacade-play-bg {
  fill: var(--ink);
  opacity: 0.9;
  transition: opacity 0.2s ease;
}

.vfacade:hover .vfacade-play-bg {
  opacity: 1;
}

/* Caption strip along the bottom of the tile. */
.vfacade-title {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 2.5rem 0.9rem 0.7rem;
  background: linear-gradient(to top, rgba(11, 11, 11, 0.92), transparent);
  color: var(--ink);
  font-family: var(--display);
  font-size: 0.85rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-align: left;
  text-transform: uppercase;
  pointer-events: none;
}

/* The iframe that replaces the facade once clicked. */
.video-frame {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--rule);
  display: block;
}

.video-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

@media (min-width: 700px) {
  .video-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1000px) {
  .video-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/*********************************  PHOTOS  ************************************/

.photo-grid {
  display: grid;
  /* These column counts must match the `sizes` attribute generated in build/build.mjs. */
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
}

@media (min-width: 700px) {
  .photo-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.8rem;
  }
}

@media (min-width: 1100px) {
  .photo-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.photo {
  display: block;
  padding: 0;
  background: none;
  border: 1px solid var(--rule);
  cursor: pointer;
  overflow: hidden;
}

.photo-img {
  width: 100%;
  height: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  transition: transform 0.4s ease, opacity 0.2s ease;
  opacity: 0.88;
}

.photo:hover .photo-img,
.photo:focus-visible .photo-img {
  transform: scale(1.04);
  opacity: 1;
}

/*********************************  LIGHTBOX  ************************************/

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--gutter);
  background: rgba(6, 6, 6, 0.95);
}

.lightbox[hidden] {
  display: none;
}

.lightbox img {
  max-width: 100%;
  max-height: 88vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border: 1px solid var(--rule-strong);
}

.lightbox-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: var(--tap);
  height: var(--tap);
  background: none;
  border: 1px solid var(--rule);
  color: var(--ink);
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
}

/*********************************  BOOKING FORM  ************************************/

.booking-sub {
  margin-bottom: 1.5rem;
  color: var(--ink-dim);
}

.booking-form {
  max-width: 780px;
}

/* The honeypot must be unreachable for humans but still present for bots. */
.booking-gotcha {
  position: absolute;
  left: -9999px;
}

.booking-row {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

@media (min-width: 700px) {
  .booking-row {
    flex-direction: row;
  }
}

.booking-field {
  display: flex;
  flex: 1;
  flex-direction: column;
  margin-bottom: 1rem;
}

.booking-field label,
.booking-fieldset legend {
  margin-bottom: 0.35rem;
  font-family: var(--display);
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.booking-field input,
.booking-field textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 0.6rem 0.75rem;
  background: var(--ground-raised);
  border: 1px solid var(--rule);
  border-radius: 0;
  color: var(--ink);
  /* 1rem (16px) stops iOS Safari zooming the viewport when a field receives focus. */
  font-size: 1rem;
  font-family: var(--body);
}

.booking-field textarea {
  resize: vertical;
}

/* Renders the native date picker's own UI against a dark background. */
.booking-field input[type='date'] {
  color-scheme: dark;
}

.booking-field input:focus,
.booking-field textarea:focus {
  border-color: var(--ink-dim);
}

.booking-fieldset {
  flex: 1;
  margin-bottom: 1rem;
  padding: 0.6rem 0.9rem 0.75rem;
  border: 1px solid var(--rule);
}

.booking-radios {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.booking-radios label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-height: var(--tap);
  font-family: var(--body);
  font-size: 0.95rem;
  letter-spacing: normal;
  text-transform: none;
  color: var(--ink);
  cursor: pointer;
}

.booking-radios input[type='radio'] {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--ink);
  cursor: pointer;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  margin-top: 0.5rem;
  padding: 0.75rem 2rem;
  background: none;
  border: 1px solid var(--ink);
  color: var(--ink);
  font-family: var(--display);
  font-size: 0.9rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease;
}

.btn:hover,
.btn:focus-visible {
  background: var(--ink);
  color: var(--ground);
}

.btn[disabled] {
  border-color: var(--ink-faint);
  color: var(--ink-faint);
  cursor: wait;
}

/* Success and failure differ by rule weight and wording, not colour - the palette has no hue. */
.booking-status {
  margin-top: 1.25rem;
  padding: 0.85rem 1rem;
  border-left: 3px solid var(--ink);
  background: var(--ground-raised);
}

.booking-status--error {
  border-left-style: dashed;
  border-left-color: var(--ink-dim);
}

/*********************************  FOOTER  ************************************/

.site-footer {
  max-width: var(--wrap);
  margin: 4rem auto 0;
  padding: 2rem var(--gutter) 2.5rem;
  border-top: 1px solid var(--rule);
  text-align: center;
}

.footer-book {
  font-family: var(--display);
  font-size: 0.95rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.footer-social {
  display: flex;
  /* A flex row does not wrap unless told to. With rem-based gaps that grow alongside a raised
     default text size, three links stop fitting on one line at 280px and spill off-screen. */
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1.5rem;
  margin-top: 1rem;
}

.footer-social a {
  min-height: var(--tap);
  display: inline-flex;
  align-items: center;
  font-family: var(--display);
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-dim);
  text-decoration: none;
}

.footer-social a:hover {
  color: var(--ink);
}

.footer-legal {
  margin-top: 1.25rem;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
}

/*********************************  MOTION  ************************************/

/* Respect a system-level request for reduced motion: keep state changes, drop the movement. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
