/* The Loop — retro skin.
 *
 * Loop pages are meant to feel like stepping into a 2003 clubbing forum: small
 * Verdana, dense bordered tables, grey-to-darker gradient bars, bevelled
 * buttons that press in. It deliberately does NOT reuse the main site's colour
 * tokens or type; that is the point of the place.
 *
 * Loaded after css/style.css, and every selector starts `body.loop`, so
 * nothing here can leak onto a main-site page, and each rule outranks the
 * style.css rule it replaces (including the ones inside its media queries).
 *
 * One fixed dark scheme, no light mode. Text contrast, measured on the surface
 * each colour actually sits on, is at least 4.5:1 throughout — the numbers are
 * beside the tokens.
 */

body.loop {
  /* Surfaces */
  --lp-bg: #101018;
  --lp-panel: #1c1c28;
  --lp-row-alt: #24243a;
  --lp-head: #2e2e46;
  --lp-border: #4c4c66;
  --lp-shadow: #000000;

  /* Ink. Ratios against --lp-panel (#1c1c28), then against the two lighter
     surfaces text can land on: striped rows (--lp-row-alt) and table heads and
     the sub-bar (--lp-head, #2e2e46). */
  --lp-text: #e8e8ee;          /* 13.8 : 1   12.4 on row-alt */
  --lp-muted: #a9a9bd;         /*  7.3 : 1    6.6 on row-alt, 5.7 on head */
  --lp-link: #66ccff;          /*  9.4 : 1    8.4 on row-alt, 7.3 on head */
  --lp-link-visited: #d9a3ff;  /*  8.5 : 1    7.7 on row-alt, 6.7 on head */
  --lp-link-hover: #ffde4d;    /* 12.7 : 1   11.4 on row-alt */
  --lp-error: #ff8f8f;         /*  7.7 : 1 */
  --lp-ok: #8fff8f;            /* 13.5 : 1 */

  /* Gradient bars: white type with a black drop shadow; 4.9:1 at the lightest
     (top) stop, 12.1:1 at the bottom. */
  --lp-bar-top: #6e6e88;
  --lp-bar-bottom: #34344a;
  --lp-bar-text: #ffffff;

  /* Bevelled grey controls, Windows-classic style. Black on the face 13.7:1. */
  --lp-btn-face: #d4d0c8;
  --lp-btn-text: #000000;
  --lp-btn-hi: #ffffff;
  --lp-btn-mid: #a0a0a0;
  --lp-btn-lo: #404040;
  /* The current tab: black on gold, 13.9:1. */
  --lp-tab-on: #ffcc33;

  /* NEW! — pale yellow on red, 5.5:1. */
  --lp-new-bg: #cc0000;
  --lp-new-text: #ffff66;

  /* Form fields: black on white, 21:1. */
  --lp-field: #ffffff;
  --lp-field-text: #000000;

  --lp-focus: #ffde4d;
  --lp-font: Verdana, Tahoma, "DejaVu Sans", Geneva, sans-serif;
  --wrap: 60rem;

  background: var(--lp-bg);
  color: var(--lp-text);
  font-family: var(--lp-font);
  font-size: 12px;
  line-height: 1.45;
  -webkit-font-smoothing: auto;
}

/* style.css's backdrop photo and shade layers: not here. */
body.loop::before,
body.loop::after { content: none; }

body.loop a { color: var(--lp-link); }
body.loop a:visited { color: var(--lp-link-visited); }
body.loop a:hover { color: var(--lp-link-hover); }

body.loop :focus-visible {
  outline: 2px dotted var(--lp-focus);
  outline-offset: 2px;
  border-radius: 0;
}

body.loop .wrap { padding-inline: 0.75rem; }

body.loop h1,
body.loop h2,
body.loop h3 {
  font-family: var(--lp-font);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.3;
  text-wrap: wrap;
}

