:root {
	color-scheme: light dark;
	--fg: #1a1a1a;
	--bg: #faf8f4;
	--muted: #6b6b6b;
	--accent: #8a3b2e;
}

@media (prefers-color-scheme: dark) {
	:root {
		--fg: #ece7e0;
		--bg: #15130f;
		--muted: #a3a09a;
		--accent: #d9a066;
	}
}

* {
	box-sizing: border-box;
}

html, body {
	margin: 0;
	height: 100%;
}

/* Carousel: a fixed-size viewport clipping a horizontal track of three
   full-screen slides. `data-active` (set server-side, so this works
   with no JS at all) picks the resting position; JS only overrides
   the transform live while dragging and after a completed swipe. */
.viewport {
	position: fixed;
	inset: 0;
	overflow: hidden;
}

.track {
	display: flex;
	height: 100%;
	width: 300%;
	touch-action: pan-y;
	transition: transform 0.3s ease;
}

.track.dragging {
	transition: none;
}

.track[data-active="0"] { transform: translateX(0); }
.track[data-active="1"] { transform: translateX(-33.3333%); }
.track[data-active="2"] { transform: translateX(-66.6667%); }

.slide {
	width: 33.3333%;
	height: 100%;
	flex-shrink: 0;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	align-items: center;
	/* `safe center`: center short content as before, but fall back to
	   start-alignment once content overflows, so the top of a long
	   concept/quote stays reachable by scrolling instead of being
	   centered into negative (unscrollable) space. */
	justify-content: safe center;
	gap: 1.5rem;
	padding: 2rem 1rem 5rem;
	background: var(--bg);
	color: var(--fg);
	font-family: "Iowan Old Style", Georgia, "Times New Roman", serif;
	text-align: center;
}

header h1 {
	font-size: 1.1rem;
	font-weight: 500;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--muted);
	margin: 0;
}

figure {
	margin: 0;
	max-width: min(90vw, 900px);
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

figure img {
	max-width: 100%;
	max-height: 72vh;
	width: auto;
	height: auto;
	align-self: center;
	box-shadow: 0 1.5rem 3rem -1.5rem rgba(0, 0, 0, 0.5);
	border-radius: 2px;
}

figcaption .title {
	font-size: 1.3rem;
	font-style: italic;
}

figcaption .artist {
	color: var(--accent);
	font-size: 1.05rem;
	margin-top: 0.25rem;
}

figcaption .meta {
	color: var(--muted);
	font-size: 0.85rem;
	margin-top: 0.5rem;
}

figcaption .meta a {
	color: inherit;
}

.empty {
	color: var(--muted);
	font-size: 1rem;
}

.commentary {
	max-width: min(90vw, 700px);
	width: 100%;
	text-align: left;
}

.commentary button {
	font-family: inherit;
	font-size: 0.9rem;
	cursor: pointer;
	border-radius: 999px;
	border: 1px solid var(--muted);
	background: transparent;
	color: var(--fg);
	padding: 0.5rem 1rem;
	transition: border-color 0.15s, color 0.15s;
}

.commentary button:hover {
	border-color: var(--accent);
	color: var(--accent);
}

/* :not([hidden]) rather than a bare ID selector: an ID selector would
   outrank the browser's default `[hidden] { display: none }` rule and
   force the element visible even while the `hidden` attribute is set. */
#commentary-prompt:not([hidden]) {
	display: block;
	margin: 0 auto;
}

#commentary-display {
	text-align: left;
}

#commentary-text {
	white-space: pre-wrap;
	line-height: 1.6;
	margin: 0 0 0.75rem;
}

#commentary-form:not([hidden]) {
	display: flex;
	flex-direction: column;
	gap: 0.6rem;
	margin-top: 1rem;
}

#commentary-textarea {
	font-family: inherit;
	font-size: 0.95rem;
	line-height: 1.5;
	color: var(--fg);
	background: transparent;
	border: 1px solid var(--muted);
	border-radius: 6px;
	padding: 0.6rem;
	resize: vertical;
}

#commentary-submit {
	align-self: flex-start;
}

/* Daily insight slide: always dark, regardless of system theme. */
.slide.insight {
	--bg: #121212;
	--fg: #cfcfcf;
	--muted: #8a8a8a;
	background: var(--bg);
	color: var(--fg);
}

.quote {
	margin: 0;
	max-width: min(90vw, 700px);
	border: none;
	text-align: left;
}

.quote .content {
	font-size: 1.4rem;
	line-height: 1.6;
	font-style: italic;
}

.quote .content > *:first-child {
	margin-top: 0;
}

.quote .content > *:last-child {
	margin-bottom: 0;
}

