@font-face {
  font-family: "Iosevka Charon";
  src: url("/fonts/iosevka-charon-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Iosevka Charon";
  src: url("/fonts/iosevka-charon-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  --paper:   #fff;
  --paper-2: #eee;
  --paper-3: #8c705f;
  --ink:     #1f0318;
  --ink-2:   #1e1a1d;
  --ink-3:   #8c705f;
  --red:     #7f534b;
  --red-2:   #66423c;
  --green:   #3f6b4f;
  --green-2: #325840;
  --mono: "Iosevka Charon", ui-monospace, Menlo, Consolas, monospace;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--mono);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: clamp(16px, 2.4vw, 40px);
}

a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1.5px solid var(--ink);
}
a:hover {
  color: var(--red);
  border-color: var(--red);
}

/* ---- masthead ---- */

.masthead {
  border-top: 3px solid var(--ink);
  border-bottom: 3px solid var(--ink);
  padding: clamp(10px, 1.4vw, 20px) 0;
  margin-bottom: clamp(18px, 2vw, 30px);
}

.masthead-brand {
  display: flex;
  align-items: center;
  gap: clamp(10px, 1.2vw, 18px);
}

.brand-logo {
  display: block;
  flex-shrink: 0;
}

.brand-logo--head {
  width: clamp(36px, 5.5vw, 68px);
  height: clamp(36px, 5.5vw, 68px);
}

.brand-logo--foot {
  width: clamp(22px, 2.2vw, 30px);
  height: clamp(22px, 2.2vw, 30px);
}

.headline {
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.02;
  font-size: clamp(22px, 4.2vw, 58px);
}

/* ---- marketplace: full-width video, then a 3-up cultivar board ---- */

.market {
  margin-bottom: clamp(18px, 2.4vw, 30px);
}

.brand-video {
  position: relative;
  border: 1.5px solid var(--ink);
  background: var(--ink);
  width: 100%;
  aspect-ratio: 25 / 9;
  overflow: hidden;
}
.brand-video-el {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.brand-video-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 8%;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.3;
  font-size: clamp(19.5px, 3.38vw, 44.2px);
  color: var(--paper);
  /* -webkit-text-stroke: 1px var(--ink); */
  pointer-events: none;
}

.board {
  margin-bottom: clamp(24px, 3.4vw, 44px);
}

.market-intro {
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1.1;
  font-size: clamp(16px, 2vw, 26px);
  border-bottom: 1.5px solid var(--ink);
  padding-bottom: 10px;
  margin-bottom: clamp(14px, 1.8vw, 22px);
}

.grid {
  display: flex;
  gap: 14px;
  align-items: start;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 14px;
  scrollbar-width: thin;
  scrollbar-color: var(--ink) var(--paper-2);
  scroll-snap-type: x mandatory;
}
@media (min-width: 720px) {
  .grid { gap: 16px; }
}

.grid .card {
  flex: 0 0 260px;
  width: 260px;
  scroll-snap-align: start;
}

.see-all-card {
  flex: 0 0 260px;
  width: 260px;
  scroll-snap-align: start;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink);
  background: var(--paper);
  border: 1.5px solid var(--ink);
  height: 230px;
  cursor: pointer;
}
.see-all-card:hover {
  background: var(--ink);
  color: var(--paper);
}

.card {
  border: 1.5px solid var(--ink);
  background: var(--paper-2);
  display: flex;
  flex-direction: column;
  height: 230px;     /* fixed so the price button is always visible */
  overflow: hidden;  /* clip the blurred teaser to the card box */
}

.sample {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 12px;
  font-size: 15px;
  line-height: 1.5;
  word-break: break-word;
  color: var(--ink);
  /* fade the teaser out at the bottom of its window instead of a hard cut */
  -webkit-mask-image: linear-gradient(to bottom, #000 68%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 68%, transparent 100%);
}
.sample .blur {
  filter: blur(4.5px);
  -webkit-filter: blur(4.5px);
  user-select: none;
  -webkit-user-select: none;
  opacity: 0.9;
}

.card-meta {
  display: flex;
  justify-content: space-between;
  padding: 0 12px 8px;
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--ink-3);
}

