/*
 * Molly Flynn — Site Foundation & Home
 *
 * V2026.09.22
 * Build: 1
 *
 * Defines the shared Molly Flynn visual system and Home page: palette, ocean and mist atmosphere, header, primary navigation, typography, common surfaces and controls, footer, accessibility, responsive behavior, and the Home book/news presentation.
 */

/* ---------- 1. Core palette ---------- */
:root {
  --mf-night: #071526;
  --mf-night-deep: #030a13;
  --mf-ocean: #0b2945;
  --mf-ocean-mid: #123858;
  --mf-mist: #c8d9e6;
  --mf-mist-cool: #9fbad0;
  --mf-spectral: #b9c6f3;
  --mf-spectral-deep: #8e9ed6;
  --mf-ghost-light: #8fdcff;
  --mf-ghost-core: #eefbff;
  --mf-gold: #e8b56f;
  --mf-text: #f4f4f2;
  --mf-text-muted: #c7d0d9;
  --mf-panel: rgba(12, 29, 48, 0.78);
  --mf-panel-soft: rgba(18, 40, 62, 0.58);
  --mf-border: rgba(185, 198, 243, 0.34);

  /* Override Tiny's principal colors. */
  --text: var(--mf-text);
  --link: var(--mf-ghost-light);
  --link_visited: var(--mf-ghost-light);
  --accent1: var(--mf-spectral);
  --accent2: var(--mf-text-muted);
  --background: var(--mf-night-deep);
  --button-text: var(--mf-night-deep);
  --blockquote: rgba(139, 157, 210, 0.12);
  --blockquote-border: var(--mf-spectral);
  --aside: rgba(159, 186, 208, 0.12);
  --aside-border: var(--mf-mist-cool);
  --note: rgba(232, 181, 111, 0.10);
  --note-border: var(--mf-gold);
  --field: rgba(255, 255, 255, 0.08);
  --code: rgba(255, 255, 255, 0.09);
}

/* Keep the Molly Flynn palette even when the device prefers dark mode. */
@media (prefers-color-scheme: dark) {
  :root {
    --text: var(--mf-text);
    --link: var(--mf-ghost-light);
    --link_visited: var(--mf-ghost-light);
    --accent1: var(--mf-spectral);
    --accent2: var(--mf-text-muted);
    --background: var(--mf-night-deep);
    --button-text: var(--mf-night-deep);
    --blockquote: rgba(139, 157, 210, 0.12);
    --blockquote-border: var(--mf-spectral);
    --aside: rgba(159, 186, 208, 0.12);
    --aside-border: var(--mf-mist-cool);
    --note: rgba(232, 181, 111, 0.10);
    --note-border: var(--mf-gold);
    --field: rgba(255, 255, 255, 0.08);
    --code: rgba(255, 255, 255, 0.09);
  }
}

/* ---------- 2. Nighttime ocean background ---------- */
html {
  min-height: 100%;
  background: var(--mf-night-deep);
}

body {
  max-width: 62rem;
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 1.25rem 3rem;
  color: var(--mf-text);
  background-color: var(--mf-night-deep);
  background-image:
    radial-gradient(ellipse at 72% 12%, rgba(142, 158, 214, 0.12) 0%, transparent 34%),
    radial-gradient(ellipse at 18% 26%, rgba(143, 220, 255, 0.07) 0%, transparent 28%),
    linear-gradient(
      to bottom,
      rgba(7, 21, 38, 0.96) 0%,
      rgba(8, 29, 49, 0.98) 24%,
      rgba(5, 20, 35, 0.99) 55%,
      rgba(3, 10, 19, 1) 100%
    ),
    repeating-linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.018) 0,
      rgba(255, 255, 255, 0.018) 1px,
      rgba(0, 0, 0, 0.018) 2px,
      rgba(0, 0, 0, 0.018) 7px
    );
  background-attachment: fixed;
}

