/* =========================================================================
   writing.css — page-specific styles for the Writing page
   Reuses palette, fonts, and shared components from styles.css.
   Signature: paper-stack backdrop in hero + self-drawing underline.
   ========================================================================= */


/* ── HERO with paper stack ──────────────────────────────────────── */
.writing-hero {
  position: relative;
  max-width: 1280px;
  margin: 2rem auto 3rem;
  padding: clamp(3rem, 9vh, 6rem) 2rem clamp(3rem, 7vh, 4rem);
  text-align: center;
  z-index: 5;
  overflow: visible;
}

/* Scattered paper sheets sitting behind the title */
.paper-stack {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.paper-stack__sheet {
  position: absolute;
  background: var(--cream);
  box-shadow: 0 24px 48px -24px rgba(43, 38, 32, 0.22),
              0 1px 3px rgba(43, 38, 32, 0.05);
  border: 1px solid rgba(107, 98, 86, 0.08);
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0 30px,
    rgba(107, 98, 86, 0.06) 31px
  );
}
.paper-stack__sheet--1 {
  width: 300px; height: 400px;
  top: 10px; left: 7%;
  transform: rotate(-8deg);
}
.paper-stack__sheet--2 {
  width: 340px; height: 440px;
  top: 60px; right: 6%;
  transform: rotate(6deg);
  background-color: #FBF4E5;
}
.paper-stack__sheet--3 {
  width: 260px; height: 360px;
  bottom: 10px; left: 22%;
  transform: rotate(-3deg);
  background-color: #FAF5EA;
}

/* Faint pen scribbles on each sheet (decorative) */
.paper-stack__sheet svg {
  position: absolute;
  inset: 12% 14% auto 14%;
  width: 72%;
  height: auto;
  opacity: 0.35;
}

.writing-hero__inner {
  position: relative;
  z-index: 2;
  display: inline-block;
}
.writing-hero__kicker {
  font-family: var(--hand);
  font-size: 1.5rem;
  color: var(--brass);
  margin: 0 0 0.4rem;
  transform: rotate(-1deg);
  display: inline-block;
  letter-spacing: 0.01em;
}
.writing-hero__title {
  font-family: var(--hand);
  font-weight: 500;
  font-size: clamp(4rem, 11vw, 7.5rem);
  line-height: 1;
  color: var(--ink);
  margin: 0;
  transform: rotate(-1deg);
  position: relative;
  padding-bottom: 0.2em;
}
.writing-hero__underline {
  display: block;
  width: 100%;
  height: 18px;
  margin: -8px auto 0;
}
.writing-hero__underline path {
  fill: none;
  stroke: var(--brass);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-dasharray: 600;
  stroke-dashoffset: 600;
  animation: draw-underline 1.8s ease-out 0.4s forwards;
}
@keyframes draw-underline {
  to { stroke-dashoffset: 0; }
}

.writing-hero__sub {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.1rem;
  color: var(--driftwood);
  margin: 1.2rem auto 0;
  opacity: 0.88;
  max-width: 540px;
}


/* ── INTRO PARAGRAPH ────────────────────────────────────────────── */
.writing-intro {
  max-width: 640px;
  margin: 0 auto 3rem;
  padding: 0 2rem;
  text-align: center;
  position: relative;
  z-index: 5;
}
.writing-intro p {
  font-family: var(--serif);
  font-size: 1.12rem;
  line-height: 1.85;
  color: var(--ink);
  margin: 0;
}


/* ── TAG FILTER BAR ─────────────────────────────────────────────── */
.tag-bar {
  max-width: 1100px;
  margin: 1.5rem auto 4rem;
  padding: 0 2rem;
  text-align: center;
  position: relative;
  z-index: 5;
}
.tag-bar__list {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  list-style: none;
  margin: 0;
  padding: 0;
}
.tag {
  font-family: var(--sans);
  font-size: 0.84rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  color: var(--ink);
  background: var(--cream);
  border: 1px solid rgba(107, 98, 86, 0.18);
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-block;
  text-decoration: none;
}
.tag:hover { background: var(--brass); color: var(--cream); border-color: var(--brass); }
.tag.is-active { background: var(--ink); color: var(--cream); border-color: var(--ink); }


