/*
Theme Name: Rapperswheels
Theme URI: https://rapperswheels.ch
Author: Honegger AdvizorIT
Author URI: https://www.advizorit.ch
Description: One-Page-Theme für den Freestyle Verein Rapperswheels – Poster-Landing, Fotowand, Statuten und Kontaktformular mit Cloudflare Turnstile.
Version: 1.0.0
Requires at least: 6.3
Requires PHP: 7.4
License: Proprietary
Text Domain: rapperswheels
*/

/* ───── Rapperswheels ───── */

:root {
  --bg: #080808;
  --fg: #f2f2ef;
  --muted: #8f8f8a;
  --line: rgba(255, 255, 255, .16);
  --alert: #ff2d95;
  color-scheme: dark;
  --gutter: clamp(16px, 3vw, 40px);
  --font: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; }
img, video { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }

::selection { background: var(--fg); color: var(--bg); }

/* ───── Nav ───── */

.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px var(--gutter);
  color: #fff;
  mix-blend-mode: difference;
  pointer-events: none;
}
.admin-bar .nav { top: 32px; }
@media (max-width: 782px) { .admin-bar .nav { top: 46px; } }
.nav a { pointer-events: auto; text-decoration: none; }
.nav-brand { font-weight: 700; letter-spacing: .05em; }
.nav ul { display: flex; gap: clamp(14px, 2.5vw, 36px); list-style: none; margin: 0; padding: 0; }
.nav li a { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.nav li a span { opacity: .5; margin-right: .6em; }
.nav li a:hover { text-decoration: underline; text-underline-offset: 4px; }

/* ───── Poster backing (landing only, held by the sticky frame) ───── */

.backing {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: left center;
  pointer-events: none;
}

/* ───── Landing / torn poster ───── */

.poster {
  position: relative;
  height: 220vh;          /* extra scroll distance drives the papers peeling away */
}
.poster-sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
}
.poster-stage {
  position: absolute;
  left: -4vw;
  top: 50%;
  width: max(108vw, calc(108vh * 1672 / 941));
  aspect-ratio: 1672 / 941;
  translate: 0 -50%;
}
@media (max-aspect-ratio: 4/5) {
  .poster-stage { left: calc(2vw - 22vh); }
}
.poster-stage .layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  pointer-events: none;
  will-change: transform;
}
.layer[data-layer=green] { transform-origin: 0% 40%; }
.layer[data-layer=upper] { transform-origin: 30% 0%; }
.layer[data-layer=lower] { transform-origin: 70% 100%; }

/* ───── Fotowand / floating wall ───── */

.photowall {
  --bg: #fff;
  --fg: #080808;
  --line: #e8e8e6;
  position: relative;
  background: var(--bg);
  color: var(--fg);
  height: 100vh;
  height: 100svh;
  min-height: 600px;
  overflow: hidden;
  isolation: isolate;
}
.photowall .section-head {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  margin: 0;
  padding: 72px var(--gutter) 0;
  color: #fff;
  mix-blend-mode: difference;
  pointer-events: none;
}
.photowall .hero-meta { z-index: 1000; }
.photowall .section-no,
.photowall .section-count { color: inherit; opacity: .6; }

.wall {
  position: absolute;
  inset: 0;
}
.wall:not(.in) .tile { animation-play-state: paused; }

.tile {
  position: absolute;
  padding: 0;
  border: 0;
  background: none;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  transform: translate3d(calc(var(--px, 0) * var(--depth) * 1px), calc(var(--py, 0) * var(--depth) * 1px), 0);
  rotate: var(--tilt, 0deg);
  transition: transform .9s cubic-bezier(.2, .7, .2, 1), rotate .5s cubic-bezier(.2, .7, .2, 1);
  opacity: 0;
  animation: tile-in 1.2s cubic-bezier(.2, .7, .2, 1) forwards;
  animation-delay: var(--in-delay);
}
.tile-float {
  display: block;
  transform: translate3d(0, calc(var(--sy, 0) * var(--speed, 0) * 1px), 0);
  animation: drift var(--dur) ease-in-out var(--delay) infinite alternate;
}
.tile img,
.tile video {
  width: 100%;
  height: auto;
  background: var(--line);
  transition: transform .5s cubic-bezier(.2, .7, .2, 1), filter .5s, box-shadow .5s;
  filter: grayscale(.15);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .12), 0 12px 24px -14px rgba(0, 0, 0, .45);
}
.tile:hover img,
.tile:hover video,
.tile:focus-visible img,
.tile:focus-visible video {
  transform: scale(1.04);
  filter: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 22px 40px -18px rgba(0, 0, 0, .5);
}
.tile:hover { z-index: 20 !important; rotate: 0deg; }
.tile:focus-visible { outline: 1px solid var(--fg); outline-offset: 4px; }
.tile.no-ring:focus-visible { outline: none; }
.tile.is-hidden { visibility: hidden; }
.tile.dragging { cursor: grabbing; }
.tile.dragging img,
.tile.dragging video {
  transform: scale(1.06);
  filter: none;
  box-shadow: 0 4px 8px rgba(0, 0, 0, .12), 0 34px 60px -24px rgba(0, 0, 0, .55);
}
@media (pointer: coarse) {
  .tile { touch-action: pan-y; }
}

