/* Blog, docs, book submission and other text pages. Loaded after home.css,
   which holds the colours, type, navigation, buttons, the download section
   and the footer. */

[hidden] { display: none !important; }
.nav a[aria-current='page'] { color: var(--ink); font-weight: 600; }

.container { padding-inline: var(--edge); }
footer .container { padding-inline: 0; }
.eyebrow, .post-kicker, .article-meta, .terms-version {
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
  color: var(--body);
}
.text-link, .prose a, .markdown-content a, .rights-check a, .next-post__all a { color: var(--sage); }

/* ---------- Page title block (blog list, posts) ---------- */
.page-title {
  font-size: clamp(56px, 6.1vw, 88px);
  line-height: 0.86;
  letter-spacing: -0.025em;
}
.page-subtitle { font-size: 21px; line-height: 1.6; }

.blog-hero .blog-column {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 64px;
  padding-top: 72px;
  padding-bottom: 72px;
}
.blog-hero .eyebrow { display: none; }
.blog-hero .page-title { max-width: 720px; }
.blog-hero .page-subtitle { flex: 0 0 440px; padding-bottom: 8px; }

/* ---------- Blog list ---------- */
.blog-list { padding-bottom: 150px; }
.post { border-top: 1px solid var(--rule); }
.post:first-child { border-top-color: var(--rule-strong); }
.post:last-child { border-bottom: 1px solid var(--rule); }
.post-link {
  display: grid;
  grid-template-columns: 480px minmax(0, 680px);
  grid-template-areas: 'image kicker' 'image title' 'image excerpt' 'image cta';
  grid-template-rows: 1fr auto auto 1fr;
  column-gap: 72px;
  row-gap: 14px;
  padding: 40px 0;
  color: inherit;
  text-decoration: none;
}
.post-kicker { grid-area: kicker; align-self: end; }
.post-title {
  grid-area: title;
  font-size: 44px;
  line-height: 1.05;
}
.post-link:hover .post-title { text-decoration: underline; text-decoration-color: var(--sage); text-decoration-thickness: 1px; text-underline-offset: 6px; }
.post-image { grid-area: image; margin: 0; align-self: center; }
.post-image img, .article-hero-image img, .next-post__link img {
  width: 100%;
  border: 1px solid var(--rule);
  border-radius: 14px;
}
.post-image img { aspect-ratio: 16 / 9; object-fit: cover; }
.post-excerpt { grid-area: excerpt; }
.post-cta { grid-area: cta; font-weight: 400; font-size: 16px; color: var(--sage); text-decoration: underline; }

/* ---------- Blog post ---------- */
.page-hero .article {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding-top: 72px;
  padding-bottom: 48px;
}
.page-hero .page-title { max-width: 1000px; }
.page-hero .page-subtitle { max-width: 680px; }
.article-hero-image { margin: 0; padding-bottom: 64px; }
.article-hero-image img { max-width: 1040px; }
.article-hero-image figcaption { margin-top: 12px; font-size: 15px; }
.article-hero-image figcaption a { color: inherit; }

.section > .article { padding-bottom: 120px; }
.section > .article > *, .terms-page > * { max-width: 680px; }
.section > .article > * + *, .terms-page > * + * { margin-top: 22px; }
.section h2, .markdown-content h2, .terms-page h2 {
  margin-top: 48px;
  font-size: 44px;
  line-height: 1.05;
}
.section h3, .markdown-content h3 {
  margin: 36px 0 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 32px;
  line-height: 1.15;
  color: var(--ink);
}
.section ul, .section ol, .markdown-content ul, .markdown-content ol, .terms-page ul, .terms-page ol { margin-bottom: 0; padding-left: 1.3em; }
.section li + li, .markdown-content li + li { margin-top: 8px; }
.section li::marker, .markdown-content li::marker { color: var(--ink); font-weight: 600; }
.section strong, .markdown-content strong, .terms-page strong { font-weight: 600; color: var(--ink); }
.section a { color: var(--sage); }
.section img { border-radius: 14px; border: 1px solid var(--rule); }

.next-post { padding-bottom: 120px; }
.next-post .article { display: grid; grid-template-columns: 328px 1fr auto; align-items: center; gap: 28px 32px; }
.next-post .article::before { content: ''; grid-column: 1 / -1; border-top: 1px solid var(--rule-strong); }
.next-post .article::after { content: ''; grid-column: 1 / -1; border-top: 1px solid var(--rule); }
.next-post__label, .next-post__all { margin: 0; font-size: 15px; }
.next-post__link { display: flex; align-items: center; gap: 24px; color: inherit; text-decoration: none; }
.next-post__link img { flex: 0 0 160px; width: 160px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 10px; }
.next-post__text { display: flex; flex-direction: column; gap: 4px; }
.next-post__title { font-family: var(--serif); font-weight: 500; font-size: 32px; line-height: 1.15; color: var(--ink); }
.next-post__link:hover .next-post__title { text-decoration: underline; text-decoration-color: var(--sage); text-decoration-thickness: 1px; }
.next-post .post-cta { display: none; }

