:root {
  --bg-page: #f4eee6;
  --bg-card: rgba(255, 252, 248, 0.72);
  --bg-pill: rgba(255, 250, 245, 0.8);
  --border-faint: rgba(75, 53, 35, 0.055);
}

.page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.15rem 1.25rem 0;
}

@media (min-width: 900px) {
  .page {
    padding: 1.45rem 1.25rem 0;
  }
}

.card-indent {
  padding-left: 1.25rem;
}

@media (max-width: 640px) {
  .card-indent {
    padding-left: 0;
  }
}

.section-label {
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 0.95rem;
  line-height: 1;
}

.freewrite-section-title {
  margin: 1.2rem 0 0.6rem 0.18rem;
  font-size: 0.74rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-walnut);
}

.freewrite-entry-list {
  max-width: 64ch;
  margin-left: 0.9rem;
}

.freewrite-entry {
  margin: 0 0 0.92rem;
  color: #6e6157;
}

.freewrite-entry-label {
  display: inline-block;
  margin-right: 0.42rem;
  font-size: 0.68rem;
  line-height: 1.2;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-walnut);
  white-space: nowrap;
  vertical-align: baseline;
}

.freewrite-entry-text {
  display: inline;
  font-size: 1rem;
  line-height: 1.84;
  letter-spacing: -0.004em;
  color: #6e6157;
}

.freewrite-entry.is-featured {
  padding-left: 0.42rem;
  border-left: 2px solid rgba(162, 126, 92, 0.2);
}

.freewrite-entry.is-unlabeled .freewrite-entry-label {
  display: none;
}

.freewrite-entry.is-unlabeled .freewrite-entry-text {
  display: block;
}

@media (max-width: 640px) {
  .freewrite-section-title {
    margin-top: 1rem;
    margin-bottom: 0.55rem;
    font-size: 0.7rem;
    letter-spacing: 0.14em;
  }

  .freewrite-entry-list {
    margin-left: 0.25rem;
  }

  .freewrite-entry {
    margin-bottom: 0.82rem;
  }

  .freewrite-entry-label {
    font-size: 0.62rem;
    letter-spacing: 0.1em;
  }

  .freewrite-entry-text {
    font-size: 0.98rem;
    line-height: 1.78;
  }
}

.free-write-shell {
  max-width: var(--reading-width);
  padding-bottom: 0;
}

.fragment-card {
  border-radius: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-beige);
  box-shadow: none;
  overflow: hidden;
  padding: 1.15rem 1.25rem 1.25rem;
  scroll-margin-top: 6.5rem;
}

.fragment-card.has-margin-notes {
  overflow: visible;
}

/* =========================
   Dog-ear / folded corner
   ========================= */

.fragment-card.dog-eared .fragment-body {
  --dog-ear-size: 4rem;
  position: relative;
  padding-top: 3.6rem;
  overflow: visible;
  isolation: isolate;
}

.fragment-card.dog-eared .fragment-body > *:not(.fragment-dog-ear) {
  position: relative;
  z-index: 2;
}

.fragment-dog-ear {
  position: absolute;
  top: 0;
  right: 0;
  width: calc(var(--dog-ear-size) * 2);
  height: calc(var(--dog-ear-size) * 2);
  pointer-events: none;
  z-index: 10;
  overflow: visible;
}

/* darker underside pocket */
.fragment-dog-ear::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: var(--dog-ear-size);
  height: var(--dog-ear-size);
  clip-path: polygon(100% 0, 0 0, 100% 100%);
  background: linear-gradient(
    135deg,
    rgba(188, 178, 165, 0.96) 0%,
    rgba(170, 159, 146, 0.95) 54%,
    rgba(145, 134, 122, 0.94) 100%
  );
  z-index: 1;
}

/* reflected flap across the crease */
.fragment-dog-ear::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: var(--dog-ear-size);
  height: var(--dog-ear-size);
  clip-path: polygon(0 0, 0 100%, 100% 100%);
  background: linear-gradient(
    135deg,
    rgba(242, 236, 228, 0.98) 0%,
    rgba(231, 223, 212, 0.97) 58%,
    rgba(212, 201, 188, 0.96) 100%
  );
  box-shadow:
    -1px 1px 0 rgba(162, 126, 92, 0.10),
    -6px 8px 12px rgba(58, 48, 40, 0.12);
  z-index: 5;
}

