/* James Cane
   The site is a quiet grey wall; the paintings carry all the colour.
   Opening a painting switches to "projection": black screen, caption set like a film subtitle. */

:root {
  --wall: #E8E8E5;
  --ink: #232427;
  --muted: #6C6D73;
  --line: #CFCFCB;
  --screen: #000000;
  --subtitle: #F4F1E4;
  --font: "Schibsted Grotesk", "Helvetica Neue", Arial, sans-serif;
  --gutter: clamp(16px, 4vw, 56px);
  --step--1: 0.8125rem;
  --step-0: 1rem;
  --step-1: 1.25rem;
  --step-2: 1.75rem;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --wall: #252628; --ink: #E7E6E2; --muted: #9A9BA0; --line: #3A3B3F;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --wall: #252628; --ink: #E7E6E2; --muted: #9A9BA0; --line: #3A3B3F;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--wall);
  color: var(--ink);
  font: 400 var(--step-0)/1.55 var(--font);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:hover { color: var(--muted); }
:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }

.wrap {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
}

/* Header */
.site-header .wrap {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 32px;
  padding-block: 28px 20px;
}
.site-name {
  font-size: var(--step-1);
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.site-nav { display: flex; flex-wrap: wrap; gap: 4px 24px; }
.site-nav a { text-decoration: none; color: var(--muted); }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--ink); }

main { flex: 1; }

/* Home: one painting, hung on the wall */
.hang {
  display: grid;
  justify-items: center;
  gap: 16px;
  padding-block: clamp(24px, 6vh, 72px) clamp(40px, 8vh, 96px);
}
.hang button { all: unset; cursor: zoom-in; display: block; }
.hang button:focus-visible { outline: 2px solid var(--ink); outline-offset: 6px; }
.hang img {
  height: auto;
  box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 12px 32px -12px rgba(0,0,0,.25);
}
.hang figcaption { color: var(--muted); font-size: var(--step--1); text-align: center; line-height: 1.8; }
.hang figcaption strong { color: var(--ink); font-weight: 500; }

.intro {
  max-width: 34rem;
  font-size: var(--step-1);
  line-height: 1.45;
  text-wrap: pretty;
  padding-block: 0 clamp(40px, 8vh, 88px);
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  border-top: 1px solid var(--line);
  padding-block: 16px 20px;
}
.section-head h2 { margin: 0; font-size: var(--step-0); font-weight: 600; }
.section-head a { color: var(--muted); font-size: var(--step--1); }

/* Recent posts strip */
.recent {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(150px, 45%), 1fr));
  gap: 8px;
  padding-bottom: clamp(48px, 8vh, 96px);
}
.tile { all: unset; cursor: zoom-in; display: block; aspect-ratio: 4 / 5; overflow: hidden; background: var(--line); }
.tile img { width: 100%; height: 100%; object-fit: cover; transition: opacity .2s; }
.tile:hover img { opacity: .85; }
.tile:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

/* Works: justified rows, like prints laid out on a table */
.page-title {
  font-size: var(--step-2);
  font-weight: 500;
  letter-spacing: -0.015em;
  margin: 0;
  padding-block: clamp(16px, 4vh, 40px) 24px;
}
.page-title span { color: var(--muted); font-weight: 400; font-size: var(--step-0); margin-left: 8px; }
.justified { display: flex; flex-direction: column; gap: 10px; padding-bottom: 80px; }
.justified .row { display: flex; gap: 10px; }
.work { all: unset; cursor: zoom-in; display: block; position: relative; flex: none; background: var(--line); }
.work img { width: 100%; height: 100%; object-fit: cover; }
.work .label {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 24px 10px 8px;
  font-size: var(--step--1);
  color: #fff;
  background: linear-gradient(transparent, rgba(0,0,0,.55));
  opacity: 0;
  transition: opacity .2s;
}
.work:hover .label, .work:focus-visible .label { opacity: 1; }
.work:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

