:root {
  --black: #060606;
  --ink: #111111;
  --white: #ffffff;
  --soft: #f4f1eb;
  --line: rgba(255, 255, 255, 0.18);
  --orange: #ff7a18;
  --gold: #f7bb3a;
  --teal: #1f9a9a;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Inter", Arial, sans-serif;
  color: var(--white);
  background: var(--black);
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 24px;
  padding: 14px clamp(18px, 4vw, 56px);
  background: rgba(6, 6, 6, 0.78);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
}

nav {
  display: flex;
  flex: 1 1 420px;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px clamp(12px, 2vw, 24px);
  font-size: 0.95rem;
  font-weight: 700;
}

nav a {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  color: rgba(255, 255, 255, 0.78);
}

nav a:hover {
  color: var(--orange);
}

.hero {
  min-height: 92vh;
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 1.1fr);
  align-items: center;
  gap: clamp(24px, 6vw, 80px);
  padding: 110px clamp(18px, 5vw, 72px) 56px;
  background:
    radial-gradient(circle at 68% 30%, rgba(255, 122, 24, 0.22), transparent 34%),
    linear-gradient(135deg, #050505 0%, #14100d 56%, #261006 100%);
}

.hero-media {
  max-width: 520px;
  margin-inline: auto;
}

.hero-media img {
  width: 100%;
  display: block;
  border-radius: 8px;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.42);
}

.hero-content {
  max-width: 680px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--gold);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

h1,
h2 {
  margin: 0;
  font-family: "Bebas Neue", Impact, sans-serif;
  letter-spacing: 0;
  line-height: 0.94;
}

h1 {
  font-size: clamp(4.6rem, 12vw, 10rem);
}

h2 {
  font-size: clamp(2.5rem, 6vw, 5.8rem);
}

h3 {
  margin: 0;
  font-size: 1.1rem;
}

.motto {
  margin: 10px 0 18px;
  color: var(--orange);
  font-size: clamp(1.35rem, 3vw, 2.2rem);
  font-weight: 800;
}

.intro,
.section p {
  color: rgba(255, 255, 255, 0.76);
  font-size: 1.05rem;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}

.button,
.join-form button,
.login-form button,
.admin-form button,
.tab-button {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  padding: 0 20px;
  font-weight: 800;
  border: 1px solid transparent;
  cursor: pointer;
}

.primary,
.join-form button,
.login-form button,
.admin-form button,
.tab-button.active {
  color: var(--black);
  background: var(--orange);
}

.secondary {
  color: var(--white);
  border-color: rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.08);
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-block: 1px solid var(--line);
  background: #101010;
}

.stats div {
  padding: 28px clamp(18px, 5vw, 56px);
  border-right: 1px solid var(--line);
}

.stats div:last-child {
  border-right: 0;
}

.stats strong {
  display: block;
  color: var(--orange);
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: 3.7rem;
  line-height: 0.9;
}

.stats span {
  color: rgba(255, 255, 255, 0.75);
  font-weight: 700;
}

.section {
  padding: clamp(58px, 9vw, 112px) clamp(18px, 5vw, 72px);
}

.split {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(320px, 1.2fr);
  gap: clamp(28px, 6vw, 80px);
  align-items: start;
  background: var(--soft);
  color: var(--ink);
}

.split .eyebrow {
  color: var(--teal);
}

.split p {
  color: rgba(17, 17, 17, 0.72);
}

.schedule {
  display: grid;
  gap: 14px;
}

.schedule article,
.value-grid article,
.join-form {
  border-radius: 8px;
}

.schedule article {
  padding: 24px;
  color: var(--ink);
  background: var(--white);
  border-left: 6px solid var(--orange);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.08);
}

.schedule span {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--teal);
  font-weight: 800;
  text-transform: uppercase;
  font-size: 0.78rem;
}

.values {
  background:
    linear-gradient(rgba(6, 6, 6, 0.82), rgba(6, 6, 6, 0.92)),
    url("assets/RAO.png") center / cover;
}

.section-heading {
  max-width: 820px;
  margin-bottom: 34px;
}

.value-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.value-grid article {
  min-height: 210px;
  padding: 26px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(10px);
}

