/* ==================================================================
 * Hugo Cotton — styles publics
 * Design épuré, dark/light auto (système) + override via [data-theme]
 * ================================================================== */

:root {
  --color-bg: #fafaf9;
  --color-fg: #1c1917;
  --color-muted: #78716c;
  --color-line: #e7e5e4;
  --color-accent: #57534e;

  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;

  --container-max: 1152px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --color-bg: #0a0a0a;
    --color-fg: #e7e5e4;
    --color-muted: #a8a29e;
    --color-line: #1c1917;
    --color-accent: #d6d3d1;
  }
}

:root[data-theme="dark"] {
  --color-bg: #0a0a0a;
  --color-fg: #e7e5e4;
  --color-muted: #a8a29e;
  --color-line: #1c1917;
  --color-accent: #d6d3d1;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --color-bg: #fafaf9;
  --color-fg: #1c1917;
  --color-muted: #78716c;
  --color-line: #e7e5e4;
  --color-accent: #57534e;
  color-scheme: light;
}

* { box-sizing: border-box; }

html {
  background: var(--color-bg);
  color: var(--color-fg);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color-scheme: light dark;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

button {
  font-family: inherit;
  font-size: inherit;
}

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

picture { display: block; }

::selection {
  background: var(--color-fg);
  color: var(--color-bg);
}

/* ============================================================
 * Layout
 * ============================================================ */

.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 1.5rem;
}
@media (min-width: 640px) {
  .container { padding: 0 2rem; }
}

main.page {
  flex: 1;
  padding: 3rem 1.5rem;
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
}
@media (min-width: 640px) {
  main.page { padding: 4rem 2rem; }
}

/* ============================================================
 * Header / Footer
 * ============================================================ */

.site-header {
  border-bottom: 1px solid var(--color-line);
}
.site-header .inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  max-width: var(--container-max);
  margin: 0 auto;
}
@media (min-width: 640px) {
  .site-header .inner { padding: 1.25rem 2rem; }
}
.site-header .brand {
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}
@media (min-width: 640px) {
  .site-header .brand { font-size: 1.125rem; }
}
.site-header .right {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}
@media (min-width: 640px) {
  .site-header .right { gap: 1.75rem; }
}
.site-header nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  font-size: 0.875rem;
}
@media (min-width: 640px) {
  .site-header nav { gap: 1.75rem; }
}
.site-header nav a {
  opacity: 0.6;
  transition: opacity 0.15s;
}
.site-header nav a:hover,
.site-header nav a[aria-current="page"] {
  opacity: 1;
}

.site-footer {
  border-top: 1px solid var(--color-line);
  margin-top: 4rem;
}
.site-footer .inner {
  display: flex;
  justify-content: flex-end;
  padding: 2rem 1.5rem;
  max-width: var(--container-max);
  margin: 0 auto;
  font-size: 0.75rem;
  opacity: 0.6;
}
.site-footer .inner p { margin: 0; }
@media (min-width: 640px) {
  .site-footer .inner { padding: 2rem; }
}

/* ============================================================
 * Theme toggle
 * ============================================================ */

#theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 9999px;
  border: 1px solid var(--color-line);
  background: transparent;
  color: inherit;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.15s, border-color 0.15s;
}
#theme-toggle:hover {
  opacity: 1;
  border-color: var(--color-fg);
}
#theme-toggle svg { width: 16px; height: 16px; }
#theme-toggle [data-icon="sun"] { display: none; }
#theme-toggle [data-icon="moon"] { display: block; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) #theme-toggle [data-icon="moon"] { display: none; }
  :root:not([data-theme]) #theme-toggle [data-icon="sun"] { display: block; }
}
:root[data-theme="dark"] #theme-toggle [data-icon="moon"] { display: none; }
:root[data-theme="dark"] #theme-toggle [data-icon="sun"] { display: block; }
:root[data-theme="light"] #theme-toggle [data-icon="sun"] { display: none; }
:root[data-theme="light"] #theme-toggle [data-icon="moon"] { display: block; }

/* ============================================================
 * Headings & Hero
 * ============================================================ */

