/* ==========================================================================
   Saint Eloi - stylesheet
   Layout tools used: Flexbox (header, nav, footer, cards), CSS Grid (12-column
   system + gallery), floats (text wrapping around figures), media queries.
   ========================================================================== */

/* 1. Tokens ---------------------------------------------------------------- */
:root {
  --green: #243C32;
  --green-dark: #1a2c25;
  --ivory: #F4EFE4;
  --gold: #A88952;
  --gold-dark: #6B5424;
  --stone: #B9AD99;
  --accent: #E2A53A;
  --ink: #1f2a25;

  --font-display: 'Cooper Black', 'Rammetto One', Georgia, serif;
  --font-logo: 'Rockwell Extra Bold', 'Rockwell', 'Alfa Slab One', Georgia, serif;
  --font-body: 'Myriad Pro', 'Source Sans 3', 'Segoe UI', Arial, sans-serif;

  --header-h: 64px;
  --radius: 6px;
  --max: 1120px;
  --gap: clamp(1rem, 2.5vw, 2rem);
}

/* 2. Base ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;              /* sticky footer: main grows, footer sits last */
  flex-direction: column;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--ink);
  background: var(--gold);
}

main { flex: 1; }

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

h1, h2 {
  margin: 0 0 .6em;
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.15;
  color: var(--green);
}
h1 { font-size: clamp(2rem, 1.4rem + 2.5vw, 3rem); }
h2 { font-size: clamp(1.4rem, 1.1rem + 1.2vw, 1.9rem); }

p { margin: 0 0 1em; max-width: 70ch; }

a { color: var(--green); }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
main :focus-visible { outline-color: var(--green); }

.skip-link {
  position: absolute; left: 1rem; top: -4rem; z-index: 100;
  padding: .6rem 1rem; background: var(--ivory); color: var(--green);
  border-radius: var(--radius); transition: top .2s;
}
.skip-link:focus { top: .75rem; }

/* 3. Layout helpers -------------------------------------------------------- */
.page { padding: clamp(1.5rem, 4vw, 3rem) clamp(1rem, 3vw, 2rem); }
.container { width: 100%; max-width: var(--max); margin-inline: auto; }
.stack > * + * { margin-top: var(--gap); }

.panel {
  padding: clamp(1.25rem, 3vw, 2.25rem);
  background: var(--ivory);
  border-radius: var(--radius);
  box-shadow: 0 3px 0 rgba(36, 60, 50, .28);
}

/* 12-column grid system */
.grid-12 {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--gap);
}
.span-3  { grid-column: span 3; }
.span-4  { grid-column: span 4; }
.span-5  { grid-column: span 5; }
.span-7  { grid-column: span 7; }
.span-12 { grid-column: span 12; }

/* Floats: text wraps around the figure */
.float-right { float: right; margin: 0 0 1rem 1.75rem; }
.clearfix::after { content: ""; display: table; clear: both; }

/* 4. Header and navigation (flexbox) --------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--green);
  transition: box-shadow .3s;
}
.site-header.is-scrolled { box-shadow: 0 4px 14px rgba(0, 0, 0, .3); }

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
  padding: 0 clamp(1rem, 2.5vw, 2rem);
}

.logo {
  font-family: var(--font-logo);
  font-size: 1.6rem;
  letter-spacing: .02em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--accent);
}

.site-nav ul {
  display: flex;
  gap: clamp(1rem, 2vw, 1.75rem);
  margin: 0; padding: 0;
  list-style: none;
}
.site-nav a {
  display: inline-block;
  padding: .25rem 0;
  color: var(--accent);
  text-decoration: none;
  background: linear-gradient(currentColor, currentColor) left bottom / 0 2px no-repeat;
  transition: background-size .3s ease;
}
.site-nav a:hover,
.site-nav a:focus-visible,
.site-nav a[aria-current="page"] { background-size: 100% 2px; }

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px; height: 44px;
  padding: 0 10px;
  background: none; border: 0; cursor: pointer;
}
.nav-toggle span {
  display: block; height: 2px; background: var(--accent);
  transition: transform .3s, opacity .2s;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* 5. Buttons --------------------------------------------------------------- */
.btn {
  display: inline-block;
  padding: .7rem 1.4rem;
  font: inherit; font-weight: 600;
  text-decoration: none;
  color: var(--ivory);
  background: var(--green);
  border: 2px solid var(--green);
  border-radius: var(--radius);
  transition: transform .2s, background .2s, color .2s;
}
.btn:hover { transform: translateY(-2px); background: var(--ivory); color: var(--green); }
.btn--accent { color: var(--green-dark); background: var(--accent); border-color: var(--accent); }
.btn--accent:hover { background: var(--ivory); border-color: var(--ivory); color: var(--green); }

