/*
Theme Name: Live Analysis
Theme URI: https://caf.la/
Author: Cambridge AI Forum
Author URI: https://cambridgeaiforum.com/
Description: Every post is a card. The front carries the image, the title and the text with its [1] marks. The back carries the sources. Cards flip in place and filter by theme. Every text and switch is under Appearance, Customize, Live Analysis.
Version: 1.4.5
Requires at least: 6.4
Tested up to: 7.1
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: live-analysis
*/

:root {
	--la-ground: #F3F1EC;
	--la-text: #231F20;
	--la-red: #C4121C;
	--la-soft: #4A4541;
	--la-mute: #6B655F;
	--la-card-text: 18px;
	--la-display: "Archivo", "Arial Black", "Helvetica Neue", Arial, sans-serif;
	--la-sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
	--la-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

*,
*::before,
*::after {
	box-sizing: border-box;
}

[hidden] {
	display: none !important;
}

html {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
}

body {
	margin: 0;
	background: var(--la-ground);
	color: var(--la-text);
	font-family: var(--la-sans);
	font-size: 16px;
	line-height: 1.55;
}

a {
	color: inherit;
	text-decoration: none;
}

a:hover {
	color: var(--la-red);
}

button {
	font: inherit;
	cursor: pointer;
}

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

:focus-visible {
	outline: 3px solid #0DCAF2;
	outline-offset: 3px;
}

.screen-reader-text {
	border: 0;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	width: 1px;
	word-wrap: normal !important;
}

.la-skip {
	position: absolute;
	left: -9999px;
	top: 16px;
	z-index: 100;
	background: var(--la-text);
	color: #FFFFFF;
	padding: 12px 16px;
}

.la-skip:focus {
	left: 16px;
	color: #FFFFFF;
}

/* One column: the whole page keeps a width that reads well. */
.la-wrap {
	max-width: 848px;
	margin: 0 auto;
	padding: 0 clamp(20px, 5vw, 64px) 96px;
}

/* ---- top: logo and menu ---- */

.la-header {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: center;
	gap: 8px 16px;
	padding: 22px 0 12px;
}

.la-logo,
.custom-logo-link {
	display: block;
	line-height: 0;
}

.la-logo img,
.custom-logo {
	display: block;
	height: 56px;
	width: auto;
	max-width: 100%;
}

.la-menu {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 0 28px;
	font-family: var(--la-mono);
	font-size: 11px;
	letter-spacing: 0.2em;
	text-transform: uppercase;
}

.la-menu a {
	display: inline-block;
	padding: 15px 0;
}

.la-menu .current-menu-item > a,
.la-menu .current_page_item > a {
	color: var(--la-red);
}

/* On a phone the menu sits in one tight row under the logo. */
@media (max-width: 480px) {
	.la-header {
		padding: 18px 0 4px;
	}

	.la-menu {
		gap: 0 16px;
		letter-spacing: 0.14em;
	}

	.la-menu a {
		padding: 11px 0;
	}
}

/* ---- top: label, title, text, shapes ---- */

.la-hero {
	display: flex;
	flex-wrap: wrap;
	gap: 28px 64px;
	align-items: flex-end;
	padding: 8px 0 34px;
}

/* Without the four shapes the words sit right above the row of themes. */
.la-hero--plain {
	padding-bottom: 6px;
}

.la-hero__words {
	flex: 1 1 420px;
	min-width: 0;
}

.la-label {
	font-family: var(--la-mono);
	font-size: 11px;
	letter-spacing: 0.22em;
	text-transform: uppercase;
	color: var(--la-red);
	margin: 0 0 14px;
}

.la-hero__title {
	margin: 0 0 18px;
	font-family: var(--la-display);
	font-stretch: 125%;
	font-weight: 900;
	font-size: clamp(44px, 7vw, 76px);
	line-height: 0.95;
	letter-spacing: -0.02em;
	overflow-wrap: anywhere;
}

.la-hero__text {
	margin: 0;
	max-width: 470px;
	font-size: 16px;
	line-height: 1.55;
	color: var(--la-soft);
}

.la-hero__shapes {
	--la-s: clamp(56px, 15vw, 112px);
	flex: 1 1 380px;
	min-width: 0;
	display: flex;
	justify-content: flex-end;
	align-items: flex-end;
	gap: calc(var(--la-s) / 8);
}

.la-hero__shapes span {
	display: block;
	flex: none;
	width: var(--la-s);
	height: var(--la-s);
}

.la-hero__circle {
	border-radius: 50%;
	background: #ED1C24;
}

.la-hero__square {
	background: #0DCAF2;
}

.la-hero__triangle {
	background: #A626FF;
	clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.la-hero__shapes .la-hero__half {
	width: calc(var(--la-s) / 2);
	border-radius: 0 var(--la-s) var(--la-s) 0;
	background: var(--la-text);
}

/* ---- the small shape that stands for a theme ---- */

.la-shape {
	display: inline-block;
	flex: none;
	width: 16px;
	height: 16px;
	background: var(--la-color, #231F20);
}

.la-shape--circle {
	border-radius: 50%;
}

.la-shape--triangle {
	clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

/* ---- filter ---- */

.la-filter {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px 30px;
	padding-bottom: 28px;
	font-family: var(--la-mono);
	font-size: 12px;
	letter-spacing: 0.18em;
	text-transform: uppercase;
}

.la-chip {
	min-height: 44px;
	padding: 0 2px;
	border: 0;
	background: none;
	color: var(--la-text);
	display: inline-flex;
	align-items: center;
	gap: 10px;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	text-underline-offset: 6px;
}

.la-chip .la-shape {
	opacity: 0.3;
}

.la-chip.is-on {
	text-decoration: underline;
}

.la-chip.is-on .la-shape,
.la-filter.is-all .la-chip .la-shape {
	opacity: 1;
}

/* My reads sits at the far right of the row, apart from the themes. Its last letter ends on the cards' right edge:
   the chip gives up its right padding and the blank that letter-spacing leaves after the last letter. */
.la-chip--reads {
	margin-left: auto;
	margin-right: -0.18em;
	padding-right: 0;
}

.la-chip__tick {
	display: inline-flex;
	width: 16px;
	height: 16px;
	opacity: 0.3;
}

.la-chip.is-on .la-chip__tick {
	opacity: 1;
}

.la-chip__n {
	margin-left: -2px;
	color: var(--la-mute);
}

.la-chip__n:empty {
	display: none;
}

html:not(.la-js) .la-chip--reads,
html:not(.la-js) .la-done {
	display: none;
}

/* ---- cards ---- */

/* One card under the other, in the feed and in My reads. */
.la-cards,
.la-reads {
	display: block;
}

.la-card {
	margin: 0 0 28px;
	container-type: inline-size;
	min-width: 0;
	perspective: 1700px;
}

.la-card[hidden] {
	display: none;
}

.la-card__face {
	min-width: 0;
}

/* With scripts on, both faces share one place and the card turns. Without, the back sits under the front. */
.la-js .la-card__inner {
	display: grid;
	height: 100%;
	transition: transform 0.7s cubic-bezier(0.3, 1.25, 0.6, 1);
	transform-style: preserve-3d;
}

.la-js .la-card__face {
	grid-area: 1 / 1;
	backface-visibility: hidden;
	-webkit-backface-visibility: hidden;
}

.la-js .la-card__back {
	transform: rotateY(180deg);
}

.la-js .la-card.is-flipped .la-card__inner {
	transform: rotateY(180deg);
}

@media (prefers-reduced-motion: reduce) {
	.la-js .la-card__inner {
		transition: none;
	}
}

/* Without scripts there is nothing to turn, so the turn buttons stay away. */
html:not(.la-js) .la-flip {
	display: none;
}

.la-card__front {
	background: #FFFFFF;
	display: flex;
	flex-direction: column;
}

.la-card__band {
	position: relative;
	flex: none;
	aspect-ratio: 564 / 112;
	background: #231F20;
	color: #FFFFFF;
	overflow: hidden;
}

.la-card__img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: left center;
	display: block;
}

.la-card__blank {
	position: absolute;
	left: 4%;
	top: 50%;
	width: 11.4%;
	height: auto;
	aspect-ratio: 1;
	transform: translateY(-50%);
}

.la-card__mark {
	position: absolute;
	right: 22px;
	right: 3.9cqi;
	top: 16%;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	text-align: right;
}

.la-card__num {
	font-family: var(--la-display);
	font-stretch: 125%;
	font-weight: 900;
	font-size: 44px;
	font-size: clamp(22px, 7.8cqi, 44px);
	line-height: 1;
}

.la-card__theme {
	font-family: var(--la-mono);
	font-size: 11px;
	font-size: clamp(8px, 1.95cqi, 11px);
	letter-spacing: 0.22em;
	text-transform: uppercase;
	margin-top: 0.9em;
}

/* The mark on a draft: a small label in the top left corner of the image. Only logged-in editors get to see it. */
.la-card__draft {
	position: absolute;
	left: 0;
	top: 0;
	background: #FFFFFF;
	color: #231F20;
	font-family: var(--la-mono);
	font-weight: 500;
	font-size: 10px;
	font-size: clamp(8px, 1.8cqi, 10px);
	line-height: 1;
	letter-spacing: 0.2em;
	text-transform: uppercase;
	padding: 5px 6px 5px 8px;
}

.la-card__body {
	flex: 1;
	display: flex;
	min-height: 0;
}

.la-card__ticks {
	flex: none;
	width: 22px;
	background-image: repeating-linear-gradient(to bottom, #231F20 0 2px, transparent 2px 60px), repeating-linear-gradient(to bottom, #231F20 0 1px, transparent 1px 12px);
	background-size: 16px 100%, 8px 100%;
	background-repeat: no-repeat;
}

.la-card__text {
	flex: 1;
	min-width: 0;
	padding: 20px 24px 18px 14px;
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.la-card__body > .la-card__text:first-child {
	padding-left: 24px;
}

.la-card__title {
	margin: 0;
	font-family: var(--la-display);
	font-stretch: 125%;
	font-weight: 900;
	font-size: 21px;
	line-height: 1.15;
	letter-spacing: -0.01em;
	text-transform: uppercase;
	overflow-wrap: anywhere;
}

.la-card__copy {
	font-size: var(--la-card-text);
	line-height: 1.55;
}

.la-card__copy > * {
	margin: 0 0 0.8em;
}

.la-card__copy > *:last-child {
	margin-bottom: 0;
}

.la-card__copy h3,
.la-card__copy h4 {
	font-size: 1em;
	font-weight: 600;
}

.la-card__copy a:not(.la-cite),
.la-post__copy a:not(.la-cite) {
	text-decoration: underline;
}

.la-cite {
	display: inline;
	font-family: var(--la-mono);
	font-size: 0.82em;
	line-height: 1;
	border: 0;
	background: none;
	padding: 0 1px;
	color: var(--la-red);
}

.la-cite:hover {
	text-decoration: underline;
}

/* The foot of a card: the sources on the left, the mark-as-read button in the middle, the turn button on the right. */
.la-card__foot {
	margin-top: auto;
	padding-top: 4px;
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
	align-items: center;
	gap: 12px;
}

.la-card__foot .la-card__count {
	grid-column: 1;
	justify-self: start;
}

.la-card__foot .la-done {
	grid-column: 2;
}

.la-card__foot .la-flip {
	grid-column: 3;
	justify-self: end;
}

.la-card__count {
	font-family: var(--la-mono);
	font-size: 11px;
	letter-spacing: 0.2em;
	text-transform: uppercase;
	color: #5F5A55;
}

.la-flip {
	flex: none;
	width: 52px;
	height: 52px;
	border: 0;
	border-radius: 50%;
	background: var(--la-color);
	color: var(--la-ink);
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.la-flip--back {
	background: var(--la-ink);
	color: var(--la-color);
}

.la-card__back {
	position: relative;
	padding: 24px 26px 20px;
	background: var(--la-color);
	color: var(--la-ink);
	display: flex;
	flex-direction: column;
	gap: 14px;
	overflow: hidden;
}

.la-card__corner {
	position: absolute;
	right: 0;
	top: 0;
	width: 150px;
	height: 150px;
	border-radius: 0 0 0 150px;
	background: #231F20;
}

.la-card__num--back {
	position: absolute;
	right: 22px;
	top: 20px;
	font-size: 44px;
	color: #FFFFFF;
}

.la-card__against {
	max-width: calc(100% - 140px);
	min-height: 1em;
	font-family: var(--la-mono);
	font-size: 11px;
	font-weight: 500;
	letter-spacing: 0.22em;
	text-transform: uppercase;
}

.la-card__total {
	max-width: min(320px, calc(100% - 140px));
	font-family: var(--la-display);
	font-stretch: 125%;
	font-weight: 900;
	font-size: 30px;
	line-height: 1;
	text-transform: uppercase;
	margin-bottom: 60px;
}

.la-refs {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.la-refs__none {
	margin: 0;
	font-weight: 500;
}

.la-ref {
	position: relative;
	display: flex;
	gap: 14px;
	border-top: 1px solid var(--la-ink);
	padding-top: 12px;
}

.la-ref.is-hit .la-ref__text {
	text-decoration: underline;
	text-decoration-thickness: 2px;
	text-underline-offset: 4px;
}

.la-ref__n {
	flex: none;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: var(--la-ink);
	color: var(--la-color);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-family: var(--la-mono);
	font-size: 13px;
	font-weight: 500;
}

.la-ref__body {
	min-width: 0;
}

.la-ref__text {
	font-size: 16px;
	line-height: 1.5;
	font-weight: 500;
}

.la-ref__site,
.la-ref__site:hover {
	display: inline-block;
	margin-top: 4px;
	padding: 4px 0;
	font-family: var(--la-mono);
	font-size: 11px;
	letter-spacing: 0.06em;
	color: inherit;
	text-decoration: underline;
	overflow-wrap: anywhere;
}

.la-ref__site:hover {
	text-decoration-thickness: 2px;
}

.la-card__foot--back {
	display: flex;
	justify-content: flex-end;
}

.la-empty {
	margin: 0;
	padding: 40px 0;
	font-family: var(--la-mono);
	font-size: 12px;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: var(--la-mute);
}

/* ---- Mark as read: the round button in the middle of a card's foot. It moves the post into My reads ---- */
/* Light on purpose: a thin outline around an open book with a tick. Pressed, it fills with the theme's colour. */

.la-done {
	position: relative;
	width: 52px;
	height: 52px;
	margin: 0;
	padding: 0;
	border: 1.5px solid var(--la-text);
	border-radius: 50%;
	background: transparent;
	color: var(--la-text);
	touch-action: manipulation;
	-webkit-tap-highlight-color: transparent;
	transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.12s ease;
}

.la-done__do,
.la-done__undo {
	display: flex;
	width: 100%;
	height: 100%;
	align-items: center;
	justify-content: center;
}

.la-done__undo,
.la-card.is-read .la-done__do {
	display: none;
}

.la-card.is-read .la-done__undo {
	display: flex;
}

.la-done svg {
	display: block;
}

/* Pressed: the button takes the theme's colour while the card starts to fold. */
.la-done.is-done {
	background: var(--la-color);
	border-color: var(--la-color);
	color: var(--la-ink);
}

@media (hover: hover) {
	.la-done:hover {
		background: var(--la-color);
		border-color: var(--la-color);
		color: var(--la-ink);
	}
}

.la-done:active {
	transform: scale(0.94);
}

/* A card on its way out: it fades at once and folds away. */
.la-card.is-leaving {
	overflow: hidden;
	pointer-events: none;
}

.la-js .la-card.is-leaving .la-card__inner {
	opacity: 0;
	transition: opacity 0.22s ease;
}

.la-note {
	margin: 0;
	padding: 36px 0;
	font-family: var(--la-mono);
	font-size: 12px;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	text-align: center;
	color: var(--la-mute);
}

/* ---- the button under the cards: it loads the next ones ---- */

button.la-more {
	border: 0;
	background: none;
	padding: 0;
	color: inherit;
}

.la-more-row {
	display: flex;
	align-items: center;
	gap: 22px;
	margin-top: 44px;
}

.la-more-row::before,
.la-more-row::after {
	content: "";
	flex: 1;
	border-top: 1px solid rgba(35, 31, 32, 0.28);
}

.la-more {
	flex: none;
	display: inline-flex;
	align-items: center;
	gap: 16px;
	min-height: 52px;
	font-family: var(--la-mono);
	font-size: 12px;
	letter-spacing: 0.2em;
	text-transform: uppercase;
}

.la-more__icon {
	flex: none;
	width: 52px;
	height: 52px;
	border-radius: 50%;
	background: var(--la-text);
	color: #FFFFFF;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: background-color 0.2s ease, transform 0.12s ease;
}

.la-more__icon svg {
	display: block;
	transition: transform 0.25s cubic-bezier(0.3, 1.25, 0.6, 1);
}

.la-more {
	touch-action: manipulation;
	-webkit-tap-highlight-color: transparent;
}

.la-more:focus-visible .la-more__icon {
	background: var(--la-red);
}

/* Hover only where a pointer can hover, so a finger never has to tap twice. */
@media (hover: hover) {
	.la-more:hover .la-more__icon {
		background: var(--la-red);
	}

	.la-more:hover .la-more__icon svg {
		transform: translateY(3px);
	}
}

.la-more:active .la-more__icon {
	transform: scale(0.92);
}

.la-more.is-busy {
	color: var(--la-mute);
	cursor: progress;
}

.la-more.is-busy .la-more__icon {
	background: var(--la-text);
}

.la-more.is-busy .la-more__icon svg {
	animation: la-dip 0.55s ease-in-out infinite alternate;
}

@keyframes la-dip {
	from {
		transform: translateY(-4px);
	}

	to {
		transform: translateY(5px);
	}
}

/* Cards that have just loaded rise into place, one after another. */
.la-card.is-new {
	animation: la-arrive 0.7s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

@keyframes la-arrive {
	from {
		opacity: 0;
		transform: translateY(32px);
	}

	to {
		opacity: 1;
		transform: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.la-more__icon svg,
	.la-more.is-busy .la-more__icon svg,
	.la-card.is-new {
		animation: none;
		transition: none;
	}
}

/* ---- one post, one page ---- */

.la-post {
	max-width: 760px;
	margin: 0 auto;
	padding-top: 8px;
}

.la-back {
	display: inline-block;
	padding: 13px 0;
	font-family: var(--la-mono);
	font-size: 11px;
	letter-spacing: 0.2em;
	text-transform: uppercase;
	text-decoration: underline;
	text-underline-offset: 6px;
}

.la-post__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 12px;
	margin-top: 18px;
	font-family: var(--la-mono);
	font-size: 11px;
	letter-spacing: 0.2em;
	text-transform: uppercase;
	color: var(--la-mute);
}

.la-post__meta a {
	color: var(--la-text);
}

.la-post__draft {
	border: 1px solid currentColor;
	padding: 1px 6px;
	color: var(--la-red);
}

.la-post__title {
	margin: 14px 0 26px;
	font-family: var(--la-display);
	font-stretch: 125%;
	font-weight: 900;
	font-size: clamp(30px, 5vw, 50px);
	line-height: 1.02;
	letter-spacing: -0.02em;
	text-transform: uppercase;
	overflow-wrap: anywhere;
}

.la-post__band {
	aspect-ratio: 564 / 112;
	background: #231F20;
	overflow: hidden;
	margin-bottom: 30px;
}

.la-post__band img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: left center;
}

.la-post__copy {
	font-size: 19px;
	line-height: 1.6;
}

.la-post__copy > * {
	margin: 0 0 1em;
}

.la-post__copy h2,
.la-post__copy h3 {
	margin-top: 1.6em;
	font-family: var(--la-display);
	font-stretch: 125%;
	font-weight: 900;
	line-height: 1.15;
	text-transform: uppercase;
}

.la-post__copy h2 {
	font-size: 24px;
}

.la-post__copy h3 {
	font-size: 19px;
}

.la-post__copy blockquote {
	margin-left: 0;
	padding-left: 18px;
	border-left: 4px solid var(--la-color, #231F20);
}

.la-post__sources {
	margin-top: 48px;
	border-top: 1px solid #231F20;
	padding-top: 22px;
}

.la-post__sources h2 {
	margin: 0 0 18px;
	font-family: var(--la-mono);
	font-size: 11px;
	font-weight: 400;
	letter-spacing: 0.22em;
	text-transform: uppercase;
	color: var(--la-red);
}

.la-refs--page {
	--la-ink: #231F20;
	--la-color: #F3F1EC;
}

.la-refs--page .la-ref {
	border-top-color: #CFC9C0;
	scroll-margin-top: 24px;
}

.la-refs--page .la-ref:first-child {
	border-top: 0;
	padding-top: 0;
}

.la-refs--page .la-ref:target .la-ref__text {
	text-decoration: underline;
	text-decoration-thickness: 2px;
	text-underline-offset: 4px;
}

.alignleft {
	float: left;
	margin: 0 1.5em 1em 0;
}

.alignright {
	float: right;
	margin: 0 0 1em 1.5em;
}

.aligncenter {
	display: block;
	margin-left: auto;
	margin-right: auto;
}

.wp-caption {
	max-width: 100%;
}

.wp-caption-text {
	font-size: 14px;
	color: var(--la-mute);
}

/* ---- bottom ---- */

.la-footer {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 12px;
	border-top: 1px solid #231F20;
	margin-top: 64px;
	padding-top: 18px;
	font-family: var(--la-mono);
	font-size: 11px;
	letter-spacing: 0.2em;
	text-transform: uppercase;
	color: var(--la-mute);
}