body.loop h1 { font-size: 16px; }
body.loop h2 { font-size: 12px; }
body.loop h3 { font-size: 12px; }

body.loop p { margin: 0 0 0.6em; }

/* --- Site header and main nav ------------------------------------------- */
/* Same markup and links as the main site, dressed as a 2003 banner with a row
   of bevelled grey tabs. Not sticky: two rows of tabs pinned over a phone
   screen would eat it. */

body.loop .site-header {
  position: static;
  background: linear-gradient(#2a2a44, #12121e);
  backdrop-filter: none;
  border-bottom: 2px solid var(--lp-border);
}

body.loop .site-header .wrap {
  gap: 8px;
  padding-block: 8px 0;
}

body.loop .brand img { height: 26px; }

@media (min-width: 47.75rem) {
  body.loop .brand img { height: 36px; }
}

@media (min-width: 64.25rem) {
  body.loop .site-header .wrap {
    column-gap: 16px;
    row-gap: 8px;
    padding-block: 8px 0;
    align-items: end;
  }
  body.loop .brand { padding-bottom: 8px; }
}

/* Tabs wrap to a second row on a phone rather than scrolling sideways: two
   rows of tabs is exactly what this era looked like. */
body.loop .site-nav {
  flex-wrap: wrap;
  justify-content: center;
  align-self: center;
  gap: 3px;
  overflow: visible;
  font-family: var(--lp-font);
  font-size: 11px;
  letter-spacing: 0;
}

@media (min-width: 64.25rem) {
  body.loop .site-nav { justify-content: flex-start; }
}

body.loop .site-nav a,
body.loop .site-nav a:visited {
  padding: 3px 8px 2px;
  color: var(--lp-btn-text);
  background: linear-gradient(#ecebe6, var(--lp-btn-face));
  border: 1px solid;
  border-color: var(--lp-btn-hi) var(--lp-btn-lo) var(--lp-btn-face) var(--lp-btn-hi);
  border-bottom: 0;
  border-radius: 3px 3px 0 0;
  font-weight: 700;
  text-decoration: none;
  box-shadow: none;
}

body.loop .site-nav a:hover {
  color: var(--lp-btn-text);
  background: #ffffff;
}

body.loop .site-nav a[aria-current="page"] {
  color: var(--lp-btn-text);
  background: var(--lp-tab-on);
  box-shadow: none;
}

/* Should the alerts ticker ever ride along on a Loop page: a black-and-yellow
   scrolling ticker, the way every 2003 club site had one. The animation is
   style.css's and already stops under reduced motion. */
body.loop .page-strip--shout {
  margin-inline: -0.75rem;
  padding: 3px 0.75rem;
  background: #000000;
  color: var(--lp-tab-on);
  font-family: var(--lp-font);
  font-size: 11px;
  letter-spacing: 0;
  text-transform: none;
}

body.loop .page-strip--shout a {
  color: #ffffff;
  box-shadow: none;
  text-decoration: underline;
}

/* --- Loop sub-bar and session box ----------------------------------------- */

body.loop .lp-subbar {
  background: var(--lp-head);
  border-bottom: 1px solid var(--lp-shadow);
  font-size: 11px;
  font-weight: 700;
}

body.loop .lp-subbar .wrap { padding-block: 5px; text-align: center; }

body.loop .lp-subbar a { white-space: nowrap; }
body.loop .lp-subbar a[aria-current="page"] { color: var(--lp-text); text-decoration: none; }

body.loop .lp-sep { color: var(--lp-muted); }

body.loop .lp-session {
  max-width: var(--wrap);
  margin: 6px auto 0;
  padding-inline: 0.75rem;
  font-size: 11px;
  text-align: right;
  color: var(--lp-muted);
}

body.loop .lp-session strong { color: var(--lp-text); }

/* A button that reads as a link: Log out. */
body.loop .lp-linkbtn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--lp-link);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

body.loop .lp-linkbtn:hover { color: var(--lp-link-hover); }

/* --- Page body ------------------------------------------------------------ */

body.loop main { padding-block: 8px 32px; }

/* The page's title bar: the tallest gradient on the page. */
body.loop .lp-titlebar {
  margin-bottom: 10px;
  padding: 6px 8px;
  border: 1px solid var(--lp-shadow);
  background: linear-gradient(var(--lp-bar-top), var(--lp-bar-bottom));
  color: var(--lp-bar-text);
  text-shadow: 1px 1px 0 var(--lp-shadow);
}

body.loop .lp-titlebar h1 { margin: 0; }
body.loop .lp-titlebar p { margin: 2px 0 0; font-size: 11px; }

/* --- Boxes ------------------------------------------------------------------ */

body.loop .lp-box {
  margin-bottom: 10px;
  background: var(--lp-panel);
  border: 1px solid var(--lp-border);
  box-shadow: 2px 2px 0 var(--lp-shadow);
  min-width: 0;
}

body.loop .lp-box > h2 {
  margin: 0;
  padding: 3px 6px;
  background: linear-gradient(var(--lp-bar-top), var(--lp-bar-bottom));
  border-bottom: 1px solid var(--lp-shadow);
  color: var(--lp-bar-text);
  text-shadow: 1px 1px 0 var(--lp-shadow);
}

body.loop .lp-box-body { padding: 6px; }
body.loop .lp-box-body > :last-child { margin-bottom: 0; }

body.loop .lp-narrow { max-width: 32rem; margin-inline: auto; }

body.loop .lp-status { margin: 0; padding: 4px 0; color: var(--lp-muted); font-style: italic; }

body.loop .lp-more { margin: 6px 0 0; text-align: right; font-size: 11px; font-weight: 700; }

/* Home: one column on a phone; galleries beside comments and members wider. */
body.loop .lp-home { display: grid; gap: 0 10px; }

@media (min-width: 48rem) {
  body.loop .lp-home { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: start; }
}

/* --- Tables --------------------------------------------------------------- */

body.loop .lp-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--lp-border);
}

