/* The Tiny Wilds — design 3a
   Tokens come from the Modernist design system; type is Cormorant Garamond
   (italic headings + accents) over EB Garamond body. */

:root {
  --color-bg: #f3f2f2;
  --color-surface: #eae9e9;
  --color-text: #201e1d;
  --color-accent: #ec3013;
  --color-accent-700: #ae1800;
  --color-divider: color-mix(in srgb, #201e1d 40%, transparent);
  --color-muted-80: color-mix(in srgb, var(--color-text) 80%, transparent);
  --color-muted-72: color-mix(in srgb, var(--color-text) 72%, transparent);
  --color-muted-70: color-mix(in srgb, var(--color-text) 70%, transparent);

  --font-head: "Cormorant Garamond", Georgia, serif;
  --font-body: "EB Garamond", Georgia, serif;
  --head-weight: 500;

  --gutter: 72px;
  --max: 1280px;

  /* 3a type scale */
  --size-brand: 28px;
  --size-hero: clamp(52px, 7.4vw, 94px);
  --size-h3: clamp(40px, 4.4vw, 56px);
  --size-h4: 28px;
  --size-kicker: 22px;
  --size-bio: clamp(28px, 3vw, 38px);
  --size-close: clamp(44px, 6vw, 76px);
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  text-wrap: pretty;
}

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

a { color: var(--color-text); text-underline-offset: 3px; }
a:hover { color: var(--color-accent); }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--color-accent) 30%, transparent); }

h1, h2, h3, h4, p { margin: 0; }

.head {
  font-family: var(--font-head);
  font-weight: var(--head-weight);
  font-style: italic;
  letter-spacing: 0;
}

.page {
  max-width: var(--max);
  margin: 0 auto;
}

.wrap { padding: 0 var(--gutter); }

.rule {
  height: 2px;
  border: 0;
  margin: 0;
  background: var(--color-divider);
}

.kicker {
  font-family: var(--font-head);
  font-style: italic;
  font-size: var(--size-kicker);
  color: var(--color-accent-700);
}

.icon { flex: none; }

/* — pill button — */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 12px 26px;
  border: 1px solid var(--color-text);
  border-radius: 999px;
  background: transparent;
  color: var(--color-text);
  text-decoration: none;
  font-family: var(--font-head);
  font-style: italic;
  font-size: 20px;
  line-height: 1.2;
  transition: background .2s, color .2s;
}
.pill:hover,
.nav .pill:hover {
  background: var(--color-text);
  color: var(--color-bg);
}
.pill-sm { padding: 8px 20px; font-size: 18px; }

/* — nav — */
.nav {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px var(--gutter);
  border-bottom: 2px solid var(--color-divider);
}
.nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-right: auto;
  font-size: var(--size-brand);
  font-style: normal;
  text-decoration: none;
}
/* the logo file is pink on white: the filter turns the pink black, and
   multiply drops the white so the page colour shows through */
.nav-logo {
  width: 40px;
  height: auto;
  filter: grayscale(1) brightness(.6) contrast(6);
  mix-blend-mode: multiply;
}
.nav a { color: inherit; text-decoration: none; font-size: 16px; }
.nav a:hover { color: var(--color-accent); }
.nav .pill { font-size: 18px; }
.nav-icon { display: inline-flex; align-items: center; }

/* — hero — */
.hero {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 24px;
  padding: 32px 0 20px;
}
.hero h1 {
  font-size: var(--size-hero);
  line-height: 1.02;
  max-width: 22ch;
}
.hero-body {
  display: grid;
  gap: 28px;
  justify-items: center;
}
.hero-body p {
  font-size: 20px;
  line-height: 1.65;
  max-width: 44ch;
  color: var(--color-muted-80);
}

/* text sits on top of the faded upper edge of the photo */
.hero { position: relative; z-index: 1; }

.hero-img {
  position: relative;
  margin-top: max(-120px, -9.4vw);
  width: 100%;
  aspect-ratio: 1658 / 866;
  object-fit: cover;
  margin-bottom: 96px;
  /* soft fades: a rounded dome for the top (so the corners melt away),
     straight fades on the sides and bottom, and a blurred arch scooped out
     of the top centre behind the headline and button */
  --dome: radial-gradient(ellipse 85% 100% at 50% 100%, #000 62%, transparent 100%);
  --sides: linear-gradient(to right, transparent, #000 9%, #000 91%, transparent);
  --bottom: linear-gradient(to top, transparent, #000 9%);
  --arch: radial-gradient(ellipse 52% 34% at 50% 0%, transparent 0%, transparent 50%, rgba(0,0,0,.55) 78%, #000 100%);
  -webkit-mask-image: var(--dome), var(--sides), var(--bottom), var(--arch);
  -webkit-mask-composite: source-in;
  mask-image: var(--dome), var(--sides), var(--bottom), var(--arch);
  mask-composite: intersect;
}

/* — work grid — */
.work {
  padding: 72px 0 112px;
  display: grid;
  gap: 48px;
  scroll-margin-top: 24px;
}
.section-head { display: grid; gap: 8px; }
.section-head h2 { font-size: var(--size-h3); line-height: 1.12; }

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 64px 32px;
}

.piece { display: grid; gap: 14px; align-content: start; }
.piece-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: var(--color-surface);
}
.piece-text {
  display: grid;
  gap: 4px;
}
.piece-text h3 { font-size: var(--size-h4); line-height: 1.12; }
.piece-text p {
  font-size: 15px;
  line-height: 1.5;
  color: var(--color-muted-72);
}
.price-link {
  display: flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  font-family: var(--font-head);
  font-style: italic;
  font-size: 19px;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
}

/* — about — */
.about {
  display: grid;
  grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
  gap: 72px;
  align-items: center;
  padding: 112px 0;
  scroll-margin-top: 24px;
}
.about img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }
.about-text { display: grid; gap: 20px; }
.about-text .bio { font-size: var(--size-bio); line-height: 1.25; }
.about-text .meta { font-size: 15px; color: var(--color-muted-72); }

/* — commissions — */
.close {
  background: var(--color-surface);
  border-top: 2px solid var(--color-divider);
  padding: 96px var(--gutter);
  display: grid;
  gap: 40px;
  scroll-margin-top: 24px;
}
.close h2 {
  font-size: var(--size-close);
  line-height: 1.04;
  max-width: 18ch;
}
.close .pill { overflow-wrap: anywhere; }

/* — footer — */
.footer {
  padding: 28px var(--gutter);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 14px;
  color: var(--color-muted-70);
}
.footer a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: inherit;
  text-decoration: none;
}
.footer a:hover { color: var(--color-accent); }

