/* Cowbrook - the same English watercolour look as oldglossop.com: warm paper,
   sepia ink, washes of dale green, sky, gritstone ochre and moorland heather,
   and faint painted hills along the top of every page.
   Everything is CSS (no image files): the paper grain is an SVG noise
   filter, the hills an SVG with softened edges, the washes layered radial
   gradients with uneven edges. */
:root {
  --paper: #f5efe0;
  --ink: #3a342b;
  --sepia: #6e5c45;
  --muted: #857560;
  --sage: 138, 166, 118;
  --sky: 132, 166, 194;
  --ochre: 206, 170, 104;
  --rose: 150, 112, 158;   /* heather */
  --link: #3d6a6c;
  --link-hover: #7a4e3a;
}

/* painted hills: three ridges (heather, dale green, distant blue), edges
   roughened with turbulence so they bleed like wet paint */
body::before {
  content: "";
  position: absolute; top: 0; left: 0; right: 0; height: 260px;
  z-index: -1; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 260' preserveAspectRatio='none'%3E%3Cdefs%3E%3Cfilter id='w'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.02' numOctaves='3' seed='4'/%3E%3CfeDisplacementMap in='SourceGraphic' scale='18'/%3E%3CfeGaussianBlur stdDeviation='2.5'/%3E%3C/filter%3E%3C/defs%3E%3Cg filter='url(%23w)'%3E%3Cpath d='M0 150 C150 95 260 120 380 100 S620 60 760 95 S1010 70 1200 110 L1200 0 L0 0Z' fill='rgb(132,166,194)' fill-opacity='0.16'/%3E%3Cpath d='M0 175 C120 140 240 150 360 128 S560 105 700 140 S960 120 1200 150 L1200 0 L0 0Z' fill='rgb(138,166,118)' fill-opacity='0.13'/%3E%3Cpath d='M0 200 C180 168 300 190 450 165 S700 150 860 180 S1080 160 1200 185 L1200 230 C900 215 400 235 0 225Z' fill='rgb(150,112,158)' fill-opacity='0.12'/%3E%3C/g%3E%3C/svg%3E") no-repeat top / 100% 100%;
}
body { position: relative; z-index: 0; }

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  font-family: 'EB Garamond', Georgia, 'Times New Roman', serif;
  font-size: 1.15rem;
  line-height: 1.65;
  background-color: var(--paper);
  /* paper grain + a faint sky wash at the top and earth wash at the foot */
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.45 0 0 0 0 0.38 0 0 0 0 0.28 0 0 0 0.09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    radial-gradient(ellipse 90% 40% at 20% 0%, rgba(var(--sky), 0.28), transparent 70%),
    radial-gradient(ellipse 70% 35% at 85% 4%, rgba(var(--sage), 0.22), transparent 70%),
    radial-gradient(ellipse 80% 30% at 50% 100%, rgba(var(--ochre), 0.18), transparent 70%);
  background-attachment: scroll;
  min-height: 100vh;
}

a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--link-hover); }

h1, h2, h3, .site-title {
  font-family: 'Cormorant Garamond', 'EB Garamond', Georgia, serif;
  font-weight: 600;
  color: var(--sepia);
}

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }

/* ---- header photo: Wal's own photo of Old Glossop (images/header.jpg),
   muted towards watercolour and faded into the paper at its foot. If the
   file is missing the page simply shows the painted hills instead. ---- */
.hero { position: relative; }
.hero::before {
  content: "";
  position: absolute; inset: 0 0 -60px 0;
  z-index: -1; pointer-events: none;
  background: url("/images/hero.jpg") center 45% / cover no-repeat;
  filter: saturate(0.7) sepia(0.18) contrast(0.92) brightness(1.06);
  opacity: 0.6;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 45%, transparent 100%);
          mask-image: linear-gradient(to bottom, #000 0%, #000 45%, transparent 100%);
}

