/* Illumination of Spirit — public styles.
   Type comes from Settings via custom properties set in the page head. */

:root {
  --paper: #faf8f4;
  --ink: #26221e;
  --muted: #7d7469;
  --line: #e6e0d5;
  --accent: #6b7f5e;
  --gap: 14px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body, system-ui, sans-serif);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

a { color: inherit; }

.skip {
  position: absolute; left: -9999px;
  background: var(--ink); color: var(--paper); padding: .6rem 1rem;
}
.skip:focus { left: 1rem; top: 1rem; z-index: 100; }

/* ------------------------------------------------------------------ hero */

.hero { position: relative; display: none; }          /* desktop only */
.hero-image { width: 100%; height: auto; }

.hero-words {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; gap: .4em;
  /* Never let the lettering crowd the edge of the frame. */
  padding: 4% max(3rem, 5%);
  pointer-events: none;
}
.hero-words { opacity: var(--hero-opacity, 1); }
.hero-words.is-light { color: #fff; }
.hero-words.is-dark  { color: #241f1b; }
.hero-words.has-shadow { text-shadow: 0 1px 14px rgba(0,0,0,.5); }
.hero-words.is-dark.has-shadow { text-shadow: 0 1px 14px rgba(255,255,255,.6); }

.hero-words[class*="pos-top-"]    { justify-content: flex-start; }
.hero-words[class*="pos-middle-"] { justify-content: center; }
.hero-words[class*="pos-bottom-"] { justify-content: flex-end; }
.hero-words[class*="-left"]   { align-items: flex-start; text-align: left; }
.hero-words[class*="-center"] { align-items: center; text-align: center; }
.hero-words[class*="-right"]  { align-items: flex-end; text-align: right; }

.hero-wordmark {
  font-family: var(--font-display, Georgia, serif);
  /* Scales with the viewport so the balance holds at any width, with a floor
     and a ceiling so it never becomes silly at the extremes. */
  font-size: clamp(22px, calc(var(--word-size-n, 60) * 100vw / 1600), 190px);
  line-height: 1.05;
}
.hero-wordmark.is-italic { font-style: italic; }
.hero-wordmark-png { max-width: 46%; height: auto; }

.hero-tagline, .hero-byline {
  letter-spacing: var(--tracking, .08em);
  font-weight: 300;
}
.hero-tagline { font-size: clamp(10px, calc(var(--tagline-size-n, 18) * 100vw / 1600), 48px); }
.hero-byline  { font-size: clamp(10px, calc(var(--byline-size-n, 16) * 100vw / 1600), 44px); }

/* ---------------------------------------------------------------- header */

.bar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  /* Line the bar up with the photographs below rather than the window edge. */
  padding: .6rem max(1.25rem, calc((100% - 1500px) / 2));
  background: rgba(250, 248, 244, .94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.bar-identity { display: flex; align-items: center; gap: .65rem; text-decoration: none; min-width: 0; }
.bar-mark { width: 40px; height: 40px; object-fit: cover; border-radius: 2px; flex: none; }
.bar-words { display: flex; flex-direction: column; min-width: 0; }

.bar-wordmark {
  font-family: var(--font-display, Georgia, serif);
  font-size: var(--mobile-word-size, 20px);
  line-height: 1.15;
}
.bar-wordmark.is-italic { font-style: italic; }
.bar-wordmark.is-plain {
  font-family: var(--font-body, system-ui, sans-serif);
  letter-spacing: var(--tracking, .08em);
  font-style: normal;
}
.bar-tagline, .bar-byline {
  font-size: .68rem; color: var(--muted);
  letter-spacing: var(--tracking, .08em);
  line-height: 1.35;
}

.bar-nav {
  display: flex; gap: 1.1rem; flex-wrap: wrap;
  margin-left: auto;
  font-size: .82rem; letter-spacing: var(--tracking, .08em);
  text-transform: lowercase;
}
.bar-nav a { text-decoration: none; color: var(--muted); padding-bottom: 2px; }
.bar-nav a:hover { color: var(--ink); border-bottom: 1px solid var(--accent); }

/* --------------------------------------------------------- shops, social */

.shopstrip {
  display: flex; align-items: center; justify-content: center;
  gap: 1.5rem; flex-wrap: wrap;
  padding: 1.4rem 1.25rem .2rem;
  font-size: .85rem; letter-spacing: var(--tracking, .08em);
}
.shops, .socials { margin: 0; display: flex; align-items: center; gap: 1rem; }
.shops-label { color: var(--muted); }
.shops a { color: var(--muted); text-decoration: none; border-bottom: 1px solid var(--line); padding-bottom: 1px; }
.shops a:hover { color: var(--ink); border-color: var(--accent); }

.socials a { color: var(--muted); display: block; }
.socials a:hover { color: var(--accent); }
.socials svg {
  width: 19px; height: 19px;
  fill: none; stroke: currentColor; stroke-width: 1.6;
}
.socials svg path { fill: currentColor; stroke: none; }
.socials svg .solid { fill: currentColor; stroke: none; }

/* ------------------------------------------------------------------ main */

main { max-width: 1500px; margin: 0 auto; padding: 1.5rem 1rem 4rem; }

.page-head { max-width: 60ch; margin: 1.5rem auto 2rem; text-align: center; }
.page-head h1 {
  font-family: var(--font-display, Georgia, serif);
  font-weight: 400; font-size: 2.2rem; margin: 0 0 .4rem;
}
.intro { color: var(--muted); margin: 0; }
.available {
  margin: .7rem 0 0; color: var(--muted);
  font-size: .78rem; letter-spacing: var(--tracking, .08em);
  line-height: 1.9;
}
.available-any { color: var(--ink); }
.empty-note { color: var(--muted); text-align: center; padding: 4rem 1rem; }

/* --------------------------------------------------------- category tiles */

.covers {
  list-style: none; margin: 2rem 0 0; padding: 0;
  display: grid; gap: 2rem;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}
.cover a { text-decoration: none; display: block; }
.cover-frame {
  display: block; aspect-ratio: 3 / 2; overflow: hidden;
  background: var(--line);
}
.cover-frame img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.cover a:hover .cover-frame img { transform: scale(1.02); }
.cover-name {
  display: block; margin-top: .7rem;
  font-family: var(--font-display, Georgia, serif);
  font-size: 1.3rem;
}
.cover-count {
  display: block; color: var(--muted);
  font-size: .78rem; letter-spacing: var(--tracking, .08em);
}

/* -------------------------------------------------------- justified rows */

.rows { display: flex; flex-wrap: wrap; gap: var(--gap); }
.cell {
  display: block; position: relative;
  overflow: hidden; background: var(--line);
  /* Before the script measures — or if it never runs — each cell holds its
     photograph's own proportions, so the grid is tidy either way rather than
     collapsing into mismatched heights. */
  aspect-ratio: var(--ar, 1.5);
  flex: var(--ar) 1 calc(var(--ar) * 260px);
}
.cell picture, .cell img { width: 100%; height: 100%; }
.cell img { object-fit: cover; transition: opacity .3s ease; }
/* Measured: the script owns the size, so the placeholder proportions go. */
.rows.is-measured .cell { flex: none; aspect-ratio: auto; }

/* One photograph per row on a phone, each at its natural shape. */
.rows.is-stacked { display: block; }
.rows.is-stacked .cell {
  flex: 0 0 auto; aspect-ratio: auto;
  width: 100%; height: auto;
  margin-bottom: var(--gap);
  background: none;
}
.rows.is-stacked .cell:last-child { margin-bottom: 0; }
.rows.is-stacked img { height: auto; object-fit: contain; }

/* Two columns on a phone, filled strictly in order. Photographs keep their
   own shape, and both outer edges stay flush because nothing has to be
   balanced across a row. */
.rows.is-paired {
  display: flex;
  gap: var(--gap);
  align-items: flex-start;
}
.rows.is-paired .col {
  flex: 1 1 0;
  display: flex; flex-direction: column; gap: var(--gap);
  min-width: 0;
}
.rows.is-paired .cell {
  aspect-ratio: auto;
  /* The base rule sets flex-basis from the aspect ratio, which inside a
     vertical column becomes a HEIGHT — stretching every photograph and
     opening gaps. Each cell here is simply as tall as its picture. */
  flex: 0 0 auto;
  width: auto; height: auto;
  background: none;
}
.rows.is-paired img { height: auto; object-fit: contain; }
.cell:hover img { opacity: .92; }

/* Marks the photographs that can be bought, so someone looking to buy can
   see at a glance rather than opening each one. Deliberately quiet. */
.tag-shop {
  position: absolute; right: 8px; bottom: 8px;
  padding: .18em .5em;
  background: rgba(24, 20, 17, .58);
  color: #fff;
  font-size: 9px; letter-spacing: .14em; text-transform: uppercase;
  border-radius: 2px;
  pointer-events: none;
}
.cell:hover .tag-shop { background: rgba(24, 20, 17, .82); }
.cell:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ------------------------------------------------------------ photo page */

.single { max-width: 1200px; margin: 0 auto; }

.crumb {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  margin: 0 0 1rem; font-size: .85rem; letter-spacing: var(--tracking, .08em);
}
.crumb a {
  display: inline-flex; align-items: center; gap: .35rem;
  color: var(--ink); text-decoration: none;
  border-bottom: 1px solid var(--line); padding-bottom: 2px;
}
.crumb a:hover { border-color: var(--accent); }
.crumb svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.crumb-count { color: var(--muted); font-size: .78rem; }

/* Arrows tucked just outside the photograph, dark enough to read against the
   paper background and against a pale image. */
.page-arrow {
  position: fixed; top: 50%; transform: translateY(-50%);
  z-index: 15;
  display: grid; place-items: center;
  width: 46px; height: 46px;
  color: #faf8f4;
  background: rgba(38, 34, 30, .82);
  border-radius: 50%;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .18);
  transition: background .2s ease, transform .2s ease;
}
.page-arrow:hover { background: rgba(38, 34, 30, .96); }
.page-arrow.prev:hover { transform: translateY(-50%) translateX(-2px); }
.page-arrow.next:hover { transform: translateY(-50%) translateX(2px); }

/* The photograph is capped at 1200px, so sit 8px off its edge and never
   closer than 8px to the window. */
.page-arrow.prev { left: max(.5rem, calc((100% - 1200px) / 2 - 54px)); }
.page-arrow.next { right: max(.5rem, calc((100% - 1200px) / 2 - 54px)); }
.page-arrow svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.single-image { background: var(--line); }
.single-image img { width: 100%; height: auto; max-height: 82vh; object-fit: contain; background: var(--paper); }

.single-meta { max-width: 62ch; margin: 1.5rem auto 0; text-align: center; }
.single-meta h1 {
  font-family: var(--font-display, Georgia, serif);
  font-weight: 400; font-size: 1.7rem; margin: 0 0 .5rem;
}
.caption { margin: 0 0 1rem; }
.print {
  display: flex; align-items: baseline; justify-content: center;
  gap: .9rem; flex-wrap: wrap;
  margin: 0 0 .8rem;
}
.print-label {
  color: var(--muted);
  font-size: .78rem; letter-spacing: var(--tracking, .08em);
}
.print a {
  color: var(--accent); text-decoration: none;
  border-bottom: 1px solid currentColor; padding-bottom: 1px;
  letter-spacing: var(--tracking, .08em); font-size: .88rem;
}
.print a:hover { color: var(--ink); }
.reference {
  margin: 0; color: var(--muted);
  font-size: .78rem; letter-spacing: var(--tracking, .08em);
}
.reference span { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.single-nav {
  display: flex; align-items: center; justify-content: center; gap: 1.5rem;
  margin: 2rem 0 0; font-size: .85rem; letter-spacing: var(--tracking, .08em);
}
.single-nav a { color: var(--muted); text-decoration: none; }
.single-nav a:hover { color: var(--ink); }
.single-nav .step { display: inline-flex; align-items: center; gap: .3rem; }
.single-nav svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; }

/* On a wide screen the arrows at the edges already do this, so the lower row
   is just the way back. */
@media (min-width: 761px) {
  .single-nav .step { display: none; }
}

/* ---------------------------------------------------------------- footer */

.foot {
  border-top: 1px solid var(--line);
  padding: 2.5rem 1rem 3rem;
  text-align: center;
  font-size: .8rem; letter-spacing: var(--tracking, .08em);
  color: var(--muted);
}
.foot .socials { justify-content: center; margin-bottom: 1rem; }
.foot-shops { margin: 0 0 .8rem; display: flex; gap: 1.25rem; justify-content: center; }
.foot-shops a { color: var(--muted); text-decoration: none; border-bottom: 1px solid var(--line); }
.foot-shops a:hover { color: var(--ink); }
.foot-credit { margin: 0; }

/* ------------------------------------------------------------ responsive */

@media (min-width: 761px) {
  .hero { display: block; }
  .bar-tagline, .bar-byline { display: none; }   /* the hero already says it */
  /* On the home page the hero carries the name and the tiles are the
     navigation, so the bar underneath it says nothing twice. */
  .bar.bar-secondary { display: none; }
  main { padding: 2rem 1.5rem 5rem; }
}

@media (max-width: 759px) {
  /* Same result without JavaScript. */
  .rows { display: block; }
  .rows .cell { width: 100%; height: auto; margin-bottom: var(--gap); background: none; }
  .rows .cell img { height: auto; object-fit: contain; }
}

@media (max-width: 760px) {
  body { font-size: 16px; }
  /* The photo page gets buttons below the image instead — arrows here would
     sit on top of the photograph. */
  .page-arrow { display: none; }
  .bar { gap: .6rem; padding: .6rem 1rem; }
  /* On the home page the tiles just below are the navigation, so the list of
     categories in the bar says the same thing twice. */
  .page-home .bar-nav { display: none; }
  .bar-nav { width: 100%; margin-left: 0; gap: .9rem; font-size: .78rem; }
  .page-head h1 { font-size: 1.7rem; }
  .covers { gap: 1.5rem; grid-template-columns: 1fr; }
  .single-meta { text-align: left; }
  .print { justify-content: flex-start; }
  .single-nav {
    justify-content: space-between; gap: .75rem;
    border-top: 1px solid var(--line); padding-top: 1.1rem;
  }
  .single-nav .step {
    border: 1px solid var(--line); border-radius: 2rem;
    padding: .5rem .9rem; color: var(--ink);
  }
  .single-nav .up { flex: 1; text-align: center; }
}

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

/* ------------------------------------------------------------ contact */

.enquiry { max-width: 34rem; margin: 0 auto; }
.enquiry label { display: block; margin: 0 0 1.1rem; font-size: .82rem; color: var(--muted); letter-spacing: var(--tracking, .08em); }
.enquiry input[type=text], .enquiry input[type=email], .enquiry textarea {
  display: block; width: 100%; margin-top: .35rem;
  padding: .6rem .7rem;
  font: inherit; font-size: .95rem; color: var(--ink); letter-spacing: normal;
  background: #fff; border: 1px solid var(--line); border-radius: 2px;
}
.enquiry textarea { resize: vertical; }
.enquiry input:focus, .enquiry textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.enquiry button {
  font: inherit; font-size: .85rem; letter-spacing: var(--tracking, .08em);
  padding: .65rem 1.6rem; cursor: pointer;
  background: var(--accent); color: #fff;
  border: 1px solid var(--accent); border-radius: 2px;
}
.enquiry button:hover { filter: brightness(.94); }

/* Only a robot ever fills this in. */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.about {
  margin: 0 0 1.4rem; padding-bottom: .9rem;
  border-bottom: 1px solid var(--line);
  font-size: .82rem; color: var(--muted); letter-spacing: var(--tracking, .08em);
}
.about span { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--ink); }
.about a { margin-left: .75rem; color: var(--accent); }

.captcha-note { font-size: .72rem; color: var(--muted); margin: .6rem 0 1.2rem; line-height: 1.6; }
.frc-captcha { margin: .5rem 0 0; min-height: 70px; }

.form-error {
  max-width: 34rem; margin: 0 auto 1.5rem;
  padding: .7rem .9rem; border-radius: 2px;
  background: #f8ecea; border: 1px solid #e6cdc7; color: #9c4a3c;
  font-size: .9rem;
}
.sent { text-align: center; font-size: 1.05rem; margin: 3rem 0 .5rem; }
.sent-back { text-align: center; color: var(--muted); font-size: .85rem; }

.enquire { margin: 0 0 .6rem; }
.enquire a {
  color: var(--accent); text-decoration: none;
  border-bottom: 1px solid currentColor; padding-bottom: 1px;
  font-size: .85rem; letter-spacing: var(--tracking, .08em);
}
.enquire a:hover { color: var(--ink); }

.foot-contact { margin: 0 0 .8rem; }
.foot-contact a { color: var(--muted); }
.foot-contact a:hover { color: var(--ink); }

a.available-any { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line); }
a.available-any:hover { border-color: var(--accent); }

