/* Amie V3: Journal (list), page heads, single post, post navigation, book card, reading progress, 404. */

/* ===== Dark page head with a tall doorway drawn on the right ===== */
.amie-page-head {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.amie-page-head::before {
  content: "";
  position: absolute;
  z-index: -1;
  right: max(1.5rem, calc((100% - 1200px) / 2));
  bottom: -2px;
  width: clamp(9rem, 22vw, 17rem);
  aspect-ratio: 5 / 8;
  border: 1px solid color-mix(in srgb, var(--wp--preset--color--brass) 55%, transparent);
  border-bottom: 0;
  border-radius: 999px 999px 0 0;
  background: linear-gradient(180deg, color-mix(in srgb, var(--wp--preset--color--brass-2) 18%, transparent), transparent 75%);
  box-shadow: 0 0 5rem color-mix(in srgb, var(--wp--preset--color--brass) 18%, transparent);
}

.amie-page-head::after {
  content: "";
  position: absolute;
  z-index: -2;
  inset: 0;
  background: radial-gradient(ellipse 40% 70% at 85% 100%, color-mix(in srgb, var(--wp--preset--color--brass) 16%, transparent), transparent 70%);
}

.amie-page-head h1 { line-height: 1; margin-block: 1rem 1.5rem; }
.amie-page-head__lead { max-width: 36rem; line-height: 1.4; }

@media (max-width: 781px) {
  .amie-page-head::before { opacity: 0.45; }
}

/* ===== Journal list ===== */
.amie-journal .wp-block-post-template {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: clamp(2rem, 4vw, 3rem);
}

.amie-journal .wp-block-post-template > li {
  display: flex;
  flex-direction: column;
  margin: 0;
}

.amie-journal .wp-block-post-featured-image {
  margin: 0;
  overflow: hidden;
}

.amie-journal .wp-block-post-featured-image img {
  transition: transform 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.amie-journal li:hover .wp-block-post-featured-image img { transform: scale(1.06); }

.amie-journal__body { padding-top: 1.5rem; display: flex; flex-direction: column; gap: 0.85rem; flex: 1; }
.amie-journal__body > * { margin: 0 !important; }

.amie-journal .wp-block-post-terms,
.amie-journal .wp-block-post-date {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--wp--preset--color--slate);
}

.amie-journal .wp-block-post-terms a { color: var(--wp--preset--color--bronze); }

.amie-journal .wp-block-post-title {
  font-family: var(--wp--preset--font-family--serif);
  font-weight: 500;
  font-size: var(--wp--preset--font-size--large);
  line-height: 1.12;
}

.amie-journal .wp-block-post-title a {
  color: var(--wp--preset--color--ink);
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  transition: background-size 0.5s ease, color 0.3s ease;
}

.amie-journal li:hover .wp-block-post-title a { background-size: 100% 1px; color: var(--wp--preset--color--bronze); }

.amie-journal .wp-block-post-excerpt__excerpt { margin: 0; color: var(--wp--preset--color--slate); }

.amie-journal__meta { margin-top: auto !important; padding-top: 1rem; border-top: 1px solid color-mix(in srgb, var(--wp--preset--color--ink) 14%, transparent); }

.amie-journal .wp-block-read-more {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--wp--preset--color--bronze);
}

.amie-journal .wp-block-read-more::after { content: " →"; display: inline-block; transition: transform 0.4s ease; }
.amie-journal li:hover .wp-block-read-more::after { transform: translateX(0.35rem); }

/* the newest note gets the whole first row: picture left, words right */
@media (min-width: 782px) {
  .amie-journal .wp-block-post-template > li:first-child {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    gap: clamp(2rem, 4vw, 3.5rem);
    align-items: center;
  }

  .amie-journal li:first-child .amie-journal__body { padding-top: 0; }
  .amie-journal li:first-child .wp-block-post-title { font-size: var(--wp--preset--font-size--x-large); }
}

/* a doorway drawn in CSS when a note has no picture (inc/journal.php) */
.amie-fallback {
  position: relative;
  background:
    radial-gradient(ellipse 45% 60% at 50% 62%, color-mix(in srgb, var(--wp--preset--color--brass) 30%, transparent), transparent 70%),
    var(--wp--preset--color--midnight);
}

.amie-fallback a { position: absolute; inset: 0; }

.amie-fallback__door {
  position: absolute;
  left: 50%;
  bottom: 14%;
  width: 22%;
  aspect-ratio: 5 / 8;
  translate: -50% 0;
  border: 1px solid var(--wp--preset--color--brass-2);
  border-radius: 999px 999px 2px 2px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--wp--preset--color--brass-2) 75%, transparent), color-mix(in srgb, var(--wp--preset--color--brass) 10%, transparent));
  box-shadow: 0 0 3rem color-mix(in srgb, var(--wp--preset--color--brass-2) 45%, transparent);
  transition: scale 1s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 1s ease;
}

.amie-journal li:hover .amie-fallback__door { scale: 1.08; box-shadow: 0 0 4.5rem color-mix(in srgb, var(--wp--preset--color--brass-2) 65%, transparent); }

.amie-journal .wp-block-query-pagination { margin-top: 3rem; font-size: var(--wp--preset--font-size--small); letter-spacing: 0.12em; text-transform: uppercase; }

/* ===== Single post ===== */
.amie-post-head { text-align: center; }
.amie-post-head::before { display: none; }
.amie-post-head::after { background: radial-gradient(ellipse 50% 80% at 50% 110%, color-mix(in srgb, var(--wp--preset--color--brass) 22%, transparent), transparent 70%); }

