/* WooCommerce Product Personalized Text - legacy group layout, refined.
   Everything is scoped under .lctf-root so themes stay untouched.

   Order (owner-approved demo, 2026-11-15):
     bare opt-in checkbox -> document-icon help link -> Line N cards
     -> Add line -> ONE shared Layout Preview -> Layout Special Instruction
     -> Add to cart.  No colour picker, no millimetre values, no save step. */

.lctf-root [hidden] { display: none !important; }
.lctf-root, .lctf-root * { box-sizing: border-box; }
.lctf-root {
  --lctf-ink: #2B2A26;
  --lctf-muted: #8B857B;
  --lctf-line: #E7E1D6;
  --lctf-soft: #F7F4EE;
  --lctf-paper: #FFFFFF;
  --lctf-field: #FDFCFA;
  --lctf-green: #2F4A3C;
  --lctf-green-soft: #EAF0EA;
  --lctf-brass: #B4843C;
  --lctf-wood-a: #EAD0A6;
  --lctf-wood-b: #D9B582;
  --lctf-wood-c: #C79A66;
  clear: both;
  margin: 0 0 1.4em;
  padding: 0; border: 0; background: none; box-shadow: none;
  color: var(--lctf-ink);
  font: 14px/1.5 -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
/* The opt-in row is a bare legacy checkbox, NEVER a framed card. */
.lctf-root:not(.lctf-opted-in) { margin-bottom: 1em; }
body.lctf-scroll-locked { overflow: hidden; }
.lctf-sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---------------------------- opt-in + help link ---------------------------- */
.lctf-card-head { margin-bottom: 10px; }
.lctf-toggle {
  display: inline-flex; align-items: center; gap: 9px; margin: 0;
  font-size: 20px; font-weight: 700; color: #22221F; cursor: pointer; user-select: none;
}
.lctf-toggle input[type="checkbox"] { width: 16px; height: 16px; margin: 0; accent-color: var(--lctf-green); flex: 0 0 16px; }
.lctf-help-link {
  display: inline-flex; align-items: center; gap: 6px; margin: 0 0 16px 1px;
  font-size: 12px; color: #6E6A62; text-decoration: underline;
  text-underline-offset: 3px; cursor: pointer;
}
.lctf-help-link svg { width: 13px; height: 13px; flex: 0 0 13px; color: var(--lctf-brass); }
.lctf-section-label {
  display: block; margin: 0 0 8px; font-size: 11px; font-weight: 700;
  letter-spacing: .11em; text-transform: uppercase; color: #777168;
}

/* ---------------------------- Line N cards ---------------------------- */
.lctf-groups { display: grid; gap: 12px; }
.lctf-group {
  position: relative; z-index: 1; overflow: visible;
  background: var(--lctf-paper); border: 1px solid var(--lctf-line);
  border-radius: 10px; box-shadow: 0 2px 10px rgba(60, 45, 25, .035);
}
.lctf-group.lctf-font-open { z-index: 100; }
.lctf-group-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  flex-wrap: nowrap;
  padding: 11px 16px; background: var(--lctf-soft);
  border-bottom: 1px solid var(--lctf-line); border-radius: 9px 9px 0 0;
}
/* Themes such as Twenty Twenty-Five inherit word-break:break-word /
   overflow-wrap:break-word onto every descendant. Firefox then shaves about
   1px off each header flex child and happily breaks "Line 1" and "(+¥10.00)"
   into two lines, inflating the header from 44px to ~63px. Pin the whole
   header to one non-shrinking, non-wrapping row (tested in Firefox 160). */