.kicker {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  opacity: 0.6;
  margin: 0 0 1rem;
}

h1.page-title {
  font-size: 1.875rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0;
  max-width: 48rem;
}
@media (min-width: 640px) {
  h1.page-title { font-size: 2.25rem; }
}

h1.hero-title {
  font-size: 1.875rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0;
  max-width: 48rem;
}
@media (min-width: 640px) {
  h1.hero-title { font-size: 3rem; }
}

.hero {
  margin-bottom: 5rem;
}
@media (min-width: 640px) {
  .hero { margin-bottom: 7rem; }
}
.hero p.lead {
  margin: 1.5rem 0 0;
  max-width: 40rem;
  font-size: 1rem;
  line-height: 1.7;
  opacity: 0.85;
}
@media (min-width: 640px) {
  .hero p.lead { font-size: 1.125rem; }
}
.hero .cta {
  margin-top: 2rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  font-size: 0.875rem;
}
.hero .cta a.primary {
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
}
.hero .cta a.primary:hover {
  text-decoration-thickness: 2px;
}
.hero .cta a.secondary {
  opacity: 0.6;
  transition: opacity 0.15s;
}
.hero .cta a.secondary:hover { opacity: 1; }

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 2rem;
}
.section-header h2 {
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 0;
}
@media (min-width: 640px) {
  .section-header h2 { font-size: 1.5rem; }
}
.section-header a.see-all {
  font-size: 0.875rem;
  opacity: 0.6;
  transition: opacity 0.15s;
}
.section-header a.see-all:hover { opacity: 1; }

p.lead, p.intro {
  font-size: 1rem;
  line-height: 1.7;
  white-space: pre-line;     /* préserve les retours à la ligne du texte stocké en DB */
}

.muted { opacity: 0.6; font-size: 0.75rem; }

/* ============================================================
 * Photo grid (CSS columns, masonry-like)
 * ============================================================ */

.photo-grid {
  column-count: 1;
  column-gap: 1rem;
  column-fill: balance;
}
@media (min-width: 640px) {
  .photo-grid { column-count: 2; column-gap: 1.5rem; }
}
@media (min-width: 1024px) {
  .photo-grid { column-count: 3; }
}

.photo-grid figure {
  margin: 0 0 1rem;
  break-inside: avoid;
}
@media (min-width: 640px) {
  .photo-grid figure { margin-bottom: 1.5rem; }
}

.photo-grid button.thumb {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
  text-align: left;
}
.photo-grid button.thumb img {
  width: 100%;
  height: auto;
  transition: opacity 0.3s;
}
.photo-grid button.thumb:hover img {
  opacity: 0.9;
}
.photo-grid figcaption {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  opacity: 0.6;
}

/* ============================================================
 * Album grid (covers)
 * ============================================================ */

/* Vraie masonry : items packés verticalement par colonne, jamais étirés
   pour matcher la hauteur de la colonne voisine. */
.album-grid {
  column-count: 1;
  column-gap: 1rem;
  column-fill: balance;
}
@media (min-width: 640px) {
  .album-grid { column-count: 2; column-gap: 1.5rem; }
}
@media (min-width: 1024px) {
  .album-grid { column-count: 3; }
}

/* inline-block : empêche absolument toute extension verticale (vs display: block
   qui peut être étiré par certains layouts cachés / ancienne CSS encore en mémoire). */
.album-card {
  display: inline-block;
  width: 100%;
  vertical-align: top;
  color: inherit;
  margin: 0 0 1rem;
  break-inside: avoid;
}
@media (min-width: 640px) {
  .album-card { margin-bottom: 1.5rem; }
}
.album-card .cover {
  background: transparent;
  overflow: hidden;
  line-height: 0;     /* enlève le whitespace inline sous l'image */
}
.album-card .cover img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.7s ease-out;
}
.album-card:hover .cover img {
  transform: scale(1.02);
}
.album-card .meta {
  margin-top: 0.75rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}
.album-card .meta h3 {
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 0;
}
.album-card .meta .count {
  font-size: 0.75rem;
  opacity: 0.6;
}

