/* Sami Samara — gallery. The room is a warm plaster wall; everything else
   stays quiet so the paintings carry the colour. */

:root {
  --wall:        #efeae1;
  --wall-deep:   #e2dacd;
  --paper:       #fbf9f5;
  --ink:         #29241f;
  --ink-soft:    #5d554c;
  --muted:       #8b8177;
  --gold:        #9a7b43;
  --gold-light:  #c4a366;
  --line:        #d8cfc0;
  --frame:       #2b2521;
  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans:  "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --arabic: "Noto Naskh Arabic", "Segoe UI", serif;
}

* { box-sizing: border-box; }

/* An author `display` rule outranks the browser's [hidden] styling, so the
   dialogs below would otherwise sit open over the gallery on first paint. */
[hidden] { display: none !important; }

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

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background-color: var(--wall);
  /* A faint plaster grain plus a vignette, so the wall is not a flat fill. */
  background-image:
    radial-gradient(ellipse 120% 80% at 50% -10%, rgba(255,255,255,.75), transparent 60%),
    radial-gradient(ellipse 100% 100% at 50% 120%, rgba(120,100,75,.13), transparent 65%);
  background-attachment: fixed;
  line-height: 1.6;
}

/* ---------- hero ---------- */

.hero {
  text-align: center;
  padding: clamp(4rem, 10vw, 8rem) 1.5rem 0;
  max-width: 52rem;
  margin: 0 auto;
}

.hero-eyebrow {
  font-size: .72rem;
  letter-spacing: .34em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 1rem;
}

.hero-name {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(3rem, 11vw, 5.75rem);
  line-height: 1;
  letter-spacing: .01em;
  margin: 0;
}

.hero-name-ar {
  font-family: var(--arabic);
  font-size: clamp(1.5rem, 5vw, 2.25rem);
  color: var(--gold);
  margin: .5rem 0 0;
  line-height: 1.5;
}

.hero-dates {
  font-size: .68rem;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 1.5rem 0 0;
}

/* The note about the artist, set ragged-left like the opening page of a
   catalogue rather than centred like a poster. */
.bio {
  max-width: 34rem;
  margin: 2.75rem auto 0;
  text-align: left;
}

.bio p {
  font-family: var(--serif);
  font-size: clamp(1.05rem, 2.1vw, 1.24rem);
  line-height: 1.75;
  color: var(--ink-soft);
  margin: 0 0 1.15rem;
}

.bio p:last-child { margin-bottom: 0; }
.bio em { color: var(--ink); }

.bio p:first-of-type::first-letter {
  float: left;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 3.5em;
  line-height: .74;
  color: var(--gold);
  padding: .06em .1em 0 0;
}

/* A hairline rule, the way a gallery sets off a title panel. */
.hero::after {
  content: "";
  display: block;
  width: 4.5rem;
  height: 1px;
  background: var(--line);
  margin: 2.75rem auto 0;
}

/* ---------- exhibition note ---------- */

.note {
  max-width: 40rem;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 0;
  text-align: center;
}

.note p {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.15rem, 2.7vw, 1.5rem);
  line-height: 1.55;
  color: var(--ink);
  margin: 0;
}

/* ---------- countdown ---------- */

.countdown {
  text-align: center;
  padding: 1.5rem 1.5rem 0;
}

.countdown-label {
  font-size: .72rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 1.1rem;
}

.clock {
  display: flex;
  justify-content: center;
  gap: clamp(1rem, 4vw, 2.5rem);
}

.unit { min-width: 3.5rem; }

.num {
  display: block;
  font-family: var(--serif);
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: lining-nums tabular-nums;
}

.cap {
  display: block;
  font-size: .62rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: .45rem;
}

.countdown-closed {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.3rem;
  color: var(--gold);
  margin: .5rem 0 0;
}

/* ---------- gallery ---------- */

/* Each piece is a spread: canvas on one side, its wall text on the other,
   sides alternating down the page, so the eye zig-zags through an exhibition
   instead of scanning a product grid. */
.gallery {
  max-width: 74rem;
  margin: 0 auto;
  padding: clamp(3.5rem, 9vw, 7rem) clamp(1.25rem, 5vw, 4rem) 2rem;
  counter-reset: plate;
}

.loading {
  text-align: center;
  font-family: var(--serif);
  font-style: italic;
  color: var(--muted);
}