/* ---- header: the name painted over a loose wash ---- */
header.wrap { padding-top: 36px; padding-bottom: 36px; }
.hero header.wrap { padding-top: 110px; padding-bottom: 44px; }
.hero .site-title {
  background:
    radial-gradient(ellipse 65% 75% at 35% 55%, rgba(245, 239, 224, 0.92), rgba(245, 239, 224, 0.6) 62%, transparent 80%);
}
@media (max-width: 700px) {
  .hero header.wrap { padding-top: 70px; padding-bottom: 32px; }
}
.site-title, .site-title a {
  display: inline-block;
  margin: 0;
  font-size: 2.6rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  color: var(--sepia);
}
.site-title {
  padding: 6px 28px 10px 18px;
  background:
    radial-gradient(ellipse 60% 70% at 30% 55%, rgba(var(--sage), 0.40), transparent 72%),
    radial-gradient(ellipse 55% 80% at 75% 40%, rgba(var(--sky), 0.35), transparent 70%);
  border-radius: 46% 54% 42% 58% / 60% 44% 56% 40%;
}

/* ---- post list: each card a soft wash of colour ---- */
.cards {
  list-style: none; margin: 0 0 72px; padding: 0;
  display: grid; gap: 36px;
  grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr));
}
.card {
  --wash: var(--sage);
  min-width: 0;
  padding: 22px 22px 20px;
  display: flex; flex-direction: column;
  overflow-wrap: break-word;
  background:
    radial-gradient(ellipse 85% 65% at 30% 25%, rgba(var(--wash), 0.42), transparent 75%),
    radial-gradient(ellipse 60% 50% at 85% 10%, rgba(var(--wash), 0.20), transparent 70%),
    radial-gradient(ellipse 70% 60% at 75% 90%, rgba(var(--wash), 0.32), transparent 70%),
    rgba(255, 252, 244, 0.50);
  /* uneven, hand-laid edges */
  border-radius: 18px 26px 16px 30px / 28px 16px 26px 18px;
  box-shadow: 0 1px 0 rgba(110, 92, 69, 0.08), 0 6px 18px -10px rgba(110, 92, 69, 0.35);
}
.card:nth-child(4n+2) { --wash: var(--sky); }
.card:nth-child(4n+3) { --wash: var(--ochre); }
.card:nth-child(4n+4) { --wash: var(--rose); }
.card img {
  width: 100%; display: block; margin-bottom: 14px;
  max-height: 240px; object-fit: cover; object-position: center 30%;
  border-radius: 6px;
  box-shadow: 0 2px 10px -4px rgba(58, 52, 43, 0.45);
}
.card h2 { margin: 0 0 6px; font-size: 1.65rem; line-height: 1.2; }
.card h2 a { color: var(--sepia); text-decoration: none; }
.card h2 a:hover { color: var(--link-hover); }
.card .desc { flex: 1; margin: 0 0 16px; }
.card .more { font-style: italic; }

.meta { color: var(--muted); font-size: 0.95rem; font-style: italic; margin: 0 0 8px; }

/* ---- post page ---- */
article { max-width: 760px; margin: 0 auto 72px; }
.post-head { display: grid; gap: 32px; margin-bottom: 36px; }
.post-head.has-cover { grid-template-columns: 1fr 1fr; align-items: center; }
.post-head h1 { margin: 0 0 14px; font-size: 2.5rem; line-height: 1.1; }
.post-head .desc { color: var(--sepia); font-style: italic; margin: 0; }
.cover {
  width: 100%; border-radius: 6px;
  box-shadow: 0 3px 14px -5px rgba(58, 52, 43, 0.5);
}

