/*
 * Legal Architect — Obsidian Publish theme for eirajarvi.com
 * Starting point: the look of mister-chad.com (Chad Bennett, Al Dente theme, CC0).
 * Written fresh for this site; revise freely.
 */

@import url("https://fonts.googleapis.com/css2?family=Bellefair&display=swap");

/* ---------- 1. Design tokens ---------- */
/* Bellefair everywhere; the dark palette comes from gioventubrucata.nekoweb.org (minus the starfield);
   the light palette is the same blues, inverted onto pale paper. */

:root {
	--la-font-body: "Bellefair", Georgia, serif;
	--la-font-title: "Bellefair", Georgia, serif;
	--la-font-mono: ui-monospace, Menlo, Monaco, "Cascadia Mono", monospace;
	--font-default: var(--la-font-body);
	--font-interface: var(--la-font-body);
	--font-text: var(--la-font-body);

	--la-radius: 0.6rem;
}

.theme-light {
	--la-ink: #14243f;
	--la-ink-muted: #4e6a8f;
	--la-surface: #e8eef7;
	--la-surface-strong: #cfdcee;
	--la-border: #b7c9e2;
	--la-accent: #2a5a94;
	--la-accent-hover: #163a66;
	--la-accent-soft: #dbe8f7;
	--la-highlight: #cfe3f8;
	--la-tag: #dde4f4;
	--la-page: #f4f7fc;
	--la-page-flat: #f4f7fc;
	--la-shadow: 0 1px 4px rgba(42, 90, 148, 0.18);
	--la-inset-shadow: inset 1px 1px 3px rgba(42, 90, 148, 0.18);
	--la-glow: none;
}

.theme-dark {
	--la-ink: #ccddf0;
	--la-ink-muted: #7a9bc4;
	--la-surface: #050d24;
	--la-surface-strong: #1a2e50;
	--la-border: #2a4d78;
	--la-accent: #89b8f0;
	--la-accent-hover: #d0e8ff;
	--la-accent-soft: rgba(91, 155, 213, 0.18);
	--la-highlight: rgba(91, 155, 213, 0.3);
	--la-tag: #1a2e50;
	--la-page: #000510;
	--la-page-flat: #000510;
	--la-shadow: 0 0 22px rgba(91, 155, 213, 0.09);
	--la-inset-shadow: 0 0 22px rgba(91, 155, 213, 0.09);
	--la-glow: 0 0 8px rgba(142, 200, 255, 0.45);
}

/* Map tokens onto Obsidian's own variables so built-in UI follows along */
.theme-light,
.theme-dark {
	--font-text-theme: var(--la-font-body);
	--font-interface-theme: var(--la-font-body);
	--font-monospace-theme: var(--la-font-mono);

	--text-normal: var(--la-ink);
	--text-muted: var(--la-ink-muted);
	--link-color: var(--la-accent);
	--link-external-color: var(--la-accent);
	--background-primary: var(--la-page-flat);
	--background-secondary: var(--la-page-flat);

	--h1-weight: 400;
	--h2-weight: 400;
	--h3-weight: 400;
}

/* ---------- 2. Page ---------- */

body {
	background: var(--la-page);
	background-attachment: fixed;
	color: var(--la-ink);
	font-size: 18px;
	text-rendering: optimizeLegibility;
	font-kerning: normal;
}

.published-container,
.site-body,
.site-body-center-column,
.markdown-preview-view {
	background: transparent;
}

.publish-renderer {
	margin-top: 2rem;
}

/* Hide the right column (outline/graph) for a clean single column */
.published-container .site-body .site-body-right-column {
	display: none;
}

/* ---------- 3. Body text and headings ---------- */

.published-container .markdown-rendered {
	font-size: 1.2rem;
	line-height: 1.7;
	color: var(--la-ink);
}

.published-container .markdown-rendered p,
.published-container .markdown-rendered ul,
.published-container .markdown-rendered ol {
	margin-bottom: 1.8rem;
}

