/* =========================================================================
   views/page-settings — the Page settings sheet (src/features/sites/
   pageSettings.js): how one page shows on Google, laid out as Overview's
   Site settings (siteSettingsPanel.js), which is built from these same
   classes: the title beside the address, the description beside its
   Google "Preview", "Show this page on Google" as a row, then the share
   image. A right side sheet (the shared Modal, side: true) in the admin
   app and the client portal; two up where the sheet is wide enough, one
   under another on a phone.
   Shared with Overview (one rule each, never copied into
   website-workspace.css): .pgs-labelrow / .pgs-over (a field's label line
   and its over-length count), .pgs-preview, .pgs-switch-sec, .pgs-link,
   .pgs-imgs / .pgs-imgrow / .pgs-imgwords / .pgs-imgpic / .pgs-imgcard.
   Prefix: pgs- (page settings).
   ========================================================================= */
.pgs { display: flex; flex-direction: column; gap: var(--space-8); container-type: inline-size; }
.pgs-sec { display: flex; flex-direction: column; gap: var(--space-2-5); min-width: 0; }
/* the parts: no lines between the pairs (Framer's rhythm is space); hairlines only around the switch row */
.pgs-pair { display: flex; flex-direction: column; gap: var(--space-8); min-width: 0; }
/* a switch's row between hairlines (Show this page on Google; Overview's Password protect) */
.pgs-switch-sec, .pgs > .pgs-sec:has(.pgs-switch-row) { padding: var(--space-5) 0; border-top: 1px solid var(--border-faint); border-bottom: 1px solid var(--border-faint); }
.pgs-switch-row .switch input:focus-visible + .switch-track { outline: var(--focus-outline); outline-offset: var(--focus-offset); }
.pgs .field { gap: var(--space-2-5); }   /* (Framer: 10px from a label to its field) */
.pgs .field > label, .pgs .field-label, .pgs .pgs-h { font-size: var(--text-sm); font-weight: var(--fw-medium); color: var(--text-strong); }
/* a part's own title: "Page images" (Framer's section title) */
.pgs-part { margin: 0 0 var(--space-1); font-size: var(--text-md); font-weight: var(--fw-semibold); color: var(--text-strong); }
/* the sheet itself: wider than the shared side sheet, so the pairs sit side by side with room (Framer's page settings) */
.modal-shell.modal-side.pgs-modal { width: min(880px, 100vw); }
@container (min-width: 640px) {
  /* each pair: two columns that start level and end level (the description's box as tall as its Google result) */
  .pgs-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: var(--space-8); align-items: stretch; }
  .pgs-pair > .pgs-sec > .field { flex: 1 1 auto; }
  .pgs-sec--desc .field, .pgs-sec--desc .pgs-input--area { display: flex; flex-direction: column; flex: 1 1 auto; }
  .pgs-sec--desc .pgs-desc { flex: 1 1 auto; }
  .pgs-sec--google .pgs-google { flex: 1 1 auto; }
}
/* a field with Write it for me at its own end (a sparkle, its words in the tooltip) */
.pgs-input { position: relative; min-width: 0; }
.pgs-input.has-write > .input { padding-right: calc(var(--control-sm) + var(--space-1-5)); }
.pgs-write { position: absolute; top: calc((var(--control-md) - var(--control-sm)) / 2); right: var(--space-1); color: var(--text-soft); }
@media (hover: hover) and (pointer: fine) { .pgs-write:hover { color: var(--text-strong); } }
.pgs-write svg { width: 15px; height: 15px; }
.pgs-h { margin: 0; font-size: var(--text-md); font-weight: var(--fw-semibold); color: var(--text-strong); }
.pgs .field-desc { margin: 0; }

/* the head: "Page settings" and the page's name after it */
.pgs-title { display: inline-flex; align-items: baseline; gap: var(--space-2); min-width: 0; }
.pgs-title-page { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: var(--fw-regular); color: var(--text-soft); }

