:root {
  --bg: #ffffff;
  --text: #111111;
  --muted: #666666;
  --line: #d8d8d8;
  --panel: #ffffff;
  --field: #ffffff;
  --accent: #111111;
  --danger: #9f1d1d;
  --max: 960px;
}

* {
  box-sizing: border-box;
}

html {
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  letter-spacing: 0;
}

body.theme-dark {
  --bg: #101010;
  --text: #f5f5f5;
  --muted: #b8b8b8;
  --line: #383838;
  --panel: #181818;
  --field: #111111;
  --accent: #f5f5f5;
}

body.theme-paper {
  --bg: #fbfaf6;
  --text: #1b1b17;
  --muted: #6d665a;
  --line: #d9d0c0;
  --panel: #fffefa;
  --field: #ffffff;
  --accent: #24443a;
}

body.theme-contrast {
  --bg: #ffffff;
  --text: #000000;
  --muted: #202020;
  --line: #000000;
  --panel: #ffffff;
  --field: #ffffff;
  --accent: #0039a6;
}

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

img {
  display: block;
  max-width: 100%;
}

.site-header {
  max-width: var(--max);
  margin: 0 auto;
  padding: 28px 24px 10px;
}

.site-nav {
  display: flex;
  gap: 24px;
  justify-content: center;
  align-items: center;
  font-size: 13px;
  letter-spacing: 0;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
}

.site-nav a[aria-current="page"] {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 0.25em;
}

.site-main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 50px 24px 96px;
}

.site-footer {
  max-width: var(--max);
  margin: 0 auto;
  padding: 24px 24px 36px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.site-footer p {
  margin: 0;
}

.home-page {
  min-height: calc(100vh - 190px);
  display: grid;
  gap: 54px;
  align-items: center;
}

.home-portrait-left {
  grid-template-columns: minmax(220px, 360px) minmax(0, 1fr);
}

.home-portrait-right {
  grid-template-columns: minmax(0, 1fr) minmax(220px, 360px);
}

.home-portrait-right .portrait {
  order: 2;
}

.home-portrait-top,
.home-centered {
  max-width: 680px;
  margin: 0 auto;
}

.home-centered {
  text-align: center;
  justify-items: center;
}

.portrait {
  width: 100%;
  max-width: 360px;
  height: auto;
}

.bio {
  margin: 0;
  font-size: 18px;
  line-height: 1.72;
  text-align: justify;
  text-justify: inter-word;
}

.page-title {
  margin: 0 0 42px;
  font-size: 18px;
  line-height: 1.2;
  font-weight: 400;
}

.work-list {
  display: grid;
  gap: 30px;
}

.work-grid .work-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.work-compact .work-list {
  gap: 14px;
}

.work-item {
  display: grid;
  gap: 12px 18px;
  align-items: start;
}

.work-item.has-work-image {
  grid-template-columns: 108px minmax(0, 1fr);
}

.work-copy {
  min-width: 0;
}

.work-image-wrap {
  display: block;
  width: 100%;
  max-width: 132px;
  text-decoration: none;
}

.work-image {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border: 1px solid var(--line);
  background: var(--field);
}

.work-link {
  font-size: 18px;
}

.work-meta,
.work-description {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.contact-wrap {
  display: grid;
  grid-template-columns: minmax(260px, 420px) minmax(220px, 1fr);
  gap: 70px;
  align-items: start;
}

.contact-stacked .contact-wrap,
.contact-narrow .contact-wrap {
  grid-template-columns: 1fr;
}

.contact-narrow .contact-wrap {
  max-width: 520px;
}

.contact-form,
.agent-details {
  display: grid;
  gap: 18px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--text);
  font-size: 14px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--field);
  color: var(--text);
  border-radius: 0;
  padding: 11px 12px;
  font: inherit;
}

textarea {
  resize: vertical;
}

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

.button {
  width: fit-content;
  min-height: 42px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 0;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}

