/* ==========================================================================
   headline.css — Headline Image Maker
   Re-toned to match the news-article (nt) design language.
   All rules scoped under .view-headline so the article view is unaffected.
   ========================================================================== */

.view-headline {
  display: flex;
  background: #0a1220;
  color: #f1f5f9;
  height: 100%;
  overflow: hidden;
}

/* -------- sidebar (editor panel) -------- */

.view-headline .headline-sidebar {
  width: 360px;
  flex-shrink: 0;
  padding: 28px 22px 22px;
  background: linear-gradient(180deg, #111a29 0%, #09111f 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100%;
  overflow-y: auto;
}

.view-headline .badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.8px;
  color: rgba(255, 255, 255, 0.92);
  flex-shrink: 0;
  align-self: flex-start;
}

.view-headline .headline-sidebar h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: -0.4px;
  flex-shrink: 0;
}

.view-headline .headline-sidebar .desc {
  margin: 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12.5px;
  line-height: 1.65;
  flex-shrink: 0;
}

.view-headline .section-title {
  margin: 8px 0 -2px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.8px;
  color: rgba(255, 255, 255, 0.52);
  flex-shrink: 0;
}

/* -------- size + options -------- */

.view-headline .size-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.94);
  flex-shrink: 0;
}

.view-headline .size-row span {
  font-weight: 700;
  flex-shrink: 0;
}

.view-headline .size-row select {
  flex: 1;
  background: var(--panel-soft);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: 0.15s ease;
  cursor: pointer;
}

.view-headline select:focus {
  border-color: rgba(138, 180, 255, 0.9);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 4px rgba(138, 180, 255, 0.12);
}

.view-headline select option {
  background: #0f1827;
  color: #fff;
}

.view-headline .canvas-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.78);
  flex-shrink: 0;
}

.view-headline .canvas-options label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}

.view-headline .canvas-options input[type='checkbox'],
.view-headline .hl-full input[type='checkbox'] {
  cursor: pointer;
  accent-color: var(--accent);
}

/* -------- canvas background mode (3-way segment) -------- */

.view-headline .bg-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.94);
  flex-shrink: 0;
}

.view-headline .bg-row-label {
  font-weight: 700;
  flex-shrink: 0;
}

.view-headline .bg-mode-options {
  display: flex;
  gap: 2px;
  flex: 1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 999px;
  padding: 3px;
}

.view-headline .bg-mode-options input[type="radio"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.view-headline .bg-mode-options label {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.65);
  cursor: pointer;
  user-select: none;
  transition: 0.15s ease;
  text-align: center;
}

.view-headline .bg-mode-options label:hover {
  color: #fff;
}

.view-headline .bg-mode-options input[type="radio"]:checked + label {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 12px rgba(123, 31, 31, 0.35);
}

.view-headline .bg-mode-options input[type="radio"]:focus-visible + label {
  outline: 2px solid rgba(138, 180, 255, 0.7);
  outline-offset: 2px;
}

/* -------- bg image upload + thumbnail -------- */

.view-headline .bg-image-area {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.view-headline .bg-image-area input[type="file"] {
  display: none;
}

.view-headline .bg-upload-btn {
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border: 1px dashed rgba(255, 255, 255, 0.20);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: 0.15s ease;
}

.view-headline .bg-upload-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(138, 180, 255, 0.7);
}

.view-headline .bg-thumb-wrap {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.25);
}

.view-headline .bg-thumb-img {
  display: block;
  width: 100%;
  height: 80px;
  object-fit: cover;
}

.view-headline .bg-thumb-clear {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  border: 0;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: 0.15s ease;
}

.view-headline .bg-thumb-clear:hover {
  background: rgba(196, 55, 55, 0.85);
}

/* -------- add-row -------- */

.view-headline .add-row {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.view-headline .add-row select {
  width: 140px;
  background: var(--panel-soft);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  border-radius: 12px;
  padding: 10px 10px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: 0.15s ease;
  cursor: pointer;
}

.view-headline .add-row button {
  flex: 1;
}

/* -------- buttons -------- */

.view-headline button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.2s ease;
  font-family: inherit;
}