body.loop .lp-table th,
body.loop .lp-table td {
  padding: 4px 6px;
  border-bottom: 1px solid var(--lp-border);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

body.loop .lp-table th {
  background: var(--lp-head);
  font-size: 11px;
  white-space: nowrap;
}

body.loop .lp-table tbody tr:nth-child(even) td { background: var(--lp-row-alt); }

body.loop .lp-table .lp-num { text-align: right; white-space: nowrap; }

body.loop .lp-thumbcell { width: 62px; }

body.loop .lp-thumbcell img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border: 1px solid var(--lp-shadow);
  background: var(--lp-head);
}

body.loop .lp-strong { font-weight: 700; }

body.loop .lp-meta {
  margin-top: 1px;
  font-size: 11px;
  color: var(--lp-muted);
}

body.loop .lp-user { font-weight: 700; }

body.loop .lp-list { margin: 0; padding: 0; list-style: none; }

body.loop .lp-list li {
  padding: 3px 4px;
  border-bottom: 1px solid var(--lp-border);
}

body.loop .lp-list li:nth-child(even) { background: var(--lp-row-alt); }
body.loop .lp-list li:last-child { border-bottom: 0; }

/* --- Thumbnail grid --------------------------------------------------------- */
/* 120px thumbs; three to a row on a 375px phone. */

