/* James Mulcahy — portfolio site
   Design read: artist portfolio for gallery-goers and print buyers,
   quiet editorial gallery language, generous whitespace, serif display
   (justified: fine-art gallery context) over a neutral sans for UI/body.
   Dials: variance 5, motion 3, density 2 (art-gallery airy). */

@import url('https://fonts.googleapis.com/css2?family=EB+Garamond:ital,wght@0,400;0,500;0,600;1,400;1,500&family=Work+Sans:wght@300;400;500&display=swap');

:root {
  --canvas: #faf8f4;
  --surface: #ffffff;
  --ink: #1c1b18;
  --ink-soft: #4a473f;
  --mute: #837e73;
  --hairline: #e4e0d5;
  --accent: #35586b;
  --accent-soft: #eef2f3;
  --focus: #35586b;

  --font-display: 'EB Garamond', 'Times New Roman', serif;
  --font-body: 'Work Sans', -apple-system, BlinkMacSystemFont, sans-serif;

  --nav-height: 72px;
  --max-width: 1320px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #171613;
    --surface: #1f1e1a;
    --ink: #f2efe8;
    --ink-soft: #d8d3c7;
    --mute: #948e80;
    --hairline: #33312a;
    --accent: #7fa6bb;
    --accent-soft: #23302f;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: inherit;
  text-decoration: none;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 32px;
}

@media (max-width: 640px) {
  .container { padding: 0 20px; }
}

/* Focus visibility */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

/* ---------- Nav ---------- */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  background: rgba(250, 248, 244, 0.97);
  border-bottom: 1px solid var(--hairline);
}

@media (prefers-color-scheme: dark) {
  .site-nav { background: rgba(23, 22, 19, 0.97); }
}

.site-nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.wordmark {
  font-family: var(--font-display);
  font-size: 20px;
  letter-spacing: 0.04em;
  font-weight: 500;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 36px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  font-size: 14px;
  letter-spacing: 0.03em;
  color: var(--ink-soft);
  padding: 6px 0;
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 1px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}

.nav-links a:hover::after,
.nav-links a[aria-current="page"]::after {
  transform: scaleX(1);
}

.nav-links a[aria-current="page"] {
  color: var(--ink);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  cursor: pointer;
  padding: 8px;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

@media (max-width: 720px) {
  .nav-links {
    position: fixed;
    inset: var(--nav-height) 0 0 0;
    background: var(--canvas);
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    gap: 0;
    padding: 24px 24px;
    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
  }
  .nav-links.is-open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }
  .nav-links li { width: 100%; border-bottom: 1px solid var(--hairline); }
  .nav-links a { display: block; padding: 16px 0; font-size: 18px; }
  .nav-toggle { display: block; }

  .cart-panel {
    top: var(--nav-height);
    right: 0;
    left: 0;
    width: auto;
    max-width: none;
    max-height: calc(100vh - var(--nav-height));
    overflow-y: auto;
    border-left: none;
    border-right: none;
  }
}

/* Cart */

.cart-toggle {
  display: none;
  position: relative;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--ink);
  cursor: pointer;
  padding: 6px;
}

.cart-toggle.is-visible { display: inline-flex; }

.cart-toggle svg { width: 19px; height: 19px; }

.cart-count {
  position: absolute;
  top: -2px;
  right: -2px;
  font-size: 10px;
  line-height: 1;
  background: var(--ink);
  color: var(--canvas);
  border-radius: 999px;
  min-width: 15px;
  height: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}

.cart-panel {
  position: fixed;
  top: calc(var(--nav-height) + 8px);
  right: 20px;
  width: 300px;
  max-width: calc(100vw - 40px);
  background: var(--surface);
  border: 1px solid var(--hairline);
  box-shadow: 0 16px 40px rgba(23, 22, 19, 0.14);
  padding: 20px;
  z-index: 60;
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.cart-panel.is-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.cart-panel-title {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mute);
  margin: 0 0 14px;
}

.cart-items {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 40vh;
  overflow-y: auto;
}

