:root {
  color-scheme: light dark;
  --ink: #141414;
  --paper: #f7f5ee;
  --muted: #64615a;
  --line: #dedad0;
  --panel: #fffdf7;
  --accent: #9fb857;
  --accent-ink: #233007;
  --danger: #9e2f2f;
  --focus: #6e842f;
  --shadow: 0 18px 60px rgba(20, 20, 20, 0.08);
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #f2f2f2;
    --paper: #11110f;
    --muted: #aca79b;
    --line: #35342f;
    --panel: #191815;
    --accent: #c2d36f;
    --accent-ink: #151b08;
    --shadow: 0 18px 60px rgba(0, 0, 0, 0.28);
  }
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family:
    ui-sans-serif,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  letter-spacing: 0;
}

button,
input,
textarea,
select {
  font: inherit;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

.site-body {
  min-height: 100svh;
  overflow: hidden;
  background: #f0f0f0;
  color: #141414;
  font-family: "Inter Tight", sans-serif;
}

.landing {
  position: relative;
  width: 100%;
  min-height: 100svh;
  overflow: hidden;
  background: #f0f0f0;
}

.landing-header {
  position: absolute;
  z-index: 3;
  top: 24px;
  right: 40px;
  left: 40px;
}

.landing-logo {
  display: block;
  width: 160px;
}

.landing-logo img {
  display: block;
  width: 100%;
  height: auto;
}

.landing-title {
  position: absolute;
  z-index: 1;
  top: 12.44vh;
  right: 40px;
  left: 40px;
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0;
  color: #ffffff;
  font-size: calc((100vw - 80px) / 3.3);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 0.791;
  white-space: nowrap;
}

.landing-title span {
  display: block;
}

.landing-mark {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 50%;
  width: 34.13vw;
  max-width: 590px;
  aspect-ratio: 589.687 / 742.447;
  transform: translate(-50%, -50%);
}

.landing-shape {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.landing-shape-path {
  fill: #141414;
  opacity: 0.9;
  transform-box: fill-box;
  transform-origin: center;
  will-change: d;
}

.landing-contact {
  position: absolute;
  z-index: 3;
  right: 40px;
  bottom: 24px;
  left: 40px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2px;
  font-size: 1.25rem;
  line-height: 1.15;
}

.landing-contact div {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 307px;
}

.landing-contact p,
.landing-descriptor {
  margin: 0;
  color: rgb(20 20 20 / 50%);
  font-weight: 400;
}

.landing-contact a {
  color: #141414;
  font-weight: 500;
  text-decoration: none;
}

.landing-contact a:hover {
  text-decoration: underline;
}

.landing-logo:focus-visible,
.landing-contact a:focus-visible {
  outline: 2px solid #141414;
  outline-offset: 4px;
}

@media (max-width: 1100px) {
  .landing-contact {
    font-size: 1.125rem;
  }

  .landing-mark {
    width: 43vw;
  }
}

@media (max-width: 760px) {
  .site-body {
    overflow: auto;
  }

  .landing {
    width: 100%;
    height: max(760px, 100svh);
    min-height: 0;
  }

  .landing-header {
    top: 24px;
    right: 20px;
    left: 20px;
  }

  .landing-logo {
    width: 148px;
  }

  .landing-mark {
    top: 44%;
    width: min(72vw, 320px);
  }

  .landing-title {
    top: 28%;
    right: 20px;
    left: 20px;
    font-size: 8rem;
  }

  .landing-contact {
    right: 20px;
    bottom: 24px;
    left: 20px;
    align-items: flex-start;
    flex-direction: column;
    gap: 18px;
    font-size: 1rem;
  }

  .landing-contact div {
    width: 100%;
  }

  .landing-descriptor {
    align-self: flex-end;
    max-width: 200px;
    text-align: right;
  }
}

@media (max-width: 390px) {
  .landing-logo {
    width: 132px;
    min-width: 132px;
  }

  .landing-header p {
    max-width: 132px;
    font-size: 0.8125rem;
  }

  .landing-title {
    font-size: 7rem;
  }
}

.workspace-body {
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(20, 20, 20, 0.04) 1px, transparent 1px),
    linear-gradient(180deg, rgba(20, 20, 20, 0.04) 1px, transparent 1px),
    var(--paper);
  background-size: 48px 48px;
}

@media (prefers-color-scheme: dark) {
  .workspace-body {
    background:
      linear-gradient(90deg, rgba(242, 242, 242, 0.04) 1px, transparent 1px),
      linear-gradient(180deg, rgba(242, 242, 242, 0.04) 1px, transparent 1px),
      var(--paper);
    background-size: 48px 48px;
  }
}

.workspace-shell {
  display: flex;
  min-height: 100vh;
}

.workspace-sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--space-7);
  width: 276px;
  height: 100vh;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  padding: var(--space-5);
}

.workspace-brand {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.workspace-logo {
  width: 160px;
}

.workspace-logo img {
  display: block;
  width: 100%;
  height: auto;
}

.workspace-nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 var(--space-3);
  color: var(--muted);
  text-decoration: none;
}

