/* ============================================
   ListingPrep — global tool-chrome styles.
   Mobile-first, vanilla CSS, system font stack only.
   Scope: the 3 tool pages (Resize / Mockup / PDF Maker).
   Tokens here are the legacy navy palette; the new public-identity
   pages (home + legal + privacy + terms + thanks) load
   /css/listingprep.css on top, which adds --color-brand (teal).
   Bleu/teal seam is acknowledged transition debt — to close at the
   global tool restyle (separate effort, post-Étape B).
   ============================================ */

:root {
  --color-bg: #fbfaf7;
  --color-surface: #ffffff;
  --color-text: #1a1a1a;
  --color-text-muted: #5a5a5a;
  --color-border: #e6e3dd;
  --color-primary: #2563eb;
  --color-primary-dark: #1d4ed8;
  --color-accent: #2a7a5a;
  --color-accent-bg: #e6f4ed;
  --color-warning-bg: #fdf5e6;
  --color-warning-border: #e9c46a;
  --color-success-bg: #e8f4ee;
  --color-success-border: #2a7a5a;
  /* Step 2 — Category 3 (output/recovery actions). Tailwind emerald-600/700.
     Used for Download buttons, per-tile downloads, and the ✓ tab marker. */
  --color-success: #059669;
  --color-success-dark: #047857;
  --color-error-bg: #fdecea;
  --color-error-border: #c0392b;
  /* Semantic "pending action" color — intentionally separate from --color-primary
     so Block 7's primary-color rebrand doesn't drag this with it. Used for the
     "● not yet downloaded" orientation-tab marker. */
  --color-pending: #d96e3c;

  /* Orientation identity colors — used by the Mockup Maker to tint each design
     card's left border so an orientation "universe" is scannable at a glance.
     The master/batched/customized hierarchy is carried by the badge text. */
  --color-orientation-portrait:  #2563eb;
  --color-orientation-landscape: #16a34a;
  --color-orientation-square:    #d97706;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-serif: Georgia, "Times New Roman", serif;

  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);

  --content-max: 1100px;
  --content-narrow: 720px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--color-primary-dark); text-decoration: underline; text-underline-offset: 2px; }
a:hover { color: var(--color-primary); }

h1, h2, h3, h4 { font-family: var(--font-serif); line-height: 1.25; margin: 0 0 .5em; }

/* ============= HEADER ============= */
.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.site-header__inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: .75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.site-header__brand {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--color-text);
  text-decoration: none;
  white-space: nowrap;
}
.site-header__brand span { color: var(--color-primary); }
.site-header__tagline {
  font-size: .8rem;
  color: var(--color-text-muted);
  text-align: right;
}
@media (max-width: 540px) {
  .site-header__tagline { display: none; }
}

/* Inter-tool navigation (Resize / Mockup / PDF) — shown on tool pages. */
.site-nav {
  display: flex;
  align-items: center;
  gap: .15rem;
}
.site-nav__link {
  font-size: .9rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-decoration: none;
  padding: .35rem .6rem;
  border-radius: var(--radius);
  white-space: nowrap;
}
.site-nav__link:hover {
  color: var(--color-text);
  background: var(--color-bg);
}
.site-nav__link--active,
.site-nav__link--active:hover {
  color: var(--color-primary);
  background: var(--color-bg);
}
.site-nav__link--disabled,
.site-nav__link--disabled:hover {
  color: var(--color-text-muted);
  opacity: 0.5;
  cursor: not-allowed;
  background: none;
}

/* Footer rules (.site-footer) removed Étape B palier 4 — the legacy
   single-paragraph footer was superseded by the multi-column
   .site-footer-global declared in /css/listingprep.css. No HTML in the
   repo references .site-footer any more (verified with grep). */

/* ============================================
   App-wide modal primitives (DPI / iOS / Reset / Alert / Custom-template / etc.).
   Used by Resize Tool and Mockup Maker. Intentionally not scoped under a page
   container so they can render full-viewport regardless of layout context.
   ============================================ */
.app-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  font-family: var(--font-sans);
}
.app-modal[hidden] { display: none; }
.app-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  cursor: pointer;
}
.app-modal__box {
  position: relative;
  z-index: 1;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  max-width: 500px;
  width: 100%;
  padding: 1.5rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
  max-height: 90vh;
  overflow-y: auto;
}
/* Wide variant — used by the Mockup Maker custom-template modal which hosts
   an 800-px-on-long-side preview image with a draw-print-area overlay. */
.app-modal__box--wide {
  max-width: 880px;
}
.app-modal__title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.35rem;
  margin: 0 0 .75rem;
  color: var(--color-text);
}
.app-modal__body {
  font-size: .95rem;
  line-height: 1.5;
  color: var(--color-text);
}
.app-modal__body p { margin: .5rem 0; }
.app-modal__body a { color: var(--color-primary-dark); font-weight: 600; }
.app-modal__list {
  list-style: none;
  padding: .6rem .9rem;
  margin: .6rem 0;
  background: var(--color-warning-bg);
  border-left: 3px solid var(--color-warning-border);
  border-radius: var(--radius);
  font-size: .9rem;
}
.app-modal__list li { margin: .2rem 0; font-variant-numeric: tabular-nums; }
.app-modal__list li strong { color: var(--color-text); }
.app-modal__list .app-modal__group-label {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--color-text-muted);
  font-weight: 700;
  margin: .55rem 0 .15rem;
  font-variant-numeric: normal;
}
.app-modal__list .app-modal__group-label:first-child { margin-top: 0; }
.app-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: .6rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}
.app-modal__actions:has(> .app-modal__btn:nth-child(3)) {
  flex-direction: column;
  align-items: stretch;
}
.app-modal__actions:has(> .app-modal__btn:nth-child(3)) .app-modal__btn {
  width: 100%;
}
@media (max-width: 540px) {
  .app-modal__actions {
    flex-direction: column;
    align-items: stretch;
  }
  .app-modal__actions .app-modal__btn {
    width: 100%;
  }
}
.app-modal__btn {
  padding: .55rem 1.1rem;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: .92rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.12s, border-color 0.12s;
}
.app-modal__btn--secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border-color: var(--color-border);
}
.app-modal__btn--secondary:hover { border-color: var(--color-text-muted); }
.app-modal__btn--primary {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}
.app-modal__btn--primary:hover {
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
}
/* Destructive confirm button (Reset modals) — uses the "attention" color so an
   irreversible purge does not read as a neutral default action. */
