/* ==========================================================================
   rcblackmere.com
   Palette and mood are sampled from the author artwork: near-black grounds
   with a warm brown undertone, stone greys, spider-lily crimson, the gold
   of the halo, and candle-lit parchment.
   ========================================================================== */

:root {
  /* Grounds ------------------------------------------------------------- */
  --ink: #0a0605;
  --ink-2: #100a08;
  --card: #17100d;
  --card-lit: #1e1512;

  /* Lines --------------------------------------------------------------- */
  --line: #33241c;
  --line-strong: #4a3527;

  /* Text ---------------------------------------------------------------- */
  --text: #e9dcc6;
  --text-dim: #ab9279;
  --text-faint: #6d5744;

  /* Accents ------------------------------------------------------------- */
  --crimson: #a8121c;
  --crimson-lit: #cf2430;
  --crimson-soft: #eda9a4;
  --gold: #c9a35c;
  --gold-lit: #e3cb99;
  --candle: #ffc074;

  /* Type ---------------------------------------------------------------- */
  --display: "Cinzel", "Trajan Pro", Palatino, "Palatino Linotype", Georgia, serif;
  --body: "EB Garamond", Georgia, "Times New Roman", Times, serif;

  --step--1: clamp(0.86rem, 0.83rem + 0.15vw, 0.95rem);
  --step-0: clamp(1.06rem, 1rem + 0.3vw, 1.22rem);
  --step-1: clamp(1.3rem, 1.18rem + 0.6vw, 1.6rem);
  --step-2: clamp(1.6rem, 1.38rem + 1.1vw, 2.3rem);
  --step-3: clamp(2rem, 1.6rem + 2vw, 3.4rem);
  --step-4: clamp(2.6rem, 1.9rem + 3.4vw, 5rem);

  /* Rhythm -------------------------------------------------------------- */
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --section-y: clamp(5rem, 11vw, 8.5rem);
  --wide: 1180px;
  --narrow: 720px;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ==========================================================================
   Reset
   ========================================================================== */

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

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

body {
  background: var(--ink);
  color: var(--text);
  font-family: var(--body);
  font-size: var(--step-0);
  line-height: 1.7;
  font-synthesis-weight: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img,
picture,
svg {
  display: block;
  max-width: 100%;
}

input,
textarea,
button {
  font: inherit;
  color: inherit;
}

/* A faint film grain keeps the large flat blacks from banding on wide
   gamut displays and matches the painterly texture of the artwork. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.038;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ==========================================================================
   Typography
   ========================================================================== */

h1,
h2,
h3 {
  font-family: var(--display);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: 0.02em;
}

p {
  text-wrap: pretty;
}

a {
  color: var(--gold);
  text-decoration-color: color-mix(in srgb, var(--gold) 35%, transparent);
  text-underline-offset: 0.22em;
  text-decoration-thickness: 1px;
  transition: color 0.25s var(--ease), text-decoration-color 0.25s var(--ease);
}

a:hover {
  color: var(--gold-lit);
  text-decoration-color: currentColor;
}

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

::selection {
  background: color-mix(in srgb, var(--crimson) 60%, transparent);
  color: var(--text);
}

.eyebrow {
  font-family: var(--display);
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--gold);
}

.lede {
  font-size: var(--step-1);
  line-height: 1.62;
  color: var(--text);
}

.prose p + p {
  margin-top: 1.15em;
}

.prose {
  color: var(--text-dim);
  max-width: 62ch;
}

.prose strong {
  color: var(--text);
  font-weight: 600;
}

/* ==========================================================================
   Layout helpers
   ========================================================================== */

.wrap {
  width: min(100% - var(--gutter) * 2, var(--wide));
  margin-inline: auto;
}

.wrap--narrow {
  width: min(100% - var(--gutter) * 2, var(--narrow));
}

.section {
  padding-block: var(--section-y);
  position: relative;
}

.section--alt {
  background: var(--ink-2);
  border-block: 1px solid var(--line);
}

.skip-link {
  position: absolute;
  left: 50%;
  top: 0;
  translate: -50% -120%;
  z-index: 200;
  background: var(--card);
  border: 1px solid var(--gold);
  padding: 0.6rem 1.2rem;
  text-decoration: none;
  transition: translate 0.2s var(--ease);
}

.skip-link:focus-visible {
  translate: -50% 0.5rem;
}

/* ==========================================================================
   Ornament — a stylised higanbana (red spider lily), the motif that runs
   through the artwork. Used as a divider and as a marker on headings.
   ========================================================================== */

.lily {
  width: 1.9rem;
  height: 1.9rem;
  flex: none;
  color: var(--crimson);
  overflow: visible;
}

.rule {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  margin-block: 1.6rem;
}

.rule::before,
.rule::after {
  content: "";
  height: 1px;
  flex: 1;
  background: linear-gradient(90deg, transparent, var(--line-strong), transparent);
}

.rule--center {
  max-width: 20rem;
  margin-inline: auto;
}

.rule--left::before {
  display: none;
}

.rule--left {
  justify-content: flex-start;
}

.rule--left::after {
  max-width: 7rem;
}

/* ==========================================================================
   Masthead
   ========================================================================== */

.masthead {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--ink) 82%, transparent);
  backdrop-filter: blur(14px) saturate(1.1);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease), background 0.3s var(--ease);
}

