@font-face {
  font-family: "Abuget";
  src: url("fonts/Abuget.ttf") format("truetype");
  font-display: block;
}

:root {
  --ink: #111;
  --ink-soft: #555;
  --rule: #1a1a1a;
  --hairline: #d9d9d9;
  --paper: #fff;
  --gallery-tint: #e9effd;
  --encouraged-tint: #f1e5fa;
  --placeholder: #ececec;

  --gutter: max(48px, 10vw);   /* space either side of the content: 10% of the window */
  --radius: 48px;
  --module-h: 152px;     /* module height on the homepage */
  --banner-h: 110px;     /* module height once it becomes a page banner */
  --stack-gap: 40px;     /* vertical rhythm between blocks */
  --footer-h: 52px;

  --script: "Abuget", "Brush Script MT", cursive;
  --sans: "Jost", Arial, Helvetica, sans-serif;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);   /* soft ease-out used by all motion */
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
}

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

.wrap {
  width: calc(100% - 2 * var(--gutter));
  margin-inline: auto;
}

/* ---------- Header ---------- */

.site-header {
  text-align: center;
  padding-top: 36px;
}

.logo {
  display: inline-block;
  font-family: var(--script);
  font-weight: normal;
  font-size: clamp(64px, 12vw, 128px);
  line-height: 1.15;
  margin: 0;
  text-decoration: none;
  color: var(--ink);
  transition: transform 0.5s ease;
}

.logo:hover {
  transform: scale(1.02);
}

.tagline {
  margin: 14px 0 0;
  font-size: clamp(13px, 2.4vw, 20px);
  font-weight: 400;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  /* offset trailing letter-spacing so the line stays optically centred */
  margin-right: -0.24em;
}

main { padding-top: var(--stack-gap); }

/* ---------- Menu (hamburger, top left) ---------- */

.menu-toggle {
  position: fixed;
  top: var(--menu-top, 24px);
  left: var(--menu-top, 24px);
  z-index: 46;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  transition: background 0.3s ease, box-shadow 0.4s ease;
}
.menu-toggle:hover { background: #f6f6f6; }
.menu-toggle:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.is-menu-open .menu-toggle { box-shadow: none; }

/* Three bars that fold into an X when the menu is open. */
.menu-toggle__bars,
.menu-toggle__bars::before,
.menu-toggle__bars::after {
  display: block;
  width: 20px;
  height: 1.5px;
  border-radius: 1px;
  background: currentColor;
}
.menu-toggle__bars { position: relative; transition: background-color 0.2s ease; }
.menu-toggle__bars::before,
.menu-toggle__bars::after {
  content: "";
  position: absolute;
  left: 0;
  transition: transform 0.5s var(--ease);
}
.menu-toggle__bars::before { transform: translateY(-6px); }
.menu-toggle__bars::after { transform: translateY(6px); }
.is-menu-open .menu-toggle__bars { background-color: transparent; }
.is-menu-open .menu-toggle__bars::before { transform: rotate(45deg); }
.is-menu-open .menu-toggle__bars::after { transform: rotate(-45deg); }

.menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 44;
  background: rgba(17, 17, 17, 0.16);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease, visibility 0s linear 0.5s;
}
.is-menu-open .menu-backdrop { opacity: 1; visibility: visible; transition: opacity 0.5s ease, visibility 0s; }

.menu {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 45;
  width: min(340px, 85vw);
  padding: 104px 40px 40px;
  overflow-y: auto;
  background: var(--paper);
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.08);
  transform: translateX(-100%);
  visibility: hidden;
  transition: transform 0.6s var(--ease), visibility 0s linear 0.6s;
}
.is-menu-open .menu { transform: none; visibility: visible; transition: transform 0.6s var(--ease), visibility 0s; }

.menu ul { list-style: none; margin: 0; padding: 0; }
.menu a { text-decoration: none; transition: opacity 0.3s ease; }
.menu a:hover { opacity: 0.55; }
.menu a:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }

.menu__pages a {
  display: inline-block;
  padding: 4px 0;
  font-family: var(--script);
  font-size: 38px;
  line-height: 1.25;
}
.menu__pages a[aria-current="page"] {
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.2em;
}