/* ---- green price button (card + buy-all + modal) ---- */

.price-btn {
  font-family: var(--mono);
  font-weight: 700;
  letter-spacing: 0.03em;
  font-variant-numeric: tabular-nums;
  background: var(--green);
  color: var(--paper);
  border: 1.5px solid var(--ink);
  cursor: pointer;
}
.price-btn:hover { background: var(--green-2); }
.price-btn:disabled { opacity: 0.5; cursor: default; }
.price-btn.danger { background: var(--red); }
.price-btn.danger:hover { background: var(--red-2); }

.card .price-btn {
  border: 0;
  border-top: 1.5px solid var(--ink);
  padding: 12px 8px;
  font-size: clamp(15px, 1.5vw, 20px);
}

/* ---- see all + buy full corpora (stacked under the board) ---- */

.see-all {
  width: 100%;
  margin-top: clamp(16px, 2.2vw, 24px); /* distance from the scroll box */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink);
  background: none;
  border: 1.5px solid var(--ink);
  padding: 11px 12px;
  cursor: pointer;
}
.see-all[hidden] { display: none; }
.see-all:hover { background: var(--ink); color: var(--paper); }
.see-all .chev { font-size: 13px; line-height: 1; }

.buy-all {
  margin-top: 10px;
}
.buy-all[hidden] { display: none; }
.buy-all-btn {
  width: 100%;
  padding: 16px 12px;
  font-size: clamp(15px, 1.6vw, 22px);
  letter-spacing: 0.03em;
}

/* ---- empty state ---- */

.empty {
  grid-column: 1 / -1;
  border: 1.5px dashed var(--ink-3);
  padding: 40px;
  text-align: center;
  color: var(--ink-2);
  line-height: 1.5;
}

/* ---- footer ---- */

.foot {
  margin-top: auto;
  padding-top: clamp(20px, 2.4vw, 40px);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  flex-wrap: wrap;
}

.foot .fine {
  max-width: 64ch;
  font-size: 9px;
  line-height: 1.5;
  color: var(--ink-2);
  letter-spacing: 0.02em;
}

.foot .right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.foot .links {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 11px;
  letter-spacing: 0.04em;
}

.foot .links a {
  font-size: inherit;
  letter-spacing: inherit;
}

.masthead-link {
  text-decoration: none;
  border-bottom: none;
  color: inherit;
}
.masthead-link:hover {
  color: inherit;
  border-color: transparent;
}

/* ---- legal pages (privacy, terms) ---- */

.legal {
  margin: clamp(8px, 1.6vw, 24px) 0 clamp(24px, 4vw, 56px);
}

.legal-title {
  font-size: clamp(24px, 3.4vw, 40px);
  letter-spacing: 0.02em;
  margin-bottom: 4px;
}

.legal-updated {
  font-size: 12px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
  margin-bottom: 24px;
}

.contact-btn {
  background: none;
  border: none;
  font-family: inherit;
  font-size: inherit;
  letter-spacing: inherit;
  color: var(--ink);
  border-bottom: 1.5px solid var(--ink);
  cursor: pointer;
  padding: 0;
}
.contact-btn:hover {
  color: var(--red);
  border-color: var(--red);
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  letter-spacing: 0.12em;
  font-size: clamp(13px, 1.1vw, 18px);
  border-top: 2px solid var(--ink);
  padding-top: 6px;
}

/* ---- prose (about + cultivate) ---- */

.prose {
  max-width: 70ch;
  font-size: clamp(15px, 1.3vw, 18px);
  line-height: 1.7;
}