.masthead[data-stuck="true"] {
  border-bottom-color: var(--line);
  background: color-mix(in srgb, var(--ink) 94%, transparent);
}

.masthead__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 4.4rem;
}

.brand {
  font-family: var(--display);
  font-size: var(--step--1);
  font-weight: 700;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--text);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
}

.brand .lily {
  width: 1.1rem;
  height: 1.1rem;
}

.brand:hover {
  color: var(--gold-lit);
}

.nav {
  display: flex;
  align-items: center;
  gap: clamp(1.1rem, 3vw, 2.4rem);
}

.nav a {
  font-family: var(--display);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-dim);
  text-decoration: none;
  padding-block: 0.35rem;
  position: relative;
}

.nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--crimson);
  scale: 0 1;
  transition: scale 0.32s var(--ease);
}

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

.nav a:hover::after,
.nav a[aria-current="true"]::after {
  scale: 1 1;
}

@media (max-width: 34rem) {
  .nav {
    gap: 1rem;
  }
  .nav a {
    font-size: 0.68rem;
    letter-spacing: 0.14em;
  }
  .brand span {
    display: none;
  }
}

/* ==========================================================================
   Hero — a title page. The artwork keeps its full square composition and
   its edges are feathered into the page ground.
   ========================================================================== */

.hero {
  min-height: 100svh;
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
  padding-block: clamp(2.5rem, 7vw, 4.5rem) var(--section-y);
  position: relative;
  isolation: isolate;
}

/* Candlelight behind the figure. */
.hero::before {
  content: "";
  position: absolute;
  z-index: -1;
  width: min(120vw, 1100px);
  aspect-ratio: 1;
  top: 6%;
  left: 50%;
  translate: -50% 0;
  background: radial-gradient(
    circle at 50% 42%,
    color-mix(in srgb, var(--candle) 13%, transparent) 0%,
    color-mix(in srgb, var(--crimson) 7%, transparent) 38%,
    transparent 68%
  );
  pointer-events: none;
}

.hero__art {
  width: auto;
  margin-bottom: clamp(1.6rem, 4vw, 2.6rem);
}

.hero__art img {
  height: min(52svh, 500px);
  width: auto;
  max-width: 100%;
  object-fit: contain;
  /* Dissolve the artwork's square border into the page ground. `closest-side`
     puts the gradient's end stop exactly on the edge, so the fade actually
     reaches it — a percentage radius here overshoots and leaves a hard edge. */
  -webkit-mask-image: radial-gradient(
    ellipse closest-side at 50% 47%,
    #000 68%,
    rgba(0, 0, 0, 0.85) 84%,
    rgba(0, 0, 0, 0.35) 94%,
    transparent 100%
  );
  mask-image: radial-gradient(
    ellipse closest-side at 50% 47%,
    #000 68%,
    rgba(0, 0, 0, 0.85) 84%,
    rgba(0, 0, 0, 0.35) 94%,
    transparent 100%
  );
}

