/* aonb.my — skeleton. a white gallery: one painting per wall, half the space empty. */

@font-face {
  font-family: "Carlito";
  src: url("fonts/Carlito-Regular.ttf") format("truetype");
  font-weight: 100 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Carlito";
  src: url("fonts/Carlito-Italic.ttf") format("truetype");
  font-weight: 100 400;
  font-style: italic;
  font-display: swap;
}

:root {
  --wall: #ffffff;
  --ink: #1a1a1a;
  --ink-soft: #3a3a3a;
  --quiet: #9b9b9b;
  --warm: 255, 196, 120;               /* spotlight colour */
  /* safe areas (notches, rounded corners, home bar) + a generous gutter */
  --gut: clamp(16px, 5vmin, 72px);
  --pt: calc(env(safe-area-inset-top, 0px) + var(--gut));
  --pb: calc(env(safe-area-inset-bottom, 0px) + var(--gut));
  --pl: calc(env(safe-area-inset-left, 0px) + var(--gut));
  --pr: calc(env(safe-area-inset-right, 0px) + var(--gut));
  /* scroll distance per picture inside a frame */
  --step: 55vh;
  --screen: 100vh;
}
@supports (height: 100svh) {
  /* svh = the screen with the browser bars showing; stable, so nothing jumps
     when the address bar hides (the extra strip is white wall anyway). */
  :root { --step: 55svh; --screen: 100svh; }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--wall); -webkit-text-size-adjust: 100%; }
