/*
Theme Name: Portfolio
Template: poe
Description: Luca De Battista's portfolio, a child theme of Poe. Edit this theme, never Poe: Poe updates overwrite the parent folder.
Version: 1.0.0
Text Domain: portfolio
*/

/* Additional styles */
@media screen and (min-width: 320px) and (max-width: 600px) {
  .wp-block-navigation__responsive-container :where(.wp-block-navigation-item a) {
    color: inherit;
    font-size: 2em;
  }
}

@media screen and (min-width: 320px) and (max-width: 780px) {
  .project-info {
    flex-direction: row !important;
  }
}

/* -------------------------------------------------------------------------- */
/*	Text links: three roles, one timing (150ms, --ease-out-strong, 80ms before letting go)
/*	1. Navigation (menu, footer, year tabs, Previous/Next): 60% at rest, 100% when current or hovered, 96% press.
/*	2. Destinations (project and book titles): an arrow fades in (see "Home: same hover as Reading").
/*	3. Inline links in running text: 80% with a solid 1px underline at 40%; hover brings both to 100%, press dips to 60%.
/*	The site name sits at 100% like a current item, with the press only. No underline appears or disappears anywhere.
/* -------------------------------------------------------------------------- */
:root { --link-timing: 150ms var(--ease-out-strong, cubic-bezier(0.23, 1, 0.32, 1)); }

/* 1. Navigation. `footer .footer_nav a` outranks the footer column's grey link colour, so the footer matches the menu. */
.custom-nav .wp-block-navigation-item__content,
footer .footer_nav a,
.reading-tabs a,
.wp-block-post-navigation-link a {
  display: inline-block;
  color: var(--wp--preset--color--foreground);
  text-decoration: none;
  opacity: 0.6;
  transition: opacity var(--link-timing) 80ms, transform 120ms ease-out;
}
.custom-nav .wp-block-navigation-item__content:hover,
footer .footer_nav a:hover,
.reading-tabs a:hover,
.wp-block-post-navigation-link a:hover {
  text-decoration: none !important; /* beats Poe's underline on link hover */
  opacity: 1;
  transition-delay: 0ms;
}
.custom-nav .current-menu-item > .wp-block-navigation-item__content,
footer .footer_nav a[aria-current="page"],
.reading-tabs .current-cat a {
  opacity: 1;
}

/* Site name: always 100% (it marks where you are), press only. */
.wp-block-site-title a,
.wp-block-site-title a:hover {
  display: inline-block;
  text-decoration: none;
  transition: transform 120ms ease-out;
}

.custom-nav .wp-block-navigation-item__content:active,
footer .footer_nav a:active,
.reading-tabs a:active,
.wp-block-post-navigation-link a:active,
.wp-block-site-title a:active {
  transform: scale(0.96);
}

/* 3. Inline links in running text (About, and any link added to a case study paragraph or list). */
main :is(p, .wp-block-list li):not(.arrow-link) a:not(.wp-element-button) {
  text-decoration-line: underline;
  text-decoration-style: solid;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  text-decoration-color: rgb(255 255 255 / 0.4);
  opacity: 0.8;
  transition: opacity var(--link-timing) 80ms, text-decoration-color var(--link-timing) 80ms;
}
main :is(p, .wp-block-list li):not(.arrow-link) a:not(.wp-element-button):hover {
  text-decoration-line: underline;
  text-decoration-color: currentColor;
  opacity: 1;
  transition-delay: 0ms;
}
/* Press: links in running text can wrap over two lines, so they can't scale like the menu; they dip to 60% instead. */
main :is(p, .wp-block-list li):not(.arrow-link) a:not(.wp-element-button):active {
  opacity: 0.6;
  transition-delay: 0ms;
}

@media (prefers-reduced-motion: reduce) {
  .custom-nav .wp-block-navigation-item__content,
  footer .footer_nav a,
  .reading-tabs a,
  .wp-block-post-navigation-link a,
  .wp-block-site-title a,
  main :is(p, .wp-block-list li):not(.arrow-link) a { transition: none; }
}