/* ---------- Docs ---------- */
.docs-container {
  display: flex;
  gap: 72px;
  padding: 72px var(--edge) 120px;
}
.docs-sidebar { flex: 0 0 240px; padding-top: 14px; }
.docs-sidebar-header { display: none; }
.docs-menu > summary { display: none; }
.docs-nav { display: flex; flex-direction: column; gap: 26px; }
.docs-nav-section-title { margin: 0 0 4px; font-family: var(--sans); font-weight: 600; font-size: 14px; line-height: 30px; color: var(--ink); }
.docs-nav ul { margin: 0; padding: 0; list-style: none; }
.docs-nav-link { display: block; font-size: 15px; line-height: 30px; color: var(--body); text-decoration: none; cursor: pointer; }
.docs-nav-link:hover { color: var(--ink); }
.docs-nav-link.active { color: var(--ink); font-weight: 600; }

.docs-main { flex: 1; min-width: 0; }
.docs-content { position: relative; max-width: 680px; }
.docs-toolbar { display: none; justify-content: flex-end; margin-bottom: 18px; }
.docs-toolbar.visible { display: flex; }
.copy-markdown-button {
  padding: 10px 16px;
  border: 1px solid var(--rule-strong);
  border-radius: 12px;
  background: none;
  color: var(--ink);
  font: 600 14px/1.2 var(--sans);
  cursor: pointer;
}
.copy-markdown-button:hover { border-color: var(--sage); }

