/* ============================================================
   Dina Amr — gallery page
   Paper ground, two voices: Inria Serif (editorial) + Montserrat (UI).
   Everything that animates is a transform or opacity, so the page
   stays smooth on a phone.
   ============================================================ */

:root {
  --paper: #f5f4f0;
  --ink: #17140f;
  --ink-mute: #595248;
  --rule: rgba(23, 20, 15, 0.16);
  --ember: #9a3a1c;

  --serif: "Inria Serif", Georgia, "Times New Roman", serif;
  --sans: "Montserrat", ui-sans-serif, system-ui, "Segoe UI", sans-serif;

  --gut: clamp(1.25rem, 5vw, 5rem);
  --page: 90rem;

  /* How tall any single painting is allowed to stand. */
  --plate-h: 78vh;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: clamp(0.9rem, 0.86rem + 0.2vw, 1rem);
  line-height: 1.65;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

h1,
h2,
h3,
p,
dl,
dd,
figure {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

::selection {
  background: var(--ink);
  color: var(--paper);
}

:focus-visible {
  outline: 1px solid var(--ember);
  outline-offset: 4px;
}

/* The bar is sticky, so an anchor jump has to stop short of it. */
[id] {
  scroll-margin-top: 6rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip {
  position: fixed;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 60;
  padding: 0.6rem 1rem;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  transform: translateY(-160%);
}

.skip:focus {
  transform: none;
}

/* ---------- scripted state ----------
   The inline head script adds `.js`, so nothing is ever hidden by CSS
   alone. main.js takes the class back off if GSAP didn't load or the
   visitor asked for reduced motion, and the page renders flat. */

.js .js-fade {
  opacity: 0;
}

.js .js-rule {
  transform: scaleX(0);
}

/* The bar and the name are painted by the intro, not by the browser.
   Both are held back here so a slow GSAP can never show their finished
   state for a frame before the timeline puts them where they start. */
.js .bar,
.js .hero__name {
  opacity: 0;
}

/* A painting is simply not on the wall until it arrives: the whole
   frame fades up, so nothing of the canvas shows beforehand. */
.js [data-plate] .plate__frame {
  opacity: 0;
}

/* ---------- shared primitives ---------- */

/* A rule is always its own 1px element — never a border on a padded
   box — so two neighbouring sections can't double the line. */
.rule {
  display: block;
  height: 1px;
  background: var(--rule);
  transform-origin: left center;
}

.eyebrow,
.plate__index,
.status,
.spec dt,
.bar__nav a,
.foot__nav a,
.foot__copy,
.hero__meta {
  font-size: clamp(0.66rem, 0.62rem + 0.14vw, 0.74rem);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 500;
}

/* ---------- top bar ---------- */

.bar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0.9rem var(--gut);
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.bar .rule--bar {
  position: absolute;
  inset: auto 0 0 0;
}

.bar__mark svg {
  display: block;
  /* The mark is a wide signature (1135 × 613), so it needs real width
     before the D and the A read as letters. */
  width: clamp(4.2rem, 7vw, 6rem);
  height: auto;
  fill: var(--ink);
}

.bar__nav {
  display: flex;
  gap: clamp(0.9rem, 2.4vw, 2.2rem);
}

.bar__nav a {
  position: relative;
  padding-block: 0.15rem;
  color: var(--ink-mute);
  transition: color 0.3s ease;
}

.bar__nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right center;
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.bar__nav a:hover,
.bar__nav a[aria-current="page"] {
  color: var(--ink);
}

.bar__nav a[aria-current="page"]::after {
  transform: scaleX(1);
}

.bar__nav a:hover::after {
  transform: scaleX(1);
  transform-origin: left center;
}

/* On a phone the bar keeps only the two in-page links — Instagram and
   Behance are a tap away in the footer and in the commissions block. */
@media (max-width: 36rem) {
  .bar__nav {
    gap: 1.15rem;
  }

  .bar__nav a[target] {
    display: none;
  }
}

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

.hero {
  position: relative;
  max-width: var(--page);
  margin-inline: auto;
  padding: clamp(3.5rem, 11vh, 8rem) var(--gut) clamp(2.5rem, 6vh, 4.5rem);
}

.hero .rule {
  position: absolute;
  left: var(--gut);
  right: var(--gut);
  bottom: 0;
}

.eyebrow {
  color: var(--ink-mute);
}

.hero__name {
  margin: clamp(0.6rem, 2vw, 1.4rem) 0 clamp(1.6rem, 5vw, 3rem);
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(3.4rem, 15vw, 11rem);
  line-height: 0.86;
  letter-spacing: -0.025em;
}

/* Per-character masks for the intro — each glyph rides up into view. */
.char {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
}

.char__in {
  display: inline-block;
  will-change: transform;
}

.hero__body {
  display: grid;
  gap: clamp(1.25rem, 3vw, 2rem);
  grid-template-columns: 1fr;
}

.lede {
  max-width: 34ch;
  font-family: var(--serif);
  font-size: clamp(1.1rem, 1rem + 0.8vw, 1.6rem);
  line-height: 1.45;
  font-weight: 300;
}

.hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.4rem;
  color: var(--ink-mute);
}

.hero__meta span {
  position: relative;
}

.hero__meta span + span::before {
  content: "";
  position: absolute;
  left: -0.75rem;
  top: 0.55em;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--rule);
}

@media (min-width: 60rem) {
  .hero__body {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
    align-items: end;
  }

  /* On a wide screen the three facts stack into a right-hand column,
     so the dot separators never start a line. */
  .hero__meta {
    flex-direction: column;
    align-items: flex-end;
    gap: 0.35rem;
    text-align: right;
  }

  .hero__meta span + span::before {
    content: none;
  }
}

/* ---------- the works ----------
   Two to a row from 48rem up, one on a phone. Each plate is the
   painting over its caption. The plates are subgrids of the wall,
   so in every row the two canvases stand on one line and the two
   captions start on one line, whatever their proportions. */

.work {
  display: grid;
  gap: clamp(4rem, 9vw, 7rem) clamp(1.5rem, 4vw, 4rem);
  max-width: var(--page);
  margin-inline: auto;
  padding: clamp(4rem, 10vw, 8rem) var(--gut);
}

.plate {
  display: grid;
  gap: clamp(1.1rem, 2vw, 1.75rem);
  align-content: start;
}

@media (min-width: 48rem) {
  .work {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    /* Half a screen each now, so a canvas may stand a little shorter. */
    --plate-h: 70vh;
  }

  .plate {
    grid-row: span 2;
    grid-template-rows: subgrid;
  }

  .plate__frame {
    align-self: end;
  }
}

.work__empty {
  grid-column: 1 / -1;
  color: var(--ink-mute);
  font-family: var(--serif);
  font-style: italic;
}

.plate__frame {
  position: relative;
  width: 100%;
  /* The frame carries the painting's own proportions, capped by height
     so a tall canvas never pushes the caption off the screen. */
  aspect-ratio: var(--ar);
  max-width: calc(var(--plate-h) * var(--ar));
  /* The image nudges to 1.01 on hover, so the frame has to crop it.
     (The frame's own box-shadow is unaffected: overflow clips
     children, not the element's shadow.) */
  overflow: hidden;
  background: var(--lqip) center / cover no-repeat;
  background-color: rgba(23, 20, 15, 0.05);
  cursor: zoom-in;
  box-shadow:
    0 1px 2px rgba(23, 20, 15, 0.08),
    0 30px 60px -40px rgba(23, 20, 15, 0.55);
  transition: box-shadow 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.plate__frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

@media (hover: hover) {
  .plate__frame:hover {
    box-shadow:
      0 2px 4px rgba(23, 20, 15, 0.1),
      0 40px 70px -40px rgba(23, 20, 15, 0.6);
  }

  /* Kept tiny on purpose: the frame now crops, and a painting should
     lose as little of itself as possible to a hover. */
  .plate__frame:hover img {
    transform: scale(1.01);
  }
}

.plate__caption {
  display: grid;
  gap: 0.75rem;
  align-content: start;
  justify-items: start;
}

.plate__index {
  color: var(--ink-mute);
}

.plate__title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.6rem, 1.2rem + 1.2vw, 2.4rem);
  line-height: 1.05;
  letter-spacing: -0.015em;
}