.cart-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.cart-item-title {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 14px;
  margin: 0;
}

.cart-item-meta {
  font-size: 12px;
  color: var(--mute);
  margin: 2px 0 0;
}

.cart-item-remove {
  background: none;
  border: none;
  color: var(--mute);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 2px 4px;
  flex-shrink: 0;
}

.cart-item-remove:hover { color: var(--ink); }

.cart-empty {
  font-size: 13px;
  color: var(--mute);
  margin: 0 0 4px;
}

.cart-checkout-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 28px;
  font-family: var(--font-body);
  font-size: 14px;
  letter-spacing: 0.03em;
  border-radius: 2px;
  border: 1px solid var(--ink);
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.15s ease, background 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--ink);
  color: var(--canvas);
}

.btn-primary:hover { opacity: 0.85; }

.btn-outline {
  background: transparent;
  color: var(--ink);
}

.btn-outline:hover {
  background: var(--ink);
  color: var(--canvas);
}

.btn-full { width: 100%; }

.btn[disabled] {
  cursor: not-allowed;
  opacity: 0.5;
}

/* ---------- Hero ---------- */

.hero {
  padding: 60px 0 72px;
}

.hero-text {
  max-width: 480px;
  margin-bottom: 28px;
}

.hero-frame {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  aspect-ratio: 1027 / 799;
  overflow: hidden;
  background: var(--surface);
  box-shadow: 0 30px 70px -30px rgba(20, 18, 14, 0.35);
}

.hero-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-name {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(32px, 3.2vw, 44px);
  letter-spacing: -0.01em;
  line-height: 1.1;
  margin: 0 0 10px;
}

.hero-tagline {
  font-size: 16px;
  color: var(--mute);
  max-width: 38ch;
  margin: 0;
  font-weight: 300;
  line-height: 1.6;
}

.hero-actions { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; margin-top: 40px; }

@media (max-width: 780px) {
  .hero { padding: 96px 0 56px; }
}

/* Screen-reader-only: present for assistive tech and crawlers, not shown. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Sections ---------- */

.section {
  padding: 112px 0;
  border-top: 1px solid var(--hairline);
}

.section:first-child { border-top: none; }

@media (max-width: 720px) {
  .section { padding: 72px 0; }
}

.section-heading {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 500;
  margin: 0 0 20px;
  letter-spacing: -0.01em;
}

.section-lede {
  color: var(--ink-soft);
  max-width: 62ch;
  font-size: 17px;
  margin: 0 0 8px;
}

.section-head {
  margin-bottom: 56px;
}

/* ---------- Intro (home) ---------- */

.intro-split {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 64px;
  align-items: center;
}

.intro-portrait {
  width: 100%;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border: 1px solid var(--hairline);
}

.intro-portrait img { width: 100%; height: 100%; object-fit: cover; }

@media (max-width: 780px) {
  .intro-split { grid-template-columns: 1fr; gap: 32px; }
  .intro-portrait { max-width: 320px; }
}

.intro {
  max-width: 60ch;
}

.intro p {
  font-size: 18px;
  color: var(--ink-soft);
  margin: 0 0 20px;
}

.intro p:last-of-type { margin-bottom: 28px; }

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  letter-spacing: 0.03em;
  color: var(--ink);
  border-bottom: 1px solid var(--ink);
  padding-bottom: 2px;
}

.text-link:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- Work grid (teaser + prints) ---------- */

.work-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px 28px;
}

@media (max-width: 980px) {
  .work-grid { grid-template-columns: repeat(2, 1fr); gap: 32px 20px; }
}

@media (max-width: 600px) {
  .work-grid { grid-template-columns: 1fr; }
}

/* Teaser bento: a strict 3x3 cell pack (1 big 2x2 tile + 5 single tiles).
   Exact packing, no leftover/orphan tile regardless of viewport. */
.work-grid.teaser {
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: clamp(190px, 21vw, 280px);
  gap: 20px;
}

