/*
Theme Name: Retro Butthole
Theme URI: https://retrobutthole.com
Author: Tom
Description: A deadpan specimen-archive theme for a weekly gallery of AI-generated images. One post is one plate: the title names the model, the featured image is the plate, the body is the archivist's note. Accession numbers are worked out automatically.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: retrobutthole
Tags: blog, photography, one-column, custom-colors, featured-images
*/

:root {
  --board:     #d9d8c7;   /* archival board */
  --mount:     #c8c7b1;   /* darker mount behind each plate */
  --ink:       #1c1e18;   /* olive-black, the writing */
  --faded:     #7e7d68;   /* pencil annotation */
  --verdigris: #2e5d52;   /* stamp ink */

  --measure: 62ch;
  --gutter: clamp(1.25rem, 5vw, 3.5rem);
}

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

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

body {
  margin: 0;
  background-color: var(--board);
  /* faint paper fibre; harmless if it fails to decode */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23f)' opacity='0.055'/%3E%3C/svg%3E");
  color: var(--ink);
  font-family: "Petrona", Georgia, "Times New Roman", serif;
  font-size: 1.0625rem;
  line-height: 1.6;
  font-variant-numeric: oldstyle-nums;
}

.wrap {
  max-width: 62rem;
  margin: 0 auto;
  padding-inline: var(--gutter);
}

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

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

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

/* --- masthead ---------------------------------------------------- */

.masthead {
  padding-block: clamp(2.5rem, 8vw, 5rem) clamp(1.75rem, 4vw, 2.75rem);
  border-bottom: 1px solid var(--ink);
}

.wordmark {
  font-family: "Zilla Slab", Georgia, serif;
  font-weight: 700;
  font-size: clamp(2.1rem, 9vw, 4.25rem);
  line-height: 0.95;
  letter-spacing: -0.02em;
  margin: 0;
  word-break: break-word;
}

.wordmark .tld {
  font-weight: 400;
  color: var(--faded);
}

.thesis {
  font-size: clamp(1.05rem, 2.6vw, 1.3rem);
  font-style: italic;
  max-width: 34ch;
  margin: 0.85rem 0 0;
}

.tally {
  font-family: "Zilla Slab", Georgia, serif;
  font-size: 0.9rem;
  color: var(--faded);
  margin: 1.4rem 0 0;
}

/* --- a filed specimen -------------------------------------------- */

.mount {
  background: var(--mount);
  padding: clamp(0.75rem, 3vw, 1.5rem);
  border: 1px solid var(--ink);
}

.mount .plate-link {
  display: block;
  border: 1px solid rgba(28, 30, 24, 0.35);
  background: var(--board);
}

.specimen--lead {
  padding-block: clamp(2.25rem, 6vw, 4rem);
}

.specimen--lead .mount { margin-bottom: 1.75rem; }

.accession {
  font-family: "Zilla Slab", Georgia, serif;
  font-weight: 700;
  color: var(--verdigris);
  font-size: clamp(1.9rem, 6vw, 3rem);
  line-height: 1;
  letter-spacing: -0.01em;
  margin: 0 0 1rem;
  font-variant-numeric: lining-nums;
}

.record dl {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(7.5rem, auto) 1fr;
  gap: 0.4rem 1.25rem;
  border-top: 1px solid var(--ink);
  padding-top: 0.9rem;
}

.record dt {
  font-family: "Zilla Slab", Georgia, serif;
  font-size: 0.875rem;
  color: var(--faded);
  padding-top: 0.25rem;
}

.record dd { margin: 0; }

.record .prompt {
  font-style: italic;
  color: var(--verdigris);
}

@media (min-width: 48rem) {
  .specimen--lead {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(15rem, 1fr);
    gap: clamp(2rem, 5vw, 3.5rem);
    align-items: start;
  }
  .specimen--lead .mount { margin-bottom: 0; }
  .record { position: sticky; top: 2rem; }
}

/* --- the archive grid -------------------------------------------- */

.section-head {
  font-family: "Zilla Slab", Georgia, serif;
  font-weight: 500;
  font-size: 1.05rem;
  margin: 0 0 1.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--ink);
  color: var(--faded);
}