@keyframes tile-in {
  from { opacity: 0; translate: 0 30px; }
  to   { opacity: 1; translate: 0 0; }
}
@keyframes drift {
  from { translate: 0 0; rotate: calc(var(--rot) * -1); }
  to   { translate: var(--dx) var(--dy); rotate: var(--rot); }
}

.badge {
  position: absolute;
  left: 8px;
  bottom: 8px;
  font-size: 10px;
  letter-spacing: .1em;
  padding: 2px 6px;
  background: var(--bg);
  color: var(--fg);
}

/* Logo inverts whatever lies beneath it */
.logo {
  position: fixed;
  inset: 0;
  margin: 0;
  display: grid;
  place-items: center;
  z-index: 60;
  pointer-events: none;
  mix-blend-mode: difference;
  will-change: transform;
}
.logo a { display: block; line-height: 0; }
.logo.is-docked a { pointer-events: auto; }
.logo img {
  width: min(88vw, 1200px);
  height: auto;
  filter: invert(1);
}

.intro {
  position: absolute;
  left: 50%;
  top: calc(50% + min(88vw, 1200px) * 0.109 + clamp(24px, 4vh, 48px));
  translate: -50% 0;
  rotate: -1.2deg;
  width: min(88vw, 580px);
  margin: 0;
  padding: 14px 18px;
  z-index: 29;
  font-size: clamp(12px, 1.1vw, 14px);
  line-height: 1.7;
  color: #f2f2ef;
  background: #080808;
  box-shadow: 0 10px 30px -12px rgba(0, 0, 0, .7);
  pointer-events: none;
}

.hero-meta {
  position: absolute;
  bottom: 22px;
  margin: 0;
  z-index: 31;
  font-size: 11px;
  line-height: 1.5;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #fff;
  mix-blend-mode: difference;
  pointer-events: none;
}
.hero-meta--left  { left: var(--gutter); }
.hero-meta--right { right: var(--gutter); text-align: right; }

.hero-scroll {
  position: absolute;
  left: 50%;
  bottom: 18px;
  translate: -50% 0;
  z-index: 31;
  color: #fff;
  mix-blend-mode: difference;
  text-decoration: none;
  font-size: 18px;
  animation: bob 2.4s ease-in-out infinite;
}
@keyframes bob { 50% { transform: translateY(6px); } }

/* ───── Sections ───── */

.section {
  padding: clamp(80px, 12vw, 160px) var(--gutter) clamp(60px, 8vw, 120px);
  border-top: 1px solid var(--line);
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: 1.2em;
  margin-bottom: clamp(36px, 6vw, 72px);
}
.section-head h1,
.section-head h2 {
  margin: 0;
  font-size: clamp(28px, 5vw, 56px);
  font-weight: 300;
  letter-spacing: -.03em;
  line-height: 1;
}
.section-no, .section-count {
  font-size: 12px;
  color: var(--muted);
}
.section-count { margin-left: auto; }

.lead {
  font-size: clamp(15px, 1.6vw, 18px);
  max-width: 40ch;
  margin: 0 0 2em;
}

/* ───── Statutes ───── */

#statuten {
  background: #000;
  border-top: 0;
}
#kontakt,
.footer {
  --bg: #1ae155;
  --fg: #080808;
  --muted: rgba(0, 0, 0, .55);
  --line: rgba(0, 0, 0, .22);
  background: var(--bg);
  color: var(--fg);
  color-scheme: light;
  border-top: 0;
}

.statutes { max-width: 820px; }
.statutes details { border-top: 1px solid var(--line); }
.statutes details:last-of-type { border-bottom: 1px solid var(--line); }
.statutes summary {
  display: flex;
  gap: 1.5em;
  padding: 18px 0;
  cursor: pointer;
  list-style: none;
  font-size: 15px;
}
.statutes summary::-webkit-details-marker { display: none; }
.statutes summary span { color: var(--muted); min-width: 4.5em; }
.statutes summary::after { content: '+'; margin-left: auto; color: var(--muted); }
.statutes details[open] summary::after { content: '−'; }
.statutes summary:hover { text-decoration: underline; text-underline-offset: 4px; }
.statutes details p {
  margin: 0 0 1em calc(4.5em + 1.5em);
  max-width: 62ch;
  color: #c8c8c3;
}
.statutes details ul,
.statutes details ol {
  margin: 0 0 1em calc(4.5em + 1.5em);
  padding-left: 1.4em;
  max-width: 62ch;
  color: #c8c8c3;
}
.statutes details ul { list-style: '– '; }
.statutes details li { margin-bottom: .25em; }
.statutes details li::marker { color: var(--muted); }
.statutes details > :last-child { margin-bottom: 22px; }

.signatures {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 2em;
  margin: 48px 0 0;
  font-size: 13px;
}
.signatures dt { color: var(--muted); }
.signatures dd { margin: 0; }

/* ───── Contact ───── */

.contact {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  gap: clamp(40px, 8vw, 120px);
}

