/* Feverfew Garden Design
   Layout: logo and menu in a column on the left, page content on the right.
   On narrow screens the column moves to the top and the menu folds away. */

/* ---------- Fonts (self-hosted, see README for licence) ---------- */

@font-face {
  font-family: "Allerta";
  src: url("/fonts/allerta-latin.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Basic";
  src: url("/fonts/basic-latin.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* ---------- Settings ---------- */

:root {
  --text: #4a4a4a;
  --heading: #444;
  --muted: #9b9b9b;
  --rule: #c8c8c8;
  --link: #0085bd;
  --hover: #858585;

  --sidebar-width: 270px;
  --page-padding: 30px;
  --grid-gap: 34px;

  --font-body: Arial, Helvetica, sans-serif;
  --font-heading: "Allerta", "Trebuchet MS", sans-serif;
  --font-nav: "Basic", "Trebuchet MS", sans-serif;
}

/* ---------- Base ---------- */

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

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

body {
  margin: 0;
  background: #fff;
  color: var(--text);
  font: 14px/1.5 var(--font-body);
}

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

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  color: var(--hover);
}

:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}

h1 {
  margin: 70px 0 26px;
  color: var(--heading);
  font: 400 26px/1.2 var(--font-heading);
}

p {
  margin: 0 0 1em;
}

hr {
  margin: 48px 0;
  border: 0;
  border-top: 1px solid var(--rule);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---------- Page frame ---------- */

.canvas {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  max-width: 1600px;
  padding: var(--page-padding);
}

.logo {
  display: block;
  width: 220px;
}

.footer {
  padding: 26px var(--page-padding) 40px;
}

/* ---------- Menu ---------- */

.site-nav {
  margin-top: 32px;
  font-family: var(--font-nav);
  font-size: 16px;
}

.nav-group {
  margin: 0 0 22px;
  padding: 0;
  list-style: none;
}

.nav-group a {
  display: inline-block;
  padding: 0.2em 0.2em;
  color: #555;
  line-height: 1.4;
}

/* The second group (About me … Contact) is set a little darker and wider apart. */
.nav-group:not(.nav-group--gardens) a {
  color: #333;
  line-height: 1.8;
}

.nav-group a:hover,
.nav-group a[aria-current="page"] {
  color: var(--muted);
}

.menu-toggle {
  display: none;
}

/* ---------- Text pages ---------- */

.prose {
  text-align: justify;
}

.prose > :first-child {
  margin-top: 0;
}

.page .prose > h1:first-child,
.page > h1:first-child,
.content > h1:first-child,
.page-title {
  margin-top: 70px;
}

.page-title--centred {
  text-align: center;
}

/* About me: text in two thirds of the width, portrait in the last third,
   lined up with the three-column garden grid. */
.page--with-aside {
  display: grid;
  /* Text spans two columns (and the gap between them) of a three-column grid. */
  grid-template-columns:
    minmax(0, calc((100% - 2 * var(--grid-gap)) * 2 / 3 + var(--grid-gap)))
    minmax(0, 1fr);
  column-gap: var(--grid-gap);
  align-items: start;
}

.page-aside {
  width: 100%;
  margin-top: 126px;
}

.testimonials {
  margin-top: 60px;
  max-width: 900px;
}

.testimonials p {
  margin-bottom: 1em;
}

.testimonials p:has(strong) {
  margin-bottom: 4.5em;
}

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

.link-list li {
  display: grid;
  grid-template-columns: minmax(0, 300px) minmax(0, 1fr);
  column-gap: var(--grid-gap);
  margin-bottom: 1em;
}

.contact-details {
  font-style: normal;
}

.contact-details a {
  color: inherit;
}

.contact-details a:hover {
  color: var(--hover);
}

.contact-name {
  letter-spacing: 0.35em;
}

/* ---------- Garden index grids ---------- */

.garden-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--grid-gap);
  margin: 0;
  padding: 0;
  list-style: none;
}

/* A category can ask for two wider columns instead of three
   ("columns": 2 in src/_data/site.json) — used for Historical Buildings. */
.garden-grid--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.garden-grid a {
  display: block;
  color: inherit;
}

.garden-grid img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  transition: opacity 0.2s ease;
}

.garden-grid a:hover img {
  opacity: 0.85;
}

.garden-caption {
  display: block;
  margin: 18px 0 14px;
  font-size: 12px;
}

/* ---------- Slideshows ----------
   Without JavaScript a garden's photos are simply stacked down the page and
   the home page shows its first photo. js/site.js adds .is-enhanced and turns
   them into slideshows. */

