:root {
  --bg: #f3f4f8;
  --surface: #ffffff;
  --surface-soft: #f7f8fb;
  --text: #232631;
  --muted: #6b7280;
  --line: #dde2ea;
  --line-strong: #cfd6e2;
  --accent: #e5322d;
  --accent-dark: #c62824;
  --accent-soft: #fff1f0;
  --shadow: 0 18px 48px rgba(17, 24, 39, 0.08);
}

body.theme-sunrise,
body.theme-forest,
body.theme-copper,
body.theme-berry,
body.theme-ocean,
body.theme-midnight,
body.theme-gold,
body.theme-ember,
body.theme-home {
  --accent: #e5322d;
  --accent-dark: #c62824;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Outfit", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top right, rgba(229, 50, 45, 0.08), transparent 22%),
    linear-gradient(180deg, #f7f8fb 0%, #eef1f6 100%);
  min-height: 100vh;
}

a {
  color: inherit;
}

.site-shell {
  min-height: 100vh;
}

.site-footer {
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
}

.site-footer .page-shell {
  padding-top: 18px;
  padding-bottom: 18px;
}

.site-footer p {
  margin: 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 500;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(221, 226, 234, 0.9);
}

.header-inner,
.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 72px;
}

.page-shell {
  padding: 40px 0 56px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  font-weight: 800;
  font-size: 1.05rem;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(180deg, var(--accent), var(--accent-dark));
  color: #fff;
  box-shadow: 0 10px 20px rgba(229, 50, 45, 0.22);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 18px;
}

.site-nav a,
.crumb-link {
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
}

.site-nav a:hover,
.crumb-link:hover {
  color: var(--text);
}

.hero {
  display: grid;
  gap: 24px;
}

.hero-home {
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 420px);
  align-items: stretch;
  margin-bottom: 38px;
}

.hero-copy,
.hero-panel-home,
.tool-hero,
.tool-workspace,
.tool-link-card,
.workflow-step {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.hero-copy,
.tool-hero,
.tool-workspace {
  border-radius: 28px;
}

.hero-copy {
  padding: 46px 44px;
}

.eyebrow,
.section-kicker {
  display: inline-flex;
  align-items: center;
  margin: 0 0 16px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.hero h1,
.tool-hero h1 {
  margin: 0;
  font-size: clamp(2.5rem, 5vw, 4.5rem);
  line-height: 0.98;
  letter-spacing: -0.04em;
}

.hero-text {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1.06rem;
  line-height: 1.7;
  max-width: 60ch;
}

.hero-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 28px;
}

.hero-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 0 24px;
  border-radius: 16px;
  font-weight: 700;
  text-decoration: none;
}

.hero-button-primary {
  background: linear-gradient(180deg, var(--accent), var(--accent-dark));
  color: #fff;
  box-shadow: 0 18px 28px rgba(229, 50, 45, 0.2);
}

.hero-note {
  color: var(--muted);
  font-weight: 500;
}

.hero-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
}

.hero-pills span {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: #4b5563;
  font-weight: 600;
}

.hero-panel-home {
  border-radius: 28px;
  padding: 20px;
  display: grid;
  gap: 14px;
}

.hero-panel-card {
  padding: 22px;
  border-radius: 22px;
  background: linear-gradient(180deg, #ffffff 0%, #f6f8fc 100%);
  border: 1px solid var(--line);
}

.hero-panel-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 1.02rem;
}

.hero-panel-card p,
.tool-link-card p,
.section-copy,
.workflow-step p,
.workspace-head p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.tool-section {
  margin-top: 10px;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.section-head h2,
.workspace-head h2 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  letter-spacing: -0.03em;
}

.section-copy {
  max-width: 420px;
}

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

.tool-link-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 220px;
  padding: 24px;
  text-decoration: none;
  border-radius: 24px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.tool-link-card:hover {
  transform: translateY(-4px);
  border-color: #cfd5df;
  box-shadow: 0 24px 40px rgba(17, 24, 39, 0.12);
}

.tool-link-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  color: #4b5563;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
}

.tool-link-card h2 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.15;
}

.tool-link-arrow {
  margin-top: auto;
  font-weight: 700;
  color: var(--accent-dark);
}

.workflow-strip {
  margin-top: 26px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.workflow-step {
  padding: 24px;
  border-radius: 22px;
}

.workflow-step strong,
.tool-fact strong {
  display: block;
  margin-bottom: 6px;
  font-size: 1rem;
}

.tool-page {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(360px, 0.9fr);
  gap: 24px;
  align-items: start;
}

body.tool-pdf-editor .page-shell {
  width: min(1600px, calc(100% - 24px));
}

.tool-page-editor {
  grid-template-columns: 1fr;
}

.tool-hero {
  padding: 34px;
}

.tool-hero-editor {
  padding: 24px 28px;
}

.tool-workspace-editor {
  padding: 22px;
}

.tool-page-editor .hero-text {
  max-width: 100%;
}

.crumb-link {
  display: inline-flex;
  margin-bottom: 18px;
}

.tool-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 28px;
}