.archive { padding-bottom: clamp(2rem, 6vw, 4rem); }

.grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: clamp(2rem, 5vw, 3.25rem) clamp(1.5rem, 3vw, 2.5rem);
}

.specimen--small .accession--small {
  font-size: 1.35rem;
  margin: 0.9rem 0 0.15rem;
}

.specimen--small .meta {
  font-size: 0.95rem;
  margin: 0;
  line-height: 1.4;
}

.specimen--small .date { color: var(--faded); }

.specimen--small .note {
  font-size: 0.9rem;
  font-style: italic;
  color: var(--faded);
  margin: 0.5rem 0 0;
  padding-left: 0.75rem;
  border-left: 1px solid var(--faded);
}

/* --- methodology, empty state, colophon --------------------------- */

.methodology {
  padding-block: clamp(2rem, 5vw, 3rem) clamp(3rem, 8vw, 5rem);
}

.methodology p {
  margin: 0 0 1rem;
  max-width: var(--measure);
}

.methodology em { color: var(--verdigris); }

.empty {
  padding-block: clamp(3rem, 10vw, 6rem);
  max-width: var(--measure);
}

.empty h2 {
  font-family: "Zilla Slab", Georgia, serif;
  font-weight: 500;
  font-size: 1.6rem;
  margin: 0 0 1rem;
}

.empty code,
.filename-demo {
  font-family: "Zilla Slab", ui-monospace, monospace;
}

.filename-demo {
  background: var(--mount);
  border: 1px solid var(--ink);
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

.colophon {
  border-top: 1px solid var(--ink);
  padding-block: 2rem 3.5rem;
  font-size: 0.9rem;
  color: var(--faded);
}

.colophon p {
  max-width: 48ch;
  margin: 0 0 0.6rem;
}

/* --- lightbox ----------------------------------------------------- */

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(20, 22, 18, 0.94);
  z-index: 50;
  display: grid;
  place-items: center;
  padding: clamp(1rem, 4vw, 3rem);
}

.lightbox[hidden] { display: none; }

.lightbox figure {
  margin: 0;
  max-width: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.lightbox img {
  max-height: 78vh;
  width: auto;
  margin-inline: auto;
  border: 1px solid var(--faded);
}

.lightbox figcaption {
  font-family: "Zilla Slab", Georgia, serif;
  color: var(--board);
  font-size: 0.9rem;
  text-align: center;
}

.lightbox__close {
  position: absolute;
  top: 0.75rem;
  right: 1rem;
  background: none;
  border: 0;
  color: var(--board);
  font-size: 2.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.25rem 0.6rem;
}

/* --- uploader ------------------------------------------------------ */

.panel {
  max-width: 34rem;
  margin-inline: auto;
  padding-block: clamp(2.5rem, 8vw, 5rem);
}

.panel h1 {
  font-family: "Zilla Slab", Georgia, serif;
  font-weight: 700;
  font-size: 1.9rem;
  margin: 0 0 0.4rem;
}

.panel .lede { margin: 0 0 2rem; color: var(--faded); }

.field { margin-bottom: 1.25rem; }

.field label {
  display: block;
  font-family: "Zilla Slab", Georgia, serif;
  font-size: 0.9rem;
  margin-bottom: 0.3rem;
}

.field .hint {
  display: block;
  font-size: 0.85rem;
  color: var(--faded);
  margin-top: 0.3rem;
}

.field input[type="text"],
.field input[type="password"],
.field input[type="date"],
.field input[type="file"] {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  padding: 0.6rem 0.7rem;
  background: var(--board);
  color: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 0;
}

.btn {
  font-family: "Zilla Slab", Georgia, serif;
  font-size: 1rem;
  font-weight: 500;
  background: var(--verdigris);
  color: var(--board);
  border: 1px solid var(--verdigris);
  padding: 0.7rem 1.5rem;
  cursor: pointer;
  border-radius: 0;
}

.btn:hover { background: var(--ink); border-color: var(--ink); }

.msg {
  border-left: 3px solid var(--verdigris);
  padding: 0.75rem 1rem;
  margin-bottom: 1.75rem;
  background: var(--mount);
}

.msg--bad { border-left-color: #8f3524; }

.backlink { display: inline-block; margin-top: 2rem; font-size: 0.95rem; }

/* --- motion ------------------------------------------------------- */

@media (prefers-reduced-motion: no-preference) {
  .specimen--lead .mount img {
    animation: develop 900ms ease-out both;
  }
  @keyframes develop {
    from { opacity: 0; filter: contrast(0.7) brightness(1.15); }
    to   { opacity: 1; filter: none; }
  }
}


/* ------------------------------------------------------------------
   WordPress-specific additions
   ------------------------------------------------------------------ */

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: var(--board);
  padding: 0.6rem 1rem;
  z-index: 100;
}
.skip:focus-visible { left: 0; }

.wordmark a {
  color: inherit;
  text-decoration: none;
}
.wordmark a:hover { color: var(--verdigris); }

.navbar ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin: 1.25rem 0 0;
  padding: 0;
  font-family: "Zilla Slab", Georgia, serif;
  font-size: 0.95rem;
}

