/* Ben Roberts — site styles
   Colours are named after the acrylics on Ben's palette. */

:root {
  --gesso: #f3f4f1;          /* page: primed board */
  --paynes: #2a3640;         /* body text: Payne's grey */
  --paynes-soft: #56626c;    /* secondary text */
  --prussian: #1e3a5c;       /* display type: Prussian blue */
  --gabbro: #33393e;         /* contact + footer: Cuillin rock */
  --night: #1d252c;          /* painting viewer */
  --cadmium: #c4471f;        /* buttons, current page */
  --cadmium-light: #f08a5d;  /* focus and errors on dark rock */
  --on-dark: #eef0ee;
  --on-dark-soft: #aab3b9;

  --display: "Archivo", "Arial Narrow", system-ui, sans-serif;
  --text: "Newsreader", Georgia, "Times New Roman", serif;

  --ridge-shape: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 768 96' preserveAspectRatio='none'%3E%3Cpath d='M0 85.9 3 85.9 6 85.0 9 84.9 12 84.0 15 83.6 18 82.9 21 82.6 24 81.2 27 80.0 30 79.9 33 79.0 36 78.9 39 78.0 42 77.9 45 77.9 48 77.9 51 77.9 54 77.9 57 77.9 60 77.9 63 79.7 66 81.9 69 82.6 72 83.2 75 83.9 78 83.6 81 82.9 84 82.9 87 83.1 90 84.8 93 84.9 96 84.6 99 83.9 102 88.2 105 92.3 108 90.9 111 87.2 114 81.9 117 80.1 120 77.6 123 72.4 126 69.2 129 67.2 132 63.0 135 58.5 138 56.2 141 54.9 144 54.0 147 52.6 150 50.2 153 49.9 156 48.9 159 46.7 162 44.6 165 43.0 168 49.5 171 55.7 174 37.4 177 35.9 180 35.9 183 35.9 186 34.5 189 32.9 192 32.9 195 33.0 198 29.7 201 25.4 204 25.3 207 25.5 210 22.2 213 17.1 216 16.2 219 15.0 222 15.6 225 16.6 228 21.0 231 24.1 234 28.5 237 30.6 240 31.2 243 31.8 246 30.1 249 30.1 252 32.6 255 34.9 258 36.6 261 37.8 264 40.2 267 42.5 270 44.0 273 46.8 276 45.3 279 41.0 282 41.8 285 49.2 288 43.5 291 30.0 294 38.4 297 57.8 300 57.6 303 56.6 306 48.3 309 31.8 312 29.9 315 27.2 318 25.8 321 22.8 324 20.7 327 19.2 330 18.0 333 17.9 336 17.2 339 16.9 342 16.9 345 17.0 348 20.9 351 27.8 354 25.1 357 21.0 360 19.0 363 17.9 366 15.9 369 13.6 372 10.3 375 8.6 378 7.6 381 5.7 384 3.9 387 2.2 390 2.3 393 4.6 396 6.9 399 7.6 402 6.2 405 10.6 408 31.8 411 33.6 414 33.6 417 31.2 420 29.9 423 27.9 426 24.9 429 22.3 432 20.9 435 17.3 438 15.6 441 14.6 444 13.6 447 12.3 450 11.0 453 11.9 456 12.7 459 14.0 462 16.5 465 18.1 468 20.8 471 20.6 474 19.2 477 19.7 480 20.9 483 21.9 486 21.9 489 22.6 492 24.9 495 24.9 498 23.6 501 21.9 504 21.6 507 18.7 510 16.9 513 16.9 516 16.4 519 11.1 522 8.1 525 5.1 528 4.0 531 3.6 534 2.9 537 3.6 540 3.9 543 3.0 546 3.9 549 5.9 552 7.2 555 8.6 558 8.9 561 8.9 564 7.9 567 6.3 570 6.0 573 6.9 576 7.6 579 7.2 582 6.9 585 6.9 588 7.9 591 8.3 594 6.9 597 7.0 600 7.9 603 7.9 606 7.9 609 8.2 612 8.6 615 8.2 618 8.2 621 7.2 624 6.9 627 6.9 630 6.9 633 6.9 636 6.9 639 7.6 642 11.3 645 13.6 648 15.0 651 27.1 654 28.0 657 19.6 660 28.3 663 26.5 666 21.0 669 20.9 672 20.9 675 20.3 678 20.1 681 16.9 684 15.9 687 15.2 690 14.9 693 16.3 696 16.9 699 16.3 702 15.0 705 16.6 708 18.1 711 21.9 714 23.9 717 25.2 720 29.9 723 42.3 726 53.6 729 55.8 732 43.9 735 36.2 738 35.9 741 35.9 744 35.9 747 35.0 750 34.9 753 34.2 756 33.9 759 33.9 762 33.9 765 33.9 767 33.9 768 33.9 L768 96 L0 96 Z'/%3E%3C/svg%3E");
  --rock-grain: 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='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0.11 0 0 0 -0.02'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url%28%23n%29'/%3E%3C/svg%3E");

  --gutter: clamp(1.25rem, 4vw, 3rem);
  --measure: 34em;
}

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

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

