/* Deckle — pen and wash on cold-press paper. */

:root {
  --paper: #FBF8F1;
  --paper-warm: #F5EFE3;
  --ink: #3A2E27;
  --ink-soft: #66574C;
  --pencil: #9A8B7E;
  --wash-lilac: #B9B6D3;
  --wash-sage: #9DB58E;
  --wash-wood: #B98C62;
  --plum: #8B3F7C;
  --plum-deep: #6F3063;
  --leaf-ink: #3F5E3A;
  --danger: #9A3B2E;

  --hand: "Caveat", "Segoe Print", cursive;
  --serif: "Cormorant Garamond", Georgia, serif;
  --body: "EB Garamond", Georgia, serif;
  --gutter: 1.25rem;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.15rem;
  line-height: 1.65;
  background-color: var(--paper);
  /* cold-press tooth */
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='260' height='260'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .35  0 0 0 0 .3  0 0 0 0 .25  0 0 0 .045 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--wash-lilac); color: var(--ink); }
:focus-visible { outline: 2px dashed var(--plum); outline-offset: 4px; }

a { color: var(--plum); text-underline-offset: .2em; text-decoration-thickness: 1px; }
a:hover { color: var(--plum-deep); }

h1, h2, h3 { margin: 0; font-family: var(--serif); font-weight: 500; line-height: 1.08; text-wrap: balance; }
h1 { font-size: clamp(2.8rem, 7vw, 5rem); letter-spacing: -0.01em; }
h2 { font-size: clamp(2rem, 4vw, 2.8rem); }
h3 { font-size: 1.45rem; font-weight: 600; }
p { margin: 0 0 1rem; max-width: 60ch; }

