:root {
  --wl-teal: #113c3d;
  --wl-teal-dark: #0a2829;
  --wl-orange: #f3752b;
  --wl-orange-hover: #e0651f;
  --wl-bg: #f5f8f6;
  --wl-surface: #ffffff;
  --wl-text: #1b1d1d;
  --wl-muted: #6a6a6a;
  --wl-border: #e7e6e6;
  --wl-success: #1a7a4c;
  --wl-error: #c0392b;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(17, 60, 61, 0.08);
  --font: "DM Sans", system-ui, sans-serif;
  --film-edge: rgba(160, 156, 150, 0.55);
  --film-edge-line: rgba(140, 136, 130, 0.4);
  --film-milky: #f5f3ef;
}

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

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--wl-text);
  background: var(--wl-bg);
}

.wrap {
  width: min(1400px, 100% - 2rem);
  margin-inline: auto;
}

.site-header {
  background: #fff;
  border-bottom: 1px solid var(--wl-border);
  box-shadow: 0 1px 8px rgba(17, 60, 61, 0.06);
  padding: 0.85rem 1rem;
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  max-width: 100%;
}

.brand img {
  display: block;
  width: min(220px, 58vw);
  height: auto;
  max-height: 52px;
}

.tagline {
  margin: 0;
  font-size: 0.875rem;
  color: var(--wl-muted);
  font-weight: 600;
}

.prints-main {
  padding: 1.5rem 0 3rem;
  display: grid;
  gap: 1.5rem;
}

.prints-intro {
  padding: 0;
}

.prints-intro h1 {
  margin: 0 0 0.35rem;
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  color: var(--wl-teal);
}

.lead {
  margin: 0;
  color: var(--wl-muted);
  max-width: 52rem;
}

/* Panels — match jobs.wearlab.co.nz */
.panel {
  background: var(--wl-surface);
  border: 1px solid #2b2b2b;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.5rem;
}

.panel-head {
  margin-bottom: 1rem;
}

.panel-head h2 {
  margin: 0 0 0.25rem;
  font-size: 1.25rem;
  color: var(--wl-teal);
}

.panel-desc {
  margin: 0;
  font-size: 0.875rem;
  color: var(--wl-muted);
}

.panel-head-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.panel-head-row .panel-desc {
  margin-bottom: 0;
}

.panel-head-row .panel-desc + .film-library-empty {
  margin: 0.2rem 0 0;
}

.film-library .panel-head {
  margin-bottom: 0.75rem;
}

.panel-film {
  padding: 1.25rem 0 0;
  overflow: hidden;
}

.panel-film > .panel-head {
  padding-inline: 1.5rem;
  margin-bottom: 0.85rem;
}

.film-library-empty {
  margin: 0;
  font-size: 0.875rem;
  color: var(--wl-muted);
}

.film-library-empty[hidden] {
  display: none;
}

.upload-status {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  color: var(--wl-muted);
}

.upload-status:empty {
  display: none;
}

.upload-status.warn {
  color: var(--wl-error);
}

