/* The Paid Hour — invoice app.
   Brand tokens and type match thepaidhour.com: no web fonts (Core Web Vitals),
   Georgia serif for display, system sans for body. */

:root {
  --ink: #0E3B43;
  --ink-d: #092429;
  --amber: #E8A33D;
  --amber-d: #A96F17;
  --text: #26333B;
  --muted: #5F7178;
  --paper: #FBF9F4;
  --card: #FFFFFF;
  --line: #E5E1D7;
  --radius: 14px;
  --serif: Georgia, "Iowan Old Style", "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --shadow-1: 0 1px 2px rgba(14, 59, 67, .04);
  --shadow-2: 0 18px 40px rgba(14, 59, 67, .10);
}

* { box-sizing: border-box; }

body {
  font-family: var(--sans);
  margin: 0;
  color: var(--text);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}

a { color: var(--ink); }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }

/* ---------------------------------------------------------------- header */
.site-header {
  background: rgba(251, 249, 244, .92);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 40;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; padding: 14px 24px; gap: 20px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); flex-shrink: 0; }
.logo-mark { display: block; width: 30px; height: 30px; line-height: 0; }
.logo-mark svg { display: block; }
.logo-text { font-family: var(--serif); font-size: 20px; font-weight: 600; letter-spacing: -.01em; color: var(--ink); }

.site-nav { display: flex; align-items: center; gap: 22px; overflow-x: auto; scrollbar-width: none; }
.site-nav::-webkit-scrollbar { display: none; }
.site-nav a {
  font-size: 13px; font-weight: 600; color: var(--muted); text-decoration: none;
  white-space: nowrap; padding: 4px 0; border-bottom: 2px solid transparent;
  transition: color .15s ease, border-color .15s ease;
}
.site-nav a:hover { color: var(--ink); }
.site-nav a.current { color: var(--ink); border-bottom-color: var(--amber); }

/* ------------------------------------------------------------------ hero */
.hero { padding: 56px 0 8px; text-align: center; }
.eyebrow {
  font-size: 11px; font-weight: 700; color: var(--muted);
  letter-spacing: .16em; text-transform: uppercase; margin: 0 0 18px;
}
.hero h1 {
  font-family: var(--serif); font-weight: 600; color: var(--ink);
  font-size: clamp(32px, 4.4vw, 46px); line-height: 1.08; letter-spacing: -.015em;
  margin: 0 auto 18px; max-width: 21ch;
}
.hero .accent { color: var(--amber-d); }
.hero-sub { max-width: 580px; margin: 0 auto; color: var(--muted); font-size: 16px; line-height: 1.65; }

.hero-price {
  display: inline-flex; align-items: center; gap: 8px;
  margin: 22px auto 0; padding: 7px 16px;
  background: rgba(232, 163, 61, .14); border: 1px solid rgba(232, 163, 61, .38);
  border-radius: 999px; color: var(--ink); font-size: 13px; font-weight: 600;
}
.hero-price b { font-weight: 700; }
.hero-price .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--amber); flex: none; }

.hero-actions { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; margin: 26px 0 0; }

.trust-row {
  display: flex; justify-content: center; flex-wrap: wrap; gap: 10px 28px;
  margin: 30px 0 0; padding: 0; list-style: none;
  font-size: 12.5px; color: var(--muted);
}
.trust-row li { display: flex; align-items: center; gap: 8px; }
.trust-row li::before {
  content: ""; width: 5px; height: 5px; border-radius: 50%;
  background: var(--amber); flex: none;
}

/* --------------------------------------------------------- how it works */
.steps { margin: 64px 0 0; border-top: 1px solid var(--line); padding-top: 34px; }
.steps-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.step-num {
  font-family: var(--serif); font-size: 13px; font-weight: 700; color: var(--amber-d);
  letter-spacing: .1em; margin: 0 0 8px;
}
.step h3 { font-family: var(--serif); font-size: 18px; font-weight: 600; color: var(--ink); margin: 0 0 6px; line-height: 1.3; }
.step p { margin: 0; font-size: 14px; color: var(--muted); line-height: 1.6; }

/* --------------------------------------------------------- section head */
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 20px; margin: 66px 0 22px; padding-bottom: 14px; border-bottom: 1px solid var(--line);
}
.section-head h2 { font-family: var(--serif); font-size: 26px; font-weight: 600; color: var(--ink); margin: 0; letter-spacing: -.01em; }
.section-head p { margin: 0; font-size: 13px; color: var(--muted); }

