/* ---------- Colors & fonts (change these to restyle the whole site) ---------- */
:root {
  --paper: #ffffff;
  --ink: #1b1a19;
  --muted: #76716b;
  --line: #e6e2dc;
  --soft: #f6f4f0;
  --display: "Cormorant Garamond", Georgia, serif;
  --body: "EB Garamond", Georgia, serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  /* very subtle stone/paper texture over the white (images/paper-texture.jpg; 800px tile shown at 400px for sharpness) */
  background: var(--paper) url("images/paper-texture.jpg?v=3") repeat;
  background-size: 400px 400px;
  color: var(--ink);
  font-family: var(--body);
  font-size: 18px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

.wrap { max-width: 1240px; margin: 0 auto; padding: 0 clamp(16px, calc(4vw - 8px), 32px); }   /* side margins narrow gradually */

/* ---------- Fade-in on scroll ---------- */
.js-reveal .reveal { opacity: 0; transform: translateY(24px); transition: opacity 1s ease, transform 1s ease; }
.js-reveal .reveal.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .js-reveal .reveal { transform: none; } }

/* ---------- Tagline font (Paragraph, a handwritten script; file in /fonts) ---------- */
@font-face { font-family: "Paragraph"; src: url("fonts/Paragraph.otf") format("opentype"); font-display: swap; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(246,244,240,.94); /* same as footer (--soft), slightly see-through */
  backdrop-filter: blur(6px);
}
/* soft fade from the header color into the white page below it */
.site-header::after {
  content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 44px;
  background: linear-gradient(to bottom, rgba(246,244,240,.94), rgba(246,244,240,0));
  pointer-events: none;
}
.header-inner {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  height: 84px;
}
.nav { display: flex; gap: 28px; font-size: 15px; }
.nav a { position: relative; padding: 4px 0; }
.nav a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: var(--ink); transform: scaleX(0); transition: transform .3s;
}
.nav a:hover::after, .nav a[aria-current="page"]::after { transform: scaleX(1); }
.logo {
  font-family: "Cormorant Unicase", var(--display); font-weight: 400; font-size: 28px;
  letter-spacing: .12em; text-align: center;
}
.header-right { display: flex; justify-content: flex-end; gap: 18px; }
.icon { width: 18px; height: 18px; }

/* ---------- Welcome ---------- */
.welcome { text-align: center; padding-top: 88px; padding-bottom: 72px; }
.eyebrow {
  font-family: var(--display); font-style: italic; font-size: 20px;
  color: var(--muted); letter-spacing: .06em;
}
.welcome h1 {
  font-family: var(--display); font-weight: 300; font-size: clamp(34px, 5vw, 56px);
  line-height: 1.15; margin: 0 auto 18px; max-width: 18ch;
}
/* handwritten tagline: one line on computers, breaks after "place" on phones */
.welcome h1.tagline {
  font-family: "Paragraph", var(--display); font-weight: 400;
  font-size: clamp(75px, calc(6.96vw + 47.8px), 130px);   /* scales smoothly: 130px desktop → ~105px tablet → 75px phone */
  line-height: .75; max-width: none; margin-bottom: 0;
}
.phone-break { display: none; }

/* Tagline "being written": it starts as faint grey script, then black ink sweeps across it left to right
   at one steady pace, fully written 1.6s after the page loads (each half sweeps in .654s). */
@property --ink-edge { syntax: "<percentage>"; inherits: false; initial-value: 0%; }   /* separate name: --ink is the site's near-black color */
.tagline.writing .seg { position: relative; display: inline-block; color: rgba(27, 26, 25, .16);
  padding: .35em .25em; margin: -.35em -.25em; }        /* padding keeps the script's flourishes inside the ink layer */
