/*
 Theme Name:   Eksell Child
 Description:  Child theme for Eksell — Art Archive
 Author:       Nico Wlock
 Template:     eksell
 Version:      1.8.0
 Text Domain:  eksell-child
*/

/* =====================================================================
   CONTENTS
   1. Palette tokens (Dawn active, Dusk available)
   2. Feed the palette into Eksell's own variables
   3. Remove the aside bar
   4. Typography
   5. Are.na-style header
   6. Grid
   7. Filter bar
   8. Single artwork
   9. Load more
   10. Details (selection, scrollbar)

   NOTE: Eksell sets the root font size to 10px, so 1rem = 10px here.
   Sizes below are in px to avoid that trap.
   ===================================================================== */


/* =====================================================================
   1. PALETTE TOKENS
   Every rule below uses the semantic tokens (--background, --text-primary…).
   To switch to Dusk, change the nine var(--dawn-…) references in the
   "Active palette" block to var(--dusk-…). Nothing else needs to change.
   ===================================================================== */

:root {
	/* Dawn */
	--dawn-bg:             #F2EEE9;
	--dawn-surface:        #FFFFFF;
	--dawn-surface-hover:  #EDE6DF;
	--dawn-border:         #D9D0C8;
	--dawn-text-primary:   #1E1A18;
	--dawn-text-secondary: #897E76;
	--dawn-text-tertiary:  #C2B8B0;
	--dawn-accent:         #A0522D;
	--dawn-accent-soft:    #C08080;

	/* Dusk */
	--dusk-bg:             #1C1A2E;
	--dusk-surface:        #252338;
	--dusk-surface-hover:  #2E2B45;
	--dusk-border:         #3A3755;
	--dusk-text-primary:   #EDE9E0;
	--dusk-text-secondary: #8B87A8;
	--dusk-text-tertiary:  #524F6B;
	--dusk-accent:         #C9A97A;
	--dusk-accent-soft:    #A07898;

	/* Active palette */
	--background:     var(--dawn-bg);
	--surface:        var(--dawn-surface);
	--surface-hover:  var(--dawn-surface-hover);
	--border:         var(--dawn-border);
	--text-primary:   var(--dawn-text-primary);
	--text-secondary: var(--dawn-text-secondary);
	--text-tertiary:  var(--dawn-text-tertiary);
	--accent:         var(--dawn-accent);
	--accent-soft:    var(--dawn-accent-soft);

	/* Kill the aside at every breakpoint */
	--eksell-aside-width: 0rem !important;
}


/* =====================================================================
   2. FEED THE PALETTE INTO EKSELL
   Eksell paints the body with `background-color: var(--eksell-background-color)
   !important`, and the Customizer prints its own colour variables inline.
   `html:root` outranks both, so the whole theme inherits our palette
   instead of fighting it rule by rule.
   ===================================================================== */

html:root {
	--eksell-background-color:       var(--background);
	--eksell-light-background-color: var(--surface-hover);
	--eksell-primary-color:          var(--text-primary);
	--eksell-secondary-color:        var(--text-secondary);
	--eksell-border-color:           var(--border);
	--eksell-accent-color:           var(--accent);
}


/* =====================================================================
   3. REMOVE THE ASIDE BAR
   ===================================================================== */

html,
html.has-aside {
	background-image: none !important;
}

body {
	border-left: none !important;
}


/* =====================================================================
   4. TYPOGRAPHY
   ===================================================================== */

body,
h1, h2, h3, h4, h5, h6,
button,
input,
textarea,
select {
	font-family: Inter, ui-sans-serif, system-ui, -apple-system,
	             BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
	letter-spacing: -0.01em;
	-webkit-font-smoothing: antialiased;
}

body {
	background-color: var(--background);
	color: var(--text-primary);
}

h1, h2, h3, .entry-title {
	font-size: 15px;
	font-weight: 400;
	letter-spacing: -0.01em;
	text-transform: none;
}

a {
	color: var(--text-primary);
	text-decoration: none;
}

a:hover {
	color: var(--accent);
}