.menu .menu__sections {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--hairline);
}
.menu__sections a {
  display: inline-block;
  padding: 6px 0;
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

/* Links drift in one after another as the panel opens. */
.menu li {
  opacity: 0;
  transform: translateX(-12px);
  transition: opacity 0.4s ease, transform 0.5s var(--ease);
}
.is-menu-open .menu li {
  opacity: 1;
  transform: none;
  transition: opacity 0.6s ease, transform 0.7s var(--ease);
  transition-delay: calc(0.12s + var(--i, 0) * 0.05s);
}
.menu__pages li:nth-child(2) { --i: 1; }
.menu__pages li:nth-child(3) { --i: 2; }
.menu__sections li:nth-child(1) { --i: 3; }
.menu__sections li:nth-child(2) { --i: 4; }

/* ---------- Modules (homepage cards / page banners) ---------- */

.module {
  position: relative;
  display: grid;
  place-items: center;
  height: var(--module-h);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: var(--ink);
  isolation: isolate;
}

/* Homepage: the two modules sit side by side (stacked on small screens). */
.modules {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--stack-gap);
}

.module::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--art) var(--art-pos, center) / cover no-repeat;
  /* The painting only adds shading: greyed, softened, lightened and multiplied onto the tint,
     so the module keeps its own colour. --art-b evens out darker paintings. */
  filter: grayscale(1) contrast(0.7) brightness(var(--art-b, 1.6));
  mix-blend-mode: multiply;
  /* --art-o / --art-s let the flying copy start from the hover state (see script.js) */
  opacity: var(--art-o, 0.35);
  transform: scale(var(--art-s, 1));
  transition: opacity 0.6s ease, transform 0.9s var(--ease);
}

.module--gallery {
  background: var(--gallery-tint);
  --art: url("images/paintings/large/01_10_orangeflowers.jpg");
  --art-pos: 50% 22%;   /* the tulip heads */
}
.module--encouraged {
  background: var(--encouraged-tint);
  --art: url("images/paintings/large/01_09_flowers.jpg");
  --art-pos: 50% 55%;   /* the yellow flowers against the fields */
  --art-b: 2.1;         /* a darker painting than the tulips */
}

.module__label {
  margin: 0;
  font-weight: normal;
  font-family: var(--script);
  font-size: clamp(38px, 7vw, 54px);
  line-height: 1;
  padding: 0.2em 0.3em;
  transition: transform 0.6s var(--ease);
}

a.module:hover::before,
a.module:focus-visible::before { opacity: 0.5; transform: scale(1.03); }
a.module:hover .module__label,
a.module:focus-visible .module__label { transform: scale(1.05); }
a.module:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }
h1.module__label:focus { outline: none; }

.module--banner { height: var(--banner-h); }
.module--banner .module__label { font-size: clamp(34px, 6vw, 46px); }

/* ---------- Section headings with a rule (dates, announcements) ---------- */

.section { margin-top: calc(var(--stack-gap) * 1.5); }

.rule-heading {
  margin: 0 0 24px;
  padding-bottom: 6px;
  border-bottom: 1.5px solid var(--rule);
  font-size: 24px;
  font-weight: 400;
  line-height: 1.3;
}

.rule-heading--script {
  font-family: var(--script);
  font-size: 40px;
  line-height: 1.1;
}

/* ---------- Announcements ---------- */

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

.event {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 20px;
  padding: 20px 0;
  border-bottom: 1px solid var(--hairline);
}
.event:first-child { padding-top: 0; }
.event:last-child { border-bottom: 0; }

.event__date {
  display: grid;
  place-content: center;
  text-align: center;
  height: 72px;
  border-radius: 18px;
  background: var(--encouraged-tint);
  line-height: 1;
}
.event:nth-child(odd) .event__date { background: var(--gallery-tint); }
.event__month { font-size: 13px; letter-spacing: 0.16em; text-transform: uppercase; }
.event__day { font-size: 28px; margin-top: 4px; }

.event__title { margin: 0; font-size: 19px; font-weight: 500; line-height: 1.35; }
.event__meta { margin: 2px 0 6px; font-size: 14px; color: var(--ink-soft); letter-spacing: 0.02em; }
.event__desc { margin: 0; }

.note {
  margin: 20px 0 0;
  padding: 16px 20px;
  border-radius: 18px;
  background: #f7f7f7;
  font-size: 15px;
}