.piece {
  counter-increment: plate;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: clamp(2rem, 6vw, 5rem);
  align-items: center;
  margin-bottom: clamp(5rem, 13vw, 10rem);
}

.piece:last-child { margin-bottom: 2rem; }

.piece:nth-child(even) .piece-hang { order: 2; }
.piece:nth-child(even) .piece-text { order: 1; }

.piece-hang {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* The plate number, ghosted into the plaster behind the canvas. */
.piece-hang::after {
  content: counter(plate, upper-roman);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -54%);
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(9rem, 22vw, 17rem);
  line-height: .8;
  color: rgba(41, 36, 31, .055);
  pointer-events: none;
  z-index: 0;
}

.frame {
  position: relative;
  z-index: 1;
  display: inline-block;
  padding: .6rem;
  border: 0;
  background: linear-gradient(160deg, #3a322b, #211c18 55%, #342c25);
  border-radius: 2px;
  cursor: zoom-in;
  box-shadow:
    0 1px 2px rgba(40,30,20,.28),
    0 18px 36px -12px rgba(50,38,25,.45);
  transition: transform .35s cubic-bezier(.2,.7,.3,1), box-shadow .35s;
}

/* Hung by a six-year-old: nothing on this wall is quite straight until you
   lean in, at which point it politely squares up. */
.piece:nth-child(odd)  .frame { transform: rotate(-.75deg); }
.piece:nth-child(even) .frame { transform: rotate(.85deg); }

/* Must out-specify the nth-child tilt rules above, or the lift never lands. */
.piece .frame:hover,
.piece .frame:focus-visible {
  transform: rotate(0deg) translateY(-8px);
  box-shadow:
    0 2px 3px rgba(40,30,20,.3),
    0 30px 54px -14px rgba(50,38,25,.5);
}

.frame:focus-visible { outline: 2px solid var(--gold); outline-offset: 5px; }

/* The mat board between frame and canvas. */
.frame-mat {
  display: block;
  padding: clamp(.7rem, 1.8vw, 1.15rem);
  background: var(--paper);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.07);
}

.frame img {
  display: block;
  max-height: clamp(15rem, 40vh, 27rem);
  width: auto;
  max-width: 100%;
  box-shadow: 0 0 0 1px rgba(0,0,0,.1), inset 0 0 30px rgba(0,0,0,.05);
}

/* ---------- wall text ---------- */

.piece-text { max-width: 31rem; }

.plate {
  font-size: .66rem;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 .7rem;
}

.plate::before { content: "Plate " counter(plate, upper-roman); }

.label-title {
  font-family: var(--serif);
  font-size: clamp(2.1rem, 4.5vw, 2.9rem);
  font-weight: 600;
  line-height: 1.05;
  margin: 0;
}

.label-title-ar {
  font-family: var(--arabic);
  font-size: 1.4rem;
  color: var(--gold);
  margin: .35rem 0 0;
  line-height: 1.6;
}

.label-medium {
  font-size: .7rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
  margin: .9rem 0 0;
}

.story {
  font-family: var(--serif);
  font-size: clamp(1.02rem, 2vw, 1.15rem);
  line-height: 1.78;
  color: var(--ink-soft);
  margin: 1.3rem 0 0;
}

.story::first-letter {
  float: left;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 3.1em;
  line-height: .76;
  color: var(--gold);
  padding: .05em .1em 0 0;
}

/* ---------- the money, kept quiet under a hairline ---------- */

.label {
  margin-top: 1.75rem;
  padding-top: 1.35rem;
  border-top: 1px solid var(--line);
  text-align: left;
}

.price-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}

.price-caption {
  font-size: .64rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 .15rem;
}

.price-value {
  font-family: var(--serif);
  font-size: 1.65rem;
  font-weight: 600;
  line-height: 1;
  margin: 0;
  font-variant-numeric: lining-nums tabular-nums;
}

.price-value.is-start { color: var(--muted); font-size: 1.25rem; }

.leader {
  font-size: .88rem;
  color: var(--ink-soft);
  margin: .9rem 0 0;
}

.leader strong { color: var(--ink); font-weight: 600; }
.leader.is-empty { color: var(--muted); font-style: italic; }

.bid-history {
  list-style: none;
  margin: .9rem 0 0;
  padding: .9rem 0 0;
  border-top: 1px dotted var(--line);
  font-size: .8rem;
  color: var(--muted);
}