main {
  position: relative;
}

/* ---------- 3. Header mist / fog bank ---------- */
header {
  position: relative;
  isolation: isolate;
  margin: 0 -1.25rem 1.5rem;
  padding: 1.45rem 1.25rem 1.7rem;
  text-align: center;
}

/* Overlapping, asymmetric fog patches keep the header mist from reading as a band. */
header::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -0.25rem -6vw -0.8rem;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 9% 55%, rgba(200, 217, 230, 0.20) 0 14%, transparent 43%),
    radial-gradient(ellipse at 31% 24%, rgba(159, 186, 208, 0.26) 0 18%, transparent 48%),
    radial-gradient(ellipse at 55% 50%, rgba(210, 224, 234, 0.19) 0 19%, transparent 47%),
    radial-gradient(ellipse at 78% 26%, rgba(159, 186, 208, 0.23) 0 17%, transparent 46%),
    radial-gradient(ellipse at 96% 58%, rgba(200, 217, 230, 0.16) 0 13%, transparent 40%),
    linear-gradient(
      to bottom,
      rgba(159, 186, 208, 0.10),
      rgba(159, 186, 208, 0.055) 58%,
      transparent 100%
    );
  filter: blur(0.6px);
}

/* ---------- 4. Series logo ---------- */
.series-logo {
  margin: 0 auto 0.8rem;
  line-height: 1;
}

.series-logo a,
.series-logo a:visited,
.series-logo a:hover {
  display: inline-block;
  text-decoration: none;
}

.series-logo img {
  display: block;
  width: min(100%, 34rem);
  height: auto;
  margin: 0 auto;
  filter:
    drop-shadow(0 0 0.25rem rgba(238, 251, 255, 0.38))
    drop-shadow(0 0 0.75rem rgba(143, 220, 255, 0.24));
}

/* ---------- 5. DLC navigation + Molly's ghost-light ---------- */
/*
 * DLC owns navigation structure/state; Molly owns the presentation.
 * The header mist automatically grows with the header's content, so when
 * dlc-subnav is present the main and secondary navigation share one fog bank.
 */

.dlc-main-nav {
  margin-top: 0.5rem;
}

.dlc-main-nav ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem 0.55rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.dlc-main-nav-item {
  display: block;
  margin: 0;
  padding: 0;
}

.dlc-main-nav-link,
.dlc-main-nav-link:visited {
  position: relative;
  display: inline-block;
  padding: 0.38rem 0.64rem 0.38rem 1.3rem;
  border: 0;
  border-radius: 999px;
  color: var(--mf-text);
  background: rgba(4, 18, 31, 0.11);
  text-decoration: none;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.65);
}

.dlc-main-nav-link:hover,
.dlc-main-nav-link:focus-visible {
  color: var(--mf-ghost-core);
  background: rgba(143, 220, 255, 0.08);
  outline: 2px solid rgba(143, 220, 255, 0.55);
  outline-offset: 2px;
}

/* The actual current item and the top-level ancestor use the same full-size ghost light. */
.dlc-main-nav-current,
.dlc-main-nav-section {
  color: var(--mf-ghost-core) !important;
  background:
    radial-gradient(circle at 0.75rem 50%, rgba(143, 220, 255, 0.20), transparent 2.4rem),
    rgba(143, 220, 255, 0.035) !important;
  text-shadow:
    0 0 0.22rem rgba(238, 251, 255, 0.52),
    0 0 0.55rem rgba(143, 220, 255, 0.30);
}

.dlc-main-nav-current::before,
.dlc-main-nav-section::before {
  content: "";
  position: absolute;
  left: 0.54rem;
  top: 50%;
  width: 0.48rem;
  height: 0.48rem;
  border-radius: 50%;
  transform: translateY(-50%);
  background: var(--mf-ghost-core);
  box-shadow:
    0 0 0.18rem 0.08rem rgba(238, 251, 255, 0.96),
    0 0 0.45rem 0.22rem rgba(143, 220, 255, 0.70),
    0 0 1rem 0.45rem rgba(143, 220, 255, 0.24);
}

