/* Lebenslauf-Generator. Colors and buttons as on solideumgesetzt.de (_includes/site.css there),
   system fonts for the page itself; the PDF brings its own fonts. */

:root {
  --bg: #fdf9f3;
  --bg-alt: #f3ede3;
  --surface: #ffffff;
  --ink: #1d2a3a;
  --ink-2: #364354;
  --muted: #5a6575;
  --line: #e6ddcf;
  --field: #ffffff;
  --field-line: #d9cfbf;
  --accent: #0b7a68;
  --accent-hover: #096656;
  --accent-ink: #ffffff;
  --accent-soft: #ddf3ea;
  --sun: #ffc247;
  --sun-soft: #fff1cf;
  --warn: #b42318;
  --warn-soft: #fdecea;
  --page-shadow: 0 1px 2px rgb(29 42 58 / 0.08), 0 14px 36px -18px rgb(29 42 58 / 0.35);
  --radius: 14px;
  --top: 60px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1720;
    --bg-alt: #0b1219;
    --surface: #182330;
    --ink: #edf1f5;
    --ink-2: #c8d1db;
    --muted: #9aa7b5;
    --line: #263445;
    --field: #111b25;
    --field-line: #33465b;
    --accent: #3fd0a8;
    --accent-hover: #67dcbb;
    --accent-ink: #06231b;
    --accent-soft: #123128;
    --sun: #ffcc66;
    --sun-soft: #3a2e12;
    --warn: #ff8f80;
    --warn-soft: #3a1f19;
    --page-shadow: 0 10px 30px -12px rgb(0 0 0 / 0.6);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0f1720;
  --bg-alt: #0b1219;
  --surface: #182330;
  --ink: #edf1f5;
  --ink-2: #c8d1db;
  --muted: #9aa7b5;
  --line: #263445;
  --field: #111b25;
  --field-line: #33465b;
  --accent: #3fd0a8;
  --accent-hover: #67dcbb;
  --accent-ink: #06231b;
  --accent-soft: #123128;
  --warn: #ff8f80;
  --warn-soft: #3a1f19;
  color-scheme: dark;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 0.9375rem/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h2 {
  margin: 0 0 0.4em;
  font-size: 1.2rem;
  letter-spacing: -0.01em;
}

a {
  color: var(--accent);
  text-underline-offset: 0.18em;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 65%, transparent);
  outline-offset: 2px;
  border-radius: 6px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.icon {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  min-height: 44px;
  padding: 0.6em 1.2em;
  border: 1.5px solid transparent;
  border-radius: 11px;
  font: inherit;
  font-weight: 650;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s, transform 0.15s;
}

.btn--primary {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 8px 22px -12px color-mix(in srgb, var(--accent) 80%, transparent);
}

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

.btn--ghost {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

.btn--ghost:hover {
  border-color: var(--muted);
}

.btn--sm {
  min-height: 38px;
  padding: 0.4em 0.9em;
  font-size: 0.875rem;
}

.btn:disabled {
  opacity: 0.6;
  cursor: progress;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.icon-btn:hover:not(:disabled) {
  background: var(--bg-alt);
  color: var(--ink);
}

.icon-btn--danger:hover:not(:disabled) {
  background: var(--warn-soft);
  color: var(--warn);
}

.icon-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 0.18em;
  cursor: pointer;
}

/* Top bar */

.top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--top);
  padding: 0 clamp(12px, 2vw, 24px);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(12px);
  backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  min-width: 0;
}

.brand__mark {
  width: 30px;
  height: 30px;
  flex: none;
}

.brand__mark rect:nth-child(1) {
  fill: #19b38a;
}
.brand__mark rect:nth-child(2) {
  fill: #12967c;
}
.brand__mark rect:nth-child(3) {
  fill: #0b7a68;
}
.brand__mark rect:nth-child(4) {
  fill: #ffc247;
}

