/* ============================================================
   PAINTINGS — a gallery inside a Mac OS 9 window
   Platinum grey · pinstriped title bars · 1px black bevels
   ============================================================ */

:root{
  /* Platinum: the grey of Mac OS 9. Every background in here is a pure mix
     of black and white (r=g=b): #a9a9a9 for the desktop, #dddddd for the
     windows. Keep it that way, or the surround tints the paintings. */
  --bg:        #a9a9a9;   /* 169,169,169 */
  --bg-2:      #dddddd;   /* 221,221,221 */
  --line:      #b9b9b9;   /* 185,185,185 */

  --txt:       #111111;
  --txt-dim:   #333333;
  --txt-faint: #5c5c5c;

  --blue:      #3355cc;

  /* every title: the masthead, window bars, painting names, read_me heading */
  --display: "Times New Roman", Times, "Liberation Serif", serif;
  --ui:      "Chicago", "Charcoal", "Geneva", Verdana, Tahoma, sans-serif;
  --mono:    "Geneva", Verdana, Tahoma, "DejaVu Sans", sans-serif;

  color-scheme:light;
}

*{ box-sizing:border-box; }

html{ background:var(--bg); }

body{
  margin:0;
  min-height:100vh;
  padding:0 0 max(64px, calc(48px + env(safe-area-inset-bottom, 0px)));
  -webkit-text-size-adjust:100%;
  text-size-adjust:100%;
  -webkit-tap-highlight-color:transparent;
  font-family:var(--mono);
  font-size:13px;
  line-height:1.62;
  color:var(--txt);
  /* the desktop: one flat grey of exactly r=g=b, so nothing in it can put
     a colour cast on the paintings. Keep every background grey neutral. */
  background-color:var(--bg);
}