/* ---------- 6. Typography ---------- */
body {
  font-family: Georgia, "Times New Roman", Times, serif;
  line-height: 1.7;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--mf-text);
  font-family: Georgia, "Times New Roman", Times, serif;
  font-weight: 600;
  letter-spacing: 0.015em;
  text-wrap: balance;
}

h1:not(.series-logo),
h2 {
  text-shadow:
    0 1px 0 rgba(0, 0, 0, 0.75),
    0 0 0.45rem rgba(185, 198, 243, 0.10);
}

.mf-spectral-heading {
  color: var(--mf-spectral);
  text-shadow:
    0 0 0.22rem rgba(185, 198, 243, 0.28),
    0 0 0.75rem rgba(143, 220, 255, 0.12);
}

/* ---------- 7. Links and buttons ---------- */
a {
  text-underline-offset: 0.16em;
  text-decoration-thickness: 0.07em;
}

a:hover,
a:focus-visible {
  color: var(--mf-ghost-core);
}

.mf-button,
a.read-more,
input[type="submit"],
button {
  display: inline-block;
  padding: 0.68rem 1.05rem;
  border: 1px solid rgba(143, 220, 255, 0.68);
  border-radius: 0.62rem;
  color: var(--mf-ghost-core);
  background: rgba(143, 220, 255, 0.08);
  box-shadow: inset 0 0 0.7rem rgba(143, 220, 255, 0.035);
  text-decoration: none;
}

.mf-button:hover,
.mf-button:focus-visible,
a.read-more:hover,
a.read-more:focus-visible,
input[type="submit"]:hover,
input[type="submit"]:focus-visible,
button:hover,
button:focus-visible {
  color: var(--mf-night-deep);
  background: var(--mf-ghost-light);
  box-shadow: 0 0 0.7rem rgba(143, 220, 255, 0.28);
}

/* ---------- 8. Spectral content surfaces ---------- */
.mf-panel,
.callout {
  padding: clamp(1rem, 2.5vw, 1.6rem);
  border: 1px solid var(--mf-border);
  border-radius: 1rem;
  background:
    linear-gradient(135deg, rgba(185, 198, 243, 0.055), transparent 45%),
    var(--mf-panel);
  box-shadow:
    0 0.8rem 2.4rem rgba(0, 0, 0, 0.20),
    inset 0 1px rgba(255, 255, 255, 0.035);
}

.mf-panel--soft {
  background:
    linear-gradient(135deg, rgba(159, 186, 208, 0.08), transparent 58%),
    var(--mf-panel-soft);
}

/* ---------- 9. Fading spectral dividers ---------- */
hr {
  height: 1px;
  margin: 2.7rem 0;
  border: 0;
  background: linear-gradient(
    to right,
    transparent,
    rgba(185, 198, 243, 0.55) 22%,
    rgba(143, 220, 255, 0.72) 50%,
    rgba(185, 198, 243, 0.55) 78%,
    transparent
  );
}

hr::before {
  content: none;
}

.mf-fade-divider {
  width: min(80%, 48rem);
  height: 1px;
  margin: 2.25rem auto 2.1rem;
  background: linear-gradient(
    to right,
    transparent,
    rgba(185, 198, 243, 0.30) 15%,
    rgba(143, 220, 255, 0.52) 36%,
    rgba(143, 220, 255, 0.88) 50%,
    rgba(143, 220, 255, 0.52) 64%,
    rgba(185, 198, 243, 0.30) 85%,
    transparent
  );
}

/* ---------- 11. Home-page book hero ---------- */
.mf-book-hero {
  display: grid;
  grid-template-columns: minmax(13rem, 21rem) minmax(0, 1fr);
  gap: clamp(1.35rem, 3.5vw, 2.5rem);
  align-items: center;
  margin: 0.4rem 0 2rem;
}

