/* Manuel Casimiro, website
   Fonts: Cormorant Garamond (titles, texts) and Jost (navigation, captions),
   both under the SIL Open Font License, served from /fonts (no Google request).
   Two background themes: light (default, :root) and dark (html.theme-dark, set by js/theme.js before the page is drawn),
   chosen with the two swatches at the bottom right of the footer. */

@font-face {
  font-family: "Cormorant Garamond";
  src: url("../fonts/cormorant-garamond-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Cormorant Garamond";
  src: url("../fonts/cormorant-garamond-latin-400-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "Cormorant Garamond";
  src: url("../fonts/cormorant-garamond-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Jost";
  src: url("../fonts/jost-latin-300-normal.woff2") format("woff2");
  font-weight: 300;
  font-display: swap;
}

@font-face {
  font-family: "Jost";
  src: url("../fonts/jost-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Jost";
  src: url("../fonts/jost-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #f6f4ef;
  --bg-soft: #efece6;
  --bg-card: #ffffff;
  --text: #1d1c1a;
  --muted: #74706a;
  --line: #dcd8d0;
  --oval: #0e0e0e;
  --serif: "Cormorant Garamond", Garamond, Georgia, serif;
  --sans: "Jost", "Helvetica Neue", Arial, sans-serif;
  --max: 1240px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

html.theme-dark {
  color-scheme: dark;
  --bg: #2e2e2d;
  --bg-soft: #363635;
  --bg-card: #3a3a39;
  --text: #ebe8e3;
  --muted: #a19d96;
  --line: #4a4946;
  --oval: #0e0e0e;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-weight: 300;
  font-size: 16px;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh; /* visible height on phones, where the address bar comes and goes */
  transition: background-color 0.5s var(--ease), color 0.5s var(--ease);
}

main {
  flex: 1;
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 8px 32px 80px;
  animation: page-in 0.6s var(--ease) both;
}

@keyframes page-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Smooth fade between pages in browsers that support it (Chrome, Edge, Safari 18) */
@view-transition {
  navigation: auto;
}

a {
  color: inherit;
}

a:focus-visible,
button:focus-visible {
  outline: 1px solid var(--muted);
  outline-offset: 4px;
}

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

button {
  font-family: inherit;
  color: inherit; /* Safari on iPhone shows buttons in system blue otherwise */
}

.skip-link {
  position: absolute;
  left: -9999px;
}

.skip-link:focus {
  left: 16px;
  top: 16px;
  background: var(--bg-card);
  padding: 8px 12px;
  z-index: 50;
}

/* Underline that grows from the left on hover */
.link-line {
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0% 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  padding-bottom: 2px;
  transition: background-size 0.4s var(--ease), color 0.3s var(--ease);
}

.link-line:hover,
.link-line:focus-visible,
.link-line[aria-current="page"] {
  background-size: 100% 1px;
}

/* ---------- Top bar: music player and languages ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: var(--max);
  width: 100%;
  margin: 0 auto;
  padding: 14px 32px 0;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  min-height: 44px;
}

.player {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.player[hidden] {
  display: none;
}

.player-toggle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--muted);
  background: none;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: border-color 0.3s var(--ease), transform 0.3s var(--ease);
}

.player-toggle:hover {
  border-color: var(--text);
  transform: scale(1.06);
}

/* Play triangle, turned into a pause sign when playing */
.player-icon {
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 5px 0 5px 8px;
  border-color: transparent transparent transparent currentColor;
  margin-left: 2px;
}

.player.is-playing .player-icon {
  width: 8px;
  height: 10px;
  border-width: 0 3px;
  border-color: currentColor;
  margin-left: 0;
}

.player-tracks {
  display: flex;
  gap: 2px;
}

.player-tracks button {
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 0.75rem;
  padding: 4px 6px;
  cursor: pointer;
  transition: color 0.3s var(--ease);
}

.player-tracks button:hover,
.player-tracks button[aria-pressed="true"] {
  color: var(--text);
}

.player-tracks button[aria-pressed="true"] {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.player-title {
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 340px;
  text-transform: uppercase;
}

/* Three small bars that move while music plays */
.player-bars {
  display: none;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
}

.player.is-playing .player-bars {
  display: flex;
}

.player-bars i {
  width: 2px;
  height: 100%;
  background: var(--muted);
  animation: bar 1s ease-in-out infinite;
}

.player-bars i:nth-child(2) {
  animation-delay: -0.35s;
}

.player-bars i:nth-child(3) {
  animation-delay: -0.7s;
}

@keyframes bar {
  0%, 100% { transform: scaleY(0.3); }
  50% { transform: scaleY(1); }
}

.player-bars i {
  transform-origin: bottom;
}

/* Language menu: a button with a globe, and a small panel that unfolds below it */
.lang-menu {
  position: relative;
  margin-left: auto;
  z-index: 30;
}

.lang-button {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  padding: 5px 12px;
  cursor: pointer;
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease);
}

.lang-button:hover,
.lang-menu.is-open .lang-button {
  color: var(--text);
  border-color: var(--line);
}

.lang-chevron {
  width: 5px;
  height: 5px;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform 0.3s var(--ease);
}

.lang-menu.is-open .lang-chevron {
  transform: translateY(1px) rotate(-135deg);
}

.lang-list {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 160px;
  list-style: none;
  margin: 0;
  padding: 6px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.25);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease), visibility 0s linear 0.25s;
}

.lang-menu.is-open .lang-list {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
}

.lang-list button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: none;
  border: 0;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 1.05rem;
  text-align: left;
  padding: 8px 12px;
  cursor: pointer;
  transition: color 0.2s var(--ease), background-color 0.2s var(--ease);
}

.lang-list button:hover,
.lang-list button:focus-visible {
  color: var(--text);
  background: var(--bg-soft);
  outline: none;
}

/* The current language is marked with the small oval */
.lang-list button::before {
  content: "";
  flex-shrink: 0;
  width: 6px;
  height: 8px;
  border-radius: 50%;
  background: transparent;
}

.lang-list button[aria-current="true"] {
  color: var(--text);
}

.lang-list button[aria-current="true"]::before {
  background: var(--text);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Header ---------- */

.site-header {
  display: flex;
  align-items: center;
  gap: 16px 40px;
  max-width: var(--max);
  width: 100%;
  margin: 0 auto;
  padding: 18px 32px 26px;
}

.brand {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.75rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-right: auto;
}

/* The oval, the artist's recurring sign, as a small mark before his name */
.brand::before {
  content: "";
  width: 13px;
  height: 18px;
  border-radius: 50%;
  background: var(--oval);
  box-shadow: 0 0 0 1px var(--muted);
  transition: transform 0.6s var(--ease);
}

.brand:hover::before {
  transform: rotate(-20deg) scale(1.15);
}

.main-nav {
  display: flex;
  gap: 32px;
}

.main-nav a {
  font-size: 0.82rem;
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.main-nav a:hover,
.main-nav a[aria-current="page"] {
  color: var(--text);
}

.menu-toggle {
  display: none;
}

/* ---------- Common ---------- */

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 32px;
  border-top: 1px solid var(--line);
  margin-bottom: 40px;
}

.page-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 2.8rem;
  line-height: 1.15;
  letter-spacing: 0.02em;
  margin: 32px 0 0;
}

.loading,
.muted {
  color: var(--muted);
}

/* Images fade in once loaded (class added by main.js) */
.fade-img {
  opacity: 0;
  transition: opacity 0.8s var(--ease), transform 0.6s var(--ease);
}

.fade-img.is-loaded {
  opacity: 1;
}

/* ---------- Home: central image and works in an oval around it ---------- */

.home {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.orbit {
  position: relative;
  width: 100%;
  max-width: 1100px;
  height: min(68vh, 640px);
  min-height: 500px;
}

.orbit-center {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(290px, 40vw, 44vh);
  transform: translate(-50%, -50%);
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  z-index: 2;
  transition: transform 0.8s var(--ease);
  will-change: transform;
}

.orbit-center img {
  width: 100%;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

.orbit.is-open .orbit-center {
  transform: translate(-50%, -50%) scale(0.9);
}

.orbit-items {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Each work keeps its own rectangular shape. It starts hidden behind the central image,
   then moves to its place on the oval path (--w, --h, --tx, --ty are set by main.js). */
.orbit-item {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--w, 80px);
  height: var(--h, 80px);
  margin-left: calc(var(--w, 80px) / -2);
  margin-top: calc(var(--h, 80px) / -2);
  opacity: 0;
  transform: translate(0, 0) scale(0.3);
  transition: transform 0.9s var(--ease), opacity 0.6s var(--ease);
  transition-delay: var(--delay, 0s);
  pointer-events: none;
  will-change: transform, opacity;
  backface-visibility: hidden;
}

.orbit.is-open .orbit-item {
  opacity: 1;
  transform: translate(var(--tx), var(--ty)) scale(1);
  pointer-events: auto;
}

.orbit-item:hover,
.orbit-item:focus-within {
  z-index: 3;
}

.orbit-item a {
  display: block;
  width: 100%;
  height: 100%;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.28);
  transition: transform 0.35s var(--ease);
}

.orbit-item a:hover,
.orbit-item a:focus-visible {
  transform: scale(1.35);
}

.orbit-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Below the oval: a hint first, then the title of the series under the mouse */
.orbit-label {
  margin: 12px 0 0;
  min-height: 2.2em;
  font-family: var(--serif);
  font-size: 1.45rem;
  font-style: italic;
  color: var(--text);
  transition: opacity 0.3s var(--ease);
}

.orbit-label.is-hint {
  font-family: var(--sans);
  font-style: normal;
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  padding-top: 0.6em;
}

.home-tagline {
  font-family: var(--serif);
  font-size: 1.45rem;
  color: var(--muted);
  margin: 4px 0 14px;
}

.home-link {
  font-size: 0.82rem;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  background-size: 100% 1px;
}

.home-link:hover {
  background-size: 0% 1px;
  background-position: 100% 100%;
}

/* ---------- Obra: grid of series ---------- */

.section-jump {
  display: flex;
  gap: 24px;
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.section-jump a:hover {
  color: var(--text);
}

.section-block {
  margin-bottom: 72px;
  scroll-margin-top: 24px;
}

.section-title {
  font-family: var(--sans);
  font-weight: 400;
  font-size: 0.8rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0 0 28px;
}

/* Thin line that fills the rest of the row after the section name */
.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.series-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 44px 28px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.series-card a {
  text-decoration: none;
  display: block;
}

.series-card {
  scroll-margin-top: 40px;
}

/* Coming back from a series: its card is outlined briefly */
.series-card.is-target .series-cover {
  animation: glow 1.8s var(--ease);
}

@keyframes glow {
  0%, 40% {
    box-shadow: 0 0 0 1px var(--text);
  }
  100% {
    box-shadow: 0 0 0 1px transparent;
  }
}

.series-cover {
  --pad: 16px;
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--bg-soft);
  padding: var(--pad);
  overflow: hidden;
  transition: background-color 0.5s var(--ease);
}

/* Safari does not resolve max-height: 100% inside a box sized by aspect-ratio
   (the image kept its natural size and was cropped). The image now fills the box
   minus the padding, and object-fit keeps the whole work visible. */
.series-cover img,
.work-button img,
.result-image img {
  position: absolute;
  top: var(--pad);
  left: var(--pad);
  width: calc(100% - 2 * var(--pad));
  height: calc(100% - 2 * var(--pad));
  max-width: none;
  object-fit: contain;
}

.series-card a:hover .series-cover {
  background: var(--bg-card);
}

.series-card a:hover .series-cover img.is-loaded {
  transform: scale(1.04);
}

.series-name {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.2rem;
  letter-spacing: 0.01em;
  line-height: 1.25;
  margin: 14px 0 4px;
  display: flex;
  align-items: baseline;
  gap: 0;
  transition: gap 0.4s var(--ease);
}

/* A small oval appears before the name on hover */
.series-name::before {
  content: "";
  flex-shrink: 0;
  width: 0;
  height: 11px;
  border-radius: 50%;
  background: var(--text);
  transform: translateY(1px);
  transition: width 0.4s var(--ease);
}

.series-card a:hover .series-name {
  gap: 10px;
}

.series-card a:hover .series-name::before {
  width: 8px;
}

.series-count {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0;
}

/* ---------- Serie: works of one series ---------- */

.breadcrumb {
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 32px 0 0;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin: 28px 0 12px;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.3s var(--ease);
}

.back-link::before {
  content: "";
  width: 8px;
  height: 8px;
  border-left: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.3s var(--ease);
}

.back-link:hover {
  color: var(--text);
}

.back-link:hover::before {
  transform: translateX(-4px) rotate(45deg);
}

.back-link small {
  font-size: inherit;
  opacity: 0.7;
}

.serie-head {
  border-top: 1px solid var(--line);
  margin-bottom: 40px;
}

.serie-head-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 32px;
}

.series-select {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.series-select select {
  font: inherit;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--text);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 8px 34px 8px 12px;
  max-width: 320px;
  cursor: pointer;
  /* Same look in every browser: the native menu is replaced by a small drawn arrow */
  -webkit-appearance: none;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}

.serie-head .page-title {
  margin-top: 12px;
}

.serie-count {
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  margin: 8px 0 0;
}

.works-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 28px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.work-button {
  --pad: 20px;
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--bg-soft);
  border: 0;
  padding: var(--pad);
  cursor: zoom-in;
  overflow: hidden;
  transition: background-color 0.5s var(--ease);
}

.work-button:hover {
  background: var(--bg-card);
}

.work-button:hover img.is-loaded {
  transform: scale(1.03);
}

.work-caption {
  font-family: var(--serif);
  font-size: 1.02rem;
  line-height: 1.4;
  color: var(--muted);
  margin: 10px 2px 0;
}

.series-nav {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-top: 72px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.series-nav a {
  text-decoration: none;
  color: var(--muted);
  max-width: 46%;
  transition: color 0.3s var(--ease);
}

.series-nav small {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.series-nav span {
  font-family: var(--serif);
  font-size: 1.25rem;
  color: var(--text);
}

.series-nav a:hover {
  color: var(--text);
}

.series-nav .next {
  text-align: right;
  margin-left: auto;
}

/* ---------- Lightbox ---------- */

.lightbox {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: 100vw;
  max-height: 100vh;
  width: 100vw;
  height: 100vh;
  /* Safari on iPhone counts 100vh without its toolbar: dvh is the height really visible */
  max-height: 100dvh;
  height: 100dvh;
  overflow: hidden;
}

.lightbox::backdrop {
  background: rgba(12, 12, 12, 0.94);
}

.lightbox[open] {
  display: flex;
  align-items: center;
  justify-content: center;
  animation: lb-in 0.35s var(--ease);
}

@keyframes lb-in {
  from {
    opacity: 0;
  }
}

.lightbox figure {
  margin: 0;
  text-align: center;
}

.lightbox img {
  max-width: 84vw;
  max-height: 80vh;
  width: auto;
  margin: 0 auto;
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
}

.lightbox img.is-changing {
  opacity: 0;
  transform: scale(0.98);
}

.lightbox figcaption {
  max-width: 84vw;
  margin: 16px auto 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.lb-text {
  font-family: var(--serif);
  font-size: 1.1rem;
  line-height: 1.4;
  color: #e6e3de;
  max-width: 720px;
}

.lb-meta {
  display: flex;
  align-items: center;
  gap: 18px;
  font-family: var(--sans);
  color: #a9a59f;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* Small text button (not one of the fixed round buttons of the lightbox) */
.lightbox .lb-copy {
  position: static;
  width: auto;
  height: auto;
  border: 1px solid #5a5853;
  border-radius: 999px;
  color: #d8d5cf;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 4px 12px;
  opacity: 1;
}

.lightbox .lb-copy:hover {
  border-color: #d8d5cf;
  transform: none;
}

.lightbox .lb-copy.is-done {
  border-color: #d8d5cf;
  color: #ffffff;
}

.lightbox button {
  position: fixed;
  width: 48px;
  height: 48px;
  background: none;
  border: 0;
  cursor: pointer;
  opacity: 0.75;
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
}

.lightbox button:hover {
  opacity: 1;
}

.lightbox button:focus-visible {
  outline: 1px solid #8a8780;
  outline-offset: -4px;
  border-radius: 50%;
}

.lightbox:focus {
  outline: none;
}

/* Arrows and cross drawn in CSS (thin lines, same style as the rest) */
.lb-prev::before,
.lb-next::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 16px;
  height: 16px;
  border-left: 1px solid #e6e3de;
  border-bottom: 1px solid #e6e3de;
}

.lb-prev::before {
  transform: translate(-30%, -50%) rotate(45deg);
}

.lb-next::before {
  transform: translate(-70%, -50%) rotate(-135deg);
}

.lb-close::before,
.lb-close::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 22px;
  height: 1px;
  background: #e6e3de;
}

.lb-close::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.lb-close::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.lb-close {
  top: 16px;
  right: 16px;
}

.lb-close:hover {
  transform: rotate(90deg);
}

.lb-prev {
  left: 16px;
  top: 50%;
  margin-top: -24px;
}

.lb-prev:hover {
  transform: translateX(-4px);
}

.lb-next {
  right: 16px;
  top: 50%;
  margin-top: -24px;
}

.lb-next:hover {
  transform: translateX(4px);
}

/* ---------- Search (Obra page) ---------- */

.search {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin: -12px 0 12px;
}

.search-field {
  position: relative;
}

/* Magnifying glass drawn in CSS */
.search-field::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 50%;
  width: 11px;
  height: 11px;
  border: 1px solid var(--muted);
  border-radius: 50%;
  transform: translateY(-62%);
}

.search-field::after {
  content: "";
  position: absolute;
  left: 12px;
  top: 50%;
  width: 6px;
  height: 1px;
  background: var(--muted);
  transform: translateY(4px) rotate(45deg);
}

.search-field input {
  width: 100%;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  font-family: var(--serif);
  font-size: 1.25rem;
  padding: 10px 4px 10px 26px;
  border-radius: 0;
  -webkit-appearance: none; /* Safari draws its own rounded search field otherwise */
  appearance: none;
  transition: border-color 0.3s var(--ease);
}

/* The browser's own clear cross is hidden: the « Limpar » button does the same */
.search-field input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

.search-field input::placeholder {
  color: var(--muted);
  opacity: 0.8;
}

.search-field input:focus {
  outline: none;
  border-bottom-color: var(--text);
}

/* Filters: rows of rounded buttons, the active one is filled */
.search-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 36px;
}

.search-filter {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  font: inherit;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: none;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 15px;
  cursor: pointer;
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease), background-color 0.3s var(--ease);
}

.chip:hover {
  color: var(--text);
  border-color: var(--muted);
}

.chip[aria-pressed="true"] {
  color: var(--bg);
  background: var(--text);
  border-color: var(--text);
}

.chip:focus-visible {
  outline: 1px solid var(--text);
  outline-offset: 3px;
}

/* Suggestions under the search field */
.search-suggest {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 20;
  list-style: none;
  margin: 0;
  padding: 6px 0;
  max-height: min(60vh, 420px);
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 14px 36px rgba(40, 36, 30, 0.12);
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
}

html.theme-dark .search-suggest {
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.28);
}

