@import url("https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,500;0,600;0,700;1,500;1,600&family=Source+Sans+3:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap");

:root {
  --paper: #f6f1e8;
  --ink: #1b1814;
  --muted: #6a6258;
  --brass: #b08d57;
  --brass-soft: #c4a574;
  --rail: #ebe4d8;
  --stage: #d9d0c3;
  --line: rgba(28, 24, 20, 0.12);
  --sans: "Source Sans 3", system-ui, ui-sans-serif, sans-serif;
  --serif: "Playfair Display", Georgia, "Times New Roman", Times, serif;
}

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

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--stage);
  color: var(--ink);
  font-family: var(--sans);
}

.app {
  display: grid;
  grid-template-columns: minmax(280px, 22rem) 1fr;
  min-height: 100vh;
}

.rail {
  background: var(--rail);
  border-right: 1px solid var(--line);
  padding: 1.6rem 1.35rem 2.4rem;
  overflow: auto;
  min-width: 0;
}

.rail-head h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.7rem;
  letter-spacing: -0.01em;
  margin: 0.15rem 0 0.45rem;
}

.kicker {
  margin: 0;
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.lede {
  margin: 0 0 1.3rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid rgba(28, 24, 20, 0.22);
  margin-bottom: 1.1rem;
}

.seg-btn {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 0.55rem 0.4rem;
  font-family: var(--sans);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}

.seg-btn.is-on {
  background: var(--ink);
  color: var(--paper);
}

.field, .photos, .agent-fields {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0 0 0.95rem;
  border: 0;
  padding: 0;
  min-width: 0;
  max-width: 100%;
}

.photos legend, .agent-fields legend {
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 0.35rem;
}

.field > span, .well > span {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--muted);
}

input[type="text"] {
  width: 100%;
  border: 1px solid rgba(28, 24, 20, 0.2);
  background: #f7f3eb;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.95rem;
  padding: 0.5rem 0.6rem;
  outline: none;
}

input[type="text"]:focus {
  border-color: var(--brass);
}

.field small, .note, .hint {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

.note { margin: 0 0 0.5rem; }

.well-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.6rem;
  min-width: 0;
}

.well {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.55rem;
  border: 1px dashed rgba(28, 24, 20, 0.22);
  background: rgba(255, 255, 255, 0.28);
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.well img {
  width: 100%;
  height: 4.2rem;
  object-fit: cover;
  background: #ddd6ca;
  display: block;
}

.well-headshot img {
  width: 4.2rem;
  height: 4.2rem;
  border-radius: 50%;
}

input[type="file"] {
  font-family: var(--sans);
  font-size: 0.75rem;
  color: var(--muted);
  max-width: 100%;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-top: 1.2rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line);
}

.btn {
  appearance: none;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  padding: 0.7rem 0.8rem;
  cursor: pointer;
}

.btn-primary {
  background: var(--ink);
  color: var(--paper);
}

.btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.text-btn {
  appearance: none;
  border: 0;
  background: none;
  padding: 0;
  font-family: var(--sans);
  font-size: 0.8rem;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  align-self: flex-start;
}

.stage-col {
  padding: 1.4rem 1.4rem 2rem;
  overflow: auto;
}

.stage-caption {
  margin: 0 0 0.85rem;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #5c5248;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.sample-pill {
  display: none;
  letter-spacing: 0.14em;
  font-size: 0.65rem;
  border: 1px solid var(--brass);
  color: #7a6238;
  padding: 0.15rem 0.45rem;
}

.sample-pill.is-on { display: inline-block; }

.flyer-stage {
  display: flex;
  justify-content: center;
}

.flyer-scale {
  transform-origin: top center;
}

.flyer-shadow {
  filter: drop-shadow(0 22px 38px rgba(40, 30, 18, 0.28)) drop-shadow(0 2px 6px rgba(40, 30, 18, 0.14));
}

