/* ===========================================================================
   Mordecai Ardon — canonical site stylesheet (ONE design source of truth).
   Consumed by BOTH builders:
     - scripts/build_site.py   links this file from every generated page
     - scripts/build_sample.py inlines it into the self-contained previews
   Edit the design HERE, nowhere else. (site/assets/site.css is a build copy.)

   The core museum-wall design (palette, gallery grid, hover glow, lightbox) is the
   approved Option B. Caption spec follows the estate's direction: title in italic,
   date beneath, dimensions retained in data but HIDDEN for now.
   =========================================================================== */
:root{
  --ink:#0C0E16; --ink-2:#11141d; --surface:#161a25;
  --parch:#ECE6D6; --muted:#948C7B; --amber:#C9651F;
  --hair:rgba(236,230,214,.14); --hair-strong:rgba(236,230,214,.28);
  --serif:"Palatino Linotype","Book Antiqua",Palatino,Georgia,"Times New Roman",serif;
  --sans:system-ui,-apple-system,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
}
*{box-sizing:border-box}
/* always reserve the vertical scrollbar gutter so page width is identical whether
   or not a page scrolls -- otherwise the centered header/footer jump sideways by
   the scrollbar width when navigating between a short page (home) and a tall one. */
html{scrollbar-gutter:stable}
body{margin:0;overflow-x:hidden}
.page{
  background:radial-gradient(120% 80% at 50% -10%, #14182400 0%, #090b1100 40%),
             linear-gradient(180deg,#0d1019 0%, var(--ink) 38%);
  color:var(--parch); font-family:var(--sans); min-height:100vh;
  -webkit-font-smoothing:antialiased; padding-bottom:5rem;
}
.wrap{max-width:1180px;margin:0 auto;padding:0 clamp(1rem,4vw,2.75rem)}
a{color:var(--amber)}
img{max-width:100%}

/* header ------------------------------------------------------------------- */
.topbar{display:flex;align-items:baseline;justify-content:space-between;gap:1.5rem;
  flex-wrap:wrap;padding:1.6rem 0 1.2rem;border-bottom:1px solid var(--hair)}
.brand{font-family:var(--serif);font-size:clamp(1.35rem,2.4vw,1.8rem);letter-spacing:.01em;
  text-decoration:none;color:var(--parch)}
.brand small{display:block;font-family:var(--sans);font-size:.62rem;letter-spacing:.42em;
  text-transform:uppercase;color:var(--muted);margin-top:.35rem;font-weight:500}
.mainnav{display:flex;gap:clamp(.9rem,2vw,1.7rem);flex-wrap:wrap;align-items:baseline}
.mainnav a{color:var(--muted);text-decoration:none;font-size:.83rem;letter-spacing:.02em;
  padding:.2rem 0;border-bottom:1px solid transparent;transition:color .2s,border-color .2s}
.mainnav a:hover,.mainnav a:focus-visible{color:var(--parch);border-color:var(--hair-strong)}
.mainnav a[aria-current="page"]{color:var(--parch);border-color:var(--amber)}
/* on narrow screens the nav takes the full row so its items wrap instead of
   overflowing off the right edge */
@media(max-width:600px){.mainnav{width:100%;gap:.5rem 1rem}}

/* period title / page title ------------------------------------------------ */
.lede{padding:clamp(2rem,5vw,3.4rem) 0 1.4rem;text-align:center}
.period-title{font-family:var(--serif);font-weight:600;line-height:1.05;
  font-size:clamp(2.2rem,6vw,3.6rem);margin:0;text-wrap:balance;letter-spacing:.005em}
.count{color:var(--muted);font-size:.9rem;margin:.95rem 0 0}

/* period chips ------------------------------------------------------------- */
.periods{display:flex;flex-wrap:wrap;gap:.55rem;padding:1.3rem 0 1.5rem;
  margin-bottom:.5rem;border-bottom:1px solid var(--hair)}
.chip{white-space:nowrap;font-size:.82rem;color:var(--muted);text-decoration:none;
  padding:.42rem .8rem;border:1px solid var(--hair);border-radius:999px;
  transition:color .2s,border-color .2s,background .2s}
.chip:hover,.chip:focus-visible{color:var(--parch);border-color:var(--hair-strong)}
.chip[aria-current="true"],.chip[aria-current="page"]{color:var(--ink);background:var(--amber);
  border-color:var(--amber);font-weight:600}

/* gallery grid -- equal LONG-EDGE, balanced across orientations.
   --L is the long-edge cap; it stays <= 450 (native big size) so the grid only
   ever DOWNSCALES the source -- never upscales. Every work's longest side == L,
   so a portrait and a landscape occupy comparable area. */
.grid{display:flex;flex-wrap:wrap;justify-content:center;align-items:flex-start;
  gap:clamp(1.1rem,2.6vw,2.1rem) clamp(1rem,2.4vw,1.9rem);
  padding-top:2.4rem; --L:clamp(168px,25vw,340px)}
.card{flex:0 0 auto;display:flex;flex-direction:column;align-items:center;background:none;
  border:0;padding:0;margin:0;color:inherit;font:inherit;cursor:zoom-in;text-align:center;
  max-width:var(--L);--ar:1}
a.card,a.card:hover,a.card:focus{text-decoration:none;color:inherit}   /* search-result links look like cards */
/* The .frame is a DEFINITELY sized box: its aspect-ratio (--ar, from the real image
   size) and its width (the long edge fixed to --L, so portrait/landscape carry equal
   weight) are set in CSS -- so the space is reserved before the image loads (no
   cold-load collapse, no layout shift). The image just fills the frame. The caption's
   width:0/min-width:100% trick keeps a long title from widening the card past the frame. */
.frame{display:block;position:relative;overflow:hidden;border:1px solid var(--hair);
  background:#05060a;box-shadow:0 1px 0 rgba(0,0,0,.5);transition:box-shadow .25s;line-height:0;
  aspect-ratio:var(--ar);width:calc(var(--L) * min(1, var(--ar)))}
.frame img{display:block;width:100%;height:100%;object-fit:contain}
/* Triptychs: wide, monumental works -> one per line, filling the column (capped at
   1000px, under even the smallest triptych's native width, so nothing upscales). */
.grid-triptychs .card{width:min(1000px,100%);max-width:100%}
.grid-triptychs .frame{width:100%}
.card:hover .frame{box-shadow:0 0 12px 1px rgba(201,101,31,.55)}
.card:focus-visible{outline:none}
.card:focus-visible .frame{box-shadow:0 0 0 2px var(--amber),0 0 12px 1px rgba(201,101,31,.45)}
.cap{display:block;width:0;min-width:100%;padding:.6rem .1rem .2rem;overflow-wrap:anywhere;
  text-align:center}
.cap .t{display:block;font-family:var(--serif);font-style:italic;font-size:1.02rem;line-height:1.25}
.cap .d{display:block;font-size:.78rem;color:var(--muted);margin-top:.2rem;
  font-variant-numeric:tabular-nums;letter-spacing:.02em}
.cap .sub{display:block;font-size:.72rem;color:var(--muted);margin-top:.28rem;font-style:italic;
  line-height:1.35}

/* home hero -- centered composition: the name alone on top, then two panels
   sitting TOGETHER and centered: left = artist portrait (native size) / dates /
   signature (centered) / CTA buttons; right = the painting. Fit-to-one-screen
   trims are scoped to .page.home so only the home page is tightened. */
.hero{text-align:center;padding:clamp(1.6rem,4vw,2.6rem) 0 0}
.hero .name{font-family:var(--serif);font-weight:600;line-height:1.03;letter-spacing:.01em;
  font-size:clamp(2.2rem,7vw,4.6rem);margin:0}
.hero .panels{display:flex;justify-content:center;align-items:center;
  gap:clamp(1.5rem,4vw,3.5rem);margin-top:clamp(1.8rem,4vw,2.8rem)}
.hero .col{display:flex;flex-direction:column;align-items:center;flex:0 0 auto}
.hero .portrait{display:block;width:auto;height:auto}   /* native size (240x252), never upscaled */
.hero .dates{color:var(--amber);letter-spacing:.4em;text-transform:uppercase;
  font-size:.72rem;font-weight:600;margin:1.1rem 0 0}
/* signature: scanned dark-on-white -> invert + screen blend so it reads as a light
   mark on the dark ground (no image editing needed). Centered under the portrait. */
.hero .sig{display:block;width:190px;height:auto;margin:1.1rem 0 0;
  filter:invert(1);mix-blend-mode:screen;opacity:.88}
.hero .btn-row{margin-top:clamp(1.6rem,3.5vw,2.4rem)}
.hero .art{flex:0 0 auto}
.hero .art img{display:block;width:auto;height:auto;max-height:min(480px,64vh);max-width:100%;
  border:1px solid var(--hair-strong);box-shadow:0 24px 70px rgba(0,0,0,.5)}
@media(max-width:760px){
  .hero .panels{flex-direction:column;gap:clamp(1.5rem,5vw,2.5rem)}
  .hero .art{order:-1}   /* painting leads on mobile */
}
/* home fits one screen: trim the generous global bottom spacing (home only). */
.page.home{padding-bottom:clamp(1.2rem,3vw,2rem)}
.page.home .foot{margin-top:clamp(1.4rem,3.5vw,2.2rem)}
.btn-row{display:flex;gap:.9rem;justify-content:center;flex-wrap:wrap;
  margin-top:clamp(2rem,5vw,3rem)}
.btn{display:inline-block;text-decoration:none;font-size:.9rem;letter-spacing:.03em;
  padding:.7rem 1.4rem;border-radius:999px;border:1px solid var(--hair-strong);
  color:var(--parch);transition:color .2s,border-color .2s,background .2s}
.btn:hover,.btn:focus-visible{border-color:var(--amber);color:var(--parch);outline:none}
.btn.primary{background:var(--amber);border-color:var(--amber);color:var(--ink);font-weight:600}
.btn.primary:hover,.btn.primary:focus-visible{background:#e0782f;border-color:#e0782f}

/* reading prose (biography, copyright) ------------------------------------- */
.page-title{font-family:var(--serif);font-weight:600;line-height:1.05;
  font-size:clamp(2.2rem,6vw,3.6rem);margin:0}
.prose{max-width:66ch;margin:0 auto;line-height:1.75;font-size:1.03rem;color:var(--parch)}
.prose p{margin:0 0 1.2em}
.prose p:last-child{margin-bottom:0}
.prose .signoff{color:var(--muted);font-style:italic;font-family:var(--serif)}
/* biography: b/w portrait floats left (subject looks right, into the text); the text
   wraps around it, and the colour photo spans the full column below. Each figure's
   --ar (set inline) sizes its .frame, so no crop, no letterbox, no cold-load collapse. */
.bio{max-width:620px;margin:0 auto;line-height:1.75;font-size:1.03rem;color:var(--parch)}
.bio p{margin:0 0 1.2em}
.bio p:last-of-type{margin-bottom:0}
.bio-portrait{float:left;width:clamp(200px,42%,250px);margin:.4rem 1.7rem .6rem 0}  /* 250px = the photo's full native width */
.bio-wide{clear:both;margin:clamp(2rem,5vw,3rem) 0 0}
.bio-portrait .frame,.bio-wide .frame{width:100%}
@media(max-width:560px){.bio-portrait{float:none;width:min(240px,72%);margin:0 auto 1.5rem}}
.lead-note{color:var(--muted);max-width:66ch;margin:0 auto;text-align:center;line-height:1.7}
.mail{word-break:break-all}

/* video & audio ------------------------------------------------------------ */
.media-block{max-width:820px;margin:0 auto}
.media-block + .media-block{margin-top:clamp(2.6rem,6vw,4rem)}
.media-title{font-family:var(--serif);font-size:clamp(1.3rem,3vw,1.7rem);margin:0 0 .4rem;
  font-style:italic}
.embed{position:relative;aspect-ratio:16/9;width:100%;background:#05060a;
  border:1px solid var(--hair);overflow:hidden}
.embed iframe{position:absolute;inset:0;width:100%;height:100%;border:0}
.embed + .embed{margin-top:1.1rem}
.desc{color:var(--muted);line-height:1.7;margin:1rem 0 0}
.desc.rtl{direction:rtl;text-align:right}
.audio-row{display:flex;align-items:center;gap:1rem;flex-wrap:wrap;
  padding:1.1rem 0;border-top:1px solid var(--hair)}
.audio-row:last-of-type{border-bottom:1px solid var(--hair)}
.audio-row .label{min-width:15rem;flex:1 1 15rem}
.audio-row .label .t{display:block;font-family:var(--serif);font-style:italic;font-size:1.05rem}
.audio-row .label .s{display:block;color:var(--muted);font-size:.8rem;margin-top:.15rem}
.audio-row audio{flex:1 1 16rem;min-width:14rem;width:100%}

/* search ------------------------------------------------------------------- */
.search-box{max-width:520px;margin:0 auto}
.search-box input{width:100%;font:inherit;font-size:1.05rem;color:var(--parch);
  background:var(--surface);border:1px solid var(--hair-strong);border-radius:999px;
  padding:.85rem 1.3rem;outline:none;transition:border-color .2s}
.search-box input:focus{border-color:var(--amber)}
.search-status{text-align:center;color:var(--muted);font-size:.85rem;margin:1.2rem 0 0}

/* footer ------------------------------------------------------------------- */
.foot{border-top:1px solid var(--hair);margin-top:3rem;padding-top:1.5rem;
  display:flex;justify-content:space-between;flex-wrap:wrap;gap:1rem;
  color:var(--muted);font-size:.78rem}
.foot a{color:var(--muted)}
.foot-links{display:flex;gap:clamp(1rem,3vw,1.6rem);flex-wrap:wrap;align-items:baseline}
.copyright-link{background:none;border:0;padding:0;margin:0;cursor:pointer;
  color:var(--muted);font:inherit;font-size:inherit;letter-spacing:inherit}
.copyright-link .u{text-decoration:underline}
.copyright-link:hover,.copyright-link:focus-visible{color:var(--parch)}

/* copyright popup (native <dialog>) */
.modal{border:0;padding:0;background:transparent;max-width:min(90vw,440px);color:var(--parch)}
.modal::backdrop{background:rgba(6,7,12,.82)}
.modal .modal-body{background:var(--surface);border:1px solid var(--hair-strong);
  padding:clamp(1.6rem,4vw,2.4rem);box-shadow:0 24px 70px rgba(0,0,0,.6)}
.modal h2{font-family:var(--serif);font-weight:400;font-size:1.5rem;margin:0 0 .9rem}
.modal p{color:var(--muted);line-height:1.7;margin:0}
.modal a{color:var(--amber)}
.modal-close{margin-top:1.5rem;background:none;border:1px solid var(--hair-strong);
  color:var(--parch);font:inherit;font-size:.8rem;letter-spacing:.02em;
  padding:.45rem 1.15rem;cursor:pointer}
.modal-close:hover,.modal-close:focus-visible{border-color:var(--amber)}

/* lightbox -- image shown at NATIVE size (max caps only shrink, never enlarge) */
.lb{position:fixed;inset:0;background:rgba(6,7,12,.96);display:none;
  flex-direction:column;align-items:center;justify-content:center;z-index:50;
  padding:clamp(1rem,4vw,3rem)}
.lb.open{display:flex}
.lb img{max-width:92vw;max-height:84vh;width:auto;height:auto;
  box-shadow:0 20px 60px rgba(0,0,0,.6);border:1px solid var(--hair-strong)}
/* the lightbox is a sibling of .page, so it does NOT inherit .page's parchment
   text colour -- set it here or the title renders black-on-black (invisible). */
.lb .lbcap{margin-top:1.1rem;text-align:center;max-width:46ch;color:var(--parch)}
.lb .lbcap .t{font-family:var(--serif);font-style:italic;font-size:1.25rem}
.lb .lbcap .d{color:var(--muted);font-size:.85rem;margin-top:.3rem;
  font-variant-numeric:tabular-nums}
.lbbtn{position:absolute;background:rgba(20,24,34,.7);border:1px solid var(--hair-strong);
  color:var(--parch);width:3rem;height:3rem;border-radius:999px;font-size:1.3rem;
  cursor:pointer;display:flex;align-items:center;justify-content:center;
  transition:background .2s,border-color .2s}
.lbbtn:hover,.lbbtn:focus-visible{background:var(--amber);border-color:var(--amber);
  color:var(--ink);outline:none}
.lb-close{top:clamp(1rem,3vw,1.8rem);right:clamp(1rem,3vw,1.8rem)}
.lb-prev{left:clamp(.5rem,2vw,1.5rem);top:50%;transform:translateY(-50%)}
.lb-next{right:clamp(.5rem,2vw,1.5rem);top:50%;transform:translateY(-50%)}
@media(max-width:520px){.lb img{max-height:72vh}}
@media(prefers-reduced-motion:reduce){*{transition:none!important}}