/* =====================================================================
   5. ARE.NA-STYLE HEADER
   ===================================================================== */

:root {
	--hdr-height: 44px;
	--hdr-pad-x:  16px;
}

.arena-header {
	position: sticky;
	top: 0;
	z-index: 100;
	background: var(--background);
	border-bottom: 1px solid var(--border);
	color: var(--text-primary);
	font-size: 15px;
	font-weight: 400;
	line-height: 1;
}

/* Sit below the WP admin bar when logged in. */
.admin-bar .arena-header { top: 32px; }
@media (max-width: 782px) { .admin-bar .arena-header { top: 46px; } }
@media (max-width: 600px) { .admin-bar .arena-header { top: 0; } }

.arena-header__inner {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr) auto;
	align-items: center;
	column-gap: 24px;
	height: var(--hdr-height);
	padding: 0 var(--hdr-pad-x);
}

.arena-header a:hover {
	text-decoration: none;
}

/* Title */
.arena-header__title {
	color: var(--text-primary);
	font-weight: 500;
	white-space: nowrap;
}
.arena-header__title:hover { color: var(--text-secondary); }

/* Search */
.arena-search {
	position: relative;
	width: 100%;
	max-width: 560px;
	margin: 0;
}

.arena-header .arena-search__input {
	width: 100%;
	height: 30px;
	margin: 0;
	padding: 0 30px 0 10px;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 0;
	box-shadow: none;
	color: var(--text-primary);
	font-family: inherit;
	font-size: 14px;
	line-height: normal;
	letter-spacing: inherit;
	-webkit-appearance: none;
	appearance: none;
}
.arena-search__input::placeholder { color: var(--text-secondary); opacity: 1; }
.arena-header .arena-search__input:focus {
	outline: none;
	border-color: var(--accent);
	box-shadow: none;
}
.arena-search__input::-webkit-search-cancel-button { -webkit-appearance: none; }

.arena-search__hint {
	position: absolute;
	top: 50%;
	right: 6px;
	transform: translateY(-50%);
	min-width: 18px;
	padding: 2px 4px;
	border: 1px solid var(--border);
	background: transparent;
	color: var(--text-secondary);
	font-family: inherit;
	font-size: 11px;
	line-height: 1.2;
	text-align: center;
	pointer-events: none;
}
.arena-search:focus-within .arena-search__hint,
.arena-search__input:not(:placeholder-shown) ~ .arena-search__hint {
	display: none;
}

/* Nav */
.arena-nav { min-width: 0; }

.arena-nav__list {
	display: flex;
	gap: 20px;
	margin: 0;
	padding: 0;
	list-style: none;
}
.arena-nav__list li { margin: 0; }
.arena-nav__list .sub-menu { display: none; }

.arena-nav__list a {
	display: flex;
	align-items: center;
	height: var(--hdr-height);
	margin-bottom: -1px;          /* active underline sits on the header rule */
	border-bottom: 1px solid transparent;
	color: var(--text-secondary);
	white-space: nowrap;
}
.arena-nav__list a:hover { color: var(--text-primary); }

.arena-nav__list .current-menu-item > a,
.arena-nav__list .current-menu-ancestor > a,
.arena-nav__list .current_page_item > a,
.arena-nav__list .current_page_parent > a {
	color: var(--text-primary);
	border-bottom-color: var(--accent);
}

.arena-header a:focus-visible {
	outline: 1px solid var(--accent);
	outline-offset: 2px;
}

/* Mobile: two rows, never a hamburger */
@media (max-width: 700px) {
	.arena-header__inner {
		grid-template-columns: auto minmax(0, 1fr);
		grid-template-areas:
			"title  nav"
			"search search";
		height: auto;
		column-gap: 16px;
	}
	.arena-header__title { grid-area: title; }
	.arena-nav {
		grid-area: nav;
		justify-self: end;
		overflow-x: auto;
		scrollbar-width: none;
	}
	.arena-nav::-webkit-scrollbar { display: none; }
	.arena-nav__list { gap: 16px; }

	.arena-search {
		grid-area: search;
		max-width: none;
		padding-bottom: 8px;
	}
	.arena-header .arena-search__input { font-size: 16px; } /* stops iOS zoom */
	.arena-search__hint { display: none; }
}