body {
  margin: 0;
  background: var(--gesso);
  color: var(--paynes);
  font-family: var(--text);
  font-size: 1.125rem;
  line-height: 1.6;
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
}

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

a { color: inherit; text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

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

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap;
}

.skip {
  position: absolute; left: var(--gutter); top: -4rem; z-index: 20;
  background: var(--gesso); color: var(--paynes);
  padding: 0.6rem 1rem; font-family: var(--display); font-weight: 600;
}
.skip:focus { top: 1rem; }

/* ---------- Navigation ---------- */

.nav {
  display: flex;
  gap: clamp(1.25rem, 3vw, 2.25rem);
  font-family: var(--display);
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.2;
}
.nav a {
  text-decoration: none;
  padding: 0.35rem 0;
  border-bottom: 2px solid transparent;
}
.nav a:hover { border-bottom-color: currentColor; }
.nav a[aria-current="page"] { border-bottom-color: var(--cadmium); }

/* ---------- Hero ---------- */

.hero {
  position: relative;
  height: 100vh;
  height: 100svh;
  min-height: 34rem;
  overflow: hidden;
  background: #9bbbe2; /* shows while the photo loads */
}
.hero-photo {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center; /* e.g. "center 30%" to change which part is cropped */
}
.hero::before { /* shade at the top so the title and menu read over any photo */
  content: "";
  position: absolute; left: 0; right: 0; top: 0; z-index: 1;
  height: 12rem;
  background: linear-gradient(to bottom, rgb(18 30 45 / 0.5), rgb(18 30 45 / 0));
  pointer-events: none;
}
.hero::after { /* keeps the intro line readable */
  content: "";
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 38%;
  background: linear-gradient(to top, rgb(22 29 35 / 0.6), rgb(22 29 35 / 0));
  pointer-events: none;
}
.hero .nav {
  position: absolute; top: 0; right: 0; z-index: 2;
  padding: 1.4rem var(--gutter);
  color: #fff;
  text-shadow: 0 1px 8px rgb(10 25 45 / 0.35);
}
.hero-title {
  position: absolute; left: 0; z-index: 2;
  top: clamp(5.5rem, 16vh, 10rem);   /* raise or lower the title here */
  margin: 0;
  padding: 0 var(--gutter);          /* same left edge as the intro line */
  font-family: var(--text);          /* the serif used for "I paint the mountains I climb." */
  font-weight: 400;
  font-size: clamp(1.6rem, 5.2vw, 3.5rem);
  line-height: 1.05;
  letter-spacing: -0.015em;
  color: #fff;
  text-shadow: 0 1px 14px rgb(10 25 45 / 0.45);
}
@media (max-width: 600px) {
  .hero-title { font-size: clamp(2.2rem, 12vw, 3.5rem); }
  .hero-title span { display: block; }
}
.hero .nav a[aria-current="page"] { border-bottom-color: #f08a5d; }
.hero :focus-visible { outline-color: #fff; }
.hero-intro {
  position: absolute; left: 0; bottom: 0; z-index: 2;
  margin: 0;
  padding: var(--gutter);
  max-width: 30ch;
  color: #fff;
  font-style: italic;
  font-size: clamp(1.25rem, 2.2vw, 1.75rem);
  line-height: 1.25;
  text-shadow: 0 1px 14px rgb(0 0 0 / 0.35);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* ---------- About ---------- */

.about {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 7fr);
  gap: clamp(2.5rem, 6vw, 6rem);
  align-items: center;
  max-width: 96rem;
  margin: 0 auto;
  padding: clamp(4.5rem, 11vw, 9rem) var(--gutter) clamp(6rem, 14vw, 11rem);
}
.about-photo { margin: 0; }
.about-photo img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; }
.about-photo figcaption {
  margin-top: 0.75rem;
  font-family: var(--display);
  font-size: 0.875rem;
  color: var(--paynes-soft);
}
.about-text h2 {
  margin: 0 0 1.75rem;
  font-family: var(--text);
  font-weight: 400;
  font-size: clamp(1.9rem, 3.4vw, 2.9rem);
  line-height: 1.12;
  letter-spacing: -0.015em;
  color: var(--prussian);
}
.about-text p { max-width: 44em; margin: 0 0 1.1em; }
.about-text .to-paintings {
  margin-top: 2rem;
  font-family: var(--display);
  font-size: 1.0625rem;
  font-weight: 600;
}
.about-text .to-paintings a {
  text-decoration: none;
  border-bottom: 2px solid var(--cadmium);
  padding-bottom: 0.15rem;
}
.about-text .to-paintings a:hover { color: var(--cadmium); }

@media (max-width: 760px) {
  .about { grid-template-columns: 1fr; }
  .about-photo { max-width: 26rem; }
}

/* ---------- Rock: dark gabbro with a fine grain, topped by the Cuillin skyline ---------- */

.rock {
  position: relative;
  background-color: var(--gabbro);
  background-image: var(--rock-grain);
}
/* The skyline is traced from one of Ben's photos of the Cuillin ridge */
.ridge-top::before {
  content: "";
  position: absolute; left: 0; right: 0; bottom: calc(100% - 1px);
  height: clamp(48px, 9vw, 140px);
  background-color: var(--gabbro);
  background-image: var(--rock-grain);
  -webkit-mask: var(--ridge-shape) center bottom / 100% 100% no-repeat;
          mask: var(--ridge-shape) center bottom / 100% 100% no-repeat;
  pointer-events: none;
}

/* ---------- Contact ---------- */

.contact {
  color: var(--on-dark);
  --cadmium: #e0602f;
}
.contact :focus-visible { outline-color: var(--cadmium-light); }
.contact-inner {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(2.5rem, 7vw, 7rem);
  max-width: 76rem;
  margin: 0 auto;
  padding: clamp(3rem, 7vw, 6rem) var(--gutter) clamp(4rem, 8vw, 7rem);
}
.contact h2 {
  margin: 0 0 1.25rem;
  font-family: var(--display);
  font-weight: 800;
  font-stretch: 75%;
  font-size: clamp(3rem, 7vw, 5.5rem);
  line-height: 0.92;
  color: #fff;
}
.contact-intro p { margin: 0 0 2.5rem; max-width: 24em; color: var(--on-dark); }
.contact-links { margin: 0; display: grid; gap: 1.5rem; font-family: var(--display); }
.contact-links dt { font-size: 0.875rem; color: var(--on-dark-soft); margin-bottom: 0.2rem; }
.contact-links dd { margin: 0; font-size: clamp(1.125rem, 1.8vw, 1.375rem); font-weight: 500; overflow-wrap: anywhere; }
.contact-links a { text-decoration-color: rgb(255 255 255 / 0.4); }
.contact-links a:hover { text-decoration-color: currentColor; }

.contact-form { display: grid; gap: 1.4rem; align-content: start; }
.field label {
  display: block;
  margin-bottom: 0.45rem;
  font-family: var(--display);
  font-size: 0.9375rem;
  font-weight: 500;
}
.field input, .field textarea {
  display: block;
  width: 100%;
  padding: 0.8rem 0.9rem;
  font: inherit;
  color: #fff;
  background: rgb(255 255 255 / 0.06);
  border: 1px solid rgb(255 255 255 / 0.3);
  border-radius: 2px;
}
.field textarea { resize: vertical; min-height: 9rem; }
.field input:hover, .field textarea:hover { border-color: rgb(255 255 255 / 0.55); }
.field input:focus-visible, .field textarea:focus-visible {
  outline: 2px solid var(--cadmium-light); outline-offset: 1px; border-color: transparent;
}
.field [aria-invalid="true"] { border-color: var(--cadmium-light); }
.field-error {
  margin: 0.4rem 0 0;
  font-family: var(--display);
  font-size: 0.875rem;
  color: var(--cadmium-light);
}
.field-error:empty { display: none; }
.trap { position: absolute; left: -9999px; }

.button {
  justify-self: start;
  padding: 0.95rem 1.6rem;
  font-family: var(--display);
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: #c4471f;
  border: 0;
  border-radius: 2px;
  cursor: pointer;
}
.button:hover { background: #a93a17; }
.button[disabled] { opacity: 0.6; cursor: progress; }
.form-status { margin: 0; max-width: 32em; color: var(--on-dark); }
.form-status:empty { display: none; }

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

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

.site-footer {
  color: var(--on-dark-soft);
  font-family: var(--display);
  font-size: 0.8125rem;
}
.site-footer-inner {
  max-width: 76rem;
  margin: 0 auto;
  padding: 1.5rem var(--gutter) 2rem;
  border-top: 1px solid rgb(255 255 255 / 0.12);
  display: flex; flex-wrap: wrap; gap: 0.5rem 2rem; justify-content: space-between;
}
.site-footer p { margin: 0; }

.site-footer--wall .site-footer-inner { max-width: 96rem; }
.footer-more {
  font-size: 1rem; color: var(--on-dark);
}
.footer-more a { font-weight: 600; }

/* ---------- Paintings page ---------- */

.site-header {
  display: flex; flex-wrap: wrap; gap: 1rem 2rem;
  align-items: baseline; justify-content: space-between;
  max-width: 96rem; margin: 0 auto;
  padding: 1.4rem var(--gutter);
}
.wordmark {
  font-family: var(--display);
  font-weight: 800;
  font-stretch: 75%;
  font-size: 1.625rem;
  line-height: 1;
  letter-spacing: 0.01em;
  color: var(--prussian);
  text-decoration: none;
}

.gallery-intro {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 1rem 3rem;
  max-width: 96rem;
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 3rem) var(--gutter) clamp(4.5rem, 10vw, 9rem);
}
.gallery-intro h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 800;
  font-stretch: 75%;
  font-size: clamp(3.5rem, 9vw, 7.5rem);
  line-height: 0.85;
  letter-spacing: -0.005em;
  color: var(--prussian);
}
.gallery-intro p { flex: 1 1 18rem; max-width: 28em; margin: 0 0 0.4rem; }