.search-suggest.is-open {
  opacity: 1;
  transform: none;
}

.search-suggest[hidden] {
  display: none;
}

.suggest-group {
  padding: 10px 18px 4px;
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.suggest-option {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 18px;
  font-family: var(--serif);
  font-size: 1.1rem;
  line-height: 1.3;
  color: var(--text);
  cursor: pointer;
  transition: background-color 0.15s var(--ease);
}

.suggest-option:hover,
.suggest-option[aria-selected="true"] {
  background: var(--bg-soft);
}

.suggest-option mark {
  background: none;
  color: inherit;
  font-weight: 500;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.suggest-count {
  flex: none;
  font-family: var(--sans);
  font-size: 0.72rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 8px;
}

.search-reset {
  margin-left: auto;
  background: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 8px 14px;
  cursor: pointer;
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease);
}

.search-reset:hover {
  color: var(--text);
  border-color: var(--text);
}

.search-reset[hidden] {
  display: none;
}

.search-count {
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  color: var(--muted);
  min-height: 1.4em;
  margin: 0 0 24px;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 36px 24px;
  list-style: none;
  margin: 0 0 40px;
  padding: 0;
}

.results-grid[hidden] {
  display: none;
}

.result a {
  display: block;
  text-decoration: none;
}

.result-image {
  --pad: 14px;
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--bg-soft);
  padding: var(--pad);
  transition: background-color 0.4s var(--ease);
}