/* tonal shading on flap */
.fragment-dog-ear .dog-ear-shadow {
  position: absolute;
  top: 0;
  right: 0;
  width: var(--dog-ear-size);
  height: var(--dog-ear-size);
  clip-path: polygon(0 0, 0 100%, 100% 100%);
  background: radial-gradient(
    circle at 0% 100%,
    rgba(58, 48, 40, 0.12) 0%,
    rgba(162, 126, 92, 0.08) 34%,
    rgba(255, 255, 255, 0.04) 72%,
    rgba(255, 255, 255, 0) 100%
  );
  opacity: 0.52;
  z-index: 6;
}

/* optional hook if you ever want a visible crease again */
.fragment-dog-ear .dog-ear-crease {
  display: none;
}

@media (max-width: 640px) {
  .fragment-card.dog-eared .fragment-body {
    --dog-ear-size: 3rem;
    padding-top: calc(var(--dog-ear-size) * 0.9);
    padding-right: 0.4rem;
  }
}

.fragment-top {
  display: block;
  margin-bottom: 0.7rem;
}

.fragment-number {
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.85rem;
  line-height: 1;
}

.fragment-title {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.5rem, 2.5vw, 2rem);
  line-height: 1.08;
  font-weight: 300;
  letter-spacing: -0.02em;
  color: #2f251f;
  text-wrap: balance;
}

.fragment-dek {
  margin: 0 0 1.1rem;
  color: #6e6157;
  font-size: 1rem;
  line-height: 1.72;
  letter-spacing: -0.004em;
  max-width: 42rem;
}

.fragment-tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.2rem;
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-pill);
  padding: 0.42rem 0.72rem;
  font-size: 0.64rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #7a6c61;
  border: 1px solid rgba(162, 126, 92, 0.12);
  background: rgba(255, 255, 255, 0.42);
  white-space: nowrap;
}

.fragment-top.with-source {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 170px;
  gap: 1rem;
  align-items: start;
}

.fragment-top.with-source .fragment-heading .fragment-dek {
  margin-top: 1.6rem;
}

.fragment-top.with-source .fragment-heading .fragment-tags {
  margin-top: 0.2rem;
}

.fragment-heading {
  min-width: 0;
}

.fragment-source {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-self: end;
  width: 170px;
  margin-top: 0.15rem;
}

.fragment-source-label {
  display: block;
  margin: 0 0 0.38rem;
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: left;
}

.fragment-source-frame {
  display: block;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(95, 74, 56, 0.10);
  background: rgba(255, 255, 255, 0.34);
  box-shadow: none;
}

.fragment-source-frame img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  filter: saturate(0.82) contrast(0.96) brightness(0.99);
  opacity: 0.92;
}

.fragment-source-caption {
  margin: 0.42rem 0 0;
  font-size: 0.72rem;
  line-height: 1.45;
  color: var(--text-muted);
  text-align: right;
}

.fragment-body {
  position: relative;
  margin-top: 0.95rem;
  margin-left: -1.25rem;
  margin-right: -1.25rem;
  margin-bottom: -1.25rem;
  padding: 1.35rem 1.9rem 1.15rem 1.95rem;
  border-top: 1px solid rgba(81, 60, 44, 0.06);
  background:
    radial-gradient(
      110% 90% at 0% 0%,
      rgba(255, 255, 255, 0.14) 0%,
      rgba(255, 255, 255, 0) 58%
    ),
    linear-gradient(
      180deg,
      rgba(171, 142, 110, 0.02) 0%,
      rgba(171, 142, 110, 0.012) 100%
    ),
    repeating-linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0) 0,
      rgba(255, 255, 255, 0) 37px,
      rgba(125, 98, 72, 0.05) 38px,
      rgba(255, 255, 255, 0) 39px
    ),
    rgba(244, 238, 230, 0.94);
}

.fragment-body::before {
  content: "";
  position: absolute;
  top: 0;
  left: 1.25rem;
  right: 1.25rem;
  height: 1px;
  background: linear-gradient(
    to right,
    rgba(0, 0, 0, 0),
    rgba(70, 48, 30, 0.06) 12%,
    rgba(70, 48, 30, 0.06) 88%,
    rgba(0, 0, 0, 0)
  );
  opacity: 0.55;
}

.fragment-body::after {
  content: "";
  position: absolute;
  top: 1.05rem;
  bottom: 1rem;
  left: 1.15rem;
  width: 1px;
  background: linear-gradient(
    to bottom,
    rgba(162, 126, 92, 0),
    rgba(162, 126, 92, 0.14) 15%,
    rgba(162, 126, 92, 0.14) 85%,
    rgba(162, 126, 92, 0)
  );
  opacity: 0.7;
}