.gallery {
  margin-top: 30px;
}

.gallery--auto {
  margin-top: 90px;
}

.gallery-stage {
  position: relative;
}

.gallery-slide {
  width: 100%;
}

.gallery:not(.is-enhanced) .gallery-slide + .gallery-slide {
  margin-top: 20px;
}

.gallery--auto:not(.is-enhanced) .gallery-slide + .gallery-slide {
  display: none;
}

/* When JavaScript is running, hide every photo but the first straight away
   (before the slideshow script has loaded), so the later photos are only
   downloaded when they are about to be shown. */
.js .gallery .gallery-slide + .gallery-slide {
  display: none;
}

.gallery.is-enhanced .gallery-stage {
  aspect-ratio: 4 / 3;
  max-height: 72vh;
  overflow: hidden;
}

/* The home page slideshow always uses the full width. */
.gallery--auto.is-enhanced .gallery-stage {
  max-height: none;
}

.gallery.is-enhanced .gallery-slide {
  position: absolute;
  inset: 0;
  display: none;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.gallery.is-enhanced .gallery-slide.is-leaving {
  display: block;
}

.gallery.is-enhanced .gallery-slide.is-active {
  z-index: 1;
  display: block;
}

/* .is-animated is added the first time the photo changes, so the opening
   photo appears at once and only later ones fade in. */
.gallery.is-animated .gallery-slide.is-active {
  animation: gallery-fade 0.7s ease;
}

.gallery--auto.is-enhanced .gallery-slide {
  object-fit: cover;
}

@keyframes gallery-fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.gallery-arrow {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 48px;
  height: 64px;
  margin-top: -32px;
  padding: 0;
  border: 0;
  background: none;
  color: #fff;
  cursor: pointer;
  filter: drop-shadow(0 0 3px rgb(0 0 0 / 0.55));
  opacity: 0.85;
}

.gallery-arrow:hover {
  opacity: 1;
}

.gallery-prev {
  left: 0;
}

.gallery-next {
  right: 0;
}

.gallery-arrow svg {
  width: 30px;
  height: 30px;
  margin: 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.gallery-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
}

.gallery-thumbs[hidden],
.gallery-arrow[hidden] {
  display: none;
}

.gallery-thumbs button {
  display: block;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.2s ease;
}

.gallery-thumbs button:hover,
.gallery-thumbs button[aria-current="true"] {
  opacity: 1;
}

.gallery-thumbs img {
  width: auto;
  height: 70px;
}

/* ---------- Narrower screens ---------- */

@media (max-width: 1000px) {
  :root {
    --sidebar-width: 230px;
    --grid-gap: 24px;
  }

  .logo {
    width: 190px;
  }
}

@media (max-width: 760px) {
  :root {
    --page-padding: 20px;
    --grid-gap: 16px;
  }

  .canvas {
    display: block;
  }

  .sidebar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }

  .logo {
    width: 180px;
  }

  .menu-toggle {
    padding: 8px 14px;
    border: 1px solid var(--rule);
    border-radius: 4px;
    background: #fff;
    color: #333;
    font: 16px var(--font-nav);
    cursor: pointer;
  }

  /* The Menu button only appears when JavaScript is running; otherwise the
     menu is always shown. */
  .js .menu-toggle {
    display: block;
  }

  .site-nav {
    flex-basis: 100%;
    margin-top: 8px;
  }

  .js .site-nav {
    display: none;
  }

  .js .site-nav.is-open {
    display: block;
  }

  .nav-group {
    margin-bottom: 12px;
  }

  .nav-group a {
    padding: 0.35em 0.2em;
  }

  .prose {
    text-align: left;
  }

  h1,
  .page .prose > h1:first-child,
  .page > h1:first-child,
  .content > h1:first-child,
  .page-title {
    margin-top: 28px;
  }

  .content {
    margin-top: 24px;
  }

  .gallery--auto {
    margin-top: 0;
  }

  .garden-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .garden-caption {
    margin: 10px 0 8px;
  }

  .page--with-aside {
    display: block;
  }

  .page-aside {
    max-width: 280px;
    margin-top: 32px;
  }

  .testimonials {
    margin-top: 0;
  }

  .link-list li {
    display: block;
  }

  .link-address {
    display: block;
    font-size: 12px;
  }

  .gallery-thumbs img {
    height: 56px;
  }

  .gallery.is-enhanced .gallery-stage {
    max-height: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gallery.is-animated .gallery-slide.is-active {
    animation: none;
  }
}
