/* =========================================================
   ZENENE SHARED LAYOUT
   One nav, page heading, footer and motion for every subpage.
   Loaded after each page's own styles, so these win.
   Each page picks its pastel with a body class, e.g.
   <body class="zn zn-mood">
   ========================================================= */

:root {
  --zn-ink: #2f2b27;
  --zn-muted: #77736b;
  --zn-line: rgba(47, 43, 39, 0.1);

  --zn-type: "Special Elite", "Courier New", monospace;
  --zn-serif: "Cormorant Garamond", Georgia, serif;
  --zn-script: "Pinyon Script", cursive;

  --zn-bg: #f5f1ea;
  --zn-accent: #8a7465;

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

/* Same pastel family, a different tint per page */

body.zn-journal { --zn-bg: #f8f2dc; --zn-accent: #9c6b6f; }  /* butter */
body.zn-mood    { --zn-bg: #eef5ec; --zn-accent: #5f7d6a; }  /* green */
body.zn-explore { --zn-bg: #edf4f8; --zn-accent: #4f6b78; }  /* blue */
body.zn-calm    { --zn-bg: #fbf0f1; --zn-accent: #846469; }  /* pink */
body.zn-plain   { --zn-bg: #f5f1ea; --zn-accent: #8a7465; }

/* Vera's signature: bold brown with cream type */
body.zn-vera {
  --zn-bg: #3b2d25;
  --zn-ink: #f7f1e7;
  --zn-muted: rgba(247, 241, 231, 0.62);
  --zn-line: rgba(247, 241, 231, 0.12);
  --zn-accent: #e7b9bd;
}

body.zn-vera .crisis-fab {
  background: #efd9d8;
  color: #392d26;
  border-color: transparent;
}

/* Pages that paint cards with their own background token
   follow the new tint too. */
body.zn {
  --background: var(--zn-bg);

  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;

  margin: 0;
  background: var(--zn-bg);
  color: var(--zn-ink);
  -webkit-font-smoothing: antialiased;
}

body.zn-journal { --paper: var(--zn-bg); }

.zn > main {
  flex: 1 0 auto;
}

/* =========================================================
   NAVIGATION
   ========================================================= */

.zn .top-nav {
  position: sticky;
  top: 0;
  z-index: 500;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;

  min-height: 0;
  margin: 0;
  padding: 20px 34px;
  line-height: 1.2;

  background: color-mix(in srgb, var(--zn-bg) 84%, transparent);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--zn-line);
}

.zn .nav-wordmark {
  flex-shrink: 0;
  color: var(--zn-ink);
  text-decoration: none;
  font-family: var(--zn-type);
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  line-height: 1.2;
  text-transform: uppercase;
}

.zn .nav-links {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 28px;
}

.zn .nav-links a {
  position: relative;
  color: var(--zn-muted);
  text-decoration: none;
  font-family: var(--zn-type);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: color 0.25s ease;
}

.zn .nav-links a::after {
  content: "";
  position: absolute;
  top: auto;
  right: 0;
  bottom: -8px;
  left: 0;
  height: 1px;
  background: var(--zn-accent);
  opacity: 1;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.35s var(--zn-ease);
}

.zn .nav-links a:hover,
.zn .nav-links a.active {
  color: var(--zn-ink);
}

.zn .nav-links a:hover::after,
.zn .nav-links a.active::after {
  transform: scaleX(1);
}

/* =========================================================
   PAGE + HEADING
   Every heading sits in the same spot, at the same size.
   ========================================================= */

.zn .page {
  width: min(1200px, calc(100% - 64px));
  margin: 0 auto;
  padding: 54px 0 0;
}

.zn .page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 40px;
  margin: 0 0 30px;
  padding: 0 0 30px;
  border-bottom: 1px solid var(--zn-line);
}

.zn .page-header .eyebrow {
  margin: 0 0 17px;
  color: var(--zn-muted);
  font-family: var(--zn-type);
  font-size: 0.64rem;
  letter-spacing: 0.12em;
  line-height: 1.7;
  text-transform: uppercase;
}

.zn .page-header h1 {
  margin: 0;
  color: var(--zn-ink);
  font-family: var(--zn-type);
  font-size: clamp(3rem, 7vw, 5.8rem);
  font-weight: 400;
  letter-spacing: -0.065em;
  line-height: 1.02;
}

.zn .page-header h1 em {
  color: var(--zn-accent);
  font-style: normal;
}

.zn .page-header .intro {
  width: min(340px, 100%);
  max-width: none;
  margin: 0 0 4px;
  color: var(--zn-muted);
  font-family: var(--zn-serif);
  font-size: 1.35rem;
  line-height: 1.45;
  text-align: left;
}

.zn .page-header .heading-date {
  display: block;
  margin-top: 12px;
  color: var(--zn-accent);
  font-family: var(--zn-type);
  font-size: 0.64rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* =========================================================
   FOOTER
   ========================================================= */

.zn .site-footer {
  margin-top: 64px;
  padding: 26px 20px 24px;
  border-top: 1px solid var(--zn-line);
  color: var(--zn-muted);
  text-align: center;
}

.zn .site-footer .script {
  margin: 0 0 4px;
  color: var(--zn-accent);
  font-family: var(--zn-script);
  font-size: 2.1rem;
  font-weight: 400;
  line-height: 1.25;
}

.zn .site-footer p {
  margin: 0;
  font-family: var(--zn-type);
  font-size: 0.56rem;
  letter-spacing: 0.09em;
  line-height: 1.8;
  text-transform: uppercase;
}

.zn .site-footer-links {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-top: 10px;
}

.zn .site-footer-links a {
  color: var(--zn-muted);
  text-decoration: none;
  font-family: var(--zn-type);
  font-size: 0.56rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  transition: color 0.25s ease;
}

.zn .site-footer-links a:hover {
  color: var(--zn-ink);
}

/* =========================================================
   CRISIS BUTTON (same on every page)
   ========================================================= */

.zn .crisis-fab {
  position: fixed;
  right: 1.5rem;
  bottom: 1.8rem;
  z-index: 200;
  padding: 10px 15px;
  border: 1px solid var(--zn-line);
  border-radius: 16px 16px 16px 4px;
  background: color-mix(in srgb, var(--zn-bg) 60%, #ffffff);
  color: var(--zn-ink);
  font-family: var(--zn-type);
  font-size: 0.62rem;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(47, 43, 39, 0.08);
  transition: transform 0.25s var(--zn-ease), box-shadow 0.25s ease;
}

.zn .crisis-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(47, 43, 39, 0.12);
}

.zn .overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(47, 43, 39, 0.35);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.zn .overlay.open {
  display: flex;
}

.zn .overlay .modal {
  --zn-ink: #2f2b27;
  --zn-muted: #77736b;

  width: min(420px, 100%);
  padding: 30px;
  border-radius: 20px;
  background: #fcfaf6;
  box-shadow: 0 30px 80px rgba(47, 43, 39, 0.25);
  animation: znRise 0.4s var(--zn-ease) both;
}

.zn .overlay .m-close {
  float: right;
  border: none;
  background: none;
  color: var(--zn-ink);
  font-size: 1.4rem;
  cursor: pointer;
}

.zn .overlay .m-title {
  color: var(--zn-ink);
  font-family: var(--zn-serif);
  font-size: 1.8rem;
}

.zn .overlay .m-sub {
  margin: 8px 0 20px;
  color: var(--zn-muted);
  font-family: var(--zn-type);
  font-size: 0.65rem;
  line-height: 1.7;
}

.zn .overlay .c-link {
  display: block;
  margin-top: 8px;
  padding: 13px;
  border-radius: 12px;
  background: rgba(47, 43, 39, 0.06);
  color: var(--zn-ink);
  text-decoration: none;
  font-family: var(--zn-type);
  font-size: 0.65rem;
  transition: background 0.2s ease;
}

.zn .overlay .c-link:hover {
  background: rgba(47, 43, 39, 0.1);
}

/* =========================================================
   GENTLE MOTION
   ========================================================= */

@keyframes znRise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.zn .page-header > * {
  animation: znRise 0.8s var(--zn-ease) both;
}

.zn .page-header > :nth-child(2) {
  animation-delay: 0.08s;
}

/* zenene-ui.js adds .zn-reveal to sections and .is-in when
   they scroll into view. Without JS nothing is hidden. */
.zn-motion .zn-reveal {
  opacity: 0;
  transform: translateY(14px);
  transition:
    opacity 0.8s var(--zn-ease),
    transform 0.8s var(--zn-ease);
}

.zn-motion .zn-reveal.is-in {
  opacity: 1;
  transform: none;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 1000px) {
  .zn .top-nav {
    padding: 18px 25px;
  }

  .zn .nav-links {
    gap: 17px;
  }
}

@media (max-width: 760px) {
  .zn .top-nav {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 20px 14px;
  }

  .zn .nav-links {
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 10px 16px;
  }

  .zn .nav-links a {
    font-size: 0.6rem;
  }

  .zn .nav-links a::after {
    bottom: -5px;
  }

  .zn .page {
    width: calc(100% - 40px);
    padding-top: 38px;
  }

  .zn .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 24px;
    padding-bottom: 24px;
  }

  .zn .page-header h1 {
    font-size: clamp(2.7rem, 12vw, 4.2rem);
  }

  .zn .page-header .intro {
    width: 100%;
    font-size: 1.2rem;
  }

  .zn .site-footer {
    margin-top: 48px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .zn .page-header > *,
  .zn-motion .zn-reveal {
    animation: none;
    opacity: 1;
    transform: none;
    transition: none;
  }

  .zn .nav-links a::after {
    transition: none;
  }
}

/* =========================================================
   PAGE ENTER / LEAVE
   ========================================================= */

@keyframes znFade {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

body.zn {
  animation: znFade 0.35s ease both;
}

body.zn.is-leaving {
  opacity: 0;
  transition: opacity 0.15s ease;
}

@media (prefers-reduced-motion: reduce) {
  body.zn {
    animation: none;
  }

  body.zn.is-leaving {
    transition: none;
  }
}