.markdown-content > * + * { margin-top: 22px; }
.markdown-content h1 {
  font-size: 60px;
  line-height: 0.97;
}
.markdown-content h1 + * { margin-top: 26px; }
.markdown-content code {
  padding: 2px 6px;
  border-radius: 6px;
  background: #161a18;
  color: var(--ink);
  font: 0.88em/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.markdown-content pre {
  margin: 0;
  padding: 16px 18px;
  border-radius: 12px;
  background: #161a18;
  overflow-x: auto;
}
.markdown-content pre code { padding: 0; background: none; font-size: 14px; line-height: 22px; }
.markdown-content table { width: 100%; border-collapse: collapse; font-size: 15px; }
.markdown-content th, .markdown-content td { padding: 12px 16px 12px 0; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: top; }
.markdown-content th { font-weight: 600; color: var(--ink); }
.markdown-content blockquote { margin: 0; padding-left: 20px; border-left: 1px solid var(--rule-strong); }
.markdown-content hr { border: 0; border-top: 1px solid var(--rule); }
.markdown-content img { border-radius: 14px; border: 1px solid var(--rule); }
.loading, .error { font-size: 15px; }
.error { color: #f0b9a8; }

/* ---------- Submit a book ---------- */
.submit {
  display: flex;
  justify-content: space-between;
  gap: 72px;
  padding: 72px var(--edge) 120px;
}
.submit-about { display: flex; flex-direction: column; gap: 22px; max-width: 600px; }
.submit-about .page-subtitle { max-width: 440px; }
.submit-about .plain-steps {
  display: grid;
  gap: 4px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}
.plain-steps li { display: flex; gap: 14px; counter-increment: step; }
.plain-steps li::before { content: counter(step); flex: 0 0 18px; font-weight: 600; color: var(--ink); }

.submit-workspace { flex: 0 0 480px; padding-top: 14px; }
.submit-workspace form, .auth-card, #submission-fields { display: flex; flex-direction: column; gap: 20px; }
.submit-workspace label { display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.submit-workspace input:not([type='checkbox']):not([type='file']),
.submit-workspace textarea {
  width: 100%;
  padding: 15px 16px;
  border: 1px solid var(--rule-strong);
  border-radius: 12px;
  background: #161a18;
  color: var(--ink);
  font: 300 16px/1.4 var(--sans);
}
.submit-workspace textarea { resize: vertical; }
.submit-workspace ::placeholder { color: #9aa09b; }
.inline-form { display: flex; gap: 10px; }
.inline-form input { flex: 1; min-width: 0; }
.inline-form .btn { white-space: nowrap; }
.form-note { font-size: 14px; }
.form-error { font-size: 14px; color: #f0b9a8; }
.quiet-button {
  align-self: flex-start;
  padding: 0;
  border: 0;
  background: none;
  color: var(--sage);
  font: 400 15px/1.6 var(--sans);
  text-decoration: underline;
  cursor: pointer;
}
.signed-in-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--rule);
  font-size: 15px;
}
.signed-in-row .quiet-button { align-self: auto; }
.submit-workspace .epub-dropzone {
  position: relative;
  align-items: center;
  gap: 6px;
  padding: 34px 20px;
  border: 1px dashed var(--rule-strong);
  border-radius: 12px;
  background: #161a18;
  text-align: center;
  cursor: pointer;
}
.epub-dropzone.is-dragging, .epub-dropzone:hover { border-color: var(--sage); }
.epub-dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.epub-dropzone:focus-within { outline: 2px solid var(--sage); outline-offset: 3px; }
.drop-mark { display: none; }
.epub-dropzone strong { font-weight: 600; font-size: 16px; color: var(--ink); }
.epub-dropzone small { font-size: 14px; }
.book-fields-head { display: flex; gap: 16px; align-items: flex-start; }
#epub-cover-preview { flex: 0 0 96px; width: 96px; border-radius: 6px; border: 1px solid var(--rule); }
#epub-cover-preview:not([src]), #epub-cover-preview[src=''] { display: none; }
.field-pair { display: flex; flex-direction: column; gap: 20px; flex: 1; min-width: 0; }
.field-row { display: flex; gap: 14px; }
.field-row label { flex: 1; min-width: 0; }
.submit-workspace .rights-check { flex-direction: row; align-items: flex-start; gap: 12px; font-size: 15px; line-height: 1.6; }
.rights-check input { flex: 0 0 20px; width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--sage); }
.submit-workspace .btn[type='submit'] { align-self: flex-start; }
.is-busy { opacity: 0.6; pointer-events: none; }

/* ---------- Thanks and terms ---------- */
.thanks-page, .terms-page { padding: 120px var(--edge); }
.thanks-page { display: flex; flex-direction: column; align-items: flex-start; gap: 22px; }
.thanks-mark { display: none; }
.thanks-page h1, .terms-page h1 { font-size: clamp(56px, 6.1vw, 88px); line-height: 0.86; letter-spacing: -0.025em; }
.thanks-page p { font-size: 21px; line-height: 1.6; }

@media (max-width: 1180px) {
  .blog-hero .blog-column { gap: 40px; }
  .blog-hero .page-subtitle { flex-basis: 340px; }
  .post-link { grid-template-columns: 340px minmax(0, 1fr); column-gap: 48px; }
  .post-title { font-size: 36px; }
  .docs-container, .submit { gap: 48px; }
  .docs-sidebar { flex-basis: 200px; }
  .submit-workspace { flex-basis: 420px; }
  .next-post .article { grid-template-columns: 200px 1fr auto; }
}

@media (max-width: 760px) {
  .page-title, .thanks-page h1, .terms-page h1 { font-size: clamp(46px, 14vw, 58px); line-height: 0.87; }
  .page-subtitle, .thanks-page p { font-size: 17px; line-height: 1.65; }

  .blog-hero .blog-column { flex-direction: column; align-items: stretch; gap: 18px; padding-top: 36px; padding-bottom: 40px; }
  .blog-hero .page-subtitle { flex: none; padding-bottom: 0; }
  .blog-list { padding-bottom: 72px; }
  .post-link { display: flex; flex-direction: column; gap: 12px; padding: 28px 0; }
  .post-image { order: -1; align-self: stretch; }
  .post-image img { border-radius: 12px; }
  .post-title { font-size: 32px; line-height: 1.1; }
  .post-kicker { align-self: auto; font-size: 14px; }

  .page-hero .article { gap: 16px; padding-top: 36px; padding-bottom: 28px; }
  .article-hero-image { padding-bottom: 36px; }
  .article-hero-image img { border-radius: 12px; }
  .section > .article { padding-bottom: 64px; }
  .section > .article > * + *, .terms-page > * + *, .markdown-content > * + * { margin-top: 16px; }
  .section h2, .markdown-content h2, .terms-page h2 { margin-top: 34px; font-size: 36px; }
  .section h3, .markdown-content h3 { margin-top: 28px; font-size: 28px; }
  .next-post { padding-bottom: 64px; }
  .next-post .article { display: flex; flex-direction: column; align-items: stretch; gap: 12px; }
  .next-post__link img { display: none; }
  .next-post__title { font-size: 28px; }

  .docs-container { flex-direction: column; gap: 32px; padding: 28px var(--edge) 72px; }
  .docs-sidebar { flex: none; padding-top: 0; }
  .docs-menu {
    border: 1px solid var(--rule-strong);
    border-radius: 12px;
    background: #161a18;
  }
  .docs-menu > summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    font-size: 16px;
    color: var(--ink);
    cursor: pointer;
    list-style: none;
  }
  .docs-menu > summary::-webkit-details-marker { display: none; }
  .docs-menu > summary::after { content: ''; width: 8px; height: 8px; border-right: 1.6px solid var(--ink); border-bottom: 1.6px solid var(--ink); transform: rotate(45deg) translateY(-3px); }
  .docs-menu[open] > summary::after { transform: rotate(225deg) translateY(-3px); }
  .docs-nav { padding: 6px 16px 18px; gap: 18px; }
  .markdown-content h1 { font-size: 48px; }

  .submit { flex-direction: column; gap: 36px; padding: 36px var(--edge) 72px; }
  .submit-about { gap: 18px; }
  .submit-workspace { flex: none; padding-top: 28px; border-top: 1px solid var(--rule-strong); }
  .inline-form { flex-direction: column; }
  .field-row { flex-direction: column; gap: 20px; }
  .submit-workspace .btn[type='submit'] { align-self: stretch; }

  .thanks-page, .terms-page { padding: 56px var(--edge) 72px; }
}