/* ── SECTION SHELL ──────────────────────────────────────────────── */
.writing-section {
  max-width: 1200px;
  margin: 4rem auto;
  padding: 0 2rem;
  position: relative;
  z-index: 5;
}
.writing-section__head {
  text-align: center;
  margin-bottom: 2.5rem;
}
.writing-section__kicker {
  font-family: var(--hand);
  font-size: 1.25rem;
  color: var(--brass);
  margin: 0;
  display: inline-block;
  transform: rotate(-1deg);
}
.writing-section__title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  margin: 0.3rem 0 0;
  color: var(--ink);
}
.writing-section__title::after {
  content: "";
  display: block;
  width: 48px;
  height: 1.5px;
  background: var(--brass);
  margin: 0.8rem auto 0;
  opacity: 0.6;
}


/* ── ESSAY CARD ─────────────────────────────────────────────────── */
.essay-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2.5rem 2rem;
}
.essay-card {
  position: relative;
  background: var(--cream);
  border: 1px solid rgba(107, 98, 86, 0.08);
  box-shadow: 0 22px 40px -22px rgba(43, 38, 32, 0.18),
              0 1px 2px rgba(43, 38, 32, 0.04);
  transition: transform 0.4s ease, box-shadow 0.4s ease;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  display: block;
}
.essay-card:hover {
  transform: translateY(-4px) !important;
  box-shadow: 0 32px 56px -24px rgba(43, 38, 32, 0.28),
              0 1px 2px rgba(43, 38, 32, 0.04);
}

/* Very subtle alternating tilts for scrapbook feel */
.essay-grid > .essay-card:nth-child(3n+1) { transform: rotate(-0.5deg); }
.essay-grid > .essay-card:nth-child(3n+2) { transform: rotate(0.3deg); }
.essay-grid > .essay-card:nth-child(3n+3) { transform: rotate(-0.2deg); }

.essay-card__cover {
  height: 200px;
  background: var(--cream);
  position: relative;
  overflow: hidden;
}
.essay-card__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.6s ease;
}
.essay-card:hover .essay-card__cover img {
  transform: scale(1.03);
}

.essay-card__body {
  padding: 1.4rem 1.4rem 1.5rem;
}
.essay-card__tag {
  font-family: var(--hand);
  font-size: 1rem;
  color: var(--brass);
  margin-bottom: 0.4rem;
  letter-spacing: 0.02em;
}
.essay-card__title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.3rem;
  line-height: 1.3;
  margin: 0 0 0.7rem;
  color: var(--ink);
}
.essay-card__excerpt {
  font-family: var(--serif);
  font-size: 0.96rem;
  line-height: 1.65;
  color: var(--driftwood);
  margin: 0 0 1rem;
}
.essay-card__meta {
  font-family: var(--sans);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--driftwood);
  opacity: 0.65;
  text-transform: uppercase;
}


/* ── NEWSLETTER INLINE BAND ─────────────────────────────────────── */
.news-band {
  max-width: 1100px;
  margin: 5rem auto;
  padding: 3.5rem 2rem;
  position: relative;
  z-index: 5;
  text-align: center;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(184, 134, 11, 0.06) 0%, transparent 65%),
    var(--cream);
  border-radius: 4px;
  border: 1px dashed rgba(107, 98, 86, 0.2);
}
.news-band__kicker {
  font-family: var(--hand);
  font-size: 1.35rem;
  color: var(--brass);
  margin: 0 0 0.4rem;
  display: inline-block;
  transform: rotate(-1deg);
}
.news-band h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.6rem, 2.8vw, 2.2rem);
  margin: 0.1rem 0 0.7rem;
  color: var(--ink);
}
.news-band p {
  font-family: var(--serif);
  font-size: 1.05rem;
  color: var(--driftwood);
  max-width: 520px;
  margin: 0 auto 1.4rem;
  line-height: 1.7;
}
.news-band .news-form {
  max-width: 440px;
  margin: 0 auto;
  justify-content: center;
}


