/* Change the race-day colors here. */
:root {
  color-scheme: dark;
  --bg: #090a0c;
  --card: #14161c;
  --card-2: #1c1f27;
  --line: rgba(246, 243, 236, 0.14);
  --text: #f6f3ec;
  --muted: #c4beb2;
  --red: #ff2b1f;
  --red-deep: #9d120c;
  --yellow: #ffd000;
  --shadow: 0 22px 50px rgba(0, 0, 0, 0.35);
  --display: "Oswald", "Arial Narrow", Impact, sans-serif;
  --body: "Barlow", "Segoe UI", system-ui, sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--body);
  font-size: 1.05rem;
  line-height: 1.55;
  color: var(--text);
  background:
    radial-gradient(ellipse at top, rgba(255, 43, 31, 0.16), transparent 32rem),
    var(--bg);
}

a {
  color: var(--yellow);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  color: white;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

img {
  max-width: 100%;
}

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 20;
  background: var(--yellow);
  color: #111;
  padding: 0.5rem 0.8rem;
  font-weight: 700;
}

.skip:focus {
  top: 0.6rem;
}

.checker {
  height: 12px;
  background:
    repeating-conic-gradient(#f6f3ec 0% 25%, #111 0% 50%) 0 0 / 12px 12px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem 1.5rem;
  padding: 0.85rem 6vw;
  background: rgba(9, 10, 12, 0.92);
  border-bottom: 3px solid var(--red);
  backdrop-filter: blur(12px);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--text);
  text-decoration: none;
  font-family: var(--display);
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.wordmark:hover {
  color: var(--text);
}

.wordmark .hot {
  color: var(--red);
}

.lights {
  width: 0.72rem;
  height: 1.55rem;
  background: linear-gradient(var(--red) 0 33%, var(--yellow) 33% 66%, #3dff7a 66% 100%);
  box-shadow: 0 0 12px rgba(255, 43, 31, 0.45);
}

.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 1.1rem;
  font-family: var(--display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav a {
  color: var(--text);
  text-decoration: none;
}

.nav a:hover,
.nav a.is-current {
  color: var(--yellow);
}

#account-slot {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}

.who {
  color: var(--muted);
  letter-spacing: 0.04em;
}

#logout-btn,
.button,
button[type="submit"] {
  border: 0;
  background: var(--yellow);
  color: #14120c;
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.75rem 1rem;
  min-height: 48px;
}

#logout-btn {
  min-height: 40px;
  padding: 0.4rem 0.7rem;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}

#logout-btn:hover,
button[type="submit"]:hover,
.button:hover {
  background: white;
  color: #111;
}

main {
  width: min(1080px, calc(100% - 8vw));
  margin: 0 auto;
  padding: 2.2rem 0 3rem;
}

.hero {
  position: relative;
  padding: 1rem 0 2rem;
  overflow: hidden;
}

.hero::after {
  content: "GRID";
  position: absolute;
  right: -0.05em;
  bottom: -0.28em;
  font-family: var(--display);
  font-size: clamp(6rem, 22vw, 14rem);
  line-height: 0.8;
  letter-spacing: -0.04em;
  color: transparent;
  -webkit-text-stroke: 1px rgba(246, 243, 236, 0.16);
  pointer-events: none;
}

.eyebrow,
.tag {
  display: inline-block;
  margin: 0 0 0.8rem;
  background: var(--yellow);
  color: #14120c;
  font-family: var(--display);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  transform: skewX(-8deg);
}

.tag span,
.eyebrow span {
  display: inline-block;
  transform: skewX(8deg);
}

h1,
h2,
h3 {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 0.92;
  text-transform: uppercase;
  margin: 0;
}

.hero h1 {
  position: relative;
  z-index: 1;
  font-size: clamp(4.4rem, 13vw, 8.4rem);
  max-width: 9ch;
}

.hero h1 em {
  font-style: normal;
  color: var(--red);
}

.lede {
  position: relative;
  z-index: 1;
  max-width: 38rem;
  margin: 1.2rem 0 0;
  font-size: 1.25rem;
  color: var(--muted);
}

.filters {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.6rem;
}

.filter {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0.35rem 0.8rem;
  border: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
  font-family: var(--display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.filter.is-on,
.filter:hover {
  background: var(--red);
  border-color: var(--red);
  color: white;
}

.post-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 0.5rem;
}

.post-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-height: 100%;
  padding: 1.2rem 1.2rem 1.3rem;
  background:
    linear-gradient(135deg, rgba(255, 43, 31, 0.18), transparent 28%),
    var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--red);
  box-shadow: var(--shadow);
  color: inherit;
}

.post-card-link,
.post-card-link:hover {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
  width: 100%;
  color: inherit;
  text-decoration: none;
}

.post-card:hover {
  border-color: var(--yellow);
  color: inherit;
  transform: translateY(-3px);
}

.post-card.featured {
  grid-column: 1 / -1;
  background:
    linear-gradient(100deg, rgba(255, 43, 31, 0.28), transparent 46%),
    var(--card-2);
}

.post-card h2 {
  font-size: clamp(1.8rem, 3vw, 2.5rem);
}

.post-card.featured h2 {
  font-size: clamp(2.6rem, 6vw, 4.6rem);
  max-width: 16ch;
}

.card-excerpt,
.meta,
.empty,
.loading,
.banner {
  color: var(--muted);
}

.card-excerpt {
  margin: 0;
  max-width: 46rem;
  font-size: 1.08rem;
}

.meta {
  margin: 0;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-family: var(--display);
}

.read-link {
  margin-top: auto;
  color: var(--yellow);
  font-family: var(--display);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.post-tools {
  position: absolute;
  z-index: 2;
  top: 0.55rem;
  right: 0.55rem;
  display: flex;
  gap: 0.35rem;
}

.delete-x,
.edit-pencil {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border: 1px solid var(--line);
  background: rgba(9, 10, 12, 0.9);
  color: var(--text);
  font-family: var(--display);
  font-size: 1.2rem;
  line-height: 1;
  letter-spacing: 0;
  text-transform: none;
  text-decoration: none;
}

.pencil-icon {
  width: 15px;
  height: 15px;
  display: block;
}

.delete-x:hover {
  background: var(--red);
  border-color: var(--red);
  color: white;
}

.edit-pencil:hover {
  background: var(--yellow);
  border-color: var(--yellow);
  color: #14120c;
}

.story {
  position: relative;
  max-width: 42rem;
}

.story.has-gallery {
  max-width: none;
}

.story-copy {
  max-width: 42rem;
}

.back {
  display: inline-block;
  margin-bottom: 1rem;
  font-family: var(--display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
}

.story h1 {
  font-size: clamp(2.8rem, 7vw, 5.4rem);
  max-width: 14ch;
}

.story .meta {
  margin-top: 1rem;
}

.story-body {
  margin-top: 1.6rem;
  font-size: 1.2rem;
  line-height: 1.65;
}

.story-body p {
  margin: 0 0 1rem;
}

.comments {
  margin-top: 2.5rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--line);
}

.comments h2 {
  font-size: clamp(2rem, 4vw, 3rem);
  margin-bottom: 1rem;
}

.comment {
  position: relative;
  padding: 0.9rem 2rem 0.9rem 0;
  border-bottom: 1px solid var(--line);
}

.comment-x,
.row-x {
  position: absolute;
  top: 0.7rem;
  right: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border: 1px solid var(--line);
  background: rgba(9, 10, 12, 0.9);
  color: var(--text);
  font-family: var(--display);
  font-size: 1.2rem;
  line-height: 1;
  letter-spacing: 0;
  text-transform: none;
}

.comment-x:hover,
.row-x:hover {
  background: var(--red);
  border-color: var(--red);
  color: white;
}

.row-x {
  position: static;
}

.row-x:disabled {
  opacity: 0.45;
  background: transparent;
  color: var(--muted);
}

.comment p {
  margin: 0.35rem 0 0;
  white-space: pre-wrap;
}

.composer,
.auth-card {
  margin-top: 1.2rem;
  padding: 1rem;
  background: var(--card);
  border: 1px solid var(--line);
}

label {
  display: block;
  margin-bottom: 0.35rem;
  font-family: var(--display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.92rem;
}

input,
textarea,
select {
  width: 100%;
  padding: 0.75rem 0.8rem;
  background: #0c0e12;
  border: 1px solid var(--line);
  border-radius: 0;
}

textarea {
  min-height: 8rem;
  resize: vertical;
}

.publish-text {
  min-height: 16rem;
}

input[type="file"] {
  padding: 0.6rem 0;
  background: transparent;
  border: 0;
}

.card-photo {
  width: 100%;
  max-height: 280px;
  object-fit: cover;
  border: 1px solid var(--line);
}

.story-photos {
  display: grid;
  gap: 0.8rem;
  margin-top: 1.4rem;
}

.story-photos.multi {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
}

.story-photos img {
  width: 100%;
  min-width: 0;
  height: auto;
  border: 1px solid var(--line);
  background: #0c0e12;
  object-fit: contain;
}

.edit-photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.7rem;
}

.keep-photo {
  display: block;
  margin: 0;
  text-transform: none;
  letter-spacing: 0;
  font-family: var(--body);
  font-size: 0.95rem;
}

.keep-photo img {
  display: block;
  width: 100%;
  height: 110px;
  object-fit: cover;
  margin-bottom: 0.4rem;
  border: 1px solid var(--line);
}

.keep-photo input {
  width: auto;
  margin-right: 0.35rem;
}

.admin-page h1 {
  font-size: clamp(2.8rem, 7vw, 5rem);
}

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.2rem 0 1.4rem;
}

.admin-tab {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0.35rem 0.8rem;
  border: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
  font-family: var(--display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.admin-tab.is-on,
.admin-tab:hover {
  background: var(--red);
  border-color: var(--red);
  color: white;
}

.backup-actions,
.review-bar,
.review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.4rem;
}

.review-bar[hidden] {
  display: none;
}

.review-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.review-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.8rem;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--line);
}

