/* Builder styles only. Shared header, footer and base type come from /tools/_assets/site.css.
   Mobile first: the base rules are the phone layout, desktop.css (900px and up) adds the two-column layout.
   Palette: cool grey page, navy for primary actions and step badges, coral for selected states and links.
   Secondary buttons (Done, Add block, Add network) are grey, so coral always means a chosen thing or a link.

   One system for the whole tool (docs/linkcabin/UX.md, Design system):
   type   five sizes, two weights: 12 for footnotes, 14 for labels and secondary lines, 16 for body and
          controls, 20 for card titles, 28 for the page title; 400 for text, 600 for anything that acts.
   space  4, 8, 12, 16, 24, 32. The gap between cards is always larger than the gaps inside them.
   corner 8 for controls, 12 for rows and tiles, 16 for cards, full round for pills. The phone frame is
          the one exception, because it draws a device. */

.lc-page {
  --lc-navy: #0f172a;
  --lc-navy-dark: #1e293b;
  --lc-accent: #c73d24;
  --lc-accent-dark: #9a2f1b;
  --lc-accent-tint: #fbe9e4;
  --lc-accent-line: #f0c7bc;
  --lc-line: #e3e6eb;
  --lc-input: #d5dae2;
  --lc-text: #0f172a;
  --lc-muted: #5b6472;
  --lc-bg: #f7f8fa;
  --lc-soft: #eceff3;
  --lc-green: #1d7a3a;
  --lc-green-tint: #e6f5ea;
  --lc-red: #c4321c;
  --lc-warn: #a15c00;
  --lc-fs-1: 12px; --lc-fs-2: 14px; --lc-fs-3: 16px; --lc-fs-4: 20px; --lc-fs-5: 28px;
  --lc-s1: 4px; --lc-s2: 8px; --lc-s3: 12px; --lc-s4: 16px; --lc-s5: 24px; --lc-s6: 32px;
  --lc-r-control: 8px; --lc-r-row: 12px; --lc-r-card: 16px; --lc-r-pill: 999px;
  font-family: var(--font);
  font-size: var(--lc-fs-3);
  background: var(--lc-bg);
}
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
.lc-page [hidden] { display: none !important; }
/* Safety net: nothing inside the page may cause sideways scrolling on phones. clip (not hidden) keeps sticky working. */
.lc-page main { overflow-x: clip; }
.lc-visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.lc-icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.lc-page :focus-visible { outline: 3px solid var(--lc-accent); outline-offset: 2px; }

/* ---------- Shell: the shared header, breadcrumb and footer, tuned for this page only ----------
   site.css is shared by every tool and is never edited; these overrides are scoped to .lc-page so the
   shell matches the builder's type, weights and link colour. */
.lc-page h1, .lc-page h2, .lc-page h3, .lc-page h4 { font-family: var(--font); font-weight: 600; }
/* At 12 px the site's own grey falls just under the 4.5:1 contrast line, so the breadcrumb takes the builder's muted ink. */
.lc-page .breadcrumb { margin: var(--lc-s4) 0 0; font-size: var(--lc-fs-1); color: var(--lc-muted); }
.lc-page .breadcrumb a { color: var(--lc-muted); }
.lc-page .breadcrumb a:hover { color: var(--lc-text); }
.lc-page .site-footer { font-size: var(--lc-fs-2); }
.lc-page .site-footer h2 { font-size: var(--lc-fs-3); }
.lc-page .site-footer a, .lc-content a { color: var(--lc-accent); }
.lc-page .site-footer a:hover, .lc-content a:hover { color: var(--lc-accent-dark); }
.lc-page .copyright { font-size: var(--lc-fs-1); }
/* Phones: a shorter header so the title is on screen without scrolling. */
@media (max-width: 899px) {
  .lc-page .site-header .wrap { min-height: 56px; gap: var(--lc-s2) var(--lc-s4); padding-top: var(--lc-s2); padding-bottom: var(--lc-s2); }
  .lc-page .site-logo img { width: 150px; }
  .lc-page .site-nav { gap: var(--lc-s4); }
  .lc-page .site-nav a { font-size: var(--lc-fs-2); }
}

/* ---------- Hero ---------- */
.lc-hero h1 { font-size: var(--lc-fs-5); line-height: 1.15; letter-spacing: -.02em; margin: var(--lc-s2) 0 var(--lc-s1); color: var(--lc-text); }
.lc-hero .lead { font-size: var(--lc-fs-3); color: var(--lc-muted); margin: 0 0 var(--lc-s2); }

/* ---------- Layout ---------- */
/* minmax(0, 1fr) and min-width: 0 stop long one-line block titles from widening the page. */
.lc-builder { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--lc-s4); margin-bottom: var(--lc-s4); }
/* app.js builds the editor, so for a moment the root is empty and the How to card sits in the first viewport,
   then drops 3000 px when the builder mounts (a 0.7 layout shift). The root keeps a viewport of height until
   something real is inside it: the editor, the load error, or the noscript line when scripts are off. */
.lc-builder:not(:has(.lc-editor, .lc-error, noscript > *)) { min-height: 100vh; }
.lc-stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--lc-s4); align-content: start; }
.lc-builder > *, .lc-stack > * { min-width: 0; }

/* ---------- Cards ---------- */
.lc-card {
  background: #fff; border: 1px solid var(--lc-line); border-radius: var(--lc-r-card);
  padding: var(--lc-s4); box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
.lc-card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--lc-s3); margin-bottom: var(--lc-s1); }
.lc-card h2 { font-size: var(--lc-fs-4); letter-spacing: -.01em; margin: 0; color: var(--lc-text); }
.lc-card-intro { color: var(--lc-muted); font-size: var(--lc-fs-2); margin: 0 0 var(--lc-s3); }
.lc-card-head + .lc-field { margin-top: var(--lc-s2); }