/* Ordering information, on the rock under the ridgeline */
.order-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem 3rem;
  max-width: 96rem;
  margin: 0 auto clamp(2.5rem, 5vw, 4rem);
  padding: 0 var(--gutter) clamp(1.5rem, 3vw, 2.5rem);
  border-bottom: 1px solid rgb(255 255 255 / 0.14);
}
.order-info p { margin: 0; }
@media (max-width: 760px) {
  .order-info { grid-template-columns: 1fr; }
}
/* The paintings hang on the rock, like boards laid out after a day on the hill */
.wall {
  color: var(--on-dark);
  padding: clamp(2rem, 5vw, 4rem) 0 clamp(3.5rem, 7vw, 6rem);
}
.collage {
  display: flex;
  align-items: flex-start;
  gap: clamp(1.25rem, 3vw, 3rem);
  max-width: 96rem;
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.collage-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; }

.work {
  margin: 0 0 var(--gap, 3rem);
  width: calc(var(--w, 1) * 100%);
}
.work[data-align="end"] { align-self: flex-end; }
.work[data-align="center"] { align-self: center; }
.work-open {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: #3d4448;
  cursor: zoom-in;
  transform: rotate(var(--tilt, 0deg));
  transform-origin: 50% 70%;
  box-shadow:
    0 2px 3px rgb(0 0 0 / 0.35),
    0 26px 34px -18px rgb(0 0 0 / 0.75);
}
.work-open img { width: 100%; }
.wall :focus-visible { outline-color: var(--cadmium-light); outline-offset: 6px; }
.work figcaption {
  display: flex; flex-direction: column;
  margin-top: 0.85rem;
  font-family: var(--display);
  font-size: 0.875rem;
  line-height: 1.4;
}
.work-title { font-weight: 600; color: #f4f5f3; font-size: 0.9375rem; }
.work-details { color: var(--on-dark-soft); }

.noscript-note { max-width: 96rem; margin: 0 auto; padding: 0 var(--gutter); }

/* ---------- Painting viewer ---------- */

.lightbox {
  width: 100vw; height: 100vh; height: 100dvh;
  max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0;
  background: var(--night);
  color: var(--on-dark);
  overflow: hidden;
}
.lightbox::backdrop { background: var(--night); }
.lightbox[open] { display: grid; grid-template-rows: minmax(0, 1fr) auto; }
.lightbox-stage {
  display: grid; place-items: center;
  min-height: 0;
  padding: clamp(1rem, 3vw, 2.5rem) clamp(1rem, 3vw, 2.5rem) 0;
  touch-action: pan-y;
}
.lightbox-stage img {
  max-width: 100%;
  max-height: 100%;
  width: auto; height: auto;
  object-fit: contain;
  min-height: 0;
  box-shadow: 0 30px 60px -30px rgb(0 0 0 / 0.6);
}
.lightbox[open] .lightbox-stage img { animation: show-painting 0.35s ease-out; }
@keyframes show-painting { from { opacity: 0; transform: scale(0.985); } }
@media (prefers-reduced-motion: reduce) {
  .lightbox[open] .lightbox-stage img { animation: none; }
}
.lightbox-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.75rem;
  padding: 1.1rem clamp(1rem, 3vw, 2.5rem) 1.4rem;
  font-family: var(--display);
}
.lightbox-caption { flex: 1 1 16rem; min-width: 0; }
.lb-title { margin: 0; font-size: 1.125rem; font-weight: 600; color: #fff; }
.lb-details { margin: 0.15rem 0 0; font-size: 0.9375rem; color: var(--on-dark-soft); }
.lb-count { margin: 0; font-size: 0.9375rem; color: var(--on-dark-soft); font-variant-numeric: tabular-nums; }
.lightbox-controls { display: flex; gap: 0.5rem; }
.lightbox-controls button {
  display: grid; place-items: center;
  width: 2.875rem; height: 2.875rem;
  padding: 0;
  color: #fff;
  background: transparent;
  border: 1px solid rgb(255 255 255 / 0.28);
  border-radius: 50%;
  cursor: pointer;
}
.lightbox-controls button:hover { background: rgb(255 255 255 / 0.1); border-color: rgb(255 255 255 / 0.6); }
.lightbox :focus-visible { outline-color: var(--cadmium-light); }
.lightbox-controls svg { width: 1.25rem; height: 1.25rem; }