.work-grid.teaser .work-card:nth-child(1) { grid-column: 1 / 3; grid-row: 1 / 3; }
.work-grid.teaser .work-card:nth-child(2) { grid-column: 3; grid-row: 1; }
.work-grid.teaser .work-card:nth-child(3) { grid-column: 3; grid-row: 2; }
.work-grid.teaser .work-card:nth-child(4) { grid-column: 1; grid-row: 3; }
.work-grid.teaser .work-card:nth-child(5) { grid-column: 2; grid-row: 3; }
.work-grid.teaser .work-card:nth-child(6) { grid-column: 3; grid-row: 3; }

.work-grid.teaser .work-thumb { height: 100%; }
.work-grid.teaser figure { height: 100%; display: flex; flex-direction: column; }
.work-grid.teaser .work-caption { margin-top: 10px; }

@media (max-width: 600px) {
  .work-grid.teaser {
    grid-template-columns: 1fr;
    grid-auto-rows: auto;
  }
  .work-grid.teaser .work-card:nth-child(n) { grid-column: 1; grid-row: auto; }
  .work-grid.teaser .work-thumb { height: auto; aspect-ratio: 4 / 3; }
}

.work-card {
  display: block;
}

.work-card figure { margin: 0; }

.work-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--hairline);
}

.work-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.work-card:hover .work-thumb img { transform: scale(1.035); }

.work-caption {
  margin-top: 14px;
}

.work-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-style: italic;
  margin: 0 0 4px;
}

.work-meta {
  font-size: 13px;
  color: var(--mute);
  margin: 0;
}

.section-foot {
  margin-top: 56px;
  text-align: center;
}

/* ---------- Prints page ---------- */

.prints-intro {
  max-width: 70ch;
  margin-bottom: 56px;
}

.print-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--hairline);
  background: var(--surface);
}

.print-thumb {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--canvas);
  cursor: zoom-in;
}

.print-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.print-card:hover .print-thumb img { transform: scale(1.04); }

.print-body {
  padding: 20px 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.print-title {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 19px;
  margin: 0;
}

.print-meta {
  font-size: 13px;
  color: var(--mute);
  margin: 0 0 6px;
}

.print-buy-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.buy-now-btn {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 15px;
  color: var(--ink-soft);
  background: none;
  border: none;
  border-bottom: 1px solid var(--ink-soft);
  padding: 0 0 1px;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.buy-now-btn:hover { color: var(--ink); border-color: var(--ink); }

.buy-now-btn.is-added {
  color: var(--ink);
  border-color: var(--ink);
}

.print-title a {
  color: inherit;
  text-decoration: none;
}

.print-title a:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ---------- Single work page ---------- */

.work-detail {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 56px;
  align-items: start;
}

@media (max-width: 820px) {
  .work-detail { grid-template-columns: 1fr; gap: 32px; }
}

.work-detail-image {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--hairline);
}

.work-detail-image img {
  width: 100%;
  height: auto;
}

.work-facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 20px;
  margin: 0 0 24px;
  font-size: 14px;
}

.work-facts dt {
  color: var(--mute);
  letter-spacing: 0.02em;
}

.work-facts dd { margin: 0; }

.work-detail-body p {
  color: var(--ink-soft);
  margin: 0 0 16px;
}

.work-print-note {
  padding: 14px 16px;
  background: var(--accent-soft);
  font-size: 14px;
}

.work-detail-actions {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
  margin-top: 28px;
}

/* Filter pills */

.filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 48px;
}

.filter-pill {
  padding: 9px 18px;
  font-size: 13px;
  letter-spacing: 0.02em;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.filter-pill:hover { border-color: var(--ink); color: var(--ink); }

.filter-pill.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--canvas);
}

/* ---------- Lightbox ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(12, 11, 9, 0.94);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}

.lightbox.is-open { display: flex; }

.lightbox-inner {
  max-width: 1100px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.lightbox-inner img {
  max-height: 78vh;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  box-shadow: 0 30px 80px rgba(0,0,0,0.4);
}

.lightbox-caption {
  color: #f6f4ee;
  text-align: center;
  font-size: 14px;
}

.lightbox-caption .work-title { color: #f6f4ee; }

.lightbox-close {
  position: absolute;
  top: 24px;
  right: 32px;
  background: none;
  border: none;
  color: #f6f4ee;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  font-family: var(--font-body);
}

/* ---------- About page ---------- */

