/* The public page, under every template. The server inlines the theme as
   variables (--bg --card --text --muted --line --dot --accent --on-accent --r
   --font); everything here derives from those, so any theme fits any template. */
*, *::before, *::after { box-sizing: border-box; }
:root {
  --soft: color-mix(in srgb, var(--accent) 13%, transparent);
  --soft-2: color-mix(in srgb, var(--accent) 22%, transparent);
  --raised: color-mix(in srgb, var(--card) 94%, var(--text));
  --hair: color-mix(in srgb, var(--line) 70%, transparent);
  /* Corners follow the theme but are capped per size, so "pill" stays sane on big cards. */
  --r-sm: min(var(--r), 10px);
  --r-md: min(var(--r), 16px);
  --r-lg: min(var(--r), 24px);
  --ease: cubic-bezier(.22, .8, .24, 1);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --shadow: 0 1px 2px rgb(15 20 30 / .05), 0 6px 20px -8px rgb(15 20 30 / .14);
  --shadow-lg: 0 2px 4px rgb(15 20 30 / .05), 0 22px 44px -16px rgb(15 20 30 / .28);
}
.is-dark {
  --raised: color-mix(in srgb, var(--card) 90%, var(--text));
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 24px -10px rgb(0 0 0 / .5);
  --shadow-lg: 0 2px 6px rgb(0 0 0 / .3), 0 28px 56px -18px rgb(0 0 0 / .7);
}
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-wrap: anywhere;
}
body.dotted { background-image: radial-gradient(circle, var(--dot) 1px, transparent 1px); background-size: 22px 22px; background-attachment: fixed; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
p, h1, h2, h3 { margin: 0; }
h1, h2, h3 { text-wrap: balance; overflow-wrap: anywhere; }
img { max-width: 100%; }
button { font: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.one-line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.clamp-2 { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.sr-only, .hp { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---- entrance motion: a short rise, staggered by --i. Not in the editor preview,
   which reloads on every keystroke, and never with reduced motion. */
@media (prefers-reduced-motion: no-preference) {
  .rise { animation: rise .6s var(--ease) both; animation-delay: calc(var(--i, 0) * 55ms); }
  .is-preview .rise { animation: none; }
  @keyframes rise { from { opacity: 0; transform: translateY(12px); } }
}

/* ---- avatar & logos ---- */
.avatar { display: block; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: var(--card); box-shadow: 0 0 0 1px var(--hair); }
.avatar-letter { display: inline-grid; place-items: center; background: linear-gradient(140deg, var(--soft-2), var(--soft)); color: var(--accent); font-weight: 700; }
.logo { display: block; border-radius: 22%; object-fit: cover; flex-shrink: 0; background: var(--card); }
.logo-letter { display: inline-grid; place-items: center; font-weight: 700; background: var(--soft); color: var(--accent); }

/* ---- bio ---- */
.bio { color: color-mix(in srgb, var(--text) 86%, var(--muted)); }
.bio p + p { margin-top: .75em; }
/* Each paragraph of maker text takes its own direction, so Arabic or Hebrew reads right to left. */
.bio p, [class*="desc"], [class*="details"], [class*="name"], [class*="title"], h1 { unicode-bidi: plaintext; }
.bio code { font-family: var(--mono); font-size: .88em; background: var(--raised); border: 1px solid var(--hair); padding: 0 5px; border-radius: 5px; }
.bio strong { color: var(--text); }
.loc { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 14px; }
.loc svg { flex-shrink: 0; }

/* ---- status ---- */
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; line-height: 1.5; white-space: nowrap; border: 1px solid; flex-shrink: 0; }
.pill-ok { color: #19703f; background: #e7f6ed; border-color: #b4dfc4; }
.pill-warn { color: #855f12; background: #fbf3df; border-color: #e6d29f; }
.pill-info { color: #1957c2; background: #e8f0fd; border-color: #bcd2f5; }
.pill-bad { color: #ad2a22; background: #fdeceb; border-color: #efbcb8; }
/* Mokxi's dark chip palette, for the dark themes. */
.is-dark .pill-ok { color: #8ee0a1; background: #16271c; border-color: #2d5b3c; }
.is-dark .pill-warn { color: #e6c77a; background: #262013; border-color: #5c4c24; }
.is-dark .pill-info { color: #9cc9ff; background: #14223a; border-color: #284a73; }
.is-dark .pill-bad { color: #ff9a95; background: #2a1514; border-color: #6b2e2b; }

.dot-status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.dot-status i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.tone-ok i { background: #22a35a; box-shadow: 0 0 0 3px rgb(34 163 90 / .16); }
.tone-warn i { background: #d99a1e; box-shadow: 0 0 0 3px rgb(217 154 30 / .16); }
.tone-info i { background: #3b82f6; box-shadow: 0 0 0 3px rgb(59 130 246 / .16); }
.tone-bad i { background: #dc4a40; box-shadow: 0 0 0 3px rgb(220 74 64 / .16); }

/* ---- revenue ---- */
.rev { display: inline-flex; align-items: center; gap: 4px; font-family: var(--mono); font-size: 12.5px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.verified { display: inline-grid; color: var(--accent); }
.total { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 14px; }
.total-label { color: var(--muted); }
.total strong { font-family: var(--mono); font-weight: 600; }

/* ---- tags ---- */
.tags { display: inline-flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.chip { font-size: 12px; line-height: 1.6; padding: 1px 9px; border-radius: 999px; background: var(--soft); color: var(--accent); white-space: nowrap; }

/* ---- screenshots: 16:10, with a drawn stand-in when there is none ---- */
.shot { position: relative; display: block; aspect-ratio: 16 / 10; overflow: hidden; background: var(--raised); }
.shot > img { color: transparent; font-size: 0; position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .6s var(--ease); }
.shot-ph {
  display: grid; place-content: center; justify-items: center; gap: 12px;
  /* A real column width, so the name can use 80% of the card before it truncates. */
  grid-template-columns: minmax(0, 80%);
  background:
    radial-gradient(120% 90% at var(--gx, 15%) var(--gy, 10%), color-mix(in srgb, var(--accent) 34%, transparent), transparent 60%),
    radial-gradient(90% 80% at var(--hx, 100%) var(--hy, 100%), color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
    linear-gradient(var(--ga, 150deg), color-mix(in srgb, var(--card) 80%, var(--accent)), var(--card));
}
.shot-ph[data-seed='1'] { --gx: 90%; --gy: 0%; --hx: 0%; --hy: 100%; --ga: 200deg; }
.shot-ph[data-seed='2'] { --gx: 50%; --gy: 110%; --hx: 50%; --hy: -10%; --ga: 90deg; }
.shot-ph[data-seed='3'] { --gx: 0%; --gy: 60%; --hx: 100%; --hy: 20%; --ga: 240deg; }
.shot-ph[data-seed='4'] { --gx: 70%; --gy: 30%; --hx: 10%; --hy: 90%; --ga: 120deg; }
.shot-ph[data-seed='5'] { --gx: 20%; --gy: 100%; --hx: 90%; --hy: 0%; --ga: 300deg; }
.shot-ph-logo .logo { border-radius: 24%; box-shadow: var(--shadow-lg), 0 0 0 1px var(--hair); }
.shot-ph-name { max-width: 100%; font-weight: 650; font-size: 15px; letter-spacing: -.01em; color: color-mix(in srgb, var(--text) 75%, transparent); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- socials, share, badge ---- */
.socials { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.socials a { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: var(--muted); transition: color .2s, background .2s; }
.socials a:hover { color: var(--accent); background: var(--soft); }

.share {
  width: 40px; height: 40px; display: grid; place-items: center; flex-shrink: 0;
  border: 0; border-radius: 50%; cursor: pointer;
  background: var(--accent); color: var(--on-accent);
  box-shadow: 0 4px 14px -4px color-mix(in srgb, var(--accent) 60%, transparent);
  transition: transform .2s var(--ease), filter .2s;
}
.share:hover { transform: translateY(-1px); filter: brightness(1.08); }
.share:active { transform: scale(.96); }
.share.done { filter: brightness(1.2); }
.share-quiet { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
.share-quiet:hover { color: var(--text); filter: none; }
.share-toast { position: fixed; left: 50%; bottom: 24px; z-index: 50; transform: translate(-50%, 12px); opacity: 0; padding: 9px 16px; border-radius: 999px; background: var(--text); color: var(--bg); font-size: 14px; font-weight: 600; pointer-events: none; transition: opacity .25s, transform .25s var(--ease); }
.share-toast.show { opacity: 1; transform: translate(-50%, 0); }

.badge {
  position: fixed; right: 16px; bottom: 16px; z-index: 20; display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px; border-radius: 999px; font-size: 12.5px; font-weight: 600; text-decoration: none;
  background: color-mix(in srgb, var(--card) 86%, transparent); color: var(--text); border: 1px solid var(--line);
  box-shadow: var(--shadow); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.badge svg { color: var(--accent); }

/* "Discover more makers" under every live page: quiet, and above the badge's corner. */
.discover { display: flex; justify-content: center; padding: 8px 16px 32px; }
.discover.has-badge { padding-bottom: 76px; }
.discover a { font-size: 13px; font-weight: 500; color: var(--muted); text-decoration: none; padding: 6px 12px; border-radius: 999px; transition: color .2s, background .2s; }
.discover a:hover { color: var(--text); background: var(--soft); }

/* ---- subscribe: the same markup in every template ---- */
.sub-h { font-size: 17px; font-weight: 650; letter-spacing: -.01em; }
.sub { min-width: 0; container-type: inline-size; }
/* In a narrow card (a phone, a small tile) the box centres, button under the field. */
@container (max-width: 420px) { .sub-h, .sub-msg, .sub-input { text-align: center; } .sub-link .sub-btn { display: flex; width: 100%; } }
.sub-msg:empty { min-height: 0; margin-top: 0; }
/* Side by side where there is room; in a narrow card the button drops below, full width. */
.sub-form { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; min-width: 0; }
.sub-input {
  flex: 1 1 190px; min-width: 0; height: 46px; padding: 0 15px; font: inherit; font-size: 16px;
  color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-sm);
  transition: border-color .2s, box-shadow .2s;
}
.sub-input::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
.sub-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--soft); }
.sub-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 46px; padding: 0 20px;
  border: 0; border-radius: var(--r-sm); background: var(--accent); color: var(--on-accent);
  font: inherit; font-size: 15px; font-weight: 600; white-space: nowrap; text-decoration: none; cursor: pointer;
  transition: filter .2s, transform .2s var(--ease);
}
.sub-form .sub-btn { flex: 1 0 auto; }
.sub-btn:hover { filter: brightness(1.08); }
.sub-btn:active { transform: scale(.98); }
.sub-btn[disabled] { opacity: .6; cursor: default; }
.sub-link .sub-btn { margin-top: 12px; }
.sub-msg { margin-top: 10px; font-size: 13px; color: var(--muted); min-height: 1.4em; }
.sub.is-ok .sub-msg { color: var(--text); font-weight: 600; }
.sub.is-error .sub-msg { color: #dc4a40; }
.sub.is-ok .sub-form { display: none; }

.empty { color: var(--muted); text-align: center; padding: 32px 16px; border: 1px dashed var(--line); border-radius: var(--r-md); }

/* ---- the confirm / unsubscribe page ---- */
.notice { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.notice-card { width: min(420px, 100%); display: grid; justify-items: center; gap: 12px; text-align: center; padding: 36px 28px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); }
.notice-card h1 { font-size: 24px; letter-spacing: -.02em; margin-top: 6px; }
.notice-card form { width: 100%; }
.notice-btn { display: inline-flex; justify-content: center; width: 100%; margin-top: 10px; padding: 12px 18px; border: 0; border-radius: var(--r-sm); background: var(--accent); color: var(--on-accent); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.notice-link { font-size: 14px; color: var(--muted); }

/* Only the owner sees this, on their own page before they confirm their email. */
.owner-banner { position: sticky; top: 0; z-index: 50; padding: 10px 16px; text-align: center; font: 14px/1.45 system-ui, -apple-system, 'Segoe UI', sans-serif; background: var(--accent); color: var(--on-accent); }
.owner-banner a { color: inherit; font-weight: 600; text-decoration: underline; white-space: nowrap; }

/* ---- a project card with its own page (projectLink in src/templates/parts.ts):
   the card's link is stretched over the whole card, the Stats link sits on top ---- */
.linked { position: relative; }
.card-link { position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.stats-link {
  position: relative; z-index: 2; display: inline-grid; place-items: center; width: 30px; height: 30px; flex-shrink: 0;
  border-radius: 50%; color: var(--muted); box-shadow: inset 0 0 0 1px var(--hair); transition: color .2s, background .2s, box-shadow .2s;
}
.stats-link:hover { color: var(--accent); background: var(--soft); box-shadow: inset 0 0 0 1px transparent; }

/* The mini revenue chart beside a verified figure (miniSpark in src/templates/parts.ts). */
.rev-spark { display: inline-block; vertical-align: middle; flex-shrink: 0; overflow: visible; }
.rev-spark polyline { fill: none; stroke: var(--accent); stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.rev-group { display: inline-flex; align-items: center; gap: 8px; }
.rev-group .rev { margin-left: 0; }
.card-meta .rev-group, .sc-meta .rev-group, .st-meta .rev-group { margin-left: auto; }