/* =====================================================================
   6. GRID
   ===================================================================== */

.post-grid,
.posts-container {
	gap: 6px;
}

.post-grid article,
.post-thumbnail,
.entry-thumbnail {
	background-color: var(--surface);
	border: 1px solid var(--border);
	border-radius: 0;
	box-shadow: none;
}

.post-grid article:hover,
.entry-thumbnail:hover {
	background-color: var(--surface-hover);
	border-color: var(--accent);
}

.post-grid article img,
.entry-thumbnail img {
	display: block;
	width: 100%;
	height: auto;
	object-fit: cover;
}


/* =====================================================================
   7. FILTER BAR
   ===================================================================== */

.filter-links,
.cat-filter,
#filter-links {
	display: flex;
	flex-wrap: wrap;
	gap: 0;
	margin-bottom: 24px;
	padding-bottom: 0;
	border-bottom: 1px solid var(--border);
	list-style: none;
}

.filter-links li a,
.cat-filter li a,
#filter-links a {
	display: inline-block;
	margin-bottom: -1px;
	padding: 8px 14px;
	border-bottom: 1px solid transparent;
	color: var(--text-secondary);
	font-size: 14px;
	font-weight: 400;
	text-decoration: none;
}

.filter-links li.current a,
.filter-links li a:hover,
.cat-filter li.active a,
#filter-links a.current,
#filter-links a:hover {
	color: var(--text-primary);
	border-bottom-color: var(--accent);
}


/* =====================================================================
   8. SINGLE ARTWORK
   ===================================================================== */

.single .entry-header {
	margin-bottom: 24px;
	padding-bottom: 16px;
	border-bottom: 1px solid var(--border);
}

.single .entry-title {
	margin-bottom: 8px;
	font-size: 18px;
	font-weight: 500;
}

.entry-meta,
.post-meta,
.entry-footer {
	color: var(--text-secondary);
	font-size: 13px;
	line-height: 1.8;
}

.post-categories,
.post-tags {
	display: inline;
	padding: 0;
	list-style: none;
}

.post-categories li,
.post-tags li {
	display: inline;
	margin-right: 6px;
}

.post-categories li a,
.post-tags li a {
	color: var(--text-secondary);
	font-size: 13px;
}

.post-categories li a:hover,
.post-tags li a:hover {
	color: var(--accent-soft);
}

.site-description {
	display: none;
}


/* =====================================================================
   9. LOAD MORE
   ===================================================================== */

.load-more-button,
#load-more-posts,
.infinite-scroll-button {
	display: block;
	width: 100%;
	margin-top: 24px;
	padding: 20px 0;
	background: none;
	border: none;
	border-top: 1px solid var(--border);
	color: var(--text-secondary);
	font-size: 14px;
	font-weight: 400;
	text-align: center;
	cursor: pointer;
}

.load-more-button:hover,
#load-more-posts:hover,
.infinite-scroll-button:hover {
	color: var(--accent);
}


/* =====================================================================
   10. DETAILS
   ===================================================================== */

input::placeholder,
textarea::placeholder {
	color: var(--text-tertiary);
}

::selection {
	background-color: var(--accent);
	color: var(--background);
}

#site-footer {
	border-top: 1px solid var(--border);
	color: var(--text-secondary);
}



/* =====================================================================
   11. EXPLORE HOMEPAGE
   ===================================================================== */

:root {
	--page-pad: clamp(16px, 4vw, 54px);
	--track:    var(--surface-hover);
}

/* Eksell makes #site-content a centred flex box with hidden overflow. */
#site-content.explore,
#site-content.artwork-view,
#site-content.page-view {
	display: block;
	min-height: 0;
	overflow: visible;
	font-size: 14px;
	line-height: 1.4;
}

#site-content.explore {
	padding: 0 var(--page-pad) 64px;
}

