/*
 * style.css — mprart.com rebuild, step 3
 *
 * One stylesheet for every page.
 *
 * Design idea: a museum room, not a template.
 *   - The background is a painted gallery wall (deep slate green), which
 *     makes Monica's reds, oranges and cobalt blues stand out.
 *   - Paintings hang with square corners and a soft shadow below,
 *     like canvases on a wall.
 *   - Every caption is a museum wall label: italic title, then medium
 *     and size underneath.
 *   - The home page menu is a row of tall vertical strips — a nod to the
 *     seven vertical panels of her original 2000s home page. A strip
 *     widens when you point at it, revealing more of the painting.
 *
 * Font: Newsreader (loaded from Google Fonts in each page's <head>).
 */

/* ==========================================================================
   1. Design tokens
   ========================================================================== */
:root {
  /* Colour */
  --wall:        #2b302e;  /* gallery wall, page background */
  --wall-deep:   #202422;  /* header, footer, form fields */
  --paper:       #ece6dc;  /* main text */
  --muted:       #a3a9a4;  /* secondary text, label details */
  --brass:       #c9a862;  /* focus ring, current page, link hover */
  --viewer-bg:   rgba(20, 23, 22, 0.97);
  --error:       #e59a8a;
  --success:     #a9c9a0;

  /* Type */
  --font:        "Newsreader", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --step--1:     0.875rem;
  --step-0:      1.0625rem;
  --step-1:      1.25rem;
  --step-2:      1.5625rem;
  --step-3:      clamp(1.9rem, 1.4rem + 2vw, 2.6rem);
  --step-4:      clamp(2.6rem, 1.6rem + 4.5vw, 5.25rem);

  /* Space */
  --space-1:     0.25rem;
  --space-2:     0.5rem;
  --space-3:     1rem;
  --space-4:     1.5rem;
  --space-5:     2.5rem;
  --space-6:     4rem;
  --space-7:     6rem;

  /* Layout */
  --page-max:    1240px;
  --gutter:      clamp(1rem, 4vw, 3rem);
  --measure:     36em;

  /* Paintings hang on the wall */
  --hang-shadow: 0 18px 30px -18px rgba(0, 0, 0, 0.75);

  --ease:        cubic-bezier(0.22, 0.61, 0.36, 1);
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--wall);
  color: var(--paper);
  font-family: var(--font);
  font-size: var(--step-0);
  font-optical-sizing: auto;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

main {
  flex: 1;
}

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

h1,
h2,
h3 {
  margin: 0;
  font-weight: 400;
  line-height: 1.1;
}

p {
  margin: 0 0 var(--space-3);
}

a {
  color: inherit;
  text-decoration-color: rgba(236, 230, 220, 0.35);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color 0.2s var(--ease), text-decoration-color 0.2s var(--ease);
}

a:hover {
  color: var(--brass);
  text-decoration-color: currentColor;
}

button {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 3px;
}

::selection {
  background: var(--brass);
  color: var(--wall-deep);
}

