@import url("https://fonts.googleapis.com/css2?family=Fraunces:wght@500;700&family=Space+Grotesk:wght@400;500;600;700&display=swap");

:root {
  color-scheme: light;
  --bg: #f4f2ee;
  --bg-alt: #fff7ee;
  --surface: #ffffff;
  --surface-alt: #f9f7f4;
  --ink: #1d1b18;
  --muted: #6c625c;
  --accent: #e35a3a;
  --accent-dark: #b9482f;
  --outline: #e6dfd6;
  --shadow: 0 20px 60px rgba(34, 25, 15, 0.12);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  background: radial-gradient(circle at top left, #fff1e6 0%, #f4f2ee 50%, #f1ebe5 100%);
  color: var(--ink);
  min-height: 100vh;
}

.background-shape {
  position: fixed;
  z-index: 0;
  border-radius: 999px;
  opacity: 0.5;
  filter: blur(0px);
}

.shape-a {
  width: 460px;
  height: 460px;
  background: radial-gradient(circle at 30% 30%, #ffe1cc, transparent 70%);
  top: -120px;
  left: -80px;
}

.shape-b {
  width: 520px;
  height: 520px;
  background: radial-gradient(circle at 70% 60%, #ffe6d2, transparent 70%);
  bottom: -180px;
  right: -120px;
}

.app-header {
  position: relative;
  z-index: 2;
  padding: 36px 7vw 26px;
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin: 0 0 8px;
}

h1 {
  font-family: "Fraunces", "Georgia", serif;
  font-size: clamp(28px, 3vw, 44px);
  margin: 0 0 10px;
}

.subtitle {
  max-width: 520px;
  margin: 0;
  color: var(--muted);
}

/* Make subtitle and credits links use site accent color */
.subtitle a,
.credits a,
.credits-footer a,
.app-footer a {
  color: var(--accent);
  text-decoration: none;
}
.credits-footer {
  color: var(--muted);
}
.subtitle a:hover,
.credits-footer a:hover,
.app-footer a:hover {
  color: var(--accent-dark);
}

.header-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn.primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 10px 24px rgba(227, 90, 58, 0.28);
}

.btn.primary:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

.btn.ghost {
  background: transparent;
  border: 1px solid var(--outline);
  color: var(--ink);
}

.btn.subtle {
  background: var(--surface-alt);
  color: var(--muted);
}

.app-shell {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(220px, 260px) minmax(0, 1fr);
  gap: 24px;
  padding: 0 7vw 40px;
}

.sidebar {
  background: var(--surface);
  padding: 24px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: 520px;
}

.sidebar-header h2 {
  margin: 0 0 6px;
  font-size: 18px;
}

.progress-text {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.nav-button {
  border: 1px solid transparent;
  background: var(--surface-alt);
  padding: 10px 14px;
  border-radius: 12px;
  text-align: left;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  transition: border 0.2s ease, transform 0.2s ease;
}

.nav-button.active {
  border-color: var(--accent);
  background: #fff1e8;
  transform: translateX(2px);
}

.sidebar-actions {
  margin-top: auto;
}

.sidebar-footer {
  font-size: 12px;
  color: var(--muted);
}

.content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
}

.panel {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  animation: fadeUp 0.5s ease both;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.section-description {
  margin: 0;
  color: var(--muted);
  max-width: 280px;
}

.section-description a {
  color: var(--accent);
  text-decoration: none;
}

.section-description a:hover {
  color: var(--accent-dark);
}

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

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

.field-group-heading {
  margin: 6px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--outline);
}

.field-group-heading h3 {
  margin: 0;
  font-family: "Fraunces", "Georgia", serif;
  font-size: 17px;
  color: var(--ink);
}

.field-label {
  font-weight: 600;
  font-size: 13px;
}

.field-help {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}

.field-input {
  border-radius: 12px;
  border: 1px solid var(--outline);
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
}

.field-input:focus {
  outline: 2px solid rgba(227, 90, 58, 0.35);
  border-color: var(--accent);
}

.form-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 18px;
}

.validation {
  background: #fff1e8;
  border: 1px dashed var(--accent);
  color: var(--accent-dark);
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13px;
  display: none;
  margin-bottom: 12px;
}

.validation.visible {
  display: block;
}

.preview-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
}

.template-controls {
  display: grid;
  gap: 8px;
  min-width: 220px;
}

.preview {
  background: #fffaf4;
  color: var(--ink);
  border-radius: 14px;
  padding: 18px;
  border: 1px solid var(--outline);
  overflow: auto;
  min-height: 480px;
}

.preview.markdown h1,
.preview.markdown h2,
.preview.markdown h3,
.preview.markdown h4 {
  font-family: "Fraunces", "Georgia", serif;
  margin: 18px 0 8px;
}

.preview.markdown h1 {
  font-size: 22px;
}

.preview.markdown h2 {
  font-size: 18px;
}

.preview.markdown h3 {
  font-size: 16px;
}

.preview.markdown h4 {
  font-size: 14px;
}

.preview.markdown p {
  margin: 10px 0;
  line-height: 1.5;
}

.preview.markdown ul,
.preview.markdown ol {
  padding-left: 20px;
  margin: 10px 0;
}

.preview.markdown code {
  background: #f0e6dc;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.9em;
}

.preview.markdown pre {
  background: #1d1b18;
  color: #f7f1ea;
  padding: 12px;
  border-radius: 10px;
  overflow-x: auto;
}

.preview.markdown pre code {
  background: transparent;
  padding: 0;
  color: inherit;
}

.preview.markdown a {
  color: var(--accent-dark);
}

.preview.markdown blockquote {
  margin: 12px 0;
  padding-left: 12px;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}

.preview.markdown details {
  background: #fff1e8;
  padding: 10px 12px;
  border-radius: 10px;
  margin: 10px 0;
}

.preview.markdown summary {
  cursor: pointer;
  font-weight: 600;
}

.app-footer {
  padding: 0 7vw 32px;
  color: var(--muted);
  font-size: 13px;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .content {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .app-header {
    padding: 24px 5vw 18px;
  }

  .app-shell {
    padding: 0 5vw 32px;
  }

  .app-footer {
    padding: 0 5vw 24px;
  }

  .sidebar {
    min-height: auto;
    padding: 16px;
  }

  .panel {
    padding: 16px;
  }

  .section-header {
    flex-direction: column;
  }

  .section-description {
    max-width: 100%;
  }

  .preview {
    min-height: 320px;
  }

  .form-actions {
    flex-wrap: wrap;
    gap: 8px;
  }

  .nav-list {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
  }

  .nav-button {
    font-size: 12px;
    padding: 8px 10px;
  }
}