.contact-info dl {
  display: grid;
  grid-template-columns: 7em 1fr;
  gap: 10px 0;
  margin: 0;
}
.contact-info dt { color: var(--muted); }
.contact-info dd { margin: 0; }
.contact-info a { text-underline-offset: 3px; }

.form { display: grid; gap: 22px; max-width: 640px; }
.form fieldset { border: 0; margin: 0; padding: 0; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.member-only { display: grid; gap: 22px; }
.member-only[hidden] { display: none; }

.toggle {
  display: inline-flex;
  border: 1px solid var(--fg);
  width: fit-content;
}
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle span {
  display: block;
  padding: 8px 16px;
  cursor: pointer;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.toggle input:checked + span { background: var(--fg); color: var(--bg); }
.toggle input:focus-visible + span { outline: 1px solid var(--fg); outline-offset: 3px; }

.field { display: grid; gap: 6px; }
.field > span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
}
.field > span[hidden] { display: none; }
.field input,
.field textarea {
  font: inherit;
  color: var(--fg);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 8px 0;
  outline: none;
  transition: border-color .2s;
  width: 100%;
}
.field textarea { resize: vertical; min-height: 7em; }
.field input:focus,
.field textarea:focus { border-color: var(--fg); }
.field.invalid input,
.field.invalid textarea { border-color: var(--alert); }

.choice > div { display: flex; flex-wrap: wrap; gap: 8px 24px; padding-top: 6px; }
.choice label, .check { display: flex; gap: 10px; align-items: baseline; cursor: pointer; }
.check.invalid { color: var(--alert); }
input[type=radio], input[type=checkbox] { accent-color: var(--fg); }

/* Honeypot */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.cf-turnstile { min-height: 65px; }
.cf-turnstile.invalid { outline: 1px solid var(--alert); outline-offset: 4px; }

.form-foot { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.btn {
  border: 1px solid var(--fg);
  background: var(--fg);
  color: var(--bg);
  padding: 12px 22px;
  cursor: pointer;
  font-size: 13px;
  letter-spacing: .04em;
  transition: background .2s, color .2s;
}
.btn:hover { background: transparent; color: var(--fg); }
.btn:disabled { opacity: .5; cursor: wait; }
.form-status { margin: 0; font-size: 12px; color: var(--muted); }

/* ───── Footer ───── */

.footer {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 24px;
  padding: 24px var(--gutter);
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}
.footer-right { display: flex; gap: 24px; }
.footer a { text-decoration: none; }
.footer a:hover { color: var(--fg); }

/* ───── Unterseiten (Impressum, Datenschutz …) ───── */

.page { padding-top: 40px; min-height: 70vh; }
.page .section { border-top: 0; }
.prose { max-width: 68ch; }
.prose p, .prose ul, .prose ol { color: #c8c8c3; }
.prose h2, .prose h3 { font-weight: 400; margin: 2em 0 .6em; }
.prose a { text-underline-offset: 3px; }

/* ───── Lightbox ───── */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  visibility: hidden;
}
.lightbox.is-open { visibility: visible; }
.lightbox.is-closing { visibility: visible; pointer-events: none; }
.lightbox.is-closing .lb-media { pointer-events: none; }

.lb-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 8, 8, .9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  transition: opacity .45s ease;
  cursor: zoom-out;
}
.lightbox.is-open .lb-backdrop { opacity: 1; }

.lb-stage { position: absolute; inset: 0; pointer-events: none; }
.lb-media {
  position: absolute;
  max-width: none;
  object-fit: cover;
  transform-origin: 50% 50%;
  pointer-events: auto;
  background: #000;
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .45);
}
.lb-media.animating { transition: transform .6s cubic-bezier(.2, .8, .2, 1), opacity .35s; }
img.lb-media { cursor: zoom-out; }

.lb-btn {
  position: absolute;
  z-index: 2;
  border: 0;
  background: none;
  padding: 14px;
  font-size: 18px;
  cursor: pointer;
  opacity: 0;
  transition: opacity .3s .15s;
}
.lightbox.is-open .lb-btn { opacity: 1; }
.lb-btn:hover { text-decoration: underline; }
.lb-close { top: 10px; right: calc(var(--gutter) - 14px); }
.lb-prev  { left: calc(var(--gutter) - 14px); top: 50%; translate: 0 -50%; }
.lb-next  { right: calc(var(--gutter) - 14px); top: 50%; translate: 0 -50%; }
.lb-index {
  position: absolute;
  left: var(--gutter);
  top: 22px;
  font-size: 12px;
  color: var(--muted);
}

/* ───── Responsive ───── */

@media (max-width: 760px) {
  .nav ul { gap: 14px; }
  .nav li a span { display: none; }
  .contact { grid-template-columns: 1fr; }
  .row { grid-template-columns: 1fr; }
  .statutes details p,
  .statutes details ul,
  .statutes details ol { margin-left: 0; }
  .hero-meta--right { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .tile, .tile-float, .hero-scroll { animation: none !important; opacity: 1; }
  .poster { height: 100vh; height: 100svh; }
  .lb-media.animating { transition: opacity .2s; }
}