/* --------------------------------------------------------------- gallery */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 24px; margin: 0 0 72px; }
.card {
  display: flex; flex-direction: column;
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  background: var(--card); box-shadow: var(--shadow-1);
  transition: box-shadow .18s ease, transform .18s ease, border-color .18s ease;
}
.card:hover { box-shadow: var(--shadow-2); transform: translateY(-3px); border-color: #d8d2c4; }

/* The A4 preview is cropped to the top of the page, so short templates don't
   leave a tall empty box and every card lines up. */
.card-preview { position: relative; background: var(--paper); overflow: hidden; aspect-ratio: 794 / 880; border-bottom: 1px solid var(--line); }
.thumb-scale { position: absolute; top: 0; left: 0; width: 794px; height: 1123px; transform-origin: top left; }
.card iframe { width: 794px; height: 1123px; border: 0; pointer-events: none; display: block; }

.card .card-foot {
  margin-top: auto; display: flex; flex-direction: column; align-items: stretch;
  gap: 14px; padding: 18px;
}
.card .card-foot > div { min-width: 0; }
.card .card-foot strong {
  font-family: var(--serif); font-size: 15.5px; font-weight: 600; color: var(--ink);
  line-height: 1.32; margin-bottom: 4px; min-height: 2.64em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card .card-foot .price-badge { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .01em; }
.gallery-empty { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 48px 0; font-size: 14px; }

/* --------------------------------------------------------------- buttons */
.btn-primary, .btn-ghost {
  font-family: inherit; font-size: 13.5px; font-weight: 600; border-radius: 999px;
  padding: 11px 22px; cursor: pointer; border: 1px solid transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  text-decoration: none; text-align: center; white-space: nowrap;
  transition: background .15s ease, color .15s ease, border-color .15s ease, transform .12s ease;
}
.btn-primary { background: var(--amber); color: var(--ink-d); box-shadow: 0 1px 0 rgba(14,59,67,.06); }
.btn-primary:hover { background: var(--amber-d); color: #fff; }
.btn-primary:active { transform: translateY(1px); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--ink); background: #fff; }
.card .card-foot .btn-primary { width: 100%; padding: 11px 16px; font-size: 13px; }

/* ---------------------------------------------------------------- footer */
.site-footer { background: var(--ink); color: rgba(244, 241, 234, .72); margin-top: 0; padding: 40px 0 34px; font-size: 13px; }
.footer-grid { display: flex; justify-content: space-between; align-items: flex-start; gap: 28px; flex-wrap: wrap; }
.site-footer .logo-text { color: #F4F1EA; }
.site-footer .foot-tag { margin: 8px 0 0; font-size: 13px; color: rgba(244, 241, 234, .62); max-width: 34ch; }
.foot-links { display: flex; gap: 22px; flex-wrap: wrap; }
.foot-links a { color: rgba(244, 241, 234, .82); text-decoration: none; font-weight: 600; font-size: 13px; }
.foot-links a:hover { color: var(--amber); }
.foot-bottom {
  margin-top: 28px; padding-top: 18px; border-top: 1px solid rgba(244, 241, 234, .14);
  font-size: 12px; color: rgba(244, 241, 234, .55);
}

/* ----------------------------------------------------------- form fields */
.field-label { display: block; font-size: 12px; font-weight: 700; color: var(--ink); margin-bottom: 14px; letter-spacing: .01em; }
.field-label input, .field-label textarea {
  display: block; width: 100%; margin-top: 6px; padding: 10px 12px; font-size: 13.5px;
  font-family: inherit; border: 1px solid var(--line); border-radius: 10px; color: var(--text);
  background: #fff; transition: border-color .15s ease, box-shadow .15s ease;
}
.field-label textarea { resize: vertical; min-height: 64px; }
.field-label input:focus, .field-label textarea:focus {
  outline: none; border-color: var(--amber); box-shadow: 0 0 0 3px rgba(232, 163, 61, .18);
}
.field-hint { display: block; font-weight: 400; color: var(--muted); font-size: 11.5px; margin-top: 3px; line-height: 1.5; letter-spacing: normal; }
.req { color: var(--amber-d); font-weight: 700; }
.checkbox-label { display: flex; align-items: flex-start; gap: 9px; font-size: 13px; color: var(--text); margin-top: 20px; line-height: 1.5; }
.checkbox-label input { width: auto; margin-top: 3px; accent-color: var(--ink); }
.builder-app .checkbox-label { margin-top: 10px; margin-bottom: 16px; }

.logo-preview-wrap { display: flex; align-items: center; gap: 10px; margin: -4px 0 16px; }
.logo-preview-wrap[hidden] { display: none; }
.logo-preview-img { max-height: 52px; max-width: 150px; object-fit: contain; border: 1px solid var(--line); border-radius: 8px; padding: 4px; background: #fff; }
.logo-remove-btn { padding: 6px 13px; font-size: 11.5px; }

.items-block { margin-bottom: 6px; }
.item-row { display: flex; gap: 6px; margin-bottom: 8px; }
.item-row input { margin-top: 0; }
.item-row .desc { flex: 1; min-width: 0; }
.item-row .qty { width: 62px; }
.item-row .price { width: 84px; }
.row-2 { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.row-2 .field-label { flex: 1; margin-bottom: 0; }

/* --------------------------------------------------------- builder popup */
.builder-modal { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; padding: 20px; }
.builder-modal[hidden] { display: none; }
.builder-modal-backdrop { position: absolute; inset: 0; background: rgba(9, 36, 41, .58); }
.builder-modal-panel {
  position: relative; background: var(--paper); border-radius: 18px; width: 100%; max-width: 1120px;
  max-height: 92vh; overflow-y: auto; padding: 36px 38px; box-shadow: 0 30px 80px rgba(9, 36, 41, .4);
  border: 1px solid var(--line);
}

.builder-head { text-align: center; margin: 0 0 28px; padding-right: 30px; }
.builder-head h1, .builder-head h2 {
  font-family: var(--serif); font-size: 28px; font-weight: 600; color: var(--ink);
  margin: 0 0 10px; letter-spacing: -.015em; line-height: 1.2;
}
.builder-sub { color: var(--muted); font-size: 14px; max-width: 580px; margin: 0 auto; line-height: 1.65; }
.builder-sub strong { color: var(--ink); font-weight: 700; }

.builder-app { display: grid; grid-template-columns: 410px 1fr; gap: 26px; align-items: start; }

.card-panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow-1); }
.card-panel h3 {
  font-size: 11px; font-weight: 700; color: var(--ink); text-transform: uppercase;
  letter-spacing: .14em; margin: 26px 0 16px; padding-top: 20px; border-top: 1px solid var(--line);
}
.card-panel h3:first-child { margin-top: 0; padding-top: 0; border-top: none; }

.pay-btn { width: 100%; padding: 14px; font-size: 14.5px; margin-top: 26px; border: none; }
.pay-btn:disabled { opacity: .55; cursor: default; }
.pay-trust { text-align: center; font-size: 11.5px; color: var(--muted); margin: 12px 0 0; line-height: 1.5; }

.preview-wrapper {
  background: #EFEAE1; padding: 26px; border-radius: var(--radius);
  border: 1px solid var(--line); display: flex; justify-content: center;
}
.invoice-canvas {
  position: relative; width: 100%; max-width: 650px; min-height: 700px; background: #fff;
  border-radius: 4px; box-shadow: 0 14px 34px rgba(9, 36, 41, .14); overflow: hidden;
  transition: filter .3s ease;
}
.invoice-canvas.blurred { filter: blur(16px); }
.invoice-canvas iframe { width: 100%; height: 700px; border: 0; display: block; pointer-events: none; }
.watermark-overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  transform: rotate(-30deg); opacity: .1; font-size: 30px; font-weight: 800; color: var(--ink);
  white-space: nowrap; pointer-events: none; z-index: 5; text-align: center; letter-spacing: .04em;
  text-transform: uppercase;
}

/* --------------------------------------------------------- payment popup */
.payment-modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; }
.payment-modal[hidden] { display: none; }
.payment-modal-backdrop { position: absolute; inset: 0; background: rgba(9, 36, 41, .58); }
.payment-modal-panel {
  position: relative; background: #fff; border-radius: 16px; width: 480px; max-width: 100%;
  max-height: 90vh; overflow-y: auto; padding: 6px; box-shadow: 0 24px 60px rgba(9, 36, 41, .34);
}
.payment-modal-close {
  position: absolute; top: 10px; right: 12px; z-index: 2; background: #fff; border: 1px solid var(--line);
  border-radius: 50%; width: 30px; height: 30px; font-size: 18px; line-height: 1; color: var(--muted);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.payment-modal-close:hover { color: var(--ink); border-color: var(--ink); }
#checkoutContainer { min-height: 480px; }

/* ------------------------------------------------------------ responsive */
@media (max-width: 900px) {
  .builder-app { grid-template-columns: 1fr; }
  .builder-modal-panel { padding: 26px 20px; }
  .steps-grid { grid-template-columns: 1fr; gap: 22px; }
  .section-head { flex-direction: column; align-items: flex-start; gap: 6px; }
}
@media (max-width: 720px) {
  .wrap { padding: 0 18px; }
  .header-inner { flex-direction: column; align-items: flex-start; gap: 12px; padding: 12px 18px; }
  .site-nav { width: 100%; gap: 18px; }
  .hero { padding: 44px 0 4px; }
  .hero h1 { max-width: 100%; }
  .trust-row { flex-direction: column; align-items: center; gap: 8px; }
  .gallery { grid-template-columns: 1fr; }
  .preview-wrapper { padding: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
