/* ============================================================
   The Wyrd Market — Shared Tokens & Components
   Runestone · light and dark
   ------------------------------------------------------------
   Theming rule: ground and ink trade places, gold stays and
   changes value. Dark ground matches The Wyrd podcast site
   (#0B0D0C ladder) rather than the original spruce greens.
   Never reference a hex in a component — tokens only.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=EB+Garamond:ital,wght@0,400;0,500;0,600;1,400;1,500&family=Inter+Tight:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── Tokens ── */
:root,
[data-theme="dark"] {
  /* Dark — ground from thewyrdpodcast.com */
  --bg:        #0B0D0C;
  --surf:      #141816;
  --surf-2:    #1C201E;
  --line:      #26201A;
  --line-2:    #35302A;
  --ink:       #E9E5DA;
  --ink-mut:   #9A958A;
  --gold:      #C9A96E;
  --gold-ink:  #C9A96E;
  --btn-bg:    #C9A96E;
  --btn-fg:    #12110D;
  --warp:      rgba(201, 169, 110, .07);

  --st-ship-fg: #C9A96E; --st-ship-bg: rgba(201, 169, 110, .16);
  --st-beta-fg: #A8BFB1; --st-beta-bg: rgba(140, 162, 148, .16);
  --st-dev-fg:  #7E9488; --st-dev-bg:  rgba(140, 162, 148, .09);

  --shadow-card: none;
}

[data-theme="light"] {
  --bg:        #ECEEE8;
  --surf:      #FFFFFF;
  --surf-2:    #F4F6F0;
  --line:      #D5DBD2;
  --line-2:    #C6CEC3;
  --ink:       #0F211A;
  --ink-mut:   #5A6D61;
  --gold:      #C9A96E;
  --gold-ink:  #8A6A2C;   /* gold carrying text — bronze, or contrast fails */
  --btn-bg:    #14261C;   /* primary button flips to solid spruce */
  --btn-fg:    #F3F1E7;
  --warp:      rgba(15, 33, 26, .055);

  --st-ship-fg: #7A5D26; --st-ship-bg: rgba(138, 106, 44, .11);
  --st-beta-fg: #1F5E45; --st-beta-bg: rgba(31, 94, 69, .10);
  --st-dev-fg:  #5A6D61; --st-dev-bg:  rgba(90, 109, 97, .09);

  --shadow-card: 0 10px 24px -14px rgba(15, 33, 26, .4);
}

/* Category accents — icon fills and category headers only, never text */
:root {
  --cat-gold:   #C9A96E;
  --cat-spruce: #1F5E45;
  --cat-sage:   #5F8A73;
  --cat-bronze: #B78C5A;
  --cat-sky:    #3D6EB8;
  --cat-violet: #6E4FB0;
  --cat-rowan:  #C02E3C;
  --cat-amber:  #D08A2E;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter Tight', system-ui, sans-serif;
  font-size: 14.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background .25s, color .25s;
}

:focus-visible { outline: 2px solid var(--gold-ink); outline-offset: 2px; }

::selection { background: var(--gold); color: #12110D; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

a { color: inherit; text-decoration: none; }

img { max-width: 100%; display: block; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 0 26px; }

/* ── Type roles ── */
.display {
  font-family: 'EB Garamond', serif;
  font-weight: 500;
  letter-spacing: -.01em;
}
.display em { font-style: italic; color: var(--gold-ink); }

.eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--gold-ink);
}

.mono-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  letter-spacing: .1em;
  color: var(--ink-mut);
}

/* ── Nav ── */
.mk-nav {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 16px 26px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 100;
}
.mk-logo {
  font-family: 'EB Garamond', serif;
  font-size: 19px;
  white-space: nowrap;
  color: var(--ink);
}
.mk-logo em { font-style: italic; color: var(--gold-ink); }
.mk-search {
  flex: 1;
  background: var(--surf);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 13px;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
}
.mk-search::placeholder { color: var(--ink-mut); }
.mk-navlink { font-size: 13px; color: var(--ink-mut); white-space: nowrap; }
.mk-navlink:hover, .mk-navlink.active { color: var(--gold-ink); }

