/* ==========================================================
   Nightstand Secrets: shared styles
   Change colors in :root below. Fonts are self hosted in /fonts
   so no outside service ever sees your readers.
   ========================================================== */

@font-face { font-family: "Fraunces"; src: url("fonts/fraunces-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Fraunces"; src: url("fonts/fraunces-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Fraunces"; src: url("fonts/fraunces-500-normal.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Fraunces"; src: url("fonts/fraunces-500-italic.woff2") format("woff2"); font-weight: 500; font-style: italic; font-display: swap; }
@font-face { font-family: "Fraunces"; src: url("fonts/fraunces-600-normal.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Fraunces"; src: url("fonts/fraunces-600-italic.woff2") format("woff2"); font-weight: 600; font-style: italic; font-display: swap; }
@font-face { font-family: "Lora"; src: url("fonts/lora-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Lora"; src: url("fonts/lora-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Lora"; src: url("fonts/lora-600-normal.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Lora"; src: url("fonts/lora-600-italic.woff2") format("woff2"); font-weight: 600; font-style: italic; font-display: swap; }

/* ---------- Color tokens ---------- */
:root {
  --paper: #ECE9E5;      /* warm stone page */
  --paper-2: #E1DBD6;    /* panels */
  --ink: #211C1E;        /* near-black text */
  --ink-soft: #5B5456;   /* secondary text */
  --accent: #7E1F24;     /* oxblood */
  --accent-soft: #B98A8A;
  --line: #D5CEC9;
  --on-accent: #FBF7F5;
  --shadow: rgba(33, 28, 30, .28);
  --display: "Fraunces", Georgia, "Times New Roman", serif;
  --body: "Lora", Georgia, "Times New Roman", serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #161213;
    --paper-2: #211A1C;
    --ink: #EDE6E3;
    --ink-soft: #B1A7A6;
    --accent: #E0706F;
    --accent-soft: #7A4344;
    --line: #33292B;
    --on-accent: #161213;
    --shadow: rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #161213;
    --paper-2: #211A1C;
    --ink: #EDE6E3;
    --ink-soft: #B1A7A6;
    --accent: #E0706F;
    --accent-soft: #7A4344;
    --line: #33292B;
    --on-accent: #161213;
    --shadow: rgba(0, 0, 0, .55);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.125rem;
  line-height: 1.75;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  transition: background-color .4s ease, color .4s ease;
}
img { max-width: 100%; height: auto; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: .2em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--accent); color: var(--on-accent); padding: .5rem 1rem; z-index: 60; }
.skip:focus { left: 1rem; }

.wrap { max-width: 68rem; margin: 0 auto; padding: 0 1.25rem; }
.narrow { max-width: 52rem; }

/* ---------- Header ---------- */
.site-header {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: .75rem 2rem; padding: 1.5rem 0 1rem;
}
.brand {
  display: inline-flex; align-items: center; gap: .55rem;
  font-family: var(--display); font-weight: 600;
  font-size: 1.6rem; letter-spacing: -.01em; line-height: 1; color: var(--ink); text-decoration: none;
}
.brand svg { width: 2.4rem; height: auto; color: var(--accent); }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: .35rem 1.4rem; }
.site-nav a { color: var(--ink-soft); text-decoration: none; font-size: 1rem; padding: .2rem 0; border-bottom: 1px solid transparent; }
.site-nav a:hover { color: var(--ink); }
.site-nav a[aria-current="page"] { color: var(--accent); border-bottom-color: currentColor; }
.theme-toggle {
  font: 400 .95rem/1 var(--body); color: var(--ink-soft);
  background: none; border: 1px solid var(--line); border-radius: 4px;
  padding: .45rem .9rem; cursor: pointer;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--accent-soft); }

/* ---------- Knot ribbon (the signature mark) ---------- */
.knot path { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.knot path + path { opacity: .55; }
.ribbon { display: block; width: 100%; height: auto; margin: 1.75rem 0 2rem; color: var(--accent); }
.ribbon path { stroke-width: 1.4; stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 2.8s cubic-bezier(.45,.05,.25,1) .25s forwards; }
.ribbon path + path { animation-delay: .7s; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) {
  .ribbon path { animation: none; stroke-dashoffset: 0; }
  body { transition: none; }
}

/* ---------- Home hero ---------- */
.hero { padding: clamp(2.5rem, 9vw, 6.5rem) 0 2.5rem; }
.hero h1 {
  font-family: var(--display); font-weight: 400;
  font-size: clamp(2.9rem, 10vw, 7rem); line-height: .98; letter-spacing: -.025em;
  margin: 0; max-width: 11ch;
}
.lede { font-size: 1.25rem; line-height: 1.7; color: var(--ink-soft); max-width: 34rem; margin: 0 0 1.75rem; }
.actions { display: flex; flex-wrap: wrap; gap: .75rem; }
.btn {
  display: inline-block; font: 400 1rem/1 var(--body); text-decoration: none;
  padding: .85rem 1.4rem; border-radius: 4px; border: 1px solid var(--accent);
  background: var(--accent); color: var(--on-accent); cursor: pointer;
}
.btn:hover { filter: brightness(1.08); }
.btn.quiet { background: transparent; color: var(--accent); }

/* ---------- Home: two columns ---------- */
.home-split { display: grid; gap: 3rem; padding: 3rem 0 4rem; border-top: 1px solid var(--line); }
@media (min-width: 54rem) { .home-split { grid-template-columns: 1.45fr 1fr; gap: 4.5rem; align-items: start; } }
.section-title { font-family: var(--display); font-weight: 400; font-size: 2rem; letter-spacing: -.015em; line-height: 1.1; margin: 0 0 .5rem; }
.section-more { font-size: 1rem; margin: 1.25rem 0 0; }

.after-dark { background: var(--paper-2); border-radius: 6px; padding: 2rem 1.75rem 1.75rem; }
.after-dark > p { color: var(--ink-soft); margin: 0 0 .5rem; font-size: 1rem; }

/* ---------- Entry lists ---------- */
.entries { list-style: none; margin: 0; padding: 0; }
.entries li { padding: 1.25rem 0; border-bottom: 1px solid var(--line); }
.entries li:last-child { border-bottom: 0; }
.entry-title { font-family: var(--display); font-weight: 500; font-size: 1.45rem; line-height: 1.15; color: var(--ink); text-decoration: none; }
.entry-title:hover { color: var(--accent); }
.entry-meta { display: block; font-style: italic; font-size: .92rem; color: var(--ink-soft); margin-top: .15rem; }
.entries p { margin: .45rem 0 0; }

/* ---------- Inner page heading ---------- */
.page-head { padding: clamp(2.25rem, 7vw, 4.75rem) 0 1.25rem; }
.page-head h1 { font-family: var(--display); font-weight: 400; letter-spacing: -.02em; font-size: clamp(2.7rem, 8vw, 4.75rem); line-height: 1; margin: 0 0 .9rem; }
.page-head p { max-width: 36rem; color: var(--ink-soft); font-size: 1.18rem; margin: 0; }

/* ---------- Blog list + filters ---------- */
.filters { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem; margin: 1.75rem 0 .5rem; padding: 0; }
.filters button {
  font: 400 .95rem/1 var(--body); color: var(--ink-soft); background: transparent;
  border: 1px solid var(--line); border-radius: 4px; padding: .55rem 1rem; cursor: pointer;
}
.filters button:hover { border-color: var(--accent-soft); color: var(--ink); }
.filters button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.posts { list-style: none; margin: 0 0 4rem; padding: 0; }
.posts li { display: grid; gap: .2rem 2rem; padding: 1.6rem 0; border-bottom: 1px solid var(--line); }
@media (min-width: 46rem) { .posts li { grid-template-columns: 9.5rem 1fr; } }
.posts time { font-style: italic; font-size: .95rem; color: var(--ink-soft); padding-top: .5rem; }
.posts p { margin: .4rem 0 .35rem; }
.tags { font-size: .9rem; color: var(--ink-soft); }
.empty { font-style: italic; color: var(--ink-soft); padding: 2rem 0; }

/* ---------- Erotica: table of contents ---------- */
.toc { list-style: none; margin: 1.5rem 0 4rem; padding: 0; }
.toc li { padding: 1.35rem 0; }
.toc li + li { border-top: 1px solid var(--line); }
.toc .row { display: flex; align-items: baseline; gap: .6rem; }
.toc .row a { font-family: var(--display); font-style: italic; font-weight: 400; font-size: clamp(1.45rem, 4vw, 1.85rem); line-height: 1.15; color: var(--ink); text-decoration: none; }
.toc .row a:hover { color: var(--accent); }
.toc .leader { flex: 1; min-width: 1.5rem; border-bottom: 2px dotted var(--accent-soft); transform: translateY(-.35em); }
.toc .len { white-space: nowrap; font-size: .95rem; color: var(--ink-soft); }
.toc .notes { margin: .3rem 0 0; font-size: .98rem; color: var(--ink-soft); }
.toc .notes em { color: var(--ink); font-style: italic; }

/* ---------- Articles + stories ---------- */
.article { max-width: 38rem; margin: 0 auto; padding: clamp(2rem, 6vw, 4rem) 0 4.5rem; }
.article .back { font-size: .98rem; text-decoration: none; }
.article h1 { font-family: var(--display); font-weight: 400; letter-spacing: -.02em; font-size: clamp(2.2rem, 6.5vw, 3.4rem); line-height: 1.08; margin: 1.25rem 0 .75rem; }
.article .entry-meta { margin-bottom: 2.25rem; }
.article h2 { font-family: var(--display); font-weight: 500; font-size: 1.6rem; line-height: 1.2; margin: 2.5rem 0 .5rem; }
.article p { margin: 0 0 1.3em; }
.article blockquote {
  margin: 2.25rem 0; padding: 0 0 0 1.4rem; border-left: 2px solid var(--accent);
  font-family: var(--display); font-style: italic; font-size: 1.5rem; line-height: 1.35; color: var(--accent);
}
.article blockquote p { margin: 0; }
.article .signoff { font-style: italic; color: var(--ink-soft); }
.story-body { font-size: 1.16rem; line-height: 1.85; }
.story-body > p:first-of-type::first-letter {
  font-family: var(--display); font-weight: 400; color: var(--accent);
  float: left; font-size: 4.2em; line-height: .82; padding: .06em .1em 0 0;
}
.content-note {
  border: 1px solid var(--line); border-radius: 6px; padding: 1rem 1.25rem;
  font-size: .98rem; color: var(--ink-soft); margin: 0 0 2.5rem; background: var(--paper-2);
}
.content-note strong { color: var(--ink); font-weight: 600; }
.scene-break { display: block; width: 4rem; margin: 2.5rem auto; color: var(--accent); }
.placeholder { font-style: italic; color: var(--ink-soft); }
.more-nav { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; border-top: 1px solid var(--line); margin-top: 3rem; padding-top: 1.5rem; font-size: 1rem; }

/* ---------- About ---------- */
.prose { max-width: 38rem; padding-bottom: 4.5rem; }
.prose h2 { font-family: var(--display); font-weight: 500; font-size: 1.6rem; line-height: 1.2; margin: 2.75rem 0 .5rem; }
.prose ul { padding-left: 1.2rem; }
.prose li { margin: .45rem 0; }
.prose li::marker { color: var(--accent); }
.prose dl { margin: 0; }
.prose dt { font-family: var(--display); font-weight: 500; font-size: 1.3rem; margin-top: 1rem; }
.prose dd { margin: 0; }
.intro-line { font-family: var(--display); font-weight: 400; font-size: 1.6rem; line-height: 1.3; margin: 0 0 1.5rem; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 2rem 0 2.5rem; font-size: .95rem; color: var(--ink-soft); }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem 2rem; }
.site-footer p { margin: 0; display: flex; align-items: center; gap: .6rem; }
.site-footer svg { width: 2rem; color: var(--accent); flex: none; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; }
.site-footer a { color: var(--ink-soft); }

/* ---------- 18+ gate ---------- */
.gate { display: none; }
html.gate-on body { overflow: hidden; }
html.gate-on .gate {
  display: grid; place-items: center; position: fixed; inset: 0; z-index: 50; padding: 1.25rem;
  background: rgba(22, 18, 19, .66); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.gate .panel {
  background: var(--paper); color: var(--ink); max-width: 27rem; width: 100%;
  border-radius: 8px; padding: 2.25rem 1.75rem 1.9rem; text-align: center;
  box-shadow: 0 30px 80px var(--shadow);
}
.gate .knot { width: 3.5rem; color: var(--accent); }
.gate h2 { font-family: var(--display); font-weight: 400; font-size: 2rem; line-height: 1.1; margin: .5rem 0 .6rem; }
.gate p { margin: 0 0 1.5rem; color: var(--ink-soft); font-size: 1.02rem; }
.gate .actions { justify-content: center; }

/* ---------- 404 ---------- */
.lost { padding: clamp(3rem, 12vw, 8rem) 0; text-align: center; }
.lost h1 { font-family: var(--display); font-weight: 400; font-size: clamp(2.8rem, 9vw, 5rem); line-height: 1; margin: 0 0 1rem; }
.lost .ribbon { margin: 1.5rem auto 2rem; }

/* ---------- Written together mark ---------- */
.together { display: inline-flex; align-items: center; gap: .4rem; font-size: .9rem; color: var(--accent); white-space: nowrap; }
.together svg { width: 1.6rem; flex: none; }
.entries .together, .posts .together { margin-top: .45rem; }
.posts .tags + .together { margin-left: 1rem; }

/* ---------- Home: topics ---------- */
.topics { border-top: 1px solid var(--line); padding: 3rem 0; }
.topic-list { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: 0 2.5rem; }
@media (min-width: 46rem) { .topic-list { grid-template-columns: repeat(2, 1fr); } }
.topic-list a { display: block; padding: 1rem 0; border-bottom: 1px solid var(--line); text-decoration: none; }
.topic-name { display: block; font-family: var(--display); font-weight: 500; font-size: 1.4rem; line-height: 1.2; color: var(--ink); }
.topic-list a:hover .topic-name { color: var(--accent); }
.topic-desc { display: block; font-size: .98rem; color: var(--ink-soft); margin-top: .2rem; }

/* ---------- Home: the two of us ---------- */
.two-of-us { display: grid; gap: 1.25rem; align-items: center; background: var(--paper-2); border-radius: 6px; padding: 2.25rem 1.75rem; margin: 1rem 0 0; }
@media (min-width: 46rem) { .two-of-us { grid-template-columns: 8rem 1fr; gap: 2.5rem; padding: 2.5rem 2.5rem; } }
.big-knot { width: 8rem; height: auto; color: var(--accent); }
.two-of-us p { margin: .5rem 0 0; max-width: 40rem; }
.two-of-us .together { vertical-align: middle; }

/* ---------- Home: ask ---------- */
.ask { padding: 3.5rem 0 4.5rem; }
.ask p { max-width: 38rem; margin: .5rem 0 0; }

/* ---------- About: FAQ ---------- */
.faq { border-top: 1px solid var(--line); margin-top: 1rem; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
  padding: 1rem 0; font-family: var(--display); font-weight: 500; font-size: 1.25rem; line-height: 1.3; color: var(--ink);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-family: var(--body); font-size: 1.4rem; line-height: 1; color: var(--accent); transition: transform .25s ease; flex: none; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq summary:hover { color: var(--accent); }
.faq details p { margin: 0 0 1.25rem; color: var(--ink-soft); }
@media (prefers-reduced-motion: reduce) { .faq summary::after { transition: none; } }

/* ---------- About: resources ---------- */
.prose ul.resources { list-style: none; padding: 0; margin: 1.25rem 0 0; display: grid; gap: .5rem; }
.resources li { margin: 0; padding: 1.1rem 1.25rem; background: var(--paper-2); border-radius: 6px; }
.res-name { font-family: var(--display); font-weight: 500; font-size: 1.25rem; text-decoration: none; }
.res-name:hover { text-decoration: underline; }
.resources p { margin: .25rem 0 0; font-size: 1rem; }
.resources .res-contact { color: var(--ink-soft); }

/* ---------- About: on this page ---------- */
.on-page { display: none; }
@media (min-width: 64rem) {
  .about-layout { display: grid; grid-template-columns: minmax(0, 38rem) 15rem; gap: 6rem; align-items: start; }
  .on-page { display: block; position: sticky; top: 2rem; font-size: .95rem; border-left: 1px solid var(--line); padding-left: 1.25rem; }
  .on-page p { margin: 0 0 .5rem; font-style: italic; color: var(--ink-soft); }
  .on-page ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
  .on-page a { color: var(--ink-soft); text-decoration: none; }
  .on-page a:hover { color: var(--accent); }
}
.prose h2[id] { scroll-margin-top: 1.5rem; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

.empty-note { font-style: italic; color: var(--ink-soft); margin: 1rem 0 0; }