::selection{ background:#3355cc; color:#fff; }


/* ------------------------------------------------------------ page */
.desktop{
  padding:30px 16px 0;
}

/* ----------------------------------------------------------- panel */
.window{
  position:relative;
  background:var(--bg-2);
  border:1px solid #000;
  box-shadow:
    inset 1px 1px 0 #fff,
    inset -1px -1px 0 #8c8c8c,
    2px 2px 0 rgba(0,0,0,.3);
}
.window:focus{ outline:none; }
.window:focus-visible{ outline:none; }

.main-window{
  width:min(1080px, 100%);
  margin:0 auto;
}

.titlebar{
  display:flex;
  align-items:center;
  gap:8px;
  height:22px;
  padding:0 6px;
  /* pinstripes */
  background:repeating-linear-gradient(180deg, #fdfdfd 0 1px, #cdcdcd 1px 2px);
  border-bottom:1px solid #000;
  user-select:none;
}
.title{
  flex:1;
  min-width:0;
  font-family:var(--display);
  font-size:12px;
  font-weight:700;
  color:#000;
  text-align:center;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.closebox{
  flex:0 0 auto;
  order:-1;
  display:flex;
  align-items:center;
  justify-content:center;
  width:15px;
  height:15px;
  padding:0;
  background:#e9e9e9;
  border:1px solid #000;
  color:#000;
  font-family:var(--ui);
  font-size:10px;
  line-height:1;
  cursor:pointer;
  touch-action:manipulation;
}
.closebox:hover{ background:#fff; }
.closebox:focus-visible{ outline:1px dotted #000; outline-offset:1px; }

.window-body{ padding:0 24px 26px; }

/* -------------------------------------------------------- masthead */
.masthead{ padding:26px 0 0; container-type:inline-size; }

.masthead-name{
  display:block;
  margin:0 0 16px;
  font-family:var(--display);
  /* one line at any width: app.js measures the name's width in ems into
     --name-em, so a longer name renders smaller instead of wrapping */
  font-size:min(44px, calc((100cqi - 12px) / var(--name-em, 14)));
  font-weight:700;
  line-height:1.15;
  letter-spacing:0;
  white-space:nowrap;
  color:#000;
}
.masthead-caret{
  display:inline-block;
  width:.3em;
  height:.82em;
  margin-left:10px;
  vertical-align:middle;
  background:#000;
  animation:blink 1.1s step-end infinite;
}

@keyframes blink{
  0%, 55%{ opacity:1; }
  55.001%, 100%{ opacity:0; }
}

.masthead-sub{
  margin:0;
  font-size:11.5px;
  line-height:1.75;
  color:var(--txt-faint);
}
.masthead-sub a{ color:#0000cc; }
/* the read_me window needs a door on every screen size */
.masthead-btn{
  position:relative;
  display:inline-block;
  vertical-align:middle;
  padding:0 6px;
  border:1px solid #000;
  border-radius:4px;
  background:#f4f4f4;
  box-shadow:inset 0 1px 0 #fff, 0 1px 0 rgba(0,0,0,.3);
  color:#000;
  font-family:var(--ui);
  font-size:11px;
  letter-spacing:0;
  line-height:1.45;
  cursor:pointer;
  touch-action:manipulation;
  -webkit-tap-highlight-color:transparent;
}
.masthead-btn:hover,
.masthead-btn:focus-visible{ background:#fff; outline:none; }
.masthead-btn:active{ background:#c9c9c9; box-shadow:inset 0 1px 2px rgba(0,0,0,.35); }

/* -------------------------------------------------- works, one/row */
.gallery{
  display:flex;
  flex-direction:column;
  gap:44px;
  margin-top:28px;
  padding:30px 0 0;
  border-top:1px solid var(--line);
}

/* true aspect ratio: image is never cropped */
.work{
  display:grid;
  grid-template-columns:minmax(0, 1fr) 300px;
  align-items:start;
  gap:28px;
  width:100%;
  background:none;
  color:inherit;
  font:inherit;
  text-align:left;
  cursor:pointer;
  touch-action:manipulation;
  -webkit-tap-highlight-color:transparent;
  padding:0 0 24px;
  border:0;
  border-bottom:1px dotted #8c8c8c;
}.work:last-child{ padding-bottom:0; border-bottom:0; }
.work:focus-visible{ outline:1px solid var(--blue); outline-offset:6px; }

.work-img{
  display:flex;
  align-items:center;
  justify-content:center;
  padding:14px;
  background:#fff;
  box-shadow:inset 0 0 0 1px #8c8c8c;
}
.work-img img{
  display:block;
  width:auto;
  height:auto;
  max-width:100%;
  max-height:64vh;
}
.work-title{
  display:block;
  margin:0 0 4px;
  font-family:var(--display);
  font-size:16px;
  font-weight:700;
  line-height:1.45;
  letter-spacing:0;
  color:#000;
  overflow-wrap:anywhere;
}

.work-artist{
  display:block;
  margin:0 0 3px;
  color:var(--txt-dim);
  font-size:12.5px;
}

.work-dims{
  display:block;
  margin:0;
  color:var(--txt-dim);
  font-size:12.5px;
}

.work-medium{
  display:block;
  margin:0;
  color:var(--txt-faint);
  font-size:12px;
}

.work-note{
  display:block;
  margin:16px 0 0;
  padding-top:14px;
  border-top:1px dotted #8c8c8c;
  font-size:12px;
  line-height:1.75;
  color:var(--txt-dim);
}

/* --------------------------------------------------------- overlay */
.overlay{
  position:fixed;
  inset:0;
  z-index:60;
  display:none;
  justify-content:center;
  align-items:flex-start;
  padding:40px 16px;
  overflow-y:auto;
  overscroll-behavior:contain;
  -webkit-overflow-scrolling:touch;
  background:rgba(70,70,70,.62);
}
.overlay.open{ display:flex; }

.viewer-window{
  width:min(1040px, 100%);
  margin-bottom:40px;
}
.viewer-body{
  padding:16px;
}

.canvas-frame{
  margin:0;
  padding:14px;
  background:#fff;
}
.canvas-frame img{
  display:block;
  width:auto;
  height:auto;
  max-width:100%;
  max-height:74vh;
  margin:0 auto;
}
/* tapped on a touch screen: the mat scrolls, the canvas doubles */
.canvas-frame.zoomed{
  cursor:zoom-out;
  max-height:76vh;
  max-height:76dvh;
  overflow:auto;
  overscroll-behavior:contain;
  -webkit-overflow-scrolling:touch;
  touch-action:auto;
}
.canvas-frame.zoomed img{
  max-width:none;
  max-height:none;
  margin:0;
}

.viewer-nav{
  display:flex;
  justify-content:center;
  gap:18px;
  margin:16px 0 2px;
}

/* the Platinum push button: 1px black outline, white face, shine on top */
.mac-btn{
  padding:2px 14px;
  border:1px solid #000;
  border-radius:5px;
  background:#f4f4f4;
  box-shadow:inset 0 1px 0 #fff, 0 1px 0 rgba(0,0,0,.3);
  color:#000;
  font-family:var(--ui);
  font-size:11.5px;
  letter-spacing:0;
  cursor:pointer;
  touch-action:manipulation;
  -webkit-tap-highlight-color:transparent;
}
.mac-btn:hover,
.mac-btn:focus-visible{ background:#fff; outline:none; }
.mac-btn:active{ background:#c9c9c9; box-shadow:inset 0 1px 2px rgba(0,0,0,.35); }

/* ----------------------------------------------------------- about */
.about-window{
  width:min(560px, 100%);
  margin-bottom:40px;
}
.about-body{ padding:24px 26px 22px; }

.about-body h2{
  margin:0 0 14px;
  font-family:var(--display);
  font-size:14px;
  /* the line reads as a sentence; the name inside it is the bold part */
  font-weight:400;
  letter-spacing:0;
  color:#000;
}
.about-body h2 strong{ font-weight:700; }
.about-body p{
  margin:0 0 14px;
  font-size:12.5px;
  line-height:1.8;
  color:var(--txt-dim);
}

.about-foot{
  display:flex;
  justify-content:flex-end;
  margin-top:22px;
  padding-top:18px;
  border-top:1px dotted #8c8c8c;
}

/* --------------------------------------------- responsive and touch */
@media (max-width: 1000px){
  .desktop{ padding:20px 14px 0; }
}

@media (max-width: 900px){
  /* one column: the caption needs the air the filename line used to give it */
  .work{ grid-template-columns:minmax(0, 1fr); gap:22px; }
  .work-img img{ max-height:52vh; }
  .canvas-frame img{ max-height:60vh; }
}

/* phones: safe areas, comfortable targets, no layout shift */
@media (max-width: 620px){
  body{
    font-size:12.5px;
    min-height:100dvh;
    padding-bottom:calc(44px + env(safe-area-inset-bottom, 0px));
  }
  .desktop{
    padding-top:max(12px, env(safe-area-inset-top, 0px));
    padding-left:max(10px, env(safe-area-inset-left, 0px));
    padding-right:max(10px, env(safe-area-inset-right, 0px));
  }
  .titlebar{ height:34px; padding:0 10px; }
  .window-body{ padding:0 15px 20px; }

  .masthead{ padding-top:18px; }
  .masthead-name{ font-size:min(30px, calc((100cqi - 12px) / var(--name-em, 14))); margin-bottom:14px; }
  .masthead-sub{ font-size:11.5px; line-height:1.7; }

  .gallery{ gap:32px; margin-top:20px; padding-top:24px; }
  .work-img{ padding:9px; }
  .work-img img{ max-height:44vh; }
  .work-title{ font-size:15px; }
  .work-artist{ font-size:12px; }
  .work-dims{ font-size:12px; }
  .work-note{ font-size:12px; }

  .overlay{
    padding:max(10px, env(safe-area-inset-top, 0px))
            max(10px, env(safe-area-inset-right, 0px))
            max(10px, env(safe-area-inset-bottom, 0px))
            max(10px, env(safe-area-inset-left, 0px));
  }
  .viewer-body{ padding:10px; }
  .about-body{ padding:18px 16px; }

  /* the close box rides along while a long note scrolls */
  .overlay .titlebar{
    position:sticky;
    top:env(safe-area-inset-top, 0px);
    z-index:2;
    border-bottom:1px solid #000;
  }
  .canvas-frame{ padding:8px; }
  .viewer-nav{ gap:26px; margin-top:12px; }

}

/* anything without a mouse gets real 44px targets, at any width
   -- including phones held in landscape */
@media (hover: none){
  /* the button stays small; an invisible surround makes it a 44px target */
  .masthead-btn{ padding:2px 9px; margin:0 2px; }
  .masthead-btn::after{ content:""; position:absolute; inset:-12px -10px; }
  .mac-btn{ padding:12px 18px; }
  .titlebar{ height:44px; padding:0 6px; }
  .closebox{
    display:flex;
    align-items:center;
    justify-content:center;
    width:44px;
    height:44px;
    flex:0 0 44px;
    font-size:16px;
  }
}

/* full-height canvas limits that follow the real viewport on iOS/Android */
@supports (height: 1dvh){
  @media (max-width: 900px){
    .work-img img{ max-height:44dvh; }
    .canvas-frame img{ max-height:58dvh; }
  }
  /* phones: let a tall canvas use more of the screen */
  @media (max-width: 620px){
    .work-img img{ max-height:54dvh; }
    .canvas-frame img{ max-height:66dvh; }
  }
}

/* phones on their side: use the width instead of stacking */
@media (orientation: landscape) and (max-height: 540px){
  .desktop{ padding-top:10px; }
  .masthead{ padding-top:10px; }
  .masthead-name{ font-size:min(22px, calc((100cqi - 12px) / var(--name-em, 14))); margin-bottom:8px; }
  .masthead-sub{ font-size:10px; line-height:1.7; }
  .gallery{ gap:26px; margin-top:14px; padding-top:18px; }
  .work{ grid-template-columns:minmax(0, 1fr) 248px; gap:20px; }
  .work-img img{ max-height:62dvh; }
  .work-title{ font-size:14px; }
  .work-note{ font-size:11px; line-height:1.7; }
  .canvas-frame img{ max-height:66dvh; }
}

@media (prefers-reduced-motion: reduce){
  .masthead-caret{ animation:none; }
}

/* ---------------------------------------------- image delivery */
.work-img picture{
  display:flex;
  justify-content:center;
  max-width:100%;
}

/* hold the space, then fade in once the file is there */
.work-img img{
  opacity:0;
  transition:opacity .28s linear;
}
.work-img img.is-loaded{ opacity:1; }

/* ----------------------------------------- viewer canvas surface */
.canvas-frame{
  touch-action:pan-y pinch-zoom;
  -webkit-user-select:none;
  user-select:none;
  /* a click doubles the canvas, so say so with the pointer */
  cursor:zoom-in;
  /* a long press on the canvas must not offer to save the image */
  -webkit-touch-callout:none;
}

/* ------------------------------------------------ read_me extras */
.about-body a{
  color:#0000cc;
  text-decoration:underline;
}
.about-body a:hover,
.about-body a:focus-visible{
  background:#3355cc;
  color:#fff;
  text-decoration:none;
  outline:none;
}
.about-contact{
  margin:0 0 6px;
  font-size:12.5px;
  line-height:1.9;
}

/* -------------------------------------------------- empty gallery */
.empty{
  margin:26px 0 0;
  font-size:12.5px;
  color:var(--txt-faint);
}

/* --------------------------------------------- screen readers only */
.sr-only{
  position:absolute;
  width:1px;
  height:1px;
  margin:-1px;
  padding:0;
  overflow:hidden;
  clip:rect(0 0 0 0);
  clip-path:inset(50%);
  white-space:nowrap;
  border:0;
}
