/* johnliawgallery — the whole site's styles. Phone first; wider screens add columns.
   Layout and type follow the "apple" design reference (~/.claude/design-references):
   quiet chrome, 17px body, 600 headings, 8px spacing, pill chips, one shadow on artwork only.
   Colour: anchor 35° terracotta: a painter's studio is linen and wood, and a near-silent warm
   frame lets the saturated paintings carry the colour. Every value below is an unmodified
   color-theme ladder stop at 35°, so text contrast passes by construction. Light scheme only;
   the lightbox uses the ladder's dark surface. */

:root {
  --surface: oklch(99% 0.004 35);
  --surface-alt: oklch(96.5% 0.010 35);
  --border: oklch(89% 0.014 35);
  --text-muted: oklch(52% 0.020 35);
  --text: oklch(24% 0.020 35);
  --primary: oklch(50% 0.08 35);
  --primary-hover: oklch(44% 0.08 35);
  --dark-surface: oklch(17% 0.012 35);
  --dark-text: oklch(95% 0.010 35);
  --dark-text-muted: oklch(72% 0.016 35);

  --font: Inter, system-ui, -apple-system, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 80px;
  --radius-sm: 8px;
  --radius-pill: 9999px;
  --artwork-shadow: 3px 5px 30px oklch(24% 0.020 35 / 0.18);
  --gutter: var(--space-4);
  --wide: 1440px;
  --narrow: 720px;
}

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

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

body {
  margin: 0;
  background: var(--surface);
  color: var(--text);
  font: 400 17px/1.47 var(--font);
  letter-spacing: -0.01em;
  overflow-wrap: break-word;  /* a long caption word ("61x51cm.Oil") must wrap, not widen the phone page */
}

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

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

h1, h2, h3 { font-weight: 600; line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 var(--space-4); }
h1 { font-size: 28px; }
h2 { font-size: 21px; }
h3 { font-size: 17px; }
p { margin: 0 0 var(--space-4); }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.page { max-width: var(--wide); margin: 0 auto; padding: var(--space-6) var(--gutter) var(--space-8); }
.page--narrow { max-width: var(--narrow); }

/* Header: the artist's name on the left, the menu on the right; frosted while it sticks. */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in oklch, var(--surface) 85%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
}
.site-header__bar {
  max-width: var(--wide); margin: 0 auto; padding: 0 var(--gutter);
  min-height: 56px; display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
}
.site-name { color: var(--text); font-weight: 600; font-size: 17px; white-space: nowrap; }
.site-name:hover { color: var(--text); }
.site-name span { color: var(--text-muted); font-weight: 400; margin-left: var(--space-2); }

.menu-button {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; margin-right: calc(-1 * var(--space-2));
  border: 0; background: none; color: var(--text); cursor: pointer;
}
.menu-button svg { width: 22px; height: 22px; }
.site-nav { display: none; }
.site-nav[data-open] {
  display: block; position: absolute; left: 0; right: 0; top: 100%;
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: var(--space-2) var(--gutter) var(--space-4);
}
.site-nav ul { list-style: none; margin: 0; padding: 0; }
.site-nav a { display: block; padding: var(--space-3) 0; color: var(--text); font-size: 17px; }
.site-nav a[aria-current] { color: var(--primary); font-weight: 600; }

@media (min-width: 834px) {
  .menu-button { display: none; }
  .site-nav, .site-nav[data-open] { display: block; position: static; padding: 0; border: 0; background: none; }
  .site-nav ul { display: flex; gap: var(--space-5); }
  .site-nav a { padding: var(--space-2) 0; font-size: 14px; }
}

/* Chips: category and year switches. */
.chips { display: flex; flex-wrap: wrap; gap: var(--space-2); list-style: none; margin: 0 0 var(--space-5); padding: 0; }
.chip {
  display: inline-block; padding: var(--space-2) var(--space-4); min-height: 36px;
  border: 1px solid var(--border); border-radius: var(--radius-pill);
  background: var(--surface); color: var(--text); font: inherit; font-size: 14px; line-height: 1.29; cursor: pointer;
}
.chip:hover { color: var(--text); border-color: var(--text-muted); }
.chip[aria-current], .chip[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--surface); }