/* ---------- Fields ---------- */
.lc-field { margin-bottom: var(--lc-s3); }
.lc-field:last-child { margin-bottom: 0; }
.lc-field label, .lc-label { display: block; font-weight: 600; font-size: var(--lc-fs-2); color: var(--lc-text); margin: 0 0 var(--lc-s1); }
.lc-optional { font-weight: 400; color: var(--lc-muted); }
/* The camera badge is a label for the file input; keep its button look. */
.lc-field label.lc-avatar-badge { display: grid; margin: 0; color: #fff; }
.lc-field input[type="text"], .lc-field input[type="url"], .lc-field textarea {
  width: 100%; min-height: 44px; font: inherit; font-size: var(--lc-fs-3); color: var(--lc-text);
  background: #fff; border: 1px solid var(--lc-input); border-radius: var(--lc-r-control); padding: var(--lc-s2) var(--lc-s3);
}
.lc-field textarea { min-height: 80px; resize: vertical; line-height: 1.5; }
.lc-field input:focus, .lc-field textarea:focus { outline: none; border-color: var(--lc-accent); box-shadow: 0 0 0 3px rgba(199, 61, 36, .18); }
.lc-field input[aria-invalid="true"] { border-color: var(--lc-red); }
.lc-field-foot { display: flex; justify-content: space-between; align-items: center; gap: var(--lc-s3); font-size: var(--lc-fs-1); color: var(--lc-muted); margin-top: var(--lc-s1); }
.lc-counter { margin-left: auto; white-space: nowrap; }
.lc-hint { font-size: var(--lc-fs-1); color: var(--lc-muted); margin: var(--lc-s1) 0 0; }
.lc-hint.is-error, .lc-error { color: var(--lc-red); }
.lc-hint.is-warn { color: var(--lc-warn); font-weight: 600; }
.lc-error { font-size: var(--lc-fs-2); margin: var(--lc-s1) 0 0; }
.lc-inline { display: flex; gap: var(--lc-s2); }
.lc-inline input { flex: 1; min-width: 0; }

/* ---------- Buttons ---------- */
.lc-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--lc-s2); min-height: 44px;
  padding: var(--lc-s2) var(--lc-s4); border-radius: var(--lc-r-control); border: 1px solid transparent; font: inherit; font-size: var(--lc-fs-3);
  font-weight: 600; line-height: 1.2; text-decoration: none; cursor: pointer; text-align: center;
}
.lc-btn-primary { background: var(--lc-navy); border-color: var(--lc-navy); color: #fff; }
.lc-btn-primary:hover { background: var(--lc-navy-dark); border-color: var(--lc-navy-dark); color: #fff; }
.lc-btn-outline { background: #fff; border-color: var(--lc-navy); color: var(--lc-navy); }
.lc-btn-outline:hover { background: var(--lc-soft); }
.lc-btn-soft { background: var(--lc-soft); border-color: var(--lc-soft); color: var(--lc-navy); }
.lc-btn-soft:hover { background: #e1e5eb; border-color: #e1e5eb; }
.lc-btn-plain { background: #fff; border-color: var(--lc-input); color: var(--lc-text); }
.lc-btn-plain:hover { background: var(--lc-bg); }
.lc-text-btn { background: none; border: 0; padding: var(--lc-s1) 0; font: inherit; font-size: var(--lc-fs-2); font-weight: 600; cursor: pointer; color: var(--lc-accent); }
.lc-danger { color: var(--lc-red); }
.lc-link-btn {
  display: inline-flex; align-items: center; gap: var(--lc-s1); background: none; border: 0; padding: var(--lc-s1) 0;
  font: inherit; font-size: var(--lc-fs-2); font-weight: 600; color: var(--lc-accent); cursor: pointer;
}
.lc-link-btn .lc-icon { width: 16px; height: 16px; }
.lc-actions { display: flex; flex-wrap: wrap; gap: var(--lc-s2); margin: var(--lc-s2) 0 0; }
.lc-actions .lc-btn { flex: 1 1 auto; white-space: nowrap; }

/* ---------- Saved chip ---------- */
.lc-saved {
  display: inline-flex; align-items: center; gap: var(--lc-s1); background: var(--lc-green-tint); color: var(--lc-green);
  font-size: var(--lc-fs-1); font-weight: 600; padding: var(--lc-s1) var(--lc-s3); border-radius: var(--lc-r-pill);
}
.lc-saved .lc-icon { width: 14px; height: 14px; stroke-width: 2.4; }
.lc-save-warn { margin: 0; padding: var(--lc-s3) var(--lc-s4); border-radius: var(--lc-r-control); background: #fff7e6; color: var(--lc-warn); font-size: var(--lc-fs-2); }

/* ---------- Example note: text and Start blank side by side; the button drops below on a phone ---------- */
.lc-example-note {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--lc-s3); padding: var(--lc-s3) var(--lc-s4);
  border: 1px solid var(--lc-accent-line); border-radius: var(--lc-r-control); background: var(--lc-accent-tint);
}
.lc-example-note p { flex: 1 1 16rem; margin: 0; font-size: var(--lc-fs-2); color: var(--lc-text); }

/* ---------- Import: one sentence under the title; the whole page takes the drop ---------- */
.lc-import { margin: 0; font-size: var(--lc-fs-2); color: var(--lc-muted); }
.lc-import-link { color: var(--lc-accent); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.lc-import-link:hover { color: var(--lc-accent-dark); }
.lc-import-wrap:focus-within .lc-import-link { outline: 3px solid var(--lc-accent); outline-offset: 2px; border-radius: 4px; }
.lc-import-msg { margin: var(--lc-s2) 0 0; padding: var(--lc-s3) var(--lc-s4); border-radius: var(--lc-r-control); background: var(--lc-green-tint); color: var(--lc-green); font-size: var(--lc-fs-2); font-weight: 600; }
.lc-import-msg.is-error { background: #fdecea; color: var(--lc-red); }
/* pointer-events: none keeps the drop reaching the document under the overlay (import.js). */
.lc-drop-overlay {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: var(--lc-s4);
  background: rgba(255, 255, 255, .85); pointer-events: none;
}
.lc-drop-overlay[hidden] { display: none; }
.lc-drop-box {
  display: grid; justify-items: center; gap: var(--lc-s3); width: min(100%, 420px); padding: var(--lc-s6) var(--lc-s5);
  border: 2px dashed var(--lc-accent); border-radius: var(--lc-r-card); background: #fff; color: var(--lc-text); font-size: var(--lc-fs-3); font-weight: 600; text-align: center;
}
.lc-drop-box .lc-icon { width: 32px; height: 32px; color: var(--lc-accent); }

/* ---------- Avatar ---------- */
.lc-avatar-row { display: flex; gap: var(--lc-s4); align-items: center; }
.lc-avatar-wrap { position: relative; flex: none; }
.lc-avatar {
  width: 80px; height: 80px; border-radius: 50%; overflow: hidden; display: grid; place-items: center;
  background: var(--lc-soft); color: #aab3c0; border: 1px solid var(--lc-line);
}
.lc-avatar img { width: 100%; height: 100%; object-fit: cover; }
.lc-avatar .lc-icon { width: 36px; height: 36px; stroke-width: 1.4; }
.lc-avatar-badge {
  position: absolute; right: -4px; bottom: -4px; width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; background: var(--lc-navy); color: #fff; border: 3px solid #fff; cursor: pointer;
}
.lc-avatar-badge .lc-icon { width: 16px; height: 16px; }
.lc-avatar-actions { flex: 1; min-width: 0; display: grid; gap: var(--lc-s2); }
/* One way in (Add photo opens the upload or link choice); Remove sits beside it once there is a photo. */
.lc-photo-btns { display: flex; flex-wrap: wrap; align-items: center; gap: var(--lc-s2) var(--lc-s4); }
.lc-photo-add { min-height: 40px; font-size: var(--lc-fs-2); }
.lc-avatar-actions .lc-hint { margin: 0; }
.lc-photo-menu { margin-top: var(--lc-s3); }
.lc-avatar-url { margin-top: var(--lc-s3); }

/* ---------- Product picture ---------- */
/* Square like the card's image, and "contain" so a wide logo shows whole, as it will on the page. */
.lc-pic-row { display: flex; gap: var(--lc-s4); align-items: center; }
.lc-pic {
  flex: none; width: 72px; height: 72px; border-radius: var(--lc-r-row); overflow: hidden; display: grid; place-items: center;
  background: var(--lc-soft); color: #aab3c0; border: 1px solid var(--lc-line);
}
.lc-pic img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.lc-pic .lc-icon { width: 32px; height: 32px; stroke-width: 1.4; }

/* ---------- Look: template tiles ---------- */
.lc-tiles { display: grid; gap: var(--lc-s2); }
.lc-tiles button { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; display: grid; gap: var(--lc-s1); min-width: 0; color: var(--lc-text); }
.lc-tile-name { font-size: var(--lc-fs-2); }
.lc-tiles [aria-pressed="true"] .lc-tile-name { font-weight: 600; }
.lc-thumb {
  position: relative; display: grid; align-content: start; justify-items: center; gap: var(--lc-s1); min-width: 0;
  aspect-ratio: 1 / 1.1; padding: var(--lc-s3); border-radius: var(--lc-r-row); border: 2px solid transparent;
  box-shadow: inset 0 0 0 1px var(--lc-line);
}
.lc-tiles [aria-pressed="true"] .lc-thumb { border-color: var(--lc-accent); box-shadow: none; }
.lc-thumb i { display: block; width: 100%; border-radius: 4px; }
.lc-thumb .lc-thumb-avatar { width: 28%; aspect-ratio: 1; border-radius: 50%; }
.lc-thumb .lc-thumb-line { height: 5px; width: 60%; }
.lc-thumb .lc-thumb-line.short { width: 40%; }
.lc-thumb .lc-thumb-btn { height: 12px; border-radius: 4px; }
.lc-thumb-light { background: #fafaf9; }
.lc-thumb-light i { background: #d4d4d8; }
.lc-thumb-light .lc-thumb-btn { background: #fff; box-shadow: inset 0 0 0 1px #e4e4e7; }
.lc-thumb-dark { background: #0b0c0f; }
.lc-thumb-dark i { background: #52525b; }
.lc-thumb-dark .lc-thumb-btn { background: #15171c; box-shadow: inset 0 0 0 1px #2d323d; }
.lc-thumb-gradient { background: linear-gradient(180deg, #f6c7a1, #e89a7c 25%, #7a6c9a 55%, #2e3a5e); }
.lc-thumb-gradient i { background: rgba(255, 255, 255, .55); }
.lc-thumb-gradient .lc-thumb-avatar { background: #fff; box-shadow: 0 0 0 2px rgba(255, 255, 255, .6); }
.lc-thumb-gradient .lc-thumb-btn { background: #fff8f2; }
.lc-thumb-check {
  position: absolute; top: -8px; right: -8px; width: 24px; height: 24px; border-radius: 50%;
  display: none; place-items: center; background: var(--lc-accent); color: #fff; border: 2px solid #fff;
}
.lc-thumb-check .lc-icon { width: 14px; height: 14px; stroke-width: 3; }
.lc-tiles [aria-pressed="true"] .lc-thumb-check { display: grid; }

/* ---------- Look: segmented control ---------- */
/* The pressed segment changes colour only, never weight, so the control never shifts under the pointer. */
.lc-segmented { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--lc-soft); border-radius: var(--lc-r-control); padding: var(--lc-s1); }
.lc-segmented button {
  min-height: 36px; border: 0; border-radius: calc(var(--lc-r-control) - 4px); background: none; font: inherit; font-size: var(--lc-fs-2);
  font-weight: 400; color: var(--lc-muted); cursor: pointer;
}
.lc-segmented [aria-pressed="true"] { background: var(--lc-accent); color: #fff; box-shadow: 0 1px 3px rgba(15, 23, 42, .15); }

/* ---------- Links: the block list ---------- */
/* A row is an icon, a name and a chevron on every screen; desktop.css adds a drag handle. Removing and
   moving live inside the open editor, so a first look at the list is calm. */
/* minmax(0, 1fr): an open editor (a select next to an input) must never widen the list past the card. */
.lc-blocks { list-style: none; margin: 0 0 var(--lc-s3); padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--lc-s2); }
.lc-block { min-width: 0; border: 1px solid var(--lc-line); border-radius: var(--lc-r-row); background: #fff; }
.lc-block.is-open { border-color: var(--lc-accent-line); box-shadow: 0 0 0 3px var(--lc-accent-tint); }
.lc-row { display: flex; align-items: center; gap: var(--lc-s1); padding: var(--lc-s2) var(--lc-s2) var(--lc-s2) var(--lc-s3); }
.lc-row-icon { display: grid; place-items: center; width: 28px; height: 28px; flex: none; color: var(--lc-text); }
.lc-row-icon .lc-icon { width: 20px; height: 20px; }
.lc-row-main {
  flex: 1; min-width: 0; display: grid; text-align: left; background: none; border: 0;
  padding: var(--lc-s1) 0; font: inherit; cursor: pointer; color: var(--lc-text);
}
.lc-row-line { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--lc-fs-2); }
.lc-row-title { font-weight: 600; }
.lc-row-extra { color: var(--lc-muted); }
.lc-row-type { font-size: var(--lc-fs-1); color: var(--lc-muted); }
.lc-icon-btn {
  display: grid; place-items: center; width: 36px; height: 36px; flex: none; padding: 0; cursor: pointer;
  background: #fff; color: var(--lc-text); border: 1px solid var(--lc-line); border-radius: var(--lc-r-control);
}
.lc-icon-btn:hover:not([disabled]) { background: var(--lc-bg); }
.lc-icon-btn[disabled] { opacity: .35; cursor: not-allowed; }
.lc-icon-btn .lc-icon { width: 18px; height: 18px; }
.lc-row-chevron { width: 32px; border-color: transparent; }
.lc-row-chevron .lc-icon { stroke-width: 2.2; transition: transform .15s; }
.lc-block.is-open .lc-row-chevron .lc-icon { transform: rotate(90deg); }
.lc-editor-panel { padding: var(--lc-s1) var(--lc-s3) var(--lc-s3); border-top: 1px solid var(--lc-line); }
.lc-editor-panel .lc-field { margin: var(--lc-s3) 0 0; }
.lc-editor-foot { display: flex; justify-content: space-between; align-items: center; gap: var(--lc-s2); margin-top: var(--lc-s4); }
.lc-editor-foot .lc-btn { min-height: 40px; padding: var(--lc-s2) var(--lc-s4); font-size: var(--lc-fs-2); }
.lc-editor-foot .lc-move { display: flex; gap: var(--lc-s2); }
.lc-editor-foot .lc-move .lc-icon-btn { width: 40px; }

.lc-add {
  width: 100%; min-height: 44px; display: flex; align-items: center; justify-content: center; gap: var(--lc-s2);
  background: var(--lc-soft); border: 1px solid var(--lc-soft); border-radius: var(--lc-r-row);
  color: var(--lc-navy); font: inherit; font-size: var(--lc-fs-3); font-weight: 600; cursor: pointer;
}
.lc-add:hover { background: #e1e5eb; border-color: #e1e5eb; }
.lc-add .lc-icon { width: 20px; height: 20px; stroke-width: 2.2; }
/* Step one: three big choices, one per row. Step two (Something else): the rarer types, two across. */
.lc-add-menu { margin-top: var(--lc-s2); }
.lc-add-choices, .lc-add-grid { display: grid; grid-template-columns: 1fr; gap: var(--lc-s2); }
.lc-add-grid { grid-template-columns: 1fr 1fr; }
.lc-add-choices .lc-add-tile { align-items: center; }
.lc-add-back { margin-bottom: var(--lc-s1); }
.lc-back-icon { transform: rotate(180deg); }
.lc-add-next { margin-left: auto; color: var(--lc-muted); }
.lc-add-tile {
  display: flex; align-items: flex-start; gap: var(--lc-s2); text-align: left; padding: var(--lc-s3); cursor: pointer;
  background: #fff; border: 1px solid var(--lc-line); border-radius: var(--lc-r-row); font: inherit; color: var(--lc-text);
}
.lc-add-tile:hover { border-color: var(--lc-accent-line); background: var(--lc-accent-tint); }
.lc-add-tile strong { display: block; font-size: var(--lc-fs-3); font-weight: 600; }
.lc-add-tile .lc-hint { margin: 2px 0 0; }
.lc-add-tile[disabled] { opacity: .5; cursor: not-allowed; }
.lc-check { display: flex; gap: var(--lc-s2); align-items: center; margin-top: var(--lc-s3); font-size: var(--lc-fs-2); }
.lc-check input { width: 20px; height: 20px; accent-color: var(--lc-accent); }
.lc-check label { margin: 0; }

/* ---------- Block editors: selects, social rows, video limit ---------- */
.lc-field select, .lc-social-item select {
  min-height: 44px; font: inherit; font-size: var(--lc-fs-3); color: var(--lc-text); background: #fff;
  border: 1px solid var(--lc-input); border-radius: var(--lc-r-control); padding: var(--lc-s2) var(--lc-s3);
}
.lc-field select { width: 100%; }
.lc-field select:focus, .lc-social-item select:focus { outline: none; border-color: var(--lc-accent); box-shadow: 0 0 0 3px rgba(199, 61, 36, .18); }
.lc-social-items { list-style: none; margin: var(--lc-s3) 0 var(--lc-s2); padding: 0; display: grid; gap: var(--lc-s2); }
.lc-social-item .lc-inline { align-items: center; }
.lc-social-item select { flex: 0 1 40%; min-width: 0; }
.lc-social-item input {
  flex: 1 1 0; width: 0; min-width: 0; min-height: 44px; font: inherit; font-size: var(--lc-fs-3); color: var(--lc-text);
  border: 1px solid var(--lc-input); border-radius: var(--lc-r-control); padding: var(--lc-s2) var(--lc-s3);
}
.lc-social-item input[aria-invalid="true"] { border-color: var(--lc-red); }
.lc-small-btn { min-height: 40px; font-size: var(--lc-fs-2); }
.lc-editor-panel .lc-check { margin-top: var(--lc-s3); }

/* ---------- Product shelf: one folding card per product, then Add product ---------- */
.lc-shelf-items { display: grid; gap: var(--lc-s2); margin: var(--lc-s3) 0; }
.lc-shelf-item { border: 1px solid var(--lc-line); border-radius: var(--lc-r-row); padding: 0 var(--lc-s3); background: #fff; }
.lc-shelf-item > summary {
  list-style: none; display: flex; align-items: center; gap: var(--lc-s2); min-height: 44px; cursor: pointer;
  font-size: var(--lc-fs-2); font-weight: 600;
}
.lc-shelf-item > summary::-webkit-details-marker { display: none; }
.lc-shelf-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lc-shelf-chevron { width: 16px; height: 16px; flex: none; stroke-width: 2.2; color: var(--lc-muted); transition: transform .15s; }
.lc-shelf-item[open] .lc-shelf-chevron { transform: rotate(90deg); }
.lc-shelf-item[open] { padding-bottom: var(--lc-s3); }
.lc-shelf-foot { display: flex; justify-content: space-between; align-items: center; gap: var(--lc-s2); margin-top: var(--lc-s3); }
.lc-shelf-foot .lc-move { display: flex; gap: var(--lc-s2); margin-left: auto; }
.lc-shelf-intro { margin-top: var(--lc-s3); }

/* ---------- Improve with AI: a link in the Bio field's foot that opens a soft panel under it ---------- */
.lc-field-foot .lc-link-btn { padding: 0; }
.lc-ai-open .lc-icon { width: 14px; height: 14px; }
.lc-ai-panel { margin-top: var(--lc-s3); padding: var(--lc-s3); background: var(--lc-soft); border-radius: var(--lc-r-row); }
.lc-ai-intro { margin: 0 0 var(--lc-s3); font-size: var(--lc-fs-2); color: var(--lc-muted); }
.lc-ai-panel .lc-actions .lc-btn { flex: 1 1 140px; }
.lc-ai-panel .lc-hint { margin: var(--lc-s2) 0 0; }
.lc-ai-panel .lc-hint:empty { display: none; }
.lc-prompt-text {
  width: 100%; margin-top: var(--lc-s2); font: var(--lc-fs-1) / 1.5 ui-monospace, Consolas, monospace; color: var(--lc-text);
  border: 1px solid var(--lc-input); border-radius: var(--lc-r-control); padding: var(--lc-s3);
}
.lc-host-pitch { font-size: var(--lc-fs-3); color: var(--lc-text); margin: 0 0 var(--lc-s2); }
.lc-host-fold h4 { font-size: var(--lc-fs-2); margin: var(--lc-s3) 0 var(--lc-s1); color: var(--lc-text); }
.lc-host-fold ol { margin: 0; padding-left: 20px; font-size: var(--lc-fs-2); color: var(--lc-text); }
.lc-host-fold li { margin-bottom: var(--lc-s1); }

/* ---------- Hosting steps ---------- */
/* Optional sections start folded (More options, the hosting steps): a heading with a chevron. */
.lc-fold > summary { list-style: none; display: flex; justify-content: space-between; align-items: center; gap: var(--lc-s3); cursor: pointer; }
.lc-fold > summary::-webkit-details-marker { display: none; }
.lc-fold > summary::after {
  content: ""; width: 8px; height: 8px; flex: none; border-right: 2px solid var(--lc-muted); border-bottom: 2px solid var(--lc-muted);
  transform: rotate(45deg) translateY(-3px);
}
.lc-fold[open] > summary::after { transform: rotate(-135deg) translateY(-1px); }
.lc-fold[open] > summary { margin-bottom: var(--lc-s2); }

/* ---------- Live preview ---------- */
/* On phones the preview is a bottom sheet: the page dims and the card rises from the bottom when sheet.js
   adds is-open. It is hidden otherwise, so the Preview button in the bar is the only way to it.
   desktop.css puts the same element back into the right column. */
.lc-preview { position: fixed; inset: 0; z-index: 50; display: none; align-items: flex-end; background: rgba(15, 23, 42, .45); }
.lc-preview.is-open { display: flex; }
.lc-preview .lc-preview-card {
  width: 100%; max-height: calc(100% - 24px); overflow: auto; margin: 0; border-radius: var(--lc-r-card) var(--lc-r-card) 0 0;
  padding-bottom: calc(var(--lc-s4) + env(safe-area-inset-bottom)); animation: lc-rise .25s ease-out;
}
@keyframes lc-rise { from { transform: translateY(40px); opacity: 0; } }
/* The chevron turn and the phone's bottom shade are the only other movement in the builder. */
@media (prefers-reduced-motion: reduce) {
  .lc-preview .lc-preview-card { animation: none; }
  .lc-row-chevron .lc-icon, .lc-phone::after { transition: none; }
}
.lc-page.lc-sheet-open { overflow: hidden; }
.lc-views { display: flex; gap: var(--lc-s2); }
.lc-views button {
  display: grid; place-items: center; width: 36px; height: 36px; padding: 0; cursor: pointer;
  background: #fff; color: var(--lc-muted); border: 1px solid var(--lc-line); border-radius: var(--lc-r-control);
}
.lc-views [aria-pressed="true"] { color: var(--lc-accent); border-color: var(--lc-accent); background: var(--lc-accent-tint); }
/* A real phone at a smaller size: the same 340 / 711 proportions as desktop.css, and the page scrolls
   inside the screen like on a phone. The 44px corner belongs to the device drawing, not the corner scale. */
.lc-phone {
  position: relative; display: flex; flex-direction: column; aspect-ratio: 340 / 711;
  width: min(100%, 280px, calc((100vh - 140px) * 340 / 711)); width: min(100%, 280px, calc((100dvh - 140px) * 340 / 711));
  margin: 0 auto; overflow: hidden; background: #fff; border: 9px solid #111827; border-radius: 44px;
  box-shadow: 0 0 0 2px #cbd2dc, 0 16px 36px rgba(15, 23, 42, .16);
}
.lc-phone::before {
  content: ""; position: absolute; z-index: 1; top: 7px; left: 50%; width: 76px; height: 22px;
  margin-left: -38px; border-radius: 16px; background: #111827;
}
/* Shown while there is more page below the screen (preview.js adds has-more). */
.lc-phone::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 64px; pointer-events: none;
  opacity: 0; transition: opacity .2s; background: linear-gradient(rgba(15, 23, 42, 0), rgba(15, 23, 42, .38));
}
.lc-phone.has-more::after { opacity: 1; }
/* preview.js sizes and scales the iframe to fit the screen; the wide view below resets that. */
.lc-phone iframe { display: block; flex: none; width: 100%; height: 100%; border: 0; transform-origin: 0 0; }
.lc-phone.is-wide { width: 100%; aspect-ratio: auto; border: 1px solid var(--lc-line); border-radius: var(--lc-r-row); box-shadow: none; }
.lc-phone.is-wide::before { display: none; }
.lc-phone.is-wide iframe { flex: none; height: 500px; }

/* ---------- Hosting: compact rows, free first, Hostinger last ---------- */
.lc-hosting h2 { margin-bottom: var(--lc-s1); }
.lc-host-list { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--lc-s2); }
.lc-host {
  display: flex; align-items: center; gap: var(--lc-s3); padding: var(--lc-s3); text-decoration: none;
  background: #fff; border: 1px solid var(--lc-line); border-radius: var(--lc-r-row); color: var(--lc-text);
}
.lc-host:hover { border-color: var(--lc-accent-line); background: var(--lc-accent-tint); }
.lc-host-mark { width: 24px; height: 24px; flex: none; }
.lc-host-text { flex: 1; min-width: 0; display: grid; line-height: 1.3; }
.lc-host-text strong { font-size: var(--lc-fs-3); font-weight: 600; }
.lc-host-time { font-size: var(--lc-fs-2); color: var(--lc-muted); }
.lc-host-price { flex: none; font-size: var(--lc-fs-1); font-weight: 600; padding: var(--lc-s1) var(--lc-s2); border-radius: var(--lc-r-pill); background: var(--lc-green-tint); color: var(--lc-green); }
.lc-host-price.is-paid { background: var(--lc-accent-tint); color: var(--lc-accent-dark); }
/* Disclosure: body size and body colour, never grey or small (PRD section 9). */
.lc-disclosure { font-size: inherit; color: var(--lc-text); margin: var(--lc-s3) 0 0; }
.lc-host-fold { margin-top: var(--lc-s3); }
.lc-host-fold h3 { font-size: var(--lc-fs-3); margin: 0; }

/* ---------- The download bar: pinned to the bottom on phones, under the preview on wide screens ---------- */
.lc-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: var(--lc-s2);
  padding: var(--lc-s2) var(--lc-s4) calc(var(--lc-s2) + env(safe-area-inset-bottom)); background: #fff;
  border-top: 1px solid var(--lc-line); box-shadow: 0 -4px 16px rgba(15, 23, 42, .06);
}
.lc-bar .lc-btn { min-height: 44px; padding: var(--lc-s2) var(--lc-s3); font-size: var(--lc-fs-3); white-space: nowrap; }
/* Download stays clickable while the page has no name, so the click can say what is missing. */
.lc-btn.is-soft { opacity: .55; }
.lc-bar-status { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: var(--lc-s1) var(--lc-s3); margin: 0; font-size: var(--lc-fs-2); color: var(--lc-text); }
.lc-bar-status[hidden] { display: none; }
.lc-bar-status.is-warn { color: var(--lc-warn); font-weight: 600; }
.lc-bar-status .lc-link-btn { padding: 0; font-size: var(--lc-fs-2); }
.lc-page { padding-bottom: 72px; }
/* Very narrow phones: give Download more room and drop the Preview icon so neither label overflows. */
@media (max-width: 360px) {
  .lc-bar { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
  .lc-bar .lc-btn { font-size: var(--lc-fs-2); padding: var(--lc-s2); }
  .lc-bar .lc-btn-outline .lc-icon { display: none; }
}

/* ---------- Content below the tool ---------- */
.lc-content { display: grid; gap: var(--lc-s4); }
.lc-content .lc-card h2 { margin-bottom: var(--lc-s1); }
.lc-content p, .lc-content li { color: var(--lc-muted); }
.lc-content .lc-card > p { margin: 0; }
.lc-steps { list-style: none; counter-reset: step; padding: 0; margin: var(--lc-s3) 0 0; display: grid; gap: var(--lc-s2); }
.lc-steps li { counter-increment: step; display: flex; gap: var(--lc-s3); align-items: flex-start; color: var(--lc-text); }
.lc-steps li::before {
  content: counter(step); flex: none; display: grid; place-items: center; width: 24px; height: 24px;
  border-radius: 50%; background: var(--lc-navy); color: #fff; font-size: var(--lc-fs-2); font-weight: 600;
}
.lc-faq { display: grid; gap: var(--lc-s2); margin-top: var(--lc-s3); }
.lc-faq details { border: 1px solid var(--lc-line); border-radius: var(--lc-r-row); }
.lc-faq summary {
  list-style: none; display: flex; justify-content: space-between; align-items: center; gap: var(--lc-s3);
  padding: var(--lc-s3); cursor: pointer; font-size: var(--lc-fs-3); font-weight: 600; color: var(--lc-text);
}
.lc-faq summary::-webkit-details-marker { display: none; }
.lc-faq summary::after {
  content: ""; width: 8px; height: 8px; flex: none; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-3px);
}
.lc-faq details[open] summary::after { transform: rotate(-135deg) translateY(-1px); }
.lc-faq details p { margin: 0; padding: 0 var(--lc-s3) var(--lc-s3); font-size: var(--lc-fs-3); }

/* ---------- Settings ---------- */
.lc-settings .lc-check { margin: 0 0 var(--lc-s4); }
.lc-required { color: var(--lc-red); }

/* Wide screen rules live in desktop.css, loaded only at 900px and up. */
.lc-desktop-only { display: none; }

@media (max-width: 380px) {
  .lc-avatar { width: 72px; height: 72px; }
  .lc-avatar-row { gap: var(--lc-s3); }
  .lc-add-grid { grid-template-columns: 1fr; }
}

/* ---------- More templates: thumbnails and the phone strip ---------- */
/* Thumbnails for the templates added after the first three; each mirrors its page's colours. */
.lc-thumb-ocean { background: radial-gradient(90% 60% at 0% 0%, #0f766e, transparent 70%), radial-gradient(80% 50% at 100% 0%, #1d4ed8, transparent 70%), #062033; }
.lc-thumb-ocean i { background: rgba(255, 255, 255, .55); }
.lc-thumb-ocean .lc-thumb-avatar { background: #fff; }
.lc-thumb-ocean .lc-thumb-btn { background: rgba(255, 255, 255, .16); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25); }
.lc-thumb-forest { background: linear-gradient(180deg, #e6efe8, #9fc1ad 22%, #3f6b56 40%, #2b4a3b 65%, #0f2219); }
.lc-thumb-forest i { background: rgba(255, 255, 255, .55); }
.lc-thumb-forest .lc-thumb-avatar { background: #fff; }
.lc-thumb-forest .lc-thumb-btn { background: #f3f7f4; }
.lc-thumb-pastel { background: radial-gradient(70% 45% at 0% 0%, #ffd6bf, transparent 70%), radial-gradient(70% 45% at 100% 15%, #e3d6ff, transparent 70%), radial-gradient(80% 50% at 20% 100%, #cdefdf, transparent 70%), #fff8f1; }
.lc-thumb-pastel i { background: #d9cfe6; }
.lc-thumb-pastel .lc-thumb-btn { background: #fff; box-shadow: 0 2px 4px rgba(120, 80, 140, .15); }
.lc-thumb-paper { background: #f6f1e8; }
.lc-thumb-paper i { background: #b9ae9d; }
.lc-thumb-paper .lc-thumb-avatar { background: #1b1917; }
.lc-thumb-paper .lc-thumb-btn { background: transparent; box-shadow: inset 0 0 0 1.5px #1b1917; }
.lc-thumb-pop { background: radial-gradient(rgba(0, 0, 0, .12) 1px, transparent 1.5px) 0 0 / 7px 7px, #fde047; }
.lc-thumb-pop i { background: #111; }
.lc-thumb-pop .lc-thumb-btn { background: #fff; box-shadow: inset 0 0 0 1.5px #111, 2px 2px 0 #111; }
.lc-thumb-midnight { background: radial-gradient(90% 55% at 50% 0%, #5b21b6, transparent 70%), #0b0920; }
.lc-thumb-midnight i { background: rgba(196, 181, 253, .55); }
.lc-thumb-midnight .lc-thumb-avatar { background: #7c3aed; }
.lc-thumb-midnight .lc-thumb-btn { background: rgba(255, 255, 255, .08); box-shadow: inset 0 0 0 1px #6d28d9; }

/* On phones the templates are one swipeable row. About three and a third tiles show, which hints that it
   scrolls; swiping sideways is natural on touch. desktop.css turns it into a grid with nothing hidden.
   Padding leaves room for the check badge that sits over the tile's corner. */
.lc-tiles {
  grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: calc((100% - 24px) / 3.3);
  overflow-x: auto; scroll-snap-type: x proximity; scroll-padding-left: var(--lc-s1); padding: var(--lc-s3) var(--lc-s4) var(--lc-s2) var(--lc-s1); margin: calc(-1 * var(--lc-s3)) calc(-1 * var(--lc-s4)) 0 calc(-1 * var(--lc-s1));
  scrollbar-width: thin;
}
.lc-tiles button { scroll-snap-align: start; }

/* Thumbnails hint at each template's layout too: left-aligned header, list rows, tiles, grouped panel. */
.lc-thumb-dark, .lc-thumb-paper { justify-items: start; }
.lc-thumb-paper .lc-thumb-btn { border-radius: 0; box-shadow: inset 0 -1.5px 0 #8a7f70; }
.lc-thumb-pop { grid-template-columns: 1fr 1fr; }
.lc-thumb-pop i:not(.lc-thumb-btn), .lc-thumb-pop .lc-thumb-btn:last-of-type { grid-column: 1 / -1; justify-self: center; }
.lc-thumb-pop .lc-thumb-btn { height: 16px; }
.lc-thumb-pop .lc-thumb-avatar { border-radius: 4px; transform: rotate(-4deg); }
.lc-thumb-forest .lc-thumb-avatar { border-radius: 6px; }
.lc-thumb-ocean .lc-thumb-btn { border-radius: 0; }
.lc-thumb-ocean .lc-thumb-btn + .lc-thumb-btn { margin-top: -6px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25); }
.lc-thumb-pastel .lc-thumb-btn { box-shadow: 0 0 0 3px rgba(255, 255, 255, .7), 0 2px 4px rgba(120, 80, 140, .15); }

/* ---------- Phones: spacing and tap targets ----------
   Most people use this tool on a phone, so every control here is a 44 px target. Where a small control must
   not push its neighbours, a pseudo-element grows the tap area and the drawing stays the same size. */
@media (max-width: 899px) {
  html { scroll-padding-bottom: 88px; } /* A focused field never lands under the fixed bar. */
  .lc-page { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
  .lc-page:has(.lc-bar-status:not([hidden])) { padding-bottom: calc(104px + env(safe-area-inset-bottom)); }

  .lc-builder, .lc-stack, .lc-content { gap: var(--lc-s5); }
  .lc-builder, .lc-content { margin-bottom: var(--lc-s5); }
  .lc-card-head { margin-bottom: var(--lc-s2); }

  .lc-link-btn, .lc-text-btn, .lc-import-link, .lc-segmented button { position: relative; }
  .lc-link-btn::after, .lc-text-btn::after, .lc-import-link::after { content: ""; position: absolute; inset: calc(50% - 22px) 0; }
  .lc-segmented button::after { content: ""; position: absolute; inset: -4px 0; }
  /* These two hang their extra area on one side: the textarea sits above the AI link, the buttons under the bar's. */
  .lc-ai-open::after { inset: 0 0 -22px; }
  .lc-bar-status .lc-link-btn::after { inset: -14px 0 -8px; }
  .lc-avatar-badge::after { content: ""; position: absolute; inset: -9px; border-radius: 50%; }
  .lc-add-back { margin-bottom: var(--lc-s2); }
  .lc-photo-add, .lc-small-btn, .lc-editor-foot .lc-btn { min-height: 44px; }
  .lc-editor-foot .lc-move .lc-icon-btn, .lc-shelf-foot .lc-icon-btn, .lc-sheet-close { width: 44px; height: 44px; }

  /* The whole row opens the editor. The name button stays the real control, so Tab and screen readers are unchanged. */
  .lc-row { position: relative; }
  .lc-row-main::before { content: ""; position: absolute; inset: 0; }
  .lc-add-tile .lc-hint { line-height: 1.4; }

  /* The label covers the row, so a tap anywhere on it toggles the box. */
  .lc-check { position: relative; min-height: 44px; }
  .lc-check label::after { content: ""; position: absolute; inset: 0; }
  .lc-editor-panel .lc-check { margin-top: var(--lc-s1); }
  .lc-settings .lc-check { margin: 0 0 var(--lc-s2); }

  /* A web address needs the width, so the network and its remove button take the first line. */
  .lc-social-items { gap: var(--lc-s4); }
  .lc-social-item .lc-inline { flex-wrap: wrap; }
  .lc-social-item select { flex: 1 1 0; order: 1; }
  .lc-social-item .lc-icon-btn { order: 2; width: 44px; height: 44px; }
  .lc-social-item input { order: 3; flex: 1 0 100%; width: 100%; }

  /* The card is the fold: a tap anywhere on a closed More options card opens it. */
  .lc-settings .lc-fold > summary { margin: calc(-1 * var(--lc-s4)); padding: var(--lc-s4); }
  .lc-settings .lc-fold[open] > summary { margin-bottom: 0; }
  .lc-host-fold { margin-top: var(--lc-s1); }
  .lc-host-fold > summary { min-height: 44px; }

  .lc-page .site-footer li, .lc-content ul li { margin: 0; }
  .lc-page .site-footer li a, .lc-content li a { display: inline-flex; align-items: center; min-height: 44px; }

  /* The preview frame shrinks with the viewport height, so the notch scales with it. */
  .lc-phone::before { width: 29%; height: auto; aspect-ratio: 76 / 22; margin-left: -14.5%; }
}

/* Narrow phones: Remove block, the arrows and Done no longer share a line. The nav stays on one row, so the
   name field is still near the top of the screen. Its labels need 306 px at 14 px, hence the second step. */
@media (max-width: 374px) {
  .lc-editor-foot { flex-wrap: wrap; }
  .lc-editor-foot .lc-btn { flex: 1 1 100%; order: 3; }
  .lc-page .site-nav { gap: var(--lc-s2); }
}
@media (max-width: 339px) {
  .lc-page .site-nav a { font-size: var(--lc-fs-1); }
}