.button.ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--line);
}

.button.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #ffffff;
}

.form-status,
.status {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.field-caption {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

.agent-details h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 400;
}

.agent-details p {
  margin: 0;
  line-height: 1.55;
}

.agent-name {
  color: var(--text);
}

.admin-app {
  max-width: 1180px;
  margin: 0 auto;
  padding: 36px 24px 72px;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-form {
  width: min(100%, 380px);
  display: grid;
  gap: 18px;
}

.login-form h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 400;
}

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

.admin-header h1 {
  margin: 4px 0 0;
  font-size: 30px;
  font-weight: 400;
}

.admin-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.admin-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

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

.panel {
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 22px;
  display: grid;
  gap: 18px;
}

.panel h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 400;
}

.panel-heading,
.repeat-heading {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.repeat-list {
  display: grid;
  gap: 14px;
}

.repeat-item {
  display: grid;
  gap: 14px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.work-picture-editor {
  display: grid;
  gap: 10px;
}

.work-picture-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.work-image-preview {
  width: 92px;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border: 1px solid var(--line);
  background: var(--field);
}

.remove-work-image:disabled {
  opacity: 0.5;
  cursor: default;
}

.admin-utility {
  margin-top: 18px;
}

.message-list {
  display: grid;
  gap: 14px;
}

.message-item {
  display: grid;
  gap: 7px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.message-item p {
  margin: 0;
  line-height: 1.55;
  white-space: pre-wrap;
}

.message-meta {
  color: var(--muted);
  font-size: 13px;
}

.file-button {
  position: relative;
  overflow: hidden;
}

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

.mobile-preview-body {
  min-height: 100vh;
  background: #f4f4f1;
}

.mobile-preview {
  min-height: 100vh;
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px 24px;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 420px;
  gap: 36px;
  align-items: center;
}

.preview-panel {
  display: grid;
  gap: 18px;
}

.preview-panel h1 {
  margin: 0;
  font-size: 32px;
  font-weight: 400;
  line-height: 1.2;
}

.preview-url {
  margin: 0;
  padding: 14px 16px;
  border: 1px solid #cfcfc8;
  background: #ffffff;
  color: #111111;
  font-size: 18px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.qr-preview {
  width: min(100%, 220px);
  margin: 0;
  display: grid;
  gap: 10px;
}

.qr-preview img {
  width: 100%;
  border: 1px solid #cfcfc8;
  background: #ffffff;
}

.qr-preview figcaption {
  color: #666666;
  font-size: 13px;
  line-height: 1.4;
}

.preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.phone-preview {
  width: min(100%, 390px);
  aspect-ratio: 390 / 844;
  margin-left: auto;
  border: 12px solid #111111;
  border-radius: 34px;
  background: #ffffff;
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.18);
  overflow: hidden;
}

.phone-preview iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #ffffff;
}

@media (max-width: 820px) {
  .site-header {
    padding-top: 22px;
  }

  .site-nav {
    gap: 18px;
  }

  .site-main {
    padding-top: 34px;
  }

  .home-page,
  .home-portrait-left,
  .home-portrait-right,
  .contact-wrap,
  .admin-grid,
  .field-row {
    grid-template-columns: 1fr;
  }

  .home-portrait-right .portrait {
    order: 0;
  }

  .portrait {
    max-width: 100%;
  }

  .bio {
    font-size: 17px;
  }

  .work-grid .work-list {
    grid-template-columns: 1fr;
  }

  .work-item.has-work-image {
    grid-template-columns: 84px minmax(0, 1fr);
  }

  .admin-header {
    align-items: start;
    flex-direction: column;
  }

  .mobile-preview {
    grid-template-columns: 1fr;
    padding: 24px 18px;
  }

  .preview-panel h1 {
    font-size: 25px;
  }

  .phone-preview {
    width: 100%;
    max-height: 72vh;
    margin: 0;
  }
}