.brand__text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand__text b {
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.brand__text small {
  color: var(--muted);
  font-size: 0.75rem;
}

.top__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.top__sep {
  width: 1px;
  height: 24px;
  background: var(--line);
  margin: 0 2px;
}

/* Two panes: form left, preview right */

.app {
  display: grid;
  grid-template-columns: minmax(380px, 520px) 1fr;
  height: calc(100dvh - var(--top));
}

.editor {
  overflow-y: auto;
  padding: 16px clamp(12px, 2vw, 20px) 40px;
  border-right: 1px solid var(--line);
  scrollbar-gutter: stable;
}

.preview {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg-alt);
}

.preview__bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 24px;
  color: var(--muted);
  font-size: 0.8125rem;
}

.preview__title {
  font-weight: 650;
  color: var(--ink-2);
}

.preview__status[data-busy="true"]::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--sun);
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.3;
  }
}

.pages {
  flex: 1;
  overflow-y: auto;
  padding: 4px max(24px, calc((100% - 820px) / 2)) 48px;
}

.page {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 0 20px;
  background: #fff;
  border-radius: 3px;
  box-shadow: var(--page-shadow);
}

/* Cards */

.banner {
  margin-bottom: 14px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--sun-soft);
  border: 1px solid color-mix(in srgb, var(--sun) 50%, transparent);
}

.banner p {
  margin: 0 0 10px;
}

.banner__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.card {
  margin-bottom: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.card--hidden .card__title {
  opacity: 0.55;
}

.card__head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 54px;
  padding: 8px 8px 8px 16px;
  cursor: pointer;
  list-style: none;
  border-radius: var(--radius);
}

.card__head::-webkit-details-marker {
  display: none;
}

.card__head::before {
  content: "";
  width: 8px;
  height: 8px;
  flex: none;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform 0.15s;
  margin-right: 4px;
}

.card[open] > .card__head::before {
  transform: rotate(45deg);
}

.card__title {
  display: flex;
  flex-direction: column;
  font-weight: 700;
  min-width: 0;
}

.card__title small {
  color: var(--muted);
  font-weight: 400;
  font-size: 0.8125rem;
}

.card__actions {
  display: flex;
  gap: 2px;
  margin-left: auto;
}

.card__body {
  padding: 4px 16px 16px;
}

/* Fields */

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
}

.grid--inline {
  grid-template-columns: 1.4fr 1fr;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  margin-bottom: 2px;
}

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

.field label,
.field__label,
.add-section label,
.segmented legend,
.swatches legend {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink-2);
}

input[type="text"],
input[type="email"],
input[type="tel"],
input:not([type]),
textarea,
select {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--field-line);
  border-radius: 9px;
  background: var(--field);
  color: var(--ink);
  font: inherit;
}

textarea {
  resize: vertical;
  line-height: 1.45;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  outline: 2px solid color-mix(in srgb, var(--accent) 35%, transparent);
  outline-offset: 0;
}

input[aria-invalid],
textarea[aria-invalid] {
  border-color: var(--warn);
}

input::placeholder,
textarea::placeholder {
  color: color-mix(in srgb, var(--muted) 75%, transparent);
}

.field__hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.field__warn {
  margin: 0;
  color: var(--warn);
  font-size: 0.78rem;
}

.field__static {
  margin: 0;
  min-height: 40px;
  display: flex;
  align-items: center;
  color: var(--muted);
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.875rem;
}

.check input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.items {
  list-style: none;
  margin: 12px 0;
  padding: 0;
}

.item {
  padding: 10px 12px 12px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: color-mix(in srgb, var(--bg) 55%, var(--surface));
}

.item__bar {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: -4px -6px 6px 0;
}

.item__label {
  margin-right: auto;
  font-size: 0.75rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.add-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 18px 0;
  padding: 14px 16px;
  border: 1.5px dashed var(--field-line);
  border-radius: var(--radius);
}

.add-section__row {
  display: flex;
  gap: 8px;
}

.add-section__row select {
  flex: 1;
}

/* Photo and signature */

.photo {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 12px;
}

.photo__img,
.photo__empty {
  width: 72px;
  height: 90px;
  flex: none;
  border-radius: 10px;
  object-fit: cover;
}

