:root {
  color-scheme: light;
  --paper: #f4efe3;
  --panel: #fffdf7;
  --ink: #1e2c25;
  --muted: #545b4f;
  --border: #d8cebb;
  --green: #345238;
  --accent: #a33723;
  --mono: ui-monospace, 'SFMono-Regular', Consolas, monospace;
  color: var(--ink);
  background: var(--paper);
  font: 16px/1.5 system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
a { color: inherit; text-underline-offset: .2em; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
button, input, select, textarea { color: inherit; font: inherit; }

.frame { width: min(100% - 3rem, 68rem); margin-inline: auto; }
.bar { background: #212b25; color: var(--panel); }
.bar-inner { min-height: 3.5rem; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .25rem 1rem; }
.bar-inner > a { display: inline-flex; align-items: center; min-height: 2.75rem; }
.bar .brand { font: 750 .9rem/1 var(--mono); letter-spacing: .09em; text-decoration: none; text-transform: uppercase; }
.bar :focus-visible { outline-color: #ecc8a2; }

main { padding-block: clamp(1.5rem, 4vw, 3rem) 2rem; }
.intro { margin-bottom: clamp(1.35rem, 3vw, 2rem); }
.intro h1, h2 { font-family: Georgia, 'Times New Roman', serif; font-weight: 500; letter-spacing: -.045em; }
.intro h1 { margin: 0; font-size: clamp(2.5rem, 7vw, 4.4rem); line-height: 1; }
.intro p { margin: .7rem 0 0; color: var(--muted); }
h2 { margin: 0; font-size: 1.7rem; line-height: 1.1; }

.workbench { display: grid; grid-template-columns: minmax(0, 23rem) minmax(0, 1fr); align-items: start; gap: 1rem; }
.panel { min-width: 0; border: 1px solid var(--border); border-radius: .6rem; background: var(--panel); }
.config { padding: clamp(1rem, 3vw, 1.35rem); }
.choices { margin: 1rem 0 0; padding: 0; border: 0; }
.choices legend, .config label[for] { margin-bottom: .4rem; font-size: .88rem; font-weight: 700; }
.mode { display: flex; align-items: flex-start; gap: .65rem; min-height: 3.4rem; padding: .65rem; border: 1px solid var(--border); border-radius: .35rem; cursor: pointer; }
.mode + .mode { margin-top: .4rem; }
.mode:has(:checked) { border-color: #788a67; background: #edf0e3; }
.mode input { margin: .3rem 0 0; accent-color: var(--green); }
.mode strong, .mode small { display: block; }
.mode small, .help { color: var(--muted); font-size: .83rem; }

.date-field, .language-field, .snippet { margin-top: 1rem; }
.config label[for] { display: block; }
.date-field input, .language-field select { min-width: 0; width: 100%; min-height: 2.75rem; border: 1px solid var(--border); border-radius: .3rem; background: #fff; padding: .4rem .55rem; }
.error { margin: .35rem 0 0; color: #882b1c; font-size: .85rem; }
textarea { display: block; width: 100%; padding: .65rem; border: 1px solid var(--border); border-radius: .3rem; background: #f8f3e8; font: .78rem/1.45 var(--mono); resize: vertical; }
button { min-height: 2.75rem; margin-top: .65rem; border: 1px solid var(--green); border-radius: .35rem; background: var(--green); color: white; cursor: pointer; font-weight: 700; padding-inline: .9rem; }
button:hover:not(:disabled) { background: #253f29; }
button:disabled { opacity: .55; cursor: default; }
.status { margin: .35rem 0 0; font-size: .88rem; min-height: 1.35em; }
.help { margin: .55rem 0 0; }

.preview { overflow: clip; }
.preview-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .25rem .75rem; padding: .65rem 1rem; border-bottom: 1px solid var(--border); }
.preview-heading a { display: inline-flex; min-height: 2.75rem; align-items: center; gap: .25rem; font-size: .88rem; font-weight: 700; }
.preview-heading + iframe { display: block; width: 100%; border: 0; background: var(--paper); }
#preview-empty { padding: 0 1rem 1rem; }

@media (max-width: 50rem) {
  .workbench { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 35rem) {
  .frame { width: min(100% - 1.5rem, 68rem); }
  .preview { margin-inline: -.55rem; }
  .preview-heading { padding-inline: .65rem; }
}
