:root {
  --bg: #ffffff;
  --ink: #121212;
  --muted: #454545;
  --accent: #9c7071;
  /* Wells-like frame: outer margin + gutter menu→galerie */
  --canvas-pad: 56px;
  --sidebar-w: 170px;
  --sidebar-gap: 60px;
  --gallery-pad: 0px;
  --thumb-w: 300px;
  --serif: "Sorts Mill Goudy", "Iowan Old Style", Palatino, Georgia, serif;
  --sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --display: "Gambarino", "Iowan Old Style", Palatino, Georgia, serif;
  --ease-soft: cubic-bezier(0.22, 1, 0.36, 1);
  --dur-fast: 220ms;
  --dur-med: 480ms;
  --dur-page: 450ms;
}

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

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

body {
  margin: 0;
  min-height: 100%;
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.4;
  color: var(--ink);
  background: var(--bg);
}

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

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease-soft), opacity var(--dur-fast) var(--ease-soft);
}

button {
  font: inherit;
  color: inherit;
}

/* Soft page enter / leave (Fanny-like fade) — requires html.js */
@media (prefers-reduced-motion: reduce) {
  :root {
    --dur-fast: 0ms;
    --dur-med: 0ms;
    --dur-page: 0ms;
  }

  .site-canvas,
  .wells-slide,
  .wells-stage,
  .wells-thumbs,
  .wells-thumb img,
  .home-hero-image {
    transition: none !important;
  }
}

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

/* —— Wells layout: same top edge for menu + gallery (sticky, shared canvas) —— */
.site-canvas {
  display: flex;
  align-items: flex-start;
  gap: var(--sidebar-gap);
  padding: var(--canvas-pad);
  min-height: 100vh;
  box-sizing: border-box;
}

html.js .site-canvas {
  opacity: 0;
  transition: opacity var(--dur-page) var(--ease-soft);
}

html.js.is-ready .site-canvas {
  opacity: 1;
}

html.js.is-leaving .site-canvas {
  opacity: 0;
  pointer-events: none;
}

.site-sidebar {
  position: sticky;
  top: var(--canvas-pad);
  flex: 0 0 var(--sidebar-w);
  width: var(--sidebar-w);
  height: calc(100vh - (var(--canvas-pad) * 2));
  max-height: calc(100vh - (var(--canvas-pad) * 2));
  z-index: 20;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 1rem;
  align-self: flex-start;
  overflow: hidden;
}

.sidebar-top {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 0 0 auto;
  min-height: 0;
}

.site-brand .site-title,
.site-brand .custom-logo-link {
  display: block;
  font-family: var(--display);
  font-size: 15px;
  font-weight: 400;
  letter-spacing: 0.04em;
  line-height: 1.15;
  text-transform: none;
  word-break: break-word;
}

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

.site-nav .nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.site-nav a {
  display: block;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.02em;
  line-height: 1.15;
  padding: 0.1em 0;
  word-break: break-word;
  transition: color var(--dur-fast) var(--ease-soft);
}

.site-nav a:hover {
  color: var(--muted);
}

.site-nav .current-menu-item > a,
.site-nav .current_page_item > a,
.site-nav .current-menu-ancestor > a {
  color: var(--accent);
}

/* Section title (ex. Books) — gap after series, editable via menu CSS class "menu-section" */
.site-nav .menu-section,
.site-nav .menu-gap {
  margin-top: 1.35em;
  padding-top: 0.15em;
}

.site-nav .menu-section > a {
  pointer-events: none;
  cursor: default;
  color: var(--ink);
  font-weight: 600;
}

.site-nav .menu-section > a:hover {
  color: var(--ink);
  opacity: 1;
}

.site-nav .sub-menu {
  list-style: none;
  margin: 0.15em 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

/* Gallery controls — bottom of sidebar (Wells .meta) */
.sidebar-gallery-meta {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  margin-top: auto;
  padding-top: 0.25rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
}

.sidebar-project-desc {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 400;
  font-style: normal;
  line-height: 1.35;
  letter-spacing: 0.02em;
  color: #4a4a4a;
  margin: 0 0 12px;
  word-break: break-word;
  flex: 0 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.25) transparent;
}