/* — tile button + photo viewer — */
.piece-open {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
}
.piece-open .piece-img { transition: opacity .2s; }
.piece-open:hover .piece-img { opacity: .9; }
.piece-badge {
  position: absolute;
  right: 12px;
  bottom: 12px;
  padding: 3px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--color-bg) 92%, transparent);
  color: var(--color-text);
  font-family: var(--font-head);
  font-style: italic;
  font-size: 16px;
}

html.viewer-open { overflow: hidden; }

.viewer {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 20px 24px 24px;
  border: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
}
.viewer[open] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 16px;
}
.viewer::backdrop { background: transparent; }

.viewer-top {
  display: flex;
  align-items: center;
  gap: 16px;
}
.viewer-title { font-size: 26px; margin-right: auto; }
.viewer-count { font-size: 15px; color: var(--color-muted-72); }

.viewer-stage {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  min-height: 0;
}
/* the frame fills the space between the top bar and the thumbnails;
   the photo is scaled to fit inside it */
.viewer-frame {
  position: relative;
  align-self: stretch;
  min-width: 0;
  min-height: 0;
}
.viewer-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: contain;
  user-select: none;
}

.viewer-btn {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid var(--color-text);
  border-radius: 999px;
  background: transparent;
  color: var(--color-text);
  cursor: pointer;
  transition: background .2s, color .2s;
}
.viewer-btn:hover { background: var(--color-text); color: var(--color-bg); }
.viewer-close { width: 44px; height: 44px; }

.viewer-thumbs {
  display: flex;
  justify-content: center;
  gap: 10px;
  overflow-x: auto;
}
.viewer-thumb {
  flex: none;
  width: 64px;
  height: 64px;
  padding: 0;
  border: 2px solid transparent;
  background: var(--color-surface);
  cursor: pointer;
  opacity: .6;
  transition: opacity .2s, border-color .2s;
}
.viewer-thumb img { width: 100%; height: 100%; object-fit: cover; }
.viewer-thumb:hover { opacity: 1; }
.viewer-thumb[aria-current="true"] { opacity: 1; border-color: var(--color-text); }

.viewer.is-single .viewer-prev,
.viewer.is-single .viewer-next { visibility: hidden; }
.viewer.is-single .viewer-thumbs { display: none; }

/* — responsive — */
@media (max-width: 1100px) {
  :root { --gutter: 48px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .about { gap: 48px; }
}

@media (max-width: 760px) {
  :root { --gutter: 20px; --size-brand: 24px; --size-h4: 24px; }
  .nav { flex-wrap: wrap; row-gap: 8px; }
  .nav-logo { width: 34px; }
  /* row 1: brand + button; row 2: links */
  .nav::after { content: ""; flex-basis: 100%; order: 1; }
  .nav > a:not(.nav-brand):not(.pill) { order: 2; }
  .hero { padding: 72px 0 48px; gap: 24px; }
  .hero-body p { font-size: 18px; }
  .hero-img { margin-bottom: 56px; }
  .work { padding: 56px 0 72px; gap: 36px; }
  .grid { grid-template-columns: minmax(0, 1fr); gap: 48px; }
  .about { grid-template-columns: minmax(0, 1fr); gap: 32px; padding: 72px 0; }
  .close { padding: 64px var(--gutter); gap: 28px; }
  .footer { flex-direction: column; }

  /* viewer: arrows sit under the photo on phones */
  .viewer { padding: 16px; }
  .viewer-title { font-size: 22px; }
  .viewer-stage { grid-template-columns: 1fr 1fr; grid-template-rows: minmax(0, 1fr) auto; gap: 12px; }
  .viewer-frame { grid-column: 1 / -1; grid-row: 1; }
  .viewer-prev { grid-row: 2; justify-self: end; }
  .viewer-next { grid-row: 2; justify-self: start; }
  .viewer.is-single .viewer-prev,
  .viewer.is-single .viewer-next { display: none; }
  .viewer-thumb { width: 52px; height: 52px; }
}