.view-headline .btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 6px 18px rgba(123, 31, 31, 0.35);
}

.view-headline .btn-primary:hover {
  background: #921f1f;
  box-shadow: 0 8px 22px rgba(123, 31, 31, 0.45);
}

.view-headline .btn-export {
  width: 100%;
}

/* -------- card-list — sidebar itself handles scrolling, list sizes to
   its content so the whole sidebar scrolls as one on small viewports */

.view-headline .card-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.view-headline .list-item {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: 0.15s ease;
}

.view-headline .list-item.is-selected {
  border-color: rgba(138, 180, 255, 0.9);
  background: rgba(138, 180, 255, 0.08);
  box-shadow: 0 0 0 3px rgba(138, 180, 255, 0.10);
}

.view-headline .list-header {
  display: flex;
  gap: 6px;
  align-items: center;
}

.view-headline .list-preset {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 12px;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  transition: 0.15s ease;
}

.view-headline .list-preset:focus {
  border-color: rgba(138, 180, 255, 0.7);
  background: rgba(255, 255, 255, 0.08);
}

.view-headline .list-delete {
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 999px;
  background: rgba(196, 55, 55, 0.14);
  color: #ffd2d2;
  border: 1px solid rgba(196, 55, 55, 0.18);
  font-size: 16px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: 0.15s ease;
  flex-shrink: 0;
}

.view-headline .list-delete:hover {
  background: rgba(196, 55, 55, 0.28);
  color: #fff;
}

.view-headline .list-body {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.45;
  font-family: inherit;
  outline: none;
  resize: vertical;
  min-height: 60px;
  transition: 0.15s ease;
}

.view-headline .meta-fields {
  display: flex;
  gap: 6px;
}

.view-headline .list-item.type-plain .meta-fields {
  display: none;
}

.view-headline .list-author,
.view-headline .list-time {
  flex: 1;
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 12px;
  font-family: inherit;
  outline: none;
  transition: 0.15s ease;
}

.view-headline .list-body:focus,
.view-headline .list-author:focus,
.view-headline .list-time:focus {
  border-color: rgba(138, 180, 255, 0.7);
  background: rgba(255, 255, 255, 0.08);
}

/* -------- highlight swatches -------- */

.view-headline .hl-row {
  display: flex;
  gap: 5px;
  align-items: center;
  flex-wrap: wrap;
}

.view-headline .hl-swatch {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  cursor: pointer;
  background: transparent;
  flex-shrink: 0;
  transition: 0.15s ease;
}

.view-headline .hl-swatch:hover {
  transform: scale(1.08);
}

.view-headline .hl-swatch.is-active {
  border-color: rgba(138, 180, 255, 0.95);
  border-width: 2px;
  box-shadow: 0 0 0 2px rgba(138, 180, 255, 0.25);
}

.view-headline .hl-swatch.hl-off {
  background: rgba(255, 255, 255, 0.04);
  position: relative;
}

.view-headline .hl-swatch.hl-off::after {
  content: '×';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.55);
  font-size: 14px;
  line-height: 1;
}

.view-headline .hl-full {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.78);
  cursor: pointer;
  user-select: none;
}

/* -------- bottom bar -------- */

.view-headline .bottom-bar {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.view-headline .hint {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.55);
  margin: 0;
  line-height: 1.45;
}

/* -------- canvas area -------- */