.result a:hover .result-image {
  background: var(--bg-card);
}

.result-caption {
  font-family: var(--serif);
  font-size: 1rem;
  line-height: 1.35;
  margin: 10px 0 4px;
}

.result-series {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}

/* ---------- Exhibitions ---------- */

.expo-block {
  margin-bottom: 56px;
}

.expo-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.expo-row {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 24px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
  transition: background-color 0.3s var(--ease);
}

.expo-row:hover {
  background: var(--bg-soft);
}

.expo-year {
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding-top: 4px;
  padding-left: 4px;
}

.expo-title {
  font-family: var(--serif);
  font-size: 1.45rem;
  font-style: italic;
  line-height: 1.25;
  margin: 0;
}

.expo-place {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 4px 0 0;
}

.expo-source {
  max-width: 720px;
  font-family: var(--serif);
  font-size: 1.1rem;
  color: var(--muted);
}

/* Timeline: year on the left, vertical line, dot, card on the right */

.timeline-wrap {
  position: relative;
  margin: 0 0 56px;
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}

/* Light line drawn over the grey one, it grows as the page scrolls */
.timeline-progress {
  position: absolute;
  top: 8px;
  left: 150px;
  width: 1px;
  height: calc(100% - 16px);
  background: var(--text);
  transform-origin: top;
  transform: scaleY(var(--progress, 0));
  transition: transform 0.25s linear;
  pointer-events: none;
}