.nav-item[aria-current="page"] {
  border-color: var(--line);
  background: var(--panel);
  color: var(--ink);
}

.workspace-sidebar-note {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.workspace-main {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: var(--space-6);
  padding: var(--space-6);
}

.workspace-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-5);
  border-bottom: 1px solid var(--line);
  padding-bottom: var(--space-5);
}

.workspace-title {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.workspace-title h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 4.5rem);
  font-weight: 720;
  letter-spacing: 0;
  line-height: 0.95;
}

.workspace-title p {
  max-width: 66ch;
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.5;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  gap: var(--space-2);
  padding: 0 var(--space-4);
  text-decoration: none;
  white-space: nowrap;
}

.button:hover {
  border-color: color-mix(in srgb, var(--ink) 24%, var(--line));
}

.button:focus-visible,
.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
}

.button.danger {
  color: var(--danger);
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: var(--space-6);
  align-items: start;
}

.tool-panel,
.preview-panel,
.code-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: var(--space-5);
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
}

.panel-header h2 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.2;
}

.panel-header p {
  max-width: 58ch;
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.field label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-transform: uppercase;
}

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

.field input,
.field textarea,
.field select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: color-mix(in srgb, var(--panel) 92%, var(--paper));
  color: var(--ink);
  padding: 10px 12px;
}

.field textarea {
  min-height: 148px;
  resize: vertical;
  font-family:
    ui-monospace,
    SFMono-Regular,
    Menlo,
    Monaco,
    Consolas,
    "Liberation Mono",
    monospace;
  font-size: 0.78rem;
  line-height: 1.5;
}

.two-up {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

.editable-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.editable-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: var(--space-2);
  align-items: end;
}

.text-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.segmented button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0 var(--space-3);
}

.segmented button[aria-pressed="true"] {
  border-color: var(--ink);
  color: var(--ink);
}

.preview-column {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  min-width: 0;
}

.signature-stage {
  display: flex;
  min-height: 272px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8f8f5;
  padding: var(--space-6);
  overflow: auto;
}

.signature-stage.compact {
  position: relative;
  min-height: 172px;
  height: 172px;
  padding: var(--space-4);
  overflow: hidden;
}

.signature-stage.compact .signature-preview {
  transform: scale(0.62);
  transform-origin: top left;
}

.signature-stage.dark {
  background: #141414;
}

.signature-stage.auto {
  background: light-dark(#f8f8f5, #141414);
}

.signature-preview {
  display: flex;
  flex-direction: column;
  align-self: flex-start;
  gap: 18px;
  width: 435px;
  color: #141414;
  font-family:
    "General Sans",
    "Avenir Next",
    Arial,
    sans-serif;
}

.signature-stage.dark .signature-preview {
  color: #f2f2f2;
}

@media (prefers-color-scheme: dark) {
  .signature-stage.auto .signature-preview {
    color: #f2f2f2;
  }
}

.signature-top {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.signature-identity {
  display: flex;
  align-items: flex-start;
  gap: 28px;
}

.signature-logo {
  position: relative;
  display: block;
  width: 103px;
  height: 38px;
  flex: 0 0 auto;
}

.signature-logo img {
  position: absolute;
  inset: 0;
  width: 103px;
  height: 38px;
}

.signature-person {
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-width: 0;
}

.signature-name {
  font-size: 20px;
  font-weight: 650;
  line-height: 1;
}

.signature-role {
  font-size: 16px;
  line-height: 1;
}

.signature-rule {
  width: 100%;
  height: 1px;
  background: #dedede;
}

.signature-stage.dark .signature-rule {
  background: #444;
}

@media (prefers-color-scheme: dark) {
  .signature-stage.auto .signature-rule {
    background: #444;
  }
}

.signature-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 12px;
  line-height: 1.25;
}

.signature-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}

.signature-row a {
  color: inherit;
  text-decoration: none;
}

.mode-preview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

.mode-preview-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
}

.mode-preview-card > span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-transform: uppercase;
}

.status-line {
  min-height: 20px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.4;
}

.code-panel {
  box-shadow: none;
}

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

@media (max-width: 980px) {
  .workspace-shell {
    flex-direction: column;
  }

  .workspace-sidebar {
    position: relative;
    width: 100%;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .workspace-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .workspace-main,
  .workspace-sidebar {
    padding: var(--space-4);
  }

  .workspace-header,
  .panel-header {
    align-items: stretch;
    flex-direction: column;
  }

  .two-up,
  .editable-row,
  .mode-preview-grid {
    grid-template-columns: 1fr;
  }

  .signature-stage {
    padding: var(--space-4);
  }

  .signature-stage.compact {
    height: 142px;
  }

  .signature-stage.compact .signature-preview {
    transform: scale(0.48);
  }

  .signature-identity {
    gap: var(--space-4);
  }

  .signature-logo,
  .signature-logo img {
    width: 103px;
    height: 38px;
  }
}