.wrap {
  width: 100%;
  max-width: var(--page-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

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

.skip-link {
  position: absolute;
  left: var(--space-3);
  top: -100px;
  z-index: 100;
  padding: var(--space-2) var(--space-3);
  background: var(--paper);
  color: var(--wall-deep);
}

.skip-link:focus {
  top: var(--space-3);
}

/* ==========================================================================
   3. Header and navigation
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--wall-deep);
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  min-height: 4.25rem;
}

.site-name {
  font-size: var(--step-1);
  text-decoration: none;
  white-space: nowrap;
}

.site-nav {
  margin-left: auto;
}

.site-nav__list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-4);
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav__link {
  display: inline-block;
  padding-block: var(--space-2);
  text-decoration: none;
  color: var(--muted);
  border-bottom: 1px solid transparent;
}

.site-nav__link:hover {
  color: var(--paper);
}

.site-nav__link[aria-current="page"] {
  color: var(--paper);
  border-bottom-color: var(--brass);
}

.lang-switch {
  display: flex;
  gap: var(--space-1);
  font-size: var(--step--1);
}

.lang-switch__btn {
  padding: var(--space-1) var(--space-2);
  background: none;
  border: 1px solid transparent;
  border-radius: 2px;
  color: var(--muted);
  cursor: pointer;
}

.lang-switch__btn:hover {
  color: var(--paper);
}

.lang-switch__btn[aria-pressed="true"] {
  color: var(--paper);
  border-color: rgba(236, 230, 220, 0.3);
}

.nav-toggle {
  display: none;
  margin-left: auto;
  padding: var(--space-2) var(--space-3);
  background: none;
  border: 1px solid rgba(236, 230, 220, 0.3);
  border-radius: 2px;
  cursor: pointer;
}

/* Phones: menu collapses behind a button */
@media (max-width: 760px) {
  .site-header__inner {
    flex-wrap: wrap;
    gap: var(--space-3);
  }

  .nav-toggle {
    display: block;
  }

  .site-nav,
  .lang-switch {
    display: none;
    width: 100%;
  }

  .site-header.is-open .site-nav,
  .site-header.is-open .lang-switch {
    display: flex;
  }

  .site-header.is-open .lang-switch {
    padding-bottom: var(--space-3);
  }

  .site-nav {
    margin-left: 0;
  }

  .site-nav__list {
    flex-direction: column;
    gap: 0;
    width: 100%;
  }

  .site-nav__link {
    display: block;
    padding-block: var(--space-2);
    font-size: var(--step-1);
    border-bottom: 0;
  }

  .site-nav__link[aria-current="page"] {
    border-left: 2px solid var(--brass);
    padding-left: var(--space-3);
  }
}

/* ==========================================================================
   4. Wall labels (captions, used everywhere a painting appears)
   ========================================================================== */
.label {
  margin-top: var(--space-3);
  font-size: var(--step--1);
  line-height: 1.45;
}

.label__title {
  display: block;
  font-size: var(--step-0);
  font-style: italic;
  color: var(--paper);
}

.label__meta {
  display: block;
  color: var(--muted);
}

/* ==========================================================================
   5. Home page — hero
   ========================================================================== */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: var(--space-6);
  align-items: end;
  padding-block: var(--space-6) var(--space-7);
}

.hero__figure {
  margin: 0;
}

.hero__img {
  width: 100%;
  box-shadow: var(--hang-shadow);
}

.hero__text {
  padding-bottom: var(--space-5);
}

.hero__name {
  font-size: var(--step-4);
  line-height: 0.95;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-4);
}

/* "Monica" on one line, "Perez-Roulet" on the next, never split at the hyphen */
.hero__name span {
  display: block;
  white-space: nowrap;
}

.hero__lede {
  max-width: 24em;
  font-size: var(--step-1);
  color: var(--muted);
}

@media (max-width: 860px) {
  .hero {
    grid-template-columns: 1fr;
    gap: var(--space-5);
    padding-block: var(--space-5);
  }

  .hero__text {
    order: -1;
    padding-bottom: 0;
  }
}

/* ==========================================================================
   6. Home page — section strips
   ========================================================================== */
.strips-heading {
  font-size: var(--step-2);
  margin-bottom: var(--space-4);
}

.strips {
  display: flex;
  gap: var(--space-2);
  height: clamp(22rem, 55vh, 34rem);
  margin: 0 0 var(--space-7);
  padding: 0;
  list-style: none;
}

.strips > li {
  flex: 1 1 0;
  min-width: 0;
  transition: flex-grow 0.6s var(--ease);
}

.strips > li:hover,
.strips > li:focus-within {
  flex-grow: 2.4;
}

.strip {
  position: relative;
  display: block;
  height: 100%;
  overflow: hidden;
  text-decoration: none;
  background: var(--wall-deep);
}

