/* placecast — minimal, dark, the streams ARE the design */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  background: #0a0a0a;
  color: #e8e8e8;
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
}

.brand {
  position: fixed;
  top: 12px;
  left: 14px;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.55;
  z-index: 5;
  pointer-events: none;
  mix-blend-mode: difference;
  color: #fff;
}

.hint {
  position: fixed;
  top: 12px;
  right: 14px;
  font-size: 11px;
  letter-spacing: 0.05em;
  opacity: 0.55;
  z-index: 5;
  pointer-events: none;
  transition: opacity 0.6s ease;
  mix-blend-mode: difference;
  color: #fff;
}

.hint.faded {
  opacity: 0;
}

/* Catalog grid: variable column count via auto-fit. 360px minmax gives:
   - 1 column on mobile / narrow tablet
   - 2 columns on standard tablet (≥720px)
   - 3 columns on laptop (≥1080px)
   - 4 columns on wide desktop (≥1440px) */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 1px;
  background: #1a1a1a;
}

.tile {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  overflow: hidden;
  cursor: pointer;
}

/* Thumbnail fills the tile until the iframe mounts. */
.tile-thumb {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-color: #0f0f0f;
  transition: opacity 0.4s ease;
}

.tile.live .tile-thumb {
  opacity: 0;
  pointer-events: none;
}

.tile-iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  pointer-events: none; /* clicks go to the tile, not the iframe */
}

.tile-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #555;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.tile-label {
  position: absolute;
  bottom: 10px;
  left: 12px;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #f0f0f0;
  opacity: 0.75;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85);
  transition: opacity 0.2s ease;
  pointer-events: none;
  z-index: 2;
}

.tile-meta {
  position: absolute;
  bottom: 10px;
  right: 12px;
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #f0f0f0;
  opacity: 0.4;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85);
  pointer-events: none;
  z-index: 2;
}

.tile:hover .tile-label {
  opacity: 1;
}

.tile:hover .tile-meta {
  opacity: 0.7;
}

/* Fullscreen overlay (click a tile) */
.overlay {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
}

.overlay.active {
  display: flex;
}

.overlay-iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.overlay-close {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 110;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 8px 14px;
  font-size: 12px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  cursor: pointer;
  font-family: inherit;
  border-radius: 2px;
}

.overlay-close:hover {
  background: rgba(0, 0, 0, 0.85);
}

.overlay-label {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 110;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #f0f0f0;
  opacity: 0.7;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

/* Submit-a-placecast section, after the catalog. The supply-side demand
   signal: clicks tracked via the submit_clicked event in Vercel Analytics. */
.submit-section {
  padding: 96px 24px 120px;
  text-align: center;
  background: #0a0a0a;
  border-top: 1px solid #161616;
}

.submit-prompt {
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  opacity: 0.5;
  margin-bottom: 24px;
}

.submit-cta {
  display: inline-block;
  font-size: 26px;
  letter-spacing: 0.04em;
  color: #f0f0f0;
  text-decoration: none;
  border-bottom: 1px solid rgba(240, 240, 240, 0.3);
  padding-bottom: 6px;
  transition: border-color 0.2s ease, opacity 0.2s ease;
  background: none;
  border-top: 0;
  border-left: 0;
  border-right: 0;
  font-family: inherit;
  cursor: pointer;
}

.submit-cta:hover {
  border-bottom-color: #f0f0f0;
}

.submit-meta {
  margin-top: 24px;
  font-size: 12px;
  letter-spacing: 0.05em;
  opacity: 0.4;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.5;
}

/* Modal — submit a placecast */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal-card {
  position: relative;
  background: #0f0f0f;
  border: 1px solid #222;
  border-radius: 4px;
  padding: 36px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  color: #e8e8e8;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: 0;
  color: #888;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  padding: 6px 10px;
  font-family: inherit;
}

.modal-close:hover {
  color: #f0f0f0;
}

.modal-title {
  font-size: 18px;
  letter-spacing: 0.02em;
  margin-bottom: 8px;
  font-weight: 500;
}

.modal-sub {
  font-size: 13px;
  opacity: 0.6;
  margin-bottom: 24px;
  line-height: 1.5;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.field-label {
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  opacity: 0.7;
}

.req {
  color: #d97171;
  margin-left: 2px;
}

.field-hint {
  font-size: 11px;
  opacity: 0.45;
  margin-top: 2px;
}

.field input,
.field textarea {
  background: #181818;
  border: 1px solid #2a2a2a;
  border-radius: 2px;
  padding: 10px 12px;
  font-size: 14px;
  color: #f0f0f0;
  font-family: inherit;
  transition: border-color 0.15s ease;
  resize: vertical;
}

.field input:focus,
.field textarea:focus {
  outline: 0;
  border-color: #555;
}

.field input::placeholder,
.field textarea::placeholder {
  color: #555;
}

.field input:invalid:not(:placeholder-shown) {
  border-color: #5a2c2c;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 8px;
}

.btn-ghost,
.btn-primary {
  font-family: inherit;
  font-size: 12px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 10px 18px;
  border-radius: 2px;
  cursor: pointer;
  transition: opacity 0.15s ease, background 0.15s ease;
}

.btn-ghost {
  background: transparent;
  border: 1px solid #2a2a2a;
  color: #aaa;
}

.btn-ghost:hover {
  border-color: #555;
  color: #f0f0f0;
}

.btn-primary {
  background: #f0f0f0;
  border: 1px solid #f0f0f0;
  color: #0a0a0a;
}

.btn-primary:hover {
  background: #fff;
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.submit-status {
  font-size: 12px;
  margin-top: 4px;
  min-height: 16px;
}

.submit-status.error {
  color: #d97171;
}

.submit-status.success {
  color: #7fce93;
}

@media (max-width: 720px) {
  .tile-label {
    font-size: 12px;
  }

  .hint {
    display: none;
  }

  .submit-section {
    padding: 64px 20px 80px;
  }

  .submit-cta {
    font-size: 22px;
  }

  .modal-card {
    padding: 28px 20px;
  }

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