.hero__name {
  font-size: var(--step-4);
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--text);
  text-shadow: 0 0 46px color-mix(in srgb, var(--candle) 22%, transparent);
}

.hero__tagline {
  font-size: var(--step-1);
  font-style: italic;
  color: var(--text-dim);
  max-width: 34ch;
  margin-inline: auto;
}

.hero__cue {
  position: absolute;
  bottom: clamp(1.4rem, 4vh, 2.6rem);
  left: 50%;
  translate: -50% 0;
  font-family: var(--display);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--text-faint);
  text-decoration: none;
  display: grid;
  justify-items: center;
  gap: 0.6rem;
}

.hero__cue::after {
  content: "";
  width: 1px;
  height: 2.4rem;
  background: linear-gradient(180deg, var(--line-strong), transparent);
  animation: drift 2.8s var(--ease) infinite;
}

.hero__cue:hover {
  color: var(--gold);
}

/* On a phone the artwork is width-bound, not height-bound — sizing by height
   would letterbox it inside its own box and pull the vignette off the edges. */
@media (max-width: 40rem) {
  .hero__art img {
    height: auto;
    width: min(90vw, 500px);
  }
}

/* The cue is pinned to the floor of the hero, so it collides with the
   tagline wherever the hero is short or the type has wrapped. */
@media (max-width: 48rem), (max-height: 44rem) {
  .hero__cue {
    display: none;
  }
}

@keyframes drift {
  0%,
  100% {
    opacity: 0.35;
    transform: scaleY(0.7);
    transform-origin: top;
  }
  50% {
    opacity: 1;
    transform: scaleY(1);
    transform-origin: top;
  }
}

/* ==========================================================================
   Section headings
   ========================================================================== */

.section__head {
  margin-bottom: clamp(2.6rem, 6vw, 4rem);
}

.section__head--center {
  text-align: center;
  max-width: 46rem;
  margin-inline: auto;
}

.section__title {
  font-size: var(--step-3);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 0.7rem;
}

/* ==========================================================================
   The author
   ========================================================================== */

.author {
  display: grid;
  gap: clamp(2.5rem, 6vw, 4.5rem);
  align-items: start;
}

@media (min-width: 60rem) {
  .author {
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1fr);
    gap: clamp(3rem, 6vw, 5.5rem);
  }
}

.author__portrait {
  position: relative;
  margin: 0;
}

.author__portrait img {
  width: 100%;
  border-radius: 2px;
}

/* Gold hairline frame, offset like a plate in an old edition. */
.author__portrait::before {
  content: "";
  position: absolute;
  inset: -0.75rem;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  pointer-events: none;
  transition: inset 0.5s var(--ease), border-color 0.5s var(--ease);
}

.author__portrait:hover::before {
  inset: -1.15rem;
  border-color: color-mix(in srgb, var(--gold) 45%, transparent);
}

.author__portrait figcaption {
  margin-top: 1.4rem;
  font-size: var(--step--1);
  font-style: italic;
  color: var(--text-faint);
  text-align: center;
}

.author__body .prose {
  max-width: 58ch;
}

.signature {
  margin-top: 2rem;
  font-family: var(--display);
  font-size: var(--step--1);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--gold);
}

/* ==========================================================================
   Books
   ========================================================================== */

.books {
  display: grid;
  gap: clamp(3rem, 7vw, 5rem);
}

.book {
  display: grid;
  gap: clamp(1.75rem, 4vw, 3rem);
  /* Top-aligned: blurbs run much taller than a cover, and centring leaves
     the cover floating oddly below the title it belongs to. */
  align-items: start;
}