.review-check {
  width: 1.15rem;
  height: 1.15rem;
  margin-top: 0.35rem;
}

.review-body {
  white-space: pre-wrap;
  margin: 0.4rem 0 0;
}

.unread-flag,
.read-flag {
  display: inline-block;
  margin-right: 0.35rem;
  padding: 0.1rem 0.4rem;
  font-family: var(--display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.78rem;
}

.unread-flag {
  background: var(--yellow);
  color: #14120c;
}

.read-flag {
  border: 1px solid var(--line);
  color: var(--muted);
}

.review-actions {
  margin-top: 0.7rem;
}

.review-actions button,
.review-bar button {
  min-height: 40px;
  padding: 0.4rem 0.75rem;
}

.about-page {
  position: relative;
  max-width: 42rem;
}

.about-page h1 {
  font-size: clamp(2.8rem, 7vw, 5rem);
  max-width: 14ch;
}

.about-photo {
  display: block;
  width: min(100%, 42rem);
  height: auto;
  margin-top: 1.4rem;
  border: 1px solid var(--line);
}

.table-wrap {
  overflow-x: auto;
}

.user-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1.4rem;
}

.user-table th,
.user-table td {
  text-align: left;
  padding: 0.75rem 0.7rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.user-table th {
  font-family: var(--display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.92rem;
  color: var(--muted);
}

.role-select {
  width: auto;
  min-width: 9rem;
  padding: 0.4rem 0.55rem;
  font-family: var(--display);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.role-select:disabled {
  color: var(--yellow);
  opacity: 1;
}

#role-status {
  margin-top: 0.9rem;
}

input:focus,
textarea:focus,
select:focus,
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--yellow);
  outline-offset: 2px;
}

