/* ==========================================================================
   Reading Group Site — Old-School PC Aesthetic
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=VT323&display=swap');

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #f5f0e8;
  --bg-dark: #e8e0d4;
  --fg: #2a2a2a;
  --fg-muted: #5a5a5a;
  --accent: #4a6741;
  --error: #a33;
  --border-light: #d5cfc5;
  --border-dark: #8a8478;
  --inset-light: #faf7f2;
  --inset-dark: #c5bfb3;
  --font: 'VT323', monospace;
  --scanline-opacity: 0.03;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  font-size: 20px;
  color: var(--fg);
  background: var(--bg);
}

/* --- CRT / Paper Texture --- */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, var(--scanline-opacity)) 2px,
    rgba(0, 0, 0, var(--scanline-opacity)) 4px
  );
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9998;
  background: radial-gradient(
    ellipse at center,
    transparent 60%,
    rgba(0, 0, 0, 0.08) 100%
  );
}

/* --- Password Gate --- */
#auth-gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

#auth-gate.hidden {
  display: none;
}

.auth-window {
  border: 2px solid;
  border-color: var(--border-light) var(--border-dark) var(--border-dark) var(--border-light);
  background: var(--bg);
  padding: 0;
  min-width: 340px;
  max-width: 90vw;
}

.auth-titlebar {
  background: var(--accent);
  color: #fff;
  padding: 4px 8px;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}

.auth-titlebar-buttons {
  display: flex;
  gap: 2px;
}

.auth-titlebar-btn {
  width: 16px;
  height: 14px;
  background: var(--bg);
  border: 1px solid;
  border-color: var(--border-light) var(--border-dark) var(--border-dark) var(--border-light);
  font-size: 10px;
  line-height: 12px;
  text-align: center;
  cursor: default;
  font-family: var(--font);
  color: var(--fg);
}

.auth-body {
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-body label {
  font-size: 1.1rem;
}

.auth-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.auth-input {
  flex: 1;
  font-family: var(--font);
  font-size: 1.1rem;
  padding: 4px 6px;
  border: 2px solid;
  border-color: var(--inset-dark) var(--inset-light) var(--inset-light) var(--inset-dark);
  background: #fff;
  color: var(--fg);
  outline: none;
}

.auth-btn {
  font-family: var(--font);
  font-size: 1.1rem;
  padding: 4px 16px;
  border: 2px solid;
  border-color: var(--border-light) var(--border-dark) var(--border-dark) var(--border-light);
  background: var(--bg);
  color: var(--fg);
  cursor: pointer;
  white-space: nowrap;
}

.auth-btn:active {
  border-color: var(--border-dark) var(--border-light) var(--border-light) var(--border-dark);
}

.auth-error {
  color: var(--error);
  font-size: 1rem;
  min-height: 1.2em;
}

/* --- Main Content --- */
#main-content {
  display: none;
  width: 100%;
  height: 100%;
  overflow-y: auto;
}

#main-content.visible {
  display: flex;
  align-items: center;
  justify-content: center;
}

.book-container {
  display: flex;
  align-items: flex-start;
  gap: 40px;
  padding: 40px;
  max-width: 900px;
  width: 100%;
}

/* --- Book Cover --- */
.book-cover-wrap {
  flex-shrink: 0;
  width: 240px;
}

.book-cover {
  width: 100%;
  aspect-ratio: 2 / 3;
  border: 2px solid;
  border-color: var(--border-light) var(--border-dark) var(--border-dark) var(--border-light);
  background: var(--bg-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.book-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.book-cover-fallback {
  padding: 24px;
  text-align: center;
  font-size: 1.6rem;
  line-height: 1.3;
  color: var(--fg);
}

/* --- Book Info --- */
.book-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-top: 8px;
}

.book-title {
  font-size: 2.4rem;
  line-height: 1.1;
  letter-spacing: 0.02em;
}

.book-author {
  font-size: 1.4rem;
  color: var(--fg-muted);
}

.book-vibe {
  font-size: 1.15rem;
  line-height: 1.4;
  color: var(--fg);
  font-style: italic;
  border-left: 3px solid var(--border-dark);
  padding-left: 12px;
}

/* --- Meetings Dropdown --- */
.meetings-section {
  margin-top: 8px;
}

.meetings-label {
  font-size: 1rem;
  margin-bottom: 6px;
  color: var(--fg-muted);
}

.meetings-select-wrap {
  position: relative;
  display: inline-block;
  width: 100%;
  max-width: 360px;
}

.meetings-select {
  appearance: none;
  -webkit-appearance: none;
  font-family: var(--font);
  font-size: 1.05rem;
  width: 100%;
  padding: 4px 28px 4px 6px;
  border: 2px solid;
  border-color: var(--inset-dark) var(--inset-light) var(--inset-light) var(--inset-dark);
  background: #fff;
  color: var(--fg);
  cursor: pointer;
  outline: none;
}

.meetings-select-wrap::after {
  content: '▼';
  position: absolute;
  right: 2px;
  top: 2px;
  bottom: 2px;
  width: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  background: var(--bg);
  border: 2px solid;
  border-color: var(--border-light) var(--border-dark) var(--border-dark) var(--border-light);
  pointer-events: none;
  color: var(--fg);
}

.meetings-empty {
  font-size: 1rem;
  color: var(--fg-muted);
}

/* --- Mobile --- */
@media (max-width: 680px) {
  html, body {
    overflow-y: auto;
    height: auto;
    min-height: 100%;
  }

  #main-content.visible {
    align-items: flex-start;
    min-height: 100vh;
    padding: 20px 0;
  }

  .book-container {
    flex-direction: column;
    align-items: center;
    gap: 24px;
    padding: 24px 20px;
  }

  .book-cover-wrap {
    width: 180px;
  }

  .book-info {
    padding-top: 0;
    align-items: center;
    text-align: center;
  }

  .book-title {
    font-size: 2rem;
  }

  .book-vibe {
    border-left: none;
    padding-left: 0;
    text-align: center;
  }

  .meetings-select-wrap {
    max-width: 100%;
  }
}
