:root {
  color-scheme: light;
  --line: #d9d3ca;
  --focus: #2f6feb;
  font-family: var(--font-family);
  color: var(--ink);
  background: #ebe7e0;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-width: 320px;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
select {
  cursor: pointer;
}
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
.skip-link {
  position: fixed;
  z-index: 20;
  top: -5rem;
  left: 1rem;
  padding: 0.75rem 1rem;
  background: var(--paper);
  color: var(--ink);
}
.skip-link:focus {
  top: 1rem;
}
.topbar {
  height: 74px;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: white;
  background: var(--ink);
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: white;
  text-decoration: none;
}
.brand img {
  width: 32px;
  height: 32px;
}
.brand span {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}
.brand small {
  padding-left: 0.65rem;
  border-left: 1px solid #414751;
  color: #c9cdd2;
}
.identity {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.82rem;
}
.identity strong {
  padding: 0.35rem 0.65rem;
  border: 1px solid #505762;
  border-radius: 99px;
  text-transform: capitalize;
  color: var(--gold-bright);
}
.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: calc(100vh - 74px);
}
.inventory {
  padding: 1.5rem 1rem;
  background: var(--ink-raised);
  color: white;
}
.panel-heading,
.workspace-heading,
.section-heading,
.block-card-header,
.preview-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.panel-actions,
.dialog-heading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1 {
  font-size: clamp(1.75rem, 4vw, 2.65rem);
  font-weight: 300;
  letter-spacing: -0.03em;
}
h2 {
  font-size: 1.35rem;
  font-weight: 500;
}
h3 {
  font-size: 1rem;
  margin-bottom: 0;
}
.eyebrow {
  display: block;
  margin-bottom: 0.3rem;
  color: #8b929b;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.inventory nav {
  display: grid;
  gap: 0.35rem;
  margin: 1rem 0 2rem;
}
.content-item {
  text-align: left;
  display: grid;
  gap: 0.25rem;
  width: 100%;
  padding: 0.8rem;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #e7e9ec;
  background: transparent;
}
.content-item small {
  color: #9da3ab;
  text-transform: capitalize;
}
.content-item:hover,
.content-item.selected {
  border-color: #3b424c;
  background: #1c232d;
}
.content-item.selected {
  border-left: 3px solid var(--gold);
}
.guardrail {
  padding: 1rem;
  border: 1px solid #383f49;
  border-radius: 8px;
  color: #bac0c7;
  font-size: 0.8rem;
}
.guardrail strong {
  color: var(--gold-bright);
}
.guardrail p {
  margin: 0.4rem 0 0;
  line-height: 1.5;
}
.workspace {
  min-width: 0;
}
.workspace-heading {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.workspace-heading h1 {
  margin-bottom: 0.3rem;
}
.workspace-heading p {
  margin: 0;
  color: var(--stone);
  font-size: 0.85rem;
}
.status {
  font-weight: 600;
  text-transform: capitalize;
}
.primary-actions,
.block-actions,
.history-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
button {
  min-height: 38px;
  padding: 0.55rem 0.8rem;
  border: 1px solid #b8b1a7;
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
}
button:hover {
  border-color: var(--ink);
}
button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
button.accent {
  border-color: var(--gold);
  background: var(--ink);
  color: var(--gold-bright);
}
button.quiet {
  color: var(--gold-bright);
  border-color: #444b55;
  background: transparent;
}
.editor-layout {
  display: grid;
  grid-template-columns: minmax(440px, 0.9fr) minmax(420px, 1.1fr);
  align-items: start;
}
.editor-pane {
  display: grid;
  gap: 1rem;
  padding: 1.5rem 2rem 4rem;
}
details {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
}
summary {
  padding: 1rem;
  font-weight: 600;
  cursor: pointer;
}
details > :not(summary) {
  margin-left: 1rem;
  margin-right: 1rem;
}
.field-grid,
.block-fields {
  display: grid;
  grid-template-columns: 145px 1fr;
  gap: 0.65rem 1rem;
  align-items: start;
  padding: 0.25rem 0 1rem;
}
label,
legend {
  font-size: 0.8rem;
  font-weight: 600;
}
label span,
.field-note {
  color: var(--stone);
  font-size: 0.72rem;
  font-weight: 400;
}
input,
textarea,
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid #b8b1a7;
  border-radius: 5px;
  padding: 0.55rem 0.65rem;
  color: var(--ink);
  background: var(--paper);
}
textarea {
  resize: vertical;
}
fieldset {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: 145px 1fr;
  gap: 0.65rem 1rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.75rem;
}
legend {
  padding: 0 0.3rem;
}
.section-heading {
  margin-top: 0.75rem;
}
.section-heading h2 {
  margin-bottom: 0;
}
.section-heading select {
  width: auto;
  min-width: 170px;
}
.block-list {
  display: grid;
  gap: 0.8rem;
}
.block-card {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  box-shadow: 0 3px 12px #17202d0b;
}
.block-card.dragging {
  opacity: 0.5;
}
.block-card-header {
  padding-bottom: 0.85rem;
  border-bottom: 1px solid #eeeae3;
}
.drag-handle {
  font-size: 1.1rem;
  letter-spacing: -0.2em;
  cursor: grab;
}
.block-fields {
  padding-top: 1rem;
}
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.75rem;
  padding-bottom: 1rem;
}
.media-upload-form,
.management-form {
  display: grid;
  grid-template-columns: 145px 1fr;
  gap: 0.65rem 1rem;
  align-items: start;
  padding-bottom: 1rem;
}
.media-upload-form h3,
.media-upload-form p,
.media-upload-form button,
.management-form .dialog-actions,
.management-form .field-note {
  grid-column: 1 / -1;
}
.media-card {
  display: grid;
  text-align: left;
  gap: 0.35rem;
  padding: 0.65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}
