:root {
  color-scheme: light;
  --ink: #15243a;
  --muted: #526176;
  --paper: #fffdf8;
  --canvas: #f4f0e7;
  --line: #c8c0b1;
  --blue: #164e72;
  --blue-dark: #103b57;
  --cream: #fff4ce;
  --focus: #b45309;
  --danger: #9f1239;
  --shadow: 0 12px 30px rgba(21, 36, 58, 0.1);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--canvas);
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 85% 5%, rgba(241, 195, 74, 0.18), transparent 28rem),
    var(--canvas);
  line-height: 1.55;
}

button,
input,
textarea {
  font: inherit;
}

code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.skip-link {
  position: fixed;
  z-index: 20;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.65rem 0.85rem;
  color: white;
  background: var(--ink);
  border-radius: 0.35rem;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.page-shell {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 3rem 0;
}

.site-header {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(16rem, 0.65fr);
  gap: 2rem;
  align-items: end;
  margin-bottom: 1.5rem;
}

.eyebrow,
.step {
  margin: 0 0 0.35rem;
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.13em;
}

h1,
h2,
p {
  overflow-wrap: anywhere;
}

h1 {
  max-width: 18ch;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.35rem, 6vw, 4.9rem);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 0.98;
}

h2 {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.3;
}

.lede {
  max-width: 65ch;
  margin: 1.1rem 0 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.privacy-note {
  margin: 0;
  padding: 1rem 1.1rem;
  color: #3f350d;
  background: var(--cream);
  border: 1px solid #d6b94d;
  border-radius: 0.65rem;
}

.workspace {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-height: 31rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 0.8rem 0.8rem 0 0;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 1.15rem;
}

.editor-panel {
  border-right: 1px solid var(--line);
}

.preview-panel {
  background: #ffffff;
}

.panel-heading {
  display: flex;
  min-height: 4rem;
  gap: 1rem;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.file-control {
  display: grid;
  max-width: 13rem;
  gap: 0.3rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.file-control input {
  max-width: 100%;
  color: var(--ink);
  font-size: 0.8rem;
}

.file-control input::file-selector-button {
  margin-right: 0.5rem;
  padding: 0.4rem 0.65rem;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  cursor: pointer;
}

.field-label {
  margin-bottom: 0.45rem;
  font-weight: 700;
}

textarea {
  width: 100%;
  min-height: 23rem;
  flex: 1;
  padding: 1rem;
  resize: vertical;
  color: #132033;
  background: #fbfaf6;
  border: 1px solid #9b9488;
  border-radius: 0.45rem;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.93rem;
  line-height: 1.55;
  tab-size: 2;
}

.help-text {
  margin: 0.6rem 0 0;
  color: var(--muted);
  font-size: 0.83rem;
}

.local-badge {
  padding: 0.3rem 0.55rem;
  color: #175c35;
  background: #e4f5e9;
  border: 1px solid #91cba3;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.preview {
  min-height: 23rem;
  flex: 1;
  padding: 1rem 1.2rem;
  border: 1px dashed #aaa293;
  border-radius: 0.45rem;
  overflow: auto;
}

.preview > :first-child {
  margin-top: 0;
}

.preview > :last-child {
  margin-bottom: 0;
}

.preview h1,
.preview h2,
.preview h3,
.preview h4,
.preview h5,
.preview h6 {
  max-width: none;
  margin: 1.15em 0 0.45em;
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.preview h1 { font-size: 2rem; }
.preview h2 { font-size: 1.55rem; }
.preview h3 { font-size: 1.3rem; }
.preview h4,
.preview h5,
.preview h6 { font-size: 1.08rem; }

.preview p,
.preview ul,
.preview ol,
.preview blockquote,
.preview pre {
  margin: 0.8rem 0;
}

.preview a {
  color: #075985;
  text-decoration-thickness: 0.12em;
  text-underline-offset: 0.12em;
}

.preview blockquote {
  margin-left: 0;
  padding: 0.1rem 0 0.1rem 1rem;
  color: #3f4e61;
  border-left: 0.25rem solid #d09916;
}

.preview code {
  padding: 0.12em 0.28em;
  color: #7f1d1d;
  background: #f5efe7;
  border-radius: 0.25rem;
  font-size: 0.9em;
}

.preview pre {
  padding: 1rem;
  color: #f8fafc;
  background: #172033;
  border-radius: 0.45rem;
  overflow: auto;
}

.preview pre code {
  padding: 0;
  color: inherit;
  background: transparent;
}

.preview hr {
  margin: 1.5rem 0;
  border: 0;
  border-top: 2px solid #d2ccbf;
}

.action-bar {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.15rem;
  background: var(--ink);
  border-radius: 0 0 0.8rem 0.8rem;
  box-shadow: var(--shadow);
}

.buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.button {
  display: inline-flex;
  min-height: 2.75rem;
  padding: 0.65rem 0.9rem;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  background: white;
  border: 2px solid transparent;
  border-radius: 0.4rem;
  font-weight: 750;
  line-height: 1.1;
  text-decoration: none;
  cursor: pointer;
}

.button:hover {
  background: #e8edf3;
}

.button-primary {
  color: white;
  background: #1673a6;
}

.button-primary:hover {
  background: #0f5d88;
}

.button-quiet {
  color: white;
  background: transparent;
  border-color: #8190a4;
}

.button-quiet:hover {
  background: #293950;
}

.status {
  max-width: 28rem;
  margin: 0;
  color: #e4e9ef;
  font-size: 0.88rem;
  text-align: right;
}

.status.is-error {
  color: #fecdd3;
}

.service-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1.5rem;
  align-items: center;
  margin-top: 1.5rem;
  padding: 1.25rem;
  background: var(--cream);
  border: 1px solid #d6b94d;
  border-radius: 0.8rem;
}

.service-card p:not(.eyebrow) {
  margin: 0.35rem 0 0;
  color: #51491f;
}

.service-link {
  color: white;
  background: var(--blue);
  white-space: nowrap;
}

.service-link:hover {
  background: var(--blue-dark);
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

@media (max-width: 800px) {
  .page-shell {
    width: min(100% - 1rem, 44rem);
    padding: 1.5rem 0;
  }

  .site-header,
  .workspace,
  .service-card {
    grid-template-columns: 1fr;
  }

  .site-header {
    gap: 1rem;
  }

  .editor-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .action-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .status {
    max-width: none;
    text-align: left;
  }

  .service-link {
    white-space: normal;
  }
}

@media (max-width: 480px) {
  .panel-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .file-control {
    max-width: none;
  }

  .buttons .button {
    width: 100%;
  }

  textarea,
  .preview {
    min-height: 19rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