/* ---------------------------------------------------------------- about */

.about { max-width: 1000px; margin: 2rem auto 0; }
.about.has-portrait {
  display: grid;
  grid-template-columns: minmax(0, 240px) minmax(0, 1fr);
  gap: 3rem;
  align-items: start;
}
.about-portrait img { width: 100%; height: auto; display: block; }
.about-words { max-width: 62ch; }
.about-words h1 {
  font-family: var(--font-display, Georgia, serif);
  font-weight: 400; font-size: 2rem; margin: 0 0 1.2rem;
}
.about-words p { margin: 0 0 1.2rem; }
.about-contact { margin-top: 2rem; }
.about-contact a {
  color: var(--accent); text-decoration: none;
  border-bottom: 1px solid currentColor; padding-bottom: 1px;
  font-size: .9rem; letter-spacing: var(--tracking, .08em);
}
.about-contact a:hover { color: var(--ink); }

/* A hairline between the galleries and the site's own pages. */
.bar-divider {
  width: 1px; height: 1em; background: var(--line);
  display: inline-block; align-self: center;
}
.strip-pages { margin: 0; display: flex; gap: 1.1rem; }

/* A hairline between the three groups: pages, shops, and elsewhere. */
.strip-divider {
  width: 1px; height: 1.1em;
  background: var(--line);
  display: inline-block;
}
.strip-pages a { color: var(--muted); text-decoration: none; border-bottom: 1px solid var(--line); padding-bottom: 1px; }
.strip-pages a:hover { color: var(--ink); border-color: var(--accent); }
.foot-contact { display: flex; gap: 1.25rem; justify-content: center; }

@media (max-width: 760px) {
  .about.has-portrait { grid-template-columns: 1fr; gap: 1.75rem; }
  .about-portrait { max-width: 260px; }
}