.media-card.recommended {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgb(199 149 45 / 16%);
}
.media-card small {
  color: var(--stone);
}
.recommendation {
  width: fit-content;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  color: var(--ink);
  background: var(--gold);
  font-size: 0.7rem;
  font-weight: 700;
}
.heritage-record {
  display: grid;
  gap: 0.4rem;
  margin: 0.4rem 0;
}
.heritage-record div {
  display: grid;
  grid-template-columns: minmax(5.5rem, 0.7fr) 1.3fr;
  gap: 0.45rem;
}
.heritage-record dt {
  color: var(--stone);
  font-size: 0.7rem;
}
.heritage-record dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 0.75rem;
}
.heritage-fields {
  margin: 0.35rem 0;
  background: #fbf7ed;
}
.checkbox-field {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.checkbox-field input {
  width: auto;
  min-height: auto;
}
.media-art {
  display: grid;
  place-items: center;
  aspect-ratio: 16/9;
  border-radius: 4px;
  color: var(--gold-bright);
  background: var(--ink);
  letter-spacing: 0.2em;
}
#review-note {
  margin: 0 0 1rem;
  width: calc(100% - 2rem);
}
.history-controls {
  padding-bottom: 1rem;
  align-items: end;
}
.history-controls label {
  flex: 1 1 190px;
}
.comparison {
  display: block;
  padding: 0.8rem;
  margin-bottom: 1rem;
  border-radius: 6px;
  background: var(--cream);
}
.notes {
  padding: 0 0 1rem 1.4rem;
}
.notes li {
  margin-bottom: 0.5rem;
}
.preview-pane {
  position: sticky;
  top: 0;
  padding: 1.5rem;
  min-height: calc(100vh - 74px);
  border-left: 1px solid var(--line);
  background: #dfdad2;
}
.preview-toolbar {
  margin-bottom: 0.6rem;
}
.preview-toolbar strong {
  display: block;
}
.preview-toolbar [aria-pressed="true"] {
  color: var(--gold-bright);
  background: var(--ink);
}
.privacy-note {
  color: var(--stone);
  font-size: 0.7rem;
}
.preview-frame {
  width: 100%;
  max-width: 780px;
  margin: auto;
  overflow: hidden;
  border: 1px solid #beb7ad;
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 18px 45px #1117201f;
  transition: max-width 0.2s ease;
}
.preview-frame.mobile {
  max-width: 390px;
}
.preview-frame > header {
  display: flex;
  align-items: center;
  height: 60px;
  padding: 0 5%;
  border-bottom: 1px solid #e6e2dc;
}
.preview-frame > header img {
  width: 148px;
  max-height: 36px;
}
.preview-section {
  padding: clamp(1.4rem, 5vw, 3.5rem) 7%;
  margin: 0;
}
.preview-section h1 {
  max-width: 13ch;
  font-size: clamp(2rem, 5vw, 4rem);
}
.preview-section h2 {
  font-size: clamp(1.5rem, 3vw, 2.3rem);
  font-weight: 300;
}
.preview-section p {
  max-width: 60ch;
  line-height: 1.65;
}
.theme-dark {
  color: white;
  background: var(--ink);
}
.theme-paper {
  background: var(--paper);
}
.theme-cream {
  background: var(--cream);
}
.preview-section a {
  display: inline-block;
  padding: 0.65rem 0.9rem;
  color: var(--ink);
  background: var(--gold);
  text-decoration: none;
}
.preview-section cite {
  display: block;
  margin-top: 1rem;
  font-size: 0.8rem;
}
.preview-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}
.preview-grid article {
  padding: 1rem;
  border: 1px solid currentColor;
}
.callout-gold {
  background: var(--gold);
}
.callout-ink {
  color: white;
  background: var(--ink);
}
.preview-image div {
  display: grid;
  place-items: center;
  aspect-ratio: 16/9;
  background: var(--cream);
  color: var(--stone);
}
.fatal {
  max-width: 600px;
  margin: 15vh auto;
  padding: 2rem;
}