.about-hero {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 64px;
  align-items: start;
}

@media (max-width: 860px) {
  .about-hero { grid-template-columns: 1fr; gap: 32px; }
}

.about-portrait {
  width: 100%;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border: 1px solid var(--hairline);
}

.about-portrait img { width: 100%; height: 100%; object-fit: cover; }

.about-copy p {
  font-size: 18px;
  color: var(--ink-soft);
  margin: 0 0 20px;
}

.cv-block { margin-top: 8px; }

.cv-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.cv-row {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 24px;
  padding: 18px 0;
  border-bottom: 1px solid var(--hairline);
  font-size: 15px;
}

.cv-row:first-child { border-top: 1px solid var(--hairline); }

.cv-year {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--mute);
}

.cv-detail strong { font-weight: 500; color: var(--ink); }
.cv-detail span { color: var(--ink-soft); }

.cv-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 64px;
  margin-top: 96px;
}

@media (max-width: 720px) {
  .cv-columns { grid-template-columns: 1fr; gap: 56px; }
}

.cv-subheading {
  font-family: var(--font-display);
  font-size: 22px;
  font-style: italic;
  margin: 0 0 24px;
}

/* ---------- Enquire page ---------- */

.enquire-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
}

@media (max-width: 860px) {
  .enquire-layout { grid-template-columns: 1fr; gap: 48px; }
}

.enquire-info p {
  font-size: 17px;
  color: var(--ink-soft);
  margin: 0 0 24px;
}

.contact-detail {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--hairline);
}

.contact-detail dt {
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--mute);
  margin-bottom: 4px;
}

.contact-detail dd {
  margin: 0 0 20px;
  font-size: 16px;
}

.field {
  margin-bottom: 22px;
}

.field label {
  display: block;
  font-size: 13px;
  letter-spacing: 0.03em;
  color: var(--ink-soft);
  margin-bottom: 8px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 13px 14px;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 2px;
}

.field input::placeholder,
.field textarea::placeholder { color: var(--mute); }

.field textarea { resize: vertical; min-height: 130px; }

.field-hint {
  font-size: 12px;
  color: var(--mute);
  margin-top: 6px;
}

.form-status {
  margin-top: 16px;
  font-size: 14px;
  display: none;
}

.form-status.is-visible { display: block; }

.form-status.success { color: var(--accent); }
.form-status.error { color: #a4392c; }

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--hairline);
  padding: 48px 0;
}

.site-footer .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-wordmark {
  font-family: var(--font-display);
  font-size: 16px;
  font-style: italic;
}

.footer-meta {
  display: flex;
  gap: 24px;
  font-size: 13px;
  color: var(--mute);
}

.footer-meta a:hover { color: var(--ink); }

/* ---------- Confirmation page (checkout success) ---------- */

.confirmation-section {
  min-height: calc(100vh - var(--nav-height) - 200px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 0;
}

.confirmation-content {
  text-align: center;
}

.confirmation-content .page-title { margin-bottom: 14px; }
.confirmation-content .page-lede { margin: 0 auto 28px; }

/* ---------- Page header (non-home pages) ---------- */

.page-header {
  padding: 64px 0 40px;
}

@media (max-width: 720px) {
  .page-header { padding: 56px 0 32px; }
}

.page-title {
  font-family: var(--font-display);
  font-size: clamp(32px, 4.2vw, 46px);
  font-weight: 500;
  margin: 0 0 14px;
}

.page-lede {
  color: var(--ink-soft);
  max-width: 60ch;
  font-size: 17px;
  margin: 0;
}

/* ---------- Reveal on scroll ---------- */

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1), transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
  .work-thumb img, .print-thumb img { transition: none; }
}