.timeline::before {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 150px;
  width: 1px;
  background: var(--line);
}

.timeline-item {
  display: grid;
  grid-template-columns: 130px 40px minmax(0, 1fr);
  align-items: start;
  padding: 14px 0;
  position: relative;
}

.timeline-year {
  text-align: right;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding-top: 10px;
}

.timeline-dot {
  justify-self: center;
  margin-top: 15px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--muted);
  position: relative;
  z-index: 1;
  transition: background-color 0.3s var(--ease), border-color 0.4s var(--ease), transform 0.3s var(--ease);
}

.timeline-item.is-passed .timeline-dot {
  border-color: var(--text);
}

.timeline-solo .timeline-dot {
  background: var(--text);
  border-color: var(--text);
}

.timeline-card {
  padding: 8px 14px 10px;
  border-radius: 2px;
  transition: background-color 0.3s var(--ease);
}

.timeline-item:hover .timeline-card {
  background: var(--bg-soft);
}

.timeline-item:hover .timeline-dot {
  transform: scale(1.5);
}

.timeline-tag {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 2px;
}

.timeline.is-animated .timeline-item {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}

.timeline.is-animated .timeline-item.is-visible {
  opacity: 1;
  transform: none;
}

@media (max-width: 680px) {
  .timeline::before,
  .timeline-progress {
    left: 5px;
  }

  .search-filters {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }

  .search-filter {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .chip {
    padding: 6px 11px;
  }

  .search-reset {
    margin-left: 0;
    align-self: flex-start;
  }

  .timeline-item {
    grid-template-columns: 11px minmax(0, 1fr);
    column-gap: 14px;
  }

  .timeline-dot {
    grid-column: 1;
    grid-row: 1 / span 2;
    margin-top: 11px;
  }

  .timeline-year {
    grid-column: 2;
    grid-row: 1;
    text-align: left;
    padding-top: 4px;
  }

  .timeline-card {
    grid-column: 2;
    grid-row: 2;
    padding: 2px 0 0;
  }

  .timeline-item:hover .timeline-card {
    background: none;
  }
}

/* ---------- Biography and contact: image on the left, text on the right ---------- */

.split {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 64px;
  align-items: start;
  border-top: 1px solid var(--line);
  padding-top: 32px;
}

.split-image {
  position: sticky;
  top: 32px;
  margin: 0;
  background: var(--bg-soft);
  padding: 24px;
}

.split-image img {
  margin: 0 auto;
}

.split .page-title {
  margin-top: 0;
  margin-bottom: 28px;
}

.text-page {
  max-width: 680px;
}

.text-page p {
  margin: 0 0 1.2em;
}

.text-page h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.5rem;
  margin: 2em 0 0.5em;
}