.photo__empty {
  display: grid;
  place-items: center;
  background: var(--bg-alt);
  color: var(--muted);
}

.photo__empty .icon {
  width: 26px;
  height: 26px;
}

.photo__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.photo__actions .field__hint {
  flex-basis: 100%;
}

.signature {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.signature__img {
  max-width: 220px;
  max-height: 70px;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

/* Design panel */

.card--design .card__body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.templates {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.template {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px 6px;
  border: 1.5px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  hyphens: auto;
  overflow-wrap: anywhere;
  text-align: center;
}

.template[aria-checked="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.thumb {
  width: 100%;
  max-width: 64px;
  color: #1f2933;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.18);
}

.templates__hint {
  margin: -6px 0 0;
  color: var(--muted);
  font-size: 0.8125rem;
}

.design-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: start;
}

fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.swatches__row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 6px;
}

.swatch {
  position: relative;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 0 1px var(--line);
  cursor: pointer;
}

.swatch[aria-pressed="true"] {
  box-shadow: 0 0 0 2px var(--ink);
}

.swatch--custom {
  overflow: hidden;
  background: conic-gradient(#e5484d, #ffc247, #19b38a, #2459c4, #7c4ddb, #e5484d);
}

.swatch--custom input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.segmented__options {
  display: flex;
  margin-top: 6px;
  border: 1px solid var(--field-line);
  border-radius: 9px;
  overflow: hidden;
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented label {
  flex: 1;
  padding: 7px 6px;
  text-align: center;
  font-size: 0.8125rem;
  cursor: pointer;
}

.segmented label + input + label,
.segmented input + label:not(:first-of-type) {
  border-left: 1px solid var(--field-line);
}

.segmented input:checked + label {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 650;
}

.segmented input:focus-visible + label {
  outline: 3px solid color-mix(in srgb, var(--accent) 65%, transparent);
  outline-offset: -3px;
}

.toggles {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toggle label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
}

.toggle input {
  position: absolute;
  opacity: 0;
}

.toggle__track {
  position: relative;
  width: 38px;
  height: 22px;
  flex: none;
  border-radius: 11px;
  background: var(--field-line);
  transition: background-color 0.15s;
}

.toggle__track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s;
}

.toggle input:checked + .toggle__track {
  background: var(--accent);
}

.toggle input:checked + .toggle__track::after {
  transform: translateX(16px);
}

.toggle input:focus-visible + .toggle__track {
  outline: 3px solid color-mix(in srgb, var(--accent) 65%, transparent);
  outline-offset: 2px;
}

.toggle .field__hint {
  margin: 4px 0 0 48px;
}

/* Footer of the form */

/* Until app.js has built design panel and form, their space is reserved and the footer is not
   shown, so nothing jumps (Lighthouse measured a layout shift of 0.82 on phones before). */
body:not([data-ready="true"]) .editor__footer {
  display: none;
}

#design:empty {
  min-height: 480px;
}

#form:empty {
  min-height: 100vh;
}

/* Grey A4 page while the first PDF is being made. */
.pages:empty::before {
  content: "";
  display: block;
  width: 100%;
  aspect-ratio: 595 / 842;
  border-radius: 3px;
  background: var(--surface);
  box-shadow: var(--page-shadow);
  opacity: 0.6;
}

.editor__footer {
  margin-top: 28px;
  color: var(--muted);
  font-size: 0.8125rem;
}

.privacy {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--ink-2);
}

.privacy .icon {
  color: var(--accent);
  margin-top: 2px;
}

.links {
  text-align: center;
}

/* Language switch (_includes/langs.html): in the top bar from 560px, below the footer always.
   On phones the top bar has no room left. */

.langs {
  display: flex;
  gap: 2px;
}

.langs a {
  padding: 4px 6px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-decoration: none;
}

.langs a:hover {
  color: var(--ink);
}

.langs a[aria-current] {
  color: var(--accent);
}

.langs--top {
  margin-left: 4px;
}

.top > .langs--top:last-child {
  margin-left: auto;
}

.langs--footer {
  justify-content: center;
  margin-top: 4px;
}