.flyer {
  width: 8.5in;
  height: 11in;
  background: var(--paper);
  color: var(--ink);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.flyer-hero {
  position: relative;
  flex: 0 0 46%;
  height: 46%;
  overflow: hidden;
  background: #2a241c;
}

.flyer-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 58%;
  display: block;
}

.hero-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(18, 14, 10, 0.66) 0%,
    rgba(18, 14, 10, 0.16) 48%,
    rgba(18, 14, 10, 0.05) 100%
  );
  pointer-events: none;
}

.hero-wordmark {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0.42in;
  text-align: center;
  padding: 0 0.4in;
  z-index: 2;
}

.hero-rule {
  display: block;
  width: 0.92in;
  height: 1.5px;
  background: var(--brass-soft);
  margin: 0 auto 0.14in;
}

.hero-wordmark h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 0.54in;
  letter-spacing: 0.145em;
  text-transform: uppercase;
  color: #f7f1e7;
  line-height: 1;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.32);
}

.sample-flag {
  display: none;
  position: absolute;
  top: 0.28in;
  right: 0.28in;
  z-index: 3;
  font-family: var(--sans);
  font-size: 0.11in;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #f6f1e8;
  border: 1px solid rgba(212, 180, 131, 0.85);
  padding: 0.06in 0.1in;
  background: rgba(20, 16, 12, 0.35);
}

.flyer.is-sample .sample-flag { display: block; }

.flyer-body {
  flex: 1;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding: 0.28in 0.48in 0.22in;
  min-height: 0;
}

.masthead { flex: 0 0 auto; }

.address {
  margin: 0;
  font-family: var(--serif);
  font-size: 0.22in;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.28;
  color: var(--ink);
}

.rule {
  display: block;
  width: 1.15in;
  height: 1.5px;
  background: var(--brass);
  margin: 0.14in 0 0.14in;
}

.price-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.2in;
}

.price-label {
  font-family: var(--sans);
  font-size: 0.105in;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--muted);
}

.price {
  font-family: var(--serif);
  font-size: 0.34in;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1;
}

.thumbs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.12in;
  min-height: 0;
  height: 0;
  margin: 0;
  overflow: hidden;
}

.thumbs.has-photos {
  height: 1.55in;
  margin: 0.14in 0 0.12in;
}

.thumbs img {
  width: 100%;
  height: 1.55in;
  object-fit: cover;
  display: block;
  background: #ddd6ca;
}

.agent-band {
  margin-top: 0;
  display: grid;
  grid-template-columns: 0.82in minmax(0, 1fr) auto;
  gap: 0.14in;
  align-items: center;
  padding-top: 0.14in;
  border-top: 1px solid rgba(176, 141, 87, 0.45);
  background: var(--paper);
  z-index: 2;
}

.headshot {
  width: 0.82in;
  height: 0.82in;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  background: #2a2622;
}

.agent-name {
  font-family: var(--serif);
  font-size: 0.18in;
  font-weight: 600;
  line-height: 1.15;
}

.agent-phone {
  font-family: var(--sans);
  font-size: 0.12in;
  color: var(--ink);
  margin-top: 0.04in;
}

.brokerage {
  font-family: var(--sans);
  font-size: 0.1in;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 0.05in;
  font-weight: 600;
}

.eho {
  font-family: var(--sans);
  font-size: 0.07in;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  justify-self: end;
  align-self: center;
}

.watermark {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 6;
}

.flyer.is-preview .watermark { display: flex; }

.watermark span {
  font-family: var(--serif);
  font-size: 1.28in;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(28, 24, 20, 0.12);
  transform: rotate(-32deg);
  white-space: nowrap;
}

.print-root { margin: 0; background: #fff; }
.print-root .flyer { filter: none; }

@page { size: letter; margin: 0; }

@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .rail { border-right: 0; border-bottom: 1px solid var(--line); }
}

.well img[src=""], .flyer-hero img[src=""] { display: none; }