.published-container .markdown-rendered h1,
.published-container .markdown-rendered h2,
.published-container .markdown-rendered h3,
.published-container .markdown-rendered h4,
.published-container .markdown-rendered h5,
.published-container .markdown-rendered h6,
.published-container .page-header,
.published-section-header,
.site-body-left-column-site-name {
	font-family: var(--la-font-title);
	color: var(--la-ink);
	border: none;
	margin-top: 1rem;
	margin-bottom: 1rem;
}

.published-container .markdown-rendered h1,
.published-container .page-header {
	font-size: 2.8rem;
	line-height: 1.15;
	font-weight: 400;
}

.published-container .markdown-rendered h2 {
	font-size: 1.9rem;
	line-height: 1.2;
	font-weight: 400;
	letter-spacing: 0.04em;
	text-transform: lowercase;
}

.published-container .markdown-rendered h3 {
	font-size: 1.5rem;
	line-height: 1.2;
	font-weight: 400;
	letter-spacing: 0.04em;
	text-transform: lowercase;
}

/* ---------- 4. Links ---------- */

.internal-link::before,
.internal-link::after {
	display: none;
}

.published-container .markdown-rendered a,
.published-container .markdown-rendered .internal-link {
	color: var(--la-accent);
	text-decoration: none;
	padding: 0.15rem 0.25rem;
	border-radius: var(--la-radius);
	transition: background 0.3s, color 0.3s;
}

.published-container .markdown-rendered a:hover {
	color: var(--la-accent-hover);
	background: var(--la-accent-soft);
	text-shadow: var(--la-glow);
}

/* ---------- 5. Left sidebar: faded until hovered ---------- */

.site-body-left-column {
	background: none;
	border-right: none;
	padding: 1rem 0 0 2rem;
	opacity: 0.25;
	transition: opacity 0.6s;
}

.site-body-left-column:hover,
.site-body-left-column:focus-within {
	opacity: 1;
}

.site-body-left-column-site-name {
	text-align: center;
	font-size: 1.6rem;
	font-weight: 400;
}

.site-body-left-column .search-bar {
	background-color: var(--la-surface);
	box-shadow: var(--la-inset-shadow);
	border: none;
	border-radius: var(--la-radius);
	padding: 0.6rem;
}

.nav-view-outer .tree-item-self,
.outline-view-outer .tree-item-self {
	border-radius: var(--la-radius);
	transition: background-color 0.4s;
}

.nav-view-outer .tree-item-self:hover:not(.mod-active) {
	background-color: var(--la-accent-soft);
}

.nav-view-outer .tree-item-self.mod-active {
	font-weight: 600;
	background-color: var(--la-surface-strong);
}

/* On small screens the sidebar is a slide-out menu: keep it solid and visible */
@media screen and (max-width: 1000px) {
	.site-body-left-column {
		opacity: 1;
		padding: 0;
		background: var(--la-page-flat);
	}

	.published-container .site-header,
	.published-container .nav-backdrop {
		background: var(--la-page-flat);
	}
}

/* ---------- 6. Boxes: blockquotes, callouts, backlinks ---------- */

.published-container .markdown-rendered blockquote,
.published-container .callout,
.published-container .backlink-items-container {
	background-color: var(--la-surface);
	box-shadow: var(--la-inset-shadow);
	border: 1px dashed var(--la-border);
	border-radius: var(--la-radius);
	color: var(--la-ink);
}

.published-container .markdown-rendered blockquote {
	padding: 0.8rem 1.4rem;
	line-height: 1.7;
}

.published-container .callout {
	padding: 0.6rem;
	margin-bottom: 2rem;
}

.published-container .callout-title {
	padding: 0.5rem 1rem;
	font-family: var(--la-font-title);
	font-size: 1.3rem;
	color: var(--la-ink);
}