.explore a:focus-visible,
.artwork-view a:focus-visible {
	outline: 1px solid var(--accent);
	outline-offset: 2px;
}

/* --- Title: "Anthony Wlock / Archive" ----------------------------- */
.page-crumbs {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 0 14px;
	margin: 36px 0 44px;
	font-size: clamp(24px, 3vw, 28px);
	font-weight: 600;
	line-height: 1.15;
	letter-spacing: -0.02em;
}

.page-crumbs__root {
	color: var(--text-secondary);
	text-decoration: none;
}

.page-crumbs__root:hover {
	color: var(--text-primary);
}

.page-crumbs__sep {
	color: var(--text-tertiary);
	font-weight: 300;
}

.page-crumbs__item {
	color: var(--text-secondary);
	text-decoration: none;
}

.page-crumbs__item[aria-current] {
	color: var(--text-primary);
}

/* --- Controls: labelled columns with a track indicator ------------- */
.explore-bar {
	display: flex;
	flex-wrap: wrap;
	gap: 24px 14px;
	margin-bottom: 48px;
}

.explore-control {
	flex: 0 1 285px;
	min-width: 180px;
}

.explore-control__label {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 10px;
	padding-bottom: 3px;
	border-bottom: 1px solid var(--border);
	color: var(--text-secondary);
	font-size: 13px;
}

.explore-count {
	color: var(--text-secondary);
}

.explore-options {
	position: relative;
	margin: 0;
	padding: 0 0 0 14px;
	list-style: none;
}

/* The light vertical track */
.explore-options::before {
	content: "";
	position: absolute;
	top: 0;
	bottom: 0;
	left: 0;
	width: 5px;
	border-radius: 3px;
	background: var(--track);
}

.explore-options li {
	margin: 0;
}

.explore-options a {
	position: relative;
	display: inline-block;
	padding: 1px 0;
	color: var(--text-secondary);
	font-size: 14px;
	font-weight: 600;
	line-height: 1.25;
	text-decoration: none;
}

.explore-options a:hover {
	color: var(--text-primary);
}

.explore-options a[aria-current] {
	color: var(--text-primary);
}

/* The dark marker on the active option */
.explore-options a[aria-current]::before {
	content: "";
	position: absolute;
	top: 50%;
	left: -14px;
	width: 5px;
	height: 11px;
	border-radius: 3px;
	background: var(--text-secondary);
	transform: translateY(-50%);
}

/* --- Grid: four across, transparent cells, artwork never cropped --- */
.explore-grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 40px 24px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.explore-cell {
	margin: 0;
	min-width: 0;
}

.explore-cell__link {
	display: block;
	color: var(--text-primary);
	text-decoration: none;
}

.explore-cell__frame {
	position: relative;
	aspect-ratio: 1 / 1;
	background: transparent;
	border: 1px solid transparent;
}

.explore-cell__frame img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	max-width: none;
	background: transparent;
	object-fit: contain;
}

.explore-cell__empty {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--text-secondary);
}

.explore-cell__link:hover .explore-cell__frame {
	border-color: var(--border);
}

.explore-cell__caption {
	display: flex;
	justify-content: space-between;
	gap: 8px;
	margin-top: 8px;
	font-size: 13px;
}