.amie-post-head__terms { font-size: 0.75rem; letter-spacing: 0.24em; text-transform: uppercase; }
.amie-post-head__terms a { color: var(--wp--preset--color--brass-2); }
.amie-post-head__terms .wp-block-post-terms__separator { color: var(--wp--preset--color--mist); }

.amie-post-head__meta { gap: 0.5rem 1.25rem; text-transform: uppercase; letter-spacing: 0.16em; }
.amie-post-head__meta > * { margin: 0; font-size: 0.75rem !important; }
.amie-post-head__meta .wp-block-post-author-name::before { content: "by "; text-transform: none; letter-spacing: 0.04em; }
.amie-readtime::before { content: "·"; margin: 0 0.75rem; }

.amie-post-cover { margin-block: 0 !important; }

.amie-post-body { padding-block: clamp(3rem, 7vw, 5rem) 2rem; }

.single .wp-block-post-content {
  font-family: var(--wp--preset--font-family--serif);
  font-size: clamp(1.2rem, 1.1rem + 0.4vw, 1.4rem);
  font-weight: 400;
  line-height: 1.72;
  color: var(--wp--preset--color--ink);
}

.single .wp-block-post-content > p:first-of-type {
  font-size: 1.22em;
  line-height: 1.5;
}

.single .wp-block-post-content > p:first-of-type::first-letter {
  float: left;
  font-family: var(--wp--preset--font-family--display);
  font-size: 3.6em;
  line-height: 0.82;
  padding: 0.06em 0.12em 0 0;
  color: var(--wp--preset--color--brass);
}

.single .wp-block-post-content h2,
.single .wp-block-post-content h3 { margin-top: 2.5em; }

/* pictures between the paragraphs: room around them, a quiet caption; corners come from the site's image setting */
.single .wp-block-post-content .wp-block-image { margin-block: 2.75rem 3rem; }
.single .wp-block-post-content .wp-block-image img { display: block; width: 100%; height: auto; }
.single .wp-block-post-content .wp-block-image .wp-element-caption {
  margin: 0.9rem auto 0;
  max-width: 40rem;
  font-family: var(--wp--preset--font-family--sans);
  font-size: 0.8rem;
  font-weight: 300;
  letter-spacing: 0.04em;
  line-height: 1.5;
  color: var(--wp--preset--color--slate);
  text-align: center;
}

.single .wp-block-post-content blockquote {
  margin: 2.5rem 0;
  padding: 0 0 0 1.5rem;
  border-left: 2px solid var(--wp--preset--color--brass);
  font-style: italic;
  font-size: 1.15em;
}

.single .wp-block-post-content a { color: var(--wp--preset--color--bronze); text-decoration: underline; }

.amie-post-end {
  margin-top: 3.5rem !important;
  color: var(--wp--preset--color--brass);
  font-size: 1.5rem;
  letter-spacing: 1.5em;
  padding-left: 1.5em;
}

/* ===== Previous / next ===== */
.amie-postnav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
  margin-block: 2rem 5rem !important;
}

.amie-postnav:not(:has(a)) { display: none; }

.amie-postnav .wp-block-post-navigation-link a {
  display: block;
  height: 100%;
  padding: 1.75rem;
  border: 1px solid color-mix(in srgb, var(--wp--preset--color--ink) 14%, transparent);
  color: var(--wp--preset--color--ink);
  font-family: var(--wp--preset--font-family--serif);
  font-size: var(--wp--preset--font-size--medium);
  transition: border-color 0.4s ease, background-color 0.4s ease;
}

.amie-postnav .wp-block-post-navigation-link a:hover {
  border-color: var(--wp--preset--color--brass);
  background: color-mix(in srgb, var(--wp--preset--color--brass) 8%, transparent);
}

.amie-postnav .post-navigation-link-next { grid-column: 2; text-align: right; }

@media (max-width: 700px) {
  .amie-postnav { grid-template-columns: 1fr; }
  .amie-postnav .post-navigation-link-next { grid-column: 1; text-align: left; }
}

/* ===== Book card at the end of posts ===== */
.amie-book-card .wp-block-columns { gap: clamp(2rem, 5vw, 4rem); }
.amie-book-card h2 { margin-block: 0.5rem 1rem; }

/* ===== Reading progress ===== */
.amie-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--wp--preset--color--brass);
  transform-origin: left;
  transform: scaleX(0);
  z-index: 120;
}

.admin-bar .amie-progress { top: 32px; }

/* ===== Search box ===== */
.amie-search .wp-block-search__inside-wrapper { border: 1px solid color-mix(in srgb, var(--wp--preset--color--white) 25%, transparent); padding: 0.25rem; max-width: 34rem; }
.amie-search .wp-block-search__input { background: transparent; border: 0; color: var(--wp--preset--color--white); font-size: var(--wp--preset--font-size--medium); padding: 0.75rem 1rem; }
.amie-search .wp-block-search__button { margin: 0; }

@media (prefers-reduced-motion: reduce) {
  .amie-journal .wp-block-post-featured-image img,
  .amie-fallback__door { transition: none; }
  .amie-progress { display: none; }
}

/* fixes after the first look */
.amie-page-head .amie-page-head__lead { margin-left: max(0px, calc((100% - 1200px) / 2)) !important; }
.amie-page-head::before { width: clamp(7rem, 15vw, 12.5rem); }
.amie-post-head__terms a,
.amie-journal .wp-block-post-terms a { text-decoration: none; }
/* groups without a background get no side padding from WordPress: give the reading column its own */
.amie-post-body,
.amie-postnav { padding-inline: clamp(1.25rem, 5vw, 2rem); }
.amie-404 { min-height: 78svh; }