.hand { font-family: var(--hand); font-weight: 500; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* svg ink + wash helpers */
.ink { fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ink-thin { fill: none; stroke: var(--ink); stroke-width: 1.1; stroke-linecap: round; stroke-linejoin: round; }
.wash { filter: url(#wc); }
.bloom { filter: url(#bloom); }

/* header */
.site-head {
  width: 100%; max-width: 1100px; margin: 0 auto;
  padding: 1.4rem var(--gutter);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.wordmark { font-family: var(--hand); font-size: 2.1rem; line-height: 1; color: var(--ink); text-decoration: none; }
.head-nav { display: flex; align-items: center; gap: 1.4rem; font-size: 1.05rem; }
.head-nav a { color: var(--ink-soft); text-decoration: none; }
.head-nav a:hover { color: var(--ink); text-decoration: underline; }

/* buttons: a pressed plum wash with a pencil edge */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: .65rem 1.5rem;
  font-family: var(--body); font-size: 1.1rem; font-weight: 500;
  color: #FFF9F0; background: var(--plum);
  border: 1.5px solid var(--ink); border-radius: 255px 18px 225px 18px / 18px 225px 18px 255px;
  text-decoration: none; cursor: pointer;
  box-shadow: 2px 3px 6px -3px rgba(58, 46, 39, .45);
  transition: background-color 200ms var(--ease), transform 200ms var(--ease);
}
.btn:hover { background: var(--plum-deep); color: #FFF9F0; transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: wait; transform: none; }
.btn-small { min-height: 40px; padding: .4rem 1.1rem; font-size: 1rem; }
.head-nav a.btn, .head-nav a.btn:hover { color: #FFF9F0; text-decoration: none; }

/* form */
.signup { margin-top: 2rem; max-width: 480px; }
.signup label { display: block; margin-bottom: .35rem; font-family: var(--hand); font-size: 1.35rem; color: var(--ink-soft); }
.field-row { display: flex; flex-wrap: wrap; gap: .7rem; }
input[type="email"] {
  flex: 1 1 230px; min-width: 0; min-height: 48px;
  padding: .6rem 1rem; font: inherit; font-size: 1.1rem; color: var(--ink);
  background: rgba(255, 255, 255, .55);
  border: 1.5px solid var(--pencil);
  border-radius: 14px 225px 14px 255px / 255px 14px 225px 14px;
}
input[type="email"]:focus { outline: none; border-color: var(--ink); background: #fff; }
input::placeholder { color: var(--ink-soft); }
.form-note { margin: .6rem 0 0; min-height: 1.5em; font-size: 1rem; color: var(--ink-soft); }
.form-note.is-error { color: var(--danger); }
.form-note.is-ok { color: var(--leaf-ink); }

/* hero */
.hero {
  width: 100%; max-width: 1100px; margin: 0 auto;
  padding: clamp(1.5rem, 5vw, 4rem) var(--gutter) clamp(3rem, 7vw, 5rem);
  display: grid; gap: 2rem; align-items: center;
  overflow-x: clip;
}
.lede { margin-top: 1.3rem; font-size: 1.3rem; color: var(--ink-soft); max-width: 40ch; }
.fine { margin-top: 1.2rem; font-size: 1rem; color: var(--ink-soft); }
.hero-art { margin: 0; justify-self: center; width: min(100%, 420px); }
.hero-art svg { display: block; width: 100%; height: auto; overflow: visible; }

/* sections */
.section { width: 100%; max-width: 1100px; margin: 0 auto; padding: clamp(3rem, 7vw, 5rem) var(--gutter); }
.section-head { display: flex; align-items: flex-end; gap: 1rem; margin-bottom: 2.25rem; }
.section-head svg { flex: 0 0 auto; width: 74px; height: auto; }

/* pencil rule between sections */
.rule { display: block; width: min(560px, 80%); height: 14px; margin: 0 auto; color: var(--pencil); }

/* the month, as three sketches */
.month { display: grid; gap: 2.5rem; list-style: none; margin: 0; padding: 0; }
.month li { display: grid; grid-template-columns: 96px 1fr; gap: 1.25rem; align-items: start; }
.month svg { width: 96px; height: auto; }
.month .when { display: block; font-family: var(--hand); font-size: 1.35rem; color: var(--plum); line-height: 1; margin-bottom: .2rem; }
.month p { margin: .35rem 0 0; color: var(--ink-soft); }

/* planned features: a handwritten list on paper */
.planned { position: relative; max-width: 720px; }
.planned .note { font-family: var(--hand); font-size: 1.4rem; color: var(--ink-soft); margin-bottom: 1.5rem; }
.planned ul { list-style: none; margin: 0; padding: 0; }
.planned li { padding: .9rem 0 .9rem 2.2rem; border-bottom: 1px dashed var(--pencil); position: relative; }
.planned li::before {
  content: ""; position: absolute; left: .2rem; top: 1.35rem; width: 14px; height: 14px;
  border: 1.4px solid var(--ink); border-radius: 50% 40% 55% 45%;
  background: radial-gradient(circle at 40% 40%, rgba(157, 181, 142, .75), rgba(157, 181, 142, .25) 70%);
}
.planned strong { font-family: var(--serif); font-size: 1.3rem; font-weight: 600; }
.planned span { color: var(--ink-soft); }

/* price: a postcard */
.postcard {
  position: relative; max-width: 620px;
  display: grid; gap: 1.5rem;
  padding: clamp(1.75rem, 5vw, 2.75rem);
  background: #FFFDF8;
  border: 1.5px solid var(--ink);
  border-radius: 6px 3px 7px 4px;
  box-shadow: 3px 5px 14px -8px rgba(58, 46, 39, .45);
}
.postcard .stamp { position: absolute; top: 1.1rem; right: 1.1rem; width: 74px; height: auto; transform: rotate(4deg); }
.amount { font-family: var(--serif); font-size: clamp(3rem, 7vw, 3.8rem); color: var(--plum); line-height: 1; }
.per { font-family: var(--hand); font-size: 1.4rem; color: var(--ink-soft); }
.postcard ul { margin: 0; padding-left: 1.1rem; color: var(--ink-soft); }
.postcard li { margin-bottom: .3rem; }

/* faq */
.faq details { border-bottom: 1px dashed var(--pencil); padding: 1rem 0; max-width: 62ch; }
.faq summary { position: relative; padding-right: 2rem; font-family: var(--serif); font-size: 1.4rem; font-weight: 600; cursor: pointer; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: .2rem; font-family: var(--hand); font-size: 1.8rem; line-height: 1; color: var(--plum); }
.faq details[open] summary::after { content: "–"; }
.faq details p { margin: .6rem 0 0; color: var(--ink-soft); }

/* closing */
.closing { display: grid; gap: 2rem; align-items: center; }
.closing svg { width: min(260px, 70%); height: auto; justify-self: center; }
.closing p { color: var(--ink-soft); }

/* footer */
.site-foot {
  width: 100%; max-width: 1100px; margin: 0 auto;
  padding: 2rem var(--gutter) 2.5rem;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1rem;
  font-size: 1rem; color: var(--ink-soft);
}
.site-foot a { color: var(--ink-soft); }

/* small pages */
.login { max-width: 480px; margin: 0 auto; padding: clamp(2rem, 8vw, 5rem) var(--gutter); text-align: left; }
.login svg { width: 150px; height: auto; margin-bottom: 1rem; }
.login .lede { margin-bottom: 0; }

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
  .draw path.ink, .draw path.ink-thin { stroke-dasharray: 1200; stroke-dashoffset: 1200; animation: draw 2.4s var(--ease) forwards; }
  .draw .wash, .draw .bloom { opacity: 0; animation: soak 1.6s var(--ease) .9s forwards; }
}
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes soak { to { opacity: 1; } }

@media (max-width: 560px) {
  .head-nav .hide-sm { display: none; }
  .month li { grid-template-columns: 72px 1fr; }
  .month svg { width: 72px; }
  .postcard .stamp { width: 56px; }
}

@media (min-width: 880px) {
  .hero { grid-template-columns: 1.05fr .95fr; gap: 3rem; }
  .month { grid-template-columns: repeat(3, 1fr); gap: 2rem; }
  .month li { grid-template-columns: 1fr; }
  .month svg { width: 150px; height: 112px; }
  .closing { grid-template-columns: 1.2fr .8fr; }
}

.closing h2 { margin-bottom: .8rem; }

/* ---------- creator dashboard ---------- */
.quiet { font-family: var(--sans); font-size: .9rem; color: var(--ink-soft); }
.dash { max-width: 760px; margin: 0 auto; padding: clamp(2rem, 6vw, 3.5rem) var(--gutter) 4rem; width: 100%; }
.dash h1 { font-size: clamp(2.2rem, 5vw, 3.2rem); margin-bottom: .6rem; }
.dash .lede { margin-bottom: 2rem; }
.sub-h { font-size: 1.6rem; margin: 2.4rem 0 .8rem; }
.field {
  display: block; width: 100%; max-width: 480px; margin: .3rem 0 1.25rem;
  padding: .6rem .9rem; font: inherit; font-size: 1.1rem; color: var(--ink);
  background: rgba(255, 255, 255, .55); border: 1.5px solid var(--pencil);
  border-radius: 12px 200px 12px 220px / 200px 12px 220px 12px;
}
textarea.field { resize: vertical; }
.field:focus { outline: none; border-color: var(--ink); background: #fff; }
.dash label { display: block; font-family: var(--hand); font-size: 1.3rem; color: var(--ink-soft); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin: 0 0 1rem; }
.stats div { border-top: 1px solid var(--rule); padding-top: .6rem; }
.stats dt { font-family: var(--hand); font-size: 1.25rem; color: var(--ink-soft); }
.stats dd { margin: .1rem 0 0; font-family: var(--serif); font-size: 2rem; color: var(--ink); }
.subs { list-style: none; padding: 0; margin: 0; }
.dash [hidden] { display: none !important; }
@media (max-width: 560px) { .stats { grid-template-columns: 1fr; } }

/* list actions: CSV and labels */
.list-actions { margin: 0 0 1.2rem; }
.list-buttons { display: flex; flex-wrap: wrap; gap: .7rem; }
.list-actions .fine { margin-top: .7rem; }
.btn-quiet { color: var(--ink); background: transparent; box-shadow: none; }
.btn-quiet:hover { color: var(--ink); background: rgba(185, 182, 211, .3); transform: none; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { color: var(--danger); }

/* subscriber rows */
.subs > li.sub { padding: 1rem 0; border-top: 1px dashed var(--pencil); }
.sub p { margin: 0; max-width: none; }
.sub-name { font-family: var(--serif); font-size: 1.3rem; font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; }
.sub-status { font-size: 1rem; color: var(--ink-soft); margin-top: .15rem; }
.sub-addr { font-size: .95rem; color: var(--ink-soft); margin-top: .2rem; overflow-wrap: anywhere; }
.sub-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .7rem; }
.sub.is-cancelled .sub-name,
.sub.is-cancelled .sub-status,
.sub.is-cancelled .sub-addr { color: var(--pencil); }
.sub.is-cancelled .sub-name { text-decoration: line-through; text-decoration-thickness: 1px; }

/* inline edit form inside a row */
.sub-edit { margin-top: .9rem; padding: 1rem 1rem .8rem; background: rgba(255, 255, 255, .45); border: 1px dashed var(--pencil); border-radius: 10px; }
.sub-edit .field { max-width: none; margin-bottom: 1rem; }
.sub-edit .addr-row .field { margin-bottom: 1rem; }
.sub-edit .sub-actions { margin-top: .2rem; }
.sub-danger { margin-top: 1rem; padding-top: .8rem; border-top: 1px dashed var(--pencil); }
.sub-edit .form-note { margin-top: .7rem; }

@media (max-width: 560px) {
  .list-buttons .btn { width: 100%; }
  .sub-actions .btn { flex: 1 1 auto; }
  .sub-danger .btn { width: 100%; }
}

/* keep the labels and export buttons inside 375px */
.dash { overflow-wrap: break-word; }

/* ---------- phone: bigger touch targets ---------- */
@media (max-width: 560px) {
  .head-nav a:not(.btn) { display: inline-flex; align-items: center; min-height: 44px; padding: 0 .35rem; }
  .btn-small { min-height: 44px; }
  .site-foot a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 .35rem; }
  .wordmark { min-height: 44px; display: inline-flex; align-items: center; }
  .field, input[type="email"] { font-size: 16px; }
  .fine a, .lede a { padding: .25rem 0; display: inline-block; }
  .faq summary { min-height: 44px; display: flex; align-items: center; }
}

/* ---------- join page ---------- */
.join { max-width: 560px; margin: 0 auto; padding: clamp(2rem, 6vw, 3.5rem) var(--gutter) 3rem; width: 100%; }
.join h1 { font-size: clamp(2.2rem, 5vw, 3rem); margin-bottom: .5rem; }
.join .lede { margin-bottom: .75rem; }
.join-form { margin-top: 1.5rem; }
.join-form .field { max-width: none; }
.addr-row { display: grid; grid-template-columns: 1fr; gap: 0 .9rem; }
.addr-row .field { max-width: none; }
.join-form .btn { margin-top: .4rem; }
.join-form .btn:disabled { opacity: .55; }
@media (min-width: 560px) {
  .addr-row { grid-template-columns: 2fr .7fr 1fr; }
}

/* ---------- legal pages ---------- */
.legal { max-width: 680px; margin: 0 auto; padding: clamp(2rem, 6vw, 3.5rem) var(--gutter) 4rem; width: 100%; }
.legal h1 { font-size: clamp(2.4rem, 6vw, 3.4rem); margin-bottom: .4rem; }
.legal h2 { font-size: 1.6rem; margin: 2.2rem 0 .6rem; }
.legal p, .legal li { color: var(--ink); }
.legal ul { padding-left: 1.2rem; }
.legal .updated { font-family: var(--sans); font-size: .9rem; color: var(--ink-soft); margin-bottom: 1.5rem; }
.draft-banner {
  margin: 0 0 1.5rem; padding: .8rem 1rem;
  font-family: var(--sans); font-size: .92rem;
  background: #F3E7C9; color: #4D3A1E;
  border: 1px dashed #B98C62; border-radius: 6px;
}

/* ---------- club insights ---------- */
.insights { margin: 0 0 1rem; }
.insights .sub-h { margin-top: 2.4rem; }
.insights-body { display: grid; gap: 1.6rem; }
.insight-block { border-top: 1px solid var(--pencil); padding-top: .9rem; }
.insight-block h3 { font-size: 1.35rem; margin-bottom: .5rem; }
.insight-block p:last-child { margin-bottom: 0; }

.insight-figures { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem 1.2rem; margin: 0; }
.insight-figures > div { border-top: 1px solid var(--rule, var(--pencil)); padding-top: .6rem; }
.insight-figures dt { font-family: var(--hand); font-size: 1.25rem; color: var(--ink-soft); }
.insight-figures dd { margin: .1rem 0 0; font-family: var(--serif); font-size: 2rem; color: var(--ink); }
@media (min-width: 560px) { .insight-figures { grid-template-columns: repeat(4, 1fr); } }

.insight-chart { display: block; width: 100%; max-width: 520px; height: auto; overflow: visible; }
.insight-base { stroke: var(--ink); stroke-width: 1; }
.insight-bar { fill: var(--wash-lilac); }
.insight-bar.is-current { fill: var(--plum); }
.insight-count { fill: var(--ink); font-family: var(--serif); font-size: 15px; }
.insight-month { fill: var(--ink-soft); font-family: var(--body); font-size: 14px; }

.mailing .mail-count { font-family: var(--serif); font-size: 1.5rem; color: var(--ink); margin-top: .2rem; }
.progress { position: relative; height: 10px; max-width: 420px; margin: .5rem 0 .8rem; border: 1px solid var(--ink); border-radius: 6px; background: rgba(255, 255, 255, .55); overflow: hidden; }
.progress-fill { height: 100%; background: var(--plum); }
.insight-note { margin-top: 0; }
/* ---------- join page profile ---------- */
.club-cover { margin: 0 0 1.5rem; }
.club-cover[hidden], .club-about[hidden], .club-inside[hidden], .club-links[hidden] { display: none; }
.club-cover img {
  display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover;
  background: var(--paper-warm);
  border: 1.5px solid var(--ink); border-radius: 10px 4px 12px 6px;
  box-shadow: 3px 5px 14px -8px rgba(58, 46, 39, .45);
}
.club-about { margin-top: 1.6rem; }
.club-about p { margin-bottom: .9rem; }
.club-inside { margin-top: 1.6rem; }
.club-inside .sub-h { margin-top: 0; font-size: 1.45rem; }
.club-inside ul { margin: 0; padding-left: 1.2rem; color: var(--ink-soft); }
.club-inside li { margin-bottom: .3rem; overflow-wrap: anywhere; }
.club-links { display: flex; flex-wrap: wrap; gap: .3rem 1.4rem; margin-top: 1.6rem; }
.club-links a { display: inline-flex; align-items: center; min-height: 44px; font-size: 1.1rem; overflow-wrap: anywhere; }

/* dashboard editor: profile.js fills #profile */
.profile { max-width: 100%; padding: 0; margin: 2.5rem 0 0; overflow-wrap: anywhere; }
.profile[hidden] { display: none !important; }
.profile .profile-intro { margin-bottom: .6rem; color: var(--ink-soft); }
.profile .field { max-width: 100%; }
.profile textarea.field { min-height: 6rem; }
.profile input[type="file"].field { min-height: 48px; padding: .5rem .6rem; font-size: 1rem; }
.profile .profile-hint { margin: -.8rem 0 1.25rem; font-size: .98rem; }
.profile .cover-preview {
  display: block; width: min(100%, 320px); height: auto; aspect-ratio: 3 / 2; object-fit: cover;
  margin: 0 0 1rem; background: var(--paper-warm);
  border: 1.5px solid var(--ink); border-radius: 10px 4px 12px 6px;
}
.profile .cover-preview[hidden] { display: none; }
.profile .check-row {
  display: flex; align-items: flex-start; gap: .7rem;
  min-height: 44px; margin: .2rem 0 1.1rem;
  font-family: var(--body); font-size: 1.1rem; color: var(--ink); cursor: pointer;
}
.profile .check-row input { flex: 0 0 auto; width: 22px; height: 22px; margin: .2rem 0 0; accent-color: var(--plum); }
.profile .profile-buttons { display: flex; flex-wrap: wrap; gap: .7rem; margin: .2rem 0 .6rem; }
.profile .btn, .profile .btn-small { min-height: 44px; }
.profile .profile-form { margin-top: 1.2rem; }
.profile .profile-form .btn { margin-top: .4rem; }
.profile .btn:disabled { opacity: .55; cursor: wait; transform: none; }
@media (max-width: 560px) {
  .profile .profile-buttons .btn { flex: 1 1 auto; }
}
/* ---------- subscriber history ---------- */
.sub .sub-events { font-size: .95rem; color: var(--ink-soft); margin-top: .15rem; }
.sent-toggle.is-sent,
.sent-toggle.is-sent:hover {
  color: var(--plum-deep); background: rgba(139, 63, 124, .14);
  border-color: var(--plum); box-shadow: none; transform: none;
}
.sub-history { margin-top: .9rem; padding: .2rem 0 .2rem 1.1rem; border-left: 1px dashed var(--pencil); }
.sub-history .history-add { margin-bottom: 1rem; }
.sub-history .history-add .field { max-width: none; margin-bottom: 1rem; }
.sub-history .form-note { margin-top: .5rem; }
.sub-history .history { list-style: none; margin: 0; padding: 0; }
.sub-history .history-item { padding: .65rem 0; border-bottom: 1px dotted var(--pencil); }
.sub-history .history-item:last-child { border-bottom: 0; }
.sub-history .history-date { display: block; font-family: var(--hand); font-size: 1.2rem; line-height: 1.2; color: var(--ink-soft); }
.sub-history .history-text { margin: .15rem 0 0; max-width: none; overflow-wrap: anywhere; }
.sub-history .history-text.is-note { font-family: var(--body); white-space: pre-wrap; }
.sub-history .fine { margin-top: .4rem; }
.sub-history .history-item .sub-actions { margin-top: .3rem; }
