/* Mystic Garden Books & Music — palette derived from the book's own artwork:
   sky blue background, lavender (Princess Anna's gown), grass green, warm
   gold (coming-soon back-matter page), rose accent. */
:root {
  --sky: #bdeaf5;
  --grass: #d3f0a7;
  --grass-deep: #4f8a3d;
  --lavender: #b39ddb;
  --lavender-deep: #6a4c93;
  --gold: #f7ce82;
  --gold-deep: #c98a2b;
  --rose: #e2646b;
  --ink: #33302a;
  --cream: #fffaf0;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Nunito Sans', 'Segoe UI', system-ui, sans-serif;
  color: var(--ink);
  background: var(--cream);
}

h1, h2, h3, .brand {
  font-family: Georgia, 'Iowan Old Style', 'Palatino Linotype', serif;
}

a { color: var(--lavender-deep); }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background: linear-gradient(180deg, var(--sky), #eaf9ff);
  border-bottom: 3px solid var(--lavender);
}

.brand {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--lavender-deep);
  text-decoration: none;
}

.site-nav a {
  margin-left: 1.5rem;
  text-decoration: none;
  color: var(--ink);
  font-weight: 600;
}

.site-nav a:hover { color: var(--rose); }

.hero {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 2rem;
  align-items: center;
  padding: 3rem 1.5rem;
  max-width: 1100px;
  margin: 0 auto;
}

.hero img {
  width: 100%;
  height: auto;
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(106, 76, 147, 0.25);
}

.hero h1 {
  font-size: 2.4rem;
  color: var(--lavender-deep);
  margin-bottom: 0.25rem;
}

.hero .byline {
  font-style: italic;
  color: var(--grass-deep);
  margin-bottom: 1rem;
}

.hero p {
  line-height: 1.6;
}

.buy-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.buy-button {
  display: inline-block;
  padding: 0.7rem 1.3rem;
  border-radius: 999px;
  font-weight: 700;
  text-decoration: none;
  color: #fff;
  background: var(--rose);
  box-shadow: 0 4px 10px rgba(226, 100, 107, 0.35);
}

.buy-button.secondary { background: var(--grass-deep); }
.buy-button.tertiary { background: var(--gold-deep); }

.buy-button.pending {
  background: #e8e2d6;
  color: #85796a;
  box-shadow: none;
  cursor: default;
  pointer-events: none;
}

.buy-button.pending .pending-note {
  display: block;
  font-size: 0.72rem;
  font-weight: 500;
}

section.band {
  padding: 3rem 1.5rem;
}

.band.coming-soon {
  background: linear-gradient(180deg, var(--gold), #fbe3ad);
  text-align: center;
}

.band.coming-soon h2 {
  color: var(--lavender-deep);
  margin-bottom: 1rem;
}

.band.coming-soon img {
  max-width: 900px;
  width: 100%;
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(201, 138, 43, 0.3);
}

.site-footer {
  text-align: center;
  padding: 1.5rem;
  background: var(--lavender-deep);
  color: #fff;
  font-size: 0.9rem;
}

.site-footer a { color: var(--gold); }

.logout-form {
  display: inline;
  margin-left: 1.5rem;
}

.logout-button {
  background: none;
  border: none;
  font: inherit;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  padding: 0;
}

.logout-button:hover { color: var(--rose); }

.login-band {
  max-width: 420px;
  margin: 3rem auto;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.login-form label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-weight: 600;
}

.login-form input {
  padding: 0.6rem 0.8rem;
  border: 2px solid var(--lavender);
  border-radius: 8px;
  font-size: 1rem;
}

.login-form button {
  padding: 0.7rem;
  border: none;
  border-radius: 999px;
  background: var(--rose);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.login-error {
  background: #fbe2e2;
  border: 1px solid var(--rose);
  color: #8a2c31;
  padding: 0.6rem 1rem;
  border-radius: 8px;
}

.mg-toolbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 1rem;
  background: var(--lavender-deep);
  color: #fff;
}

.mg-toolbar button {
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  border: none;
  background: var(--gold);
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
}

.mg-save-status { font-size: 0.85rem; }
.mg-save-status.mg-save-error { color: #ffb3b3; }

.buy-button-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.mg-edit-url {
  display: none;
  padding: 0.3rem 0.6rem;
  font-size: 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--lavender-deep);
  background: #fff;
  cursor: pointer;
}

body.mg-edit-mode .mg-edit-url { display: inline-block; }

.mg-editable {
  outline-offset: 2px;
}

body.mg-edit-mode .mg-editable {
  outline: 2px dashed var(--rose);
  border-radius: 4px;
}

.mg-editable-image {
  position: relative;
}

.mg-image-replace {
  display: none;
  position: absolute;
  bottom: 0.6rem;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  background: rgba(51, 48, 42, 0.8);
  color: #fff;
  font-size: 0.8rem;
  cursor: pointer;
}

.mg-image-replace input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

body.mg-edit-mode .mg-image-replace { display: block; }

.mg-history-panel {
  position: fixed;
  top: 3.2rem;
  right: 1rem;
  z-index: 60;
  width: min(320px, 90vw);
  max-height: 70vh;
  overflow-y: auto;
  background: #fff;
  border: 2px solid var(--lavender);
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 10px 30px rgba(51, 48, 42, 0.25);
}

.mg-history-panel h3 {
  margin-top: 0;
  font-size: 1rem;
}

.mg-history-panel ul {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
}

.mg-history-panel li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid #eee;
  font-size: 0.85rem;
}

.mg-history-restore {
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--lavender-deep);
  background: #fff;
  cursor: pointer;
  font-size: 0.78rem;
}

#mg-history-close {
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  border: none;
  background: var(--lavender);
  cursor: pointer;
}

@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; }
  .site-header { flex-direction: column; gap: 0.5rem; }
  .site-nav a { margin: 0 0.6rem; }
}

@media (max-width: 640px) {
  .mg-toolbar {
    position: fixed;
    bottom: 0;
    top: auto;
    left: 0;
    right: 0;
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
  }

  body.mg-admin {
    padding-bottom: 3.5rem; /* keep content clear of the fixed bottom toolbar, which
                                shows for any logged-in admin, not just in edit mode */
  }

  .mg-history-panel {
    top: auto;
    bottom: 4rem;
    right: 0.5rem;
  }

  .mg-image-replace {
    bottom: 0.3rem;
    font-size: 0.72rem;
    padding: 0.3rem 0.6rem;
  }
}
