/* longform.css */
/* Long-form reading pages that still feel like Field Notes */

:root {
  --link-accent: #6192ff;
  --link-accent-visited: #a77cff;

  --bg: #181818;
  --fg: #ffffff;

  --muted: rgba(255, 255, 255, 0.65);
  --hairline: rgba(255, 255, 255, 0.12);

  --surface: rgba(255, 255, 255, 0.06);
  --surface-border: rgba(255, 255, 255, 0.10);

  --radius: 12px;
  --measure: 62ch;
}

/* Base */
body {
  background: var(--bg);
  color: var(--fg);
  font-family: Inter, Arial, sans-serif;
  margin: 0;
  padding: 2.5rem 1.25rem 4rem;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Container */
#longform-container {
  max-width: min(980px, 100%);
  margin: 0 auto;
  text-align: left;
  line-height: 1.75;
  padding-top: 60px;
}

/* Back link (same behaviour as Field Notes) */
.return-icon {
  position: fixed;
  top: 20px;
  left: 20px;
  color: rgba(255,255,255,0.9);
  text-decoration: none;
  font-size: 1.8em;
  z-index: 100;
  text-shadow: 0 2px 6px rgba(0,0,0,.6);
  transition: transform .2s ease;
}
.return-icon:hover { transform: scale(1.2); }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  border: 0;
  clip: rect(0 0 0 0);
  overflow: hidden;
  white-space: nowrap;
}

/* Watermark (optional but compatible with your existing markup) */
.watermark-group {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  text-align: center;
  line-height: 1.4;
  white-space: nowrap;
}
.watermark {
  text-shadow: 0 0 6px rgba(0,0,0,.4);
  backdrop-filter: blur(1px);
  font-size: 1.2em;
  color: rgba(255,255,255,.3);
  letter-spacing: 2px;
  text-transform: uppercase;
  display: block;
  margin: 0;
}

/* Post surface */
.longform {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
  padding: clamp(22px, 4vw, 44px);
}

/* Title + meta */
.longform-title {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  line-height: 1.2;
  margin: 0 0 0.85rem;
  letter-spacing: -0.01em;
}

.longform-meta {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0 0 1.8rem;
}

.longform-meta a {
  color: inherit;
  text-decoration: none;
  opacity: 0.85;
}
.longform-meta a:hover,
.longform-meta a:focus-visible {
  opacity: 1;
  text-decoration: underline;
}

/* Reading content */
.longform-content {
  max-width: var(--measure);
  margin: 0 auto;
  font-size: 1.05rem;
  line-height: 1.85;
}

.longform-content p {
  margin: 0 0 1.15rem;
}

/* Headings */
.longform-content h2 {
  font-size: 1.15rem;
  letter-spacing: 0.02em;
  margin: 2.2rem 0 0.8rem;
  color: rgba(255,255,255,0.92);
}

.longform-content h3 {
  font-size: 1.05rem;
  margin: 1.8rem 0 0.6rem;
  color: rgba(255,255,255,0.9);
}

/* Links (same underline animation as Field Notes, but dark-safe hover) */
.longform-content a {
  color: var(--link-accent);
  text-decoration: none;
  position: relative;
  transition: color .2s ease;
}
.longform-content a:visited { color: var(--link-accent-visited); }

.longform-content a::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .25s ease;
  opacity: .6;
}

.longform-content a:hover,
.longform-content a:focus-visible { color: rgba(255,255,255,0.95); }

.longform-content a:hover::after,
.longform-content a:focus-visible::after { transform: scaleX(1); opacity: 1; }

/* Lists */
.longform-content ul,
.longform-content ol {
  margin: 0 0 1.2rem 1.25rem;
  padding: 0;
}
.longform-content li { margin: 0.35rem 0; }

/* Quotes */
.longform-content blockquote {
  margin: 1.6rem 0;
  padding: 0.2rem 0 0.2rem 1rem;
  border-left: 2px solid rgba(255,255,255,0.25);
  color: rgba(255,255,255,0.85);
}
.longform-content blockquote p { margin: 0.9rem 0; }

/* Horizontal rule */
.longform-content hr {
  border: 0;
  height: 1px;
  background: var(--hairline);
  margin: 2rem 0;
}

/* Inline code */
.longform-content code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.95em;
  background: rgba(255,255,255,0.08);
  padding: 0.15em 0.35em;
  border-radius: 6px;
}

/* Code blocks */
.longform-content pre {
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 10px;
  padding: 14px 16px;
  overflow: auto;
  margin: 1.4rem 0;
}
.longform-content pre code {
  background: none;
  padding: 0;
  border-radius: 0;
}

/* Images */
.longform-content img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  display: block;
  margin: 1.4rem auto;
  box-shadow: 0 6px 18px rgba(0,0,0,.25);
}

/* Figures */
.longform-content figure {
  margin: 1.6rem 0;
}
.longform-content figcaption {
  color: var(--muted);
  font-size: 0.95rem;
  margin-top: 0.7rem;
  text-align: center;
}

/* Audio (reused styling, tuned for dark surface) */
.audio-wrapper {
  display: flex;
  justify-content: center;
  padding: 0.5em 0;
}

audio {
  width: 240px;
  height: 32px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  backdrop-filter: blur(2px);
  filter: invert(100%) contrast(120%);
  border: none;
  outline: none;
  opacity: 0.95;
}

audio::-webkit-media-controls-panel {
  background-color: transparent;
  border-radius: 6px;
}

audio::-webkit-media-controls-play-button {
  filter: invert(40%);
}

audio::-webkit-media-controls-mute-button,
audio::-webkit-media-controls-volume-slider,
audio::-webkit-media-controls-time-remaining-display {
  display: none;
}

/* Mobile */
@media (max-width: 600px) {
  body {
    padding: 2rem 1rem 3.5rem;
  }

  #longform-container {
    padding-top: 80px;
  }

  .longform {
    padding: 20px;
    border-radius: 14px;
  }

  .longform-content {
    font-size: 1.02rem;
    line-height: 1.9;
    max-width: 100%;
  }

  audio {
    width: 100%;
    max-width: 320px;
  }
}

/* Larger screens */
@media (min-width: 800px) {
  #longform-container {
    max-width: 1100px;
    padding-left: 20px;
    padding-right: 20px;
  }
}

/* Motion preference */
@media (prefers-reduced-motion: reduce) {
  .return-icon:hover { transform: none; }
  .longform-content a::after { transition: none; }
}

.longform-meta {
  color: rgba(255,255,255,0.5);
  font-size: 0.9rem;
  margin: 0 0 1.6rem;
}