.tagline.writing .seg::after {
  content: attr(data-text); position: absolute; inset: 0; padding: inherit; color: #1b1a19;
  -webkit-mask-image: linear-gradient(90deg, #000 calc(var(--ink-edge) - 6%), transparent var(--ink-edge));
          mask-image: linear-gradient(90deg, #000 calc(var(--ink-edge) - 6%), transparent var(--ink-edge));
  animation: write .654s linear .4s forwards;
}
.tagline.writing .s2::after { animation-delay: .947s; }  /* starts as the first half's ink reaches it (.4s + .654s × 88.6/106), so the edge flows straight through */
@keyframes write { from { --ink-edge: 0%; } to { --ink-edge: 106%; } }
@media (prefers-reduced-motion: reduce) {                /* no animation: show it already written */
  .tagline.writing .seg::after { animation: none; -webkit-mask-image: none; mask-image: none; }
}
@media (max-width: 600px) { .phone-break { display: inline; } }   /* phones: two lines */

.welcome p { max-width: 560px; margin: 0 auto 34px; color: #4a4642; }

.btn {
  display: inline-block; background: var(--ink); color: #fff;
  padding: 13px 34px; font-size: 16px; letter-spacing: .04em;
  transition: background .25s;
}
.btn:hover { background: #3a3733; }
.btn.outline { background: transparent; color: var(--ink); border: 1px solid var(--ink); }
.btn.outline:hover { background: var(--ink); color: #fff; }
.btn[aria-disabled="true"] { background: #bdb8b1; pointer-events: none; }

.divider { width: 48px; height: 1px; background: var(--ink); margin: 0 auto; opacity: .5; }

/* ---------- Shop ---------- */
.shop { padding-top: 72px; padding-bottom: 110px; scroll-margin-top: 20px; }
.section-title {
  font-family: var(--display); font-weight: 400; font-size: clamp(24px, calc(2.14vw + 13.7px), 30px); text-align: center;
}
.filters { display: flex; justify-content: center; gap: 28px; margin-top: 18px; font-size: 16px; color: var(--muted); }
.filters button { padding: 4px 0; border-bottom: 1px solid transparent; }
.filters button.active { color: var(--ink); border-color: var(--ink); }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 56px 40px; margin-top: 56px; }
/* Staggered layout (used when LAYOUT = "staggered" in artworks.js) */
.stagger { margin-top: 56px; }
.srow { display: flex; align-items: flex-start; margin-bottom: clamp(48px, 7vw, 110px); }
.srow .card { flex: none; width: calc(var(--in) / 40 * clamp(44%, calc(44% + (1300px - 100vw) * .21), 50%)); }
.srow .card:last-child:not(:first-child) { margin-left: auto; }
@media (max-width: 760px) {                             /* phones: one column, alternating left and right */
  .srow { flex-direction: column; margin-bottom: 0; }
  .srow .card { width: calc(var(--in) / 40 * 86%); margin: 0 0 56px 0 !important; }
  .srow .card.alt { align-self: flex-end; }
}

.card { text-align: left; cursor: pointer; }
.card-media { position: relative; aspect-ratio: 1 / 1; overflow: hidden; background: var(--soft); }
.card-media img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  transition: opacity .7s ease;
}
.card-media .room { opacity: 0; }
@media (hover: hover) {
  .card:hover .card-media .room { opacity: 1; }
}
.tag {
  position: absolute; top: 14px; left: 14px; z-index: 2;
  background: rgba(255,255,255,.55); backdrop-filter: blur(4px); color: rgba(27,26,25,.8); font-size: 13px; letter-spacing: .08em; text-transform: uppercase;
  padding: 3px 10px;
}
.card h3 { font-family: var(--display); font-style: italic; font-weight: 500; font-size: 22px; margin-top: 18px; }
.card .meta { font-size: 15px; color: var(--muted); }
.card .price { font-size: 16px; margin-top: 2px; }
.card.sold .price { color: var(--muted); }
/* On computers, the price only appears while the mouse is over the painting (its space stays reserved so nothing jumps).
   Phones and tablets can't hover, so there it stays visible. */
@media (hover: hover) {
  /* quick fade-out in place: it only moves back up after it's fully invisible, ready for the next slide-in */
  .card .price { opacity: 0; transform: translateY(-12px); transition: opacity .4s ease, transform 0s linear .4s; }
  .card:hover .price, .card:focus-visible .price {                                    /* slow fade-in, sliding down */
    opacity: 1; transform: none; transition: opacity 1s ease, transform 1s ease;
  }
}

/* ---------- Detail view (opens when a painting is clicked) ---------- */
.detail {
  position: fixed; inset: 0; z-index: 50; background: var(--paper) url("images/paper-texture.jpg?v=3") repeat; background-size: 400px 400px;
  overflow-y: auto; opacity: 0; visibility: hidden; transition: opacity .35s, visibility .35s;
}
.detail.open { opacity: 1; visibility: visible; }
.detail-close {
  position: fixed; top: 22px; right: 28px; font-size: 16px; z-index: 2;
  letter-spacing: .04em; padding: 6px 0; border-bottom: 1px solid var(--ink);
}
.detail-inner { container-type: inline-size; 
  display: grid; grid-template-columns: 1.25fr 1fr; gap: 64px; align-items: start;
  max-width: 1240px; margin: 0 auto; padding: 84px 32px 80px;
}
.detail-main { aspect-ratio: 1 / 1; background: var(--soft); overflow: hidden; touch-action: pan-y; }
/* mouse zoom eases in slowly and glides after the pointer; fingers move it directly (no lag) */
.detail-main img { width: 100%; height: 100%; object-fit: cover;
  transition: transform .8s cubic-bezier(.22, .61, .36, 1), transform-origin .45s ease-out; }
.detail-main.zoomed { touch-action: none; }                       /* while zoomed, a finger drag looks around the painting */
.detail-main.touching img { transition: none; }
@media (hover: hover) and (pointer: fine) { .detail-main { cursor: zoom-in; } }
.thumbs { display: flex; gap: 12px; margin-top: 12px; }
.thumbs button { width: 96px; aspect-ratio: 1 / 1; opacity: .5; transition: opacity .2s; outline-offset: 2px; }
.thumbs button.active, .thumbs button:hover { opacity: 1; }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }
.detail-info { position: sticky; top: 84px; }
.detail-info h2 { font-family: var(--display); font-style: italic; font-weight: 400; font-size: clamp(26px, 3.06cqw, 36px); line-height: 1.1; }
.detail-info .kind { font-family: var(--display); font-style: italic; color: var(--muted); font-size: clamp(15px, 1.62cqw, 19px); margin-top: 6px; margin-bottom: 22px; }
/* detail view text scales with the detail view itself (cqw = % of its width), keeping the proportions to the painting you see at full width */
/* gallery-style status line: ● AVAILABLE / ● SOLD (detail view, and ● SOLD under sold paintings in the grid) */
.status { letter-spacing: .26em; text-transform: uppercase; color: var(--muted); }
.status .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #7e9a6f; margin-right: 9px; vertical-align: 1px; }
.status.sold .dot { background: #b0624f; }
.detail-info .status { font-size: clamp(10.5px, 1.02cqw, 12px); margin-bottom: 8px; }
.card .status { font-size: 10.5px; margin-top: 6px; }
.card .status .dot { width: 6px; height: 6px; margin-right: 8px; }
.detail-info .status + .price { margin-top: 0; }
.detail-info .status.sold { margin-bottom: 26px; }
.detail-info .price { font-size: clamp(17px, 1.87cqw, 22px); margin: 22px 0; }
.detail-info dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 22px; font-size: 16px; border-top: 1px solid var(--line); padding-top: 20px; margin-bottom: 22px; }
.detail-info dt { color: var(--muted); }
.detail-info .desc { color: #4a4642; margin-bottom: 30px; }
.sizes { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 26px; }
.sizes button { border: 1px solid var(--line); padding: 8px 16px; font-size: 15px; }
.sizes button.active { border-color: var(--ink); }
/* the inquire/purchase link: spaced capitals on a full-width hairline, arrow glides right on hover */
.ruled { display: flex; justify-content: space-between; align-items: baseline; width: 100%;
  font-size: clamp(11px, 1.1cqw, 13px); letter-spacing: .26em; text-transform: uppercase; color: var(--ink);
  padding: 4px 0 11px; border-bottom: 1px solid var(--ink); }
.ruled .arrow { display: inline-block; letter-spacing: 0; font-size: 15px; transition: transform .45s cubic-bezier(.22, .61, .36, 1); }
.ruled:hover .arrow, .ruled:focus-visible .arrow { transform: translateX(8px); }
.small-note { font-size: 14px; color: var(--muted); margin-top: 12px; }

/* ---------- Footer / contact ---------- */
.site-footer { position: relative; background: var(--soft); padding: 90px 0 36px; text-align: center; }
/* soft fade from the white page into the footer color */
.site-footer::before {
  content: ""; position: absolute; left: 0; right: 0; bottom: 100%; height: 90px;
  background: linear-gradient(to bottom, rgba(246,244,240,0), var(--soft));
  pointer-events: none;
}
/* Footer: gallery columns */
.site-footer { text-align: left; padding: 84px 0 34px; }
.foot-grid { display: grid; grid-template-columns: auto 1fr auto; gap: 72px; padding-bottom: 64px; }
.foot-lead { font-family: var(--display); font-weight: 300; font-size: clamp(30px, 2.9vw, 40px); line-height: 1.15; }
.foot-lead .nowrap { white-space: nowrap; }

.foot-col:nth-child(2) { justify-self: center; }
.foot-col:last-child { width: 300px; }
.foot-lead em { font-style: italic; }
.foot-col h3 { font-size: 11px; letter-spacing: .24em; text-transform: uppercase; font-weight: 500; color: var(--muted); margin: 10px 0 18px; }
.foot-col ul { list-style: none; padding: 0; }
.foot-col li { margin-bottom: 10px; }
.foot-col a { color: inherit; text-decoration: none; border-bottom: 1px solid transparent; transition: border-color .2s; }
.foot-col a:hover { border-bottom-color: currentColor; }
.foot-note { color: var(--muted); margin-bottom: 10px; }
.signup { display: flex; max-width: 340px; border-bottom: 1px solid var(--ink); }
.signup input { flex: 1; border: 0; background: transparent; font: inherit; font-size: 16px; padding: 10px 0; min-width: 0; color: var(--ink); }
.signup input:focus { outline: none; }
.signup button { background: none; border: 0; color: var(--ink); font-size: 18px; padding: 0 2px 0 14px; cursor: pointer; transition: transform .25s; }
.signup button:hover { transform: translateX(4px); }
.foot-base { border-top: 1px solid var(--line); padding-top: 22px; display: flex; justify-content: space-between; align-items: flex-start; font-size: 13px; color: var(--muted); line-height: 1.6; }
.foot-base a { color: inherit; text-decoration: none; font-size: 11px; letter-spacing: .24em; text-transform: uppercase; }
.foot-base a:hover { color: var(--ink); }
@media (max-width: 1040px) {
  .foot-grid { grid-template-columns: 1fr 1fr; gap: 40px; }
  .foot-col:nth-child(2) { justify-self: start; }
  .foot-col:last-child { width: auto; }
  .foot-lead { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .foot-grid { grid-template-columns: 1fr; gap: 34px; padding-bottom: 48px; }
  .foot-base { flex-direction: column; gap: 14px; }
}

/* ---------- About page ---------- */
/* portrait sized to exactly the height of the bio beside it (height set by a small script in about.html) */
.about { display: grid; grid-template-columns: auto minmax(0, 560px); justify-content: center; gap: 64px; align-items: center; padding-top: 80px; padding-bottom: 110px; }
.about img { aspect-ratio: 4/5; object-fit: cover; width: auto; height: var(--bio-h, 340px); }
.about-bio > :last-child { margin-bottom: 0; }
.about h1 { font-family: var(--display); font-weight: 300; font-size: 52px; line-height: 1.1; margin: 10px 0 24px; }
.about p { color: #4a4642; margin-bottom: 18px; line-height: 1.75; }
.about-link { max-width: 420px; margin-top: 44px; }
.statement { max-width: 720px; margin: 0 auto; padding-bottom: 110px; text-align: center; }
.statement h2 { font-family: var(--display); font-weight: 400; font-size: 34px; margin-bottom: 18px; }
.statement p { font-family: var(--display); font-style: italic; font-size: 24px; line-height: 1.5; color: #3d3935; }

/* ---------- Smaller screens ---------- */
@media (max-width: 900px) {
  .grid { grid-template-columns: repeat(2, 1fr); gap: 44px 20px; }
  .about { gap: 40px; }        /* tablets keep the portrait beside the bio */
  .detail-inner { gap: 36px; }   /* tablets keep the desktop side-by-side detail view, just a tighter gap */
}
@media (max-width: 760px) {      /* phones: detail view stacks (photo above the details) */
  .about { grid-template-columns: 1fr; gap: 36px; }   /* phones: portrait above the bio, full width */
  .about img { width: 100%; height: auto; }
  .detail-inner { grid-template-columns: 1fr; }
  .detail-info { position: static; }
  .thumbs button { width: 76px; }
}
@media (max-width: 720px) {
  /* narrow screens: name centered on its own line, menu centered below
     (switches at 720px, before the menu and name would touch at ~650px) */
  .header-inner { display: flex; flex-direction: column; align-items: center; height: auto; padding-top: 14px; padding-bottom: 10px; gap: 4px; }
  .logo { font-size: 23px; letter-spacing: .1em; white-space: nowrap; order: -1; }
  .header-right { display: none; }
  .nav { gap: 24px; font-size: 14px; justify-content: center; }
  .shop { scroll-margin-top: 90px; }
}
@media (max-width: 600px) {
  .grid { gap: 36px 14px; }
  .card h3 { font-size: 18px; }
  .detail-inner { padding: 64px 16px 60px; }
  .detail-close { right: 16px; top: 16px; }
}

/* keeps a page heading for search engines and screen readers without showing it */
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.about .eyebrow { margin-bottom: 18px; }

/* Shipping & Returns and Thank-you pages */
.policy { max-width: 640px; margin: 0 auto; padding: 80px 0 110px; }
.policy h1 { font-family: var(--display); font-weight: 300; font-size: 44px; line-height: 1.1; margin-bottom: 36px; }
.policy h2 { font-size: 11px; letter-spacing: .22em; text-transform: uppercase; font-weight: 500; margin: 40px 0 12px; }
.policy p { color: #4a4642; line-height: 1.75; margin-bottom: 14px; }
.policy a:not(.ruled) { color: inherit; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.policy .lead-in { font-family: var(--display); font-style: italic; font-size: 22px; color: var(--ink); }
.thanks { text-align: left; }
.policy-link { max-width: 420px; margin-top: 30px; }
.small-note a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.thanks { padding: 150px 0 190px; }
@media (max-width: 560px) { .thanks { padding: 90px 0 120px; } }

/* sold note sits above the Inquire link; "Price on request" uses the same quiet note style */
.detail-info .sold-note { margin: 0 0 22px; }
.detail-info .price-request { margin: 30px 0 22px; }
.detail-info .price-request ~ .desc:empty { display: none; }
.detail-info .status.sold { margin-bottom: 8px; }
