/* ==========================================================================
   Art Studio DB — site styles
   A warm, linen-and-umber palette taken from the paintings: rust from the
   old logo, ochre from the autumn birches, sage from the morning mist.
   ========================================================================== */

@font-face {
  font-family: "Cormorant Garamond";
  src: url("../fonts/cormorant-garamond.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Cormorant Garamond";
  src: url("../fonts/cormorant-garamond-italic.woff2") format("woff2");
  font-weight: 300 700;
  font-style: italic;
  font-display: swap;
}

/* ---------- Colour & type tokens ---------- */
:root {
  color-scheme: light dark;

  --linen: #f2e9d6;
  --paper: #fbf6ea;
  --ink: #2f2418;
  --muted: #6e5c45;
  --rust: #a8431b;
  --ochre: #b88426;
  --sage: #6f7d52;
  --line: #cdbb98;
  --mat: #f7f0df;
  --shadow: 40 24 10;
  --grain-opacity: 0.55;

  --gilt: linear-gradient(135deg, #6f4f1f 0%, #c9a35b 22%, #8b6a2f 45%, #e0c27d 62%, #7c5a24 82%, #b48d47 100%);

  --display: "Cormorant Garamond", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --body: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;

  --measure: 74rem;
  --gutter: clamp(1rem, 4vw, 3rem);
}

/* Evening by lamplight */
@media (prefers-color-scheme: dark) {
  :root {
    --linen: #1b1611;
    --paper: #241d16;
    --ink: #eee3cf;
    --muted: #b9a68a;
    --rust: #e07a45;
    --ochre: #d9a644;
    --sage: #a3b07f;
    --line: #4a3c2c;
    --mat: #2c241b;
    --shadow: 0 0 0;
    --grain-opacity: 0.35;
  }
}

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

@view-transition { navigation: auto; }

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--body);
  font-size: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  line-height: 1.6;
  color: var(--ink);
  background-color: var(--linen);
  /* canvas weave + a soft window-light glow from the top */
  background-image:
    radial-gradient(ellipse 120% 60% at 50% -10%, color-mix(in srgb, var(--ochre) 14%, transparent), transparent 70%),
    repeating-linear-gradient(0deg, rgb(var(--shadow) / 0.025) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgb(var(--shadow) / 0.025) 0 1px, transparent 1px 3px);
  background-attachment: fixed, scroll, scroll;
}

/* fine paint grain over everything, never intercepting clicks */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  opacity: var(--grain-opacity);
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .3 0 0 0 0 .2 0 0 0 0 .1 0 0 0 .14 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) {
  body::before { mix-blend-mode: screen; }
}

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

a { color: var(--rust); text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 2px solid var(--rust);
  outline-offset: 4px;
  border-radius: 2px;
}

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 500;
  line-height: 1.1;
  margin: 0;
  text-wrap: balance;
}
h1 { font-size: clamp(2.4rem, 1.6rem + 3.5vw, 4.25rem); letter-spacing: -0.01em; }
h2 { font-size: clamp(1.7rem, 1.3rem + 1.6vw, 2.4rem); }
h3 { font-size: 1.35rem; font-style: italic; }

p { margin: 0 0 1em; }

.eyebrow {
  font-family: var(--display);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--rust);
  margin: 0 0 0.6rem;
}

/* Ornamental divider: a hand-drawn sprig between two hairlines */
hr {
  border: 0;
  height: 1.5rem;
  margin: clamp(2.5rem, 6vw, 4rem) auto;
  max-width: 28rem;
  color: var(--ochre);
  background:
    linear-gradient(currentColor, currentColor) left center / calc(50% - 2.5rem) 1px no-repeat,
    linear-gradient(currentColor, currentColor) right center / calc(50% - 2.5rem) 1px no-repeat;
  position: relative;
  overflow: visible;
}
hr::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 3.5rem;
  height: 1.5rem;
  translate: -50% -50%;
  background: currentColor;
  -webkit-mask: var(--sprig) center / contain no-repeat;
  mask: var(--sprig) center / contain no-repeat;
}
:root {
  --sprig: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 56 24'%3E%3Cpath d='M4 13c12-3 30-3 48 0' fill='none' stroke='%23000' stroke-width='1.3' stroke-linecap='round'/%3E%3Cpath d='M14 12c1-5 5-8 9-8-1 5-4 8-9 8zM22 11.5c2-4 6-6 10-5-2 4-5 6-10 5zM30 11.6c3-3 7-4 10-2-2 3-6 4-10 2zM16 13c2 4 6 6 10 5-2-4-6-6-10-5zM26 13c3 3 7 5 10 3-2-3-6-4-10-3zM36 13c3 2 7 3 9 1-2-2-6-3-9-1z'/%3E%3Ccircle cx='50' cy='12.6' r='1.8'/%3E%3C/svg%3E");
}

