/* ==========================================================================
   Scott Parsons Artworks - style.css
   Base, layout and shared components. Brand tokens live in theme.css,
   page-specific layouts in pages.css.
   ========================================================================== */

/* ---------- Reset and base ---------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  color-scheme: dark;
  scroll-padding-top: var(--header-h);
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--ink);
  /* faint canvas grain */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  color: var(--gesso);
  font-family: var(--font-text);
  font-size: var(--step-0);
  font-weight: 400;
  line-height: 1.6;
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}

img, picture, svg, video, canvas { display: block; max-width: 100%; }
img { height: auto; }
picture { background-color: var(--c, transparent); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
p, h1, h2, h3, h4, ul, ol, dl, dd, figure, blockquote { margin: 0; }
ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

p { text-wrap: pretty; }

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: color 0.2s, text-decoration-color 0.2s;
}
a:hover { color: var(--cadmium); }

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

::selection { background: var(--cadmium); color: var(--ink); }

main:focus { outline: none; }

.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: fixed;
  left: 1rem; top: 1rem;
  z-index: 200;
  padding: 0.6rem 1rem;
  background: var(--cadmium);
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-200%);
  transition: transform 0.2s;
}
.skip-link:focus { transform: none; color: var(--ink); }

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

.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 60;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding: 0 var(--gutter);
  view-transition-name: site-header;
  transition: background-color 0.4s, backdrop-filter 0.4s, height 0.4s var(--ease-out);
}
.site-header::after {
  content: "";
  position: absolute;
  inset: auto var(--gutter) 0;
  height: 1px;
  background: var(--line);
  opacity: 0;
  transition: opacity 0.4s;
}
.site-header.is-scrolled {
  background-color: rgb(14 31 69 / 0.78);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
  height: 4.25rem;
}
.site-header.is-scrolled::after { opacity: 1; }

.brand { display: block; flex: none; }
.brand img { width: auto; height: 2.1rem; transition: height 0.4s var(--ease-out); }
.is-scrolled .brand img { height: 1.8rem; }

.site-nav ul { display: flex; gap: clamp(1.25rem, 3vw, 2.75rem); list-style: none; margin: 0; padding: 0; }
.site-nav a {
  position: relative;
  display: inline-block;
  padding: 0.4rem 0;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
}
.site-nav a::after {
  content: "";
  position: absolute;
  left: -2%;
  bottom: 0;
  width: 104%;
  height: 0.32em;
  border-radius: 40% 60% 55% 45% / 60% 40% 60% 40%;
  background: var(--cadmium);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.45s var(--ease-paint);
  z-index: -1;
}
.site-nav a:hover { color: var(--gesso); }
.site-nav a:hover::after,
.site-nav a[aria-current="page"]::after { transform: scaleX(1); }
.site-nav a[aria-current="page"]::after { opacity: 0.9; }

.menu-button {
  display: none;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.9rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgb(14 31 69 / 0.4);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
}
.menu-button__lines {
  width: 1.1rem; height: 0.55rem;
  border-top: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
}

.menu-panel {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 5.5rem var(--gutter) 2rem;
  border: 0;
  background: var(--ink-deep);
  color: var(--gesso);
}
.menu-panel::backdrop { background: transparent; }
.menu-panel[open] { display: flex; flex-direction: column; }
.menu-panel ul { list-style: none; padding: 0; margin: 0; }
.menu-panel li a {
  display: block;
  padding: 0.2rem 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.75rem, 13vw, 5rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  text-decoration: none;
}
.menu-panel li a[aria-current="page"] { color: var(--cadmium); }
.menu-panel__close {
  position: absolute;
  top: 1.1rem; right: var(--gutter);
  padding: 0.55rem 0.9rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  font-family: var(--font-display);
  font-weight: 600;
}
.menu-panel__meta { margin-top: auto; color: var(--gesso-dim); }