.mf-book-intro {
  min-width: 0;
}

.mf-kicker {
  font-size: 1.15em;
  font-style: italic;
  line-height: 1.5;
}

.mf-audience {
  margin-top: 1.75rem;
}

.mf-book-actions {
  margin-top: 1.5rem;
}

/* ---------- 12. Physical-book cover effect ---------- */
.mf-book-cover {
  position: relative;
  display: block;
  width: min(100%, 22rem);
  margin: 0 auto 1.75rem;
  perspective: 900px;
  filter: drop-shadow(0.8rem 1rem 1.15rem rgba(0, 0, 0, 0.48));
}

.mf-book-hero .mf-book-cover {
  margin-bottom: 0;
}

.mf-book-cover::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 0.7%;
  right: -0.42rem;
  width: 0.52rem;
  height: 98.6%;
  border-radius: 0 0.22rem 0.22rem 0;
  background: linear-gradient(
    to right,
    #c9bea5 0%,
    #eee6d4 35%,
    #b4aa94 100%
  );
  box-shadow: inset -1px 0 rgba(0, 0, 0, 0.28);
  transform: skewY(-0.7deg);
}

.mf-book-cover::after {
  content: "";
  position: absolute;
  z-index: -2;
  inset: 2% -0.65rem -0.55rem 3%;
  border-radius: 0.45rem;
  background: rgba(0, 0, 0, 0.32);
  filter: blur(0.45rem);
}

.mf-book-cover img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 0.22rem 0.12rem 0.12rem 0.22rem;
  box-shadow:
    inset 1px 0 rgba(255, 255, 255, 0.10),
    0 0 0 1px rgba(255, 255, 255, 0.045);
  transform: rotateY(-1.4deg) rotateZ(-0.15deg);
  transform-origin: center left;
}

/* ---------- 13. Book title artwork + local mist ---------- */
.mf-book-title {
  margin: 1.1rem 0 1.4rem;
}

.mf-book-title-mist {
  position: relative;
  display: inline-block;
  max-width: 100%;
  padding: 0.75rem 1.35rem;
  isolation: isolate;
}

/* Localized mist preserves the artist's dark title artwork without recoloring it. */
.mf-book-title-mist::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -0.85rem -1.45rem;
  background:
    radial-gradient(ellipse 35% 62% at 12% 58%, rgba(192, 214, 229, 0.46) 0%, rgba(159, 186, 208, 0.18) 58%, transparent 100%),
    radial-gradient(ellipse 46% 74% at 34% 44%, rgba(224, 235, 242, 0.86) 0%, rgba(190, 211, 226, 0.56) 50%, transparent 100%),
    radial-gradient(ellipse 48% 68% at 59% 56%, rgba(214, 229, 238, 0.78) 0%, rgba(170, 198, 216, 0.38) 54%, transparent 100%),
    radial-gradient(ellipse 38% 58% at 82% 39%, rgba(203, 222, 234, 0.58) 0%, rgba(159, 186, 208, 0.22) 57%, transparent 100%),
    radial-gradient(ellipse 24% 48% at 97% 61%, rgba(191, 213, 228, 0.31) 0%, transparent 100%);
  filter: blur(0.58rem);
}

.mf-book-title-image {
  display: block;
  width: 85%;
  max-width: 32rem;
  height: auto;
}

/* ---------- 14. Latest news + reusable cards ---------- */
.mf-latest-news {
  margin-top: 0;
  padding-top: 0;
}

.mf-latest-news > h2 {
  margin-bottom: 1.35rem;
}

.mf-news-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.1rem;
}