/* ---- How this page looks on Google: a search result, as Google draws one ---- */
.pgs-google {
  display: flex; flex-direction: column; gap: var(--space-1);
  padding: var(--space-4); border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--surface); min-width: 0;
  transition: opacity var(--dur) var(--ease);
}
.pgs-google.is-hidden { opacity: 0.55; }
.pgs-google-site { display: flex; align-items: center; gap: var(--space-2-5); min-width: 0; margin-bottom: var(--space-1); }
.pgs-fav {
  display: inline-grid; place-items: center; flex: none; width: 28px; height: 28px; overflow: hidden;
  border: 1px solid var(--border); border-radius: var(--radius-full); background: var(--surface-sunk);
  font-size: var(--text-xs); font-weight: var(--fw-semibold); color: var(--text-muted);
}
.pgs-fav img { width: 18px; height: 18px; object-fit: contain; }
.pgs-google-id { display: flex; flex-direction: column; min-width: 0; line-height: var(--leading-snug); }
.pgs-google-name { font-size: var(--text-sm); color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pgs-google-url { font-size: var(--text-xs); color: var(--text-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* the result's link: Google's blue (the info hue at its text step, readable in both themes) */
.pgs-google-title { margin: 0; font-size: var(--text-md); font-weight: var(--fw-medium); line-height: var(--leading-snug); color: var(--info-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pgs-google-desc { margin: 0; font-size: var(--text-sm); line-height: var(--leading-normal); color: var(--text-muted); overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.pgs-google-title.is-empty, .pgs-google-desc.is-empty { color: var(--text-soft); }
.pgs-hidden-note { display: flex; align-items: center; gap: var(--space-1-5); margin: 0; font-size: var(--text-sm); color: var(--text-muted); }
.pgs-hidden-note[hidden] { display: none; }
.pgs-hidden-note svg { width: 14px; height: 14px; flex: none; color: var(--text-soft); }

/* ---- Title and Description: the label line, the field with "Write it for me", nothing under it ---- */
/* a field's label line: the label, and on its right a count only while it's over Google's length ("164/155") */
.pgs-labelrow { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-2); min-width: 0; }
.pgs-over { font-size: var(--text-2xs); line-height: 1; font-variant-numeric: tabular-nums; color: var(--warning-700); }
.pgs-over:empty { display: none; }
.pgs .field-msg[hidden], .pgs .field-desc[hidden] { display: none; }
/* the Google result under "Preview", as tall as the description beside it */
.pgs-preview { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; }
.pgs-preview .pgs-google { flex: 1 1 auto; }
/* an inline text link in a quiet line ("Change it in the post", "Change password") */
.pgs-link { display: inline; padding: 0; border: 0; background: none; font: inherit; color: var(--text-strong); font-weight: var(--fw-medium); text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; cursor: pointer; }
.pgs-link:focus-visible { outline: var(--focus-outline); outline-offset: var(--focus-offset); border-radius: var(--radius-sm); }
@media (hover: hover) and (pointer: fine) { .pgs-link:hover { text-decoration-color: currentColor; } }
.pgs-link[aria-disabled="true"] { color: var(--text-soft); text-decoration-color: var(--border); cursor: not-allowed; }
.pgs-desc { min-height: 88px; }
/* a value the page takes from elsewhere: the same field, read-only (components .input.is-readonly), never resized */
textarea.input.is-readonly { resize: none; }
.pgs-check-row { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); margin-top: calc(var(--space-1) * -1); }
.pgs-check-row:has(.pgs-check.is-ok), .pgs-check-row:has(.pgs-check:empty) { display: none; }
.pgs-check-row .field-msg { margin-top: 0; }
.pgs-check.is-ok svg { color: var(--success-600); }
.pgs-check.is-warn { color: var(--warning-700); }
.pgs-check.is-warn svg { color: var(--warning-600); }
.pgs-count { flex: none; font-size: var(--text-xs); line-height: var(--leading-snug); color: var(--text-soft); font-variant-numeric: tabular-nums; }
.pgs-count.is-over { color: var(--warning-700); }
/* an uploaded page's own words under its field, with "Use the page's own" (only while the field says something else) */

/* ---- Show this page on Google: the whole row is the switch's label ---- */
.pgs-switch-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); cursor: pointer; }
.pgs-switch-text { display: flex; flex-direction: column; gap: var(--space-0-5); min-width: 0; }
.pgs-switch-label { font-size: var(--text-md); font-weight: var(--fw-medium); color: var(--text-strong); }

/* ---- Images (Page images; Overview's Site images): each row its words and Upload left, its picture right, the
   social preview as wide as Overview's two favicon tiles and their gap, the label level with the picture ---- */
.pgs-imgs { --pgs-img-w: 180px; --pgs-img-gap: var(--space-4); gap: var(--space-6); }
.pgs-imgrow { display: flex; flex-direction: column; gap: var(--space-2-5); min-width: 0; }
.pgs-imgrow + .pgs-imgrow { padding-top: var(--space-6); border-top: 1px solid var(--border-faint); }
.pgs-imgwords { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.pgs-imgwords > .pgs-share-label { line-height: 1; }
.pgs-imgwords .pgs-image-actions { margin-top: var(--space-2); }
.pgs-imglines { display: contents; }
.pgs-imgrow > .field-msg[hidden] { display: none; }
.pgs-share-label { font-size: var(--text-sm); font-weight: var(--fw-medium); color: var(--text-strong); }
.pgs-card { overflow: hidden; border: 1px solid var(--border-faint); border-radius: var(--radius-lg); background: var(--surface-sunk); max-width: 420px; }
.pgs-card-img { aspect-ratio: 1.91 / 1; background: var(--surface-sunk); }
.pgs-card-img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.pgs-card-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-1-5); height: 100%; padding: var(--space-4); font-size: var(--text-sm); color: var(--text-soft); text-align: center; }
.pgs-card-empty svg { width: 20px; height: 20px; }
/* (its × on the corner, half outside: the picture clips to the card's corners instead of the card) */
.pgs-card.pgs-imgcard { position: relative; width: 100%; max-width: calc(2 * var(--pgs-img-w, 180px) + var(--pgs-img-gap, var(--space-4))); overflow: visible; }
.pgs-imgcard .pgs-card-img { overflow: hidden; border-radius: calc(var(--radius-lg) - 1px); }
/* a card that takes a photo: dropped on it, or chosen with a click */
.pgs-card.is-droppable { cursor: pointer; transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease); }
.pgs-card.is-drop { border-color: var(--primary); background: var(--surface-hover); }
.pgs-card.is-drop .pgs-card-empty { color: var(--text-strong); }
.pgs-card[aria-busy="true"] { cursor: progress; opacity: .7; }
@media (hover: hover) and (pointer: fine) { .pgs-card.is-droppable:hover { border-color: var(--border-strong); } }
.pgs-card-text { display: none; }   /* (a shared link's words: the Google result above already shows the title) */
.pgs-card-url { font-size: var(--text-xs); color: var(--text-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pgs-card-title { font-size: var(--text-sm); font-weight: var(--fw-semibold); line-height: var(--leading-snug); color: var(--text-strong); overflow-wrap: anywhere; }
.pgs-image-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.pgs-image-actions:empty { display: none; }
.pgs-image-actions [hidden] { display: none; }

/* ---- Address: the site's address, then the page's own part to type (one ring, on the box) ---- */
.pgs-slug, .pgs-affixed {
  display: flex; align-items: center; height: var(--control-md); padding: 0 var(--space-2-5); min-width: 0;
  border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface);
  box-shadow: var(--shadow-xs); cursor: text;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.pgs-slug:focus-within, .pgs-affixed:focus-within { border-color: var(--border-strong); box-shadow: var(--ring-primary); }
@media (hover: hover) and (pointer: fine) { .pgs-slug:hover:not(:focus-within), .pgs-affixed:hover:not(:focus-within) { box-shadow: var(--shadow-sm); } }
.pgs-slug.is-error { border-color: var(--danger-300); }
.pgs-slug.is-error:focus-within { border-color: var(--danger-600); }
/* the site's address takes what it needs (at most 60%, then an ellipsis) and the field fills the rest */
.pgs-slug-base { flex: 0 0 auto; min-width: 0; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-md); color: var(--text-soft); }
/* an item page's title made from one field: the fixed words around it shown in the box, never typed or stored */
.pgs-affix { flex: 0 0 auto; min-width: 0; max-width: 50%; overflow: hidden; text-overflow: ellipsis; white-space: pre; font-size: var(--text-md); color: var(--text-soft); }
.pgs-affix--after { order: 2; }
.pgs-input.has-write > .pgs-affixed { padding-right: calc(var(--control-sm) + var(--space-1-5)); }
.pgs-slug-input, .pgs-affixed-input { flex: 1 1 0; width: 0; min-width: 64px; height: 100%; padding: 0; font: inherit; font-size: var(--text-md); color: var(--text); }
/* a read-only value with no field behind it (Overview's fixed Language) */
.pgs-readonly { display: flex; align-items: center; gap: var(--space-2); min-height: var(--control-md); margin: 0; padding: 0 var(--space-2-5); border: 1px solid var(--border-faint); border-radius: var(--radius-md); background: var(--surface-sunk); font-size: var(--text-md); color: var(--text-muted); overflow-wrap: anywhere; cursor: default; }
.pgs-readonly-text { flex: 1 1 auto; min-width: 0; }
/* where a place comes from (the post's field, or why it can't change), and the way to change it, as one quiet line */
.pgs-from, .pgs-legacy { margin: 0; }
/* More for Google: the other fields only the page's head uses */
.pgs-sec--more { display: flex; flex-direction: column; gap: var(--space-2-5); }
.pgs-more { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-6); min-width: 0; }
.pgs-more-pic { display: flex; align-items: center; justify-content: center; width: 160px; max-width: 100%; aspect-ratio: 16 / 10; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-sunk); box-shadow: inset 0 0 0 1px var(--border-faint); color: var(--text-soft); }
.pgs-more-pic img { display: block; width: 100%; height: 100%; object-fit: cover; }
.pgs-more-pic svg { width: 18px; height: 18px; }