.fragment-body p {
  max-width: 64ch;
  margin: 0 0 1.22rem;
  padding-left: 0.18rem;
  font-size: 1rem;
  line-height: 1.84;
  letter-spacing: -0.004em;
  color: #6e6157;
}

.fragment-body > p:last-child {
  margin-bottom: 0.1rem;
}

.fragment-epigraph {
  position: relative;
  max-width: 38rem;
  margin: 0 0 1.7rem 0.18rem;
  padding: 1.1rem 1.15rem 1rem 1.2rem;
  background:
    radial-gradient(
      120% 120% at 0% 0%,
      rgba(255, 255, 255, 0.22),
      transparent 58%
    ),
    rgba(255, 252, 248, 0.34);
  border: 1px solid rgba(95, 74, 56, 0.08);
  border-left: 2px solid rgba(162, 126, 92, 0.22);
  border-radius: 10px;
}

.fragment-epigraph-mark {
  position: absolute;
  top: 0.32rem;
  left: 0.75rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2.3rem;
  line-height: 1;
  color: rgba(162, 126, 92, 0.34);
  pointer-events: none;
}

.fragment-epigraph-quote {
  margin: 0;
  padding-left: 1.15rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.12rem;
  line-height: 1.68;
  letter-spacing: -0.01em;
  color: #4a3d33;
  text-wrap: balance;
}

.fragment-epigraph-attribution {
  margin-top: 0.7rem;
  padding-left: 1.15rem;
  font-size: 0.68rem;
  line-height: 1.2;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-walnut);
}

.freewrite-entry.has-margin-note {
  position: relative;
}

.margin-note {
  position: absolute;
  top: -0.05rem;
  left: calc(100% + 0.9rem);
  width: 12rem;
  padding: 0.15rem 0.2rem 0.2rem 0.85rem;
  border-left: 2px solid rgba(162, 126, 92, 0.18);
  color: #8a6f5a;
  transform: rotate(-2deg);
}

.margin-note::before {
  content: "";
  position: absolute;
  top: 0.08rem;
  left: 0.12rem;
  right: 0;
  bottom: 0;
  background: rgba(255, 252, 248, 0.12);
  filter: blur(0.2px);
  pointer-events: none;
}

.margin-note-label {
  margin: 0 0 0.12rem;
  font-family: "Caveat", "Bradley Hand", "Segoe Print", "Comic Sans MS", cursive;
  font-size: 0.94rem;
  line-height: 1;
  letter-spacing: 0.01em;
  text-transform: none;
  color: rgba(140, 92, 66, 0.78);
}

.margin-note p {
  margin: 0;
  font-family: "Caveat", "Bradley Hand", "Segoe Print", "Comic Sans MS", cursive;
  font-size: 1.12rem;
  line-height: 1.18;
  letter-spacing: 0.01em;
  color: rgba(126, 92, 72, 0.9);
}

.fragment-update-divider {
  height: 2px;
  margin: 1.2rem 0 0.8rem;
  position: relative;
}

.fragment-update-divider::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 1px;
  background-image: radial-gradient(
    circle,
    rgba(162, 126, 92, 0.45) 1.4px,
    transparent 1px
  );
  background-size: 5px 2px;
  background-repeat: repeat-x;
}

.fragment-update-label {
  margin: 1.15rem 0 0.6rem;
  padding-left: 0.18rem;
  font-size: 0.74rem;
  line-height: 1.2;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-walnut);
  font-weight: 500;
}

.fragment-addendum {
  padding-left: 0.5rem;
  color: #6e6157;
  line-height: 1.52;
  letter-spacing: -0.005em;
}

.fragment-addendum p {
  max-width: 64ch;
  margin: 0 0 0.7rem;
  font-size: 1rem;
  line-height: 1.54;
  letter-spacing: -0.005em;
  color: rgba(58, 48, 40, 0.92);
}

.fragment-addendum p:last-child {
  margin-bottom: 0.1rem;
}

.external-link {
  color: var(--accent-walnut);
  text-decoration: none;
  border-bottom: 1px solid rgba(162, 126, 92, 0.35);
  font-weight: 500;
  transition: border-color 0.18s ease-out, color 0.18s ease-out;
}

.external-link:hover {
  color: var(--text-primary);
  border-bottom-color: var(--accent-walnut);
}

.fragment-pause {
  height: 1.4rem;
}