@media (max-width: 559px) {
  .langs--top {
    display: none;
  }
}

/* Toast, drop zone, dialogs */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 40;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  max-width: min(560px, calc(100vw - 32px));
  padding: 12px 16px;
  transform: translateX(-50%);
  border-radius: 12px;
  background: var(--ink);
  color: var(--bg);
  box-shadow: 0 16px 40px -12px rgb(0 0 0 / 0.45);
  font-size: 0.875rem;
}

.toast[data-kind="error"] .icon {
  color: #ffb4a8;
}

.dropzone {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  border: 4px dashed var(--accent);
  pointer-events: none;
}

.dropzone p {
  padding: 16px 24px;
  border-radius: 12px;
  background: var(--surface);
  font-weight: 650;
}

.dialog {
  width: min(420px, calc(100vw - 32px));
  padding: 20px;
  border: 0;
  border-radius: 16px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 30px 80px -20px rgb(0 0 0 / 0.5);
}

.dialog::backdrop {
  background: rgb(15 23 32 / 0.55);
}

.dialog__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.crop {
  position: relative;
  width: min(260px, 100%);
  aspect-ratio: 4 / 5;
  margin: 14px auto 10px;
  overflow: hidden;
  border-radius: 8px;
  background: #ddd;
  cursor: grab;
  touch-action: none;
}

.crop img {
  position: absolute;
  max-width: none;
  user-select: none;
  pointer-events: none;
}

.crop__circle {
  position: absolute;
  left: 0;
  right: 0;
  top: 6%;
  aspect-ratio: 1;
  border-radius: 50%;
  box-shadow: 0 0 0 999px rgb(0 0 0 / 0.28);
  outline: 2px dashed rgb(255 255 255 / 0.85);
  pointer-events: none;
}

.crop__zoom {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.875rem;
}

.crop__zoom input {
  flex: 1;
  accent-color: var(--accent);
}

.signature-pad {
  display: block;
  width: 100%;
  height: 160px;
  margin-top: 10px;
  border: 1px dashed var(--field-line);
  border-radius: 10px;
  background: #fff;
  touch-action: none;
  cursor: crosshair;
}

.noscript {
  padding: 24px;
  text-align: center;
}

.mobile-bar {
  display: none;
}

/* Phones and small tablets: one pane at a time, bar at the bottom */

@media (max-width: 899px) {
  .app {
    display: block;
    height: auto;
  }

  .editor {
    overflow: visible;
    border: 0;
    padding-bottom: 96px;
  }

  .preview {
    min-height: calc(100dvh - var(--top));
    padding-bottom: 80px;
  }

  body[data-view="edit"] .preview,
  body[data-view="preview"] .editor {
    display: none;
  }

  .pages {
    padding: 4px 12px 24px;
    overflow: visible;
  }

  .preview__bar {
    padding: 10px 16px;
  }

  .top__actions .btn span,
  #download-pdf,
  .top__sep {
    display: none;
  }

  .top__actions .btn {
    padding: 0.4em 0.65em;
  }

  .mobile-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    display: flex;
    gap: 8px;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    background: var(--surface);
    border-top: 1px solid var(--line);
  }

  .mobile-bar [data-view-target] {
    flex: 1;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-weight: 600;
  }

  .mobile-bar [aria-pressed="true"] {
    background: var(--accent-soft);
    border-color: var(--accent);
  }

  .toast {
    bottom: 84px;
  }
}

@media (max-width: 480px) {
  .grid,
  .grid--inline,
  .design-row {
    grid-template-columns: 1fr;
  }

  .brand__text small {
    display: none;
  }

  .templates {
    gap: 6px;
  }
}

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

/* Simple text pages (Lizenzen) */

body.plain {
  min-height: 100dvh;
}

.legal {
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 16px 64px;
}

.legal h1 {
  margin: 0 0 0.5em;
  font-size: clamp(1.6rem, 1.2rem + 2vw, 2.2rem);
  letter-spacing: -0.02em;
}

.legal h2 {
  margin-top: 1.6em;
}

.legal li {
  margin-bottom: 0.5em;
}