/* ============================================================
 * About page
 * ============================================================ */

.about-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
  align-items: start;
}
@media (min-width: 768px) {
  .about-grid {
    grid-template-columns: 1fr 2fr;
    gap: 4rem;
  }
}
.about-grid .intro {
  font-size: 1rem;
  line-height: 1.7;
  opacity: 0.9;
  /* Pas de pre-line : le markdown rendu produit déjà <p> et <br>. */
}
@media (min-width: 640px) {
  .about-grid .intro { font-size: 1.125rem; }
}
.about-grid .intro p:first-child { margin-top: 0; }
.about-grid .intro p:last-child { margin-bottom: 0; }
.about-grid .intro a {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
.about-grid .intro a:hover {
  text-decoration-thickness: 2px;
}
.about-grid .actions { margin-top: 2.5rem; }

/* ============================================================
 * Contact form
 * ============================================================ */

.contact-form {
  max-width: 36rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.contact-form .field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.contact-form label {
  font-size: 0.875rem;
  opacity: 0.8;
}
.contact-form input,
.contact-form textarea {
  background: transparent;
  color: inherit;
  border: none;
  border-bottom: 1px solid var(--color-line);
  outline: none;
  padding: 0.5rem 0;
  font: inherit;
  transition: border-color 0.15s;
  resize: none;
}
.contact-form input:focus,
.contact-form textarea:focus {
  border-bottom-color: var(--color-fg);
}
.contact-form .honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.contact-form .footer {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
}
.contact-form .status {
  font-size: 0.875rem;
  opacity: 0.7;
  margin: 0;
}

/* ============================================================
 * Buttons
 * ============================================================ */

.btn {
  display: inline-block;
  font-size: 0.875rem;
  border: 1px solid var(--color-fg);
  background: transparent;
  color: inherit;
  padding: 0.625rem 1.25rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  text-align: center;
}
.btn:hover:not(:disabled) {
  background: var(--color-fg);
  color: var(--color-bg);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-link {
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
  cursor: pointer;
  background: none;
  border: none;
  color: inherit;
  padding: 0;
  font: inherit;
}
.btn-danger {
  border-color: #b91c1c;
  color: #b91c1c;
}
.btn-danger:hover:not(:disabled) {
  background: #b91c1c;
  color: white;
}

/* ============================================================
 * Lightbox
 * ============================================================ */

#lightbox {
  background: transparent;
  padding: 0;
  margin: 0;
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  border: none;
  color: white;
}
#lightbox::backdrop { background: transparent; }
#lightbox[open] { display: flex; }

#lightbox-overlay {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 4rem 1rem;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(4px);
  cursor: zoom-out;
}

.lb-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  max-height: 100%;
  cursor: default;
}
#lightbox-img {
  max-width: 95vw;
  max-height: 75vh;
  object-fit: contain;
}
.lb-caption {
  margin: 0;
  font-size: 0.875rem;
  text-align: center;
}
.lb-meta {
  margin: 0.25rem 0 0;
  font-size: 0.75rem;
  opacity: 0.7;
  text-align: center;
}
.lb-counter {
  margin: 0.5rem 0 0;
  font-size: 11px;
  opacity: 0.5;
  letter-spacing: 0.1em;
  text-align: center;
}

.lb-btn {
  position: absolute;
  width: 2.5rem;
  height: 2.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: 0;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s;
}
.lb-btn:hover { background: rgba(255, 255, 255, 0.2); }

#lightbox-close { top: 1rem; right: 1rem; font-size: 1.25rem; }
#lightbox-prev  { left: 0.5rem; top: 50%; transform: translateY(-50%); }
#lightbox-next  { right: 0.5rem; top: 50%; transform: translateY(-50%); }
@media (min-width: 640px) {
  #lightbox-prev { left: 1rem; }
  #lightbox-next { right: 1rem; }
}

/* ============================================================
 * Empty state
 * ============================================================ */

.empty {
  opacity: 0.6;
  font-size: 0.875rem;
  padding: 2rem 0;
}