/* Page-load animations: one short staggered entrance, everything settled in under 1s.
   "backwards" fill: no transform is left on the element once it lands (keeps the sticky nav clean). */
:root { --ease-out-strong: cubic-bezier(0.23, 1, 0.32, 1); }

.appear-1 { animation: fade-up 1.1s var(--ease-out-strong) backwards; }
.appear-2 { animation: fade-up 1.1s var(--ease-out-strong) 1s backwards; }
.animated-content { animation: fade-up 0.5s var(--ease-out-strong) backwards; }
.site-content { animation: fade-up 1s var(--ease-out-strong) 2s backwards; }

@media screen and (min-width: 601px) {
  .custom-nav { animation: slide-down 0.4s var(--ease-out-strong) backwards; } /* inner pages: menu right away */
  .home .custom-nav { animation-delay: 2s; } /* home: menu after the intro animation */
  .custom-nav .custom-nav { animation: none; } /* nested items move with their bar, not on top of it */
}

@keyframes fade-up {
  from { transform: translateY(12px); opacity: 0; }
}

@keyframes slide-down {
  from { transform: translateY(-8px); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .appear-1, .appear-2, .animated-content, .site-content, .custom-nav { animation: none; }
}
/* -------------------------------------------------------------------------- */
/*	Portfolio grid: hovering (or keyboard-focusing) one tile dims the others
/* -------------------------------------------------------------------------- */

.wp-block-post-template > .wp-block-post {
	/* Un-dimming waits 80ms so crossing the gap between tiles doesn't flash the grid back to full.
	   The title arrows use the same 150ms / curve / 80ms, so the gesture moves as one. */
	transition: opacity 150ms var(--ease-out-strong, cubic-bezier(0.23, 1, 0.32, 1)) 80ms;
}

/* Keyboard: Tab moves fast, so focus-driven dimming and arrows switch instantly. */
.wp-block-post-template:has(> .wp-block-post a:focus-visible) > .wp-block-post,
.wp-block-post-template:has(> .wp-block-post a:focus-visible) .wp-block-post-title a::after {
	transition: none;
}

/* The whole tile is the link: the title link stretches over it, so everywhere that lights up on hover
   also clicks. Home project tiles and book tiles. */
.home .wp-block-post-template > .wp-block-post,
.reading-grid .wp-block-post-template > .wp-block-post {
	position: relative;
}
.home .wp-block-post-template .wp-block-post-title a::before,
.reading-grid .wp-block-post-template .book-title a::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1; /* above the author line, whose 60% opacity would otherwise stack it on top */
}

.wp-block-post-template:has(> .wp-block-post a:focus-visible) > .wp-block-post:not(:focus-within, .reveal) {
	opacity: 0.6;
	transition-delay: 0ms;
}

@media (hover: hover) and (pointer: fine) {
	/* .reveal: a book still fading in (scroll-reveal.js) is left out of the dimming. */
	.wp-block-post-template:has(> .wp-block-post:hover) > .wp-block-post:not(:hover, .reveal) {
		opacity: 0.6;
		transition-delay: 0ms;
	}

	.wp-block-post-template > .wp-block-post:hover {
		transition-delay: 0ms;
	}
}

/* Press: the tile you click dips to 80% (the others sit at 60% while you hover, so it stays the brightest). */
.wp-block-post-template > .wp-block-post:active {
	opacity: 0.8;
	transition-delay: 0ms;
}

@media (prefers-reduced-motion: reduce) {
	.wp-block-post-template > .wp-block-post {
		transition: none;
	}
}

/* -------------------------------------------------------------------------- */
/*	Reading: year tabs and a masonry book grid (after jschlossberg.com/books):
/*	5 columns, 2 on phones; covers at full column width, natural height, never cropped.
/*	reading-masonry.js packs the tiles; without JS they fall back to a top-aligned grid.
/* -------------------------------------------------------------------------- */

/* Year switcher: a row of years at menu size; selected 100%, others 60%, hover 100%, press 96%. */
.reading-tabs {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	column-gap: 0.9em;
	row-gap: 0.2em;
	list-style: none;
	margin: 0 0 2.5rem;
	padding: 0;
	font-size: var(--wp--preset--font-size--medium);
}
/* Year links: the navigation role at the top of this file. */

