@import url('https://fonts.googleapis.com/css2?family=Berkshire+Swash&family=DM+Sans:wght@400;500;600;700&family=Playfair+Display:wght@500;600&display=swap');

@font-face {
  font-family: "GoudySans";
  src: url("/fonts/GoudySans%20Regular/GoudySans%20Regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "GoudySans";
  src: url("/fonts/GoudySans%20Bold/GoudySans%20Bold.ttf") format("truetype");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "GoudySans";
  src: url("/fonts/GoudySans%20Italic/GoudySans%20Italic.ttf") format("truetype");
  font-style: italic;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "GoudySans";
  src: url("/fonts/GoudySans%20Bold%20Italic/GoudySans%20Bold%20Italic.ttf") format("truetype");
  font-style: italic;
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: light;
  --ink: #23241f;
  --muted: #77786f;
  --line: #e7e4dc;
  --paper: #fffefa;
  --gold: #a9863f;
  --green: #355342;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #f5f4ef;
  color: var(--ink);
  font-family: "DM Sans", "Segoe UI", sans-serif;
}

.topbar {
  height: 82px;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 0 34px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.brand-home {
  display: block;
  flex: 0 0 44px;
  border-radius: 10px;
}

.brand-home:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.brand-mark {
  display: block;
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.topbar h1,
.panel-heading h2,
.preview-heading h2 {
  margin: 0;
  font-family: "Playfair Display", Georgia, serif;
  font-weight: 500;
}

.topbar h1 {
  font-size: 20px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .16em;
}

.topbar-note {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
}

.workspace {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 1540px;
  margin: 0 auto;
  padding: 28px;
}

.editor-panel,
.preview-panel {
  min-width: 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 26px rgb(34 34 27 / 4%);
}

.editor-panel {
  padding: 25px 27px 19px;
}

.panel-heading,
.preview-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-heading {
  margin-bottom: 22px;
}

.panel-heading h2,
.preview-heading h2 {
  font-size: 23px;
}

.format-tag {
  color: #77786f;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .1em;
}

.manual-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 18px;
}

.field-span-2 {
  grid-column: 1 / -1;
}

.name-input-row {
  display: flex;
  align-items: stretch;
  gap: 0;
  overflow: hidden;
  border: 1px solid #e4e2db;
  border-radius: 5px;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}

.name-input-row:focus-within {
  border-color: #9caa9e;
  box-shadow: 0 0 0 3px rgb(53 83 66 / 9%);
}

.name-input-row>input {
  min-width: 0;
  flex: 1;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.name-input-row>input:focus {
  border: 0;
  box-shadow: none;
}

.font-stepper {
  display: flex;
  align-items: center;
  gap: 3px;
  flex: 0 0 auto;
  padding: 3px 6px 3px 9px;
  border-left: 1px solid #eeeae2;
  background: #fff;
}

.font-size-input {
  width: 49px;
  min-width: 0;
  min-height: 28px;
  padding: 3px 2px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #383a34;
  font: 11px "DM Sans", "Segoe UI", sans-serif;
  text-align: right;
  appearance: textfield;
  -moz-appearance: textfield;
}

.font-size-input::-webkit-inner-spin-button,
.font-size-input::-webkit-outer-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

.font-size-input:focus {
  border: 0;
  box-shadow: none;
}

.font-size-unit {
  color: #77786f;
  font-size: 10px;
}

.stepper-buttons {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-left: 4px;
}

.stepper-buttons button {
  display: grid;
  width: 21px;
  height: 16px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: #686a61;
  cursor: pointer;
}

.stepper-buttons svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.stepper-buttons button:hover {
  background: #f0eee7;
  color: var(--green);
}

.ollama-assist {
  margin: 2px 0 18px;
  border: 1px solid #e7e2d5;
  border-radius: 7px;
  background: #f8f6f0;
}

.ollama-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 0 15px;
  color: #393b32;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  list-style: none;
}

.ollama-toggle::-webkit-details-marker {
  display: none;
}

.assist-star {
  margin-right: 5px;
  color: var(--gold);
}

.toggle-icon {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  color: #77786f;
  transition: transform .18s ease;
}

.ollama-assist[open] .toggle-icon {
  transform: rotate(180deg);
}

.ollama-content {
  padding: 0 15px 15px;
}

.ollama-content .field {
  margin-bottom: 12px;
}

.ollama-content textarea {
  min-height: 84px;
}

.character-count {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
  text-align: right;
}

.remember-password {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: -2px 0 12px;
  color: #55574f;
  font-size: 10px;
}

.remember-password input {
  display: inline-block;
  width: auto;
  min-height: 0;
  margin: 0;
  accent-color: var(--green);
}

.button-assist {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 43px;
  padding: 0 16px;
  background: var(--green);
  color: white;
}

.button-assist:hover {
  background: #294435;
}

.assist-button-icon {
  width: 17px;
  height: 17px;
}

.button:disabled {
  cursor: wait;
  opacity: .65;
  transform: none;
}

.privacy-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.ollama-status {
  min-height: 14px;
  margin: 7px 0 0;
  color: var(--green);
  font-size: 10px;
  line-height: 1.4;
}

.ollama-status.error {
  color: #9b3b32;
}

.field {
  display: block;
  min-width: 0;
  margin-bottom: 15px;
}

.field>span {
  display: block;
  margin-bottom: 7px;
  color: #383a34;
  font-size: 11px;
  font-weight: 700;
}

.field small {
  color: #8b8b83;
  font-size: 10px;
  font-weight: 400;
}

.field output {
  float: right;
  color: #77786f;
  font-size: 10px;
  font-weight: 500;
}

input,
textarea,
select {
  display: block;
  width: 100%;
  min-height: 39px;
  padding: 9px 11px;
  border: 1px solid #e4e2db;
  border-radius: 5px;
  outline: none;
  background: #fff;
  color: var(--ink);
  font: 12px/1.5 "DM Sans", "Segoe UI", sans-serif;
  transition: border-color .15s, box-shadow .15s;
}

textarea {
  resize: vertical;
  min-height: 83px;
}

input:focus,
textarea:focus,
select:focus {
  border-color: #9caa9e;
  box-shadow: 0 0 0 3px rgb(53 83 66 / 9%);
}

.field-label {
  display: block;
  margin-bottom: 7px;
  color: #383a34;
  font-size: 11px;
  font-weight: 700;
}

.field-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
}

.field-heading .field-label {
  min-width: 0;
  margin: 0;
}

.alignment-select {
  flex: 0 0 auto;
  width: auto;
  min-width: 108px;
  min-height: 31px;
  padding: 5px 26px 5px 8px;
  font-size: 10px;
}

.photo-upload {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 72px;
  padding: 11px 14px;
  border: 1px dashed #cfc8b8;
  border-radius: 6px;
  background: #fcfbf8;
  cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s;
}

.photo-upload:hover,
.photo-upload.dragover {
  border-color: #9c895f;
  background: #f7f4ec;
}

.photo-upload:focus-within {
  border-color: #9caa9e;
  box-shadow: 0 0 0 3px rgb(53 83 66 / 9%);
}

.photo-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

.photo-icon {
  display: grid;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid #e8e2d4;
  border-radius: 6px;
  background: #f5f1e8;
  color: var(--gold);
}

.photo-icon svg {
  width: 20px;
  height: 20px;
}

.photo-copy {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.photo-copy strong {
  overflow: hidden;
  color: #363830;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.photo-copy small {
  color: var(--muted);
  font-size: 10px;
}

.photo-action {
  margin-left: auto;
  padding: 7px 10px;
  border: 1px solid #e1ddd3;
  border-radius: 4px;
  background: white;
  color: #4a4b43;
  font-size: 10px;
  font-weight: 700;
}

.select-wrap {
  position: relative;
  display: block;
}

.select-wrap select {
  appearance: none;
  padding-right: 42px;
}

.select-chevron {
  position: absolute;
  top: 50%;
  right: 13px;
  width: 17px;
  height: 17px;
  color: #686a61;
  pointer-events: none;
  transform: translateY(-50%);
}

.editor-footer {
  padding-top: 2px;
}

.editor-footer>p:first-child {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 10px;
}

.actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.button-reset {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  gap: 6px;
  width: auto;
  min-height: 34px;
  padding: 0 10px;
  border-color: #e4e2db;
  color: #686a61;
  font-size: 10px;
}

.button-reset:hover {
  border-color: #cfc8b8;
  background: #f7f5f0;
}

.reset-icon {
  width: 17px;
  height: 17px;
}

.button {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 5px;
  cursor: pointer;
  font: 700 11px "DM Sans", "Segoe UI", sans-serif;
  transition: transform .12s, background .12s;
}

.button:hover {
  transform: translateY(-1px);
}

.button-primary {
  background: var(--green);
  color: white;
}

.button-primary:hover {
  background: #294435;
}

.button-secondary {
  border-color: #dcd9d0;
  background: white;
  color: #3c4039;
}

.button-icon {
  width: 16px;
  height: 16px;
  margin-right: 6px;
  vertical-align: -3px;
}

.status {
  min-height: 14px;
  margin: 8px 0 0;
  color: var(--green);
  font-size: 10px;
}

.preview-panel {
  display: flex;
  flex-direction: column;
  padding: 25px;
}

.preview-heading {
  margin-bottom: 20px;
}

.format-tag {
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.canvas-wrap {
  display: grid;
  flex: 1;
  place-items: center;
  min-height: 450px;
  padding: 22px;
  overflow: hidden;
  background: #f0efe9;
  border: 1px solid #e8e6df;
  border-radius: 6px;
}

#poster {
  display: block;
  width: min(100%, 1120px);
  height: auto;
  background: white;
  box-shadow: 0 6px 22px rgb(32 31 25 / 13%);
}

.preview-note {
  margin: 13px 0 0;
  color: var(--muted);
  font-size: 10px;
  text-align: right;
}

@media (max-width: 1000px) {
  .workspace {
    gap: 16px;
    padding: 18px;
  }

  .editor-panel,
  .preview-panel {
    padding: 20px;
  }

  .canvas-wrap {
    min-height: 0;
    padding: 12px;
  }
}

@media (max-width: 740px) {
  .topbar {
    height: 70px;
    padding: 0 17px;
  }

  .topbar-note {
    display: none;
  }

  .workspace {
    display: flex;
    flex-direction: column;
    padding: 13px;
  }

  .manual-fields {
    grid-template-columns: 1fr;
  }

  .field-span-2 {
    grid-column: auto;
  }

  .preview-panel {
    order: 0;
  }

  .canvas-wrap {
    min-height: 0;
    padding: 10px;
  }
}

@media print {
  @page {
    size: A4 landscape;
    margin: 4mm;
  }

  html,
  body {
    width: 289mm;
    height: 202mm;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden;
  }

  body {
    background: white;
  }

  .topbar,
  .editor-panel,
  .preview-heading,
  .preview-note {
    display: none !important;
  }

  .workspace {
    display: block;
    width: 289mm;
    height: 202mm;
    min-height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
  }

  .preview-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .canvas-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-height: 0;
    padding: 0;
    border: 0;
    background: white;
  }

  #poster {
    width: auto;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    box-shadow: none;
  }
}