.published-container .callout-icon {
	display: none;
}

.published-container .callout-content {
	padding: 0.4rem 1rem 0.8rem;
}

.published-container .backlink-items-container {
	padding: 1rem 2rem;
}

/* ---------- 7. Tables ---------- */

.published-container .markdown-rendered table {
	background-color: var(--la-surface);
	box-shadow: var(--la-shadow);
	border: none;
	border-radius: var(--la-radius);
	border-collapse: separate;
	border-spacing: 0;
	overflow: hidden;
}

.published-container .markdown-rendered th,
.published-container .markdown-rendered td {
	border: 1px solid var(--la-page-flat);
	padding: 0.5rem 0.9rem;
}

.published-container .markdown-rendered th {
	background-color: var(--la-surface-strong);
	font-weight: 600;
}

/* ---------- 8. Highlights, tags, images ---------- */

.published-container .markdown-rendered mark,
::selection {
	color: var(--la-ink);
	background: linear-gradient(to right, transparent, var(--la-highlight) 15%, var(--la-highlight) 85%, transparent);
	padding: 0.1em 0.35em;
	border-radius: 0.8em 0.3em;
	-webkit-box-decoration-break: clone;
	box-decoration-break: clone;
}

.published-container .markdown-rendered .tag,
.published-container a.tag {
	background: var(--la-tag);
	color: var(--la-ink);
	padding: 0.2rem 0.4rem;
	border-radius: var(--la-radius);
	border: none;
}

.published-container .image-embed {
	display: flex;
	justify-content: center;
}

.published-container .internal-embed img {
	border-radius: var(--la-radius);
}

/* ---------- 9. Layout helpers (use as callouts in notes) ----------
 *
 * > [!card-left]
 * > ![[photo.jpg]]
 * > Text that sits to the right of the image.
 *
 * card-left: image 1/3, text 2/3   card-right: text 2/3, image 1/3
 * card-double: two equal columns    right-card / left-card: small floated box
 */

.published-container .callout[data-callout^="card-left"],
.published-container .callout[data-callout^="card-right"],
.published-container .callout[data-callout^="card-double"],
.published-container .callout[data-callout="right-card"],
.published-container .callout[data-callout="left-card"] {
	background: transparent;
	box-shadow: none;
	border: none;
	padding: 0;
}

.published-container .callout[data-callout^="card-"] .callout-title,
.published-container .callout[data-callout$="-card"] .callout-title {
	display: none;
}

.published-container .callout[data-callout^="card-"] .callout-content {
	display: grid;
	gap: 1rem;
	align-items: center;
	padding: 0;
}

.published-container .callout[data-callout^="card-left"] .callout-content {
	grid-template-columns: 1fr 2fr;
}

.published-container .callout[data-callout^="card-right"] .callout-content {
	grid-template-columns: 2fr 1fr;
}

.published-container .callout[data-callout^="card-double"] .callout-content {
	grid-template-columns: 1fr 1fr;
	align-items: start;
}

.published-container .callout[data-callout="right-card"] {
	float: right;
	width: 35%;
	margin: 0 0 0.5rem 1rem;
}

.published-container .callout[data-callout="left-card"] {
	float: left;
	width: 35%;
	margin: 0 1rem 0.5rem 0;
}

@media screen and (max-width: 800px) {
	.published-container .callout[data-callout^="card-"] .callout-content {
		display: block;
	}

	.published-container .callout[data-callout="right-card"],
	.published-container .callout[data-callout="left-card"] {
		float: none;
		width: 80%;
		margin: 0 auto 1rem;
	}
}

/* Every piece of UI text (search, nav, footer, buttons) in Bellefair too */
body,
.published-container,
.published-container input,
.published-container button {
	font-family: var(--la-font-body);
}