@media (prefers-reduced-motion: no-preference) {
  .menu-panel[open] { animation: menu-pour 0.6s var(--ease-paint) both; }
  .menu-panel[open] li { animation: rise-in 0.6s var(--ease-out) both; animation-delay: calc(0.12s + var(--li, 0) * 0.05s); }
  .menu-panel li:nth-child(2) { --li: 1; }
  .menu-panel li:nth-child(3) { --li: 2; }
  .menu-panel li:nth-child(4) { --li: 3; }
  .menu-panel li:nth-child(5) { --li: 4; }
}
@keyframes menu-pour {
  from { clip-path: circle(0% at var(--mx, 92%) var(--my, 4%)); }
  to { clip-path: circle(150% at var(--mx, 92%) var(--my, 4%)); }
}
@keyframes rise-in {
  from { opacity: 0; transform: translateY(0.6em); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 760px) {
  .site-nav { display: none; }
  .menu-button { display: inline-flex; }
  .brand img { height: 1.75rem; }
}

/* ---------- Buttons and links ---------- */

.button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  min-height: 3rem;
  padding: 0.8rem 1.5rem;
  border: 1.5px solid var(--gesso);
  border-radius: 999px;
  background: transparent;
  color: var(--gesso);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.1;
  text-decoration: none;
  overflow: hidden;
  isolation: isolate;
  transition: color 0.35s var(--ease-out), border-color 0.35s, transform 0.2s;
}
.button::before {
  content: "";
  position: absolute;
  inset: -2px;
  z-index: -1;
  background: var(--gesso);
  border-radius: inherit;
  transform: translateY(102%);
  transition: transform 0.45s var(--ease-paint);
}
.button:hover { color: var(--ink); }
.button:hover::before { transform: none; }
.button:active { transform: scale(0.98); }

.button--paint {
  border-color: var(--cadmium);
  background: var(--cadmium);
  color: var(--ink);
}
.button--paint::before { background: var(--gesso); }
.button--paint:hover { color: var(--ink); border-color: var(--gesso); }

.button--ghost { border-color: var(--line-strong); }

.text-link {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  text-decoration: underline;
  text-decoration-color: var(--cadmium);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.35em;
}
.text-link:hover { color: var(--cadmium); }

/* ---------- Section scaffolding ---------- */

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem 2rem;
  flex-wrap: wrap;
  margin: 0 auto clamp(2rem, 5vw, 4rem);
  padding: 0 var(--gutter);
  max-width: var(--max);
}
.section-head h2 { font-size: clamp(1.9rem, 4vw, 3.6rem); font-weight: 800; letter-spacing: -0.035em; }

.page-head {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  align-items: end;
  gap: 1.5rem 4vw;
  max-width: var(--max);
  margin: 0 auto;
  padding: calc(var(--header-h) + clamp(3rem, 9vw, 7rem)) var(--gutter) clamp(2rem, 4vw, 3rem);
}
.page-head h1 {
  font-size: clamp(2.75rem, 6.4vw, 6.75rem);
  font-weight: 800;
  line-height: 0.86;
  letter-spacing: -0.045em;
}
.page-head__intro p { max-width: 34ch; color: var(--gesso-dim); font-size: var(--step-1); line-height: 1.45; }
.crumbs { margin-bottom: 1rem; color: var(--gesso-dim); font-family: var(--font-display); font-size: 0.95rem; font-weight: 600; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.crumbs span { margin: 0 0.4em; opacity: 0.6; }

@media (max-width: 760px) {
  .page-head { grid-template-columns: 1fr; }
}

.empty {
  max-width: var(--max);
  margin: 0 auto;
  padding: 4rem var(--gutter) 8rem;
  color: var(--gesso-dim);
  font-size: var(--step-1);
}
.empty p + p { margin-top: 1rem; }

/* ---------- Filters ---------- */

.filters {
  max-width: var(--max);
  margin: 0 auto clamp(2rem, 4vw, 3.5rem);
  padding: 0 var(--gutter);
}
.filters ul { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.chip {
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.55rem 1.05rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}
.chip:hover { border-color: var(--gesso); color: var(--gesso); }
.chip[aria-current="page"] { background: var(--gesso); border-color: var(--gesso); color: var(--ink); }
.chip__n { font-family: var(--font-text); font-weight: 400; opacity: 0.7; font-variant-numeric: tabular-nums; }

@media (max-width: 600px) {
  .filters ul { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 calc(var(--gutter) * -1); padding: 0 var(--gutter) 0.25rem; }
  .filters ul::-webkit-scrollbar { display: none; }
  .chip { white-space: nowrap; }
}

/* ---------- Wall labels ---------- */

.label {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.15rem 0.6rem;
  margin-top: 0.85rem;
  font-size: 1rem;
  line-height: 1.35;
}
.label__title { font-style: normal; font-weight: 500; }
.label__title.is-catalog { font-style: normal; color: var(--gesso); }
.label__meta { color: var(--gesso-dim); font-size: 0.9375rem; }
.label__meta::before { content: ""; }

.dot {
  display: inline-block;
  width: 0.62rem;
  height: 0.62rem;
  border-radius: 50%;
  align-self: center;
  flex: none;
}
.dot--sold { background: var(--sold); }
.dot--available { border: 2px solid var(--cadmium); }

/* ---------- Justified gallery wall ----------
   Every row is filled edge to edge while each work keeps its own
   proportions: nothing is cropped. */

.wall {
  --row: clamp(200px, 26vw, 380px);
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: clamp(2rem, 4vw, 3.5rem) clamp(1rem, 2vw, 1.75rem);
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter) clamp(5rem, 10vw, 9rem);
}
.wall::after { content: ""; flex: 10000 1 0; }

.piece {
  flex: calc(var(--ar) * 1000) 1 calc(var(--ar) * var(--row));
  min-width: 0;
}
.piece__link { display: block; text-decoration: none; }
.piece picture { width: 100%; aspect-ratio: var(--ar); overflow: hidden; }
.piece img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.9s var(--ease-out), filter 0.6s;
}
.piece__link:hover img { transform: scale(1.025); }
.piece__link:hover + .label .label__title { color: var(--cadmium); }

