/* Knitbone Passages: one narrow reading column. Every item page is the item, what it connects to, then Discuss.
   Fonts and colors follow knitbone.com: Cormorant Garamond text in brown, italic EB Garamond headings in olive,
   italic links with a dotted orange underline. */

:root {
	--paper: #ffffff;
	--ink: #382519;        /* knitbone.com body text */
	--link: #404040;       /* knitbone.com link text */
	--green: #7c9100;      /* knitbone.com headings, large sizes only */
	--green-small: #6a7c00;/* the same olive, a shade darker so small labels stay readable */
	--muted: #7a6e64;
	--rule: #d9d1c8;
	--hair: #ece6df;
	--accent: #e38900;     /* knitbone.com underlines; decoration only, too light for text */
	--field: #fbf9f6;
	--warn: #a3361f;
	--serif: "Cormorant Garamond", Garamond, Georgia, serif;
	--display: "EB Garamond", Garamond, Georgia, serif;
	--logo-w: 4rem;
	--indent: calc(var(--logo-w) + .8rem); /* every line of text starts right of the logo */
	color-scheme: light; /* always white, like knitbone.com, even when the device is in dark mode */
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
	margin: 0;
	background: var(--paper);
	color: var(--ink);
	font: 400 1.25rem/1.5 var(--serif);
	padding-left: max(16px, env(safe-area-inset-left, 0px));
	padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.wrap { max-width: calc(36rem + var(--indent)); margin: 0 auto; padding: 2.5rem 0 4rem var(--indent); }
a, .add, .act, .reply {
	color: var(--link); font-style: italic;
	text-decoration: underline dotted var(--accent); text-decoration-thickness: 1.5px; text-underline-offset: .18em;
}
a:hover, .add:hover, .act:hover, .reply:hover { text-decoration-style: solid; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Header */
.site { display: grid; gap: .35rem; margin-bottom: 3rem; }
.brand { display: flex; align-items: center; gap: calc(var(--indent) - var(--logo-w)); margin-left: calc(-1 * var(--indent)); text-decoration: none; padding-bottom: .4rem; position: relative; }
.brand::after { content: ""; position: absolute; left: var(--indent); right: 0; bottom: 0; border-bottom: 1px solid var(--hair); } /* the rule starts with the text, not under the logo */
.brand svg, .brand img { width: var(--logo-w); height: calc(var(--logo-w) * 1.2); flex: none; object-fit: contain; }
.brand span { font: italic 400 2rem/1 var(--display); color: var(--green); }
.site nav { display: flex; flex-wrap: wrap; gap: .5rem; }
.site nav .sep { color: var(--muted); }
.site nav { font-size: 1.05rem; }
.site nav a[aria-current] { font-weight: 600; color: var(--ink); }

/* Type */
h1 { font: italic 400 1.75rem/1.25 var(--display); color: var(--green); margin: 0 0 1rem; text-wrap: balance; }
.big { font-size: 1.8rem; line-height: 1.35; margin: 0 0 1.2rem; text-wrap: pretty; }
.by { margin: 0; }
hr { border: 0; border-top: 1px solid var(--rule); margin: 2rem 0; }
.label { font: italic 400 1.3rem/1.3 var(--display); color: var(--green-small); margin: 0 0 .6rem; }
.empty { color: var(--muted); font-style: italic; margin: 0; }

/* Lists */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 1rem 0; border-bottom: 1px solid var(--hair); }
.list > li:first-child { padding-top: 0; }
.list .q { color: var(--ink); font-style: normal; text-decoration: none; }
.list .q:hover { text-decoration: underline dotted var(--accent); }
.tags { font-size: .9rem; color: var(--muted); margin-top: .3rem; }
.tags a { color: var(--muted); }
.passage-page .by a, .list a:not(.q) { color: var(--link); }
.count { color: var(--muted); font-size: .9rem; }
.names > li { padding: .45rem 0; }
.bullets { list-style: none; margin: 0; padding-left: 1em; font-size: 1.1rem; }
.bullets li { position: relative; }
.bullets li::before { content: "-"; position: absolute; left: -1em; color: var(--muted); }
.pager { display: flex; justify-content: space-between; gap: 1rem; margin-top: 1.5rem; font-size: .95rem; }
.pager .next { margin-left: auto; }

/* Discuss */
.comments { list-style: none; padding: 0; margin: 1rem 0 0; font-size: 1.05rem; }
.comments .comments { margin: .6rem 0 0 1.5rem; }
.comments li { margin-bottom: .8rem; }
.comments p { margin: 0; }
.comments .text p + p { margin-top: .5rem; }
.meta { font-size: .88rem; color: var(--muted); margin-top: .15rem; display: flex; flex-wrap: wrap; gap: .8rem; align-items: center; }
.deleted { color: var(--muted); font-style: italic; }
.comment-form { display: grid; gap: .5rem; }
.comment-form textarea, .panel textarea { font: inherit; font-size: 1rem; color: var(--ink); background: var(--paper); border: 1px solid var(--rule); padding: .45rem .6rem; width: 100%; min-height: 4rem; resize: vertical; }
.comment-form p { margin: 0; }
.reply { display: inline-flex; gap: .25rem; align-items: center; background: none; border: 0; padding: 0; font-family: inherit; font-size: .88rem; cursor: pointer; }
.reply svg { width: 1rem; height: .8rem; }
.comments .panel { margin: .5rem 0 .8rem; }

/* Footer */
.foot { margin-top: 4rem; padding-top: 1rem; border-top: 1px solid var(--hair); font-size: .95rem; color: var(--muted); }
.foot a { color: var(--muted); }

/* Editor controls (Administrator only) */
[hidden] { display: none !important; }
.add { display: inline-flex; align-items: center; gap: .35rem; margin-top: 1rem; background: none; border: 0; padding: 0; font-family: inherit; font-size: 1.05rem; cursor: pointer; }
.add::before { content: "+"; color: var(--accent); font-size: 1.5rem; line-height: 1; font-weight: 500; font-style: normal; display: inline-block; }
.tools { display: flex; gap: .9rem; margin: -.5rem 0 1.2rem; }
.passage-page .tools { margin: .6rem 0 0; }
.act { background: none; border: 0; padding: 0; font-family: inherit; font-size: .88rem; color: var(--muted); cursor: pointer; }
.panel { margin-top: 1rem; display: grid; gap: .6rem; padding: 1rem; border: 1px dashed var(--rule); background: var(--field); }
.panel label { font-size: .95rem; color: var(--muted); }
.panel p { margin: 0; }
.panel input, .panel textarea { font: inherit; font-size: 1rem; color: var(--ink); background: var(--paper); border: 1px solid var(--rule); padding: .45rem .6rem; width: 100%; }
.panel textarea { min-height: 5rem; resize: vertical; }
.row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.btn { font: inherit; font-size: .95rem; padding: .35rem .9rem; border: 1px solid var(--ink); background: var(--ink); color: var(--paper); cursor: pointer; }
.btn.plain { background: none; color: var(--ink); border-color: var(--rule); }
.btn:disabled { opacity: .5; cursor: default; }
.hint { font-size: .95rem; color: var(--muted); margin: 0; }
.error { font-size: .9rem; color: var(--warn); }
.error ul { margin: .4rem 0; padding-left: 1.2rem; color: var(--ink); }
.matches { list-style: none; margin: 0; padding: 0; max-height: 16rem; overflow: auto; border-top: 1px solid var(--hair); }
.matches:empty { display: none; }
.matches li { border-bottom: 1px solid var(--hair); }
.matches .hint { padding: .5rem .2rem; }
.matches button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: .5rem .2rem; font: inherit; font-size: .95rem; color: var(--ink); cursor: pointer; }
.matches button:hover, .matches button:focus-visible { background: var(--paper); text-decoration: underline dotted var(--accent); }
.matches small { color: var(--muted); }

@media (max-width: 480px) {
	.big { font-size: 1.5rem; }
	.brand span { font-size: 1.7rem; }
	:root { --logo-w: 2.8rem; }
}
