/* Rally: shared world. Optic-yellow polymer, drilled holes, stamped ink. */

@font-face {
  font-family: 'Anybody';
  src: url('../fonts/anybody.woff2') format('woff2');
  font-weight: 100 900;
  font-stretch: 50% 150%;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Anybody';
  src: url('../fonts/anybody-italic.woff2') format('woff2');
  font-weight: 100 900;
  font-stretch: 50% 150%;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Archivo';
  src: url('../fonts/archivo.woff2') format('woff2');
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Archivo';
  src: url('../fonts/archivo-italic.woff2') format('woff2');
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-style: italic;
  font-display: swap;
}

:root {
  /* polymer */
  --ball: #dce82c;
  --ball-hi: #e8f25a;
  --ball-lo: #c7d31c;
  --hole: #a9b414;
  --hole-deep: #6f770a;
  /* ink */
  --ink: #151a0b;
  --ink-2: #353c12;
  --ink-3: #485018;
  /* other balls, other jobs */
  --white-ball: #f8faf0;
  --orange: #ff6a1f;
  --orange-deep: #c2410c;
  --court: #1f5aa0;
  --court-deep: #173f72;
  --olive: #48560f;

  --font-display: 'Anybody', 'Archivo', system-ui, sans-serif;
  --font-ui: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --radius-s: 6px;
  --radius-m: 12px;
  --radius-l: 20px;
  --radius-pill: 999px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-press: cubic-bezier(0.3, 0, 0.2, 1);
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-variant-numeric: tabular-nums;
}

img,
svg {
  display: block;
}

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

a {
  color: inherit;
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1.5px;
}

::selection {
  background: var(--ink);
  color: var(--ball);
}

:focus-visible {
  outline: 3px solid var(--court);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* The stamp: the brand mark printed on a ball */
.stamp {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 850;
  font-stretch: 135%;
  letter-spacing: -0.02em;
}

/* ---------- Pegboard (shared by landing and dashboard) ---------- */

.board {
  --label: 92px;
  --row: 36px;
  --hole-r: 5px;
  --hole-c: var(--hole);
  --hole-d: var(--hole-deep);
  position: relative;
  user-select: none;
}

.board-hours {
  display: grid;
  grid-template-columns: var(--label) 1fr;
  height: 22px;
  align-items: end;
}
.board-hours ol {
  position: relative;
  margin: 0;
  padding: 0;
  list-style: none;
  height: 100%;
}
.board-hours li {
  position: absolute;
  bottom: 4px;
  transform: translateX(-50%);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-3);
  white-space: nowrap;
}
.board-hours li[style="left:0%"] {
  transform: none;
}

.board-body {
  position: relative;
}

.board-row {
  display: grid;
  grid-template-columns: var(--label) 1fr;
  height: var(--row);
}

.board-court {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding-right: 10px;
  align-self: center;
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
}
.board-court small {
  font-weight: 500;
  font-size: 11px;
  color: var(--ink-3);
}

/* Ghost holes: one per half hour, drawn on purpose */
.board-track {
  position: relative;
  background-image:
    radial-gradient(circle at 50% 60%, var(--hole-c) 0 calc(var(--hole-r) - 1.5px), transparent calc(var(--hole-r) - 1px)),
    radial-gradient(circle at 50% 50%, var(--hole-d) 0 var(--hole-r), transparent calc(var(--hole-r) + 0.6px));
  background-size: calc(100% / var(--cols)) 100%;
  background-repeat: repeat-x;
}

.plug {
  position: absolute;
  top: 4px;
  bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.1;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.18) inset,
    0 2px 3px rgba(21, 26, 11, 0.28);
  transition:
    transform 0.18s var(--ease-press),
    box-shadow 0.18s var(--ease-press),
    left 0.6s var(--ease-out),
    top 0.6s var(--ease-out);
}
.plug span {
  overflow: hidden;
  text-overflow: ellipsis;
}
.plug:active {
  transform: translateY(1px);
  box-shadow: 0 0 0 rgba(21, 26, 11, 0.2);
}