.artwork-thumbs {
  list-style: none;
  margin: 0;
  padding: 0.35rem 0.15rem;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 0.65rem;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

.artwork-thumb {
  position: relative;
  flex: 0 0 132px;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  background: #fff;
  border: 1px solid #2b2b2b;
  border-radius: 8px;
  overflow: hidden;
}

.artwork-thumb__frame {
  position: relative;
  width: 100%;
}

.artwork-thumb__preview {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  background: repeating-conic-gradient(#eee 0% 25%, #fff 0% 50%) 50% / 16px 16px;
  cursor: grab;
}

.artwork-thumb__preview:active {
  cursor: grabbing;
}

.artwork-thumb--dragging {
  opacity: 0.45;
}

.artwork-drag-ghost-wrap {
  position: fixed;
  top: -1000px;
  left: -1000px;
  z-index: 9999;
  width: 120px;
  height: 120px;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 2px solid var(--wl-orange);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(17, 60, 61, 0.22);
  pointer-events: none;
}

.artwork-drag-ghost-wrap img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.artwork-thumb__meta {
  padding: 0.3rem 0.45rem;
  font-size: 0.68rem;
  color: var(--wl-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.artwork-thumb-actions {
  display: flex;
  flex-direction: row;
  gap: 0.25rem;
  padding: 0 0.45rem 0.45rem;
  margin-top: auto;
}

.artwork-thumb-edit,
.artwork-thumb-delete {
  flex: 1;
  min-width: 0;
  padding: 0.3rem 0.25rem;
  font-size: 0.62rem;
  line-height: 1.2;
  border-radius: 4px;
  border: 1px solid var(--wl-border);
  background: #f4f7f7;
  cursor: pointer;
  font-weight: 700;
  font-family: inherit;
  letter-spacing: 0.03em;
}

.artwork-thumb-edit {
  color: var(--wl-teal);
}

.artwork-thumb-delete {
  color: var(--wl-error);
}

.artwork-thumb-edit:hover:not(:disabled),
.artwork-thumb-edit:focus-visible:not(:disabled) {
  background: #e8f0f0;
  border-color: var(--wl-teal);
}

.artwork-thumb-delete:hover:not(:disabled),
.artwork-thumb-delete:focus-visible:not(:disabled) {
  background: #fdeeed;
  border-color: var(--wl-error);
}

.artwork-thumb-edit:disabled,
.artwork-thumb-delete:disabled {
  opacity: 0.55;
  cursor: wait;
}

.artwork-thumb--bg-removed {
  border-color: #9ecfb8;
}

.artwork-thumb__badge {
  align-self: center;
  margin: 0.35rem 0.45rem 0.2rem;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  color: #fff;
  line-height: 1.2;
}

.artwork-thumb__badge--low-res {
  background: #e8a040;
}

.artwork-thumb__badge--high-res {
  background: #1a4fd6;
}

.film-belt-zone {
  display: flex;
  flex-direction: column;
  min-width: 0;
  position: relative;
  background: #ffffff;
  --film-height: 278px;
}

.film-belt-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: stretch;
}

.film-printer {
  grid-column: 1;
  grid-row: 1;
  align-self: start;
  margin-top: calc(1.1rem + 3px);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 0.5rem 0 0.65rem;
  background: #ffffff;
  border-right: 1px solid var(--wl-border);
  z-index: 2;
  box-sizing: border-box;
}

.film-belt-scroll {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  background: #ffffff;
  padding: 0;
  box-sizing: border-box;
}

.film-meter-price-row {
  grid-column: 2;
  grid-row: 2;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 0.65rem 0.75rem 0.85rem 0.35rem;
  border-top: 1px solid rgba(17, 60, 61, 0.08);
  background: #ffffff;
}

.film-price-tag {
  position: relative;
  width: 10.5rem;
  margin: 0;
  pointer-events: none;
  transform: rotate(-3deg);
  transform-origin: center center;
  filter: drop-shadow(0 3px 8px rgba(17, 60, 61, 0.18));
  line-height: 1;
}

.film-price-tag__img {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
}

.film-price-tag__price {
  position: absolute;
  top: 50%;
  left: 38%;
  right: 8%;
  transform: translateY(-52%);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.1rem;
  line-height: 1;
}

.film-price-tag__estimated {
  font-family: "Trebuchet MS", Trebuchet, sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  font-style: italic;
  color: #c41e1e;
  letter-spacing: 0.02em;
  text-transform: lowercase;
  line-height: 1;
}

.film-price-tag__amount {
  font-size: 1.35rem;
  font-weight: 800;
  color: #1a4fd6;
  letter-spacing: -0.02em;
  line-height: 1;
  white-space: nowrap;
}

.film-belt-scroll-content {
  display: flex;
  flex-direction: column;
  min-width: 100%;
}

.film-belt-ruler {
  position: relative;
  height: 1.1rem;
  flex-shrink: 0;
  margin-bottom: 3px;
  border-bottom: 1px solid rgba(17, 60, 61, 0.08);
  pointer-events: none;
  user-select: none;
  overflow: hidden;
}

.film-meter-mark {
  position: absolute;
  bottom: 0;
  transform: translateX(-50%);
  padding-bottom: 2px;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgba(106, 106, 106, 0.85);
  white-space: nowrap;
}

.film-meter-mark::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 100%;
  width: 1px;
  height: 5px;
  margin-bottom: 1px;
  background: rgba(106, 106, 106, 0.35);
  transform: translateX(-50%);
}

.film-belt-track {
  position: relative;
  display: flex;
  align-items: stretch;
  min-height: 100%;
  height: 100%;
}

.film-meter-lines {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  --film-meter-line: rgba(106, 106, 106, 0.2);
  background-image: repeating-linear-gradient(
    to right,
    transparent 0,
    transparent calc(var(--meter-px, 897px) - 1px),
    var(--film-meter-line) calc(var(--meter-px, 897px) - 1px),
    var(--film-meter-line) var(--meter-px, 897px)
  );
}

.film-belt-surface {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(
      180deg,
      var(--film-edge-line) 0,
      var(--film-edge-line) 1px,
      transparent 1px,
      transparent calc(100% - 1px),
      var(--film-edge-line) calc(100% - 1px),
      var(--film-edge-line) 100%
    ),
    var(--film-milky);
  border-top: 1px solid var(--film-edge);
  border-bottom: 1px solid var(--film-edge);
  box-shadow:
    0 0 0 1px rgba(17, 60, 61, 0.06),
    0 2px 10px rgba(17, 60, 61, 0.07);
  pointer-events: none;
}

.film-belt-track canvas {
  display: block;
  position: relative;
  z-index: 1;
  z-index: 1;
}

.film-printer-media {
  position: relative;
  flex: 0 0 var(--film-height);
  height: var(--film-height);
  width: auto;
}

.film-printer-img {
  display: block;
  height: 100%;
  width: auto;
  object-fit: contain;
  object-position: center right;
}

.quality-warning {
  margin: 1rem auto 0;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  background: #fff8ee;
  border: 1px solid #e8a040;
  color: #8a5a00;
  font-size: 0.9rem;
}

.quality-warning[hidden] {
  display: none;
}

.film-selection-banner {
  border-top: 1px solid var(--wl-border);
  background: #fafafa;
  font-size: 0.925rem;
  line-height: 1.45;
}

.film-selection-banner[hidden] {
  display: none;
}

.film-selection-banner-inner {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  padding: 0.75rem 1.5rem;
}

.film-selection-banner__size {
  margin: 0;
  color: var(--wl-text);
  font-weight: 500;
  width: 100%;
}

.film-selection-banner__quality {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0;
  width: 100%;
  font-size: 0.875rem;
}

.film-selection-banner__quality--ok {
  color: var(--wl-success);
}

.film-selection-banner__quality--warn {
  color: var(--wl-error);
}

.film-selection-banner__icon {
  flex-shrink: 0;
  width: 1.125rem;
  height: 1.125rem;
  margin-top: 0.1rem;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

.film-selection-banner__quality--ok .film-selection-banner__icon {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%231a7a4c'%3E%3Cpath fill-rule='evenodd' d='M16.707 5.293a1 1 0 0 1 0 1.414l-7.25 7.25a1 1 0 0 1-1.414 0l-3.25-3.25a1 1 0 1 1 1.414-1.414L8.75 11.836l6.543-6.543a1 1 0 0 1 1.414 0Z' clip-rule='evenodd'/%3E%3C/svg%3E");
}

.film-selection-banner__quality--warn .film-selection-banner__icon {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23c0392b'%3E%3Cpath fill-rule='evenodd' d='M4.293 4.293a1 1 0 0 1 1.414 0L10 8.586l4.293-4.293a1 1 0 1 1 1.414 1.414L11.414 10l4.293 4.293a1 1 0 0 1-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 0 1-1.414-1.414L8.586 10 4.293 5.707a1 1 0 0 1 0-1.414Z' clip-rule='evenodd'/%3E%3C/svg%3E");
}

.submit-panel .panel-head {
  margin-bottom: 1rem;
}

.prints-form {
  margin: 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.field--full {
  grid-column: 1 / -1;
}

.field label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.875rem;
  font-weight: 600;
}

.optional {
  font-weight: 400;
  color: var(--wl-muted);
}

.field input,
.field textarea {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--wl-border);
  border-radius: 8px;
  font: inherit;
}

.field input:focus,
.field textarea:focus {
  outline: 2px solid var(--wl-teal);
  outline-offset: 1px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.55rem 1.1rem;
  border-radius: 8px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.15s, opacity 0.15s;
}

.btn-primary {
  background: var(--wl-orange);
  color: #fff;
}

.btn-primary:hover {
  background: var(--wl-orange-hover);
}

.btn-secondary {
  background: #fff;
  color: var(--wl-teal);
  border: 1px solid var(--wl-border);
}

.btn-secondary:hover {
  background: var(--wl-bg);
}

.btn-save {
  background: #1a4fd6;
  color: #fff;
}

.btn-save:hover:not(:disabled) {
  background: #153eb8;
}

.btn-danger {
  background: var(--wl-error);
  color: #fff;
}

.btn-danger:hover:not(:disabled) {
  background: #a93226;
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.875rem;
}

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

.form-message {
  margin: 1rem 0 0.75rem;
  font-size: 0.9rem;
}

.form-message.ok {
  color: var(--wl-success);
}

.form-message.err {
  color: var(--wl-error);
}

.site-footer {
  margin-top: 2rem;
  padding: 1.25rem 1rem;
  border-top: 1px solid var(--wl-border);
  background: #fff;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--wl-muted);
}

.footer-inner a {
  color: var(--wl-teal);
}

.bg-removal-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(17, 60, 61, 0.45);
  padding: 1rem;
}

.bg-removal-modal[hidden] {
  display: none !important;
}

.bg-removal-modal__panel {
  background: #fff;
  border-radius: var(--radius);
  padding: 1.5rem;
  max-width: 24rem;
  width: 100%;
  box-shadow: var(--shadow);
  text-align: center;
}

.crop-modal {
  position: fixed;
  inset: 0;
  z-index: 205;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.crop-modal[hidden] {
  display: none !important;
}

.crop-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 60, 61, 0.45);
}

