/* ============================================================
   The Honest Draft — stylesheet
   Ink & Paper. Quiet, readable, calm.
   ============================================================ */

:root {
  /* "Bond Street Blue" — pale Smythson blue paper, deep navy ink,
     muted antique-gold accent used sparingly. */
  --paper:       #d8e2e8;
  --paper-soft:  #c5d3dd;
  --ink:         #1a2238;
  --ink-soft:    #4a5670;
  --ink-faint:   #8895a8;
  --accent:      #9a7a36;
  --accent-soft: #e6dabd;
  --rule:        #b4c2cc;

  --measure: 38rem;

  --sans:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --serif:   'Source Serif 4', Georgia, 'Times New Roman', serif;
  --display: 'Newsreader', Georgia, 'Times New Roman', serif;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; }
html, body, h1, h2, h3, h4, p, ul, ol, li, figure, blockquote { margin: 0; padding: 0; }
ul { list-style: none; }
img { max-width: 100%; height: auto; display: block; }

html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  animation: pageFade 0.6s ease both;
}

.wrap {
  max-width: 46rem;
  margin: 0 auto;
  padding: clamp(2rem, 6vw, 4.5rem) 1.6rem 5rem;
}

/* Links — default tone */
a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: var(--rule);
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}
a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

/* Focus — keyboard-friendly */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---------- Masthead ---------- */
header.masthead {
  text-align: center;
  padding-bottom: 1.6rem;
  margin-bottom: 2.6rem;
  border-bottom: 1px solid var(--rule);
}

.kicker {
  font-family: var(--sans);
  font-size: 0.7rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 1rem;
}

.brand {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(2.4rem, 7vw, 3.6rem);
  line-height: 1.02;
  letter-spacing: -0.01em;
}
.brand a {
  color: var(--ink);
  text-decoration: none;
}
.brand a:hover {
  color: var(--accent);
}

.tagline {
  margin-top: 0.85rem;
  font-style: italic;
  color: var(--ink-soft);
  font-size: 1.05rem;
}

nav {
  margin-top: 1.5rem;
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  font-family: var(--sans);
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
nav a {
  color: var(--ink-soft);
  text-decoration: none;
  padding-bottom: 3px;
  border-bottom: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}
nav a:hover,
nav a.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ---------- Index ---------- */
.intro {
  text-align: center;
  max-width: 34rem;
  margin: 0 auto 3rem;
  color: var(--ink-soft);
  font-size: 1.06rem;
}

.post-list {
  margin: 0;
  padding: 0;
}
.post-item {
  border-bottom: 1px solid var(--rule);
  animation: rise 0.7s ease both;
}
.post-item:last-child {
  border-bottom: 0;
}
.post-link {
  display: block;
  padding: 1.6rem 0;
  color: inherit;
  text-decoration: none;
}
.post-link:hover .pi-title { color: var(--accent); }
.post-link:hover .pi-arrow {
  transform: translateX(4px);
  opacity: 1;
}

.pi-meta {
  font-family: var(--sans);
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 0.55rem;
}
.pi-title {
  font-family: var(--display);
  font-weight: 500;
  font-size: 1.6rem;
  line-height: 1.15;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  color: var(--ink);
  transition: color 0.2s;
}
.pi-arrow {
  color: var(--accent);
  opacity: 0;
  transition: transform 0.25s, opacity 0.25s;
  font-size: 1rem;
}
.pi-excerpt {
  margin-top: 0.5rem;
  color: var(--ink-soft);
  font-size: 1rem;
}

/* ---------- Single post ---------- */
.back {
  display: inline-block;
  margin-bottom: 2.2rem;
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-decoration: none;
}
.back:hover {
  color: var(--accent);
}

.post-meta {
  font-family: var(--sans);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 0.9rem;
  text-align: center;
}
.post-meta a {
  color: var(--ink-faint);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
}
.post-meta a:hover {
  color: var(--accent);
}

article .post-title {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(1.9rem, 5.5vw, 2.7rem);
  line-height: 1.1;
  letter-spacing: -0.01em;
  text-align: center;
  margin-bottom: 2.4rem;
  color: var(--ink);
}

.post-body {
  max-width: var(--measure);
  margin: 0 auto;
}
.post-body p { margin-bottom: 1.35rem; }

/* Drop cap — subtle, matches accent, only on the first paragraph */
.post-body > p:first-of-type::first-letter {
  font-family: var(--display);
  font-weight: 500;
  float: left;
  font-size: 2.4rem;
  line-height: 0.9;
  padding: 0.18rem 0.38rem 0 0;
  color: var(--accent);
}

.post-body .stanza {
  color: var(--ink-soft);
  margin-bottom: 1.35rem;
}
.post-body h3 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.3rem;
  margin: 2.2rem 0 0.8rem;
  color: var(--ink);
}
.post-body h4 {
  font-family: var(--display);
  font-weight: 500;
  font-size: 1.1rem;
  margin: 1.8rem 0 0.6rem;
  color: var(--ink);
}
.post-body em { color: var(--ink-soft); }
.post-body strong { color: var(--ink); }