/* ---------- Site header ---------- */
.site-header {
  width: min(100% - 2 * var(--gutter), var(--measure));
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 1.75rem) 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--display);
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--rust);
}
/* a little painter's palette */
.brand::before {
  content: "";
  width: 2.1rem;
  aspect-ratio: 1;
  flex: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cpath d='M20 4C9 4 3 11 3 19c0 9 8 16 17 16 3 0 4-2 3-4s0-4 3-4h5c4 0 7-3 7-7C38 11 30 4 20 4zm-6 26a3 3 0 1 1 0-.01z' fill='%23b98a4e'/%3E%3Cpath d='M20 4C9 4 3 11 3 19c0 9 8 16 17 16' fill='none' stroke='%237a5524' stroke-width='1.2'/%3E%3Ccircle cx='12' cy='15' r='3' fill='%23a8431b'/%3E%3Ccircle cx='20' cy='10.5' r='3' fill='%23d9a644'/%3E%3Ccircle cx='28.5' cy='13' r='3' fill='%236f7d52'/%3E%3Ccircle cx='31' cy='21' r='2.6' fill='%234d6a8a'/%3E%3C/svg%3E") center / contain no-repeat;
  rotate: -12deg;
}

.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.75rem;
}
.site-nav a {
  font-family: var(--display);
  font-size: 1.3rem;
  font-style: italic;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  padding: 0.2rem 0;
  background: linear-gradient(var(--ochre), var(--ochre)) left 100% / 0 2px no-repeat;
  transition: background-size 0.3s ease, color 0.2s;
}
.site-nav a:hover { color: var(--ink); background-size: 100% 2px; }
.site-nav a[aria-current="page"] { color: var(--ink); background-size: 100% 2px; background-image: linear-gradient(var(--rust), var(--rust)); }

/* ---------- Main & footer ---------- */
main {
  flex: 1;
  width: min(100% - 2 * var(--gutter), var(--measure));
  margin: 0 auto;
  padding-block: clamp(2rem, 5vw, 4rem) 0;
}

.page-intro {
  text-align: center;
  margin-bottom: clamp(2rem, 5vw, 3.5rem);
}
.page-intro p:not(.eyebrow) {
  max-width: 38rem;
  margin: 1rem auto 0;
  color: var(--muted);
  font-style: italic;
}

.site-footer {
  width: min(100% - 2 * var(--gutter), var(--measure));
  margin: 0 auto;
  padding-bottom: 2.5rem;
  text-align: center;
  color: var(--muted);
  font-family: var(--display);
  font-size: 1.15rem;
  letter-spacing: 0.06em;
}
.site-footer p { margin: 0; }

/* ---------- Framed paintings ---------- */
/* Any <img> inside .painting or .salon gets a gilt frame and a linen mat. */
.painting img,
.salon img {
  padding: clamp(5px, 1.2vw, 10px);
  background: var(--mat);
  border: clamp(7px, 1.4vw, 13px) solid transparent;
  border-image: var(--gilt) 1;
  box-shadow:
    inset 0 0 0 1px rgb(0 0 0 / 0.12),
    inset 0 2px 6px rgb(var(--shadow) / 0.25),
    0 1px 1px rgb(var(--shadow) / 0.25),
    0 14px 28px -10px rgb(var(--shadow) / 0.55);
  transition: translate 0.35s ease, box-shadow 0.35s ease;
}
.painting a:hover img,
.salon a:hover img {
  translate: 0 -4px;
  box-shadow:
    inset 0 0 0 1px rgb(0 0 0 / 0.12),
    inset 0 2px 6px rgb(var(--shadow) / 0.25),
    0 1px 1px rgb(var(--shadow) / 0.25),
    0 22px 36px -12px rgb(var(--shadow) / 0.6);
}

/* ---------- Gallery pages ---------- */
.gallery-section + .gallery-section { margin-top: clamp(3rem, 7vw, 5rem); }

.gallery-section > h2 {
  text-align: center;
  margin-bottom: clamp(1.5rem, 4vw, 2.5rem);
}
.gallery-section > h2::after {
  content: "";
  display: block;
  width: 3rem;
  height: 2px;
  margin: 0.75rem auto 0;
  background: var(--ochre);
}

/* paintings wrap into centred rows, so a lone painting hangs in the middle */
.gallery {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(2.5rem, 5vw, 3.5rem) clamp(1.5rem, 4vw, 3rem);
}
.gallery .painting { flex: 0 1 21rem; }

.painting {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* every painting hangs in the same height "slot" so captions line up */
.gallery .painting > a {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 100%;
  height: clamp(15rem, 28vw, 19rem);
  cursor: zoom-in;
}
.gallery .painting img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
}