.strip__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.85) brightness(0.8);
  transition: filter 0.6s var(--ease), transform 0.6s var(--ease);
}

.strip:hover .strip__img,
.strip:focus-visible .strip__img {
  filter: none;
  transform: scale(1.03);
}

.strip__text {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: var(--space-5) var(--space-3) var(--space-3);
  background: linear-gradient(to top, rgba(20, 23, 22, 0.85), transparent);
}

.strip__name {
  display: block;
  font-size: var(--step-1);
  line-height: 1.2;
}

.strip__count {
  display: block;
  font-size: var(--step--1);
  color: var(--muted);
}

.strip:hover .strip__name {
  color: var(--brass);
}

/* The one orchestrated moment: strips rise into place on first load */
@media (prefers-reduced-motion: no-preference) {
  .strips > li {
    animation: strip-rise 0.9s var(--ease) both;
  }
  .strips > li:nth-child(2) { animation-delay: 0.08s; }
  .strips > li:nth-child(3) { animation-delay: 0.16s; }
  .strips > li:nth-child(4) { animation-delay: 0.24s; }
  .strips > li:nth-child(5) { animation-delay: 0.32s; }
  .strips > li:nth-child(6) { animation-delay: 0.40s; }
}

@keyframes strip-rise {
  from { clip-path: inset(100% 0 0 0); }
  to   { clip-path: inset(0 0 0 0); }
}

/* Phones: strips become stacked horizontal bands */
@media (max-width: 760px) {
  .strips {
    flex-direction: column;
    height: auto;
  }

  .strips > li,
  .strips > li:hover,
  .strips > li:focus-within {
    flex: none;
    height: 7.5rem;
  }
}

/* ==========================================================================
   7. Page heading (gallery, about, contact)
   ========================================================================== */
.page-head {
  padding-block: var(--space-6) var(--space-5);
}

.page-title {
  font-size: var(--step-3);
  letter-spacing: -0.01em;
}

.page-intro {
  max-width: var(--measure);
  margin-top: var(--space-3);
  color: var(--muted);
}

/* ==========================================================================
   8. Gallery page — paintings hung in columns
   ========================================================================== */
.gallery {
  columns: 3 18rem;
  column-gap: var(--space-6);
  margin: 0 0 var(--space-6);
  padding: 0;
  list-style: none;
}

.gallery > li {
  break-inside: avoid;
  margin-bottom: var(--space-6);
}

.work {
  margin: 0;
}

.work__button {
  display: block;
  width: 100%;
  padding: 0;
  background: none;
  border: 0;
  cursor: zoom-in;
}

.work__img {
  width: 100%;
  box-shadow: var(--hang-shadow);
  transition: transform 0.4s var(--ease);
}

.work__button:hover .work__img {
  transform: translateY(-3px);
}

/* Previous / next section links at the bottom of a gallery */
.section-nav {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  padding-block: var(--space-5) var(--space-6);
  border-top: 1px solid rgba(236, 230, 220, 0.12);
}

.section-nav a {
  text-decoration: none;
}

.section-nav__hint {
  display: block;
  font-size: var(--step--1);
  color: var(--muted);
}

.section-nav__name {
  display: block;
  font-size: var(--step-1);
  font-style: italic;
}

.section-nav__next {
  margin-left: auto;
  text-align: right;
}

/* ==========================================================================
   9. Full-screen viewer (a native <dialog>)
   ========================================================================== */
.viewer {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--viewer-bg);
  color: var(--paper);
}

.viewer::backdrop {
  background: var(--viewer-bg);
}

.viewer[open] {
  display: grid;
  grid-template-rows: 1fr auto;
}

.viewer__stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: var(--space-5) clamp(3.5rem, 8vw, 6rem) var(--space-3);
}

.viewer__img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.9);
}

.viewer__caption {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-3) var(--gutter) var(--space-4);
}

