/* Alan Hartt. Editorial and classical: paper, ink, his ember orange (from
   alanhartt.com/bio), Cormorant Garamond, a mono for labels. Pointed arches
   come from the gothic windows on his Pinterest. The stencil violet is the
   colour of a real transfer stencil on skin. */
:root {
  --paper: #eeeae3;
  --ink: #16130f;
  --muted: #6c655b;
  --line: rgb(22 19 15 / .14);
  --ember: #d9581c;
  --ember-hi: #e4692a;
  --serif: "Cormorant Garamond", "Cormorant", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --pad: clamp(20px, 4.4vw, 64px);
  --nav-h: 76px;
  --ink-time: 3s;
  /* A true pointed arch: two compass arcs of radius 0.75 x width, struck from the springing line. */
  --arch: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 300' preserveAspectRatio='none'%3E%3Cpath d='M0 300V141.4A150 150 0 0 1 100 0A150 150 0 0 1 200 141.4V300Z'/%3E%3C/svg%3E");
  --arch-outer: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 300' preserveAspectRatio='none'%3E%3Cpath d='M0 300V141.4A150 150 0 0 1 100 0A150 150 0 0 1 200 141.4V300Z'/%3E%3C/svg%3E");
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
img { display: block; max-width: 100%; }
a { color: inherit; }

/* Paper grain. */
body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 50;
  opacity: .22; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .55 0 0 0 0 .5 0 0 0 0 .44 0 0 0 .5 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Nav ---------- */
.nav {
  position: relative; z-index: 5;
  height: var(--nav-h); padding: 0 var(--pad);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  max-width: 1520px; margin: 0 auto;
}
.wordmark {
  font: 500 15px/1 var(--serif); letter-spacing: .34em; text-transform: uppercase;
  text-decoration: none; white-space: nowrap;
}
.nav-links { display: flex; gap: 40px; }
.nav-links a {
  font: 400 12px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase;
  text-decoration: none; color: var(--muted); transition: color .2s;
}
.nav-links a:hover { color: var(--ink); }
.nav-cta {
  justify-self: end; display: inline-flex; gap: 10px; align-items: center;
  font: 500 12px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase;
  text-decoration: none; padding: 12px 18px; border-radius: 999px;
  background: var(--ink); color: var(--paper); transition: background .2s;
}
.nav-cta:hover { background: #2c2620; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  max-width: 1520px; margin: 0 auto; padding: 0 var(--pad) 32px;
  min-height: min(calc(100svh - var(--nav-h)), 980px);
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr);
  align-items: center; column-gap: clamp(32px, 4.5vw, 80px);
}

.hero-copy { position: relative; z-index: 3; max-width: 580px; padding: 24px 0 40px; }
.eyebrow {
  margin: 0 0 28px; font: 400 12px/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
h1 {
  margin: 0; font: 300 clamp(3rem, 5.7vw, 5.1rem)/.94 var(--serif);
  letter-spacing: -.02em;
}
h1 em { display: block; font-style: italic; color: var(--ember); letter-spacing: -.025em; white-space: nowrap; }
h1 .roman { font-style: normal; color: var(--ink); letter-spacing: -.02em; }
.lead { max-width: 45ch; margin: 28px 0 0; font-size: 17px; line-height: 1.65; color: var(--muted); }

.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 36px; }
.btn {
  display: inline-flex; align-items: center; gap: 12px;
  padding: 17px 26px; border-radius: 999px; background: var(--ink); color: var(--paper);
  font-size: 15px; font-weight: 500; text-decoration: none;
  transition: background .2s, box-shadow .2s;
  box-shadow: 0 1px 0 rgb(255 255 255 / .2) inset, 0 12px 30px -14px rgb(22 19 15 / .55);
}
.btn:hover { background: #2c2620; }
.btn-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ember-hi); box-shadow: 0 0 0 4px rgb(228 105 42 / .22); }
.btn-ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.btn-ghost:hover { background: rgb(22 19 15 / .05); }

.facts {
  list-style: none; padding: 22px 0 0; margin: 44px 0 0; border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: 8px 28px;
  font: 400 12px/1.4 var(--mono); letter-spacing: .02em; color: var(--muted);
}
.facts a { text-decoration: none; border-bottom: 1px solid var(--line); }
.facts a:hover { color: var(--ink); border-color: var(--ink); }