.bio-text p {
  font-family: var(--serif);
  font-size: 1.25rem;
  line-height: 1.7;
}

/* First paragraph slightly larger, with a drop capital */
.bio-text p:first-child {
  font-size: 1.45rem;
  line-height: 1.6;
}

.bio-text p:first-child::first-letter {
  float: left;
  font-size: 4.2em;
  line-height: 0.8;
  padding: 0.08em 0.1em 0 0;
}

.contact-intro {
  font-family: var(--serif);
  font-size: 1.35rem;
  color: var(--muted);
}

.email {
  font-family: var(--serif);
  font-size: clamp(1.6rem, 3.4vw, 2.4rem);
  background-size: 100% 1px;
}

.email:hover {
  background-size: 0% 1px;
  background-position: 100% 100%;
}

.split-contact {
  align-items: center;
}

/* ---------- 404 ---------- */

.not-found {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 80px 0;
  gap: 24px;
}

.big-oval {
  width: 110px;
  height: 150px;
  border-radius: 50%;
  background: var(--oval);
  box-shadow: 0 0 0 1px var(--muted);
}

/* ---------- Footer ---------- */

.site-footer {
  max-width: var(--max);
  width: 100%;
  margin: 0 auto;
  padding: 24px 32px 84px; /* room for the back-to-top button, so it never covers the swatches */
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 32px;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.site-footer p {
  margin: 0;
}

.site-footer a:hover {
  color: var(--text);
}

.theme-switch {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.swatch {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid var(--muted);
  padding: 0;
  cursor: pointer;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.swatch:hover {
  transform: scale(1.15);
}

.swatch[aria-pressed="true"] {
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--text);
}

.swatch-dark {
  background: #2e2e2d;
}

.swatch-light {
  background: #f6f4ef;
}

/* ---------- Back to top ---------- */

.to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--bg-card);
  cursor: pointer;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.4s var(--ease), transform 0.4s var(--ease), border-color 0.3s var(--ease);
  z-index: 20;
}

