/* ============================================
   Wall Art Tool — global styles.
   Mobile-first, vanilla CSS, system font stack only.
   Tokens ported from the FR reference; identical palette
   for the cropper port. PDF accent color (navy) lives
   in shop-info defaults (Step 3).
   ============================================ */

: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 ============= */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 1.5rem 1rem;
  text-align: center;
  font-size: .85rem;
  color: var(--color-text-muted);
  margin-top: 3rem;
  background: var(--color-surface);
}
.site-footer p { margin: 0; }

/* ============================================
   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;
}