/* ── Buttons ── */
.btn {
  display: inline-block;
  font: inherit;
  font-size: 13.5px;
  padding: 10px 18px;
  border-radius: 7px;
  border: 1px solid var(--line-2);
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { border-color: var(--gold-ink); }
.btn.primary {
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-weight: 600;
  border-color: transparent;
}
.btn.sm { font-size: 13px; padding: 8px 15px; }

/* ── Hero ── */
.mk-hero {
  padding: 52px 0 40px;
  border-bottom: 1px solid var(--line);
  position: relative;
  overflow: hidden;
}
.mk-warp {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(90deg, transparent 0 79px, var(--warp) 79px 80px);
}
.mk-hero .wrap { position: relative; }
.mk-h1 {
  font-family: 'EB Garamond', serif;
  font-weight: 500;
  font-size: clamp(30px, 4.4vw, 50px);
  line-height: 1.06;
  letter-spacing: -.01em;
  margin: 16px 0;
  max-width: 16ch;
}
.mk-h1 em { font-style: italic; color: var(--gold-ink); }
.mk-sub {
  color: var(--ink-mut);
  font-size: 14.5px;
  line-height: 1.6;
  max-width: 47ch;
  margin-bottom: 26px;
}
.mk-cta { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── Sections ── */
.mk-sec { padding: 28px 0 34px; }
.mk-sech {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 18px;
}
.mk-sech h2 {
  font-family: 'EB Garamond', serif;
  font-weight: 500;
  font-size: 21px;
}
.mk-sech .mono-meta { letter-spacing: .1em; }

.mk-prose { max-width: 640px; }
.mk-prose h2 {
  font-family: 'EB Garamond', serif;
  font-weight: 500;
  font-size: 21px;
  margin: 34px 0 11px;
}
.mk-prose p { color: var(--ink-mut); margin-bottom: 14px; }
.mk-prose p strong { color: var(--ink); font-weight: 600; }
.mk-prose a { color: var(--gold-ink); border-bottom: 1px solid var(--line-2); }
.mk-prose a:hover { border-color: var(--gold-ink); }

/* ── Category chips ── */
.mk-strip {
  display: flex;
  gap: 8px;
  padding: 16px 26px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.mk-strip::-webkit-scrollbar { display: none; }
.mk-chip {
  font: inherit;
  font-size: 12px;
  padding: 6px 12px;
  border: 1px solid var(--line-2);
  background: transparent;
  border-radius: 20px;
  color: var(--ink-mut);
  white-space: nowrap;
  cursor: pointer;
}
.mk-chip.on { border-color: var(--gold-ink); color: var(--gold-ink); }

/* ── Listing grid & cards ── */
.mk-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
@media (max-width: 760px) { .mk-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 420px) { .mk-grid { grid-template-columns: 1fr; } }

.mk-card {
  background: var(--surf);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 15px;
  transition: border-color .2s, transform .2s, box-shadow .2s;
}
.mk-card:hover {
  border-color: var(--gold-ink);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}
.mk-icon {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  margin-bottom: 12px;
  display: grid;
  place-items: center;
  font-family: 'EB Garamond', serif;
  font-size: 19px;
  color: #12110D;
}
.mk-icon.on-dark { color: #F1F4EE; }
.mk-name { font-size: 14.5px; font-weight: 600; letter-spacing: -.01em; margin-bottom: 4px; }
.mk-by { font-size: 11.5px; color: var(--ink-mut); }
.mk-desc {
  font-size: 12.5px;
  color: var(--ink-mut);
  line-height: 1.5;
  margin: 8px 0 12px;
  min-height: 38px;
}
.mk-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}
.mk-status {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 3px;
}
.st-ship { background: var(--st-ship-bg); color: var(--st-ship-fg); }
.st-beta { background: var(--st-beta-bg); color: var(--st-beta-fg); }
.st-dev  { background: var(--st-dev-bg);  color: var(--st-dev-fg); }
.st-concept { color: var(--st-dev-fg); }
.mk-price { font-size: 12.5px; }

/* ── Empty state ── */
.mk-empty {
  border: 1px dashed var(--line-2);
  border-radius: 11px;
  padding: 44px 26px;
  text-align: center;
  color: var(--ink-mut);
}
.mk-empty .btn { margin-top: 14px; }

/* ── Footer ── */
.mk-footer {
  border-top: 1px solid var(--line);
  padding: 34px 0 44px;
  color: var(--ink-mut);
  font-size: 12.5px;
}
.mk-footer .wrap { display: flex; justify-content: space-between; gap: 22px; flex-wrap: wrap; }
.mk-footer a { color: var(--ink-mut); }
.mk-footer a:hover { color: var(--gold-ink); }
.mk-footer nav { display: flex; gap: 18px; flex-wrap: wrap; }

/* ── Mobile tab bar (app pages only) ── */
.mk-tabs {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surf);
  border-top: 1px solid var(--line);
  color: var(--ink-mut);
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}
.mk-tab {
  flex: 1;
  text-align: center;
  padding: 11px 4px 12px;
  font-size: 9.5px;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--ink-mut);
  min-height: 44px;
}
.mk-tab i {
  display: block;
  width: 17px;
  height: 17px;
  margin: 0 auto 5px;
  border-radius: 5px;
  border: 1.5px solid currentColor;
  opacity: .5;
}
.mk-tab.on { color: var(--gold-ink); }
.mk-tab.on i { opacity: 1; }

/* ── App-page mobile behavior ── */
@media (max-width: 640px) {
  body.app .mk-tabs { display: flex; }
  body.app { padding-bottom: 70px; }
  body.app .mk-nav { flex-wrap: wrap; }
  body.app .mk-nav .mk-navlink, body.app .mk-nav .btn { display: none; }
  body.app .mk-search { flex-basis: 100%; order: 10; }
  .mk-card:hover { transform: none; }
  .mk-card:active { border-color: var(--gold-ink); }
}

/* ── Forms (submission, settings) ── */
.field { margin-bottom: 22px; }
.field label {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-mut);
  margin-bottom: 8px;
}
.field input, .field textarea, .field select {
  width: 100%;
  background: var(--surf);
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  padding: 11px 14px;
  font: inherit;
  font-size: 14px;
}
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--gold-ink);
  outline: none;
}
.field-hint { font-size: 12.5px; color: var(--ink-mut); margin-top: 6px; }

/* ── Segmented control (theme setting) ── */
.seg {
  display: inline-flex;
  border: 1px solid var(--line-2);
  border-radius: 7px;
  overflow: hidden;
}
.seg button {
  font: inherit;
  font-size: 13px;
  padding: 9px 18px;
  background: transparent;
  border: none;
  color: var(--ink-mut);
  cursor: pointer;
  min-height: 44px;
}
.seg button + button { border-left: 1px solid var(--line-2); }
.seg button[aria-pressed="true"] {
  background: var(--surf-2);
  color: var(--gold-ink);
  font-weight: 600;
}