.to-top::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 10px;
  border-left: 1px solid var(--text);
  border-top: 1px solid var(--text);
  transform: translate(-50%, -25%) rotate(45deg);
}

.to-top.is-visible {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.to-top:hover {
  border-color: var(--text);
  transform: translateY(-3px);
}

/* ---------- Tablets and phones ---------- */

/* Design and Livros have one series each: shown side by side, as wide cards */
.section-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px;
}

.section-pair .section-block {
  margin-bottom: 72px;
}

.series-wide a {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 24px;
  align-items: end;
}

.series-wide .series-name {
  font-size: 1.5rem;
  margin-top: 0;
}

/* The first series of a grid gets a double-width card */
.series-grid > .series-card:first-child {
  grid-column: span 2;
}

.series-grid > .series-card:first-child .series-cover {
  aspect-ratio: 8 / 3;
}

.series-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

@media (max-width: 900px) {
  .section-pair {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .series-wide a {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .split {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .split-image {
    position: static;
    max-width: 520px;
  }
}

@media (max-width: 680px) {
  .topbar {
    padding: 10px 16px 0;
  }

  .player-title {
    display: none;
  }

  .site-header {
    flex-wrap: wrap;
    gap: 12px 16px;
    padding: 14px 16px 18px;
  }

  .brand {
    font-size: 1.15rem;
    letter-spacing: 0.14em;
    gap: 10px;
  }

  .menu-toggle {
    display: block;
    background: none;
    border: 1px solid var(--line);
    color: var(--text);
    font-size: 0.72rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    padding: 6px 12px;
    cursor: pointer;
  }

  .main-nav {
    width: 100%;
    flex-direction: column;
    gap: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s var(--ease);
  }

  .main-nav.is-open {
    max-height: 260px;
  }

  .main-nav a {
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
    background-image: none;
  }

  main {
    padding: 4px 16px 64px;
  }

  .page-title {
    font-size: 2.1rem;
  }

  .orbit {
    height: 600px;
    min-height: 0;
  }

  .orbit-center {
    width: 52vw;
  }

  .works-grid {
    grid-template-columns: 1fr;
  }

  .results-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px 14px;
  }

  .search-filter {
    flex: 1 1 40%;
  }

  .search-field input {
    font-size: 1.05rem;
  }

  .search-filter select {
    min-width: 0;
    width: 100%;
  }

  .expo-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .expo-title {
    font-size: 1.25rem;
  }

  .series-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 28px 14px;
  }

  .series-cover {
    --pad: 10px;
  }

  .series-name {
    font-size: 1.02rem;
  }

  .bio-text p {
    font-size: 1.15rem;
  }

  .bio-text p:first-child {
    font-size: 1.28rem;
  }

  .site-footer {
    padding: 20px 16px 80px;
  }

  .theme-switch {
    margin-left: 0;
  }


  .to-top {
    right: 16px;
    bottom: 16px;
  }
}

/* People who ask their system for less motion get no animation */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }

  @view-transition {
    navigation: none;
  }
}

/* A section hidden by the Section filter on the Obra page */
.section-block[hidden],
.section-pair[hidden] {
  display: none;
}

/* Design or Livros shown alone: the remaining section takes the full width */
.section-pair:has(> .section-block[hidden]) {
  grid-template-columns: 1fr;
}