.fragment-footer {
  margin-top: 2rem;
  padding-left: 0.2rem;
}

.reply-prefix {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-right: 0.4rem;
}

.reply-link {
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.18s ease, border-color 0.18s ease;
}

.reply-link:hover {
  color: var(--accent-walnut);
  border-bottom-color: rgba(162, 126, 92, 0.4);
}

.thesis-block {
  max-width: 64ch;
  margin-left: 0.18rem;
  margin-right: auto;
  position: relative;
  margin: 1.55rem 0 1.8rem;
  padding: 0.85rem 0.9rem 0.85rem 1.1rem;
  background: rgba(255, 252, 248, 0.34);
  border-left: 2px solid rgba(162, 126, 92, 0.26);
}

.thesis-block::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    120% 100% at 0% 0%,
    rgba(255, 255, 255, 0.16),
    transparent 60%
  );
  pointer-events: none;
  opacity: 0.62;
}

.thesis-label {
  margin: 0 0 0.5rem;
  font-size: 0.62rem;
  line-height: 1.2;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.thesis-intro {
  max-width: 62ch;
  margin: 0 0 0.72rem;
  font-size: 1rem;
  line-height: 1.82;
  letter-spacing: -0.004em;
  color: #6e6157;
}

.thesis-list {
  list-style: none;
  margin: 0;
  padding-left: 1.2rem;
}

.thesis-list li {
  position: relative;
  margin: 0 0 0.54rem;
  padding-left: 0.42rem;
  font-size: 1rem;
  line-height: 1.35;
  letter-spacing: -0.004em;
  color: #6e6157;
}

.thesis-list li:last-child {
  margin-bottom: 0;
}

.thesis-list li::before {
  content: "";
  position: absolute;
  left: -0.82rem;
  top: 0.78em;
  width: 0.32rem;
  height: 0.32rem;
  border-radius: 50%;
  background: rgba(162, 126, 92, 0.72);
  transform: translateY(-50%);
}

.thesis-list strong {
  font-weight: 500;
  color: #4c4036;
}

.thesis-development {
  position: relative;
  margin: 1.45rem 0 0.25rem;
  padding-left: 1.55rem;
}

.thesis-section {
  position: relative;
  margin: 0 0 2.35rem;
}

.thesis-section:last-child {
  margin-bottom: 0.35rem;
}

.thesis-section + .thesis-section::after {
  content: "";
  position: absolute;
  left: 1.05rem;
  right: 0;
  top: -1.12rem;
  height: 1px;
}

.thesis-section-label {
  margin: 0 0 0.72rem -1.05rem;
  font-size: 0.72rem;
  line-height: 1.2;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--accent-walnut);
}

.thesis-section p {
  max-width: 62ch;
  margin: 0 0 1rem;
  padding-left: 0;
  font-size: 1rem;
  line-height: 1.84;
  letter-spacing: -0.004em;
  color: #6e6157;
}

.thesis-section p:last-child {
  margin-bottom: 0;
}

.thesis-emphasis {
  margin: 0.18rem 0 1rem;
  font-weight: 600;
  color: #4a3a30;
}

.highlight {
  background: rgba(176, 138, 98, 0.18);
  padding: 0 2px;
  border-radius: 2px;
}

.circled {
  display: inline-block;
  white-space: nowrap;
  padding: 0.06em 0.38em 0.12em;
  border: 1.6px solid rgba(162, 126, 92, 0.42);
  border-radius: 58% 42% 63% 37% / 45% 55% 40% 60%;
  line-height: 1.15;
  box-shadow: 0 0 0 1px rgba(162, 126, 92, 0.14);
  vertical-align: baseline;
}

.page-end-spacer {
  height: 1.6rem;
}