/* ---------- The gallery: two arched windows, the smaller one in front ---------- */
.gallery {
  --gh: min(calc(100svh - var(--nav-h) - 72px), 820px);    /* gallery height */
  --pad-a: 9px;
  --aw: calc(var(--gh) * .72 * 2 / 3 + 2 * var(--pad-a));   /* width of arch A, frame + moulding */
  --bw: calc(var(--gh) * .58 * 2 / 3 + 2 * var(--pad-a));   /* width of arch B */
  --overlap: clamp(40px, 6vw, 84px);
  position: relative; height: var(--gh); align-self: center;
}
.art { margin: 0; position: absolute; }
.art-a { right: 0; top: 0; width: var(--aw); }
.art-b { right: calc(var(--aw) - var(--overlap)); bottom: 0; width: var(--bw); z-index: 2; }

.arch { position: relative; padding: var(--pad-a); }
.arch::before { /* hairline moulding around the window */
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 300' preserveAspectRatio='none'%3E%3Cpath d='M.5 300V141.4A149.5 149.5 0 0 1 100 .7A149.5 149.5 0 0 1 199.5 141.4V300' fill='none' stroke='%2316130f' stroke-opacity='.3' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E") 0 0 / 100% 100% no-repeat;
}
.art-b .arch { /* paper backing, so the front window hides what is behind it */
  background: var(--paper);
  -webkit-mask: var(--arch-outer) 0 0 / 100% 100% no-repeat;
          mask: var(--arch-outer) 0 0 / 100% 100% no-repeat;
}
.frame {
  position: relative; aspect-ratio: 2 / 3; background: #f3efe9;
  -webkit-mask: var(--arch) 0 0 / 100% 100% no-repeat;
          mask: var(--arch) 0 0 / 100% 100% no-repeat;
}

/* Compass construction of arch A, drawn faintly around it. */
.compass {
  position: absolute; inset: var(--pad-a); width: calc(100% - 2 * var(--pad-a)); height: calc(100% - 2 * var(--pad-a));
  z-index: -1; overflow: visible; color: rgb(22 19 15 / .16); pointer-events: none;
}
.compass .accent { stroke: var(--ember); opacity: .8; }
.compass circle, .compass path { stroke-dasharray: 1; stroke-dashoffset: 0; }
.js .compass > g > * { animation: draw 1.8s cubic-bezier(.6, .1, .2, 1) both; }
.js .compass > g > :nth-child(2) { animation-delay: .2s; }
.js .compass > g > :nth-child(3) { animation-delay: .45s; }
.js .compass > g > :nth-child(4) { animation-delay: .9s; }
@keyframes draw { from { stroke-dashoffset: 1; } }

.slide { position: absolute; inset: 0; opacity: 0; transition: opacity .4s ease; }
/* the old piece clears to paper first, then the next stencil is laid down */
.slide.is-active { opacity: 1; transition-delay: .35s; }
.slide img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