@media (max-width: 1100px) { .wall { --row: clamp(180px, 30vw, 300px); } }
@media (max-width: 600px) {
  .wall { --row: 46vw; gap: 2.25rem 0.75rem; }
  .piece { flex-basis: calc(var(--ar) * var(--row)); }
}

/* Paint-spreading reveal as works scroll into view */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .wall .piece picture,
    .reveal {
      animation: pour-in linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 55%;
    }
  }
}
@keyframes pour-in {
  from { clip-path: circle(14% at 32% 70%); filter: saturate(0.4); }
  to { clip-path: circle(142% at 32% 70%); filter: none; }
}

/* ---------- Prose ---------- */

.prose { max-width: 66ch; font-size: var(--step-1); line-height: 1.65; }
.prose > * + * { margin-top: 1.1em; }
.prose h2 { margin-top: 2em; font-size: var(--step-3); }
.prose h3 { margin-top: 1.8em; font-size: var(--step-2); }
.prose h4 { margin-top: 1.6em; font-size: var(--step-1); }
.prose a { text-decoration-color: var(--cadmium); }
.prose ul, .prose ol { padding-left: 1.2em; }
.prose li + li { margin-top: 0.35em; }
.prose blockquote { padding-left: 1.2em; border-left: 3px solid var(--cadmium); font-style: italic; }
.prose hr { border: 0; height: 1px; background: var(--line); margin: 2.5em 0; }
.prose strong { font-weight: 650; }

/* ---------- Forms ---------- */

.form { display: grid; gap: 1.5rem; }
.field { display: grid; gap: 0.45rem; }
.field label, .field legend {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
}
.field__opt { color: var(--gesso-dim); font-weight: 400; margin-left: 0.3em; }
.field input, .field textarea, .field select {
  width: 100%;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--ink-raised);
  color: var(--gesso);
  font-size: 1.0625rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field textarea { resize: vertical; min-height: 10rem; line-height: 1.5; }
