:root {
  color-scheme: light;
  --paper: #f3efe6;
  --ink: #1e1a16;
  --muted: #6e675e;
  --line: #e2d9c8;
  --card: #fffcf6;
  --green: #1d6b48;
  --green-ink: #f4fbf7;
  --danger: #8d3a2c;
}

* { box-sizing: border-box; }

html { background: var(--paper); }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 1.0625rem;
  line-height: 1.5;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

main {
  width: min(40rem, calc(100% - 2rem));
  margin: 0 auto;
  padding-bottom: calc(2rem + env(safe-area-inset-bottom));
}

a { color: var(--green); }

button, input, textarea { font: inherit; color: inherit; }

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

.top {
  width: min(40rem, calc(100% - 2rem));
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding-top: calc(0.75rem + env(safe-area-inset-top));
}

.brand {
  color: inherit;
  text-decoration: none;
  font-size: 1.45rem;
}

.who {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  color: var(--muted);
  font-size: 0.92rem;
  max-width: 60%;
}

.who span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.kicker {
  margin: 0;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.78rem;
  color: var(--green);
}

h1 {
  font-size: clamp(2.2rem, 8vw, 3.2rem);
  font-weight: 500;
  line-height: 1.1;
  margin: 0.2rem 0 0.6rem;
}

.lede, .meta, .empty { color: var(--muted); }

.error { color: var(--danger); }

.gate { padding-top: calc(14vh + env(safe-area-inset-top)); }

.button, button.button, a.button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.55rem 1.15rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
}

a.button.primary,
button.button.primary,
.button.primary {
  background: var(--green);
  border-color: var(--green);
  color: var(--green-ink);
}

.linkish {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  text-decoration: underline;
  min-height: 44px;
  padding: 0;
  cursor: pointer;
}

.danger { color: var(--danger); }

.new-note {
  width: 100%;
  margin: 0.4rem 0 1rem;
}

.notes { display: flex; flex-direction: column; gap: 0.75rem; }

.note-card {
  display: block;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1rem 1.05rem 0.85rem;
  text-decoration: none;
  color: inherit;
}

.note-card h2 {
  margin: 0 0 0.25rem;
  font-size: 1.3rem;
  font-weight: 600;
}

.note-card p { margin: 0; color: var(--muted); }

.note-card time {
  display: block;
  margin-top: 0.55rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.editor input[type="text"],
.editor textarea {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0.2rem 0;
}

.editor input[type="text"] {
  font-size: 2rem;
  font-weight: 500;
  margin-top: 0.6rem;
}

.editor textarea {
  min-height: 42vh;
  resize: vertical;
  line-height: 1.55;
}

.preview { padding-bottom: 1rem; }

.savebar {
  position: sticky;
  bottom: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding: 0.8rem 0 calc(0.8rem + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, var(--paper) 28%);
}

.actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 2rem;
}

.prose { overflow-wrap: anywhere; }

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

.prose pre {
  overflow-x: auto;
  background: #ebe4d6;
  padding: 0.85rem 1rem;
  border-radius: 12px;
}

.prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
}

.prose blockquote {
  margin-left: 0;
  padding-left: 0.9rem;
  border-left: 3px solid var(--green);
  color: var(--muted);
}

.prose img, .prose table { max-width: 100%; }

.prose table { border-collapse: collapse; display: block; overflow-x: auto; }

.prose th, .prose td {
  border: 1px solid var(--line);
  padding: 0.35rem 0.55rem;
}