.sidebar-project-desc::-webkit-scrollbar {
  width: 3px;
}

.sidebar-project-desc::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 2px;
}

.sidebar-project-desc p {
  margin: 0 0 0.55em;
  padding: 0;
}

.sidebar-project-desc p:last-child {
  margin-bottom: 0;
}

.wells-simple-controls {
  display: block;
  flex: 0 0 auto;
  margin-top: 25px;
  font-family: var(--serif);
  font-size: 10px;
  letter-spacing: 0.02em;
  line-height: 1.3;
  text-transform: lowercase;
  color: #0d0d0d;
}

.wells-simple-controls button {
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  font: inherit;
  color: #222;
  text-transform: lowercase;
}

.wells-simple-controls button:hover {
  opacity: 0.55;
}

.wells-sep {
  color: #0d0d0d;
}

.wells-thumbs-toggle {
  display: block;
  flex: 0 0 auto;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  font-family: var(--serif);
  font-size: 10px;
  letter-spacing: 0.02em;
  line-height: 1.3;
  text-transform: lowercase;
  text-align: left;
  color: #0d0d0d;
}

.wells-thumbs-toggle:hover {
  opacity: 0.55;
}

body.is-thumbs-mode .wells-simple-controls,
body.is-thumbs-mode .wells-thumbs-toggle {
  visibility: hidden;
  pointer-events: none;
}

/* —— Main content — same top as sidebar (flex row), gutter via gap —— */
.site-main {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding: 0;
  min-height: calc(100vh - (var(--canvas-pad) * 2));
  box-sizing: border-box;
}

.nav-toggle {
  display: none;
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 30;
  width: 2.25rem;
  height: 2.25rem;
  border: 0;
  background: transparent;
  padding: 0.4rem;
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  height: 1px;
  margin: 5px 0;
  background: var(--ink);
}

/* Home */
.home-hero {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - (var(--canvas-pad) * 2));
}

.home-hero-link {
  display: block;
  max-width: min(900px, 100%);
}

.home-hero-image {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
}

html.js .home-hero-image {
  opacity: 0;
  transform: translateY(6px);
  transition:
    opacity calc(var(--dur-med) + 80ms) var(--ease-soft),
    transform calc(var(--dur-med) + 80ms) var(--ease-soft);
}

html.js.is-ready .home-hero-image {
  opacity: 1;
  transform: translateY(0);
}

/* Info / pages */
.page-content {
  max-width: 56rem;
  width: 100%;
  padding-top: 0;
}

.page-header {
  margin: 0 0 1.25rem;
}

.page-title {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: none;
  margin: 0;
  color: var(--ink);
}

.entry-content {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 400;
  line-height: 1.45;
  letter-spacing: 0.02em;
  color: #4a4a4a;
}

.entry-content h1,
.entry-content h2,
.entry-content h3,
.entry-content h4 {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.3;
  color: var(--ink);
  margin: 0 0 0.65em;
}

.entry-content h2 {
  margin-top: 0.25em;
}

.entry-content p {
  margin: 0 0 0.85em;
}

.entry-content a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.entry-content hr,
.entry-content .wp-block-separator {
  border: 0;
  border-top: 1px solid #ddd;
  margin: 1.25em 0;
}

.entry-content .wp-block-columns {
  display: flex;
  flex-wrap: wrap;
  gap: 3.5rem;
  margin: 0;
}

.entry-content .wp-block-column {
  flex: 1 1 0;
  min-width: min(100%, 16rem);
  margin: 0;
}

@media (max-width: 900px) {
  .entry-content .wp-block-columns {
    flex-direction: column;
    gap: 2rem;
  }
}

/* —— Gallery Fit stage —— */
.project-single {
  min-height: calc(100vh - (var(--canvas-pad) * 2));
}

.wells-gallery {
  position: relative;
  width: 100%;
  min-height: calc(100vh - (var(--canvas-pad) * 2));
  display: flex;
  flex-direction: column;
}