.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--cadmium);
  box-shadow: 0 0 0 3px rgb(245 190 59 / 0.25);
}
.field [aria-invalid="true"] { border-color: #ff8c7a; }
.field__error { color: #ffb4a8; font-size: 0.95rem; }
.field--hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.field--choices { border: 0; padding: 0; margin: 0; }
.field--choices legend { margin-bottom: 0.6rem; padding: 0; }
.choices { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.choice { position: relative; display: inline-flex; cursor: pointer; }
.choice input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.choice span {
  padding: 0.55rem 1rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 1rem;
  transition: background-color 0.25s, color 0.25s, border-color 0.25s;
}
.choice:hover span { border-color: var(--gesso); }
.choice input:checked + span { background: var(--cadmium); border-color: var(--cadmium); color: var(--ink); }
.choice input:focus-visible + span { outline: 2px solid var(--cadmium); outline-offset: 3px; }
.form__note { color: var(--gesso-dim); font-size: 0.95rem; }

.notice { padding: 1.25rem 1.4rem; border-radius: var(--radius); border: 1px solid var(--line-strong); }
.notice:focus { outline: none; }
.notice h2 { font-size: var(--step-3); margin-bottom: 0.6rem; }
.notice p + p { margin-top: 0.75rem; }
.notice--ok { border-color: var(--cadmium); }
.notice--error { border-color: #ff8c7a; background: rgb(229 65 45 / 0.1); }

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

.site-footer {
  position: relative;
  padding: clamp(4rem, 9vw, 8rem) var(--gutter) 2rem;
  background: var(--ink-deep);
  border-top: 1px solid var(--line);
}
.footer-cta {
  display: block;
  max-width: var(--max);
  margin: 0 auto clamp(3rem, 7vw, 6rem);
  text-decoration: none;
}
.footer-cta__text {
  display: inline;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2rem, 8.6vw, 9rem);
  line-height: 0.9;
  overflow-wrap: anywhere;
  letter-spacing: -0.045em;
  background-image: linear-gradient(var(--cadmium), var(--cadmium));
  background-repeat: no-repeat;
  background-size: 0% 0.12em;
  background-position: 0 92%;
  transition: background-size 0.7s var(--ease-paint), color 0.3s;
}
.footer-cta:hover { color: var(--gesso); }
.footer-cta:hover .footer-cta__text { background-size: 100% 0.12em; }

.footer-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2rem;
  max-width: var(--max);
  margin: 0 auto;
  padding-top: 2rem;
  border-top: 1px solid var(--line);
}
.footer-label { margin-bottom: 0.6rem; color: var(--gesso-dim); font-family: var(--font-display); font-size: 0.875rem; font-weight: 600; }
.footer-col ul { list-style: none; margin: 0; padding: 0; }
.footer-col a { text-decoration: none; }
.footer-col a:hover { text-decoration: underline; }
.footer-base {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem 2rem;
  max-width: var(--max);
  margin: 3rem auto 0;
  color: var(--gesso-dim);
  font-size: 0.9rem;
}

@media (max-width: 760px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-grid > :first-child { grid-column: 1 / -1; }
}

/* ---------- Contextual cursor (mouse only) ---------- */

.cursor {
  position: fixed;
  left: 0; top: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  width: 5.5rem;
  height: 5.5rem;
  margin: -2.75rem 0 0 -2.75rem;
  border-radius: 50%;
  background: var(--cadmium);
  color: var(--ink);
  pointer-events: none;
  opacity: 0;
  transform: translate3d(var(--x, -100px), var(--y, -100px), 0) scale(0.2);
  transition: opacity 0.25s, transform 0.35s var(--ease-out);
  will-change: transform;
}
.cursor.is-on { opacity: 1; transform: translate3d(var(--x), var(--y), 0) scale(var(--s, 1)) rotate(var(--r, 0deg)); transition: opacity 0.25s; }
.cursor__label { font-family: var(--font-display); font-size: 0.95rem; font-weight: 700; }
.has-cursor [data-cursor] { cursor: none; }
@media (hover: none), (pointer: coarse), (prefers-reduced-motion: reduce) {
  .cursor { display: none; }
  .has-cursor [data-cursor] { cursor: pointer; }
}

/* ---------- Page transitions ---------- */

@view-transition { navigation: auto; }

@media (prefers-reduced-motion: no-preference) {
  ::view-transition-old(root) { animation: 0.35s var(--ease-out) both vt-out; }
  ::view-transition-new(root) { animation: 0.55s var(--ease-out) 0.05s both vt-in; }
  ::view-transition-group(*) { animation-duration: 0.6s; animation-timing-function: var(--ease-out); }
}
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}
@keyframes vt-out { to { opacity: 0; filter: blur(6px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(14px); } }

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* Email address revealed on click */
button.email-reveal {
  -webkit-appearance: none;
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0;
  padding: 0.6rem 1.15rem;
  border: 1px solid var(--cadmium);
  border-radius: 999px;
  background: transparent;
  color: var(--gesso);
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.3s var(--ease-out), color 0.3s var(--ease-out), transform 0.3s var(--ease-out);
}
button.email-reveal::after {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.3s var(--ease-out);
}
button.email-reveal:hover,
button.email-reveal:focus-visible {
  background: var(--cadmium);
  color: var(--ink);
}
button.email-reveal:hover::after,
button.email-reveal:focus-visible::after { transform: translateX(3px) rotate(45deg); }
button.email-reveal:focus-visible { outline: 2px solid var(--cadmium); outline-offset: 3px; }
button.email-reveal[aria-busy="true"] { opacity: 0.7; cursor: progress; }
button.email-reveal[data-failed] { border-color: var(--sold); }
.footer-col button.email-reveal { margin-bottom: 0.5rem; }
.email-reveal-note { margin-top: 0.5rem; color: var(--gesso-dim); font-size: 0.9rem; }
a.email-revealed { font-weight: 600; text-decoration-color: var(--cadmium); text-decoration-thickness: 2px; text-underline-offset: 0.3em; overflow-wrap: anywhere; }