@media (min-width: 48rem) {
  .book {
    grid-template-columns: minmax(0, 260px) minmax(0, 1fr);
    gap: clamp(2.5rem, 5vw, 4rem);
  }

  /* Alternate the side the cover sits on. The column template has to flip
     too, or the cover lands in the wide text column. */
  .book:nth-child(even) {
    grid-template-columns: minmax(0, 1fr) minmax(0, 260px);
  }

  .book:nth-child(even) .book__cover {
    order: 2;
  }

  .book:nth-child(even) .book__body {
    order: 1;
  }
}

.book__cover {
  position: relative;
  border-radius: 2px;
  overflow: hidden;
  box-shadow: 0 18px 48px -18px rgb(0 0 0 / 0.9), 0 0 0 1px var(--line);
  transition: transform 0.5s var(--ease), box-shadow 0.5s var(--ease);
}

/* No forced ratio: covers differ slightly from 2:3 and cropping one to fit
   would shave the title or the author name off the artwork. */
.book__cover img {
  display: block;
  width: 100%;
  height: auto;
}

.book:hover .book__cover {
  transform: translateY(-6px);
  box-shadow: 0 26px 60px -20px rgb(0 0 0 / 0.95), 0 0 0 1px color-mix(in srgb, var(--gold) 40%, transparent);
}

/* Stand-in shown until a real cover image is dropped in. */
.book__cover--placeholder {
  aspect-ratio: 2 / 3;
  display: grid;
  place-content: center;
  gap: 0.9rem;
  padding: 1.75rem;
  text-align: center;
  background: linear-gradient(160deg, var(--card-lit), var(--ink) 70%);
}

.book__cover--placeholder::before,
.book__cover--placeholder::after {
  content: "";
  position: absolute;
  inset: 0.7rem;
  border: 1px solid color-mix(in srgb, var(--gold) 30%, transparent);
  pointer-events: none;
}

.book__cover--placeholder::after {
  inset: 1.05rem;
  border-color: color-mix(in srgb, var(--gold) 14%, transparent);
}

.book__cover--placeholder .lily {
  width: 2.6rem;
  height: 2.6rem;
  margin-inline: auto;
}

.book__cover-label {
  font-family: var(--display);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.book__meta {
  font-family: var(--display);
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--gold);
}

.book__title {
  font-size: var(--step-2);
  margin-top: 0.55rem;
}

/* Release flag for a title that isn't out yet. */
.book__flag {
  display: inline-block;
  margin-left: 0.85rem;
  padding: 0.3em 0.75em;
  font-family: var(--display);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--crimson-soft);
  border: 1px solid color-mix(in srgb, var(--crimson) 60%, transparent);
  border-radius: 2px;
  vertical-align: 0.25em;
  white-space: nowrap;
}

.book__blurb {
  margin-top: 1.1rem;
}

.book__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem 1.6rem;
  align-items: center;
  margin-top: 1.6rem;
}

.book__detail {
  font-size: var(--step--1);
  color: var(--text-faint);
}

/* Stacked on a phone, a full-width cover swamps the copy beneath it. */
@media (max-width: 47.999rem) {
  .book__cover {
    max-width: 320px;
    margin-inline: auto;
  }
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  --btn-fg: var(--ink);
  --btn-bg: var(--gold);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.82em 1.9em;
  font-family: var(--display);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--btn-fg);
  background: var(--btn-bg);
  border: 1px solid var(--btn-bg);
  border-radius: 2px;
  cursor: pointer;
  transition: background 0.3s var(--ease), color 0.3s var(--ease),
    border-color 0.3s var(--ease), transform 0.3s var(--ease);
}

