/* Ink & Epoch — writing room. Standalone, no site chrome: scanned on a phone, should load straight into the prompt. */

:root {
  --paper: #fbfaf7;
  --ink: #24262b;
  --ink-soft: #5c5f68;
  --accent: #a6673a;
  --rule: #d8d3c8;
  --card: #f2efe6;
  --focus-bg: #fffdf8;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Georgia, 'Iowan Old Style', 'Palatino Linotype', serif;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.wr-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(251, 250, 247, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--rule);
}

.wr-brand {
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-decoration: none;
  white-space: nowrap;
}

.wr-topbar-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.wr-btn {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 13px;
  padding: 7px 11px;
  border-radius: 8px;
  border: 1px solid var(--rule);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  line-height: 1;
}

.wr-btn:hover { border-color: var(--accent); color: var(--accent); }
.wr-btn[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }

.wr-main {
  flex: 1;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 20px 18px 60px;
}

.wr-meta {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}

.wr-title {
  font-size: clamp(28px, 5vw, 40px);
  line-height: 1.15;
  margin: 0 0 14px;
}

.wr-prompt {
  font-size: 18px;
  line-height: 1.55;
  margin: 0 0 14px;
}

.wr-context {
  font-style: italic;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.5;
  margin: 0 0 10px;
}

.wr-details {
  margin: 4px 0 20px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--card);
  overflow: hidden;
}

.wr-details summary {
  cursor: pointer;
  list-style: none;
  padding: 10px 14px;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.wr-details summary::-webkit-details-marker { display: none; }
.wr-details summary::after { content: '▸'; float: right; }
.wr-details[open] summary::after { content: '▾'; }

.wr-details-body {
  padding: 0 14px 14px;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-soft);
}

.wr-details-body h4 {
  margin: 12px 0 4px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

.wr-details-body h4:first-child { margin-top: 0; }
.wr-details-body ul { margin: 0; padding-left: 18px; }
.wr-details-body p { margin: 0; }
.wr-details-body .wr-try { font-style: italic; }

.wr-editor-wrap {
  border-top: 2px solid var(--ink);
  padding-top: 16px;
}

.wr-editor {
  min-height: 45vh;
  outline: none;
  font-size: var(--wr-font-size, 19px);
  line-height: 1.7;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.wr-editor:empty::before {
  content: attr(data-placeholder);
  color: #a9a49a;
}

.wr-statusbar {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 16px;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 12px;
  color: var(--ink-soft);
  background: rgba(251, 250, 247, 0.92);
  backdrop-filter: blur(6px);
  border-top: 1px solid var(--rule);
}

.wr-save-state[data-state="saved"] { color: #4a7c59; }
.wr-save-state[data-state="saving"] { color: var(--ink-soft); }

/* Focus mode: hide everything but the editor */
body.wr-focus .wr-meta,
body.wr-focus .wr-title,
body.wr-focus .wr-prompt,
body.wr-focus .wr-context,
body.wr-focus .wr-details {
  display: none;
}

body.wr-focus .wr-editor-wrap { border-top: none; padding-top: 4px; }
body.wr-focus .wr-editor { min-height: 70vh; }
body.wr-focus .wr-main { max-width: 680px; }

@media print {
  .wr-topbar, .wr-statusbar, .wr-details { display: none !important; }
  .wr-editor { min-height: 0; }
}

@media (max-width: 480px) {
  .wr-main { padding: 16px 14px 50px; }
  .wr-editor { font-size: var(--wr-font-size, 18px); }
}
