/*
 * The journal shares the photo portfolio's look: same colour tokens, type, header and page width.
 * Keep the :root and dark-mode blocks in step with client/src/styles.css.
 */

:root {
  color-scheme: light dark;
  --bg: #f6f4f0;
  --surface: #ffffff;
  --text: #1c1b19;
  --muted: #6b675f;
  --border: #e3dfd7;
  --accent: #a84b22;
  --radius: 8px;
  --gutter: 24px;
  /* Content width of every page; the same in the portfolio so the two sites line up. */
  --page-width: 1000px;
  /* Text column inside it. */
  --measure: 680px;
  --font-sans: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --font-serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121211;
    --surface: #1c1b1a;
    --text: #ecebe8;
    --muted: #9c978e;
    --border: #2e2c2a;
    --accent: #e3956a;
  }
}

@media (max-width: 600px) {
  :root {
    --gutter: 16px;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  /* Always reserve the scrollbar's space, so short and long pages (and the portfolio) line up. */
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.65 var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

h1,
h2,
h3 {
  font-family: var(--font-serif);
  font-weight: 500;
  line-height: 1.2;
  margin: 0;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.1rem, 1.5rem + 2.5vw, 3.25rem);
  letter-spacing: -0.01em;
}

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

.container {
  width: 100%;
  max-width: calc(var(--page-width) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.muted {
  color: var(--muted);
}

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

.skip-link {
  position: absolute;
  left: 8px;
  top: -48px;
  z-index: 10;
  padding: 8px 12px;
  border-radius: var(--radius);
  background: var(--text);
  color: var(--bg);
}

.skip-link:focus {
  top: 8px;
}

/* ---- Header & footer ---------------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px);
  /* The portfolio's line height, not this page's 1.65, so the two headers match to the pixel. */
  line-height: 1.6;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
}

.brand {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  text-decoration: none;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.main-nav a {
  padding: 6px 12px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.95rem;
  text-decoration: none;
}

.main-nav a:hover,
.main-nav a[aria-current='page'] {
  color: var(--text);
}

.main-nav a[aria-current='page'] {
  background: var(--border);
}

.header-search input {
  width: 9rem;
  margin-left: 8px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
}

@media (max-width: 560px) {
  .header-search {
    display: none;
  }
}

main {
  flex: 1;
  padding-bottom: 72px;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-block: 24px 32px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.875rem;
}

.site-footer a {
  color: var(--muted);
}

/* ---- Front page --------------------------------------------------------------------------- */

.hero {
  max-width: var(--measure);
  padding-block: clamp(40px, 7vw, 80px) 32px;
}

/* Banner intro. Identical to the portfolio's .lede (client/src/styles.css). */
.lede {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1.15rem;
  line-height: 1.65;
  text-wrap: pretty;
}

/* The front page's intro is rich text, i.e. paragraphs inside .lede. */
.lede p {
  margin: 0;
}

.lede p + p {
  margin-top: 0.6em;
}

.filter-note {
  margin: 0 0 24px;
  color: var(--muted);
}

.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.post-card {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 28px;
  padding-block: 24px;
  border-top: 1px solid var(--border);
}

.post-card:not(:has(.post-card-image)) {
  grid-template-columns: minmax(0, 1fr);
}

.post-card-image img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 4px;
  background: var(--border);
}

.post-card h2 {
  font-size: 1.6rem;
}

.post-card h2 a {
  text-decoration: none;
}

.post-card h2 a:hover {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.post-card-text p {
  margin: 8px 0 0;
}

@media (max-width: 600px) {
  .post-card {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }
}

.post-meta {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tag-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0 0;
  padding: 0;
}

.tag-list a {
  display: inline-block;
  padding: 2px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.8rem;
  text-decoration: none;
}

.tag-list a:hover {
  border-color: var(--muted);
  color: var(--text);
}

.pagination,
.post-nav {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.empty-state {
  padding: 48px 0;
  color: var(--muted);
  text-align: center;
}

/* ---- A post ------------------------------------------------------------------------------- */

.post-head {
  max-width: var(--measure);
  margin-inline: auto;
  padding-block: 40px 32px;
}

.back-link {
  display: inline-block;
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 0.95rem;
  text-decoration: none;
}

.back-link:hover {
  color: var(--text);
}

.post-hero,
.captioned-image {
  margin: 0 auto 32px;
}

.post-hero img,
.captioned-image img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 4px;
}

.post-body {
  max-width: var(--measure);
  margin-inline: auto;
}

.post-body > h2 {
  margin: 2em 0 0.5em;
  font-size: 1.6rem;
}

.post-body p,
.post-body ul,
.post-body ol {
  margin: 0 0 1.1em;
}

.post-body a {
  color: var(--accent);
  text-underline-offset: 3px;
}

.post-body code {
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background: var(--border);
  font-size: 0.9em;
}

.post-body blockquote {
  margin: 1.6em 0;
  padding-left: 20px;
  border-left: 3px solid var(--accent);
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-style: italic;
}

.captioned-image {
  margin-block: 1.8em;
}

/* Wide images break out of the text column, up to the page width. */
.captioned-image.is-wide {
  width: min(var(--page-width), 100vw - 2 * var(--gutter));
  margin-left: 50%;
  transform: translateX(-50%);
}

.captioned-image figcaption {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.875rem;
  text-align: center;
}

.captioned-image figcaption a {
  color: inherit;
}

/* Photos chosen from the portfolio's albums (portfolio/blocks/portfolio_photo.html). */
.portfolio-photo-frame {
  position: relative;
  overflow: hidden;
  border-radius: 4px;
}

.portfolio-photo-frame img {
  border-radius: 0;
}

/* The photo's palette along its bottom edge, like the portfolio's lightbox. */
.palette-strip {
  position: absolute;
  inset: auto 0 0 0;
  display: flex;
  height: clamp(10px, 4%, 24px);
  box-shadow: 0 -1px 0 rgb(0 0 0 / 0.2);
}

.palette-strip span {
  flex-basis: 0;
  min-width: 6px;
}

.block-embed iframe {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  margin-block: 1.6em;
  border: 0;
}

.post-nav {
  max-width: var(--measure);
  margin-inline: auto;
}

.post-nav a {
  display: flex;
  flex-direction: column;
  max-width: 48%;
  font-family: var(--font-serif);
  font-size: 1.1rem;
  text-decoration: none;
}

.post-nav a .muted {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.post-nav .older {
  margin-left: auto;
  text-align: right;
}

/* ---- Search ------------------------------------------------------------------------------- */

.search-form {
  display: flex;
  gap: 8px;
  margin-top: 20px;
}

.search-form input {
  flex: 1;
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.button {
  padding: 9px 18px;
  border: 1px solid var(--text);
  border-radius: var(--radius);
  background: var(--text);
  color: var(--bg);
  font: inherit;
  cursor: pointer;
}

.search-results {
  list-style: none;
  max-width: var(--measure);
  margin: 0;
  padding: 0;
}

.search-results li {
  padding-block: 18px;
  border-top: 1px solid var(--border);
}

.search-results h2 {
  font-size: 1.35rem;
}

.search-results h2 a {
  text-decoration: none;
}

.search-results p {
  margin: 6px 0 0;
  color: var(--muted);
}

/* "Search the portfolio for …" under the results; the portfolio links back the same way. */
.search-elsewhere {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  color: var(--muted);
}
