/* ============================================================
   NJH: Nancy Jane Highfield, digital art gallery
   Stark and simple: near-white (or near-black), heavy geometric
   lettering, one vermilion accent. Edit the colours below.
   ============================================================ */
:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --ink: #0b0b0c;
  --muted: #6b6b6b;
  --accent: #c8321e;
  --accent-ink: #ffffff;
  --soft: #eeeeee;
  --line: #dedede;
  --serif: "Jost", "Futura", system-ui, sans-serif;   /* headings and labels */
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0d0e;
    --surface: #17171a;
    --ink: #ededed;
    --muted: #9d9d9d;
    --accent: #ef7b66;
    --accent-ink: #1a0f0c;
    --soft: #1a1a1d;
    --line: #2a2a2e;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right);   /* iPhone notch in landscape */
}

/* taps respond instantly (no double-tap-zoom delay), which matters for fast games on iPad and iPhone */
a, button, input, select, textarea, label, [role="button"] { touch-action: manipulation; }
input, textarea { -webkit-appearance: none; appearance: none; border-radius: 0; }

a { color: inherit; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.wrap { width: min(1180px, 100% - 32px); margin-inline: auto; }

/* ---------- Header (inner pages) ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { font-family: var(--serif); font-weight: 700; font-size: 1.5rem; letter-spacing: .22em; text-decoration: none; }
.site-header nav ul { display: flex; gap: 32px; list-style: none; }
.site-header nav a {
  font-family: var(--serif); text-transform: uppercase; letter-spacing: .1em; font-weight: 400;
  text-decoration: none; font-size: .88rem; color: var(--muted);
  padding-bottom: 4px; border-bottom: 1px solid transparent;
  transition: color .2s, border-color .2s;
}
.site-header nav a[aria-current="page"] { color: var(--ink); border-color: var(--ink); }

/* ---------- Buttons and small type ---------- */
.eyebrow { text-transform: uppercase; letter-spacing: .18em; font-family: var(--serif); font-size: .78rem; color: var(--accent); margin-bottom: 14px; }
.btn {
  display: inline-block; text-decoration: none; font-family: var(--serif); text-transform: uppercase; letter-spacing: .1em;
  font-size: .85rem; cursor: pointer;
  padding: 12px 26px; border-radius: 0; border: 1px solid var(--ink); color: var(--ink); background: none;
  transition: background .2s, color .2s, border-color .2s;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn:disabled { opacity: .6; cursor: default; }

/* ---------- Home: the NJH screen ---------- */
.dam {
  position: relative; overflow: hidden;
  min-height: 100vh; min-height: 100svh;
  display: grid; place-items: center; text-align: center;
}
.dam .wrap { position: relative; display: grid; place-items: center; height: 100%; pointer-events: none; }
/* one soft disc that inverts whatever is under it (moved by js/fx.js) */
.fx-orb {
  position: absolute; left: 0; top: 0; width: clamp(150px, 26vmin, 340px); aspect-ratio: 1; border-radius: 50%;
  background: #fff; mix-blend-mode: difference; pointer-events: none; will-change: transform;
}

/* the lettering inverts over the ink, so it stays readable on light and dark */
.dam-center { mix-blend-mode: difference; color: #fff; }
.dam-title {
  font-family: var(--serif); font-weight: 700; line-height: 1;
  font-size: clamp(5rem, 24vmin, 17rem); letter-spacing: .2em; padding-left: .2em;
}
.dam-title span { display: inline-block; opacity: 0; animation: rise 1s cubic-bezier(.2,.7,.2,1) forwards; }
.dam-title span:nth-child(2) { animation-delay: .12s; }
.dam-title span:nth-child(3) { animation-delay: .24s; }
.dam-nav { display: flex; justify-content: center; gap: clamp(22px, 7vmin, 72px); margin-top: clamp(10px, 3vmin, 28px); opacity: 0; animation: rise 1s .5s cubic-bezier(.2,.7,.2,1) forwards; }
.dam-nav a {
  pointer-events: auto; text-decoration: none; font-family: var(--serif); font-weight: 400;
  font-size: clamp(1rem, 3vmin, 1.6rem); text-transform: uppercase; letter-spacing: .1em;
  padding: 6px 2px; background: linear-gradient(currentColor, currentColor) left bottom / 0 3px no-repeat;
  transition: background-size .3s ease, opacity .3s ease, font-weight .2s;
}
/* hovering one word: it goes bold with a thick underline, the others step back */
.dam-nav a:focus-visible, .dam-nav a:active { font-weight: 700; background-size: 100% 3px; outline: none; }
@keyframes rise { from { opacity: 0; transform: translateY(28px); } to { opacity: 1; transform: none; } }

.scroll-hint {
  position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%);
  font-family: var(--serif); text-transform: uppercase; letter-spacing: .2em; font-size: .7rem; color: var(--muted);
  text-decoration: none; display: grid; gap: 6px; justify-items: center;
}
.scroll-hint::after { content: ""; width: 1px; height: 34px; background: currentColor; animation: drip 2.2s ease-in-out infinite; transform-origin: top; }
@keyframes drip { 0% { transform: scaleY(0); } 55% { transform: scaleY(1); } 100% { transform: scaleY(1); opacity: 0; } }

/* intro text under the NJH screen */
.intro-dam { padding: 88px 0 120px; max-width: 900px; }
.intro-dam h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(2rem, 4.6vw, 3.1rem); line-height: 1.2; margin-bottom: 34px; }
.intro-dam p { font-size: 1.2rem; font-weight: 300; line-height: 1.7; max-width: 62ch; margin-bottom: 1.4em; }

/* ---------- Inner pages ---------- */
.page { padding: 64px 0 96px; }
.page h1 { font-family: var(--serif); font-weight: 700; text-transform: uppercase; letter-spacing: .12em; font-size: clamp(2.2rem, 6vw, 4rem); line-height: 1.08; }
.page .lead { color: var(--muted); font-size: 1.1rem; font-weight: 300; max-width: 52ch; margin-top: 14px; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 32px; }
.filters button {
  font-family: var(--serif); text-transform: uppercase; letter-spacing: .1em; font-size: .78rem; cursor: pointer;
  background: none; color: var(--muted);
  border: 1px solid var(--line); border-radius: 0; padding: 7px 16px;
  transition: all .2s;
}
.filters button.active { background: var(--ink); border-color: var(--ink); color: var(--bg); }

.gallery { columns: 3 300px; column-gap: 28px; padding-bottom: 88px; }
.piece {
  break-inside: avoid; margin-bottom: 30px; cursor: pointer;
  background: none; border: 0; width: 100%; text-align: left; font: inherit; color: inherit; display: block;
}
.piece .art { overflow: hidden; background: var(--soft); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.piece img, .piece .ph { width: 100%; transition: transform .6s ease; }
.piece:focus-visible img, .piece:focus-visible .ph { transform: scale(1.03); }
.piece .cap { padding-top: 12px; display: grid; gap: 1px; }
.piece .cap .t { font-family: var(--serif); font-weight: 500; font-size: 1.05rem; }
.piece .cap .m { color: var(--muted); font-size: .8rem; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.tag { font-family: var(--serif); font-size: .66rem; text-transform: uppercase; letter-spacing: .12em; color: var(--accent); border: 1px solid var(--accent); padding: 0 6px; line-height: 1.6; }
.piece.hide { display: none; }

/* Placeholder art (shown until a real image exists) */
.ph { display: grid; place-items: center; color: rgba(255,255,255,.8); font-family: var(--serif); font-size: 1rem; }

/* ---------- Artwork viewer ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 50; display: none;
  background: #0b0b0c; color: #fff;
  grid-template-columns: minmax(0, 1fr) 360px; grid-template-rows: minmax(0, 1fr);
  overscroll-behavior: contain;
}
.lightbox.open { display: grid; }
.lb-stage { display: grid; place-items: center; min-height: 0; padding: 28px; }
.lb-stage img, .lb-stage .ph { max-height: calc(100vh - 56px); max-height: calc(100dvh - 56px); max-width: 100%; width: auto; }
.lb-stage img { object-fit: contain; }
.lb-stage .ph { height: min(100%, calc(100vh - 56px)); height: min(100%, calc(100dvh - 56px)); max-width: 90%; }
.lb-info {
  background: var(--bg); color: var(--ink); padding: 40px 30px 30px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 6px;
  overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
}
.lb-info h2 { font-family: var(--serif); font-weight: 500; font-size: 1.9rem; line-height: 1.15; padding-right: 40px; }
.lb-info .meta { color: var(--muted); font-size: .88rem; }
.lb-info .status { margin: 4px 0 2px; }
.lb-info .from { font-family: var(--serif); text-transform: uppercase; letter-spacing: .14em; font-size: .68rem; color: var(--muted); margin-top: 18px; }
.lb-info p { font-size: .95rem; }
.lb-info .price { font-family: var(--serif); font-size: 1.25rem; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.lb-info .lb-enquire { margin-top: 6px; text-align: center; }
.lb-info .small { color: var(--muted); font-size: .78rem; margin-top: 8px; }
.lb-btn {
  position: absolute; background: rgba(255,255,255,.1); border: 0; color: #fff;
  width: 44px; height: 44px; border-radius: 50%; font-size: 1.4rem; cursor: pointer; z-index: 2;
}
.lb-close { top: calc(16px + env(safe-area-inset-top)); right: 16px; background: rgba(0,0,0,.35); }
.lb-prev { left: 16px; top: 50%; }
.lb-next { right: 376px; top: 50%; }
.lb-pager { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; font-size: .82rem; color: var(--muted); }
.lb-pager[hidden] { display: none; }
.lb-pager button { background: var(--soft); border: 0; color: var(--ink); width: 30px; height: 30px; border-radius: 50%; font-size: 1.05rem; cursor: pointer; }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: 1fr 1.3fr; gap: 64px; margin-top: 48px; align-items: start; }
.portrait { aspect-ratio: 4/5; overflow: hidden; background: var(--soft); box-shadow: 0 18px 50px rgba(0,0,0,.15); }
.portrait img { width: 100%; height: 100%; object-fit: cover; }
.prose p { margin-bottom: 1.1em; max-width: 60ch; font-weight: 300; font-size: 1.05rem; }
.prose h2 { font-family: var(--serif); font-weight: 400; font-size: 1.8rem; margin: 1.6em 0 .5em; }
.prose h2:first-child { margin-top: 0; }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-top: 18px; }
.fact { border-top: 2px solid var(--ink); padding-top: 10px; }
.fact b { display: block; font-family: var(--serif); font-size: 1.6rem; font-weight: 500; color: var(--accent); }
.fact span { font-size: .8rem; color: var(--muted); }
.fact.wide b { font-size: 1.2rem; line-height: 1.3; }

.sailing-band { background: var(--soft); margin-top: 72px; padding: 56px 0; }
.sailing-band .prose { max-width: 62ch; }

/* ---------- Contact ---------- */
.contact-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 64px; margin-top: 44px; align-items: start; }
.form { display: grid; gap: 18px; }
.form label { display: grid; gap: 6px; font-size: .82rem; color: var(--muted); letter-spacing: .02em; }
.form input, .form select, .form textarea {
  font: inherit; font-size: 1rem; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 0; padding: 11px 12px; width: 100%;
}
.form textarea { min-height: 150px; resize: vertical; }
.form input:focus, .form select:focus, .form textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.form .btn { justify-self: start; }
.form-status { min-height: 1.5em; font-size: .95rem; }
.form-status.ok { color: #2f7a4a; }
.form-status.err { color: var(--accent); }
.hp { position: absolute; left: -9999px; }
.aside h2 { font-family: var(--serif); font-weight: 400; font-size: 1.5rem; margin-bottom: 12px; }
.contact-links { list-style: none; display: grid; gap: 12px; margin-bottom: 36px; }
.contact-links a {
  display: flex; justify-content: space-between; gap: 12px; text-decoration: none;
  padding: 14px 16px; border: 1px solid var(--line); background: var(--surface);
  transition: border-color .2s;
}
.contact-links span { color: var(--muted); }
.mini-steps { list-style: none; display: grid; gap: 14px; color: var(--muted); font-size: .92rem; counter-reset: m; }
.mini-steps li { counter-increment: m; padding-left: 34px; position: relative; }
.mini-steps li::before { content: counter(m); position: absolute; left: 0; top: 0; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--accent); color: var(--accent); font-size: .75rem; display: grid; place-items: center; }
.mini-steps b { color: var(--ink); font-weight: 500; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 28px 0; color: var(--muted); font-size: .85rem; }
.site-footer .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.site-footer a { text-decoration: none; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .contact-grid { grid-template-columns: 1fr; gap: 48px; }
  .lightbox { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; }
  .lb-stage { padding: 56px 16px 12px; }
  .lb-stage img, .lb-stage .ph { max-height: 52vh; max-height: 52dvh; }
  .lb-stage .ph { height: 52vh; height: 52dvh; }
  .lb-info { max-height: 44vh; max-height: 44dvh; padding: 20px 20px 22px; }
  .lb-info h2 { font-size: 1.45rem; }
  .lb-prev { left: 10px; top: 40%; }
  .lb-next { right: 10px; top: 40%; }
}
@media (max-width: 760px) {
  .about-grid { grid-template-columns: 1fr; gap: 32px; }
  .site-header nav ul { gap: 18px; }
  .brand { font-size: 1.25rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .dam-title span, .dam-nav { animation: none; opacity: 1; }
  .scroll-hint::after { animation: none; }
  .piece img, .piece .ph { transition: none; }
}

/* ---------- Hover effects: only on devices that really hover (mouse, trackpad) ---------- */
@media (hover: hover) {
  .site-header nav a:hover { color: var(--ink); border-color: var(--ink); }
  .btn:hover { background: var(--ink); color: var(--bg); }
  .btn.primary:hover { filter: brightness(1.08); background: var(--accent); color: var(--accent-ink); }
  .filters button:hover { color: var(--ink); border-color: var(--ink); }
  .piece:hover img, .piece:hover .ph { transform: scale(1.03); }
  .lb-btn:hover { background: rgba(255,255,255,.22); }
  .lb-pager button:hover { background: var(--line); }
  .contact-links a:hover { border-color: var(--ink); }
  .site-footer a:hover { color: var(--ink); text-decoration: underline; }
  .dam-nav a:hover { font-weight: 700; background-size: 100% 3px; }
  .dam-nav:hover a:not(:hover) { opacity: .35; }
}

/* ---------- Touch screens (iPad, iPhone, Android): finger-sized targets ---------- */
@media (pointer: coarse) {
  .site-header nav a { padding: 15px 2px; }
  .site-header .wrap { height: 60px; }
  .btn { min-height: 46px; padding: 13px 26px; }
  .filters button { min-height: 44px; padding: 10px 18px; }
  .lb-pager button { width: 42px; height: 42px; }
  .site-footer a { padding: 12px 0; display: inline-block; }
  .dam-nav a { padding: 14px 6px; }
}

/* iPhone in landscape: show the artwork and its details side by side */
@media (max-width: 900px) and (orientation: landscape) and (max-height: 520px) {
  .lightbox { grid-template-columns: minmax(0, 1fr) 300px; grid-template-rows: minmax(0, 1fr); }
  .lb-stage { padding: 12px; }
  .lb-stage img, .lb-stage .ph { max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); }
  .lb-stage .ph { height: calc(100vh - 24px); height: calc(100dvh - 24px); }
  .lb-info { max-height: none; padding: 20px 18px; }
  .lb-prev { left: 10px; top: 50%; }
  .lb-next { right: 316px; top: 50%; }
  .dam-title { font-size: clamp(3.5rem, 30vh, 9rem); }
}