/* ---------- Contact ---------- */

.contact {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin: 0;
}
.contact dt { font-size: 13px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-soft); }
.contact dd { margin: 4px 0 0; overflow-wrap: anywhere; }
.contact a { text-decoration: none; border-bottom: 1px solid var(--hairline); transition: border-color 0.3s ease; }
.contact a:hover { border-color: var(--ink); }

/* ---------- Gallery ---------- */

/* Groups sit side by side: 3 across on wide screens, 2 on medium, 1 on phones. */
.gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: var(--stack-gap);
}

/* Each group: one large painting beside two stacked smaller ones.
   Groups alternate which side the large painting sits on. */
.gallery__group {
  display: grid;
  grid-template-columns: 1fr 2fr;
  grid-template-rows: 1fr 1fr;
  gap: 24px;
  aspect-ratio: 3 / 2.6;
}
.gallery__group > :nth-child(1) { grid-column: 2; grid-row: 1 / span 2; }
.gallery__group:nth-child(even) { grid-template-columns: 2fr 1fr; }
.gallery__group:nth-child(even) > :nth-child(1) { grid-column: 1; }
/* A group holding a single painting shows it across the whole group. */
.gallery__group > :only-child { grid-column: 1 / -1; grid-row: 1 / -1; }

.painting {
  position: relative;
  margin: 0;
  overflow: hidden;
  background: var(--placeholder);
  cursor: zoom-in;
  border: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  text-align: left;
}
.painting img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.8s var(--ease);
}
.painting:hover img { transform: scale(1.03); }
/* Keep the subject in view where a wide painting is cropped into a tall frame. */
.painting img[src*="01_07_bird"] { object-position: 40% 50%; }
.painting:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }

.painting__caption {
  position: absolute;
  inset: auto 0 0 0;
  padding: 28px 14px 10px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.55));
  color: #fff;
  font-size: 14px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.4s ease, transform 0.4s var(--ease);
}
.painting:hover .painting__caption,
.painting:focus-visible .painting__caption { opacity: 1; transform: none; }

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 32px var(--gutter) calc(var(--footer-h) + 16px);
  background: rgba(255, 255, 255, 0.96);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0s linear 0.4s;
}
.lightbox.is-open { opacity: 1; visibility: visible; transition: opacity 0.4s ease, visibility 0s; }
.lightbox figure {
  margin: 0;
  text-align: center;
  transform: translateY(14px) scale(0.98);
  transition: transform 0.6s var(--ease);
}
.lightbox.is-open figure { transform: none; }
.lightbox img {
  max-height: calc(100vh - 180px);
  max-height: calc(100dvh - 180px);
  width: auto;
  margin-inline: auto;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
}
.lightbox figcaption { margin-top: 14px; font-size: 16px; }
.lightbox__close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: #f1f1f1;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease;
}
.lightbox__close:hover { background: #e4e4e4; }

/* ---------- Get Encouraged (videos) ---------- */

/* Videos: 3 across on wide screens, 2 on medium, 1 on phones. */
.videos {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--stack-gap) 32px;
  margin-top: var(--stack-gap);
}
.entry .rule-heading { margin-bottom: 20px; }
.entry__summary { margin: 0 0 16px; }

.video {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #c6c6c6;
  overflow: hidden;
}
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video__placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  color: #333;
  font-size: 18px;
}
.video__play {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  display: grid;
  place-items: center;
}
.video__play::after {
  content: "";
  margin-left: 6px;
  border-style: solid;
  border-width: 14px 0 14px 22px;
  border-color: transparent transparent transparent #333;
}

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

.site-footer {
  height: var(--footer-h);
  display: grid;
  place-items: center;
  background: var(--paper);
  font-size: 13px;
  color: var(--ink-soft);
}

/* ---------- Motion ---------- */

@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
}
@keyframes fade {
  from { opacity: 0; }
}

/* Page load: everything waits (hidden) until the script marks the page ready,
   so the logo font is in place before the fade-up starts. */
.js:not(.is-ready) .site-header,
.js:not(.is-ready) main,
.js:not(.is-ready) .site-footer,
.js:not(.is-ready) .menu-toggle { opacity: 0; }