.plug[data-type='booking'] {
  background: var(--ink);
  color: var(--white-ball);
}
.plug[data-type='open'] {
  background: var(--white-ball);
  color: var(--ink);
}
.plug[data-type='league'],
.plug[data-type='ladder'] {
  background: var(--olive);
  color: var(--white-ball);
}
.plug[data-type='clinic'],
.plug[data-type='lesson'] {
  background: var(--court);
  color: #fff;
}
.plug[data-type='hold'] {
  background: repeating-linear-gradient(-45deg, var(--white-ball) 0 6px, #e4e7d6 6px 12px);
  color: var(--ink);
  box-shadow: 0 0 0 1.5px var(--ink) inset;
}
.plug.is-past {
  box-shadow: none;
  cursor: pointer;
}
.plug.is-past[data-type='booking'],
.plug.is-past[data-type='league'],
.plug.is-past[data-type='ladder'] {
  background: color-mix(in oklab, var(--ink) 52%, var(--hole));
  color: color-mix(in oklab, var(--white-ball) 85%, var(--hole));
}
.plug.is-past[data-type='open'] {
  background: color-mix(in oklab, var(--white-ball) 55%, var(--hole));
  color: var(--ink-2);
}
.plug.is-past[data-type='clinic'],
.plug.is-past[data-type='lesson'] {
  background: color-mix(in oklab, var(--court) 55%, var(--hole));
  color: #fff;
}
.plug.is-noshow {
  background: transparent;
  color: var(--ink-2);
  box-shadow: 0 0 0 1.5px var(--ink-3) inset;
  text-decoration: line-through;
}
.plug.is-alert {
  background: var(--orange);
  color: var(--ink);
}

/* two plugs, one hole: the row opens up so both can be read */
.board-row.has-conflict {
  height: calc(var(--row) * 1.7);
}
.board-row.has-conflict .plug:not(.is-conflict) {
  top: calc(50% - var(--row) / 2 + 4px);
  bottom: auto;
  height: calc(var(--row) - 8px);
}
.plug.is-conflict {
  z-index: 2;
  padding: 0 7px;
}
.plug.is-conflict.is-over {
  top: 4px;
  bottom: auto;
  height: calc(var(--row) * 0.85 - 6px);
  box-shadow: 0 0 0 2px var(--orange), 0 2px 3px rgba(21, 26, 11, 0.28);
}
.plug.is-conflict.is-under {
  top: auto;
  bottom: 4px;
  height: calc(var(--row) * 0.85 - 6px);
  background: var(--orange);
  color: var(--ink);
  z-index: 3;
  box-shadow: 0 2px 6px rgba(21, 26, 11, 0.35);
}
.board-row.has-conflict .board-track::after {
  content: '';
  position: absolute;
  inset: 0 auto 0 var(--conf-left);
  width: var(--conf-width);
  border-radius: 14px;
  background: rgba(255, 106, 31, 0.18);
  box-shadow: 0 0 0 2px var(--orange);
  animation: conflict-pulse 1.8s ease-in-out infinite;
  pointer-events: none;
}
@keyframes conflict-pulse {
  50% {
    box-shadow: 0 0 0 6px rgba(255, 106, 31, 0.28);
  }
}

.plug.is-ghost {
  background: transparent;
  color: var(--ink);
  box-shadow: 0 0 0 2px var(--ink) inset;
  border: 0;
  outline: 2px dashed var(--ink);
  outline-offset: -2px;
  box-shadow: none;
  animation: ghost-breathe 1.4s ease-in-out infinite;
  cursor: default;
  pointer-events: none;
}
@keyframes ghost-breathe {
  50% {
    opacity: 0.55;
  }
}
.plug.is-seated {
  animation: seat 0.5s var(--ease-out);
}
@keyframes seat {
  0% {
    transform: translateY(-3px) scale(1.04);
    box-shadow: 0 8px 14px rgba(21, 26, 11, 0.3);
  }
  100% {
    transform: none;
  }
}

.board-now {
  position: absolute;
  top: -24px;
  bottom: -4px;
  width: 2px;
  margin-left: -1px;
  background: var(--ink);
  pointer-events: none;
  z-index: 0;
}
.board-track .plug {
  z-index: 1;
}
.board-now::before {
  content: attr(data-label);
  position: absolute;
  top: -42px;
  left: 50%;
  transform: translateX(-50%);
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  background: var(--ink);
  color: var(--ball);
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
  }
}