.hint,
.form-status,
.form-error {
  margin: 0.55rem 0 0;
  color: var(--muted);
}

.form-error {
  color: #ffb4ad;
}

.stack {
  display: grid;
  gap: 0.9rem;
}

.auth {
  max-width: 34rem;
}

.auth h1 {
  font-size: clamp(3rem, 8vw, 5rem);
  margin-bottom: 1rem;
}

.switch {
  margin: 1rem 0 0;
}

.gate {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.gate p {
  margin: 0;
}

.button {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.subscribe {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1.5rem;
  align-items: end;
  width: min(1080px, calc(100% - 8vw));
  margin: 0 auto 2rem;
  padding: 1.4rem;
  background:
    linear-gradient(90deg, rgba(255, 208, 0, 0.12), transparent 40%),
    #10080a;
  border: 1px solid var(--line);
  border-top: 4px solid var(--yellow);
}

.subscribe h2 {
  font-size: clamp(2rem, 4vw, 3.2rem);
  margin-bottom: 0.5rem;
}

.subscribe-copy p:last-child {
  margin: 0;
  color: var(--muted);
}

.subscribe-row {
  display: flex;
  gap: 0.5rem;
}

.subscribe-row input {
  flex: 1;
}

.site-footer {
  padding: 1.4rem 6vw 2rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

.site-footer p {
  margin: 0.2rem 0;
}

.banner {
  width: min(1080px, calc(100% - 8vw));
  margin: 1rem auto;
}

.empty,
.loading {
  font-size: 1.2rem;
}

@media (max-width: 800px) {
  .post-grid,
  .subscribe,
  .subscribe-row {
    grid-template-columns: 1fr;
    display: grid;
  }

  .subscribe-row {
    display: grid;
  }

  .hero h1 {
    font-size: clamp(3.4rem, 18vw, 5.2rem);
  }

  .post-card.featured {
    grid-column: auto;
  }
}

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

  .post-card,
  .post-card:hover {
    transform: none;
  }
}

/* house-style test banner (aero-test / .lan only) */
.local-env-banner { position: sticky; top: 0; z-index: 10000; background: #ea580c; color: #fff; text-align: center; font-size: 0.72rem; font-weight: 700;
  letter-spacing: 0.03em; padding: 0.28rem 0.6rem; line-height: 1.25; box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2); }
.local-env-banner.hidden { display: none !important; }
@media print { .local-env-banner { display: none !important; } }
html.is-test .site-header { top: 1.55rem; }
.app-version.hidden { display: none; }
