/* ink on paper ------------------------------------------------------------ */

@font-face {
  font-family: 'EB Garamond';
  src: url('/fonts/EBGaramond.ttf') format('truetype-variations');
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'EB Garamond';
  src: url('/fonts/EBGaramond-Italic.ttf') format('truetype-variations');
  font-weight: 400 800;
  font-style: italic;
  font-display: swap;
}

:root {
  --paper: #f3f1ea;
  --paper-deep: #eae7dd;
  --ink: #211e18;
  --ink-faded: #5f594d;
  --rule: #d8d3c5;
  --seal: #9e2c25;
  --sumi: #262319;
  --measure: 42rem;
}

* { box-sizing: border-box; }

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

body {
  margin: 0 auto;
  padding: 3.5rem 1.5rem 5rem;
  max-width: var(--measure);
  font-family: 'EB Garamond', 'Iowan Old Style', Palatino, Georgia, serif;
  font-size: 1.3rem;
  line-height: 1.72;
  color: var(--ink);
  background: var(--paper);
}

/* masthead ------------------------------------------------------------------ */

.masthead {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 4rem;
}

.seal {
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  background: var(--seal);
  color: var(--paper);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.05em;
  text-decoration: none;
  transform: rotate(-3deg);
  box-shadow: 0 0 0 1px rgba(0,0,0,.06) inset;
}
.seal:hover { transform: rotate(0deg); }

.masthead nav {
  display: flex;
  gap: 1.5rem;
  font-size: 1.05rem;
  color: var(--ink-faded);
}
.masthead nav a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.masthead nav a:hover {
  color: var(--ink);
  border-bottom-color: var(--seal);
}

/* type ------------------------------------------------------------------------ */

h1 {
  font-size: 2.6rem;
  font-weight: 550;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 1.5rem;
}

h2 {
  font-size: 1.7rem;
  font-weight: 550;
  margin: 3rem 0 0.75rem;
}

h3 {
  font-size: 1.25rem;
  font-weight: 650;
  margin: 2.25rem 0 0.5rem;
}

p { margin: 0 0 1.25rem; }

.intro { font-size: 1.35rem; }

.aside {
  color: var(--ink-faded);
  font-style: italic;
  font-size: 1.1rem;
}

a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--seal);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}
a:hover { color: var(--seal); }

hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 3rem 0;
}

/* article lists ----------------------------------------------------------------- */

ul.articles {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0;
}
ul.articles li {
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--rule);
}
ul.articles li:first-child { border-top: 1px solid var(--rule); }
ul.articles a { text-decoration: none; }
ul.articles a:hover { color: var(--seal); }

ul.manage li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}
.row-actions {
  display: flex;
  gap: 1rem;
  font-size: 1rem;
  color: var(--ink-faded);
  flex-shrink: 0;
}
.row-actions form { display: inline; }

/* article body ---------------------------------------------------------------- */

article img {
  display: block;
  width: 100%;
  height: auto;
  margin: 2rem 0 0.5rem;
  border: 1px solid var(--rule);
}
article img + em, article em:has(+ img) { color: var(--ink-faded); }

article ul, article ol { margin: 0 0 1.25rem; padding-left: 1.5rem; }
article li { margin-bottom: 0.4rem; }

blockquote {
  margin: 2rem 0;
  padding-left: 1.25rem;
  border-left: 2px solid var(--seal);
  font-style: italic;
  color: var(--ink-faded);
}

code {
  font-family: ui-monospace, 'Cascadia Code', Menlo, Consolas, monospace;
  font-size: 0.85em;
  background: var(--paper-deep);
  padding: 0.1em 0.35em;
}

pre {
  background: var(--sumi);
  color: #ece8db;
  padding: 1.1rem 1.3rem;
  overflow-x: auto;
  margin: 1.5rem 0;
  line-height: 1.5;
}
pre code { background: none; padding: 0; color: inherit; }

/* forms ------------------------------------------------------------------------- */

.stack { display: flex; flex-direction: column; gap: 1.25rem; max-width: 34rem; }
.editor { max-width: none; }

label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 1.1rem; }

input[type="text"], input[type="password"], textarea {
  font: inherit;
  font-size: 1.1rem;
  color: var(--ink);
  background: #fffdf8;
  border: 1px solid var(--rule);
  padding: 0.55rem 0.75rem;
}
input:focus, textarea:focus, button:focus-visible {
  outline: 2px solid var(--seal);
  outline-offset: 1px;
}

textarea {
  font-family: ui-monospace, 'Cascadia Code', Menlo, Consolas, monospace;
  font-size: 0.95rem;
  line-height: 1.6;
  resize: vertical;
}

button, .button {
  font: inherit;
  font-size: 1.05rem;
  padding: 0.5rem 1.4rem;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button[type="submit"], .button {
  background: var(--seal);
  border-color: var(--seal);
  color: var(--paper);
}
button:hover, .button:hover { opacity: 0.85; }

.link-button {
  border: 0;
  padding: 0;
  background: none;
  font-size: inherit;
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--seal);
  text-underline-offset: 0.2em;
}
.link-button:hover { color: var(--seal); opacity: 1; }

.editor-tools {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.upload {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  color: var(--ink-faded);
  font-size: 1rem;
}
.upload input { font-size: 0.9rem; }

.preview {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
}
.preview::before {
  content: 'Preview';
  display: block;
  font-style: italic;
  color: var(--ink-faded);
  margin-bottom: 1rem;
}
.preview img { max-width: 100%; }

.error { color: var(--seal); font-weight: 600; }

/* footer ------------------------------------------------------------------------ */

footer {
  margin-top: 6rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font-size: 0.95rem;
  color: var(--ink-faded);
}

@media (max-width: 600px) {
  body { padding: 2rem 1.1rem 4rem; font-size: 1.18rem; }
  h1 { font-size: 2.1rem; }
  .masthead { margin-bottom: 2.5rem; }
}

@media (prefers-reduced-motion: no-preference) {
  .seal { transition: transform 0.25s ease; }
}