@property --wipe { syntax: "<percentage>"; inherits: true; initial-value: 115%; }
.stencil {
  opacity: 0;
  -webkit-mask-image: linear-gradient(to bottom, transparent calc(var(--wipe) - 16%), #000 var(--wipe));
          mask-image: linear-gradient(to bottom, transparent calc(var(--wipe) - 16%), #000 var(--wipe));
}
.slide::after { /* the needle line riding the edge between stencil and skin */
  content: ""; position: absolute; left: 0; right: 0; top: calc(var(--wipe) - 8%); height: 1px; opacity: 0;
  background: linear-gradient(90deg, transparent, var(--ember) 20%, var(--ember-hi) 50%, var(--ember) 80%, transparent);
  box-shadow: 0 0 14px 1px rgb(228 105 42 / .5);
}
/* Before the script starts, each arch already shows its stencil. */
@media (prefers-reduced-motion: no-preference) {
  .js .art:not(.run) .slide.is-active { --wipe: -2%; }
  .js .art:not(.run) .slide.is-active .stencil { opacity: 1; }
  .js .art:not(.run) .s-draw { opacity: 1; }
  .js .art:not(.run) .s-skin { opacity: 0; }
}
.run .slide.is-active { animation: ink var(--ink-time) cubic-bezier(.6, 0, .3, 1) both; }
.run .slide.is-active .stencil { animation: stencil-on var(--ink-time) linear both; }
.run .slide.is-active::after { animation: needle var(--ink-time) linear both; }
@keyframes ink { 0%, 24% { --wipe: -2%; } 100% { --wipe: 115%; } }
@keyframes stencil-on { 0%, 99% { opacity: 1; } 100% { opacity: 0; } }
@keyframes needle { 0%, 25% { opacity: 0; } 31%, 90% { opacity: .9; } 100% { opacity: 0; } }

.stage {
  position: absolute; left: 50%; bottom: calc(var(--pad-a) + 14px); margin: 0; z-index: 2; translate: -50% 0;
  font: 500 10px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase;
}
.stage span {
  position: absolute; bottom: 0; left: 50%; translate: -50% 0; white-space: nowrap;
  padding: 7px 10px; border-radius: 999px; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.s-draw { color: #fff; background: rgb(84 70 190 / .85); opacity: 0; }
.s-skin { color: var(--paper); background: rgb(22 19 15 / .6); }
.run .s-draw { animation: draw-tag var(--ink-time) linear both; }
.run .s-skin { animation: skin-tag var(--ink-time) linear both; }
@keyframes draw-tag { 0%, 46% { opacity: 1; } 54%, 100% { opacity: 0; } }
@keyframes skin-tag { 0%, 48% { opacity: 0; } 58%, 100% { opacity: 1; } }

.caption {
  display: flex; align-items: baseline; gap: 10px; padding: 10px var(--pad-a) 0;
  font: 400 11px/1.2 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
}
.art-a .caption { justify-content: flex-end; }
.caption .n::before { content: "Nº "; }
.caption .n { color: var(--ink); }
.c-title { font: italic 400 18px/1 var(--serif); letter-spacing: 0; text-transform: none; color: var(--ink); }
.art-b .c-place { margin-left: auto; }

/* Load-in */
.js .hero-copy > * { animation: rise 1s cubic-bezier(.2, .7, .2, 1) both; }
.js .hero-copy > :nth-child(2) { animation-delay: .08s; }
.js .hero-copy > :nth-child(3) { animation-delay: .2s; }
.js .hero-copy > :nth-child(4) { animation-delay: .3s; }
.js .hero-copy > :nth-child(5) { animation-delay: .42s; }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }
.js .art .frame, .js .art .caption { animation: rise 1.1s .25s cubic-bezier(.2, .7, .2, 1) both; }
.js .art-b .frame, .js .art-b .caption { animation-delay: .4s; }

/* ---------- Narrower screens ---------- */
@media (max-width: 1100px) {
  .hero { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .facts li:nth-child(2) { display: none; }
}
@media (max-width: 860px) {
  :root { --nav-h: 60px; }
  .nav { grid-template-columns: 1fr auto; }
  .nav-links { display: none; }
  .wordmark { font-size: 13px; letter-spacing: .3em; }
  .nav-cta { padding: 10px 14px; font-size: 11px; }

  .hero { display: block; min-height: 0; padding: 0 20px calc(40px + var(--preview-bar-h, 0px)); }
  .hero-copy { padding: 22px 0 32px; }
  .eyebrow { margin-bottom: 16px; font-size: 10.5px; }
  h1 { font-size: clamp(2.8rem, 12.4vw, 3.6rem); }
  .lead { margin-top: 16px; font-size: 15px; line-height: 1.6; }
  .actions { margin-top: 22px; }
  .btn { width: 100%; justify-content: center; padding: 17px 22px; }
  .btn-ghost { display: none; }
  .facts { display: none; }

  .gallery { --gh: 430px; --pad-a: 6px; --overlap: 44px; width: 100%; }
  .stage { bottom: calc(var(--pad-a) + 10px); }
  .c-title { font-size: 16px; }
  .art-a .caption .c-place { display: none; }
  .art-b .caption { flex-wrap: wrap; row-gap: 4px; }
  .art-b .c-place { margin-left: 0; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .run .slide.is-active, .run .slide.is-active .stencil, .run .slide.is-active::after,
  .run .s-draw, .run .s-skin, .js .hero-copy > *, .js .art .frame, .js .art .caption, .js .compass > g > * { animation: none; }
  .slide { transition: none; }
}