.join {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(300px, 1fr);
  gap: clamp(28px, 6vw, 72px);
  align-items: start;
  background: #151515;
}

.join-form {
  display: grid;
  gap: 16px;
  padding: clamp(20px, 4vw, 32px);
  background: var(--white);
  color: var(--ink);
}

.join-form label {
  display: grid;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 800;
}

.join-form input,
.join-form select,
.login-form input,
.admin-form input,
.admin-form select,
.admin-form textarea,
.event-edit-form input,
.event-edit-form textarea,
.result-edit-form input,
.result-edit-form select {
  width: 100%;
  min-height: 48px;
  border: 1px solid #d8d8d8;
  border-radius: 6px;
  padding: 0 12px;
  font: inherit;
  background: #fafafa;
}

.phone-input {
  display: grid;
  grid-template-columns: minmax(110px, 0.28fr) minmax(180px, 1fr);
  gap: 10px;
}

.admin-form textarea,
.event-edit-form textarea {
  min-height: 112px;
  padding: 12px;
  resize: vertical;
}

.public-events {
  position: relative;
  background:
    linear-gradient(rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.92)),
    url("assets/RAO.png") center 120px / min(760px, 78vw) auto no-repeat,
    #ffffff;
  color: var(--ink);
}

.public-results {
  background: #111111;
  color: var(--white);
}

.public-events .eyebrow,
.public-results .eyebrow {
  color: var(--teal);
}

.public-events .section-heading p {
  color: rgba(17, 17, 17, 0.7);
}

.public-results .section-heading p {
  color: rgba(255, 255, 255, 0.72);
}

.admin-jump {
  margin-top: 18px;
}

.public-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  align-items: start;
}

.public-events #public-event-list {
  grid-template-columns: 1fr;
}

.public-event-group {
  display: grid;
  gap: 14px;
}

.public-event-list {
  display: grid;
  gap: 12px;
}

.public-event-list .event-card {
  grid-template-columns: minmax(140px, 180px) minmax(0, 1fr);
  align-items: center;
}

.public-event-list .event-card p {
  grid-column: 1 / -1;
  margin: 0;
  color: rgba(17, 17, 17, 0.68);
}

.public-event-list .event-poster img {
  aspect-ratio: 3 / 4;
}

.public-event-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  align-items: start;
}

#public-result-list,
.result-list {
  grid-template-columns: 1fr;
}

.public-results .event-card,
.public-results .result-card {
  color: var(--ink);
}

.admin {
  background: #f7f7f7;
  color: var(--ink);
}

.admin .eyebrow {
  color: var(--teal);
}

.admin .section-heading p {
  max-width: 760px;
  color: rgba(17, 17, 17, 0.7);
}

.admin-shell {
  display: grid;
  gap: 18px;
}

.admin-workspace {
  display: grid;
  gap: 18px;
}

.login-form,
.admin-status {
  border-radius: 8px;
  background: var(--white);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.08);
}

.login-form {
  max-width: 520px;
  display: grid;
  gap: 14px;
  padding: clamp(20px, 4vw, 28px);
}

.login-form label {
  display: grid;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 800;
}

.login-message {
  min-height: 22px;
  margin: 0;
  color: #7a1d1d;
  font-weight: 800;
}

.form-message {
  min-height: 22px;
  margin: 0;
  color: #7a1d1d;
  font-weight: 800;
}

.form-message.success {
  color: #137a45;
}

.admin-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 18px;
  color: rgba(17, 17, 17, 0.72);
  font-weight: 800;
}

.logout-button {
  min-height: 38px;
  border: 1px solid #dddddd;
  border-radius: 6px;
  color: var(--ink);
  background: #f6f6f6;
  font-weight: 800;
  cursor: pointer;
}

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tab-button {
  color: var(--ink);
  border-color: #d9d9d9;
  background: var(--white);
}

.admin-panels,
.admin-panel {
  min-width: 0;
}

.admin-panel {
  grid-template-columns: minmax(280px, 0.78fr) minmax(320px, 1.22fr);
  gap: clamp(18px, 4vw, 34px);
  align-items: start;
}

.admin-panel.active {
  display: grid;
}

