/*
 * members.shaol.info - base stylesheet
 *
 * Skeleton only. Next Claude Code session is expected to flesh out
 * page-specific styles. Conventions here mirror the parent site.
 */

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

/* Honor the HTML hidden attribute even when an element's class sets an
 * explicit display (flex/grid/block). Without this, .modal-backdrop
 * etc. would stay visible despite [hidden] being set. */
[hidden] { display: none !important; }

/* Scanline overlay -- mirrors main site (shaol.info). Fixed, non-
 * interactive, sits above everything else. Keep the gradient stops in
 * sync with /home/tp/code/shaolinfoundry/styles/main.css. */
.scanlines {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 2px,
    rgba(0, 0, 0, 0.08) 2px,
    rgba(0, 0, 0, 0.08) 4px
  );
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--white);
  font-family: var(--font-mono);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
}

a {
  color: var(--cyan);
  text-decoration: none;
}
a:hover, a:focus {
  text-decoration: underline;
  text-decoration-thickness: 1px;
}

h1, h2, h3 {
  font-family: var(--font-vt);
  color: var(--cyan);
  letter-spacing: 0.02em;
  margin: 0 0 0.5em;
}

/* Cyan glow on the two main heading levels mirrors shaol.info; h3 stays
 * flat because it labels modal/card subsections where glow is noise. */
h1, h2 {
  text-shadow: 0 0 8px var(--cyan);
}

h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
h2 { font-size: clamp(1.4rem, 3vw, 1.8rem); }
h3 { font-size: 1.1rem; color: var(--white); }

/* Wrap [ ] characters in a page-header logo for the magenta accent
 * that matches the main site nav and footer. */
.logo-bracket {
  color: var(--magenta);
}

/* CRT-bezel-lite frame: a single-element nod to the main site's full
 * monitor chrome. Used to wrap auth surfaces (login) so the front door
 * reads as the same shop as shaol.info without going full monitor-and-
 * stand. */
.crt-frame {
  background: #030808;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.75rem 1.5rem;
  margin: 1.5rem 0;
  box-shadow:
    inset 0 0 30px rgba(0, 255, 204, 0.04),
    inset 0 0 80px rgba(0, 0, 0, 0.6),
    0 0 12px rgba(0, 255, 204, 0.08);
}
.crt-frame .card {
  background: transparent;
  border: 1px solid var(--border);
  margin: 1rem 0;
}

/* Small uppercase amber "// LABEL" line that sits above a card heading.
 * Used sparingly -- only where a card needs system-status framing. */
.section-label {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  color: var(--amber);
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

/* Dashboard row containers. Cards inside flow as columns at desktop
 * widths and stack on narrow viewports. The whole dashboard is
 * deliberately laid out so action surfaces (pending + needs) sit
 * above the calendar grid, and utility cards (subscribe + signal +
 * profile) sit below. */
.dashboard-row {
  display: grid;
  gap: 1rem;
  margin: 1rem 0;
}
/* minmax(0, 1fr) -- not bare 1fr -- so a column never grows past its
 * share to accommodate intrinsic content size. Without this, any
 * oversized image inside a card (e.g. a high-res QR) would push the
 * column wider than the row and the row wider than the viewport. */
.dashboard-row--actions {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}
.dashboard-row--utility {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.dashboard-row > .card {
  margin: 0;
}

/* Action button strip that sits between the action row and the
 * calendar. Buttons are inline-flex so a hidden one (e.g. [+ Add
 * event] for members) collapses cleanly. */
.dashboard-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.5rem 0 1rem;
  align-items: center;
}

@media (max-width: 720px) {
  .dashboard-row--actions,
  .dashboard-row--utility {
    grid-template-columns: 1fr;
  }
}

/* Role badge in the members list. Same chip shape as .needs-count
 * but role-coloured. admin = magenta, staff = amber, member = dim. */
.role-badge {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0 0.4rem;
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  color: var(--bg);
  background: var(--dim);
  text-transform: uppercase;
}
.role-badge.role-admin { background: var(--magenta); }
.role-badge.role-staff { background: var(--amber); }

.members-row {
  list-style: none;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
}
.members-row:last-child { border-bottom: none; }
.members-name { color: var(--cyan); text-decoration: none; }
.members-name:hover { text-decoration: underline; }

/* .plan body. Plaintext from the server; preserve user-authored line
 * breaks but allow wrapping at word boundaries. No markdown rendered. */
.plan-text {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0.5rem 0 1rem;
  font-size: 0.9rem;
  line-height: 1.6;
}
.plan-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.25rem 0 1rem;
}

/* Signal-card QR: source asset is a phone screenshot (1260x1142) so
 * "max-width: 100%" alone is not enough -- the card column would
 * stretch to fit. Cap at 240px (comfortably scannable from a phone
 * held a few inches away) and center inside the card. */
.signal-qr-img {
  display: block;
  width: 100%;
  max-width: 240px;
  height: auto;
  margin: 0.5rem auto 0;
}

/* Pending-count badge in the nav. Same chip shape as .needs-count
 * but applies inline next to the "Pending" link; only rendered when
 * count > 0 (auth.js appends the element only in that case). */
.nav-badge {
  display: inline-block;
  margin-left: 0.25rem;
  padding: 0 0.35rem;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  color: var(--bg);
  background: var(--amber);
}

/* Count chip for the Needs snapshot. Solid amber pill, hidden when 0. */
.needs-count {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0 0.4rem;
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  color: var(--bg);
  background: var(--amber);
  text-transform: uppercase;
}

/* Tiny pulsing LED for page headers. Inline element; place inside the
 * h1 so it inherits the heading baseline. */