/* 6. Home hero ------------------------------------------------------------- */
.hero {
  position: relative;
  display: flex;
  align-items: center;
  min-height: calc(100vh - var(--header-h) - 90px);
  padding: 3rem clamp(1.25rem, 5vw, 4rem);
  overflow: hidden;
  background: var(--green);
  color: var(--ivory);
}
.hero::before {                       /* photograph with slow settle-in zoom */
  content: "";
  position: absolute; inset: 0;
  background: url("../images/statue-hero.jpg") 50% 20% / cover no-repeat;
  transform-origin: 50% 40%;
  animation: settle 16s ease-out both;
}
.hero::after {                        /* scrim keeps the text readable */
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(26, 44, 37, .92) 0%, rgba(26, 44, 37, .6) 34%, rgba(26, 44, 37, 0) 58%);
}
.hero-content { position: relative; z-index: 1; max-width: 30rem; }
.hero-title {
  margin: 0 0 .3em;
  font-family: var(--font-display);
  font-size: clamp(3rem, 2rem + 5vw, 5.5rem);
  line-height: 1;
  color: var(--ivory);
}
.hero-tagline { margin: 0 0 1.75rem; font-size: clamp(1.15rem, 1rem + .8vw, 1.5rem); line-height: 1.4; }

.hero-title, .hero-tagline, .hero .btn { animation: rise 1s cubic-bezier(.2, .7, .2, 1) both; }
.hero-tagline { animation-delay: .25s; }
.hero .btn    { animation-delay: .5s; }

@keyframes settle { from { transform: scale(1.1); } to { transform: scale(1); } }
@keyframes rise   { from { opacity: 0; transform: translateY(26px); } to { opacity: 1; transform: none; } }

/* Explore cards (flexbox) */
.explore {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap);
  margin: 0; padding: 0; list-style: none;
}
.explore li { flex: 1 1 220px; }
.explore a {
  display: block; height: 100%;
  padding: 1.25rem 1.4rem;
  text-decoration: none;
  background: var(--ivory);
  border-left: 5px solid var(--green);
  border-radius: var(--radius);
  box-shadow: 0 3px 0 rgba(36, 60, 50, .28);
  transition: transform .25s, box-shadow .25s;
}
.explore a:hover, .explore a:focus-visible { transform: translateY(-4px); box-shadow: 0 8px 0 rgba(36, 60, 50, .28); }
.explore h2 { margin: 0 0 .3em; font-size: 1.3rem; }
.explore p { margin: 0; color: var(--ink); }

/* 7. Figures --------------------------------------------------------------- */
figure { margin: 0; }
figcaption { margin-top: .5rem; font-size: .9rem; color: var(--gold-dark); }
.photo { border-radius: var(--radius); }

.figure-estate { width: 46%; }
.figure-portrait { width: min(320px, 40%); }

.thumbs figure { overflow: hidden; border-radius: var(--radius); }
.thumbs img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; transition: transform .5s ease; }
.thumbs figure:hover img { transform: scale(1.06); }

.map-link { display: block; overflow: hidden; border-radius: var(--radius); }
.map-link img { width: 100%; min-height: 180px; aspect-ratio: 1920 / 420; object-fit: cover; transition: transform .5s ease; }
.map-link:hover img { transform: scale(1.03); }
.map-actions { margin-top: 1rem; }

/* 8. About the Art --------------------------------------------------------- */
.art-figure img { width: 100%; border-radius: var(--radius); }
.details { margin: 0; }
.details div { padding: .85rem 0; border-bottom: 1px solid rgba(36, 60, 50, .18); }
.details div:last-child { border-bottom: 0; }
.details dt { font-family: var(--font-display); font-size: 1.05rem; color: var(--gold-dark); }
.details dd { margin: .15rem 0 0; }
.history-text { columns: 2 22rem; column-gap: 2.5rem; }
.history-text p { max-width: none; break-inside: avoid-column; }

/* 9. Photo gallery (CSS Grid) ---------------------------------------------- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .75rem;
  margin: 0; padding: 0; list-style: none;
}
.gallery-item {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  padding: 0;
  overflow: hidden;
  cursor: zoom-in;
  background: var(--stone);
  border: 0;
  border-radius: var(--radius);
}
.gallery-grid li:first-child { grid-row: span 2; }
.gallery-grid li:first-child .gallery-item { aspect-ratio: auto; height: 100%; }
.gallery-item img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .5s ease, filter .5s ease;
}
.gallery-grid li:first-child img { object-position: center top; }
.gallery-item::after {                 /* hover cue */
  content: "View";
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: .6rem;
  font-weight: 600; text-align: center;
  color: var(--ivory);
  background: linear-gradient(transparent, rgba(26, 44, 37, .85));
  transform: translateY(100%);
  transition: transform .3s ease;
}
.gallery-item:hover img, .gallery-item:focus-visible img { transform: scale(1.07); filter: brightness(.85); }
.gallery-item:hover::after, .gallery-item:focus-visible::after { transform: none; }

/* 10. Lightbox ------------------------------------------------------------- */
.lightbox {
  position: fixed; inset: 0; z-index: 200;
  display: flex; flex-direction: column;
  padding: 1rem;
  color: var(--ivory);
  background: rgba(26, 44, 37, .96);
  opacity: 0; visibility: hidden;
  transition: opacity .3s ease, visibility 0s linear .3s;
}
.lightbox.is-open { opacity: 1; visibility: visible; transition: opacity .3s ease, visibility 0s; }