.plate__note {
  margin-top: -0.4rem;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  color: var(--ink-mute);
}

.spec {
  display: grid;
  gap: 0.35rem;
  margin-top: 0.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  width: 100%;
  max-width: 24rem;
}

.spec > div {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
}

.spec dt {
  color: var(--ink-mute);
  padding-top: 0.15em;
}

.spec dd {
  font-family: var(--serif);
  font-size: 1.05em;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.4rem;
  color: var(--ink-mute);
}

.status::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.status--sold {
  color: var(--ember);
}

/* ---------- commissions ---------- */

.commissions {
  position: relative;
  display: grid;
  gap: clamp(1.5rem, 4vw, 3rem);
  max-width: var(--page);
  margin-inline: auto;
  padding: clamp(3.5rem, 9vw, 7rem) var(--gut);
}

.commissions .rule {
  position: absolute;
  left: var(--gut);
  right: var(--gut);
  top: 0;
}

.commissions__title {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(2.2rem, 1.4rem + 4vw, 5rem);
  line-height: 1;
  letter-spacing: -0.02em;
}

.commissions__body {
  display: grid;
  gap: 1.25rem;
  max-width: 46ch;
  font-size: 1.02em;
}

.cta {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  justify-self: start;
  margin-top: 0.75rem;
  padding: 0.85rem 1.6rem;
  border: 1px solid var(--ink);
  border-radius: 999px;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 500;
  overflow: hidden;
  position: relative;
  isolation: isolate;
  transition: color 0.4s ease;
}

.cta::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: right center;
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.cta:hover {
  color: var(--paper);
}