.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: rgb(0 0 0 / 72%);
}

.navigation-dialog {
  width: min(34rem, 100%);
  padding: 1.5rem;
  border: 1px solid var(--gold);
  border-radius: 0.75rem;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 1.5rem 4rem rgb(0 0 0 / 45%);
}

.navigation-dialog h2 {
  margin-top: 0;
}
.management-dialog {
  width: min(48rem, 100%);
  min-width: 0;
  max-height: calc(100vh - 3rem);
  overflow: auto;
}
.management-form > * {
  min-width: 0;
}
.dialog-heading {
  justify-content: space-between;
}
.user-list {
  display: grid;
  gap: 0.75rem;
}
.user-card {
  display: grid;
  grid-template-columns: minmax(12rem, 1fr) 5rem minmax(8rem, 10rem) auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
}
.user-card div {
  display: grid;
  gap: 0.2rem;
}
.user-card small {
  color: var(--stone);
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
}
@media (max-width: 1180px) {
  .editor-layout {
    grid-template-columns: 1fr;
  }
  .preview-pane {
    position: static;
    min-height: auto;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}
@media (max-width: 760px) {
  .topbar {
    padding: 0 1rem;
  }
  .brand small,
  .identity span {
    display: none;
  }
  .app-shell {
    grid-template-columns: minmax(0, 1fr);
  }
  .inventory {
    min-width: 0;
    padding: 0.75rem 1rem;
  }
  .panel-heading,
  .panel-actions {
    flex-wrap: wrap;
  }
  .inventory nav {
    display: flex;
    overflow-x: auto;
    margin: 0.6rem 0 0;
  }
  .content-item {
    min-width: 190px;
  }
  .guardrail {
    display: none;
  }
  .workspace-heading {
    align-items: flex-start;
    flex-direction: column;
    padding: 1rem;
  }
  .editor-pane,
  .preview-pane {
    padding: 1rem;
  }
  .field-grid,
  .block-fields,
  fieldset,
  .media-upload-form,
  .management-form,
  .user-card {
    grid-template-columns: 1fr;
  }
  .preview-grid {
    grid-template-columns: 1fr;
  }
  .media-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .media-card,
  .media-card > * {
    min-width: 0;
  }
  .management-dialog {
    padding: 1rem;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}

.research-context {
  padding: 16px;
  margin-bottom: 20px;
  border: 1px solid var(--border, #d0d5d2);
  border-radius: 12px;
  overflow-wrap: anywhere;
}

.article-drafting-layout {
  grid-template-columns: minmax(170px, 0.55fr) minmax(320px, 1.25fr) minmax(
      280px,
      1fr
    );
  gap: 16px;
  padding: 20px;
  background: #f6f7f8;
}
.article-drafting-layout > * {
  min-width: 0;
}
.article-drafting-layout .editor-pane,
.article-drafting-layout .preview-pane {
  padding: 0;
  border: 0;
  background: transparent;
}
.article-drafting-layout .block-fields {
  grid-template-columns: minmax(0, 1fr);
}
.article-drafting-layout .block-fields textarea {
  min-height: 180px;
  line-height: 1.65;
}
.draft-context-rail {
  display: grid;
  gap: 14px;
  align-content: start;
}
.draft-outline,
.draft-agents,
.draft-metrics {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  padding: 14px;
}
.draft-outline h2,
.draft-agents h2 {
  font-size: 0.95rem;
  font-weight: 650;
}
.draft-outline nav {
  display: grid;
  gap: 7px;
}
.draft-outline button {
  text-align: left;
  display: grid;
  gap: 4px;
  width: 100%;
  border-color: transparent;
  background: #f3f7f5;
  overflow-wrap: anywhere;
}
.draft-outline small {
  color: var(--stone);
  font-size: 0.72rem;
}
.draft-outline .field-note {
  margin: 12px 0 0;
  line-height: 1.5;
}
.draft-context-rail .research-context {
  padding: 0;
  margin: 0;
  border: 0;
  font-size: 0.8rem;
}
.draft-context-rail .research-context details {
  min-width: 0;
}
.draft-context-rail .research-context summary {
  padding: 12px;
}
.draft-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.draft-metrics > div {
  display: grid;
  gap: 4px;
}
.draft-metrics span,
.draft-metrics small {
  font-size: 0.72rem;
  color: var(--stone);
  overflow-wrap: anywhere;
}
.draft-metrics strong {
  font-size: 0.9rem;
}
.draft-byline {
  margin-top: 8px !important;
}
.draft-preview-appearance {
  display: flex;
  gap: 5px;
  margin-bottom: 10px;
}
.draft-preview-appearance [aria-pressed="true"] {
  background: #d8eee2;
  border-color: #78a38a;
}
.article-preview-frame {
  padding: 0;
  width: 100%;
  max-width: 100%;
  background: white;
  overflow: auto;
}
.article-preview-frame iframe {
  display: block;
  width: 100%;
  height: 820px;
  border: 0;
}
.article-preview-frame.mobile {
  width: 375px;
  max-width: 100%;
}
.article-preview-frame.desktop iframe {
  width: 1024px;
  height: 1500px;
  zoom: 0.34;
}
.draft-agents {
  margin-top: 15px;
}
.draft-agents p {
  font-size: 0.8rem;
  line-height: 1.5;
}
.draft-agents button {
  width: 100%;
}
.preview-unavailable {
  padding: 18px;
  font-size: 0.85rem;
}
@media (max-width: 1200px) {
  .article-drafting-layout {
    grid-template-columns: minmax(160px, 0.6fr) minmax(0, 1.4fr);
  }
  .article-drafting-layout .preview-pane {
    grid-column: 2;
  }
  .article-preview-frame.desktop iframe {
    zoom: 0.45;
  }
}
@media (max-width: 820px) {
  .article-drafting-layout {
    grid-template-columns: minmax(0, 1fr);
    padding: 12px;
  }
  .article-drafting-layout .preview-pane {
    grid-column: 1;
  }
  .draft-outline nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .article-drafting-layout .field-grid,
  .article-drafting-layout .block-fields {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 600px) {
  .article-preview-frame.desktop iframe {
    zoom: 0.28;
  }
}
.research-context summary {
  cursor: pointer;
  font-weight: 700;
}
.research-prose {
  white-space: pre-wrap;
}
.research-context .research-resource-list {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 12px;
}
.research-context .research-resource-list li {
  border-bottom: 1px solid var(--border, #d0d5d2);
  padding-bottom: 10px;
}
.research-context .research-resource-list small {
  display: block;
  margin: 4px 0;
  opacity: 0.75;
}
.research-context pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 280px;
  overflow-y: auto;
  font: inherit;
}