.viewer__caption .label {
  margin-top: 0;
}

.viewer__count {
  font-size: var(--step--1);
  color: var(--muted);
  white-space: nowrap;
}

.viewer__btn {
  position: absolute;
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  padding: 0;
  background: rgba(32, 36, 34, 0.7);
  border: 1px solid rgba(236, 230, 220, 0.25);
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.4rem;
  line-height: 1;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}

.viewer__btn:hover {
  color: var(--brass);
  border-color: var(--brass);
}

.viewer__close {
  top: var(--space-3);
  right: var(--space-3);
}

.viewer__prev,
.viewer__next {
  top: 50%;
  transform: translateY(-50%);
}

.viewer__prev {
  left: var(--space-3);
}

.viewer__next {
  right: var(--space-3);
}

@media (max-width: 760px) {
  .viewer__stage {
    padding: var(--space-6) var(--space-2) var(--space-2);
  }

  .viewer__prev,
  .viewer__next {
    top: auto;
    bottom: var(--space-3);
    transform: none;
  }

  .viewer__caption {
    padding-inline: 4.5rem;
    text-align: center;
    flex-direction: column;
    align-items: center;
    gap: var(--space-1);
  }
}

/* ==========================================================================
   10. About page
   ========================================================================== */
.about__banner {
  width: 100%;
  height: clamp(4rem, 9vw, 7rem);
  object-fit: cover;
  margin-bottom: var(--space-6);
}

.about {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr);
  gap: var(--space-6);
  align-items: start;
  padding-bottom: var(--space-7);
}

.about__portrait {
  margin: 0;
}

.about__portrait img {
  width: 100%;
  box-shadow: var(--hang-shadow);
}

.prose {
  max-width: var(--measure);
  font-size: var(--step-1);
  line-height: 1.65;
}

.prose p + p {
  text-indent: 1.5em;
  margin-top: calc(-1 * var(--space-3));
}

@media (max-width: 860px) {
  .about {
    grid-template-columns: 1fr;
    gap: var(--space-5);
  }

  .about__portrait {
    max-width: 22rem;
  }
}

/* ==========================================================================
   11. Contact page — form
   ========================================================================== */
.form {
  display: grid;
  gap: var(--space-4);
  max-width: 34rem;
  padding-bottom: var(--space-7);
}

.field {
  display: grid;
  gap: var(--space-2);
}

.field__label {
  font-size: var(--step--1);
  color: var(--muted);
}

.field__input,
.field__textarea {
  width: 100%;
  padding: var(--space-3);
  font: inherit;
  color: var(--paper);
  background: var(--wall-deep);
  border: 1px solid rgba(236, 230, 220, 0.18);
  border-radius: 2px;
}

.field__textarea {
  min-height: 10rem;
  resize: vertical;
}

.field__input:focus-visible,
.field__textarea:focus-visible {
  outline-offset: 0;
  border-color: var(--brass);
}

.field__input[aria-invalid="true"],
.field__textarea[aria-invalid="true"] {
  border-color: var(--error);
}

.button {
  justify-self: start;
  padding: var(--space-3) var(--space-5);
  background: var(--paper);
  color: var(--wall-deep);
  border: 0;
  border-radius: 2px;
  cursor: pointer;
  transition: background 0.2s var(--ease);
}

.button:hover {
  background: var(--brass);
}

.button[disabled] {
  opacity: 0.6;
  cursor: progress;
}

.form__status {
  min-height: 1.6em;
  margin: 0;
}

.form__status.is-success {
  color: var(--success);
}

.form__status.is-error {
  color: var(--error);
}

/* ==========================================================================
   12. Footer
   ========================================================================== */
.site-footer {
  background: var(--wall-deep);
  color: var(--muted);
  font-size: var(--step--1);
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-3);
  padding-block: var(--space-4);
}

/* ==========================================================================
   13. Reduced motion — respect the visitor's system setting
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