.mf-news-card,
.mf-card {
  padding: 1.15rem 1.2rem;
  border: 1px solid var(--mf-border);
  border-radius: 0.8rem;
  background:
    linear-gradient(145deg, rgba(185, 198, 243, 0.035), transparent 45%),
    var(--mf-panel);
  box-shadow: 0 0.65rem 1.5rem rgba(0, 0, 0, 0.14);
}

.mf-news-card h3 {
  margin-top: 0.25rem;
  margin-bottom: 0.5rem;
}

.mf-news-date {
  margin: 0;
  font-size: 0.85rem;
  opacity: 0.75;
}

.mf-news-read-more {
  margin-bottom: 0;
}

.mf-news-more {
  margin-top: 1.4rem;
}

.mf-card-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  gap: 1rem;
}

.mf-card > :first-child {
  margin-top: 0;
}

.mf-card > :last-child {
  margin-bottom: 0;
}

/* ---------- 15. Images and embedded video ---------- */
article img,
.e-content img,
.p-summary img {
  border-radius: 0.45rem;
}

.mf-video,
.mf-embed {
  overflow: hidden;
  border: 1px solid rgba(185, 198, 243, 0.22);
  border-radius: 0.85rem;
  background: rgba(3, 10, 19, 0.72);
  box-shadow: 0 0.7rem 2rem rgba(0, 0, 0, 0.28);
}

.mf-video iframe,
.mf-embed iframe {
  display: block;
  width: 100%;
  max-width: 100%;
  border: 0;
}

/* ---------- 16. Forms ---------- */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="url"],
input[type="tel"],
input[type="search"],
input[type="number"],
textarea {
  color: var(--mf-text);
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(143, 220, 255, 0.45) !important;
}

input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--mf-ghost-light);
  outline-offset: 2px;
}

iframe {
  max-width: 100%;
}

/* Letterbird controls its own internal iframe styling. */
.mf-contact-form iframe {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 0.85rem;
}

/* ---------- 17. Newsletter + footer ---------- */
.mf-newsletter {
  position: relative;
  max-width: 42rem;
  margin: 2.05rem auto 1.6rem;
  padding: 1.45rem;
  border: 1px solid var(--mf-border);
  border-radius: 0.78rem;
  background:
    linear-gradient(to bottom, rgba(159, 186, 208, 0.065), transparent 88%),
    var(--mf-panel);
  text-align: center;
}

.mf-newsletter h2 {
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.mf-newsletter > p {
  margin-top: 0;
}

.mf-newsletter form {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.6rem;
  margin-top: 1rem;
}

.mf-newsletter input[type="email"] {
  flex: 1 1 16rem;
  max-width: 24rem;
  padding: 0.7rem 0.8rem;
  border-radius: 0.4rem;
  font: inherit;
}

.mf-newsletter input[type="submit"],
.mf-newsletter button {
  padding: 0.7rem 1rem;
  border-radius: 0.4rem;
  font: inherit;
  cursor: pointer;
}

footer {
  position: relative;
  color: var(--mf-text-muted);
}

footer::before {
  content: "";
  position: absolute;
  z-index: -1;
  left: -8vw;
  right: -8vw;
  top: -1.6rem;
  height: 5rem;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 28% 55%, rgba(159, 186, 208, 0.08), transparent 56%),
    radial-gradient(ellipse at 72% 45%, rgba(185, 198, 243, 0.07), transparent 54%);
}

.mf-footer-legal {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.25rem 2rem;
  max-width: 50rem;
  margin: 1.4rem auto 0;
  padding-top: 1rem;
  color: rgba(199, 208, 217, 0.82);
  font-size: 0.85rem;
}

.mf-footer-copyright {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.55rem;
  min-width: 0;
}

.mf-footer-author {
  display: inline-flex;
  align-items: center;
  border-radius: 0.25rem;
  text-decoration: none;
}

.mf-footer-author img {
  display: block;
  width: clamp(7.75rem, 14vw, 9rem);
  height: auto;
}

.mf-footer-privacy {
  flex: 0 0 auto;
  white-space: nowrap;
}