/* Visually hidden, still read by screen readers and search engines. */
.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

.reading-grid .wp-block-post-template.wp-block-post-template {
	display: grid;
	grid-template-columns: repeat(5, minmax(0, 1fr));
	column-gap: 15px;
	row-gap: 30px;
	align-items: start;
}
@media screen and (max-width: 580px) {
	.reading-grid .wp-block-post-template.wp-block-post-template {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}
/* Masonry: 1px rows, each tile spans its own height (set by reading-masonry.js). */
.reading-grid.is-masonry .wp-block-post-template.wp-block-post-template {
	grid-auto-rows: 1px;
	row-gap: 0;
}

.reading-grid .wp-block-post {
	display: flex;
	flex-direction: column;
	gap: 0.2em;
}

.reading-grid .book-cover {
	margin: 0 0 5px;
}
.reading-grid .book-cover img {
	display: block;
	width: 100%;
	height: auto;
	object-fit: contain;
	/*
	 * Hairline edge on every cover. Drawn just outside the image, on the page background, so it shows on light covers too
	 * (inside, it vanished on white ones). Outlines take no space: masonry heights unchanged.
	 * 20%: at 10% the line was ~1.35:1 against #1D201F and disappeared beside black covers (The AGI Chronicles).
	 */
	outline: 1px solid rgb(255 255 255 / 0.2);
	outline-offset: 0;
}
.reading-grid .book-cover-placeholder {
	display: block;
	width: 100%;
	aspect-ratio: 2 / 3;
	background: var(--wp--preset--color--quaternary);
	border: 1px solid var(--wp--preset--color--tertiary);
	box-sizing: border-box;
}

/* Title and author take the theme's type presets (set on the blocks); only spacing here. */
.reading-grid .book-title,
.reading-grid .book-author {
	margin: 0;
}
/* Title and author sit flush: no gap between tile items. The cover's margin takes over the old
   gap (5px + 4.2px) so the cover-to-title spacing stays where it was. */
.reading-grid .wp-block-post-template > .wp-block-post {
	row-gap: 0;
}
.reading-grid .wp-block-post-template > .wp-block-post .book-cover {
	margin-bottom: 9px;
}
.reading-grid .book-title a {
	color: var(--wp--preset--color--foreground);
}
.reading-grid .book-author {
	color: var(--wp--preset--color--foreground);
	opacity: 0.6;
}

/* Reading: no underline on titles. The whole tile is the hover target; a "↗" fades in to say
   the link leaves the site (Goodreads). Opacity only, so nothing reflows. */
.reading-grid .book-title a,
.reading-grid .book-title a:hover {
	text-decoration: none;
}
.reading-grid .book-title a::after {
	content: "";
	opacity: 0;
	transition: opacity 150ms var(--ease-out-strong) 80ms;
}
@media (hover: hover) and (pointer: fine) {
	.reading-grid .wp-block-post:hover .book-title a::after {
		opacity: 1;
		transition-delay: 0ms;
	}
}
.reading-grid .wp-block-post:focus-within .book-title a::after {
	opacity: 1;
	transition-delay: 0ms;
}
@media (prefers-reduced-motion: reduce) {
	.reading-grid .book-title a::after {
		transition: none;
	}
}

/* Home: same hover as Reading, on the project names. Projects open case studies on this site,
   so the arrow is the site's own "⟶" (as in "More⟶"), not the outbound "↗". */
.home .wp-block-post-title a,
.home .wp-block-post-title a:hover {
	text-decoration: none;
}
.home .wp-block-post-title a::after {
	content: "";
	opacity: 0;
	transition: opacity 150ms var(--ease-out-strong) 80ms;
}
@media (hover: hover) and (pointer: fine) {
	.home .wp-block-post-template > .wp-block-post:hover .wp-block-post-title a::after {
		opacity: 1;
		transition-delay: 0ms;
	}
}
.home .wp-block-post-template > .wp-block-post:focus-within .wp-block-post-title a::after {
	opacity: 1;
	transition-delay: 0ms;
}
@media (prefers-reduced-motion: reduce) {
	.home .wp-block-post-title a::after {
		transition: none;
	}
}

/* "More" and any paragraph link with .arrow-link: the site's "⟶" fades in on hover/focus, no underline. */
.arrow-link a,
.arrow-link a:hover {
	text-decoration: none;
}
.arrow-link a::after {
	content: "";
	opacity: 0;
	transition: opacity 150ms ease-out;
}
@media (hover: hover) and (pointer: fine) {
	.arrow-link a:hover::after {
		opacity: 1;
	}
}
.arrow-link a:focus-visible::after {
	opacity: 1;
}
@media (prefers-reduced-motion: reduce) {
	.arrow-link a::after {
		transition: none;
	}
}

/* One arrow everywhere (book titles, project names, "More"): an up-right "↗" drawn as a mask,
   so its bottom edge sits exactly on the text baseline whatever the font, and it takes the link colour. */
.reading-grid .book-title a::after,
.home .wp-block-post-title a::after,
.arrow-link a::after {
	display: inline-block;
	width: 0.6em;
	height: 0.6em;
	margin-left: 0.3em;
	vertical-align: baseline;
	background-color: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M1.5 10.5 10.5 1.5M3.5 1.5h7v7' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M1.5 10.5 10.5 1.5M3.5 1.5h7v7' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* Section labels on the home page ("Projects selection 2006⟶2026"): quieter than the content they introduce. */
.section-label {
	opacity: 0.8;
}

/*
 * Client logos ("I had the chance to work with"), cycled like antonsten.com.
 * Four slots; the 12 logos stack three per slot (1-5-9, 2-6-10, 3-7-11, 4-8-12) and take turns:
 * 4s each, rising in from 20px below with a 6px blur and leaving 20px upward. Slots start 0.2s apart.
 * assets/logo-cycle.js adds .cycle-started when the wall is in view and .cycle-paused when it leaves.
 * The :not(#individual-image) selectors match WordPress's gallery rules, which carry an ID's weight.
 */
.wp-block-gallery.has-nested-images.logo-cycle {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 16px;
}
.wp-block-gallery.has-nested-images.logo-cycle figure.wp-block-image:not(#individual-image) {
	grid-row: 1;
	width: auto;
	margin: 0;
	opacity: 0;
}
/* Logos fill their slot (WordPress's gallery keeps them at max-width 100%); the files are 502px wide, 2x the usual size. */
.logo-cycle figure.wp-block-image:not(#individual-image) img {
	width: 100%;
	height: auto;
	margin-inline: auto;
}
.logo-cycle figure.wp-block-image:nth-child(4n+1):not(#individual-image) { grid-column: 1; }
.logo-cycle figure.wp-block-image:nth-child(4n+2):not(#individual-image) { grid-column: 2; --slot: 1; }
.logo-cycle figure.wp-block-image:nth-child(4n+3):not(#individual-image) { grid-column: 3; --slot: 2; }
.logo-cycle figure.wp-block-image:nth-child(4n+4):not(#individual-image) { grid-column: 4; --slot: 3; }
.logo-cycle figure.wp-block-image:nth-child(n+5):not(#individual-image) { --turn: 1; }
.logo-cycle figure.wp-block-image:nth-child(n+9):not(#individual-image) { --turn: 2; }

/* Phones: the four slots sit two by two, so each logo keeps a readable size. */
@media (max-width: 600px) {
	.wp-block-gallery.has-nested-images.logo-cycle {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
	.wp-block-gallery.has-nested-images.logo-cycle figure.wp-block-image:nth-child(4n+3):not(#individual-image) { grid-column: 1; grid-row: 2; }
	.wp-block-gallery.has-nested-images.logo-cycle figure.wp-block-image:nth-child(4n+4):not(#individual-image) { grid-column: 2; grid-row: 2; }
}

/* Before the wall is in view: the first logo of each slot, still. */
.wp-block-gallery.has-nested-images.logo-cycle figure.wp-block-image:nth-child(-n+4):not(#individual-image) {
	opacity: 1;
}

.wp-block-gallery.has-nested-images.logo-cycle.cycle-started figure.wp-block-image:not(#individual-image) {
	opacity: 0;
	filter: blur(6px);
	transform: translateY(20px);
	animation: logo-cycle-swap 12s infinite;
	animation-delay: calc(var(--turn, 0) * 4s + var(--slot, 0) * 0.2s);
}
.wp-block-gallery.has-nested-images.logo-cycle.cycle-paused figure.wp-block-image:not(#individual-image) {
	animation-play-state: paused;
}

/* One turn = a third of the 12s loop: 0.5s in, 3s held, 0.5s out. */
@keyframes logo-cycle-swap {
	0% { opacity: 0; filter: blur(6px); transform: translateY(20px); }
	4.1667%, 29.1667% { opacity: 1; filter: blur(0); transform: translateY(0); }
	33.3333%, 100% { opacity: 0; filter: blur(6px); transform: translateY(-20px); }
}

@media (prefers-reduced-motion: reduce) {
	.wp-block-gallery.has-nested-images.logo-cycle.cycle-started figure.wp-block-image:not(#individual-image) {
		animation: none;
		filter: none;
		transform: none;
	}
	.wp-block-gallery.has-nested-images.logo-cycle.cycle-started figure.wp-block-image:nth-child(-n+4):not(#individual-image) {
		opacity: 1;
	}
}

/*
 * Case studies and books: items below the fold fade up once as they scroll in (assets/scroll-reveal.js adds the classes).
 * Same 12px rise and curve as the page-load fade-up, a touch slower because it plays while reading.
 */
.reveal {
	opacity: 0;
	transform: translateY(12px);
	transition: opacity 600ms var(--ease-out-strong), transform 600ms var(--ease-out-strong);
}
/* Book tiles carry their own (hover) opacity transition; this outranks it while a book is revealing. */
.wp-block-post-template > .wp-block-post.reveal {
	transition: opacity 600ms var(--ease-out-strong), transform 600ms var(--ease-out-strong);
}
.reveal.is-revealed {
	opacity: 1;
	transform: none;
}
@media (prefers-reduced-motion: reduce) {
	.reveal { opacity: 1; transform: none; transition: none; }
}

/* Book authors: each full name stays in one piece ("Deborah Frances-White") and moves to the next line whole.
   Inline-block, not nowrap: a name wider than the column (phones) can still wrap instead of overflowing. */
.reading-grid .book-author .author-name {
	display: inline-block;
}

/* -------------------------------------------------------------------------- */
/*	Typography review (2026-11-23)
/* -------------------------------------------------------------------------- */

/* Inter ships every weight but no true italic: never let the browser fake a bold or a slanted roman. */
body {
	font-synthesis: none;
}

/* Headings break into even lines instead of stranding one word; the home intro avoids a lone last word. */
h1, h2, h3 {
	text-wrap: balance;
}
.home .appear-2 {
	text-wrap: pretty;
}

/* Pull quotes (32px): display size, so tighter leading than body text.
   p.poe-custom-quote: WordPress's own paragraph line-height prints after this file with equal weight. */
p.poe-custom-quote {
	line-height: 1.3;
	/* Hanging quote: the opening “ sits in the margin so the words align with the text column.
	   0.374em = the measured width of Inter's “ (12px at 32px). One method everywhere: Safari's
	   native hanging-punctuation would add to the indent and hang it twice. */
	text-indent: -0.374em;
	hanging-punctuation: none;
}

/* Case study titles (96px): extra-light 200 weight, tighter tracking than the other headings (-0.033em). */
.single-post main h1.wp-block-post-title {
	font-weight: 200;
	letter-spacing: -0.045em;
}
/* Phones: the title shrinks to ~66px, where 200 gets too thin; 300 keeps the strokes solid. */
@media (max-width: 600px) {
	.single-post main h1.wp-block-post-title {
		font-weight: 300;
	}
}

/* Case study footer arrows: the site's long arrow (as in "2006⟶2026") instead of Poe's short ← →.
   Drawn inside the link, so it dims, brightens and clicks together with the project title. */
.post-navigation-link-previous a::before { content: "⟵\00a0"; }
.post-navigation-link-next a::after { content: "\00a0⟶"; }