.explore-cell__title {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.explore-cell__year {
	flex-shrink: 0;
	color: var(--text-secondary);
}

.explore-cell__link:hover .explore-cell__title {
	color: var(--accent);
}

/* --- Index: one row per work -------------------------------------- */
.explore-index-wrap {
	overflow-x: auto;
}

.explore-index {
	width: 100%;
	margin: 0;
	border: 0;
	border-collapse: collapse;
	font-size: 14px;
}

.explore-index th,
.explore-index td {
	padding: 8px 16px 8px 0;
	border: 0;
	border-bottom: 1px solid var(--border);
	background: transparent;
	color: var(--text-secondary);
	font-weight: 400;
	text-align: left;
	vertical-align: middle;
	white-space: nowrap;
}

.explore-index .explore-row__title {
	width: 100%;
	white-space: normal;
}

.explore-row__title a {
	color: var(--text-primary);
	text-decoration: none;
}

.explore-row:hover td {
	background: var(--surface-hover);
}

.explore-row__thumb {
	width: 48px;
}

.explore-row__thumb img {
	display: block;
	width: 40px;
	height: 40px;
	background: transparent;
	object-fit: contain;
}

/* --- Load more and empty state ------------------------------------- */
.explore-more {
	margin-top: 40px;
	border-top: 1px solid var(--border);
	text-align: center;
}

.explore-more__link {
	display: block;
	padding: 20px 0;
	color: var(--text-secondary);
	text-decoration: none;
}

.explore-more__link:hover {
	color: var(--accent);
}

.explore-empty {
	padding: 64px 0;
	color: var(--text-secondary);
}

.explore-empty a {
	color: var(--text-primary);
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* --- Responsive ---------------------------------------------------- */
@media (max-width: 1000px) {
	.explore-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
	.page-crumbs { margin: 24px 0 28px; }
	.explore-bar { margin-bottom: 32px; }
	.explore-control { flex-basis: 100%; }

	.explore-grid {
		grid-template-columns: minmax(0, 1fr);
		gap: 36px;
	}
}


/* =====================================================================
   12. ARTWORK PAGE (Are.na block view)
   ===================================================================== */

#site-content.artwork-view {
	padding: 16px;
}

.artwork-panel {
	display: grid;
	grid-template-columns: minmax(0, 1fr) clamp(280px, 26vw, 340px);
	grid-template-rows: auto 1fr;
	grid-template-areas:
		"media controls"
		"media info";
	min-height: calc(100vh - var(--hdr-height) - 32px);
	padding: 0 20px 0 0;
	background: var(--background);
	border: 1px solid var(--border);
	box-shadow: 0 1px 12px rgba(30, 26, 24, 0.04);
}

/* Image: contained, centred, as large as the viewport allows */
.artwork-panel__media {
	grid-area: media;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 46px;
}

.artwork-panel__media img {
	display: block;
	width: auto;
	height: auto;
	max-width: 100%;
	max-height: calc(100vh - var(--hdr-height) - 32px - 92px);
	object-fit: contain;
}

/* Controls and info share the hairline divider on the left */
.artwork-panel__controls,
.artwork-panel__info {
	padding-left: 20px;
	border-left: 1px solid var(--border);
}

.artwork-panel__controls {
	grid-area: controls;
	display: flex;
	justify-content: flex-end;
	gap: 6px;
	margin-top: 28px;
	padding-top: 2px;
}

.artwork-control {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 22px;
	height: 22px;
	border: 1px solid transparent;
	border-radius: 3px;
	color: var(--text-primary);
}

.artwork-control svg {
	width: 14px;
	height: 14px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.4;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.artwork-control:hover {
	border-color: var(--border);
	color: var(--text-primary);
}

.artwork-control.is-disabled {
	color: var(--text-tertiary);
}

.artwork-panel__info {
	grid-area: info;
	margin-bottom: 28px;
	padding-top: 16px;
}

.artwork-title {
	margin: 0 0 10px;
	color: var(--text-primary);
	font-size: 18px;
	font-weight: 400;
	line-height: 1.2;
	letter-spacing: -0.01em;
}

.artwork-description {
	margin-bottom: 24px;
	color: var(--text-primary);
	font-size: 14px;
	line-height: 1.45;
	hyphens: auto;
	-webkit-hyphens: auto;
}

.artwork-description p {
	margin: 0 0 0.8em;
}

.artwork-description p:last-child {
	margin-bottom: 0;
}

/* Metadata: label left, value right, hairline rows */
.artwork-meta {
	margin: 0;
	font-size: 13px;
}

.artwork-meta__row {
	display: flex;
	justify-content: space-between;
	gap: 16px;
	padding: 5px 0;
	border-bottom: 1px solid var(--border);
}

.artwork-meta dt {
	flex-shrink: 0;
	margin: 0;
	color: var(--text-secondary);
	font-weight: 400;
}

.artwork-meta dd {
	min-width: 0;
	margin: 0;
	color: var(--text-secondary);
	text-align: right;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.artwork-meta dd.is-strong,
.artwork-meta dd a {
	color: var(--text-primary);
	font-weight: 600;
	text-decoration: none;
}

.artwork-meta dd a:hover {
	color: var(--accent);
}

/* Mobile: controls, then image, then info */
@media (max-width: 900px) {
	#site-content.artwork-view {
		padding: 0;
	}

	.artwork-panel {
		grid-template-columns: minmax(0, 1fr);
		grid-template-rows: auto auto auto;
		grid-template-areas:
			"controls"
			"media"
			"info";
		min-height: 0;
		padding: 0;
		border: 0;
		box-shadow: none;
	}

	.artwork-panel__controls,
	.artwork-panel__info {
		padding: 0 16px;
		border-left: 0;
	}

	.artwork-panel__controls {
		margin-top: 12px;
	}

	.artwork-panel__media {
		padding: 12px 16px 24px;
	}

	.artwork-panel__media img {
		max-height: 70vh;
	}

	.artwork-panel__info {
		padding-top: 20px;
		border-top: 1px solid var(--border);
	}
}



/* =====================================================================
   13. PAGES (About, Contact…)
   Same title and column grid as the archive: the text spans the first
   two control columns (2 × 285px + 14px gap), a Featured Image the third.
   ===================================================================== */

#site-content.page-view {
	padding: 0 var(--page-pad) 64px;
}

.page-view a:focus-visible {
	outline: 1px solid var(--accent);
	outline-offset: 2px;
}

.page-layout {
	display: grid;
	grid-template-columns: minmax(0, 584px);
	gap: 32px 14px;
	align-items: start;
}

.page-layout.has-figure {
	grid-template-columns: minmax(0, 584px) minmax(0, 285px);
}

/* --- Text ---------------------------------------------------------- */
.page-body {
	color: var(--text-primary);
	font-size: 16px;
	line-height: 1.5;
}

.page-body > *:first-child { margin-top: 0; }
.page-body > *:last-child  { margin-bottom: 0; }

.page-body p,
.page-body ul,
.page-body ol {
	margin: 0 0 1em;
}

.page-body ul,
.page-body ol {
	padding-left: 1.2em;
}

.page-body h2,
.page-body h3,
.page-body h4 {
	margin: 2em 0 0.5em;
	padding-bottom: 3px;
	border-bottom: 1px solid var(--border);
	color: var(--text-secondary);
	font-size: 13px;
	font-weight: 400;
	letter-spacing: 0;
}

.page-body a {
	color: var(--text-primary);
	text-decoration: underline;
	text-decoration-color: var(--border);
	text-decoration-thickness: 1px;
	text-underline-offset: 3px;
}

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

.page-body img {
	max-width: 100%;
	height: auto;
}

.page-body figure {
	margin: 1.5em 0;
}

.page-body figcaption {
	margin-top: 6px;
	color: var(--text-secondary);
	font-size: 13px;
}

/* Table block = facts list, styled like the artwork metadata rows */
.page-body .wp-block-table {
	margin: 1.5em 0;
}

.page-body .wp-block-table table {
	width: 100%;
	border: 0;
	border-collapse: collapse;
	font-size: 14px;
}

.page-body .wp-block-table th,
.page-body .wp-block-table td {
	padding: 6px 16px 6px 0;
	border: 0;
	border-bottom: 1px solid var(--border);
	background: transparent;
	color: var(--text-primary);
	font-weight: 400;
	text-align: left;
	vertical-align: top;
}

.page-body .wp-block-table td:first-child {
	width: 35%;
	color: var(--text-secondary);
}

/* --- Featured image ------------------------------------------------ */
.page-figure {
	margin: 0;
}

.page-figure img {
	display: block;
	width: 100%;
	height: auto;
}

@media (max-width: 700px) {
	.page-layout,
	.page-layout.has-figure {
		grid-template-columns: minmax(0, 1fr);
	}
}