.admin-panel.single {
  grid-template-columns: 1fr;
}

.admin-form,
.admin-list {
  border-radius: 8px;
  background: var(--white);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.08);
}

.admin-form {
  display: grid;
  gap: 16px;
  padding: clamp(20px, 4vw, 28px);
}

.admin-form label {
  display: grid;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 800;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.admin-list {
  min-height: 360px;
  padding: clamp(20px, 4vw, 28px);
}

.admin-list h3 {
  margin-bottom: 16px;
}

.event-list,
.result-list,
.joiner-list {
  display: grid;
  gap: 14px;
}

.event-list {
  grid-template-columns: repeat(auto-fit, minmax(280px, 520px));
  align-items: start;
}

.event-list .event-card {
  align-self: start;
}

.result-group {
  display: grid;
  gap: 12px;
}

.result-event-group {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid #dddddd;
  border-radius: 8px;
  background: #ffffff;
}

.result-event-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid #f0f0f0;
}

.result-event-heading h3 {
  margin: 0 0 6px;
  font-size: 1.25rem;
}

.result-event-heading span,
.result-event-heading strong {
  color: rgba(17, 17, 17, 0.64);
  font-weight: 800;
}

.result-group-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border-radius: 8px;
  color: var(--white);
  background: #222222;
}

.result-group-heading h3 {
  margin: 0;
}

.result-group-heading span {
  color: rgba(255, 255, 255, 0.72);
  font-weight: 800;
}

.admin-list .result-group-heading {
  color: var(--ink);
  background: #f1f1f1;
}

.admin-list .result-group-heading span {
  color: rgba(17, 17, 17, 0.62);
}

.result-group-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.result-table-wrap {
  overflow-x: auto;
  border: 1px solid #d8d8d8;
  border-radius: 8px;
  background: #ffffff;
}

.result-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  color: var(--ink);
  font-size: 0.95rem;
}

.result-table th,
.result-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #e0e0e0;
  text-align: left;
  vertical-align: middle;
}

.result-table th {
  color: #111111;
  background: #f0f0f2;
  font-weight: 800;
}

.result-table tbody tr:nth-child(4n + 1),
.result-table tbody tr:nth-child(4n + 2) {
  background: #fbfbfb;
}

.place-cell {
  width: 64px;
  font-weight: 800;
}

.runner-cell,
.time-cell {
  font-weight: 800;
}

.diff-cell {
  font-style: italic;
}

.strava-link {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 6px;
  color: #ffffff;
  background: #fc4c02;
  font-size: 0.85rem;
  font-weight: 800;
}

.actions-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 170px;
}

.result-edit-row td {
  padding: 0;
  background: #ffffff;
}

.result-edit-row .result-edit-form {
  margin: 12px;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 220px;
  padding: 24px;
  color: rgba(17, 17, 17, 0.58);
  text-align: center;
  border: 1px dashed #cfcfcf;
  border-radius: 8px;
  background: #fbfbfb;
}

.empty-state.compact {
  min-height: 120px;
}

.event-card,
.result-card,
.joiner-card {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid #e4e4e4;
  border-left: 6px solid var(--orange);
  border-radius: 8px;
  background: #ffffff;
  min-width: 0;
  overflow: hidden;
}

.joiner-card {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.result-card {
  position: relative;
  padding-left: 82px;
}

.result-rank {
  position: absolute;
  top: 18px;
  left: 18px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: var(--black);
  background: var(--orange);
  font-weight: 800;
}

.event-meta,
.result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: rgba(17, 17, 17, 0.62);
  font-size: 0.88rem;
  font-weight: 700;
}

.finish-time {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0;
}

.finish-time span {
  color: rgba(17, 17, 17, 0.58);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.finish-time strong {
  color: var(--ink);
  font-size: 1.55rem;
}

.event-poster {
  display: block;
  overflow: hidden;
  border-radius: 8px;
  background: #101010;
}

.event-poster img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
}

.event-album,
.event-joiners {
  display: grid;
  gap: 12px;
}

.event-album summary,
.event-joiners summary {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 14px;
  border-radius: 6px;
  color: var(--black);
  background: var(--orange);
  font-weight: 800;
  cursor: pointer;
  list-style: none;
}

