/*
 * GDV Ebooks: the ebook's page. Two columns from 861 px up, the cover at
 * 340 px with "Read an extract" under it, beside the title and the buy area.
 * Below, one grid: the cover at 120 px beside the title, the series and
 * "By …"; then the short line and the card text, the buy area and "Read an
 * extract", each at full width. Then the jump bar and the sections. Buttons,
 * notices and the cards are gdv-public-ui's; every colour is one of its tokens.
 *
 * The child theme centres every h1 and h2 and paints links with a yellow
 * underline, on bare element selectors: the headings here are element
 * qualified to set their own alignment, and the page draws no ul of its own,
 * because the theme's bullet rule on ul outranks any class.
 */

/* ===== First screen ===== */

/* The page writes the cover, the main column and "Read an extract" in reading
   order. The main column spans both rows, so the second row starts right
   under the cover and the extract sits there; the 1fr row takes whatever
   height the main column needs beyond the cover's. */
.gdv-ebooks-page .gdv-ebooks-page__hero {
	display: grid;
	grid-template-columns: minmax(0, 340px) minmax(0, 1fr);
	grid-template-rows: auto 1fr;
	gap: 0 40px;
	align-items: start;
}

.gdv-ebooks-page .gdv-ebooks-page__cover {
	grid-column: 1;
	grid-row: 1;
}

.gdv-ebooks-page .gdv-ebooks-page__main {
	grid-column: 2;
	grid-row: 1 / span 2;
	min-width: 0;
}

.gdv-ebooks-page .gdv-ebooks-page__extract {
	grid-column: 1;
	grid-row: 2;
	margin: 16px 0 0;
	text-align: center;
}

/* Without a cover: one column, "Read an extract" under the buy area. */
.gdv-ebooks-page .gdv-ebooks-page__hero--no-cover {
	grid-template-columns: minmax(0, 1fr);
	grid-template-rows: none;
}

.gdv-ebooks-page .gdv-ebooks-page__hero--no-cover .gdv-ebooks-page__main,
.gdv-ebooks-page .gdv-ebooks-page__hero--no-cover .gdv-ebooks-page__extract {
	grid-column: 1;
	grid-row: auto;
}

.gdv-ebooks-page .gdv-ebooks-page__cover-img {
	display: block;
	width: 100%;
	height: auto;
}

.gdv-ebooks-page h1.gdv-ebooks-page__title {
	margin: 0;
	text-align: left;
	overflow-wrap: anywhere;
}