.accession a {
  color: inherit;
  text-decoration: none;
}
.accession a:hover { text-decoration: underline; }

.mount--missing {
  display: grid;
  place-items: center;
  min-height: 14rem;
  color: var(--faded);
  font-style: italic;
  text-align: center;
}
.mount--missing p { margin: 0; padding: 1rem; }

/* Pagination between archive pages */

.pagination {
  border-top: 1px solid var(--ink);
  padding-block: 1.25rem 3rem;
  font-family: "Zilla Slab", Georgia, serif;
  font-size: 0.95rem;
}

.pagination .nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  align-items: baseline;
}

.pagination .page-numbers {
  color: var(--verdigris);
  text-decoration: none;
}

.pagination .page-numbers:hover { text-decoration: underline; }

.pagination .page-numbers.current {
  color: var(--ink);
  font-weight: 700;
}

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

/* Previous and next plate on a single page */

.plate-nav {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  border-top: 1px solid var(--ink);
  padding-block: 1.25rem 3rem;
}

.plate-nav__link {
  font-family: "Zilla Slab", Georgia, serif;
  font-weight: 700;
  font-size: 1.2rem;
  text-decoration: none;
  color: var(--verdigris);
}

.plate-nav__link:hover { text-decoration: underline; }

.plate-nav__link--right { margin-left: auto; text-align: right; }

.plate-nav__label {
  display: block;
  font-weight: 400;
  font-size: 0.85rem;
  color: var(--faded);
  margin-bottom: 0.15rem;
}

/* Static pages, plus anything the block editor emits */

.prose {
  max-width: var(--measure);
  padding-block: clamp(2rem, 6vw, 3.5rem);
}

.page-title {
  font-family: "Zilla Slab", Georgia, serif;
  font-weight: 700;
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  margin: 0 0 1.5rem;
}

.prose h2, .prose h3 {
  font-family: "Zilla Slab", Georgia, serif;
  font-weight: 500;
  margin-top: 2rem;
}

.prose img { margin-block: 1.5rem; }

.prose blockquote {
  margin: 1.5rem 0;
  padding-left: 1.25rem;
  border-left: 2px solid var(--verdigris);
  font-style: italic;
}

.aligncenter { margin-inline: auto; }
.alignright { margin-left: auto; }
.wp-caption-text, .wp-element-caption {
  font-size: 0.9rem;
  color: var(--faded);
  margin-top: 0.5rem;
}


/* --- the rest of the week's field -------------------------------- */

.rbh-field {
  margin-top: clamp(2rem, 5vw, 3.25rem);
}

.rbh-field-grid {
  list-style: none;
  margin: 1.25rem 0 0;
  padding: 0;
  display: grid;
  gap: clamp(1rem, 3vw, 1.75rem);
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

.rbh-field-item {
  margin: 0;
}

.rbh-field-item .plate-link {
  display: block;
  background: var(--mount);
  padding: 0.6rem;
  border: 1px solid var(--ink);
}

.rbh-field-item img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid rgba(28, 30, 24, 0.35);
}

.rbh-field-label {
  font-family: "Zilla Slab", Georgia, serif;
  font-size: 0.95rem;
  margin: 0.6rem 0 0;
  color: var(--ink);
}