/* the article sits on a lighter sheet with a faint wash at its head */
.content {
  padding: 28px 32px;
  background:
    radial-gradient(ellipse 70% 25% at 15% 0%, rgba(var(--sage), 0.18), transparent 70%),
    rgba(255, 252, 244, 0.6);
  border-radius: 14px 20px 12px 24px / 22px 12px 20px 14px;
  box-shadow: 0 6px 20px -12px rgba(110, 92, 69, 0.4);
}
.content p { margin: 0 0 0.9em; }
.content img, .content video {
  max-width: 100%; height: auto; border-radius: 6px;
  box-shadow: 0 2px 10px -4px rgba(58, 52, 43, 0.45);
}
.content video { width: 100%; background: #000; }
.content h2, .content h3 { line-height: 1.25; margin: 1.2em 0 0.4em; }
.content h2 { font-size: 1.7rem; }
.content strong { color: var(--sepia); }
.content blockquote {
  margin: 1em 0; padding: 0.4em 1em;
  border-left: 3px solid rgba(var(--ochre), 0.8);
  background: rgba(var(--ochre), 0.10);
  font-style: italic;
}
.back { margin-top: 40px; font-style: italic; }

.notfound { text-align: center; padding: 40px 0 120px; }

/* ---- the 1936 brochure as a book (js/brochure.js) ---- */
.flipbook[hidden] { display: none; }
.flipbook {
  /* wider than the article column: two pages side by side need the room */
  width: min(1000px, calc(100vw - 32px));
  margin: 20px 0 8px calc(50% - min(500px, 50vw - 16px));
}
#book { margin: 0 auto; }
#book .page { background: #f1e8d4; }
#book .page img {
  display: block; width: 100%; height: 100%;
  object-fit: contain; border-radius: 0; box-shadow: none;
}
#book .page-hard { background: #7c7b77; }
.back-cover {
  height: 100%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px;
  color: #2f2e2b; text-align: center;
  font-family: 'Cormorant Garamond', Georgia, serif; font-size: 1.3rem;
}
.back-cover p { margin: 0; }
/* the same faint corner-to-corner walster.co.uk mark the page images carry
   (sized in container units so it spans the cover at any size) */
#book .page-back { container-type: size; }
.back-cover { position: relative; overflow: hidden; }
.back-cover::after {
  content: "walster.co.uk";
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%) rotate(-54deg);
  white-space: nowrap; pointer-events: none;
  font-family: Georgia, serif; font-weight: 700; font-size: 25cqw;
  color: rgba(70, 55, 40, 0.13);
  text-shadow: 2px 2px 0 rgba(255, 255, 255, 0.12);
}
.back-cover .bc-title { font-size: 2rem; letter-spacing: 0.08em; text-transform: uppercase; }
.back-cover .bc-printer { margin-top: 40px; font-size: 0.9rem; letter-spacing: 0.1em; text-transform: uppercase; }
.book-controls {
  display: flex; align-items: center; justify-content: center; gap: 18px;
  margin-top: 18px;
}
.book-controls button {
  font: inherit; font-size: 1rem; color: var(--sepia); cursor: pointer;
  padding: 6px 18px; border-radius: 999px;
  background: rgba(255, 252, 244, 0.75);
  border: 1px solid rgba(110, 92, 69, 0.35);
}
.book-controls button:hover:not(:disabled) { background: rgba(var(--ochre), 0.25); }
.book-controls button:disabled { opacity: 0.4; cursor: default; }
.book-page { min-width: 9em; text-align: center; font-style: italic; color: var(--sepia); }
.book-hint { text-align: center; font-style: italic; color: var(--muted); font-size: 0.95rem; }
.all-pages { margin-top: 32px; }
.all-pages summary {
  cursor: pointer; color: var(--sepia);
  font-family: 'Cormorant Garamond', Georgia, serif; font-size: 1.5rem; font-weight: 600;
}
.all-pages h3 { font-size: 1.2rem; margin: 1.4em 0 0.4em; }

@media (max-width: 700px) {
  body { font-size: 1.08rem; }
  .site-title, .site-title a { font-size: 2.1rem; }
  .post-head.has-cover { grid-template-columns: 1fr; }
  .post-head h1 { font-size: 2rem; }
  .content { padding: 20px 18px; }
}