.view-headline .canvas-wrap {
  flex: 1;
  min-width: 0;
  height: 100%;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.025), transparent 60%),
    linear-gradient(180deg, #0d1422 0%, #060b14 100%);
  overflow: auto;
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.view-headline .canvas-stage {
  position: relative;
  flex-shrink: 0;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  border-radius: 8px;
  background-color: #2c3850;
  background-image:
    linear-gradient(45deg, #1e2940 25%, transparent 25%),
    linear-gradient(-45deg, #1e2940 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #1e2940 75%),
    linear-gradient(-45deg, transparent 75%, #1e2940 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}

.view-headline #canvas {
  position: relative;
  background: linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%);
  border-radius: 6px;
  overflow: hidden;
}

.view-headline #canvas.no-background {
  background: transparent;
}

/* -------- card primitives (on canvas) -------- */

.view-headline .card {
  position: absolute;
  top: 0;
  left: 0;
  cursor: move;
  user-select: none;
  white-space: pre-wrap;
  word-break: keep-all;
  transform-origin: 50% 50%;
  min-height: 1em;
  touch-action: none;
}

.view-headline .card-body {
  white-space: pre-wrap;
  word-break: keep-all;
}

.view-headline .card-meta {
  margin-top: 8px;
  font-size: 12px;
  color: #6b7280;
  white-space: pre-wrap;
}

.view-headline .card.preset-headline {
  background: #ffffff;
  padding: 18px 22px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.10);
}
.view-headline .card.preset-headline .card-body {
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: 700;
  font-size: 24px;
  line-height: 1.3;
  color: #111;
}
.view-headline .card.preset-headline .card-meta {
  font-family: -apple-system, 'Segoe UI', sans-serif;
  font-size: 12px;
  color: #4b5563;
  margin-top: 10px;
}

.view-headline .card.preset-comment {
  background: #ffffff;
  padding: 14px 18px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.10);
}
.view-headline .card.preset-comment .card-body {
  font-family: -apple-system, 'Segoe UI', 'Pretendard',
    'Apple SD Gothic Neo', sans-serif;
  font-size: 16px;
  line-height: 1.45;
  color: #1f2937;
}
.view-headline .card.preset-comment .card-meta {
  font-size: 12px;
  color: #6b7280;
  margin-top: 6px;
}

.view-headline .card.preset-handwriting {
  background: #fffbeb;
  padding: 16px 20px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.10);
}
.view-headline .card.preset-handwriting .card-body {
  font-family: 'Comic Sans MS', 'Nanum Pen Script', cursive;
  font-size: 20px;
  line-height: 1.4;
  color: #3f3f46;
}

.view-headline .card.preset-plain {
  background: #ffffff;
  padding: 12px 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.10);
}
.view-headline .card.preset-plain .card-body {
  font-family: -apple-system, 'Segoe UI', 'Pretendard',
    'Apple SD Gothic Neo', sans-serif;
  font-size: 16px;
  color: #1f2937;
}

.view-headline #canvas.no-card-shadow .card {
  box-shadow: none;
}

.view-headline .card-body .hl-text.has-highlight {
  background-image: linear-gradient(
    180deg,
    transparent 55%,
    var(--hl) 55%,
    var(--hl) 92%,
    transparent 92%
  );
  padding: 0 0.15em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.view-headline .card-body .hl-text.has-highlight.is-full {
  background-image: none;
  background-color: var(--hl);
}

/* -------- responsive -------- */

@media (max-width: 768px) {
  .view-headline {
    flex-direction: column;
  }
  .view-headline .headline-sidebar {
    order: 2;
    width: 100%;
    height: 45%;
    flex-shrink: 0;
    border-right: none;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 16px;
    gap: 10px;
  }
  .view-headline .headline-sidebar h1,
  .view-headline .headline-sidebar .desc {
    display: none;
  }
  .view-headline .canvas-wrap {
    order: 1;
    flex: 1;
    height: 55%;
    padding: 12px;
  }
  .view-headline .add-row select {
    width: 120px;
  }
}

@media (max-width: 768px) and (orientation: landscape) {
  .view-headline {
    flex-direction: row;
  }
  .view-headline .headline-sidebar {
    order: 0;
    width: 280px;
    height: 100%;
    border-top: none;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
  }
  .view-headline .canvas-wrap {
    height: 100%;
  }
}