.mf-footer-legal a {
  color: inherit;
}

.mf-footer-privacy:hover,
.mf-footer-privacy:focus-visible {
  color: var(--mf-ghost-core);
}

.mf-footer-author:hover img,
.mf-footer-author:focus-visible img {
  filter: drop-shadow(0 0 0.38rem rgba(143, 220, 255, 0.32));
}

/* ---------- 18. Accessibility ---------- */
:focus-visible {
  outline: 2px solid var(--mf-ghost-light);
  outline-offset: 3px;
}

::selection {
  color: var(--mf-night-deep);
  background: var(--mf-ghost-light);
}

/* Avoid introducing motion for visitors who request reduced motion. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- 19. Responsive adjustments ---------- */
@media (max-width: 44rem) {
  body {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  header {
    margin-right: -1rem;
    margin-bottom: 0.8rem;
    margin-left: -1rem;
    padding: 1.25rem 1rem 1.3rem;
  }

  .series-logo img {
    width: min(92vw, 30rem);
  }

  nav {
    margin-top: 0.35rem;
  }

  nav ul {
    gap: 0.32rem 0.4rem;
  }

  nav a,
  nav a:visited {
    padding: 0.34rem 0.52rem 0.34rem 1.18rem;
    background: rgba(4, 18, 31, 0.065);
  }

  nav a[aria-current="page"]::before {
    left: 0.48rem;
    width: 0.44rem;
    height: 0.44rem;
  }

  .mf-book-hero {
    grid-template-columns: 1fr;
    gap: 1.35rem;
    margin-top: 0;
    margin-bottom: 1.65rem;
  }

  .mf-book-cover {
    width: min(78vw, 20rem);
  }

  .mf-book-title {
    margin-top: 0.8rem;
  }

  .mf-book-title-mist {
    padding: 0.65rem 1rem;
  }

  .mf-fade-divider {
    margin-top: 2rem;
    margin-bottom: 1.9rem;
    background: linear-gradient(
      to right,
      transparent,
      rgba(185, 198, 243, 0.24) 15%,
      rgba(143, 220, 255, 0.42) 36%,
      rgba(143, 220, 255, 0.72) 50%,
      rgba(143, 220, 255, 0.42) 64%,
      rgba(185, 198, 243, 0.24) 85%,
      transparent
    );
  }

  .mf-newsletter {
    margin-top: 1.75rem;
  }

  .mf-footer-legal {
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    text-align: center;
  }

  .mf-footer-copyright {
    flex-direction: column;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: center;
    gap: 0.45rem;
  }

  footer .mf-footer-legal .mf-footer-copyright .mf-footer-author {
    display: block !important;
    width: 9.5rem !important;
    max-width: 9.5rem !important;
    height: auto !important;
    overflow: visible !important;
  }

  footer .mf-footer-legal .mf-footer-copyright .mf-footer-author img {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: none !important;
    aspect-ratio: auto !important;
    object-fit: contain !important;
    margin: 0 auto !important;
  }

  .mf-book-title-image {
    width: 92%;
  }

  .mf-news-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 37.5rem) {
  .mf-newsletter form {
    flex-direction: column;
    align-items: stretch;
  }

  .mf-newsletter input[type="email"] {
    width: 100%;
    max-width: none;
  }

  .mf-newsletter input[type="submit"],
  .mf-newsletter button {
    width: 100%;
  }
}

@media (max-width: 28rem) {
  .dlc-main-nav ul {
    gap: 0.24rem;
  }

  .dlc-main-nav-link,
  .dlc-main-nav-link:visited {
    padding-right: 0.44rem;
    padding-left: 1.08rem;
    font-size: 0.88em;
  }

  .dlc-main-nav-current::before,
  .dlc-main-nav-section::before {
    left: 0.43rem;
  }

  .mf-fade-divider {
    width: 90%;
  }
}