/* the little museum label */
.painting figcaption {
  margin-top: 1.25rem;
  padding: 0.6rem 1.1rem 0.7rem;
  min-width: 13rem;
  max-width: 100%;
  text-align: center;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: 0 3px 8px -4px rgb(var(--shadow) / 0.35);
}
.painting figcaption h3 { margin-bottom: 0.3rem; }
.painting figcaption p {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.5;
  letter-spacing: 0.04em;
  color: var(--muted);
}

/* ---------- Home ---------- */
.hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}
@media (min-width: 50rem) {
  .hero { grid-template-columns: 1fr 1.15fr; }
}
.hero h1 span { display: block; font-style: italic; color: var(--rust); }
.hero .lede {
  font-size: 1.15em;
  color: var(--muted);
  max-width: 30rem;
  margin-top: 1.25rem;
}
.hero .painting { rotate: 0.6deg; }
.hero .painting figcaption {
  font-family: var(--display);
  font-style: italic;
  font-size: 1.2rem;
  min-width: 0;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  margin-top: 2rem;
}
.button {
  display: inline-block;
  padding: 0.65rem 1.4rem;
  font-family: var(--display);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-decoration: none;
  color: var(--paper);
  background: var(--rust);
  border: 1px solid var(--rust);
  border-radius: 2px;
  box-shadow: 0 6px 14px -8px rgb(var(--shadow) / 0.6);
  transition: translate 0.2s, box-shadow 0.2s;
}
.button:hover { translate: 0 -2px; box-shadow: 0 10px 18px -8px rgb(var(--shadow) / 0.6); }
.button.quiet { color: var(--rust); background: transparent; }
@media (prefers-color-scheme: dark) {
  .button:not(.quiet) { color: #1b1611; }
}

/* salon hang: frames of varied sizes, loosely centred like a studio wall */
.salon > h2 { text-align: center; margin-bottom: 2.5rem; }
.salon ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: clamp(1.25rem, 3.5vw, 2.75rem);
}
.salon li { --h: 12rem; }
.salon li:nth-child(3n + 1) { --h: 15rem; }
.salon li:nth-child(4n + 2) { --h: 10rem; }
.salon li:nth-child(5n + 3) { --h: 13.5rem; }
.salon img { height: var(--h); width: auto; max-width: 100%; object-fit: cover; }
.salon a { display: block; }
@media (max-width: 40rem) {
  .salon li { --h: 8rem !important; }
}

/* ---------- Contact ---------- */
.contact {
  max-width: 34rem;
  margin: 0 auto;
  text-align: center;
  padding: clamp(1.5rem, 5vw, 3rem);
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: 0 18px 36px -24px rgb(var(--shadow) / 0.6);
}
.contact h1 { margin-bottom: 1.5rem; }
.contact address { font-style: normal; font-size: 1.15em; }

/* ---------- Painting viewer (built by js/gallery.js) ---------- */
.viewer {
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: clamp(0.75rem, 3vw, 2rem);
  border: 0;
  color: #efe5d2;
  background: transparent;
  overflow: hidden;
}
.viewer::backdrop {
  background: rgb(20 15 10 / 0.9);
  backdrop-filter: blur(4px);
}
.viewer[open] {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.5rem;
}
.viewer figure {
  margin: 0;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}
.viewer img {
  min-height: 0;
  max-height: calc(100dvh - 10rem);
  width: auto;
  object-fit: contain;
  border: clamp(8px, 1.6vw, 16px) solid transparent;
  border-image: var(--gilt) 1;
  box-shadow: 0 30px 60px -20px #000;
}
.viewer figcaption { text-align: center; }
.viewer figcaption h3 { font-size: 1.6rem; }
.viewer figcaption p { margin: 0.2rem 0 0; color: #b9a68a; font-size: 0.9rem; }
.viewer button {
  appearance: none;
  border: 1px solid rgb(239 229 210 / 0.25);
  background: rgb(0 0 0 / 0.3);
  color: inherit;
  width: 3rem;
  aspect-ratio: 1;
  border-radius: 50%;
  font: 400 1.9rem/1 var(--display);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.viewer button:hover { background: var(--rust); border-color: var(--rust); }
.viewer .viewer-close {
  position: absolute;
  top: clamp(0.75rem, 2vw, 1.5rem);
  right: clamp(0.75rem, 2vw, 1.5rem);
}
.viewer button[hidden] { visibility: hidden; display: block; }
@media (max-width: 40rem) {
  .viewer[open] { grid-template-columns: 1fr; }
  .viewer .viewer-prev,
  .viewer .viewer-next { position: absolute; bottom: 1rem; }
  .viewer .viewer-prev { left: 1rem; }
  .viewer .viewer-next { right: 1rem; }
  .viewer img { max-height: calc(100dvh - 13rem); }
}

/* ---------- Motion & print ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
  @view-transition { navigation: none; }
}

@media print {
  body::before, .site-nav { display: none; }
  body { background: none; }
  .gallery .painting > a { height: auto; }
}