.prose h2 {
  font-size: clamp(18px, 1.8vw, 26px);
  letter-spacing: 0.02em;
  margin: 28px 0 10px;
}

.prose p {
  margin: 0 0 16px;
  color: var(--ink-2);
}

.prose p:first-of-type {
  color: var(--ink);
}

/* ---- blurred teaser handled above ---- */

/* ---- payment modal ---- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal[hidden] { display: none; }

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(31, 3, 24, 0.55);
}

.modal-panel {
  position: relative;
  width: 100%;
  max-width: 420px;
  max-height: calc(100vh - 32px);
  overflow: auto;
  background: var(--paper);
  border: 3px solid var(--ink);
  display: flex;
  flex-direction: column;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1.5px solid var(--ink);
  padding: 10px 14px;
}
.modal-title {
  font-weight: 700;
  letter-spacing: 0.04em;
  font-size: 14px;
}
.modal-x {
  background: none;
  border: 0;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 20px;
  line-height: 1;
  color: var(--ink);
}

.modal-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.modal-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--ink-2);
}
.modal-field input {
  font-family: var(--mono);
  font-size: 14px;
  padding: 9px 10px;
  border: 1.5px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
}
.modal-field input:focus,
.modal-field textarea:focus {
  outline: 2px solid var(--green);
  outline-offset: -2px;
}

.modal-field input:disabled,
.modal-field textarea:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.modal-note {
  font-size: 12px;
  line-height: 1.4;
  color: var(--ink-3);
}
.modal-note.warn {
  color: var(--red-2);
  font-weight: 700;
}
.modal-error {
  font-size: 12px;
  line-height: 1.4;
  color: var(--red-2);
  min-height: 1em;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 14px 14px;
}
.modal-primary {
  width: 100%;
  padding: 12px 10px;
  font-size: clamp(14px, 1.4vw, 18px);
  letter-spacing: 0.03em;
}
.modal-secondary {
  width: 100%;
  padding: 11px 8px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: var(--paper);
  color: var(--red-2);
  border: 1.5px solid var(--ink);
  cursor: pointer;
}
.modal-secondary:hover { background: var(--red); color: var(--paper); }
.modal-secondary:disabled { opacity: 0.5; cursor: default; }

.modal-success {
  padding: 14px;
  border-top: 1.5px solid var(--ink);
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink);
}

/* ---- corpus browse modal (all data, infinite scroll) ---- */

.corpus-modal { z-index: 45; } /* the payment modal (z 50) can stack above this */

.corpus-panel {
  max-width: 760px;
  width: 100%;
  height: 85vh;
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.corpus-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 22px 14px;
  scrollbar-width: thin;
  scrollbar-color: var(--ink) var(--paper-2);
  /* top/bottom fade is applied dynamically in app.js */
}

.corpus-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
}

.corpus-foot {
  border-top: 1.5px solid var(--ink);
  padding: 12px 14px;
  background: var(--paper);
}

/* ---- "how we cultivate" section ---- */

.cultivate {
  margin-top: clamp(28px, 4vw, 56px);
  border-top: 1.5px solid var(--ink);
  padding-top: clamp(18px, 2vw, 28px);
}
.section-title {
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.1;
  font-size: clamp(18px, 2.4vw, 30px);
}
.section-sub {
  margin-top: 6px;
  font-size: clamp(13px, 1.2vw, 16px);
  letter-spacing: 0.02em;
  color: var(--ink-3);
}
.cultivate-body {
  margin-top: clamp(16px, 2vw, 26px);
  display: grid;
  gap: clamp(16px, 2.4vw, 32px);
}
@media (min-width: 768px) {
  .cultivate-body { grid-template-columns: 1fr 1fr; align-items: start; }
}
.cultivate-photo {
  border: 1.5px solid var(--ink);
  background: var(--paper-2);
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cultivate-photo span {
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ink-3);
}
.cultivate-prose { max-width: none; }
