/*
Theme Name: Marielle Gallery
Description: Dark, minimal painting portfolio for www.bessaguet.net. Galleries are ordinary WordPress Gallery blocks; the theme lays them out as a two-column masonry grid with a full-screen viewer.
Version: 1.0.0
Requires at least: 6.4
Requires PHP: 8.0
Text Domain: marielle-gallery
*/

:root {
  --bg: #292929;
  --text: #b8b8b8;
  --heading: #ffffff;
  --accent: #00ff8e;
  --line: #4a4a4a;
  --button: #474747;
  --button-hover: #33312f;
  --font-logo: 'Dr Sugiyama', cursive;
  --font-menu: 'Arial Black', Gadget, 'Montserrat', sans-serif;
  --font-heading: 'Montserrat', sans-serif;
  --font-body: 'Open Sans', sans-serif;
  --page-width: 960px;
  --gallery-width: 666px;
  --gallery-gap: 60px;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.75;
  letter-spacing: 0.25px;
  -webkit-font-smoothing: antialiased;
}

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

a { color: var(--accent); text-decoration: none; }
a:hover, a:focus-visible { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

h1, h2, h3 {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--heading);
  text-transform: uppercase;
  letter-spacing: 1px;
  line-height: 1.25;
  margin: 0 0 0.8em;
}
h1 { font-size: 23px; }
h2 { font-size: 20px; }
h3 { font-size: 17px; }