.crop-modal__card {
  position: relative;
  width: fit-content;
  max-width: calc(100% - 2.5rem);
  max-height: min(92vh, 44rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.15rem 1.25rem 1.1rem;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.crop-modal__head {
  width: 100%;
  max-width: 100%;
  margin-bottom: 0.75rem;
  text-align: center;
}

.crop-modal__title {
  margin: 0 0 0.25rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--wl-teal);
}

.crop-modal__filename {
  margin: 0 0 0.35rem;
  font-size: 0.8rem;
  color: var(--wl-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crop-modal__stage-wrap {
  display: flex;
  justify-content: center;
  max-height: min(58vh, 28rem);
  overflow: auto;
}

.crop-modal__stage {
  flex: 0 0 auto;
  overflow: visible;
  border: 1px solid var(--wl-border);
  border-radius: 8px;
  background: #fff;
  line-height: 0;
}

.crop-modal__stage .upper-canvas {
  overflow: visible;
}

.crop-modal__stage .canvas-container {
  margin: 0 !important;
}

.crop-modal__stage .canvas-container,
.crop-modal__stage canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.crop-modal__footer {
  margin-top: 1rem;
  width: 100%;
}

.crop-modal__buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.crop-modal__buttons .btn {
  min-width: 6.5rem;
}

.bg-removal-spinner {
  width: 2.5rem;
  height: 2.5rem;
  margin: 1rem auto;
  border: 3px solid var(--wl-border);
  border-top-color: var(--wl-orange);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

body.bg-removal-modal-open,
body.crop-modal-open {
  overflow: hidden;
}

@media (max-width: 639px) {
  .crop-modal__buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    width: 100%;
  }

  .crop-modal__buttons #crop-modal-crop,
  .crop-modal__buttons #crop-modal-remove-bg,
  .crop-modal__buttons #crop-modal-rotate {
    grid-column: 1 / -1;
    min-width: 0;
    width: 100%;
  }

  .crop-modal__buttons #crop-modal-cancel,
  .crop-modal__buttons #crop-modal-save {
    min-width: 0;
    width: 100%;
  }
}

@media (max-width: 768px) {
  .panel {
    padding: 1rem;
  }

  .panel-film {
    padding-top: 1rem;
  }

  .panel-film > .panel-head {
    padding-inline: 1rem;
  }

  .film-selection-banner-inner {
    flex-direction: column;
    align-items: flex-start;
    padding-inline: 1rem;
  }

  .artwork-thumb {
    flex: 0 0 112px;
  }

  .film-printer {
    padding: 0 0.35rem 0 0.35rem;
  }

  .film-price-tag {
    width: 8.5rem;
  }

  .film-price-tag__amount {
    font-size: 1.15rem;
  }

  .film-price-tag__estimated {
    font-size: 0.7rem;
  }
}
