/* ============================================================
   Base & layout
   ============================================================ */

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  font-family: var(--font-mono);
  font-size: var(--text-base);
  line-height: var(--leading);
  margin: 0;
  padding: 0;
  color: var(--ink);
  background-color: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Yellow highlighter for selected text — the writer's own highlight. */
::selection {
  background: var(--reward-tint);
  color: var(--ink);
}

h1, h2, h3, h4 {
  color: var(--ink);
  line-height: var(--leading-tight);
  letter-spacing: -0.01em;
  font-weight: 600;
}

h1 { font-size: var(--text-2xl); margin: 0 0 var(--space-5); }
h2 { font-size: var(--text-xl); margin: 0 0 var(--space-4); }
h3 { font-size: var(--text-lg); margin: 0 0 var(--space-3); }

a {
  color: var(--accent-strong);
  text-decoration: none;
  text-underline-offset: 0.15em;
  transition: color var(--transition);
}

a:hover {
  color: var(--ink);
  text-decoration: underline;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
}

hr {
  border: none;
  border-top: 1px solid var(--rule);
  margin: var(--space-5) 0;
}

.container {
  width: 90%;
  max-width: 1080px;
  margin: 0 auto;
  padding: var(--space-4);
}

/* — Masthead — */
header {
  background-color: transparent;
  border-bottom: 1px solid var(--rule);
  padding: var(--space-3) 0;
}

nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

nav .brand {
  font-family: var(--font-mono);
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: -0.02em;
  text-decoration: none;
  color: var(--ink);
}

nav .brand:hover {
  color: var(--ink);
  text-decoration: none;
}

nav ul {
  display: flex;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: var(--space-5);
}

nav ul li {
  margin: 0;
}

nav ul li a {
  font-size: var(--text-sm);
  text-decoration: none;
  color: var(--ink-muted);
  transition: color var(--transition);
}

nav ul li a:hover {
  color: var(--accent-strong);
  text-decoration: none;
}

/* — Writing surface — */
.editor-container {
  max-width: 760px;
  margin: 0 auto;
  padding: var(--space-7) var(--space-4);
}

.editor-header {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-bottom: var(--space-5);
}

.editor-footer {
  margin-top: var(--space-6);
  text-align: center;
}

.editor-intro {
  text-align: center;
  font-size: var(--text-sm);
  color: var(--ink-muted);
}

.editor-intro p {
  margin-bottom: var(--space-3);
}

.editor-intro-actions {
  display: flex;
  justify-content: center;
  gap: var(--space-3);
}

.editor-divider {
  border: none;
  border-top: 1px solid var(--rule);
  margin: var(--space-5) 0;
}

@media (max-width: 640px) {
  nav ul { gap: var(--space-4); }
  h1 { font-size: var(--text-xl); }
}
