/*
 * MOTIKA.IO — Add/Edit Spark
 * Complete page implementation copied from the supplied Text Post design.
 * This file is intentionally self-contained: the page does not depend on
 * style.css or on another document defining the mk-* classes.
 */

:root {
  --mk-green: #99cc00;
  --mk-green-dark: #506b00;
  --mk-green-deep: #40a629;
  --mk-cyan: #01a0c6;
  --mk-gradient-brand: linear-gradient(122deg, #99cc00, #40a629, #01a0c6, #01a0c6);
  --mk-text: #242424;
  --mk-text-input: #464957;
  --mk-text-muted: #8a8f99;
  --mk-bg: #ffffff;
  --mk-bg-soft: #f5f5f5;
  --mk-border: #dddddd;
  --mk-border-strong: #cccccc;
  --mk-red: #ff4444;
  --mk-red-dark: #8b0000;
  --mk-radius-pill: 30px;
  --mk-radius-lg: 16px;
  --mk-radius-md: 10px;
  --mk-radius-sm: 8px;
  --mk-shadow-input: inset 0 5px 10px rgba(0, 0, 0, .25);
  --mk-font: 'Montserrat', "Helvetica Neue", Helvetica, Arial, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
  font-family: var(--mk-font);
  margin: 0;
}

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

body {
  background: #e9e9e9;
  color: var(--mk-text);
  line-height: 1.5;
  padding-bottom: 80px;
}

a {
  color: var(--mk-green-dark);
  text-decoration: none;
}

img {
  max-width: 100%;
}

button,
textarea {
  font: inherit;
}

.mk-spark-page {
  min-height: 100vh;
  background: #e9e9e9;
}

/* Exact mk-header from the supplied design. */
.mk-header {
  position: relative;
  background: #fff;
  border-bottom: 1px solid var(--mk-border);
  padding: 18px 16px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mk-header img {
  height: 30px;
  display: block;
}

.mk-header h3 {
  text-transform: uppercase;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .5px;
}

.mk-header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: var(--mk-gradient-brand);
}

/* Exact page spacing from the Create Spark example. */
.mk-spark-page__body {
  padding: 28px 16px 40px;
}

/* Exact mk-card and Spark wrapper from the supplied design. */
.mk-card {
  background: #fff;
  border-radius: var(--mk-radius-lg);
  padding: 22px;
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
}

.mk-card__eyebrow {
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--mk-text-muted);
  font-weight: 600;
  margin-bottom: 6px;
  text-align: center;
}

.mk-card__title {
  font-size: 20px;
  font-weight: 700;
  color: var(--mk-text);
  margin-bottom: 20px;
  text-align: center;
}

.mk-card__muted {
  color: var(--mk-text-muted);
  font-size: 13px;
  margin: 6px 0 0;
  text-align: center;
}

.mk-spark-form {
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}

.mk-spark-tagline {
  margin: -14px 0 20px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.mk-form-head {
  margin-bottom: 20px;
}

.mk-field-group {
  margin-bottom: 12px;
}

.mk-field-line {
  margin-bottom: 6px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

/* Exact mk-field from the supplied design. */
.mk-field {
  width: 100%;
  min-height: 100px;
  outline: 0;
  border: none;
  border-radius: var(--mk-radius-sm);
  background: var(--mk-bg-soft);
  box-shadow: var(--mk-shadow-input);
  font-size: 16px;
  color: var(--mk-text-input);
  padding: 16px 20px;
  display: block;
}

.mk-field,
.mk-field::placeholder {
  font-family: var(--mk-font);
}

.mk-field::placeholder {
  color: #9aa0ab;
}

textarea.mk-field {
  min-height: 100px;
  resize: vertical;
}

.mk-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--mk-text-muted);
}

/* Exact optional-story details treatment from the supplied design. */
.mk-details {
  background: #fff;
  border-radius: var(--mk-radius-lg);
  margin: 6px auto 0;
  text-align: center;
}

.mk-details summary {
  cursor: pointer;
  list-style: none;
  padding: 16px 0;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--mk-text-muted);
}

.mk-details summary::-webkit-details-marker {
  display: none;
}

.mk-details summary::after {
  content: ' +';
  color: var(--mk-green-dark);
}

.mk-details[open] summary::after {
  content: ' \2212';
}

.mk-details__body {
  padding: 0 0 8px;
  text-align: left;
}

.mk-details--btn summary {
  display: inline-block;
  list-style: none;
  cursor: pointer;
  background: #fff;
  color: var(--mk-green-dark);
  border: 2px solid var(--mk-green);
  border-radius: var(--mk-radius-pill);
  font-family: var(--mk-font);
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: normal;
  padding: 0 18px;
  height: 36px;
  line-height: 32px;
  text-align: center;
}

.mk-details--btn summary::-webkit-details-marker {
  display: none;
}

.mk-details--btn summary::after {
  content: none;
}

.mk-details--btn summary:hover {
  background: var(--mk-green);
  color: #fff;
}

.mk-details--btn[open] summary {
  display: none;
}

.mk-details--btn .mk-field--lg {
  min-height: 180px;
}

.mk-actions {
  margin-top: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

/* Exact primary CTA from the supplied design. */
.mk-btn {
  font-family: var(--mk-font);
  font-weight: 500;
  font-size: 16pt;
  text-transform: uppercase;
  color: #fff;
  background: var(--mk-green);
  border: none;
  cursor: pointer;
  padding: 0 32px;
  border-radius: var(--mk-radius-pill);
  line-height: 48px;
  display: inline-block;
  text-align: center;
  text-decoration: none;
  transition: background .2s ease, color .2s ease;
}

.mk-btn:hover {
  background: var(--mk-green-dark);
}

.mk-link-btn {
  min-height: 48px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--mk-text-muted);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
}

.mk-link-btn:hover {
  color: var(--mk-green-dark);
}

.mk-btn:focus-visible,
.mk-link-btn:focus-visible,
.mk-details--btn summary:focus-visible,
.mk-field:focus-visible {
  outline: 2px solid var(--mk-green-dark);
  outline-offset: 2px;
}

@media (min-width: 520px) {
  .mk-btn {
    min-width: 260px;
  }
}

/* Exact design-system feedback colors; hidden in the normal reference state. */
.mk-alert {
  border-radius: var(--mk-radius-sm);
  padding: 10px 14px;
  font-size: 14px;
  margin: 10px 0;
}

.mk-alert ul {
  margin: 0;
  padding-left: 18px;
}

.mk-alert--error {
  border: 1px solid var(--mk-red);
  background: rgba(255, 68, 68, .10);
  color: var(--mk-red);
}

.mk-alert--success {
  border: 1px solid var(--mk-green);
  background: rgba(153, 204, 0, .12);
  color: var(--mk-green-dark);
}

.mk-form-feedback {
  margin-bottom: 10px;
}

/* Live title counter: normal state matches the exact muted reference example. */
.mk-title-counter {
  flex: none;
  text-align: right;
}

.mk-title-counter.is-near-limit {
  color: var(--mk-red);
  font-weight: 700;
}

.mk-title-counter.is-at-limit {
  color: var(--mk-red-dark);
  font-weight: 700;
}

.mk-visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@media (max-width: 520px) {
  .mk-actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .mk-btn,
  .mk-link-btn {
    width: 100%;
  }
}