.wells-stage {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - (var(--canvas-pad) * 2));
  margin: 0;
  user-select: none;
  opacity: 1;
  transition: opacity var(--dur-med) var(--ease-soft);
}

.wells-gallery.is-stage-enter .wells-stage,
.wells-gallery.is-stage-enter .wells-slide.is-active {
  opacity: 0;
  transition: none;
}

.wells-gallery.is-thumbs-mode .wells-stage {
  /* Keep viewport-sized at the top — never stretch over the full thumbs grid */
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: calc(100vh - (var(--canvas-pad) * 2));
  min-height: calc(100vh - (var(--canvas-pad) * 2));
  inset: auto;
  opacity: 0;
  pointer-events: none;
  z-index: 2;
}

.wells-gallery.is-thumbs-mode:not(.is-thumbs-visible) .wells-stage {
  opacity: 1;
}

.wells-slide {
  position: absolute;
  inset: 0;
  margin: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity var(--dur-med) var(--ease-soft),
    visibility var(--dur-med) var(--ease-soft);
  pointer-events: none;
  z-index: 0;
}

.wells-slide.is-active {
  opacity: 1;
  visibility: visible;
  z-index: 1;
}

.wells-slide img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - (var(--canvas-pad) * 2));
  width: auto;
  height: auto;
  object-fit: contain;
  pointer-events: none;
}

/* Wells hover zones — cursors only (no visible arrows) */
.wells-overlay {
  position: absolute;
  top: 0;
  height: 100%;
  z-index: 5;
  background: transparent;
}

.wells-overlay-left {
  left: 0;
  width: 40%;
  cursor: w-resize;
}

.wells-overlay-center {
  left: 40%;
  width: 20%;
  cursor: n-resize;
}

.wells-overlay-right {
  left: 60%;
  width: 40%;
  cursor: e-resize;
}

.wells-gallery.is-thumbs-mode .wells-overlay {
  display: none;
}

/* Thumbnails — masonry Wells (largeur fixe, ratio original, marges égales)
   Haut aligné avec le titre du menu (pas de padding-top). */
.wells-thumbs {
  position: relative;
  display: block;
  width: 100%;
  padding: 0 0 2rem;
  margin: 0;
  box-sizing: border-box;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity var(--dur-med) var(--ease-soft),
    visibility var(--dur-med) var(--ease-soft);
}

.wells-gallery.is-thumbs-mode .wells-thumbs {
  display: block;
}

.wells-gallery.is-thumbs-visible .wells-thumbs {
  opacity: 1;
  visibility: visible;
}

.wells-thumbs[hidden] {
  display: none !important;
}

.wells-thumb {
  position: absolute;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  cursor: pointer;
  display: block;
  line-height: 0;
  overflow: hidden;
  box-sizing: border-box;
}

.wells-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
  vertical-align: top;
  transition: opacity var(--dur-fast) var(--ease-soft);
}

.wells-thumb:hover img {
  opacity: 0.9;
}

.project-empty {
  max-width: 36rem;
}

/* Mobile — Wells stacks; keep usable drawer */
@media (max-width: 900px) {
  :root {
    --canvas-pad: 20px;
    --sidebar-w: min(180px, 78vw);
    --sidebar-gap: 24px;
    --gallery-pad: 24px;
    --thumb-w: 140px;
  }

  .nav-toggle {
    display: block;
  }

  .site-canvas {
    display: block;
    padding: var(--canvas-pad);
    padding-top: 3.5rem;
  }

  .site-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    height: auto;
    max-height: none;
    padding: 20px;
    width: var(--sidebar-w);
    flex: none;
    background: var(--bg);
    transform: translateX(-105%);
    transition: transform 0.25s ease;
    box-shadow: 1px 0 0 rgba(0, 0, 0, 0.06);
  }

  body.nav-open .site-sidebar {
    transform: translateX(0);
  }

  .site-main {
    margin: 0;
    padding: 0;
    min-height: 0;
  }

  .wells-stage {
    margin: 1rem 0;
    min-height: 50vh;
  }

  .wells-slide img {
    max-height: 65vh;
  }
}