.lb-stage {
  flex: 1; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 2.5rem 4rem 0;
}
.lb-figure { display: flex; flex-direction: column; align-items: center; width: min(100%, 960px); max-height: 100%; min-height: 0; }
.lb-img {
  width: 100%; min-height: 0; flex: 0 1 auto;
  max-height: calc(100vh - 260px);
  object-fit: contain;
  border-radius: var(--radius);
  opacity: 0; transform: scale(.96);
  transition: opacity .35s ease, transform .35s ease;
}
.lightbox.is-open .lb-img.is-in { opacity: 1; transform: none; }
.lb-caption { margin: .75rem 0 0; text-align: center; font-size: 1.05rem; color: var(--ivory); }
.lb-count { margin: .25rem 0 0; text-align: center; font-size: .9rem; color: var(--stone); }

.lb-btn {
  position: absolute;
  display: flex; align-items: center; justify-content: center;
  width: 48px; height: 48px;
  color: var(--ivory);
  background: rgba(244, 239, 228, .1);
  border: 2px solid rgba(244, 239, 228, .6);
  border-radius: 50%;
  cursor: pointer;
  transition: background .2s, transform .2s;
}
.lb-btn:hover { background: rgba(244, 239, 228, .25); }
.lb-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.lb-close { top: 1rem; right: 1rem; }
.lb-prev, .lb-next { top: 50%; margin-top: -24px; }
.lb-prev { left: 1rem; }
.lb-next { right: 1rem; }
.lb-prev:hover { transform: translateX(-3px); }
.lb-next:hover { transform: translateX(3px); }

.lb-thumbs {
  display: flex; justify-content: center; gap: .5rem;
  margin: .75rem 0 0; padding: .25rem 0; list-style: none;
  overflow-x: auto;
}
.lb-thumbs button {
  display: block; width: 72px; height: 52px; padding: 0;
  overflow: hidden; cursor: pointer;
  background: none; border: 2px solid transparent; border-radius: 4px;
  opacity: .6; transition: opacity .2s, border-color .2s;
}
.lb-thumbs button:hover { opacity: 1; }
.lb-thumbs button.is-active { opacity: 1; border-color: var(--accent); }
.lb-thumbs img { width: 100%; height: 100%; object-fit: cover; }
.lightbox :focus-visible { outline-color: var(--accent); }

body.no-scroll { overflow: hidden; }

/* 11. Footer (flexbox) ----------------------------------------------------- */
.site-footer {
  display: flex; align-items: center; justify-content: center;
  min-height: 90px; padding: 1.5rem 1rem;
  color: var(--accent);
  text-align: center;
  background: var(--green);
  border-top: 3px solid var(--gold);
}
.site-footer p { margin: 0; }

/* 12. Scroll reveal -------------------------------------------------------- */
.js [data-reveal] {
  opacity: 0; transform: translateY(18px);
  transition: opacity .7s ease var(--delay, 0s), transform .7s ease var(--delay, 0s);
}
.js [data-reveal].is-visible { opacity: 1; transform: none; }

/* 13. Media queries -------------------------------------------------------- */
@media (max-width: 1000px) {
  .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span-3 { grid-column: span 6; }
}

@media (max-width: 860px) {
  .nav-toggle { display: flex; }

  .site-nav {
    position: absolute; top: var(--header-h); left: 0; right: 0;
    max-height: 0; overflow: hidden; visibility: hidden;
    background: var(--green);
    transition: max-height .35s ease, visibility 0s linear .35s;
  }
  .site-nav.is-open { max-height: 380px; visibility: visible; transition: max-height .35s ease, visibility 0s; }
  .site-nav ul { flex-direction: column; gap: 0; padding: .5rem clamp(1rem, 2.5vw, 2rem) 1.25rem; }
  .site-nav a { padding: .7rem 0; font-size: 1.15rem; }

  .span-5, .span-7 { grid-column: span 12; }
  .figure-estate { width: 100%; float: none; margin: 0 0 1.25rem; }

  .hero { align-items: flex-end; min-height: 80vh; }
  .hero::after { background: linear-gradient(0deg, rgba(26, 44, 37, .94) 0%, rgba(26, 44, 37, .7) 45%, rgba(26, 44, 37, 0) 80%); }
  .hero-content { max-width: 100%; }

  .lb-stage { padding: 3.5rem .5rem 0; }
  .lb-prev, .lb-next { top: auto; bottom: 5.5rem; margin-top: 0; }
}

@media (max-width: 560px) {
  .span-3 { grid-column: span 12; }
  .float-right { float: none; margin: 0 0 1.25rem; }
  .figure-portrait { width: 100%; max-width: 320px; }
  .gallery-grid li:first-child { grid-column: 1 / -1; grid-row: auto; }
  .gallery-grid li:first-child .gallery-item { aspect-ratio: 4 / 3; }
  .logo { font-size: 1.35rem; }
}

@media (max-height: 560px) {
  .lb-thumbs { display: none; }
}

/* 14. Reduced motion ------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .js [data-reveal] { opacity: 1; transform: none; }
}