.lctf-line-title {
  display: flex; align-items: baseline; gap: 6px;
  flex: 0 0 auto; white-space: nowrap; word-break: normal; overflow-wrap: normal;
}
.lctf-line-title > * {
  flex: 0 0 auto; white-space: nowrap; word-break: normal; overflow-wrap: normal;
}
.lctf-group-title { margin: 0; font-size: 14px; font-weight: 700; color: #34322C; }
.lctf-required { color: var(--lctf-brass); font-weight: 700; }
.lctf-price { font-weight: 400; font-size: 13px; color: var(--lctf-muted); }
.lctf-line-head-actions {
  display: flex; align-items: center; gap: 12px;
  flex: 0 0 auto; white-space: nowrap; word-break: normal; overflow-wrap: normal;
}
.lctf-line-head-actions > * { white-space: nowrap; word-break: normal; overflow-wrap: normal; }
.lctf-expand, .lctf-remove {
  border: 0; background: none; padding: 2px 0; font-size: 11px;
  color: #777168; cursor: pointer; letter-spacing: .02em;
}
.lctf-expand::before { content: "\25B2"; font-size: 9px; margin-right: 4px; color: #9C958A; }
.lctf-expand[aria-expanded="false"]::before { content: "\25BC"; }
.lctf-expand:hover { color: var(--lctf-green); }
.lctf-remove { color: #B08A7A; }
.lctf-remove:hover { color: #8D2119; }
.lctf-group-body { padding: 16px; }

/* input + 0/N counter (16px so iOS never zooms on focus) */
.lctf-input-row, .lctf-input-wrap { position: relative; }
.lctf-text {
  width: 100%; height: 42px; padding: 0 66px 0 14px;
  border: 1px solid #DCD5C9; border-radius: 7px; background: var(--lctf-field);
  font-size: 16px; outline: none;
}
.lctf-text:focus { border-color: var(--lctf-green); box-shadow: 0 0 0 2px rgba(47, 74, 60, .10); }
.lctf-text::placeholder { color: #A8A198; }
.lctf-char-count {
  position: absolute; right: 11px; top: 50%; transform: translateY(-50%);
  font-size: 10px; color: #918A7E; background: #F2EFE9;
  border-radius: 4px; padding: 2px 6px; letter-spacing: .03em; pointer-events: none;
}

/* six inline shortcuts + "more..." (one bar PER LINE) */
.lctf-symbol-bar { margin-top: 10px; }
.lctf-quick-chars { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.lctf-quick-char, .lctf-special-open {
  border: 1px solid var(--lctf-line); border-radius: 6px; background: #FCFAF6;
  color: #4A443B; cursor: pointer;
}
.lctf-quick-char {
  width: 31px; height: 31px; padding: 0;
  font: 16px/1 "DejaVu", Arial, sans-serif;
  display: flex; align-items: center; justify-content: center;
}
.lctf-special-open { height: 31px; padding: 0 11px; font-size: 11px; color: var(--lctf-muted); }
.lctf-quick-char:hover, .lctf-special-open:hover { border-color: var(--lctf-green); background: var(--lctf-green-soft); }

/* non-blocking missing-glyph hint (amber) / blocking hint (red) */
.lctf-glyph-warning {
  margin: 10px 0 0; padding: 5px 8px; border-radius: 5px;
  border: 1px solid #E2C185; background: #FFF7E6; color: #7A5300; font-size: 11px;
}
.lctf-glyph-warning[data-kind="error"] { border-color: #E4B3AE; background: #FDECEA; color: #8D2119; }

/* Plain helper text: the admin's "Field label" verbatim. No heading, no input. */
.lctf-line-note {
  margin-top: 14px; padding: 9px 12px; background: #F8F5EF;
  border: 1px solid #EFE9DE; border-radius: 7px;
  font-size: 12px; line-height: 1.55; color: #5C564C;
}

/* ---------------------------- Choose Font (per line) ---------------------------- */
.lctf-font-field { margin-top: 16px; position: relative; }
.lctf-font-label { display: block; font-size: 14px; font-weight: 700; color: #34322C; margin: 0 0 8px; }
.lctf-font { position: relative; display: block; width: 100%; }
.lctf-font-trigger.font-current {
  width: 100%; height: 42px; padding: 0 14px;
  display: flex; align-items: center; justify-content: space-between;
  border: 1px solid #DCD5C9; border-radius: 7px; background: var(--lctf-field);
  cursor: pointer; text-align: left;
}
.lctf-font-trigger.font-current:hover { border-color: #BEB4A2; }
.lctf-font-trigger.font-current[aria-expanded="true"] { border-color: var(--lctf-green); }
.font-current .name {
  font-size: 18px; line-height: 1; color: #3A352E;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lctf-font-trigger .chev { font-size: 12px; color: #8B857B; flex: 0 0 auto; margin-left: 8px; }
.lctf-font-list {
  position: absolute; z-index: 60; top: calc(100% + 6px); left: 0; right: 0;
  max-height: 240px; overflow-y: auto; padding: 5px;
  border: 1px solid #DCD5C9; border-radius: 8px;
  background: var(--lctf-paper); box-shadow: 0 14px 32px rgba(50, 40, 25, .16);
}
/* Flip above the trigger when there is not enough room below. */
.lctf-font-list[data-placement="top"] { top: auto; bottom: calc(100% + 3px); }
.lctf-font-option {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; padding: 8px 11px; border: 0; border-radius: 5px;
  background: none; text-align: left; cursor: pointer;
  font-size: 20px; color: #3A352E; white-space: nowrap; overflow: hidden;
}
.lctf-font-option[aria-selected="true"] { background: var(--lctf-green-soft); color: var(--lctf-green); }
.lctf-font-option[aria-selected="true"]::after { content: "\2713"; font: 12px Arial, sans-serif; }
.lctf-font-option:hover, .lctf-font-option:focus { background: var(--lctf-soft); outline: none; }
.lctf-font-empty { padding: 10px; color: var(--lctf-muted); font-size: 12px; line-height: 1.4; }

/* ---------------------------- Add line ---------------------------- */
.lctf-add-line {
  width: 100%; margin-top: 12px; padding: 8px 16px;
  border: 1px dashed #CFC6B6; border-radius: 10px; background: #FBF9F4;
  color: var(--lctf-green); cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 9px; flex-wrap: wrap;
}
.lctf-add-line:hover { background: var(--lctf-green-soft); border-color: var(--lctf-green); }
.lctf-add-line:disabled { opacity: .55; cursor: default; background: #F6F4EF; }
.lctf-add-line-plus { font-size: 17px; font-weight: 700; line-height: 1; }
.lctf-add-line-text { font-size: 13px; font-weight: 700; letter-spacing: .01em; }
.lctf-add-line-sub { font-size: 11px; color: var(--lctf-muted); font-weight: 400; }

/* ---------------------------- ONE shared Layout Preview ---------------------------- */
.lctf-preview-block { margin-top: 20px; }
.lctf-preview-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
.lctf-preview-heading { margin: 0; font: 700 14px -apple-system, "Segoe UI", Arial, sans-serif; color: #34322C; }
.lctf-preview-hint {
  margin: 0; color: var(--lctf-muted); font-size: 9px; font-weight: 400;
  letter-spacing: .01em; text-align: right; line-height: 1.35; border: 1px solid var(--lctf-line);
  padding: 3px 7px;
}
/* The preview is a permanent REGION (<section>), never a .lctf-dialog:
 * no backdrop, no scroll lock, no close button and no popup opener.
 * The canvas itself uses multiply so the engraving sinks into the wood. */
.lctf-preview-block { display: block; }
.lctf-preview-block .lctf-status { margin: 6px 0 0; }

.lctf-preview-stage {
  position: relative; padding: 8px 0; border-radius: 8px;
  background: #F3F0EA; border: 1px solid #E9E3D8;
  display: flex; align-items: center; justify-content: center;
}
/* Owner-specified wood plaque geometry: 96% wide, 86% high. With an
 * auto-height stage the percentage height degrades to the canvas height,
 * so the bitmap keeps its aspect ratio and never stretches. */
.lp-plaque {
  width: 96%; height: 86%;
  display: flex; align-items: center; justify-content: center;
  position: relative; border-radius: 8px;
  background:
    repeating-linear-gradient(93deg, rgba(120, 80, 40, .055) 0 2px, transparent 2px 11px),
    repeating-linear-gradient(88deg, rgba(255, 255, 255, .06) 0 1px, transparent 1px 17px),
    linear-gradient(135deg, var(--lctf-wood-a), var(--lctf-wood-b) 55%, var(--lctf-wood-c));
  box-shadow: inset 0 0 0 1px rgba(120, 80, 40, .28), inset 0 10px 22px rgba(255, 255, 255, .38),
              0 6px 16px rgba(74, 50, 26, .12);
}
.lctf-canvas-wrap {
  position: relative; width: 100%; max-width: var(--lctf-canvas-w, 800px); margin: 0;
  padding: 0; border-radius: 0; background: none; box-shadow: none;
}
.lctf-canvas {
  display: block; width: 100%; height: auto; border: 0; background: transparent;
  mix-blend-mode: multiply; touch-action: none;
}
/* The outline and its ONE corner handle belong to the selected text line. */
.lctf-selection-box {
  position: absolute; pointer-events: none; border: 1px dashed var(--lctf-green);
  border-radius: 2px; background: rgba(47, 74, 60, .07);
}
.lctf-resize-handle {
  position: absolute; width: 14px; height: 14px; z-index: 4;
  border: 2px solid #fff; border-radius: 2px;
  background: var(--lctf-green); cursor: ew-resize; touch-action: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .3);
}
.lctf-size-bubble {
  position: absolute; z-index: 5; padding: 4px 7px; border-radius: 4px;
  background: rgba(43, 42, 38, .88); color: #fff; font-size: 11px; white-space: nowrap;
}
.lctf-preview-empty { margin: 0; padding: 8px 0; text-align: center; color: var(--lctf-muted); font-size: 11px; }

/* Relative size slider - no mm numbers, no colour picker. */
.lctf-size-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.lctf-size-label { font-size: 11px; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; color: #777168; white-space: nowrap; }
.lctf-size-a { font: 12px Georgia, serif; color: #9C958A; }
.lctf-size-a-lg { font-size: 20px; }
.lctf-size-range { flex: 1; min-width: 0; height: 4px; accent-color: var(--lctf-green); cursor: pointer; }
.lctf-size-relative { font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: #9C958A; }
.lctf-preview-note { margin: 9px 0 0; color: var(--lctf-muted); font-size: 11px; line-height: 1.5; }

/* ---------------------------- remarks (LAST block) ---------------------------- */
.lctf-remarks { margin-top: 16px; }
.lctf-remarks-label { display: block; font-size: 12px; font-weight: 700; color: #4B463E; margin: 0 0 7px; }
.lctf-remarks-label span { font-weight: 400; color: var(--lctf-muted); }
.lctf-remarks-body .lctf-input-wrap { position: relative; }
.lctf-remarks-body input {
  width: 100%; height: 40px; padding: 0 66px 0 14px;
  border: 1px solid #DCD5C9; border-radius: 7px; background: var(--lctf-field);
  font-size: 16px; outline: none;
}
.lctf-remarks-body input:focus { border-color: var(--lctf-green); box-shadow: 0 0 0 2px rgba(47, 74, 60, .10); }
.lctf-remarks-count {
  position: absolute; right: 11px; top: 50%; transform: translateY(-50%);
  font-size: 10px; color: #918A7E; background: #F2EFE9;
  border-radius: 4px; padding: 2px 6px; pointer-events: none;
}

/* ---------------------------- modals (chars + help) ---------------------------- */
.lctf-dialog {
  position: fixed; inset: 0; z-index: 9998; display: flex;
  align-items: center; justify-content: center; padding: 1em;
  background: rgba(35, 30, 24, .45);
}
.lctf-dialog-panel {
  position: relative; width: min(560px, 100%); max-height: 82vh; overflow: auto;
  padding: 0; border-radius: 12px; background: var(--lctf-paper);
  box-shadow: 0 24px 70px rgba(40, 30, 18, .28);
}
.lctf-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--lctf-line); background: var(--lctf-soft);
}
.lctf-modal-head h4 { margin: 0; font: 400 19px Georgia, serif; }
.lctf-dialog-close {
  border: 0; background: none; font-size: 22px; line-height: 1;
  color: #777168; cursor: pointer; padding: 0 4px;
}
.lctf-special-hint { margin: 0; padding: 18px 20px 0; font-size: 11px; color: var(--lctf-muted); }
.lctf-special-grid { display: grid; grid-template-columns: repeat(9, 1fr); gap: 8px; padding: 18px 20px 22px; }
.lctf-special-char {
  height: 42px; padding: 0; border: 1px solid var(--lctf-line); border-radius: 7px;
  background: #FCFAF6; font: 20px/1 "DejaVu", Arial, sans-serif;
  color: #4A443B; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.lctf-special-char:hover { border-color: var(--lctf-green); background: var(--lctf-green-soft); }
.lctf-help-content { padding: 18px 20px 22px; font-size: 12px; line-height: 1.65; color: #5C564C; }
.lctf-help-content p { margin: 0 0 12px; }
.lctf-help-content img { max-width: 100%; height: auto; }

/* ---------------------------- inline status ---------------------------- */
/* No extra "Preview All Text" / "Save Layout" step for the buyer; the only
 * status node sits inside the permanent preview region. */
.lctf-status { font-size: 11px; color: #B3261E; }
.lctf-status:empty { display: none; }
.lctf-status[data-kind="ok"] { color: #1D7A46; }
.lctf-status[data-kind="warn"] { color: #A4650C; }

/* ---------------------------- a11y & responsive ---------------------------- */
.lctf-root :focus-visible { outline: 2px solid var(--lctf-green); outline-offset: 2px; }
@media (max-width: 600px) {
  .lctf-toggle { font-size: 18px; }
  .lctf-group-body { padding: 13px; }
  .lctf-resize-handle { width: 20px; height: 20px; }
  .lctf-size-relative { display: none; }
  .lctf-special-grid { grid-template-columns: repeat(6, 1fr); }
  .lctf-dialog-panel { max-height: 86vh; }
}
@media (prefers-reduced-motion: reduce) {
  .lctf-root * { transition: none !important; animation: none !important; }
}