.post-body a {
  color: var(--accent);
  text-decoration-color: var(--accent-soft);
}
.post-body a:hover {
  text-decoration-color: var(--accent);
}

.post-body blockquote {
  border-left: 2px solid var(--rule);
  padding-left: 1.2rem;
  margin: 1.6rem 0;
  color: var(--ink-soft);
  font-style: italic;
}

.post-body ul,
.post-body ol {
  margin: 0 0 1.35rem 1.4rem;
  padding: 0;
}
.post-body ul { list-style: disc; }
.post-body ol { list-style: decimal; }
.post-body li { margin-bottom: 0.4rem; }

.post-body code {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 0.9em;
  background: var(--paper-soft);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}
.post-body pre {
  background: var(--paper-soft);
  padding: 1rem 1.2rem;
  border-radius: 4px;
  overflow-x: auto;
  margin-bottom: 1.35rem;
  font-size: 0.9rem;
  line-height: 1.55;
}
.post-body pre code {
  background: none;
  padding: 0;
}

.post-body hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 2.4rem auto;
  width: 6rem;
}

.endmark {
  text-align: center;
  margin-top: 2.6rem;
  color: var(--ink-faint);
  letter-spacing: 0.5em;
  font-size: 0.9rem;
}

/* ---------- About / generic prose ---------- */
.about {
  max-width: var(--measure);
  margin: 0 auto;
}
.about h1 {
  font-family: var(--display);
  font-weight: 500;
  font-size: 2.1rem;
  margin-bottom: 1.4rem;
  text-align: center;
  color: var(--ink);
}
.about p {
  margin-bottom: 1.2rem;
  color: var(--ink-soft);
}
.about a {
  color: var(--accent);
  text-decoration-color: var(--accent-soft);
}

/* ---------- Comments (Remark42) ---------- */
/* The Remark42 widget renders into real DOM (no Shadow DOM), so we can
   override its colours and chrome with regular CSS. Class names use BEM
   conventions — we target by class-name *prefix* (e.g. [class*="input"])
   so hashing or version bumps don't break this entirely. */

.comments {
  max-width: var(--measure);
  margin: 3.5rem auto 0;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
}
.comments-heading {
  font-family: var(--display);
  font-weight: 500;
  font-size: 1.3rem;
  margin-bottom: 1.4rem;
  color: var(--ink);
  text-align: center;
  letter-spacing: 0.02em;
}

#remark42 {
  font-family: var(--serif) !important;
  font-size: 1rem;
  color: var(--ink);
}

/* Outer widget wrappers — kill the default grey panel backgrounds. */
.comments .remark42,
.comments [class*="root"],
.comments [class*="comment-form"],
.comments [class*="auth-panel"] {
  background: transparent !important;
  border-color: var(--rule) !important;
}

/* The comment textarea — paper background, gentle border, our typography. */
.comments [class*="input"] textarea,
.comments textarea[class*="input"],
.comments [class*="textarea"] {
  background: var(--paper) !important;
  border: 1px solid var(--rule) !important;
  border-radius: 4px !important;
  color: var(--ink) !important;
  font-family: var(--serif) !important;
  font-size: 1rem !important;
  padding: 0.9rem 1rem !important;
}
.comments [class*="input"] textarea:focus,
.comments textarea:focus {
  border-color: var(--accent) !important;
  outline: none !important;
  box-shadow: 0 0 0 3px var(--accent-soft) !important;
}

