/*
 * Layout and structure only. Matching the old design exactly (the Spectral and
 * Source Sans 3 fonts, the size tokens and line-heights) is Phase 4 of the
 * migration runbook. The colours below are already the measured values.
 */

:root {
  --color-base: #ffffff;
  --color-contrast: #232323;
  --color-accent: #7a00df;
  --font-body: Georgia, 'Times New Roman', serif;
  --font-ui: system-ui, -apple-system, 'Segoe UI', sans-serif;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --content-width: 40rem;
  --wide-width: 72rem;
}

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

body {
  margin: 0;
  background: var(--color-base);
  color: var(--color-contrast);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
}

a {
  color: inherit;
}

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

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

.skip-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  z-index: 10;
  padding: 0.5rem 1rem;
  background: var(--color-base);
  color: var(--color-contrast);
  font-family: var(--font-ui);
}

.skip-link:focus {
  top: 1rem;
}

/* Site title and navigation, used in the cover and in the footer. */

.site-title {
  margin: 0;
  font-family: var(--font-ui);
  font-weight: 600;
  line-height: 1;
}

.site-title a,
nav a {
  text-decoration: none;
}

.site-title a:hover,
nav a:hover {
  text-decoration: underline;
}

nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-family: var(--font-ui);
  font-size: 0.9rem;
  line-height: 1.590909091;
}

/* Cover: the featured image across the top of every page. */

.cover {
  position: relative;
  display: flex;
  overflow: hidden;
  color: var(--color-base);
}

.cover-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cover-fade {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgb(0, 0, 0) 0%, rgba(0, 0, 0, 0) 45%, rgba(0, 0, 0, 0) 55%, rgb(0, 0, 0) 100%);
}

.cover-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 100%;
  min-height: 60vh;
}

.top-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  width: 100%;
  max-width: var(--wide-width);
  margin: 0 auto;
  padding: 1.5rem var(--gutter);
}

.cover-heading {
  width: 100%;
  max-width: var(--wide-width);
  margin: 0 auto;
  padding: 1.5rem var(--gutter) 2.5rem;
}

.home-title {
  margin: 0;
  font-family: var(--font-ui);
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 600;
  line-height: 1;
}

.home-tagline {
  margin: 0.75rem 0 0;
}

.entry-date {
  margin: 0 0 0.5rem;
  font-family: var(--font-ui);
  font-size: 0.9rem;
  line-height: 1.590909091;
}

.entry-title {
  max-width: 50rem;
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 400;
  /* The old post and About headers set this inline, overriding the theme's 1.163873371. */
  line-height: 1.056603774;
}

/* A post or page. */

.entry-content {
  max-width: var(--content-width);
  margin: 3rem auto 0;
  padding: 0 var(--gutter);
  font-size: 1.125rem;
}

.entry-content h2 {
  margin: 2.5rem 0 1rem;
  font-weight: 500;
  line-height: 1.2;
}

.entry-content blockquote {
  margin: 1.5rem 0;
  padding-left: 1.25rem;
  border-left: 2px solid currentColor;
}

/*
 * The About page's questions. These were an accordion plugin on WordPress; here they
 * are native <details>, styled to docs/01-blog.md Part B §4 in the ranthink repository.
 */

.entry-content details {
  margin: 0 0 15px;
  border: 1px solid #bcb6b638;
}

.entry-content summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: transparent;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.entry-content summary::-webkit-details-marker {
  display: none;
}

.entry-content summary:focus-visible {
  outline: 2px solid #c2dbfe;
}

/* The plus sign, 23px, white on #505050; it becomes a minus when open. */
.entry-content summary::after {
  content: '';
  flex: none;
  width: 23px;
  height: 23px;
  background:
    linear-gradient(#fff, #fff) center / 13px 2px no-repeat,
    linear-gradient(#fff, #fff) center / 2px 13px no-repeat,
    #505050;
}

.entry-content details[open] > summary::after {
  background:
    linear-gradient(#fff, #fff) center / 13px 2px no-repeat,
    #505050;
}

.entry-content details > :not(summary) {
  margin: 0;
  padding: 0 1rem 1rem;
}

.entry-content details > :not(summary) + :not(summary) {
  padding-top: 0;
}

.entry-footer {
  margin-top: 3rem;
  padding: 1.5rem 0;
  border-top: 1px solid currentColor;
}

.entry-footer p {
  margin: 0;
}

.entry-footer-label {
  font-family: var(--font-ui);
  font-size: 0.9rem;
}

/* Homepage: the introduction beside the list of posts. */

.home {
  display: grid;
  gap: 3rem;
  max-width: var(--wide-width);
  margin: 3rem auto 0;
  padding: 0 var(--gutter);
}

@media (min-width: 48rem) {
  .home {
    grid-template-columns: 1fr 2fr;
    align-items: start;
  }

  .home-intro {
    position: sticky;
    top: 1.5rem;
  }
}

.home-intro h2 {
  margin-top: 0;
  font-weight: 500;
}

.home-intro blockquote {
  margin: 1.5rem 0 0;
  padding-left: 1.25rem;
  border-left: 2px solid currentColor;
}

.home-intro blockquote p {
  margin: 0;
}

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

.post-list li + li {
  margin-top: 3rem;
}

.post-list-image img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.post-list h3 {
  margin: 1rem 0 0.25rem;
  font-size: 1.5rem;
  font-weight: 500;
  /* The theme's post-title line-height, which the homepage list does not override. */
  line-height: 1.163873371;
}

.post-list h3 a {
  text-decoration: none;
}

.post-list h3 a:hover {
  text-decoration: underline;
}

.post-list-date {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 0.9rem;
  line-height: 1.590909091;
}

/* Footer. */

.site-footer {
  margin-top: 4rem;
  background-color: var(--color-contrast);
  background-position: 51% 37%;
  background-size: cover;
  color: var(--color-base);
}

.site-footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  max-width: var(--wide-width);
  margin: 0 auto;
  padding: 2rem var(--gutter);
}