body {
  font-family: "Carlito", "Calibri", "Segoe UI", sans-serif;
  font-weight: 400;
  color: var(--ink);
  background: var(--wall);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

/* hairline: a thin white stroke shaves the letters below "light" */
.hair {
  font-weight: 400;
  color: #111;
  -webkit-text-stroke: 0.035em var(--wall);
  letter-spacing: 0.02em;
}

/* ---------- opening & closing walls ---------- */
.opening, .closing {
  min-height: var(--screen);
  display: grid;
  place-content: center;
  text-align: center;
  padding: var(--pt) var(--pr) var(--pb) var(--pl);
}
.opening h1 {
  font-size: clamp(1.7rem, 7.5vw, 4.2rem);
  line-height: 1.15;
  max-width: 14ch;
  margin-inline: auto;
}
@media (min-aspect-ratio: 4/5) { .opening h1 { max-width: none; font-size: clamp(1.7rem, 5vw, 4.2rem); } }
.closing { min-height: calc(var(--screen) * 0.9); gap: 1.2em; }
.closing-name { font-size: clamp(1.4rem, 5vw, 2.6rem); }
.closing-mail { font-size: 0.85rem; color: var(--quiet); letter-spacing: 0.03em; }

/* ---------- a run: one project, scrolled through while its wall stays pinned ---------- */
.run {
  position: relative;
  height: calc(var(--screen) + var(--steps) * var(--step));
}
.run + .run { margin-top: calc(var(--screen) * 0.12); } /* a breath between walls */

.wall {
  position: sticky;
  top: 0;
  height: var(--screen);
  display: grid;
  padding: var(--pt) var(--pr) var(--pb) var(--pl);
  /* narrow phones: painting on top, label tucked beside its lower corner */
  grid-template-rows: auto auto;
  grid-template-areas: "piece" "label";
  align-content: center;
  row-gap: clamp(10px, 2.5svh, 24px);
}

/* ---------- the painting ---------- */
.piece {
  grid-area: piece;
  container-type: inline-size; /* narrow: frame sizes from the width, capped in height */
  display: grid;
  place-items: center;
  min-height: 0;
}
/* one frame for every painting: a slim, flat modern gallery moulding.
   only the wood (--wood base colour, --grain strength) changes per project. */
.frame {
  --b: clamp(7px, 1.1vmin + 4px, 14px);   /* moulding width: identical on every frame */
  --m: clamp(12px, 3.4vmin, 38px);        /* mat width: identical on every frame */
  --t: calc(var(--b) + var(--m));
  --room: 0.84;                            /* leave wall for the light */
  position: relative;
  padding: var(--b);
  background: linear-gradient(135deg, rgba(255,255,255,.10), rgba(0,0,0,.10)), var(--wood);
  box-shadow:
    inset 0 0 0 1px rgba(0,0,0,.22),            /* crisp outer edge */
    inset 1px 1px 0 1px rgba(255,255,255,.10),  /* soft light on the top-left arris */
    0 2px 3px rgba(0,0,0,.12),
    0 12px 28px -6px rgba(60,40,20,.18);        /* hangs a little off the wall */
}
.grain {
  position: absolute; inset: 0; pointer-events: none;
  opacity: var(--grain, .35);
  mix-blend-mode: multiply;
  background-size: 200px 2000px;
}
/* sides: vertical grain */
.grain--side { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='2000'><filter id='g'><feTurbulence type='fractalNoise' baseFrequency='0.55 0.006' numOctaves='3' stitchTiles='stitch' seed='3'/><feColorMatrix values='0 0 0 0 0.25  0 0 0 0 0.15  0 0 0 0 0.08  2.4 0 0 0 -0.9'/></filter><rect width='100%' height='100%' filter='url(%23g)'/></svg>"); }
/* top and bottom rails: horizontal grain, mitred at 45 degrees */
.grain--top, .grain--bottom { background-color: var(--wood); opacity: 1; mix-blend-mode: normal; }
.grain--top::before, .grain--bottom::before {
  content: ""; position: absolute; inset: 0;
  opacity: var(--grain, .35);
  mix-blend-mode: multiply;
  background-size: 2000px 200px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='2000' height='200'><filter id='g'><feTurbulence type='fractalNoise' baseFrequency='0.006 0.55' numOctaves='3' stitchTiles='stitch' seed='9'/><feColorMatrix values='0 0 0 0 0.25  0 0 0 0 0.15  0 0 0 0 0.08  2.4 0 0 0 -0.9'/></filter><rect width='100%' height='100%' filter='url(%23g)'/></svg>");
}
.grain--top    { clip-path: polygon(0 0, 100% 0, calc(100% - var(--b)) var(--b), var(--b) var(--b)); }
.grain--bottom { clip-path: polygon(0 100%, 100% 100%, calc(100% - var(--b)) calc(100% - var(--b)), var(--b) calc(100% - var(--b))); }
/* the rails' highlight/edge sit on top of the grain */
.frame::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.25), inset 0 1px 0 1px rgba(255,255,255,.08);
}
/* warm pools of light on the wall around the frame, from the four lamps */
.frame::before {
  content: "";
  position: absolute;
  inset: -16cqmin;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(closest-side at 12% 12%, rgba(var(--warm), .20), transparent),
    radial-gradient(closest-side at 88% 12%, rgba(var(--warm), .20), transparent),
    radial-gradient(closest-side at 12% 88%, rgba(var(--warm), .14), transparent),
    radial-gradient(closest-side at 88% 88%, rgba(var(--warm), .14), transparent),
    radial-gradient(closest-side, rgba(var(--warm), .10), transparent 100%);
  filter: blur(6px);
}
.mat {
  position: relative; z-index: 1;
  padding: var(--m);
  background: #f8f6f1;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.05), inset 1px 2px 3px rgba(0,0,0,.18);
}
.canvas {
  position: relative;
  overflow: hidden;
  aspect-ratio: var(--ar);
  --max-h: calc(var(--screen) * 0.58);   /* narrow: leave room for the label */
  width: min(
    calc(var(--size) * var(--room) * 100cqw - 2 * var(--t)),
    calc((var(--size) * var(--max-h) - 2 * var(--t)) * var(--ar))
  );
  background: #ccc;
  box-shadow: 0 0 0 1px rgba(0,0,0,.12);   /* bevel edge of the mat */
}
.layer { position: absolute; inset: 0; will-change: opacity; }
.layer img { width: 100%; height: 100%; object-fit: cover; display: block; }
.warmth {
  position: absolute; inset: 0; pointer-events: none;
  mix-blend-mode: soft-light;
  background:
    radial-gradient(circle at 0 0, rgba(var(--warm), .55), transparent 55%),
    radial-gradient(circle at 100% 0, rgba(var(--warm), .55), transparent 55%),
    radial-gradient(circle at 0 100%, rgba(var(--warm), .35), transparent 55%),
    radial-gradient(circle at 100% 100%, rgba(var(--warm), .35), transparent 55%);
}

/* placeholder pictures */
.ph-label {
  position: absolute; inset: auto 0 8% 0;
  display: grid; gap: .3em; justify-items: center;
  padding-inline: 6%;
  font-size: clamp(9px, 4.2cqmin, 15px);
  color: rgba(255,255,255,.9);
  letter-spacing: .04em;
  text-align: center;
}
.ph-count { opacity: .7; font-size: .85em; }

/* the four spotlights: no visible fixtures, just a soft warm bloom at each corner
   where the light comes from, aimed in at the painting */