/* Buttons — accent gold instead of teal. */
.comments button,
.comments [class*="button"] {
  background: var(--ink) !important;
  color: var(--paper) !important;
  border: 0 !important;
  border-radius: 3px !important;
  font-family: var(--sans) !important;
  font-size: 0.78rem !important;
  font-weight: 500 !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase !important;
  padding: 0.55rem 1.1rem !important;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.comments button:hover,
.comments [class*="button"]:hover {
  background: var(--accent) !important;
  color: var(--paper) !important;
}

/* Subdued / secondary buttons (e.g. dropdown arrows, cancel, reply). */
.comments [class*="dropdown__toggle"],
.comments [class*="secondary"] {
  background: transparent !important;
  color: var(--ink-soft) !important;
}
.comments [class*="dropdown__toggle"]:hover {
  background: var(--paper-soft) !important;
  color: var(--ink) !important;
}

/* Inline text links inside the widget. */
.comments a,
.comments [class*="link"] {
  color: var(--accent) !important;
  text-decoration: none !important;
  border-bottom: 1px solid var(--accent-soft);
}
.comments a:hover {
  border-bottom-color: var(--accent) !important;
}

/* Individual comments — calm cards. */
.comments [class*="comment"][class*="root"],
.comments [class*="comment-item"],
.comments [class*="comment "] {
  background: transparent !important;
  border: 0 !important;
  padding-top: 1.1rem !important;
  padding-bottom: 1.1rem !important;
  border-bottom: 1px solid var(--rule) !important;
}

/* Comment author name + date row. */
.comments [class*="username"],
.comments [class*="user-name"] {
  font-family: var(--sans) !important;
  font-weight: 500 !important;
  font-size: 0.85rem !important;
  color: var(--ink) !important;
}
.comments [class*="time"],
.comments [class*="timestamp"] {
  font-family: var(--sans) !important;
  font-size: 0.72rem !important;
  letter-spacing: 0.05em !important;
  color: var(--ink-faint) !important;
}

/* Tame the avatar — circular, accent-tinted, no neon. */
.comments [class*="avatar"] {
  background: var(--accent-soft) !important;
  color: var(--accent) !important;
  border-radius: 50% !important;
  width: 32px !important;
  height: 32px !important;
}

/* The comment body itself — body serif, soft ink. */
.comments [class*="comment__body"],
.comments [class*="text"] p {
  font-family: var(--serif) !important;
  color: var(--ink) !important;
  line-height: 1.6 !important;
}

/* ---------- Footer ---------- */
footer {
  margin-top: 4rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--rule);
  text-align: center;
  font-family: var(--sans);
  font-size: 0.74rem;
  color: var(--ink-faint);
  line-height: 1.9;
}
footer .sub {
  font-family: var(--serif);
  font-style: italic;
}
.foot-links {
  margin-bottom: 0.7rem;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.foot-links a {
  color: var(--ink-soft);
  text-decoration: none;
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}
.foot-links a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.foot-links .dot {
  color: var(--ink-faint);
  margin: 0 0.5rem;
}

/* Post coda — a quiet sign-off below the endmark, above comments. */
.post-coda {
  max-width: var(--measure);
  margin: 1.4rem auto 0;
  text-align: center;
  font-family: var(--sans);
  font-size: 0.82rem;
  color: var(--ink-faint);
  line-height: 1.6;
}
.post-coda a {
  color: var(--accent);
  text-decoration-color: var(--accent-soft);
}

/* Small utility classes for prose pages (e.g. /now/) */
.about .muted { color: var(--ink-faint); }
.about .small { font-size: 0.85rem; }
.about h2 {
  font-family: var(--display);
  font-weight: 500;
  font-size: 1.3rem;
  margin: 2rem 0 0.8rem;
  color: var(--ink);
  text-align: left;
}
.about ul {
  list-style: disc;
  margin: 0 0 1.2rem 1.4rem;
  color: var(--ink-soft);
}
.about ul li { margin-bottom: 0.4rem; }

/* ---------- Animations ---------- */
@keyframes pageFade {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- Small screens ---------- */
@media (max-width: 480px) {
  body { font-size: 18px; }
  .wrap { padding-left: 1.2rem; padding-right: 1.2rem; }
  .pi-title { font-size: 1.4rem; }
  nav { gap: 1.1rem; }
}