/* ── THEME GRID ─────────────────────────────────────────────────── */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.4rem;
}
.theme-card {
  position: relative;
  background: var(--cream);
  padding: 1.5rem 1.3rem 1.4rem;
  border-radius: 3px;
  box-shadow: 0 14px 28px -18px rgba(43, 38, 32, 0.2);
  border: 1px solid rgba(107, 98, 86, 0.08);
  text-align: left;
  transition: transform 0.4s ease, box-shadow 0.4s ease;
  text-decoration: none;
  color: inherit;
  display: block;
}
.theme-card:nth-child(4n+1) { transform: rotate(-0.6deg); }
.theme-card:nth-child(4n+2) { transform: rotate(0.4deg); }
.theme-card:nth-child(4n+3) { transform: rotate(-0.3deg); }
.theme-card:nth-child(4n+4) { transform: rotate(0.5deg); }
.theme-card:hover {
  transform: translateY(-3px) !important;
  box-shadow: 0 22px 38px -18px rgba(43, 38, 32, 0.26);
}

.theme-card__dot {
  display: inline-block;
  width: 28px; height: 4px;
  border-radius: 2px;
  background: var(--brass);
  margin-bottom: 0.7rem;
}
.theme-card--travel   .theme-card__dot { background: #6FA28B; }
.theme-card--becoming .theme-card__dot { background: #9D8AB8; }
.theme-card--parent   .theme-card__dot { background: #C95C5C; }
.theme-card--books    .theme-card__dot { background: #B8860B; }
.theme-card--playtime .theme-card__dot { background: #4F7A4A; }

.theme-card__title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.3rem;
  margin: 0;
  color: var(--ink);
}
.theme-card__desc {
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--driftwood);
  margin: 0.5rem 0 0;
  opacity: 0.9;
}


/* ── "All essays" closing link ──────────────────────────────────── */
.all-essays {
  text-align: center;
  margin: 4rem auto 5rem;
  z-index: 5;
  position: relative;
  padding: 0 2rem;
}
.all-essays a {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.2rem;
  border-bottom: 1px solid var(--brass);
  padding-bottom: 0.2rem;
  opacity: 0.9;
}


/* ── RESPONSIVE ─────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .essay-grid { grid-template-columns: repeat(2, 1fr); }
  .theme-grid { grid-template-columns: repeat(2, 1fr); }
  .paper-stack__sheet--1 { width: 220px; height: 300px; left: 2%; }
  .paper-stack__sheet--2 { width: 240px; height: 320px; right: 2%; }
  .paper-stack__sheet--3 { width: 200px; height: 270px; left: 30%; bottom: 0; }
}

@media (max-width: 760px) {
  .writing-hero { padding: 2.5rem 1rem 2rem; }
  .paper-stack { display: none; }
  .writing-hero__title { font-size: clamp(3rem, 14vw, 4.5rem); }
  .writing-hero__sub { font-size: 1rem; }
  .writing-intro { padding: 0 1.2rem; }
  .tag-bar { padding: 0 1rem; }
  .tag-bar__list { gap: 0.4rem; }
  .tag { font-size: 0.78rem; padding: 0.38rem 0.85rem; }

  .essay-grid { grid-template-columns: 1fr; gap: 1.8rem; }
  .essay-grid > .essay-card { transform: none !important; }
  .essay-card:hover { transform: translateY(-2px) !important; }

  .theme-grid { grid-template-columns: 1fr; gap: 1rem; }
  .theme-card { transform: none !important; }

  .writing-section { margin: 3rem auto; padding: 0 1rem; }
  .news-band { margin: 3rem 1rem; padding: 2.5rem 1.4rem; }
}

@media (prefers-reduced-motion: reduce) {
  .writing-hero__underline path { animation: none; stroke-dashoffset: 0; }
}


/* ── EMPTY STATE (no posts yet or empty category) ──────────────── */
.writing-empty {
  max-width: 640px;
  margin: 2rem auto 4rem;
  padding: 2.5rem 2rem;
  text-align: center;
  font-family: var(--serif);
  color: var(--driftwood);
  background: rgba(255,255,255,0.5);
  border-radius: 12px;
  border: 1px dashed rgba(107,98,86,0.25);
}
.writing-empty p { margin: 0 0 0.8rem; line-height: 1.6; }
.writing-empty p:last-child { margin-bottom: 0; }
.writing-empty a { color: var(--brass); text-decoration: none; border-bottom: 1px solid currentColor; }
.writing-empty a:hover { opacity: 0.7; }