.led-pulse {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
  animation: led-pulse 2s ease-in-out infinite;
  vertical-align: middle;
  margin-left: 0.5rem;
  flex: 0 0 auto;
}

@keyframes led-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

@media (prefers-reduced-motion: reduce) {
  .led-pulse { animation: none; opacity: 1; }
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
}
.skip-link:focus {
  left: 1rem;
  top: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--cyan);
  padding: 0.5rem 0.75rem;
  z-index: 100;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.25rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 1.5rem;
  margin: 1rem 0;
}

.dim     { color: var(--dim); }
.cyan    { color: var(--cyan); }
.magenta { color: var(--magenta); }
.amber   { color: var(--amber); }
.green   { color: var(--green); }

.crt-input,
.crt-textarea,
.crt-select {
  display: block;
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--white);
  font: inherit;
  padding: 0.5rem 0;
  margin: 0.25rem 0 1rem;
}
.crt-input:focus,
.crt-textarea:focus,
.crt-select:focus {
  outline: none;
  border-bottom-color: var(--cyan);
}

.btn {
  display: inline-block;
  background: var(--cyan);
  color: var(--bg);
  border: 1px solid var(--cyan);
  padding: 0.5rem 1.25rem;
  font: inherit;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
}
.btn:hover, .btn:focus {
  background: transparent;
  color: var(--cyan);
  outline: none;
  box-shadow: 0 0 16px var(--cyan);
}

.btn-ghost {
  background: transparent;
  color: var(--cyan);
  border: 1px solid var(--cyan);
  padding: 0.4rem 1rem;
  font: inherit;
  cursor: pointer;
}

.error {
  color: var(--magenta);
  text-shadow: 0 0 4px rgba(255, 45, 120, 0.4);
}
.success  { color: var(--green); }

.meta {
  color: var(--dim);
  font-size: 0.85rem;
}

.qr-block {
  background: #fff;
  padding: 1rem;
  display: inline-block;
}
.qr-block svg { display: block; }

.op-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.75rem;
  font-size: 0.9rem;
}
.op-table th,
.op-table td {
  text-align: left;
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.op-table th {
  color: var(--dim);
  font-weight: normal;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}
.op-table code { font-size: 0.85em; }

.footer-bottom { margin-top: 2rem; }

@media (max-width: 480px) {
  .container { padding: 1.25rem 0.75rem; }
  .card { padding: 1rem; }
  .op-table { font-size: 0.8rem; }
  .op-table th, .op-table td { padding: 0.3rem 0.25rem; }
}

/* ---- calendar grid ---------------------------------------------------- */

.cal-card { padding-bottom: 1rem; }

.cal-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}
.cal-header h2 {
  margin: 0;
  flex: 1;
  min-width: 0;
  font-size: 1.2rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.cal-header .btn-ghost { padding: 0.25rem 0.6rem; font-size: 0.85rem; }

.cal-weekday-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  color: var(--dim);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0 1px;
}
.cal-weekday-row > div { padding: 0.25rem 0.4rem; }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--border);
  gap: 1px;
  border: 1px solid var(--border);
}
.cal-cell {
  background: var(--bg-card);
  min-height: 88px;
  padding: 0.25rem 0.35rem;
  display: flex;
  flex-direction: column;
  cursor: pointer;
}
.cal-cell:hover { background: var(--bg-2); }
.cal-cell.other-month {
  background: var(--bg);
  color: var(--dim);
}
.cal-cell.other-month:hover { background: var(--bg-2); }
.cal-cell.today .cal-day-num {
  color: var(--bg);
  background: var(--cyan);
  padding: 0 0.3rem;
  display: inline-block;
}
.cal-day-num {
  font-size: 0.8rem;
  color: var(--dim);
  margin-bottom: 0.2rem;
}
.cal-cell.today { box-shadow: inset 0 0 0 1px var(--cyan); }

.cal-chip {
  display: block;
  font-size: 0.75rem;
  line-height: 1.2;
  padding: 0.1rem 0.3rem;
  margin-bottom: 0.15rem;
  border: 1px solid var(--cyan);
  color: var(--cyan);
  background: transparent;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.cal-chip:hover { background: var(--bg-2); }
.cal-chip.kind-event {
  background: var(--cyan);
  color: var(--bg);
  border-color: var(--cyan);
}
.cal-chip.kind-booking {
  border-style: solid;
}
.cal-chip.status-pending {
  border-style: dashed;
  color: var(--amber);
  border-color: var(--amber);
  background: transparent;
}
.cal-chip-more {
  font-size: 0.7rem;
  color: var(--dim);
  margin-top: 0.1rem;
}

@media (max-width: 640px) {
  .cal-cell { min-height: 64px; padding: 0.15rem 0.2rem; }
  .cal-day-num { font-size: 0.7rem; }
  .cal-chip { font-size: 0.65rem; padding: 0.05rem 0.2rem; }
}

/* ---- modal ----------------------------------------------------------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 5, 8, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 1rem;
}
.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--cyan);
  padding: 1.5rem;
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-card h3 { color: var(--cyan); margin-top: 0; }
.modal-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

/* ---- type toggle + role-aware form ----------------------------------- */

.type-toggle {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
}
.type-toggle label { cursor: pointer; }
.type-toggle input { margin-right: 0.3rem; }

.row-actions { margin-top: 0.4rem; }
.row-actions .btn-ghost { padding: 0.2rem 0.6rem; font-size: 0.8rem; margin-right: 0.3rem; }

#sub-url-box {
  display: block;
  word-break: break-all;
  background: var(--bg-2);
  border: 1px solid var(--border);
  padding: 0.5rem;
  margin: 0.5rem 0;
  font-size: 0.85rem;
}