.free-write-footer {
  max-width: var(--max-width-wide, 1000px);
  margin: 0 auto;
  padding: 1.5rem 1.25rem 2.5rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

@media (max-width: 1100px) {
  .margin-note {
    position: static;
    width: auto;
    margin: 0.5rem 0 0 1.2rem;
    padding: 0.1rem 0 0 0.7rem;
    transform: rotate(-1deg);
  }
}

@media (min-width: 900px) {
  .page-end-spacer {
    height: 2.2rem;
  }
}

@media (max-width: 640px) {
  .page {
    padding: 1.1rem 1rem 0;
  }

  .fragment-card {
    padding: 0.95rem 1rem 1.05rem;
    border-radius: 18px;
  }

  .fragment-title {
    font-size: clamp(2.55rem, 9vw, 3.05rem);
    line-height: 0.96;
    letter-spacing: -0.035em;
    text-wrap: balance;
  }

  .fragment-dek {
    font-size: 1rem;
    line-height: 1.58;
    max-width: 20rem;
  }

  .fragment-top.with-source {
    display: block;
    margin-bottom: 0.5rem;
  }

  .fragment-top.with-source .fragment-heading .fragment-dek {
    margin-top: 1rem;
    margin-bottom: 0.95rem;
    max-width: 19rem;
    font-size: 0.98rem;
    line-height: 1.62;
  }

  .fragment-top.with-source .fragment-heading .fragment-tags {
    margin-top: 0;
    margin-bottom: 0.95rem;
  }

  .fragment-source {
    width: 124px;
    margin-top: 0;
    justify-self: auto;
    align-self: auto;
  }

  .fragment-source-label {
    margin: 0 0 0.32rem;
    font-size: 0.58rem;
    letter-spacing: 0.16em;
    opacity: 0.82;
  }

  .fragment-source-frame {
    border-radius: 10px;
  }

  .fragment-source-frame img {
    aspect-ratio: 4 / 5;
  }

  .fragment-body {
    margin-left: -1rem;
    margin-right: -1rem;
    margin-bottom: -1.05rem;
    padding: 1.15rem 1.05rem 0.95rem 1.3rem;
    background:
      linear-gradient(
        180deg,
        rgba(171, 142, 110, 0.04) 0%,
        rgba(171, 142, 110, 0.02) 100%
      ),
      repeating-linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0) 0,
        rgba(255, 255, 255, 0) 34px,
        rgba(125, 98, 72, 0.055) 35px,
        rgba(255, 255, 255, 0) 36px
      ),
      rgba(244, 238, 230, 0.95);
  }

  .fragment-body::before {
    left: 0.95rem;
    right: 0.95rem;
  }

  .fragment-body::after {
    left: 0.82rem;
  }

  .fragment-body p {
    font-size: 0.98rem;
    line-height: 1.78;
  }

  .fragment-epigraph {
    margin-bottom: 1.45rem;
    padding: 0.95rem 0.95rem 0.9rem 1rem;
  }

  .fragment-epigraph-mark {
    top: 0.26rem;
    left: 0.62rem;
    font-size: 2rem;
  }

  .fragment-epigraph-quote {
    padding-left: 1rem;
    font-size: 1.02rem;
    line-height: 1.62;
  }

  .fragment-epigraph-attribution {
    padding-left: 1rem;
    font-size: 0.64rem;
    letter-spacing: 0.13em;
  }

  .fragment-card.has-margin-notes {
    overflow: visible;
  }

  .freewrite-entry.has-margin-note {
    position: relative;
  }

  .margin-note {
    margin: 0.45rem 0 0 1rem;
    padding-left: 0.6rem;
    transform: none;
  }

  .margin-note::before {
    display: none;
  }

  .margin-note-label {
    font-size: 0.88rem;
  }

  .margin-note p {
    font-size: 1.02rem;
    line-height: 1.16;
  }

  .fragment-update-label {
    margin-top: 1rem;
    font-size: 0.71rem;
  }

  .fragment-addendum p {
    font-size: 0.98rem;
    line-height: 1.5;
  }

  .thesis-block {
    margin: 1.35rem 0 1.55rem;
    padding: 0.88rem 0.85rem 0.88rem 1rem;
  }

  .thesis-intro {
    font-size: 0.98rem;
    line-height: 1.76;
  }

  .thesis-list {
    padding-left: 1.05rem;
  }

  .thesis-list li {
    font-size: 0.98rem;
    line-height: 1.76;
  }

  .thesis-list li::before {
    left: -0.72rem;
    width: 0.28rem;
    height: 0.28rem;
  }

  .thesis-development {
    margin-top: 1.2rem;
    padding-left: 1.1rem;
  }

  .thesis-section {
    margin-bottom: 2rem;
  }

  .thesis-section + .thesis-section::after {
    left: 0.75rem;
    top: -0.96rem;
  }

  .thesis-section-label {
    margin: 0 0 0.62rem -0.72rem;
    font-size: 0.67rem;
    letter-spacing: 0.14em;
  }

  .thesis-section p,
  .thesis-emphasis {
    font-size: 0.98rem;
    line-height: 1.78;
  }

  .free-write-footer {
    padding: 1.6rem 1rem 2rem;
  }
}