.bid-history li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: .12rem 0;
}

.bid-history li span:last-child { font-variant-numeric: tabular-nums; }

.btn-primary {
  display: block;
  width: 100%;
  max-width: 20rem;
  margin-top: 1.5rem;
  padding: .85rem 1rem;
  font-family: var(--sans);
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--paper);
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 2px;
  cursor: pointer;
  transition: background .2s, color .2s;
}

.btn-primary:hover { background: var(--gold); border-color: var(--gold); }
.btn-primary:disabled { background: var(--line); border-color: var(--line); color: var(--muted); cursor: default; }

.sold {
  margin-top: 1.5rem;
  padding: .8rem;
  font-family: var(--serif);
  font-size: 1.05rem;
  font-style: italic;
  color: var(--gold);
  border: 1px solid var(--gold-light);
  background: rgba(196,163,102,.09);
}

/* One column on narrow screens: the zig-zag and the tilt both stop. */
@media (max-width: 60rem) {
  .piece {
    grid-template-columns: 1fr;
    gap: 2.25rem;
    margin-bottom: clamp(4rem, 14vw, 7rem);
  }
  .piece:nth-child(even) .piece-hang,
  .piece:nth-child(even) .piece-text { order: 0; }
  .piece-text { max-width: none; }
  .piece:nth-child(odd)  .frame,
  .piece:nth-child(even) .frame { transform: none; }
}

/* ---------- modal ---------- */

.modal, .lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(30,24,18,.62);
  backdrop-filter: blur(3px);
  animation: fade .22s ease;
}

@keyframes fade { from { opacity: 0; } }

.modal-card {
  position: relative;
  width: min(26rem, 100%);
  max-height: 92vh;
  overflow-y: auto;
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 2.25rem 2rem 2rem;
  text-align: center;
  box-shadow: 0 30px 70px -20px rgba(30,20,10,.55);
}

.modal-close {
  position: absolute;
  top: .35rem;
  right: .6rem;
  font-size: 1.9rem;
  line-height: 1;
  color: var(--muted);
  background: none;
  border: 0;
  cursor: pointer;
  padding: .25rem .4rem;
}

.modal-close:hover { color: var(--ink); }

.modal-eyebrow {
  font-size: .64rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}

.modal-title {
  font-family: var(--serif);
  font-size: 2.1rem;
  font-weight: 600;
  margin: .25rem 0 0;
}

.modal-sub { font-size: .88rem; color: var(--ink-soft); margin: .5rem 0 1.6rem; }

.field { display: block; text-align: left; margin-bottom: 1.1rem; }

.field-label {
  display: block;
  font-size: .64rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: .45rem;
}

.field input {
  width: 100%;
  padding: .7rem .8rem;
  font-family: var(--sans);
  font-size: 1rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 2px;
}

.field input:focus { outline: 2px solid var(--gold); outline-offset: -1px; border-color: var(--gold); }

.amount { display: flex; align-items: stretch; }

.amount-cur {
  display: flex;
  align-items: center;
  padding: 0 .75rem;
  font-size: .8rem;
  letter-spacing: .08em;
  color: var(--muted);
  background: var(--wall);
  border: 1px solid var(--line);
  border-right: 0;
}

.amount input { border-radius: 0; }

.form-error {
  margin: 0 0 1rem;
  padding: .6rem .75rem;
  font-size: .85rem;
  color: #8a2c22;
  background: rgba(138,44,34,.07);
  border: 1px solid rgba(138,44,34,.25);
  text-align: left;
}

/* ---------- lightbox ---------- */

.lightbox { cursor: zoom-out; background: rgba(22,18,14,.9); }

.lightbox-figure { margin: 0; text-align: center; max-width: 100%; }

.lightbox-figure img {
  max-width: min(92vw, 68rem);
  max-height: 80vh;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
}

.lightbox-figure figcaption {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-style: italic;
  color: var(--wall);
  margin-top: 1.1rem;
}

.lightbox-close { color: var(--wall); top: 1rem; right: 1.25rem; font-size: 2.4rem; }

/* ---------- footer ---------- */

.footer {
  text-align: center;
  padding: 2.5rem 1.5rem 4rem;
  font-size: .8rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
  max-width: 42rem;
  margin: 0 auto;
}

.footer p { margin: 0; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