.btn:hover:not(:disabled) {
  --btn-bg: var(--gold-lit);
  transform: translateY(-2px);
  color: var(--ink);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn--ghost {
  --btn-fg: var(--text);
  --btn-bg: transparent;
  border-color: var(--line-strong);
}

.btn--ghost:hover:not(:disabled) {
  --btn-bg: transparent;
  color: var(--gold-lit);
  border-color: var(--gold);
}

.link-arrow {
  font-family: var(--display);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.link-arrow::after {
  content: "→";
  transition: translate 0.3s var(--ease);
}

.link-arrow:hover::after {
  translate: 0.28rem 0;
}

/* ==========================================================================
   Contact
   ========================================================================== */

.contact-grid {
  display: grid;
  gap: clamp(2.5rem, 6vw, 4rem);
}

@media (min-width: 58rem) {
  .contact-grid {
    grid-template-columns: minmax(0, 0.72fr) minmax(0, 1fr);
    gap: clamp(3rem, 6vw, 5rem);
  }
}

.form {
  display: grid;
  gap: 1.25rem;
}

.field {
  display: grid;
  gap: 0.5rem;
}

.field > label {
  font-family: var(--display);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.field .optional {
  color: var(--text-faint);
  letter-spacing: 0.12em;
}

.field input,
.field textarea {
  width: 100%;
  padding: 0.85rem 1rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--text);
  font-size: 1rem;
  line-height: 1.6;
  transition: border-color 0.25s var(--ease), background 0.25s var(--ease);
}

.field textarea {
  resize: vertical;
  min-height: 9.5rem;
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--text-faint);
}

.field input:hover,
.field textarea:hover {
  border-color: var(--line-strong);
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--gold);
  background: var(--card-lit);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 14%, transparent);
}

/* Honeypot: off-screen for bots, invisible and unreachable for people. */
.field--trap {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.form__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem;
  justify-content: space-between;
}

.form__note {
  font-size: var(--step--1);
  color: var(--text-faint);
  max-width: 34ch;
}

.form__status {
  font-size: var(--step--1);
  padding: 0.9rem 1.1rem;
  border-radius: 2px;
  border: 1px solid var(--line);
  background: var(--card);
  display: none;
}

.form__status[data-state="ok"],
.form__status[data-state="error"],
.form__status[data-state="busy"] {
  display: block;
}

.form__status[data-state="ok"] {
  border-color: color-mix(in srgb, var(--gold) 50%, transparent);
  color: var(--gold-lit);
}

.form__status[data-state="error"] {
  border-color: color-mix(in srgb, var(--crimson-lit) 55%, transparent);
  color: #f0a9a3;
}

.contact-aside dl {
  display: grid;
  gap: 1.4rem;
  margin-top: 2rem;
}

.contact-aside dt {
  font-family: var(--display);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.3rem;
}

.contact-aside dd {
  margin: 0;
  color: var(--text-dim);
  font-size: var(--step--1);
}

/* ==========================================================================
   Footer
   ========================================================================== */

.footer {
  border-top: 1px solid var(--line);
  padding-block: clamp(3rem, 7vw, 4.5rem);
  text-align: center;
}

.socials {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.6rem clamp(1rem, 3vw, 2rem);
  list-style: none;
  padding: 0;
  margin-bottom: 2rem;
}

.socials a {
  font-family: var(--display);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-dim);
  text-decoration: none;
}

.socials a:hover {
  color: var(--gold-lit);
}

.socials li:not(:last-child)::after {
  content: "·";
  margin-left: clamp(1rem, 3vw, 2rem);
  color: var(--line-strong);
}

.footer__fine {
  font-size: var(--step--1);
  color: var(--text-faint);
}

.footer__fine a {
  color: var(--text-dim);
}

/* ==========================================================================
   Scroll reveal — opt-in, and entirely skipped when motion is reduced.
   ========================================================================== */

@media (prefers-reduced-motion: no-preference) {
  .reveal {
    opacity: 0;
    translate: 0 1.75rem;
    transition: opacity 0.9s var(--ease), translate 0.9s var(--ease);
  }

  .reveal.is-visible {
    opacity: 1;
    translate: 0 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