.quote .content p,
.quote .content ul,
.quote .content ol,
.quote .content blockquote {
	margin: 0 0 1rem;
}

.quote .content ul,
.quote .content ol {
	padding-left: 1.5rem;
}

.quote .content blockquote {
	border-left: 2px solid var(--muted);
	padding-left: 1rem;
	font-style: normal;
}

.quote .content code {
	font-family: ui-monospace, "SF Mono", Consolas, monospace;
	font-size: 0.9em;
}

.quote .content a {
	color: inherit;
}

.quote .quote-title {
	margin-top: 1.25rem;
	color: var(--muted);
	font-size: 0.9rem;
	font-style: normal;
}

/* Future hook: style [data-type="short"] differently (e.g. larger
   font) from [data-type="post"] once that distinction is wanted. */

.concept-body {
	margin: 0;
	max-width: min(90vw, 700px);
	text-align: left;
}

.concept-name {
	font-size: 1.7rem;
	font-weight: 600;
	margin: 0 0 1rem;
}

.concept-body .content p {
	font-size: 1.3rem;
	line-height: 1.7;
	margin: 0 0 1rem;
}

.concept-body .content p:last-child {
	margin-bottom: 0;
}

.concept-body .content strong {
	color: var(--accent);
	font-weight: 700;
}

.comments {
	max-width: min(90vw, 700px);
	width: 100%;
	text-align: left;
	margin-top: 1.5rem;
}

.comments button {
	font-family: inherit;
	font-size: 0.9rem;
	cursor: pointer;
	border-radius: 999px;
	border: 1px solid var(--muted);
	background: transparent;
	color: var(--fg);
	padding: 0.5rem 1rem;
	transition: border-color 0.15s, color 0.15s;
}

.comments button:hover {
	border-color: var(--accent);
	color: var(--accent);
}

.comments button:disabled {
	opacity: 0.6;
	cursor: default;
}

.comments-list {
	display: flex;
	flex-direction: column;
	gap: 1rem;
	margin-bottom: 1rem;
	border-top: 1px solid var(--muted);
	padding-top: 1rem;
}

.comment-date {
	font-size: 0.8rem;
	color: var(--muted);
	margin-bottom: 0.25rem;
}

.comment-content p {
	margin: 0 0 0.5rem;
	line-height: 1.5;
}

.comment-content p:last-child {
	margin-bottom: 0;
}

/* :not([hidden]) rather than a bare ID selector: an ID selector would
   outrank the browser's default `[hidden] { display: none }` rule and
   force the element visible even while the `hidden` attribute is set. */
#comment-form:not([hidden]) {
	display: flex;
	flex-direction: column;
	gap: 0.6rem;
	margin-top: 1rem;
}

#comment-textarea {
	font-family: inherit;
	font-size: 0.95rem;
	line-height: 1.5;
	color: var(--fg);
	background: transparent;
	border: 1px solid var(--muted);
	border-radius: 6px;
	padding: 0.6rem;
	resize: vertical;
}

#comment-submit {
	align-self: flex-start;
}

/* Page indicator: fixed in the same spot over every slide. */
.dots {
	position: fixed;
	bottom: 1.25rem;
	left: 50%;
	transform: translateX(-50%);
	z-index: 10;
	display: flex;
	align-items: center;
	gap: 0.6rem;
	padding: 0.55rem 0.75rem;
	border-radius: 999px;
	background: rgba(0, 0, 0, 0.35);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
}

.dot {
	width: 0.5rem;
	height: 0.5rem;
	padding: 0;
	border-radius: 50%;
	border: 1.5px solid rgba(255, 255, 255, 0.6);
	background: transparent;
	display: block;
	transition: background-color 0.15s, border-color 0.15s, transform 0.15s;
}

.dot.active {
	background: #fff;
	border-color: #fff;
	transform: scale(1.15);
}

/* Edge arrows: hidden on narrow/portrait screens where swipe is the
   natural gesture; shown on wider screens (laptops, desktops, tablets
   in landscape) as a tappable equivalent. Swipe stays enabled either
   way. */
.edge-nav {
	position: fixed;
	top: 50%;
	transform: translateY(-50%);
	z-index: 10;
	display: none;
	align-items: center;
	justify-content: center;
	width: 2.75rem;
	height: 2.75rem;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.35);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	color: #fff;
	font-size: 1.5rem;
	line-height: 1;
	text-decoration: none;
	transition: background-color 0.15s;
}

.edge-nav:hover {
	background: rgba(0, 0, 0, 0.5);
}

.edge-prev {
	left: 1rem;
}

.edge-next {
	right: 1rem;
}

@media (min-width: 768px) {
	.edge-nav {
		display: flex;
	}
}