/* Artwork grid: 2 columns on a phone, up to 4 on a desktop. site.js deals the works into
   the shortest column so the order runs across; without it, CSS columns run down instead. */
.grid { --cols: 2; --gap: var(--space-3); columns: var(--cols); column-gap: var(--gap); }
@media (min-width: 640px) { .grid { --cols: 3; --gap: var(--space-5); } }
@media (min-width: 1068px) { .grid { --cols: 4; } .grid--three { --cols: 3; } }
.grid[data-dealt] { display: flex; align-items: flex-start; gap: var(--gap); columns: auto; }
.grid__col { flex: 1; min-width: 0; }

.work { break-inside: avoid; margin: 0 0 var(--space-5); }
.work img { width: 100%; background: var(--surface-alt); box-shadow: var(--artwork-shadow); }
.work figcaption { margin-top: var(--space-2); font-size: 13px; line-height: 1.35; color: var(--text); }
.work figcaption span { display: block; color: var(--text-muted); }
.work[hidden] { display: none; }

/* Equal boxes (home page): every picture sits whole in the same square, so rows line up. */
.boxes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-5) var(--space-3); }
@media (min-width: 640px) { .boxes { grid-template-columns: repeat(4, minmax(0, 1fr)); column-gap: var(--space-5); } }
.boxes .work { margin: 0; }
.boxes .work img { aspect-ratio: 1; object-fit: contain; padding: var(--space-3); box-shadow: none; }

/* Home */
.hero { margin: 0; }
.hero img { width: 100%; max-height: 72vh; object-fit: cover; }
.section-title { font-size: 21px; margin: var(--space-7) 0 var(--space-5); }
.visually-hidden + .section-title { margin-top: 0; }  /* a section that opens the page */
.more { display: inline-block; margin-top: var(--space-2); font-size: 14px; }

/* Lists of documents (articles) */
.doc-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.doc-list a { display: block; padding: var(--space-4) 0; border-bottom: 1px solid var(--border); color: var(--text); }
.doc-list a:hover { color: var(--primary); }

/* About and contact */
.portrait { width: 160px; border-radius: var(--radius-sm); margin-bottom: var(--space-5); box-shadow: var(--artwork-shadow); }
.prose + .prose { margin-top: var(--space-7); padding-top: var(--space-7); border-top: 1px solid var(--border); }
.prose p { color: var(--text); }
.contact-art { width: 100%; max-width: 420px; margin-bottom: var(--space-5); box-shadow: var(--artwork-shadow); }

/* Footer */
.site-footer { background: var(--surface-alt); color: var(--text-muted); font-size: 12px; }
.site-footer p { max-width: var(--wide); margin: 0 auto; padding: var(--space-6) var(--gutter); }

/* Lightbox */
.lightbox {
  position: fixed; inset: 0; width: auto; height: auto; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0;
  background: var(--dark-surface); color: var(--dark-text);
}
.lightbox::backdrop { background: var(--dark-surface); }
.lightbox[open] { display: grid; grid-template-rows: 1fr auto; }
.lightbox__stage { display: flex; align-items: center; justify-content: center; min-height: 0; padding: var(--space-7) var(--space-2) var(--space-2); }
.lightbox__stage img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lightbox__caption { margin: 0; padding: var(--space-3) var(--gutter) var(--space-5); text-align: center; font-size: 14px; color: var(--dark-text-muted); }
.lightbox button {
  position: absolute; width: 44px; height: 44px; border: 0; border-radius: var(--radius-pill);
  background: oklch(24% 0.020 35 / 0.6); color: var(--dark-text); font-size: 24px; line-height: 1; cursor: pointer;
}
.lightbox__close { top: var(--space-3); right: var(--space-3); }
.lightbox__prev, .lightbox__next { top: 50%; transform: translateY(-50%); }
.lightbox__prev { left: var(--space-2); }
.lightbox__next { right: var(--space-2); }