.event-album summary::-webkit-details-marker,
.event-joiners summary::-webkit-details-marker {
  display: none;
}

.event-album summary strong,
.event-joiners summary strong {
  font-size: 0.9rem;
}

.event-album[open] summary {
  background: var(--gold);
}

.event-joiners summary {
  color: var(--ink);
  background: #f1f1f1;
}

.event-joiners[open] summary {
  background: #e4e4e4;
}

.event-album[open] .photo-grid {
  margin-top: 12px;
}

.event-joiner-list {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.event-joiner-list li {
  display: grid;
  grid-template-columns: minmax(120px, 0.8fr) minmax(180px, 1fr) minmax(140px, 0.8fr) minmax(140px, 0.8fr);
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  background: #fbfbfb;
}

.event-joiner-list span {
  color: rgba(17, 17, 17, 0.66);
  font-weight: 700;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  width: 100%;
  min-width: 0;
}

.photo-tile {
  position: relative;
  display: grid;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  border-radius: 8px;
  background: #101010;
}

.photo-open {
  display: block;
  min-width: 0;
  aspect-ratio: 1;
}

.photo-grid img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border: 0;
}

.photo-download {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 6px;
  color: var(--black);
  background: rgba(255, 122, 24, 0.94);
  font-size: 0.82rem;
  font-weight: 800;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
}

.photo-download:hover {
  background: var(--gold);
}

.photo-delete {
  position: absolute;
  left: 8px;
  bottom: 8px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 6px;
  color: #ffffff;
  background: rgba(122, 29, 29, 0.94);
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
}

.photo-delete:hover {
  background: #9f2424;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.hidden-action {
  display: none;
}

.event-edit-form,
.result-edit-form {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid #dddddd;
  border-radius: 8px;
  background: #f8f8f8;
}

.event-list .event-edit-form {
  grid-template-columns: 1fr 1fr;
}

.event-list .event-edit-form label:first-child,
.event-list .event-edit-form label:nth-child(4),
.event-list .event-edit-form label:nth-child(6),
.event-list .event-edit-form .card-actions {
  grid-column: 1 / -1;
}

.event-edit-form label,
.result-edit-form label {
  display: grid;
  gap: 8px;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 800;
}

.edit-button,
.save-button,
.cancel-button,
.delete-button {
  min-height: 38px;
  border: 1px solid #dddddd;
  border-radius: 6px;
  padding: 0 14px;
  font-weight: 800;
  cursor: pointer;
}

.edit-button {
  color: var(--black);
  background: var(--orange);
}

.save-button {
  color: var(--black);
  background: var(--gold);
}

.cancel-button {
  color: var(--ink);
  background: #f6f6f6;
}

.delete-button {
  color: #7a1d1d;
  background: #fff6f4;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 28px clamp(18px, 5vw, 72px);
  color: rgba(255, 255, 255, 0.72);
  background: #050505;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

footer span:first-child {
  color: var(--white);
  font-weight: 800;
}

@media (max-width: 860px) {
  .site-header {
    position: sticky;
  }

  .hero,
  .split,
  .join,
  .admin-panel.active {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
    padding-top: 34px;
  }

  .hero-media {
    max-width: 360px;
  }

  .stats,
  .value-grid {
    grid-template-columns: 1fr;
  }

  .stats div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .event-joiner-list li {
    grid-template-columns: 1fr;
  }

  .event-list,
  .event-list .event-edit-form {
    grid-template-columns: 1fr;
  }

  footer {
    flex-direction: column;
  }
}

@media (max-width: 520px) {
  nav {
    width: 100%;
    justify-content: flex-start;
  }

  .brand span {
    font-size: 0.95rem;
  }

  h1 {
    font-size: 4.2rem;
  }

  .hero-actions {
    flex-direction: column;
  }

  .button {
    width: 100%;
  }

  .tab-button,
  .login-form button,
  .admin-form button {
    width: 100%;
  }

  .admin-status {
    align-items: stretch;
    flex-direction: column;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .phone-input {
    grid-template-columns: 1fr;
  }

  .result-card {
    padding-left: 18px;
    padding-top: 74px;
  }
}