.screen-reader-text {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.skip-link:focus {
  position: fixed; top: 8px; left: 8px; width: auto; height: auto; clip: auto; clip-path: none;
  background: var(--bg); padding: 8px 12px; z-index: 1000;
}

.wrap { width: 100%; max-width: var(--page-width); margin: 0 auto; padding: 0 16px; }

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

.site-header { padding-top: 14px; }

.site-logo {
  display: flex; align-items: center; justify-content: center;
  min-height: 72px; margin: 0;
  font-family: var(--font-logo); font-weight: 400; font-size: 39px; line-height: 1.1;
  letter-spacing: 4px; text-transform: none; text-align: center;
}
.site-logo a { color: var(--heading); text-decoration: none; }

.site-nav { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.site-nav ul {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 22px;
  list-style: none; margin: 0; padding: 9px 0;
}
.site-nav a {
  display: block; padding: 2px 0;
  font-family: var(--font-menu); font-weight: 900; font-size: 13px; letter-spacing: 1.5px;
  color: var(--heading); text-decoration: none; transition: color 0.2s;
}
.site-nav a:hover,
.site-nav a:focus-visible,
.site-nav .current-menu-item > a,
.site-nav .current_page_item > a { color: var(--accent); }

.nav-toggle { display: none; }

/* ---------- Content ---------- */

.site-main { padding: 60px 0 70px; min-height: 55vh; }
.entry-content > * { margin-top: 0; margin-bottom: 1.6em; }
.entry-content > *:last-child { margin-bottom: 0; }
.entry-content p { margin: 0 0 1.2em; }
.entry-content > :not(.wp-block-gallery):not(.wp-block-columns):not(.alignwide) { max-width: 680px; margin-left: auto; margin-right: auto; }

/* ---------- Gallery (core Gallery block) ---------- */

body .wp-block-gallery.has-nested-images {
  display: block;
  max-width: var(--gallery-width);
  margin: 0 auto;
  column-count: 2;              /* fallback when JavaScript is off */
  column-gap: var(--gallery-gap);
}
body .wp-block-gallery.has-nested-images.is-masonry {
  display: flex; flex-wrap: nowrap; align-items: flex-start; gap: var(--gallery-gap); column-count: auto;
}
.gallery-col { flex: 1 1 0; min-width: 0; }

body .wp-block-gallery.has-nested-images figure.wp-block-image {
  display: block; width: 100% !important; margin: 0 0 34px !important;
  break-inside: avoid; position: relative; flex-grow: 0;
}
body .wp-block-gallery.has-nested-images figure.wp-block-image a { display: block; cursor: zoom-in; }
body .wp-block-gallery.has-nested-images figure.wp-block-image img {
  display: block; width: 100% !important; height: auto !important;
  border: 1px solid var(--text); border-radius: 4px;
  background: #222; transition: opacity 0.25s;
}
body .wp-block-gallery.has-nested-images figure.wp-block-image a:hover img { opacity: 0.8; }

body .wp-block-gallery.has-nested-images figure.wp-block-image figcaption {
  position: static; background: none; max-height: none; overflow: visible;
  padding: 10px 0 0; margin: 0; text-align: center; text-shadow: none;
  font-family: var(--font-heading); font-weight: 700; font-size: 11px; line-height: 1.4;
  letter-spacing: 1px; text-transform: uppercase; color: var(--text);
  -webkit-backdrop-filter: none; backdrop-filter: none;
}
body .wp-block-gallery.has-nested-images figure.wp-block-image::before,
body .wp-block-gallery.has-nested-images figure.wp-block-image::after { content: none; }

/* ---------- Full-screen viewer ---------- */

.viewer {
  position: fixed; inset: 0; z-index: 900; display: flex; align-items: center; justify-content: center;
  background: rgba(41, 41, 41, 0.97); opacity: 0; visibility: hidden; transition: opacity 0.3s, visibility 0.3s;
}
.viewer.is-open { opacity: 1; visibility: visible; }
.viewer__stage { position: absolute; inset: 44px 64px 64px; display: flex; align-items: center; justify-content: center; }
.viewer__img { max-width: 100%; max-height: 100%; object-fit: contain; opacity: 0; transition: opacity 0.4s; }
.viewer__img.is-loaded { opacity: 1; }
.viewer button {
  position: absolute; background: none; border: 0; color: var(--heading); cursor: pointer;
  width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; opacity: 0.8;
}
.viewer button:hover, .viewer button:focus-visible { opacity: 1; color: var(--accent); }
.viewer button svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; }
.viewer__close { top: 6px; right: 10px; }
.viewer__prev { left: 8px; top: 50%; transform: translateY(-50%); }
.viewer__next { right: 8px; top: 50%; transform: translateY(-50%); }
.viewer__caption {
  position: absolute; left: 64px; right: 64px; bottom: 18px; margin: 0;
  font-size: 12px; line-height: 1.5; color: var(--text);
}
.viewer__caption strong { color: var(--heading); font-family: var(--font-heading); letter-spacing: 1px; text-transform: uppercase; font-size: 11px; margin-right: 10px; }
.viewer__count { position: absolute; top: 20px; left: 24px; font-size: 11px; letter-spacing: 1px; color: var(--text); }
body.viewer-open { overflow: hidden; }

/* ---------- About / contact ---------- */

.wp-block-columns { display: flex; gap: 48px; align-items: flex-start; max-width: 860px; margin-left: auto; margin-right: auto; }
.wp-block-column { flex: 1 1 0; min-width: 0; }
.wp-block-column > :first-child { margin-top: 0; }
.wp-block-image { margin: 0 0 1.6em; }
.wp-block-image img { display: block; }

.wpcf7 { margin-top: 34px; max-width: 400px; }
.wpcf7 p { margin: 0 0 14px; }
.wpcf7 label { display: block; font-size: 12px; color: var(--text); }
.wpcf7 input[type="text"], .wpcf7 input[type="email"], .wpcf7 textarea {
  display: block; width: 100%; margin-top: 2px; padding: 8px 0;
  background: transparent; border: 0; border-bottom: 1px solid var(--line); border-radius: 0;
  color: var(--heading); font: inherit;
}
.wpcf7 textarea { min-height: 42px; height: 96px; resize: vertical; }
.wpcf7 input:focus, .wpcf7 textarea:focus { outline: none; border-bottom-color: var(--accent); }
.wpcf7 input[type="submit"] {
  margin-top: 14px; min-width: 162px; padding: 14px 28px;
  background: transparent; border: 1px solid var(--line); border-radius: 0; color: var(--text);
  font-family: var(--font-body); font-size: 12px; letter-spacing: 2.4px; text-transform: uppercase;
  cursor: pointer; transition: background 0.2s, color 0.2s;
}
.wpcf7 input[type="submit"]:hover, .wpcf7 input[type="submit"]:focus-visible { background: var(--button); color: var(--heading); }
.wpcf7 .wpcf7-not-valid-tip { color: #ff8a8a; font-size: 11px; margin-top: 4px; }
.wpcf7 form .wpcf7-response-output { margin: 16px 0 0; padding: 10px 12px; border: 1px solid var(--line); font-size: 12px; }
.wpcf7 form.sent .wpcf7-response-output { border-color: var(--accent); }

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

.site-footer .wrap > div { border-top: 1px solid var(--line); padding: 22px 0 40px; text-align: left; font-size: 12px; font-weight: 700; }
.site-footer p { margin: 0; }

/* ---------- Small screens ---------- */

@media (max-width: 700px) {
  :root { --gallery-gap: 20px; }
  .site-logo { font-size: 31px; letter-spacing: 2px; min-height: 60px; }
  .site-main { padding: 32px 0 48px; }

  .nav-toggle {
    display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
    padding: 12px 0; background: none; border: 0; color: var(--heading); cursor: pointer;
    font-family: var(--font-menu); font-weight: 900; font-size: 13px; letter-spacing: 1.5px;
  }
  .nav-toggle svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; }
  .js .site-nav ul { display: none; }
  .js .site-nav.is-open ul { display: flex; }
  .site-nav ul { flex-direction: column; align-items: center; gap: 0; padding: 0 0 10px; }
  .site-nav a { padding: 10px 0; font-size: 14px; }

  .wp-block-columns { flex-direction: column; gap: 28px; }
  .wp-block-column { width: 100%; flex: none; }
  .wpcf7 { max-width: none; }

  .viewer__stage { inset: 52px 8px 76px; }
  .viewer__caption { left: 16px; right: 16px; bottom: 14px; }
  .viewer__prev, .viewer__next { top: auto; bottom: 8px; transform: none; z-index: 2; }
  .viewer__prev { left: auto; right: 56px; }
  .viewer__caption { right: 112px; }
}

@media (max-width: 480px) {
  body .wp-block-gallery.has-nested-images figure.wp-block-image { margin-bottom: 24px !important; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
