/* Being Freya — modelled on the WordPress Twenty Twenty-Two theme the blog used */
:root {
  --fg: #000;
  --bg: #fff;
  --muted: #5e5e5e;
  --tertiary: #f6f6f6;
  --serif: 'Source Serif 4', 'Source Serif Pro', Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
  --content: 650px;
  --wide: 1000px;
  --gutter: clamp(1.25rem, 5vw, 2.5rem);
  --gap: 0.5em;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 1.125rem/1.6 var(--sans);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
a { color: inherit; text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-style: dashed; }
img, video { max-width: 100%; height: auto; display: block; }

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

/* Header & footer */
.site-header {
  background: var(--fg);
  color: var(--bg);
  padding: 1.25rem var(--gutter);
}
.site-title {
  font: 400 1.125rem/1 var(--sans);
  text-decoration: none;
  letter-spacing: 0.01em;
}
.site-title:hover { text-decoration: underline; }
.site-footer { padding: 6rem var(--gutter) 2rem; font-size: 0.95rem; }
.site-footer .site-title { font-weight: 600; }

/* Main column */
.site-main {
  flex: 1;
  width: 100%;
  padding: clamp(3rem, 8vw, 8rem) var(--gutter) 0;
  transition: opacity 0.2s;
}
.site-main.loading { opacity: 0.35; }
.entry { max-width: var(--content); margin: 0 auto; }
.spacer { height: 100px; }

.entry-title {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(2.625rem, 1.5rem + 3.6vw, 3.25rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 2rem;
}
.single .entry-title { font-size: clamp(3rem, 1.5rem + 5vw, 4.5rem); margin-bottom: 1rem; }
.entry-title a { text-decoration: none; }
.entry-title a:hover { text-decoration: underline; text-decoration-thickness: 1px; }
.entry-date { display: block; font-size: 0.95rem; color: var(--muted); }
.single .entry-date { margin-bottom: 2.5rem; }

.entry-content > * { margin: 0 0 1.25em; }
.entry-content p:empty { display: none; }

/* Images */
.wp-block-image { margin-left: 0; margin-right: 0; }
.wp-block-image figcaption,
.wp-block-video figcaption {
  font-size: 0.875rem;
  color: var(--muted);
  text-align: center;
  margin-top: 0.5em;
}

/* Galleries — WordPress "columns-default is-cropped": 3 across, 2 for pairs */
.wp-block-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap);
  margin-left: 0;
  margin-right: 0;
}
@media (min-width: 900px) {
  .entry-content > .wp-block-gallery {
    margin-left: calc((var(--content) - min(var(--wide), 100vw - 2 * var(--gutter))) / 2);
    margin-right: calc((var(--content) - min(var(--wide), 100vw - 2 * var(--gutter))) / 2);
  }
}
.wp-block-gallery > .wp-block-image {
  position: relative;
  margin: 0;
  flex-grow: 1;
  width: calc(50% - var(--gap) / 2);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
@media (min-width: 600px) {
  .wp-block-gallery > .wp-block-image { width: calc(33.333% - var(--gap) * 2 / 3); }
  .wp-block-gallery > .wp-block-image:first-child:nth-last-child(2),
  .wp-block-gallery > .wp-block-image:first-child:nth-last-child(2) ~ .wp-block-image {
    width: calc(50% - var(--gap) / 2);
  }
}
.wp-block-gallery > .wp-block-image:only-child { width: 100%; }
.wp-block-gallery.is-cropped > .wp-block-image { align-self: stretch; }
.wp-block-gallery.is-cropped > .wp-block-image img { flex: 1 0 0%; width: 100%; height: 100%; object-fit: cover; }
.wp-block-gallery > .wp-block-image figcaption {
  position: absolute;
  inset: auto 0 0;
  margin: 0;
  padding: 3em 0.75em 0.6em;
  color: #fff;
  font-size: 0.8125rem;
  text-align: center;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.25) 60%, transparent);
  max-height: 100%;
  overflow: auto;
}

/* Video */
.wp-block-video video { width: 100%; background: #000; }
.wp-block-video.aligncenter video { margin: 0 auto; }

/* Previous / next */
.post-nav {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  margin-top: 6rem;
  padding-top: 2rem;
  border-top: 1px solid #e0e0e0;
}
.post-nav a { text-decoration: none; font-family: var(--serif); font-size: 1.35rem; line-height: 1.3; max-width: 45%; }
.post-nav a span { display: block; font: 0.85rem var(--sans); color: var(--muted); margin-bottom: 0.35rem; text-transform: uppercase; letter-spacing: 0.08em; }
.post-nav a:hover { text-decoration: underline; }
.post-nav .next { text-align: right; margin-left: auto; }

/* Password gate */
.login { max-width: 460px; margin: 0 auto; }
.login-lead { font-family: var(--serif); font-weight: 300; font-size: clamp(1.75rem, 1.2rem + 2vw, 2.25rem); line-height: 1.25; margin: 0 0 2.5rem; }
.login-form label { display: block; font-size: 0.95rem; margin-bottom: 0.5rem; }
.login-row { display: flex; gap: 0.5rem; }
.login-row input {
  flex: 1;
  min-width: 0;
  font: inherit;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--fg);
  border-radius: 0;
  background: var(--bg);
}
.login-row input:focus { outline: 2px solid var(--fg); outline-offset: 1px; }
.login-row button {
  font: inherit;
  padding: 0.7rem 1.4rem;
  background: var(--fg);
  color: var(--bg);
  border: 1px solid var(--fg);
  cursor: pointer;
}
.login-row button:hover { background: var(--bg); color: var(--fg); }
.login-row button:disabled { opacity: 0.5; cursor: wait; }
.login-error { min-height: 1.6em; margin: 0.75rem 0 0; color: #b00020; font-size: 0.95rem; }