.tool-fact {
  padding: 18px;
  border-radius: 18px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
}

.tool-fact span {
  color: var(--muted);
}

.tool-workspace {
  padding: 28px;
}

.workspace-head {
  margin-bottom: 18px;
}

.workspace-head h2 {
  margin-bottom: 8px;
}

.tool-form {
  display: grid;
  gap: 14px;
}

.field-label {
  font-size: 0.95rem;
  font-weight: 700;
}

.text-input {
  width: 100%;
  min-height: 54px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: #fff;
  font: inherit;
  color: var(--text);
  outline: none;
}

.text-input:focus {
  border-color: rgba(229, 50, 45, 0.6);
  box-shadow: 0 0 0 4px rgba(229, 50, 45, 0.08);
}

.field-help {
  margin-top: -6px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.upload-dropzone {
  position: relative;
  overflow: hidden;
  border: 2px dashed #cfd6e2;
  border-radius: 24px;
  background:
    linear-gradient(180deg, #fff 0%, #fafbfe 100%);
  min-height: 172px;
}

.upload-dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.upload-dropzone-copy {
  min-height: 172px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 28px;
}

.upload-dropzone-copy strong {
  display: block;
  margin-bottom: 8px;
  font-size: 1.1rem;
}

.upload-dropzone-copy span,
.file-meta {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

.upload-dropzone.is-dragover {
  border-color: var(--accent);
  background: linear-gradient(180deg, #fff4f3 0%, #fff 100%);
}

.file-list {
  display: grid;
  gap: 10px;
}

.file-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

.file-chip span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.94rem;
}

.range-row {
  display: grid;
  gap: 10px;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  font-weight: 600;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

button {
  border: 0;
  border-radius: 16px;
  background: linear-gradient(180deg, var(--accent), var(--accent-dark));
  color: #fff;
  min-height: 56px;
  padding: 0 18px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 18px 28px rgba(229, 50, 45, 0.2);
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

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

button:disabled {
  opacity: 0.7;
  cursor: wait;
}

.file-chip button {
  min-height: 38px;
  padding: 0 12px;
  border-radius: 12px;
  box-shadow: none;
  font-size: 0.85rem;
}

.result {
  min-height: 24px;
  margin-top: 14px;
  font-size: 0.96rem;
  color: var(--muted);
}

.result.is-error {
  color: #c62828;
}

.result.is-success {
  color: #15803d;
}

.preview-panel {
  margin-top: 18px;
  padding: 18px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.preview-header span {
  color: var(--muted);
  font-size: 0.92rem;
}

.preview-canvas {
  display: grid;
  place-items: center;
  min-height: 280px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  background:
    linear-gradient(45deg, rgba(15, 23, 42, 0.04) 25%, transparent 25%, transparent 75%, rgba(15, 23, 42, 0.04) 75%),
    linear-gradient(45deg, rgba(15, 23, 42, 0.04) 25%, transparent 25%, transparent 75%, rgba(15, 23, 42, 0.04) 75%);
  background-position: 0 0, 14px 14px;
  background-size: 28px 28px;
  background-color: #fff;
}

.preview-image {
  max-width: 100%;
  max-height: 520px;
  object-fit: contain;
}

.pdf-editor-panel {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.pdf-editor-toolbar {
  margin-bottom: 18px;
}

.sejda-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 14px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff 0%, #f7f8fb 100%);
}

.sejda-toolbar-row,
.sejda-toolbar-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.toolbar-chip {
  min-height: 44px;
  padding: 0 16px;
  border-radius: 14px;
  border: 1px solid #cdd5e1;
  background: #fff;
  color: #0f172a;
  font-weight: 700;
  box-shadow: none;
}

.toolbar-chip.is-active {
  border-color: rgba(229, 50, 45, 0.4);
  background: #fff1f0;
  color: var(--accent-dark);
}

.toolbar-chip-secondary {
  background: #f8fafc;
}

.toolbar-chip-file {
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.toolbar-chip-file input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.pdf-editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: start;
}

.pdf-editor-pages {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.pdf-editor-page {
  padding: 14px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  overflow: hidden;
}

.pdf-editor-page-head {
  margin-bottom: 12px;
  font-weight: 700;
}

.pdf-page-canvas {
  position: relative;
  max-width: 100%;
  overflow: auto;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #fff;
  min-height: 320px;
}

.pdf-page-preview {
  display: block;
  max-width: none;
}

.pdf-overlay-canvas {
  position: absolute;
  inset: 0;
  cursor: crosshair;
}

.pdf-word-layer {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.pdf-word-hitbox {
  position: absolute;
  min-height: 0;
  height: auto;
  color: transparent;
  font-size: 0;
  cursor: text;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 4px;
  background: rgba(37, 99, 235, 0.02);
  box-shadow: none;
  opacity: 0;
  transform: none;
  transition: opacity 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}

.pdf-word-layer:hover .pdf-word-hitbox,
.pdf-word-hitbox.is-selected {
  opacity: 1;
}

.pdf-word-hitbox:hover,
.pdf-word-hitbox.is-selected {
  border-color: rgba(37, 99, 235, 0.45);
  background: rgba(59, 130, 246, 0.18);
  transform: none;
}

.pdf-selection-marquee {
  position: absolute;
  z-index: 2;
  border: 1px solid rgba(37, 99, 235, 0.65);
  background: rgba(59, 130, 246, 0.15);
  border-radius: 8px;
  pointer-events: none;
}

.editor-object {
  position: absolute;
  z-index: 3;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 8px 10px;
  border: 2px solid #0f172a;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: none;
  color: #0f172a;
  min-height: 24px;
  overflow: hidden;
  word-break: break-word;
  user-select: none;
}

.editor-object:hover,
.editor-object.is-selected {
  outline: 2px solid rgba(229, 50, 45, 0.3);
  outline-offset: 1px;
}

.editor-object-source-pdf {
  border-color: transparent;
  background: transparent;
  outline: 1px dashed rgba(37, 99, 235, 0.55);
  outline-offset: 0;
  box-shadow: none;
}

.editor-object-source-pdf:hover,
.editor-object-source-pdf.is-selected {
  outline: 2px dashed rgba(37, 99, 235, 0.85);
  border-color: transparent;
}

.editor-inline-input {
  display: block;
  padding: 0;
  min-height: 0;
  border: 0;
  overflow: hidden;
  background: transparent;
  box-shadow: none;
  outline: none;
  line-height: 1.15;
  white-space: pre-wrap;
  word-break: break-word;
  caret-color: currentColor;
  cursor: text;
  user-select: text;
}

.editor-inline-input:focus {
  outline: none;
}

.editor-style-toggle {
  width: 100%;
  justify-content: center;
}

.editor-bold-toolbar {
  font-weight: 800;
}

.editor-object-rectangle,
.editor-object-ellipse {
  background: transparent;
}

.editor-object-whiteout {
  background: #ffffff;
}

.editor-object-image {
  padding: 0;
  object-fit: contain;
  background: #fff;
}

.editor-object-signature {
  font-style: italic;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.editor-object-handle {
  position: absolute;
  right: -8px;
  bottom: -8px;
  width: 16px;
  min-height: 16px;
  height: 16px;
  padding: 0;
  border-radius: 999px;
  border: 2px solid #fff;
  background: var(--accent);
  box-shadow: none;
}

.is-draft {
  pointer-events: none;
}

.pdf-editor-sidebar {
  display: grid;
  gap: 14px;
  position: sticky;
  top: 88px;
  align-self: start;
}

.editor-card,
.editor-edit-item {
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

.editor-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
}

.field-label.is-disabled {
  opacity: 0.5;
}

.editor-selected-text,
.editor-edit-list {
  color: var(--text);
  line-height: 1.55;
}

.editor-textarea {
  width: 100%;
  min-height: 110px;
  padding: 14px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: #fff;
  font: inherit;
  color: var(--text);
  resize: vertical;
}

.tool-page-editor .workspace-head p {
  max-width: 90ch;
}

.editor-textarea:focus {
  outline: none;
  border-color: rgba(229, 50, 45, 0.6);
  box-shadow: 0 0 0 4px rgba(229, 50, 45, 0.08);
}

.editor-number-input {
  min-height: 52px;
}

.editor-color-input {
  width: 100%;
  height: 52px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: #fff;
  padding: 6px;
}

.editor-color-input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.editor-helper-copy {
  margin: -2px 0 4px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.6;
}

.editor-edit-list {
  display: grid;
  gap: 10px;
}

.editor-edit-item {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
}

.editor-edit-item div {
  min-width: 0;
}

.editor-edit-item span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  word-break: break-word;
}

.editor-save-button,
.editor-edit-item button {
  box-shadow: none;
}

@media (max-width: 1080px) {
  .tool-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero-home,
  .tool-page {
    grid-template-columns: 1fr;
  }

  .pdf-editor-layout {
    grid-template-columns: 1fr;
  }

  .pdf-editor-sidebar {
    position: static;
  }
}

@media (max-width: 720px) {
  .header-inner,
  .page-shell {
    width: min(100% - 20px, 1180px);
  }

  .header-inner {
    min-height: 64px;
  }

  .site-nav {
    gap: 12px;
    font-size: 0.92rem;
  }

  .hero-copy,
  .hero-panel-home,
  .tool-hero,
  .tool-workspace,
  .tool-link-card,
  .workflow-step {
    border-radius: 22px;
  }

  .hero-copy,
  .tool-hero,
  .tool-workspace {
    padding: 24px;
  }

  .tool-grid,
  .workflow-strip,
  .tool-facts {
    grid-template-columns: 1fr;
  }

  .tool-link-card {
    min-height: auto;
  }
}