/* ---- cowbrook.com: the house as the centrepiece ---- */
.hero { min-height: 0; }
/* the three-name title: one line on a computer, neat wrapping on a phone */
.hero .site-title { font-size: clamp(1.6rem, 2.9vw, 2.1rem); line-height: 1.2; }
.nowrap { white-space: nowrap; }
/* the pale wash behind the title: centred on the words and wide enough to sit
   evenly under all of them, fading softly into the photograph at the edges */
.hero .site-title {
  padding: 30px 64px 34px;
  margin: -16px 0 -16px -64px;
  /* closest-side: the oval reaches nothing exactly at the box edges, so no hard lines */
  background: radial-gradient(closest-side,
    rgba(245, 239, 224, 0.94) 0%, rgba(245, 239, 224, 0.88) 55%,
    rgba(245, 239, 224, 0.55) 78%, rgba(245, 239, 224, 0) 100%);
  border-radius: 0;
}
@media (max-width: 700px) {
  .hero .site-title { padding: 24px 32px 28px; margin-left: -32px; }
}
/* "Glossop" small and italic, on the same line as the names */
.hero .site-title .site-sub { display: inline; margin: 0 0 0 0.35em; font-size: 0.55em; white-space: nowrap; }
.site-sub { display: block; margin-top: 2px; font-size: 1.05rem; font-style: italic; color: var(--sepia); font-family: 'EB Garamond', Georgia, serif; font-weight: 400; letter-spacing: 0; }

.feature {
  display: grid; grid-template-columns: 1.15fr 1fr; gap: 40px; align-items: center;
  margin: 8px 0 56px;
}
.feature figure, .gallery figure { margin: 0; }
.mount {
  /* the photograph mounted like an old print: pale card, soft shadow */
  padding: 14px 14px 10px; background: #fbf7ec;
  border-radius: 4px; box-shadow: 0 10px 28px -14px rgba(58, 52, 43, 0.6), 0 1px 0 rgba(110, 92, 69, 0.15);
}
.mount img { display: block; width: 100%; height: auto; }
figcaption { font-style: italic; color: var(--muted); font-size: 0.95rem; text-align: center; padding-top: 8px; }
.feature h1 { margin: 0 0 12px; font-size: 2.6rem; line-height: 1.1; }
.feature .lede { font-size: 1.2rem; }
.quote { font-style: italic; color: var(--sepia); border-left: 3px solid rgba(var(--ochre), 0.8); padding-left: 14px; margin: 18px 0; }

.section { max-width: 820px; margin: 0 auto 56px; }
.section > h2 { font-size: 2rem; margin: 0 0 16px; }

.timeline { list-style: none; margin: 0; padding: 0; border-left: 2px solid rgba(var(--sage), 0.7); }
.timeline li { position: relative; padding: 0 0 22px 26px; }
.timeline li::before {
  content: ""; position: absolute; left: -7px; top: 9px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--paper); border: 2px solid rgba(var(--sage), 0.95);
}
.timeline .when { display: block; font-family: 'Cormorant Garamond', Georgia, serif; font-size: 1.35rem; font-weight: 600; color: var(--sepia); }
.timeline .family::before { border-color: rgba(var(--rose), 0.95); background: rgba(var(--rose), 0.35); }
.timeline .note { color: var(--muted); font-size: 0.95rem; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); gap: 28px; }

.links { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.links li { padding: 14px 18px; background: rgba(255, 252, 244, 0.55); border-radius: 12px 18px 10px 20px / 18px 10px 16px 12px; }
.links .desc { display: block; color: var(--muted); font-size: 0.95rem; }

footer.wrap { padding: 24px 16px 48px; text-align: center; color: var(--muted); font-size: 0.95rem; font-style: italic; }

@media (max-width: 760px) {
  .feature { grid-template-columns: 1fr; gap: 24px; }
  .feature h1 { font-size: 2.1rem; }
}