/* ---------- 10. Section cards (home page) ----------
 *
 * > [!cards]
 * > - [[Articles]]
 * >   Considered pieces on law and product
 * > - [[Projects]]
 * >   The demo and the decisions behind it
 *
 * Each item: a link (the card title) and a line of description.
 * The icon is picked from the link target; unknown targets get a compass.
 */

.published-container .callout[data-callout="cards"] {
	background: transparent;
	box-shadow: none;
	border: none;
	border-top: 1px solid var(--la-border);
	border-bottom: 1px solid var(--la-border);
	border-radius: 0;
	padding: 1.6rem 0;
	margin: 2rem 0;
}

.published-container .callout[data-callout="cards"] .callout-title {
	display: none;
}

.published-container .callout[data-callout="cards"] .callout-content {
	padding: 0;
}

.published-container .callout[data-callout="cards"] ul {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
	gap: 1.2rem;
}

/* Four cards: a tidy 2 × 2 grid instead of 3 + 1 */
.published-container .callout[data-callout="cards"] ul:has(> li:nth-child(4):last-child) {
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media screen and (max-width: 600px) {
	.published-container .callout[data-callout="cards"] ul,
	.published-container .callout[data-callout="cards"] ul:has(> li:nth-child(4):last-child) {
		grid-template-columns: 1fr;
	}
}

.published-container .callout[data-callout="cards"] li {
	position: relative;
	margin: 0;
	padding: 1rem 1.1rem 1.1rem 3rem;
	border: 1px solid var(--la-border);
	border-radius: var(--la-radius);
	background: var(--la-surface);
	color: var(--la-ink-muted);
	line-height: 1.4;
}

.published-container .callout[data-callout="cards"] li::marker,
.published-container .callout[data-callout="cards"] .list-bullet,
.published-container .callout[data-callout="cards"] .list-collapse-indicator,
.published-container .callout[data-callout="cards"] li br {
	display: none;
	content: none;
}

.published-container .callout[data-callout="cards"] li p {
	margin: 0;
}

.published-container .callout[data-callout="cards"] li a {
	display: block;
	position: static;
	padding: 0;
	margin-bottom: 0.3rem;
	color: var(--la-ink);
	font-size: 1.35rem;
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.2em;
	background: none;
}

.published-container .callout[data-callout="cards"] li a:hover {
	color: var(--la-accent-hover);
	background: none;
}

.published-container .callout[data-callout="cards"] li a::before {
	display: block;
	content: "";
	position: absolute;
	left: 1rem;
	top: 1.15rem;
	width: 1.3rem;
	height: 1.3rem;
	background-color: var(--la-accent);
	-webkit-mask: var(--la-card-icon) center / contain no-repeat;
	mask: var(--la-card-icon) center / contain no-repeat;
	--la-card-icon: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='10'/><polygon points='16.24 7.76 14.12 14.12 7.76 16.24 9.88 9.88 16.24 7.76'/></svg>");
}

/* Icons by link target (Lucide icons, ISC licence) */
.published-container .callout[data-callout="cards"] li a[data-href*="article" i]::before {
	--la-card-icon: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'><path d='M12 20h9'/><path d='M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z'/></svg>");
}

.published-container .callout[data-callout="cards"] li a[data-href*="project" i]::before {
	--la-card-icon: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'><path d='M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z'/></svg>");
}

.published-container .callout[data-callout="cards"] li a[data-href*="note" i]::before {
	--la-card-icon: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'><path d='M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z'/><path d='M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z'/></svg>");
}

.published-container .callout[data-callout="cards"] li a[data-href*="cv" i]::before {
	--la-card-icon: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'><path d='M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16'/><rect width='20' height='14' x='2' y='6' rx='2'/></svg>");
}

/* ---------- 11. Pages without the file-name title ----------
 * Add to a note's frontmatter:   cssclasses: [no-title]
 * (used on Home, which has its own # heading)
 */

.markdown-preview-view.no-title .page-header,
.markdown-preview-view.no-title .mod-header .page-header {
	display: none;
}