body.loop .lp-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (max-width: 30rem) {
  body.loop .lp-thumbs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

body.loop .lp-thumbs img {
  width: 100%;
  aspect-ratio: 1;
  height: auto;
  object-fit: cover;
  border: 1px solid var(--lp-shadow);
  background: var(--lp-head);
}

/* --- NEW! ------------------------------------------------------------------- */
/* Static on purpose: no blink, so there is nothing for reduced motion to stop. */

body.loop .lp-new {
  display: inline-block;
  padding: 0 3px;
  border: 1px solid var(--lp-new-text);
  background: var(--lp-new-bg);
  color: var(--lp-new-text);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.3;
  vertical-align: 1px;
}

/* --- Buttons ----------------------------------------------------------------- */

body.loop .lp-btn {
  display: inline-block;
  padding: 3px 12px;
  border: 2px solid;
  border-color: var(--lp-btn-hi) var(--lp-btn-lo) var(--lp-btn-lo) var(--lp-btn-hi);
  border-radius: 0;
  background: var(--lp-btn-face);
  color: var(--lp-btn-text);
  box-shadow: inset -1px -1px 0 var(--lp-btn-mid);
  font-family: var(--lp-font);
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

body.loop .lp-btn:active:not(:disabled) {
  border-color: var(--lp-btn-lo) var(--lp-btn-hi) var(--lp-btn-hi) var(--lp-btn-lo);
  box-shadow: inset 1px 1px 0 var(--lp-btn-mid);
  padding: 4px 11px 2px 13px;
}

body.loop .lp-btn:disabled { color: #555555; cursor: progress; } /* 4.9:1 on the face */

/* --- Forms ----------------------------------------------------------------- */

body.loop .lp-form label { display: block; margin: 6px 0 2px; font-weight: 700; }

body.loop .lp-form input[type="email"],
body.loop .lp-form input[type="text"] {
  width: 100%;
  max-width: 22rem;
  padding: 3px 4px;
  border: 2px solid;
  border-color: var(--lp-btn-lo) var(--lp-btn-hi) var(--lp-btn-hi) var(--lp-btn-lo);
  border-radius: 0;
  background: var(--lp-field);
  color: var(--lp-field-text);
  font-family: var(--lp-font);
  font-size: 16px; /* below 16px iOS zooms the page on focus */
}

body.loop .lp-form input[aria-invalid="true"] { border-color: var(--lp-error); }

body.loop .lp-form .lp-check {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 10px 0;
}

/* style.css gives every input a 46px min-height, padding and a fill; a
   checkbox wants none of them. */
body.loop .lp-check input {
  flex: none;
  width: 16px;
  height: 16px;
  min-height: 0;
  margin: 0;
  padding: 0;
  background: none;
  accent-color: var(--lp-tab-on);
}

body.loop .lp-hint { margin: 2px 0 0; font-size: 11px; color: var(--lp-muted); }

body.loop .lp-note {
  margin: 8px 0 10px;
  padding: 6px;
  border: 1px dashed var(--lp-border);
  background: var(--lp-bg);
  font-size: 11px;
  color: var(--lp-muted);
}

body.loop .lp-note strong { color: var(--lp-text); }
body.loop .lp-note p:last-child { margin-bottom: 0; }

body.loop .lp-error { margin: 4px 0; color: var(--lp-error); font-weight: 700; }
body.loop .lp-ok { margin: 0; color: var(--lp-ok); font-weight: 700; }

/* --- Event gallery, upload, comments ------------------------------------------ */

body.loop [hidden] { display: none !important; }

body.loop .lp-thumbs li { min-width: 0; }
body.loop .lp-thumbs a { display: block; }
body.loop .lp-thumbs .lp-pending img { opacity: 0.55; }
body.loop .lp-thumbs .lp-pending .lp-meta { display: block; }

body.loop .lp-uploads input[type="text"],
body.loop .lp-form textarea {
  width: 100%;
  max-width: 32rem;
  padding: 3px 4px;
  border: 2px solid;
  border-color: var(--lp-btn-lo) var(--lp-btn-hi) var(--lp-btn-hi) var(--lp-btn-lo);
  border-radius: 0;
  background: var(--lp-field);
  color: var(--lp-field-text);
  font-family: var(--lp-font);
  font-size: 16px;
}

body.loop .lp-form input[type="file"] { max-width: 100%; font-size: 12px; }
body.loop .lp-filecell { overflow-wrap: anywhere; }
body.loop .lp-uploadstatus { font-size: 11px; min-width: 5rem; }
body.loop .lp-comment-body { white-space: pre-wrap; overflow-wrap: anywhere; }
body.loop .lp-reply { margin-top: 8px; }
body.loop .lp-inline { margin: 6px 0; }

/* --- Single photo page ---------------------------------------------------------- */

body.loop .lp-photo { margin: 0 0 6px; text-align: center; }

body.loop .lp-photo img {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--lp-shadow);
  background: var(--lp-head);
}

body.loop .lp-photonav { margin: 0 0 6px; font-size: 12px; font-weight: 700; }
body.loop .lp-caption { margin: 0 0 4px; font-weight: 700; overflow-wrap: anywhere; }
body.loop .lp-badge { font-size: 11px; font-weight: 700; }
body.loop .lp-tagbtn { margin: 8px 0 4px; }
body.loop .lp-tags { margin: 4px 0; overflow-wrap: anywhere; }
body.loop .lp-actions { margin: 8px 0 0; font-size: 11px; }

/* --- Venues, galleries, member pages -------------------------------------------- */

body.loop .lp-text { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
body.loop .lp-form textarea { width: 100%; }
body.loop .lp-btn.lp-danger {
  --lp-btn-face: #f2b4b4;
  --lp-btn-text: #3a0000;
  background: #f2b4b4;
  color: #3a0000;
}
body.loop .lp-btn.lp-danger:disabled { color: #6b3a3a; }

/* --- Upvotes, sorting, promoters, Register a night --------------------------- */

/* Selects and dates in Loop forms get the same sunken field as text inputs. */
body.loop .lp-form select,
body.loop .lp-filter select,
body.loop .lp-form input[type="date"] {
  width: 100%;
  max-width: 22rem;
  min-height: 0;
  padding: 3px 4px;
  border: 2px solid;
  border-color: var(--lp-btn-lo) var(--lp-btn-hi) var(--lp-btn-hi) var(--lp-btn-lo);
  border-radius: 0;
  background: var(--lp-field);
  color: var(--lp-field-text);
  font-family: var(--lp-font);
  font-size: 16px; /* below 16px iOS zooms the page on focus */
}


/* "▲ 3" in the corner of a thumbnail: the gold of the current tab, so it reads
   as a score rather than as a link. */
body.loop .lp-thumbs a { position: relative; }

body.loop .lp-votes {
  position: absolute;
  left: 3px;
  bottom: 3px;
  padding: 0 4px;
  border: 1px solid var(--lp-shadow);
  background: var(--lp-tab-on);
  color: #000000; /* 13.9:1 on the gold */
  font-size: 11px;
  font-weight: 700;
  line-height: 16px;
}

body.loop .lp-votes-static { font-weight: 700; color: var(--lp-tab-on); }
body.loop .lp-votebar { margin: 8px 0 4px; }
body.loop .lp-votebtn[aria-pressed="true"] {
  background: var(--lp-tab-on);
  border-color: var(--lp-btn-lo) var(--lp-btn-hi) var(--lp-btn-hi) var(--lp-btn-lo); /* pressed in */
}

/* Top photos on the home page: one row of eight on a wide screen, four a row
   on a phone. */
body.loop .lp-topthumbs { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }
@media (max-width: 30rem) {
  body.loop .lp-topthumbs { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* "Sort: Newest · Top" over a gallery. */
body.loop .lp-sortbar { margin: 0 0 6px; font-size: 11px; font-weight: 700; }
body.loop .lp-sortbar a[aria-current="true"] { color: var(--lp-text); text-decoration: none; }

/* The promoter picker over the galleries table. */
body.loop .lp-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  margin: 0 0 8px;
  font-weight: 700;
}

body.loop .lp-filter select { width: auto; flex: 1 1 10rem; }