.app-modal__btn--danger {
  background: var(--color-pending);
  color: white;
  border-color: var(--color-pending);
}
.app-modal__btn--danger:hover {
  background: #c25f30;
  border-color: #c25f30;
}

/* ============================================
   Drive collision modal — shared chrome.

   Migrated from /css/pdf-maker.css in Chantier α palier 1. Now consumed
   by Resize + Mockup + PDF Maker collision modals via window.WallArtDrive.
   preflightFileCollision returns the data; each tool keeps its own
   .drive-collision-modal element in HTML and its own openDriveCollisionModal
   handler in JS, but the visual rendering is unified through this CSS.

   Layout per row: filename + path label on top, Skip / Save-as radio
   choice below. Single-conflict cases still use the modal (uniform UI
   with multi-conflict cases). For batch-global usage (Resize multi-format,
   Mockup multi-mockup, PDF Maker unlinked), the modal can show N rows
   with grouped sections per artwork — the row CSS is unchanged.
   ============================================ */
.drive-collision__intro {
  margin: 0 0 1rem;
  color: var(--color-text);
  line-height: 1.5;
}
.drive-collision__list {
  display: flex;
  flex-direction: column;
  gap: .85rem;
  max-height: 50vh;
  overflow-y: auto;
}
.drive-collision__row {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
  padding: .75rem .85rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: .55rem;
}
.drive-collision__row-head {
  display: flex;
  flex-direction: column;
  gap: .15rem;
}
.drive-collision__filename {
  font-weight: 600;
  color: var(--color-text);
  font-family: ui-monospace, "SF Mono", "Consolas", monospace;
  font-size: .9rem;
  word-break: break-all;
}
.drive-collision__path {
  font-size: .8rem;
  color: var(--color-text-muted);
}
.drive-collision__choice {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  font-size: .88rem;
}
.drive-collision__choice label {
  display: flex;
  align-items: center;
  gap: .5rem;
  cursor: pointer;
}
.drive-collision__choice input[type="radio"] {
  accent-color: var(--color-primary);
}
.drive-collision__choice-newname {
  font-family: ui-monospace, "SF Mono", "Consolas", monospace;
  color: var(--color-text);
  background: var(--color-surface);
  padding: 0 .35rem;
  border-radius: 3px;
  border: 1px solid var(--color-border);
}

/* Per-artwork grouping inside the collision modal (Chantier α palier 2).
   When multiple artworks have collisions, rows are grouped under an h3
   that names the artwork. Resize + Mockup may have many rows; PDF Maker
   has at most one section so the heading collapses naturally. */
.drive-collision__group { margin-bottom: 1.25rem; }
.drive-collision__group:last-child { margin-bottom: 0; }
.drive-collision__group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .75rem;
  margin: 0 0 .55rem;
}
.drive-collision__group-title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1rem;
  color: var(--color-text);
  margin: 0;
}
.drive-collision__group-count {
  font-size: .8rem;
  color: var(--color-text-muted);
}

/* Bulk Skip / Save-as toggles, shown above the list when total N>5. */
.drive-collision__bulk {
  display: flex;
  gap: .5rem;
  margin: 0 0 .85rem;
  flex-wrap: wrap;
}

/* ============================================
   T3 (chantier 5 É1) — String opérateur Drive partagée.
   FR uniquement (« Sauvegarde sur Google Drive, opéré par ListingPrep »),
   EN = chaîne vide via common.drive.operated_by → :empty match →
   display:none → zéro pixel rendu côté EN sur les 3 outils.
   Authoring strict : aucun whitespace dans le <p></p> en HTML source.
   ============================================ */
.drive-operated-by {
  font-size: .8rem;
  color: #5e7174;
  /* Horizontal margin auto pairs with max-width to center the box in any
     parent (flex row PDF, flex column Mockup/Resize). */
  margin: 0 auto .4rem;
  text-align: center;
  line-height: 1.4;
  /* É3 fix — FR string "Sauvegarde sur Google Drive, opéré par ListingPrep"
     was rendered as one long crushed line inside .pdf-maker__preview-actions
     (display:flex; row gap). 28ch caps the box so the FR string wraps
     naturally at the comma onto 2 balanced lines, and the flex item base
     (0 0 auto) blocks both grow and shrink so the cap is respected even
     under pressure. Zero effect EN-side: common.drive.operated_by = "" →
     :empty → display:none below → the rules above never apply. Resize +
     Mockup are flex column; the same cap centers and wraps the FR string
     there as well. */
  max-width: 28ch;
  flex: 0 0 auto;
}
.drive-operated-by:empty {
  display: none;
}