/* The series, under the title in the short line's quiet colour. */
.gdv-ebooks-page .gdv-ebooks-page__series {
	margin: 6px 0 0;
	color: var(--gdv-ui-text-faint, #666666);
}

.gdv-ebooks-page .gdv-ebooks-page__by {
	margin: 8px 0 0;
}

.gdv-ebooks-page .gdv-ebooks-page__meta {
	margin: 6px 0 0;
	color: var(--gdv-ui-text-faint, #666666);
}

/* "All future editions included": under the short line, in the body colour, because it is part of the offer. */
.gdv-ebooks-page .gdv-ebooks-page__editions {
	margin: 6px 0 0;
}

/* The card text, under the short line at the form's reading width. */
.gdv-ebooks-page .gdv-ebooks-page__summary {
	max-width: 40rem;
	margin: 16px 0 0;
}

/* The buy area: the form card, "Email me when it is out", the owner's
   buttons, or one notice, at the form's reading width. */
.gdv-ebooks-page .gdv-ebooks-page__buy > .gdv-ebooks-buy,
.gdv-ebooks-page .gdv-ebooks-page__buy > .gdv-ebooks-stay-tuned,
.gdv-ebooks-page .gdv-ebooks-page__buy > .gdv-ebooks-page__owned,
.gdv-ebooks-page .gdv-ebooks-page__buy > .gdv-ui-notice {
	max-width: 40rem;
	margin-top: 24px;
}

/* "Discover the other ebooks", under the notice of an ebook that cannot be bought. */
.gdv-ebooks-page .gdv-ebooks-page__buy > .gdv-ebooks-buy__discover {
	margin: 16px 0 0;
}

/* The price, read first by its size; a price is never bold. */
.gdv-ebooks-page .gdv-ebooks-buy__price {
	margin: 0 0 12px;
	font-size: 1.5rem;
	font-weight: 400;
	line-height: 1.3;
	color: var(--gdv-ui-text, #444444);
	font-variant-numeric: tabular-nums;
}

/* "Stay up to date" at the top of the sign-up card, left-aligned over the
   theme's centred h2 and a step below the section headings. */
.gdv-ebooks-page h2.gdv-ebooks-stay-tuned__title {
	margin: 0 0 16px;
	font-size: 1.375rem;
	line-height: 1.3;
	text-align: left;
}

/* Under the address of "Email me when it is out": what the address is used for, in the quiet tone of the form's notes. */
.gdv-ebooks-page .gdv-ebooks-stay-tuned__email-use {
	margin: 0.375rem 0 0;
	font-size: 0.9375rem;
	line-height: 1.5;
	color: var(--gdv-ui-text-faint);
}

/* An ebook "Coming soon": the price stands above the release notice, with no form card around it. */
.gdv-ebooks-page .gdv-ebooks-page__buy > .gdv-ebooks-buy__price {
	margin-top: 24px;
}

/* On a phone the main column gives its parts to the grid, so the buy button
   stays in the first screen: the small cover beside the title, the rest under
   it at full width in reading order, "Read an extract" last. A part the page
   leaves out leaves no empty row. */
@media (max-width: 860px) {
	.gdv-ebooks-page .gdv-ebooks-page__hero {
		grid-template-columns: 120px minmax(0, 1fr);
		grid-template-rows: none;
		gap: 16px;
	}

	.gdv-ebooks-page .gdv-ebooks-page__hero--no-cover {
		grid-template-columns: minmax(0, 1fr);
	}

	.gdv-ebooks-page .gdv-ebooks-page__main {
		display: contents;
	}

	.gdv-ebooks-page .gdv-ebooks-page__cover {
		grid-column: 1;
		grid-row: auto;
	}

	.gdv-ebooks-page .gdv-ebooks-page__headline {
		grid-column: 2;
		min-width: 0;
	}

	.gdv-ebooks-page .gdv-ebooks-page__hero--no-cover .gdv-ebooks-page__headline {
		grid-column: 1;
	}

	.gdv-ebooks-page .gdv-ebooks-page__intro,
	.gdv-ebooks-page .gdv-ebooks-page__buy,
	.gdv-ebooks-page .gdv-ebooks-page__extract,
	.gdv-ebooks-page .gdv-ebooks-page__hero--no-cover .gdv-ebooks-page__extract {
		grid-column: 1 / -1;
		grid-row: auto;
		min-width: 0;
	}

	.gdv-ebooks-page .gdv-ebooks-page__extract {
		margin: 0;
	}

	/* The grid's gap spaces these rows; a margin on top would double it. */
	.gdv-ebooks-page .gdv-ebooks-page__intro > :first-child,
	.gdv-ebooks-page .gdv-ebooks-page__buy > :first-child {
		margin-top: 0;
	}
}

/* ===== Jump bar ===== */

/* A row of outlined chips, each a target of its own, wrapping on a phone. */
.gdv-ebooks-page .gdv-ebooks-page__nav {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 40px 0 0;
}

.gdv-ebooks-page a.gdv-ebooks-page__nav-link {
	display: inline-block;
	padding: 6px 16px;
	border: 1px solid var(--gdv-ui-border-strong, #666666);
	border-radius: 999px;
	color: var(--gdv-ui-text, #444444);
	font-weight: 600;
	line-height: 1.4;
	text-decoration: none;
}

.gdv-ebooks-page a.gdv-ebooks-page__nav-link:hover {
	background: var(--gdv-ui-bg, #fafbf5);
	color: var(--gdv-ui-text, #444444);
	text-decoration: none;
}

/* ===== Sections ===== */

.gdv-ebooks-page .gdv-ebooks-page__section {
	margin: 40px 0 0;
	scroll-margin-top: 1rem;
}

.gdv-ebooks-page .gdv-ebooks-page__section:not(.gdv-ebooks-page__section--related) {
	max-width: 68ch;
}

.gdv-ebooks-page h2.gdv-ebooks-page__heading {
	margin: 0 0 16px;
	text-align: left;
}

/* "Contents": no numbers and no bullets, an indented entry set in under its
   parent. Element-qualified, because the theme styles ul and li inside
   .nv-content-wrap; list-style goes on the li, because neve-child's
   ul:not(...) rule sets list-style-type on the ul at (0,6,1). */
.gdv-ebooks-page ul.gdv-ebooks-page__contents,
.gdv-ebooks-page ul.gdv-ebooks-page__contents ul {
	display: grid;
	gap: 4px;
	margin: 0;
	padding-left: 0;
}

.gdv-ebooks-page ul.gdv-ebooks-page__contents ul {
	margin-top: 4px;
	padding-left: 1.5em;
}

.gdv-ebooks-page ul.gdv-ebooks-page__contents li {
	margin: 0;
	list-style: none;
}

/* "Author": one card per author, in the shape of the event page's speaker
   card: the photo or the initials beside the name, the role and the bio. */
.gdv-ebooks-page .gdv-ebooks-page__authors {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.gdv-ebooks-page .gdv-ebooks-author {
	display: flex;
	gap: 16px;
	align-items: flex-start;
	padding-bottom: 16px;
	border-bottom: 1px solid var(--gdv-ui-border);
}

.gdv-ebooks-page .gdv-ebooks-author:last-child {
	padding-bottom: 0;
	border-bottom: 0;
}

.gdv-ebooks-page .gdv-ebooks-author__photo {
	flex: none;
	width: 80px;
}

.gdv-ebooks-page .gdv-ebooks-author__img {
	display: block;
	width: 80px;
	height: 80px;
	border-radius: 50%;
	object-fit: cover;
}

/* The credit belongs with the picture it credits. */
.gdv-ebooks-page .gdv-ebooks-author__credit {
	display: block;
	margin-top: 4px;
	line-height: 1.3;
	color: var(--gdv-ui-text-faint);
	overflow-wrap: anywhere;
}

.gdv-ebooks-page .gdv-ebooks-author__initials {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 80px;
	height: 80px;
	border-radius: 50%;
	background: var(--gdv-ui-surface);
	border: 1px solid var(--gdv-ui-border);
	color: var(--gdv-ui-text);
	font-size: 1.5rem;
	font-weight: 600;
	line-height: 1;
}

.gdv-ebooks-page .gdv-ebooks-author__info {
	min-width: 0;
}

.gdv-ebooks-page .gdv-ebooks-author__name {
	margin: 0 0 2px;
	font-weight: 600;
}

/* The theme's yellow link underline reads at 2:1; the name's underline is the text colour. */
.gdv-ebooks-page .gdv-ebooks-author__name a {
	color: var(--gdv-ui-text);
	text-decoration: underline;
	text-decoration-color: currentColor;
}

/* Marks a name that leaves the site; inside the link, so it takes the link's colour. */
.gdv-ebooks-page .gdv-ebooks-author__external {
	width: 0.85em;
	height: 0.85em;
	margin-left: 0.2em;
	vertical-align: -0.08em;
}

.gdv-ebooks-page .gdv-ebooks-author__role {
	margin: 0 0 4px;
	color: var(--gdv-ui-text-faint);
}

.gdv-ebooks-page .gdv-ebooks-author__bio {
	margin: 4px 0 0;
	line-height: 1.5;
}

.gdv-ebooks-page .gdv-ebooks-author__bio p:last-child {
	margin-bottom: 0;
}

/* Six lines, so a typical bio shows whole and a long one gets "Read more". */
.gdv-ebooks-page .gdv-ebooks-author__bio--collapsed {
	display: -webkit-box;
	-webkit-line-clamp: 6;
	line-clamp: 6;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* A text button; the resets keep Neve's generic button:hover paint off it. */
.gdv-ebooks-page .gdv-ebooks-author__bio-toggle,
.gdv-ebooks-page .gdv-ebooks-author__bio-toggle:hover,
.gdv-ebooks-page .gdv-ebooks-author__bio-toggle:focus {
	display: inline-block;
	min-height: 24px;
	margin-top: 4px;
	padding: 0;
	background: none;
	border: 0;
	color: var(--gdv-ui-text);
	font-weight: 600;
	text-decoration: underline;
	cursor: pointer;
}

.gdv-ebooks-page .gdv-ebooks-author__bio-toggle[hidden] {
	display: none;
}

.gdv-ebooks-page .gdv-ebooks-author__bio-toggle:focus-visible {
	outline: 2px solid var(--gdv-ui-focus);
	outline-offset: 2px;
}

/* On a phone the card stacks, centred, with a smaller photo. */
@media (max-width: 600px) {
	.gdv-ebooks-page .gdv-ebooks-author {
		flex-direction: column;
		align-items: center;
		text-align: center;
	}

	.gdv-ebooks-page .gdv-ebooks-author__photo,
	.gdv-ebooks-page .gdv-ebooks-author__img,
	.gdv-ebooks-page .gdv-ebooks-author__initials {
		width: 64px;
	}

	.gdv-ebooks-page .gdv-ebooks-author__img,
	.gdv-ebooks-page .gdv-ebooks-author__initials {
		height: 64px;
		font-size: 1.25rem;
	}
}

/* The table scrolls inside its own box rather than widening the page. */
.gdv-ebooks-page .gdv-ebooks-page__facts-wrap {
	overflow-x: auto;
}

.gdv-ebooks-page .gdv-ebooks-page__facts {
	width: 100%;
	max-width: 560px;
	margin: 0;
	border-collapse: collapse;
}

.gdv-ebooks-page .gdv-ebooks-page__facts th,
.gdv-ebooks-page .gdv-ebooks-page__facts td {
	padding: 8px 16px 8px 0;
	text-align: left;
	vertical-align: top;
	border: none;
	border-bottom: 1px solid var(--gdv-ui-border, #dddddd);
	overflow-wrap: anywhere;
}

.gdv-ebooks-page .gdv-ebooks-page__facts th {
	width: 40%;
	font-weight: 600;
}

/* "More to discover": cards at a bookshop shelf's width, not the page's.
   Three classes, over the teaser grid's two. */
.gdv-ebooks-page .gdv-ui-teaser-grid.gdv-ebooks-page__related {
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 12rem), 15rem));
	margin-top: 0;
}