/* Studio: everything from Instagram, at its own proportions */
.studio-grid { columns: 4 220px; column-gap: 10px; padding-bottom: 80px; }
.studio-grid .post { all: unset; cursor: zoom-in; display: block; margin-bottom: 10px; break-inside: avoid; }
.studio-grid .post img { width: 100%; height: auto; }
.studio-grid .post:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.post-date { display: block; font-size: var(--step--1); color: var(--muted); padding-top: 6px; }

.empty { max-width: 34rem; color: var(--muted); padding-bottom: 80px; }

/* About + contact */
.text-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 40px;
  padding-block: clamp(16px, 4vh, 40px) 96px;
}
@media (min-width: 760px) {
  .text-page { grid-template-columns: minmax(0, 300px) minmax(0, 36rem); gap: 64px; }
}
@media (min-width: 760px) {
  .text-page.solo { grid-template-columns: minmax(0, 36rem); padding-left: calc(max(var(--gutter), env(safe-area-inset-left, 0px)) + 300px + 64px); }
}
.text-page img { width: 100%; height: auto; }
.text-page h1 { font-size: var(--step-2); font-weight: 500; letter-spacing: -0.015em; margin: 0 0 20px; }
.text-page p { margin: 0 0 1em; text-wrap: pretty; }
.lead { font-size: var(--step-1); line-height: 1.45; }
.cv { margin: 32px 0 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.cv li {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr);
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
.cv .when { color: var(--muted); }
.contact-list { margin: 0; display: grid; gap: 20px; }
.contact-list dt { color: var(--muted); font-size: var(--step--1); }
.contact-list dd { margin: 2px 0 0; font-size: var(--step-1); overflow-wrap: anywhere; }

/* Footer */
.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  border-top: 1px solid var(--line);
  padding-block: 20px 32px;
  color: var(--muted);
  font-size: var(--step--1);
}
.site-footer nav { display: flex; gap: 20px; }

/* Projection: the viewer */
.projector {
  border: 0; padding: 0; margin: 0;
  width: 100vw; height: 100vh; max-width: none; max-height: none;
  height: 100dvh;
  background: var(--screen);
  color: var(--subtitle);
}
.projector::backdrop { background: var(--screen); }
.projector[open] {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  animation: lights-down .35s ease-out;
}
@keyframes lights-down { from { opacity: 0; } to { opacity: 1; } }
.projector .frame {
  display: grid; place-items: center; min-height: 0;
  padding: max(56px, env(safe-area-inset-top, 0px)) max(64px, env(safe-area-inset-right, 0px)) 8px max(64px, env(safe-area-inset-left, 0px));
}
.projector .frame img { max-width: 100%; max-height: calc(100vh - 190px); max-height: calc(100dvh - 190px); width: auto; height: auto; }
.subtitle {
  text-align: center;
  padding: 12px 24px max(28px, env(safe-area-inset-bottom, 0px));
  font-size: clamp(1rem, 2.2vw, 1.375rem);
  line-height: 1.35;
  text-shadow: 0 1px 3px #000;
  min-height: 4.5em;
}
.subtitle .meta { display: block; font-size: var(--step--1); color: #A7A69F; margin-top: 4px; }
.subtitle a { color: #A7A69F; }
.projector .ctl {
  all: unset; position: absolute; cursor: pointer;
  color: #A7A69F; font: 300 2rem/1 var(--font);
  width: 48px; height: 48px; display: grid; place-items: center;
}
.projector .ctl:hover, .projector .ctl:focus-visible { color: var(--subtitle); }
.projector .ctl:focus-visible { outline: 1px solid var(--subtitle); }
.projector .close { top: max(8px, env(safe-area-inset-top, 0px)); right: max(8px, env(safe-area-inset-right, 0px)); font-size: 1.75rem; }
.projector .prev { left: max(8px, env(safe-area-inset-left, 0px)); top: 50%; transform: translateY(-50%); }
.projector .next { right: max(8px, env(safe-area-inset-right, 0px)); top: 50%; transform: translateY(-50%); }
@media (max-width: 600px) {
  .projector .frame { padding-left: 12px; padding-right: 12px; }
  .projector .prev, .projector .next { top: auto; bottom: max(12px, env(safe-area-inset-bottom, 0px)); transform: none; }
}

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