.lamp {
  --s: clamp(18px, 6cqmin, 44px);
  position: absolute; z-index: 2; pointer-events: none;
  width: var(--s); height: var(--s);
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 232, 190, .55), rgba(var(--warm), .18) 55%, transparent);
}
.lamp--tl { left: calc(var(--s) * -.75); top: calc(var(--s) * -.75); }
.lamp--tr { right: calc(var(--s) * -.75); top: calc(var(--s) * -.75); }
.lamp--bl { left: calc(var(--s) * -.75); bottom: calc(var(--s) * -.75); opacity: .75; }
.lamp--br { right: calc(var(--s) * -.75); bottom: calc(var(--s) * -.75); opacity: .75; }

/* woods: same frame, different timber */
.frame--walnut { --wood: #5b3a24; --grain: calc(.55 * 1.6); }
.frame--oak    { --wood: #b99262; --grain: calc(.40 * 1.6); }
.frame--teak   { --wood: #8a5a32; --grain: calc(.50 * 1.6); }
.frame--ebony  { --wood: #1f1b19; --grain: calc(.25 * 1.6); }
.frame--ash    { --wood: #d9cbb2; --grain: calc(.30 * 1.6); }
.frame--cherry { --wood: #8e4a32; --grain: calc(.45 * 1.6); }

/* ---------- the museum label ---------- */
.label {
  grid-area: label;
  justify-self: end;               /* hangs off the painting's lower-right corner */
  width: min(100%, 30ch);
  font-size: clamp(11px, 3.3vw, 14px);
  line-height: 1.45;
  color: var(--ink-soft);
  letter-spacing: .01em;
}
.wall--flip .label { justify-self: start; }
.label-name { font-weight: 400; font-size: 1.25em; color: var(--ink); letter-spacing: .02em; }
.label-place { color: var(--quiet); margin-bottom: .9em; }
.label-body p { margin: 0; }
.label-now { margin-top: .9em; color: var(--quiet); font-size: .9em; min-height: 1.45em; }
.label-now::before { content: "now showing · "; }
.label-stage { color: var(--ink-soft); font-size: .9em; }
.label-status { margin-top: .5em; font-size: .9em; letter-spacing: .04em; }
.label-status--sold { color: var(--quiet); font-style: italic; }
.label-status--available { color: var(--ink-soft); font-style: normal; }

/* very short phones: keep the label to essentials so the painting stays big */
@media (max-aspect-ratio: 4/5) and (max-height: 700px) {
  .label-body p:nth-child(n+3) { display: none; }
}

/* ---------- wide / near-square screens: true side-by-side, at eye level ----------
   two equal halves, so on a foldable the painting and the label each keep to
   their own half and nothing lands in the crease. */
@media (min-width: 600px) and (min-aspect-ratio: 4/5) {
  .wall {
    grid-template-rows: minmax(0, 1fr);
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas: "piece label";
    column-gap: calc(var(--gut) * 2);
  }
  .wall--flip { grid-template-areas: "label piece"; }
  .label {
    align-self: center;
    justify-self: start;           /* close to the painting, not the screen edge */
    width: min(100%, 34ch);
    font-size: clamp(13px, 1.5vw, 17px);
  }
  .wall--flip .label { justify-self: end; }
  .wall { align-content: stretch; }
  .piece { container-type: size; justify-items: end; }   /* frame and label meet near the middle */
  .wall--flip .piece { justify-items: start; }
  .frame { --room: 0.86; }
  .canvas { --max-h: 100cqh; --room-h: 0.8; width: min(
    calc(var(--size) * var(--room) * 100cqw - 2 * var(--t)),
    calc((var(--size) * var(--room-h) * 100cqh - 2 * var(--t)) * var(--ar))); }
}

/* real dual-screen / foldable devices that report their hinge */
@media (horizontal-viewport-segments: 2) {
  .wall {
    padding-inline: 0;
    grid-template-columns:
      env(viewport-segment-width 0 0)
      calc(env(viewport-segment-left 1 0) - env(viewport-segment-right 0 0))
      env(viewport-segment-width 1 0);
    grid-template-areas: "piece hinge label";
    column-gap: 0;
  }
  .wall--flip { grid-template-areas: "label hinge piece"; }
  .label { justify-self: center; padding-inline: var(--gut); }
  .wall--flip .label { justify-self: center; }
}
@media (vertical-viewport-segments: 2) {
  .wall {
    grid-template-columns: 1fr;
    grid-template-rows:
      env(viewport-segment-height 0 0)
      calc(env(viewport-segment-top 0 1) - env(viewport-segment-bottom 0 0))
      env(viewport-segment-height 0 1);
    grid-template-areas: "piece" "hinge" "label";
    padding-block: 0;
  }
  .label { align-self: center; justify-self: center; }
}

/* reduced motion: no blending; the picture changes in plain cuts */
@media (prefers-reduced-motion: reduce) {
  .layer { will-change: auto; }
}