.cta:hover::before {
  transform: scaleX(1);
  transform-origin: left center;
}

.cta svg {
  width: 1.1rem;
  height: 1.1rem;
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.cta:hover svg {
  transform: translateX(3px);
}

@media (min-width: 60rem) {
  .commissions {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
  }
}

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

.foot {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.25rem 2rem;
  max-width: var(--page);
  margin-inline: auto;
  padding: clamp(2.5rem, 6vw, 4rem) var(--gut) clamp(2rem, 5vw, 3rem);
}

.foot .rule {
  position: absolute;
  left: var(--gut);
  right: var(--gut);
  top: 0;
}

.foot__name {
  font-family: var(--serif);
  font-size: clamp(1.3rem, 1rem + 1.4vw, 2rem);
  font-weight: 300;
}

.foot__nav {
  display: flex;
  gap: 1.5rem;
}

.foot__nav a {
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.15rem;
  transition: border-color 0.3s ease;
}

.foot__nav a:hover {
  border-color: var(--ink);
}

.foot__copy {
  color: var(--ink-mute);
  letter-spacing: 0.1em;
}

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

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: clamp(1rem, 4vw, 3rem);
}

.lightbox[hidden] {
  display: none;
}

.lightbox__scrim {
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--paper) 94%, var(--ink));
  opacity: 0;
}

.lightbox__figure {
  position: relative;
  display: grid;
  gap: 0.9rem;
  justify-items: center;
  max-width: 100%;
}

.lightbox__figure img {
  max-width: 100%;
  max-height: 78vh;
  width: auto;
  height: auto;
  object-fit: contain;
  box-shadow: 0 40px 80px -50px rgba(23, 20, 15, 0.7);
  will-change: transform;
}

.lightbox figcaption {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem 1rem;
  text-align: center;
}

.lightbox figcaption strong {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.25rem;
}

.lightbox figcaption span {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.lightbox__close {
  position: absolute;
  top: clamp(0.75rem, 3vw, 1.75rem);
  right: clamp(0.75rem, 3vw, 1.75rem);
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition:
    background 0.3s ease,
    color 0.3s ease;
}

.lightbox__close:hover {
  background: var(--ink);
  color: var(--paper);
}

.lightbox__close svg {
  width: 1.1rem;
  height: 1.1rem;
}

body.is-locked {
  overflow: hidden;
}

/* ---------- reduced motion ---------- */

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

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}

/* ---------- interest ----------
   A quieter sibling of .cta: available work carries one, the
   commissions section reuses the big one. Both open the same
   dialog, which is the only thing on the page that is a form. */

.ask {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  justify-self: start;
  margin-top: 0.2rem;
  padding: 0.6rem 1.15rem;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: none;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.25s ease, color 0.25s ease;
}

.ask:hover,
.ask:focus-visible {
  background: var(--ink);
  color: var(--paper);
}

/* ---------- the dialog ---------- */

.enq {
  width: min(100%, 30rem);
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
}

.enq::backdrop {
  background: rgba(23, 20, 15, 0.55);
  backdrop-filter: blur(2px);
}

.enq__in {
  padding: clamp(1.5rem, 5vw, 2.5rem);
}

.enq__eyebrow {
  margin: 0;
  color: var(--ink-mute);
  font-family: var(--sans);
  font-size: 0.65rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.enq__title {
  margin: 0.4rem 0 1.5rem;
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(1.6rem, 5vw, 2.2rem);
  line-height: 1.1;
}

.enq__field {
  display: block;
  margin-bottom: 1rem;
}

.enq__field > span {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--ink-mute);
  font-family: var(--sans);
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.enq input,
.enq textarea {
  width: 100%;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--rule);
  border-radius: 2px;
  background: #fff;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.9rem;
}

.enq textarea {
  min-height: 6rem;
  resize: vertical;
}

.enq input:focus,
.enq textarea:focus {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}

/* Nobody sees this, so nobody fills it in. */
.enq__trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.enq__row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1.5rem;
}

.enq__send {
  padding: 0.8rem 1.6rem;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
}

.enq__send[disabled] {
  opacity: 0.5;
  cursor: default;
}

.enq__close {
  margin-left: auto;
  border: 0;
  background: none;
  color: var(--ink-mute);
  font-family: var(--sans);
  font-size: 0.75rem;
  text-decoration: underline;
  cursor: pointer;
}

.enq__says {
  margin: 1rem 0 0;
  font-family: var(--sans);
  font-size: 0.8rem;
  color: var(--ink-mute);
}

.enq__says--bad {
  color: var(--ember);
}

.enq__done {
  padding: clamp(1.5rem, 5vw, 2.5rem);
  text-align: center;
}

.enq__done p {
  margin: 0 0 1.5rem;
  font-family: var(--serif);
  font-size: 1.2rem;
}

@media (prefers-reduced-motion: no-preference) {
  .enq[open] {
    animation: enq-in 0.28s ease-out;
  }
}

@keyframes enq-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
