:root {
  --purple-dark: #3d2b56;
  --purple-mid: #5b4b8a;
  --lavender: #e6e0f8;
  --tan: #d9c7a3;
  --text: #3d2b56;
}

* { box-sizing: border-box; }

html, body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: Georgia, 'Times New Roman', serif;
  color: var(--text);
  /* Spans the full page height (not viewport-fixed), so scrolling
     further into a long page naturally reveals the darker end. */
  background: linear-gradient(to bottom, #f7f5fc 0%, var(--lavender) 20%, var(--purple-mid) 65%, var(--purple-dark) 100%);
  background-attachment: scroll;
}

.site-header {
  background: var(--purple-dark);
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
}
.site-header .logo {
  color: #fff;
  text-decoration: none;
  font-size: 1.4rem;
  letter-spacing: 2px;
}
.site-header .logo span {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 3px;
  opacity: 0.8;
}
.site-header nav a {
  color: #fff;
  text-decoration: none;
  margin-left: 1.5rem;
}

.flash {
  background: var(--lavender);
  padding: 0.75rem 2rem;
  text-align: center;
}

main {
  max-width: 1000px;
  margin: 2.5rem auto;
  padding: 2.5rem;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

.hero { display: flex; gap: 2rem; flex-wrap: wrap; align-items: flex-start; }
.hero .cover { max-width: 320px; width: 100%; border-radius: 4px; }
.hero-text { flex: 1; min-width: 280px; }
.hero-text h1 { color: var(--purple-mid); font-weight: normal; }

.buy-buttons { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 1.5rem; max-width: 320px; }
.buy {
  background: var(--purple-dark);
  color: #fff;
  text-decoration: none;
  padding: 0.7rem 1rem;
  border-radius: 20px;
  text-align: center;
}
.buy:hover { background: var(--purple-mid); }

.synopsis {
  background: var(--lavender);
  padding: 2rem;
  margin: 2.5rem 0;
  font-style: italic;
  text-align: center;
}

.latest-post { border-top: 1px solid #ddd; padding-top: 2rem; }
.post-date { color: #888; font-size: 0.9rem; }
.post-body { white-space: normal; }
.post-body img { max-width: 100%; height: auto; border-radius: 6px; margin: 1rem 0; display: block; }
.see-all-link { display: block; margin-top: 2rem; }

.mailing-list { background: #fff; text-align: center; padding: 2rem 0; }
.subscribe-subtext { color: #666; margin-top: -0.5rem; }
.mailing-list form { display: flex; justify-content: center; gap: 0.5rem; max-width: 400px; margin: 1rem auto 0; }
.mailing-list input { flex: 1; padding: 0.5rem; border: none; border-bottom: 1px solid var(--purple-mid); }
.mailing-list button { background: var(--purple-dark); color: #fff; border: none; padding: 0.5rem 1.2rem; border-radius: 4px; }

.archive-post { margin-bottom: 2rem; }
.archive-post h2 { color: var(--purple-mid); margin-bottom: 0.2rem; }
.post-divider { border: none; border-top: 1px solid #e5e5e5; margin: 2.5rem 0; }

.about {
  display: grid;
  grid-template-columns: 300px 1fr;
  align-items: center;
  gap: 2rem;
  background: var(--tan);
  padding: 2rem;
  border-radius: 4px;
}
.about .author-photo { max-width: 100%; width: 100%; display: block; margin: 0 auto; border-radius: 4px; }

@media (max-width: 600px) {
  .about { grid-template-columns: 1fr; }
  .about .author-photo { max-width: 280px; }
}

.admin-form { max-width: 420px; margin: 2rem auto; }
.admin-form form { display: flex; flex-direction: column; gap: 1rem; }
.admin-form input, .admin-form textarea { padding: 0.6rem; font-family: inherit; }
.admin-form button { background: var(--purple-dark); color: #fff; border: none; padding: 0.7rem; border-radius: 4px; cursor: pointer; }
.admin-form .checkbox-row { flex-direction: row; align-items: center; gap: 0.5rem; }

.site-footer {
  text-align: center;
  padding: 1.5rem;
  font-size: 0.85rem;
  color: #777;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 12px;
  max-width: 1000px;
  margin: 0 auto 2.5rem;
}

.secret-door {
  display: block;
  width: fit-content;
  margin: 0 auto 1rem;
  font-size: 1.4rem;
  text-decoration: none;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s ease;
}
.secret-door.visible {
  opacity: 0.7;
  pointer-events: auto;
}
.secret-door.visible:hover {
  opacity: 1;
}

.admin-shell { display: flex; gap: 2rem; align-items: flex-start; }
.admin-nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 140px;
  border-right: 1px solid #eee;
  padding-right: 1.5rem;
}
.admin-nav a {
  color: var(--purple-mid);
  text-decoration: none;
  padding: 0.4rem 0;
}
.admin-nav a.active { font-weight: bold; color: var(--purple-dark); }
.admin-content { flex: 1; min-width: 0; }

.stat-row { display: flex; gap: 1.5rem; margin-bottom: 2rem; }
.stat-card {
  background: var(--lavender);
  padding: 1.2rem 1.6rem;
  border-radius: 8px;
  text-align: center;
}
.stat-number { font-size: 2rem; color: var(--purple-dark); font-weight: bold; }
.stat-label { font-size: 0.85rem; color: #666; }

.chart-section { margin-bottom: 2.5rem; }
.chart-section h2 { font-size: 1.1rem; color: var(--purple-mid); }

.table-section { margin-bottom: 2.5rem; }
.table-section h2 { font-size: 1.1rem; color: var(--purple-mid); }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.admin-table th, .admin-table td {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #eee;
}
.admin-table th { color: #888; font-weight: normal; }
.muted { color: #999; font-style: italic; }

.inline-form { display: flex; gap: 0.5rem; }
.inline-form input { flex: 1; padding: 0.3rem; }
.inline-form button, .admin-table .danger {
  background: var(--purple-mid);
  color: #fff;
  border: none;
  padding: 0.3rem 0.7rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
}
.admin-table .danger { background: #a33; }

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal-overlay.visible { display: flex; }
.modal-box {
  background: #fff;
  border-radius: 8px;
  padding: 2rem;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}
.modal-box h3 { color: var(--purple-dark); margin-top: 0; }
.modal-actions { display: flex; gap: 1rem; margin-top: 1.5rem; }
.modal-actions .buy { flex: 1; text-align: center; }
.modal-no {
  flex: 1;
  background: #eee;
  color: #555;
  border: none;
  border-radius: 20px;
  padding: 0.7rem 1rem;
  cursor: pointer;
}

.facebook-link { margin-top: 1rem; }
.facebook-link a { color: var(--purple-mid); }

.quote-block {
  text-align: center;
  font-style: italic;
  font-size: 1.2rem;
  color: var(--purple-mid);
  padding: 1.5rem 2rem;
  margin: 2rem 0;
  border-left: 4px solid var(--purple-mid);
  border-right: 4px solid var(--purple-mid);
}

.share-story-teaser {
  text-align: center;
  background: var(--lavender);
  padding: 2rem;
  border-radius: 8px;
  margin: 2rem 0;
}
.share-story-teaser .buy { display: inline-block; margin: 0.75rem 0.5rem 0; }
.share-story-teaser .see-all-link { display: block; margin-top: 0.75rem; }

.desk-banner {
  background: linear-gradient(120deg, var(--purple-dark), var(--purple-mid));
  color: #fff;
  padding: 1.5rem 2rem;
  border-radius: 10px;
  margin: -2.5rem -2.5rem 2rem;
  text-align: center;
}
.desk-banner h1 { margin: 0; font-size: 1.8rem; }
.desk-banner p { margin: 0.3rem 0 0; opacity: 0.85; font-style: italic; }

.publish-mode-fieldset { border: 1px solid #ddd; border-radius: 6px; padding: 1rem; }
.publish-mode-fieldset legend { padding: 0 0.5rem; color: var(--purple-mid); }
.radio-row { display: block; font-weight: normal; margin-bottom: 0.4rem; }
.radio-row input { width: auto; margin-right: 0.4rem; }

.status-badge { font-size: 0.85rem; padding: 0.2rem 0.5rem; border-radius: 4px; }
.status-published { background: #dff0d8; color: #3c763d; }
.status-scheduled { background: #fcf3cf; color: #7d6608; }
.status-draft { background: #eee; color: #666; }

.action-cell { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.link-button {
  background: none;
  border: none;
  color: var(--purple-mid);
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  font-size: 0.9rem;
  font-family: inherit;
}

.story-card {
  background: #faf9fc;
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 1.2rem;
  margin-bottom: 1rem;
}
.story-meta { color: #888; font-size: 0.85rem; margin: 0 0 0.5rem; }
.story-body { white-space: pre-wrap; }
.story-actions { display: flex; gap: 0.75rem; margin-top: 1rem; }
.story-actions .buy { padding: 0.5rem 1rem; }

.drop-zone {
  border: 2px dashed var(--purple-mid);
  border-radius: 8px;
  padding: 3rem 2rem;
  text-align: center;
  color: var(--purple-mid);
  cursor: pointer;
  margin-bottom: 2rem;
  transition: background 0.2s ease;
}
.drop-zone.drag-active { background: var(--lavender); }

.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1.2rem; }
.media-tile { text-align: center; }
.media-tile img { width: 100%; height: 120px; object-fit: cover; border-radius: 6px; }
.media-filename { font-size: 0.8rem; margin: 0.4rem 0 0.1rem; word-break: break-word; }
.media-path { font-size: 0.7rem; color: #999; word-break: break-all; margin: 0 0 0.4rem; }

.image-picker { margin-top: -0.5rem; }
.image-picker-label { font-size: 0.85rem; color: #666; margin-bottom: 0.5rem; }
.image-picker-grid { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.image-picker-thumb {
  width: 70px;
  height: 70px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.15s ease;
}
.image-picker-thumb:hover { border-color: var(--purple-mid); }

.media-tile .link-button { display: block; margin: 0 auto 0.4rem; }
.media-used-badge { font-size: 0.8rem; color: #7d6608; background: #fcf3cf; border-radius: 4px; padding: 0.15rem 0.4rem; display: inline-block; }

/* Honeypot: invisible to people, irresistible to form-filling bots */
.hp-field { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }
