@import url("https://fonts.googleapis.com/css2?family=Source+Serif+4:ital,opsz,wght@0,8..60,400;0,8..60,600;0,8..60,700;1,8..60,400;1,8..60,600&display=swap");

.composer-shell {
  max-width: 44rem;
  margin: 0 auto;
}

.composer-head {
  margin-bottom: var(--space-5);
}

.composer-page-title {
  margin-bottom: 0.35rem;
  font-size: clamp(1.7rem, 4vw, 2.15rem);
}

.composer-intro {
  margin-bottom: 0;
}

.composer-card {
  margin-bottom: var(--space-5);
  padding: var(--space-4) var(--space-4) var(--space-5);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.composer-card-label {
  margin-bottom: var(--space-4);
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.composer-draft {
  padding-top: var(--space-5);
}

.composer-meta {
  display: grid;
  gap: 0.35rem;
  margin-bottom: var(--space-4);
}

.composer-hint {
  max-width: 40rem;
  line-height: 1.45;
}

.composer-byline {
  display: grid;
  gap: var(--space-4);
  margin-bottom: 0;
}

@media (min-width: 700px) {
  .composer-byline {
    grid-template-columns: 1fr 1fr;
  }
}

.story,
.composer-story {
  font-family: "Source Serif 4", Georgia, "Times New Roman", serif;
  font-size: 1.2rem;
  line-height: 1.7;
}

.story {
  max-width: 42rem;
  margin: 0 auto;
}

.story-kicker,
.composer-kicker {
  margin: 0 0 0.8rem;
  color: var(--accent);
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.composer-kicker,
.composer-title,
.composer-subtitle,
.composer-dek {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  resize: none;
}

.composer-kicker:focus,
.composer-title:focus,
.composer-subtitle:focus,
.composer-dek:focus,
.story-text:focus,
.story-li:focus,
.story-code:focus,
.story-caption:focus,
.story-alt:focus,
.story-cite:focus {
  outline: none;
}

.story-title,
.composer-title {
  margin: 0;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: clamp(2.1rem, 5vw, 3.15rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.12;
}

.composer-title {
  min-height: 1.2em;
  margin-bottom: 0.35rem;
  overflow: hidden;
}

.story-subtitle,
.composer-subtitle {
  margin: 0.2rem 0 0.35rem;
  color: var(--text-muted);
  font-size: clamp(1.25rem, 2.5vw, 1.55rem);
  font-weight: 400;
  line-height: 1.35;
}

.story-dek,
.composer-dek {
  margin: 0 0 1.25rem;
  color: var(--text-muted);
  font-size: 1.05rem;
  font-style: italic;
  line-height: 1.5;
}

.story-meta {
  margin: 0 0 1.75rem;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.92rem;
}

.story-body p,
.story-text {
  margin: 0 0 1.15em;
}

.story-body h2,
.story-block[data-type="h2"] .story-text {
  margin: 1.8em 0 0.45em;
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.story-body h3,
.story-block[data-type="h3"] .story-text {
  margin: 1.45em 0 0.35em;
  font-size: 1.28rem;
  font-weight: 700;
  line-height: 1.3;
}

.story-body a {
  color: var(--accent-hover);
  text-decoration: underline;
  text-underline-offset: 0.16em;
}

.story-body ul,
.story-body ol,
.story-list {
  margin: 0 0 1.2em;
  padding-left: 1.35rem;
}

.story-body ul,
.story-list[data-list="ul"] {
  list-style: disc;
}

.story-body ol,
.story-list[data-list="ol"] {
  list-style: decimal;
}

.story-body li,
.story-li {
  margin: 0.28em 0;
}

.story-li {
  display: list-item;
}

.story-body blockquote,
.story-quote {
  margin: 1.4em 0;
  padding-left: 1rem;
  border-left: 3px solid var(--accent);
  color: var(--text);
  font-size: 1.28rem;
  font-style: italic;
  line-height: 1.45;
}

.story-body blockquote p,
.story-quote .story-text {
  margin: 0;
}

.story-body cite,
.story-cite {
  display: block;
  margin-top: 0.45rem;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-style: normal;
}

.story-body hr,
.story-divider {
  width: 5rem;
  height: 1px;
  margin: 2rem auto;
  border: 0;
  background: var(--border-strong);
}

.story-figure {
  margin: 1.6rem 0 1.3rem;
}

.story-figure img,
.story-card img {
  width: 100%;
  height: auto;
  border-radius: 0.35rem;
}

.story-figure.is-wide {
  width: 100%;
  max-width: 100%;
  margin-left: 0;
  transform: none;
}

@media (min-width: 960px) {
  .story-figure.is-wide {
    width: min(68rem, calc(100vw - 2rem));
    max-width: none;
    margin-left: 50%;
    transform: translateX(-50%);
  }
}

.story-figure figcaption,
.story-caption {
  margin-top: 0.55rem;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-style: italic;
  text-align: center;
}

.story-video {
  margin: 1.6rem 0;
}

.story-video iframe,
.story-video-frame {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 0.35rem;
  background: #111;
}

.story-card {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 0.9rem;
  margin: 1.4rem 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  font-family: var(--font-body);
  text-decoration: none;
}

.story-card:hover {
  border-color: var(--border-strong);
}

.story-card img {
  height: 100%;
  min-height: 6.5rem;
  object-fit: cover;
  border-radius: 0;
}

.story-card-copy {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.85rem 0.95rem 0.85rem 0;
  min-width: 0;
}

.story-card:not(:has(img)) {
  grid-template-columns: 1fr;
}

.story-card:not(:has(img)) .story-card-copy {
  padding-left: 0.95rem;
}

.story-card-site {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.story-card strong {
  font-size: 1rem;
  line-height: 1.35;
}

.story-card-text {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.story-code,
.story-body .story-code {
  margin: 1.2rem 0;
  padding: 0.9rem 1rem;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

.story-table-wrap {
  margin: 1.3rem 0 1.5rem;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
}

.story-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-body);
  font-size: 0.95rem;
  line-height: 1.45;
}

.story-table th,
.story-table td {
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.story-table th {
  background: var(--accent-soft);
  font-weight: 700;
}

.story-body .size-sm,
.story-text .size-sm {
  font-size: 0.86em;
}

.story-body .size-lg,
.story-text .size-lg {
  font-size: 1.2em;
}

.story-body .size-xl,
.story-text .size-xl {
  font-size: 1.4em;
}

.story-block {
  display: grid;
  grid-template-columns: 2.4rem minmax(0, 1fr);
  gap: 0.15rem;
  align-items: start;
  min-width: 0;
  max-width: 100%;
}

.story-content {
  min-width: 0;
  max-width: 100%;
}

.story-gutter {
  position: sticky;
  top: 5rem;
  display: flex;
  justify-content: center;
  padding-top: 0.35rem;
}

.story-plus,
.story-remove,
.story-wide,
.story-add-row {
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1;
}

.story-plus {
  width: 1.85rem;
  height: 1.85rem;
  opacity: 0;
}

.story-block:hover .story-plus,
.story-block:focus-within .story-plus,
.story-plus[aria-expanded="true"] {
  opacity: 1;
}

@media (hover: none) {
  .story-plus {
    opacity: 1;
  }
}

.story-plus:hover,
.story-remove:hover,
.story-wide:hover,
.story-add-row:hover {
  color: var(--text);
  border-color: var(--accent);
}

.story-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.35rem 0 0.8rem;
  font-family: var(--font-body);
}

.story-remove,
.story-wide,
.story-add-row {
  padding: 0.25rem 0.6rem;
  font-size: 0.78rem;
}

.story-alt,
.story-caption,
.story-cite {
  width: 100%;
  border: 0;
  background: transparent;
  font-family: var(--font-body);
}

.story-alt {
  margin-top: 0.35rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.story-text[data-placeholder]:empty::before,
.story-li[data-placeholder]:empty::before,
.composer-title:placeholder-shown,
.composer-kicker::placeholder,
.composer-subtitle::placeholder,
.composer-dek::placeholder {
  color: var(--text-placeholder);
}

.story-text[data-placeholder]:empty::before,
.story-li[data-placeholder]:empty::before {
  content: attr(data-placeholder);
  pointer-events: none;
}

.composer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-2);
}

.composer-actions .btn.is-busy {
  cursor: progress;
}

.composer-busy {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: max(1.25rem, env(safe-area-inset-top, 0px)) max(1rem, env(safe-area-inset-right, 0px)) max(1.25rem, env(safe-area-inset-bottom, 0px)) max(1rem, env(safe-area-inset-left, 0px));
  background: rgba(11, 13, 16, 0.42);
}

.composer-busy[hidden] {
  display: none;
}

.composer-busy-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: min(100%, 22rem);
  padding: 1rem 1.15rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.18);
}

.composer-busy-card p {
  font-weight: 600;
  line-height: 1.35;
}

.composer-spinner {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  border: 3px solid var(--accent-soft);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: composer-spin 0.7s linear infinite;
}

.composer-actions .btn .composer-spinner {
  width: 1rem;
  height: 1rem;
  border-width: 2px;
  border-color: transparent;
  border-top-color: currentColor;
  border-right-color: currentColor;
}

@keyframes composer-spin {
  to {
    transform: rotate(360deg);
  }
}

.composer-count {
  margin-top: var(--space-4);
}

#composer-status.is-error {
  color: var(--danger);
}

.story-menu,
.story-toolbar,
.story-popover {
  position: fixed;
  z-index: 30;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.14);
  font-family: var(--font-body);
}

.story-menu[hidden],
.story-toolbar[hidden],
.story-popover[hidden] {
  display: none;
}

.story-menu {
  width: min(22rem, calc(100vw - 1.5rem));
  width: min(22rem, calc(100dvw - 1.5rem));
  max-height: min(24rem, 70vh);
  max-height: min(24rem, 70dvh);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 0.4rem;
}

.story-menu button {
  display: flex;
  width: 100%;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.05rem;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius-sm);
  text-align: left;
}

.story-menu button:hover,
.story-menu button.is-active {
  background: var(--accent-soft);
}

.story-menu small {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.story-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem;
  max-width: calc(100vw - 1rem);
  max-width: calc(100dvw - 1rem);
  padding: 0.25rem;
}

.story-toolbar button {
  min-width: 2rem;
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

.story-toolbar button:hover,
.story-toolbar button[aria-pressed="true"] {
  background: var(--accent-soft);
}

.story-popover {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  width: min(24rem, calc(100vw - 1.5rem));
  padding: 0.45rem;
}

.story-popover label {
  width: 100%;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.story-popover input {
  flex: 1;
  min-width: 0;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
}

.story-popover button {
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius-sm);
  background: var(--btn-primary-bg);
  color: var(--btn-primary-text);
  font-weight: 700;
}

.article-card .excerpt {
  margin-top: 0.35rem;
  color: var(--text-muted);
}

.story-preview {
  max-height: 70vh;
  max-height: 70dvh;
  margin-top: var(--space-4);
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 767px) {
  .composer-shell {
    padding-bottom: 0.5rem;
  }

  .composer-card {
    margin-inline: -0.15rem;
    padding: var(--space-4) 0.9rem var(--space-5);
  }

  .composer-draft {
    padding-top: 1.1rem;
  }

  .composer-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.6rem;
    margin-top: var(--space-4);
  }

  .composer-actions .btn {
    width: 100%;
    min-height: 2.9rem;
  }

  .composer-title {
    font-size: clamp(1.65rem, 8vw, 2.35rem);
  }

  .composer-count,
  .composer-hint {
    overflow-wrap: anywhere;
  }

  .story-block {
    grid-template-columns: 2.25rem minmax(0, 1fr);
    gap: 0.1rem;
  }

  .story-plus {
    width: 2.25rem;
    height: 2.25rem;
  }

  .story-toolbar button {
    min-width: 2.4rem;
    min-height: 2.4rem;
  }

  .story-menu button {
    min-height: 2.75rem;
  }

  .story-preview {
    max-height: none;
    overflow: visible;
  }

  .story-card {
    grid-template-columns: 1fr;
  }

  .story-card img {
    width: 100%;
    height: 11rem;
    min-height: 0;
  }

  .story-card-copy {
    padding: 0.85rem 0.95rem 0.95rem;
  }

  .composer-kicker,
  .story-alt,
  .story-caption,
  .story-cite,
  .story-code,
  .story-body .story-code,
  .story-popover input {
    font-size: 1rem;
  }

  .story-popover {
    left: max(0.75rem, env(safe-area-inset-left, 0px)) !important;
    right: max(0.75rem, env(safe-area-inset-right, 0px));
    width: auto;
  }
}

.story-editor-table td,
.story-editor-table th {
  min-width: 7rem;
}

.story-editor-table [contenteditable] {
  min-height: 1.4em;
}

@media (max-width: 420px) {
  .composer-card {
    border-radius: var(--radius-md);
  }

  .story-tools {
    gap: 0.35rem;
  }

  .story-remove,
  .story-wide,
  .story-add-row {
    min-height: 2.25rem;
  }
}

@media (max-width: 1099px) {
  body:has(.composer-form) .whatsapp-fab {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .composer-spinner {
    animation: none;
  }
}