.is-ready .site-header { animation: rise 0.9s var(--ease) backwards; }
.is-ready .menu-toggle { animation: fade 0.9s ease 0.3s backwards; }

/* Each block in a view fades up in turn whenever the view is shown. */
.view.is-entering > * {
  animation: rise 0.8s var(--ease) backwards;
  animation-delay: calc(var(--enter-delay, 0s) + var(--stagger, 0s));
}
.view.is-first { --enter-delay: 0.15s; }
.view > :nth-child(2) { --stagger: 0.08s; }
.view > :nth-child(3) { --stagger: 0.16s; }
.view > :nth-child(4) { --stagger: 0.24s; }
.view > :nth-child(n + 5) { --stagger: 0.32s; }

/* The footer rises in together with the view's content, not as a separate stagger step. */
main:has(.view.is-entering) ~ .site-footer {
  animation: rise 0.8s var(--ease) backwards;
}
main:has(.view.is-entering.is-first) ~ .site-footer {
  animation-delay: 0.15s;
}
/* A module or banner that just flew into place doesn't fade in again; its neighbours do. */
.view.from-flight > .module--banner,
.view.from-flight > .modules { animation: none; }
.view.from-flight .modules > .module:not(.is-landed) {
  animation: rise 0.8s var(--ease) 0.08s backwards;
}

/* Homepage content fading away while a module flies to the top. */
.view.is-leaving > * { opacity: 0; transition: opacity 0.35s ease; }
main:has(.view.is-leaving) ~ .site-footer { opacity: 0; transition: opacity 0.35s ease; }

/* Copy of the clicked module that shrinks and rises into the banner position. */
.module--flying {
  position: absolute;
  z-index: 30;
  margin: 0;
  pointer-events: none;
}

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

/* ---------- Password gate ---------- */

.gate { display: none; }

.is-locked body > :not(.gate) { display: none !important; }

.is-locked .gate {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100svh;
  padding: 24px var(--gutter);
  text-align: center;
  animation: rise 0.9s var(--ease) backwards;
}

.gate__logo {
  margin: 0;
  font-family: var(--script);
  font-size: clamp(64px, 12vw, 128px);
  line-height: 1.15;
}

.gate__label {
  margin-top: 56px;
  color: var(--ink-soft);
  font-size: 15px;
}

.gate__row {
  display: flex;
  gap: 12px;
  width: min(100%, 420px);
  margin-top: 14px;
}

.gate__input,
.gate__button {
  font: inherit;
  height: 48px;
  border-radius: 24px;
}

.gate__input {
  flex: 1;
  min-width: 0;
  padding: 0 20px;
  border: 1px solid var(--hairline);
  background: var(--paper);
  color: var(--ink);
  transition: border-color 0.2s ease;
}

.gate__input:focus {
  outline: none;
  border-color: var(--ink);
}

.gate__button {
  padding: 0 26px;
  border: 0;
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
  transition: transform 0.3s var(--ease);
}

.gate__button:hover { transform: scale(1.04); }

.gate__error {
  min-height: 1.6em;
  margin: 12px 0 0;
  color: #b3261e;
  font-size: 15px;
}

.gate.is-wrong .gate__input {
  border-color: #b3261e;
  animation: shake 0.4s ease;
}

@keyframes shake {
  25% { transform: translateX(-6px); }
  50% { transform: translateX(6px); }
  75% { transform: translateX(-3px); }
}

/* ---------- Medium screens ---------- */

@media (max-width: 1200px) {
  .gallery,
  .videos { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Small screens: same layout, less dead space ---------- */

@media (max-width: 600px) {
  :root {
    --radius: 32px;
    --gutter: 16px;
    --module-h: 100px;
    --menu-top: 12px;
    --banner-h: 88px;
    --stack-gap: 28px;
  }
  .site-header { padding-top: 24px; }
  .modules { grid-template-columns: 1fr; }
  .gallery,
  .videos { grid-template-columns: 1fr; }
  .gallery,
  .gallery__group { gap: 12px; }
  .contact { grid-template-columns: 1fr; gap: 16px; }
  .event { grid-template-columns: 60px 1fr; gap: 16px; }
  .event__date { height: 60px; border-radius: 14px; }
  .event__day { font-size: 24px; }
}