@container (min-width: 640px) {
  /* an images row: the words and Upload on the left, the picture from the right column's left edge */
  .pgs-imgrow { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: var(--space-8); align-items: start; }
  .pgs-imgrow > * { grid-column: 1; }
  .pgs-imgrow > .pgs-imgpic { grid-column: 2; grid-row: 1 / span 3; }
  /* More for Google: two up, a long one or a switch across both */
  .pgs-more { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: var(--space-8); }
  .pgs-more > .pgs-more-wide { grid-column: 1 / -1; }
}

/* ---- the footer: an error on the left, Cancel and Save on the right ---- */
.pgs-foot { display: flex; align-items: center; justify-content: flex-end; gap: var(--space-2); width: 100%; min-width: 0; }
.pgs-foot-error { flex: 1 1 auto; min-width: 0; margin: 0 auto 0 0; }
.pgs-foot-error[hidden] { display: none; }

@media (max-width: 640px) {
  .pgs { gap: var(--space-6); }
  .pgs-google { padding: var(--space-3-5); }
  .pgs-card:not(.pgs-imgcard) { max-width: none; }
  .pgs-foot { flex-wrap: wrap; }
  .pgs-foot-error { flex-basis: 100%; }
}
@media (pointer: coarse) {
  .pgs-slug, .pgs-affixed { height: var(--control-lg); }
}
@media (prefers-reduced-motion: reduce) {
  .pgs-google { transition: none; }
}
