/* Flea share pages: "market flyer" design (LOG 056). Plain CSS, no
   framework. Colours and fonts are custom properties on :root; a theme
   only redefines tokens (LOG 059). */

:root {
  color-scheme: light dark;
  --bg: #f7f6f1;
  --surface-2: #efede6;
  --text: #1f1d1a;
  --muted: #6b675f;
  --line: #e2ddd2;
  --accent: #f2b92b;
  --accent-ink: #1f1d1a;
  --free: #3f7f3d;
  --reserved: #c8412f;
  --stamp-bg: rgb(255 255 255 / 0.88);
  --num-bg: #1f1d1a;
  --num-ink: #f2b92b;
  --radius: 12px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: ui-rounded, "SF Pro Rounded", system-ui, sans-serif;
}

/* Header band and date chip; defaults derive from the accent. */
:root {
  --poster-bg: var(--accent);
  --poster-ink: var(--accent-ink);
  --kicker-ink: inherit;
  --chip-bg: var(--accent-ink);
  --chip-ink: var(--accent);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161513;
    --surface-2: #2b2925;
    --text: #f3f1ec;
    --muted: #a39e94;
    --line: #3a3630;
    --free: #8fc98a;
    --reserved: #f08a78;
    --stamp-bg: rgb(22 21 19 / 0.88);
    --num-bg: #f2b92b;
    --num-ink: #1f1d1a;
  }
}

/* Themes chosen by the sender (share.theme). Both are fixed: they don't
   follow the viewer's light/dark setting. [data-theme] outranks the plain
   :root in the prefers-color-scheme block, so these tokens win in both. */
:root[data-theme="bright"] {
  color-scheme: light;
  --bg: #ffffff;
  --surface-2: #edf4f8;
  --text: #10202b;
  --muted: #5a6b77;
  --line: #d6e1e9;
  --accent: #36b4f2;
  --accent-ink: #0b1f2b;
  --poster-bg: linear-gradient(135deg, #8fdcff 0%, #f7bfe0 36%, #ffc48f 68%, #bff0d4 100%);
  --poster-ink: #0b1f2b;
  --kicker-ink: inherit;
  --chip-bg: #0b1f2b;
  --chip-ink: #ffffff;
  --free: #12884f;
  --reserved: #e0453a;
  --stamp-bg: rgb(255 255 255 / 0.9);
  --num-bg: #0b1f2b;
  --num-ink: #8fdcff;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #22252b;
  --surface-2: #30343c;
  --text: #f4f4f6;
  --muted: #a6abb7;
  --line: #3b3f48;
  --accent: #ff6fae;
  --accent-ink: #1b1d22;
  /* A fine pink dot grid on top of a grey gradient. */
  --poster-bg:
    radial-gradient(circle, rgb(255 111 174 / 0.28) 1.1px, transparent 1.6px) 0 0 / 14px 14px,
    linear-gradient(160deg, #474c57 0%, #2a2d34 100%);
  --poster-ink: #ffffff;
  --kicker-ink: #ff6fae;
  --chip-bg: #ff6fae;
  --chip-ink: #1b1d22;
  --free: #7ee0a0;
  --reserved: #ff7a6b;
  --stamp-bg: rgb(34 37 43 / 0.9);
  --num-bg: #ff6fae;
  --num-ink: #1b1d22;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.5 var(--font);
}

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

a {
  color: inherit;
}

button {
  font: inherit;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

/* Header band: the share's title on the accent colour, in light and dark. */
.poster {
  background: var(--poster-bg);
  color: var(--poster-ink);
  padding: 28px 18px 22px;
}

.poster .inner,
main {
  max-width: 620px;
  margin: 0 auto;
}

.kicker {
  margin: 0;
  color: var(--kicker-ink);
  font: 800 0.78rem var(--font-display);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1 {
  margin: 8px 0 12px;
  font: 800 2.4rem/1.05 var(--font-display);
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.intro {
  margin: 0 0 14px;
  font-size: 1.05rem;
  white-space: pre-line;
}

.until {
  display: inline-block;
  margin: 0;
  padding: 5px 12px;
  border-radius: 6px;
  background: var(--chip-bg);
  color: var(--chip-ink);
  font: 700 0.9rem var(--font-display);
}

main {
  padding: 6px 16px 40px;
}

.hint {
  margin: 14px 0 6px;
  color: var(--muted);
  font-size: 0.88rem;
}

/* One item: photo on the left, text on the right, dashed rule between. */
.row {
  position: relative;
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 14px;
  padding: 14px 0;
  border-bottom: 2px dashed var(--line);
}

.row:last-of-type {
  border-bottom: 0;
}

.num {
  position: absolute;
  z-index: 1;
  top: 8px;
  left: -6px;
  padding: 3px 8px;
  border-radius: 0 8px 8px 0;
  background: var(--num-bg);
  color: var(--num-ink);
  font: 800 0.82rem var(--font-display);
}

.pic {
  position: relative;
  width: 104px;
  height: 104px;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface-2);
}

.pic a,
.pic img {
  width: 100%;
  height: 100%;
}

.pic img {
  object-fit: cover;
}

.more {
  position: absolute;
  right: 5px;
  bottom: 5px;
  padding: 1px 6px;
  border-radius: 6px;
  background: rgb(0 0 0 / 0.6);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  pointer-events: none;
}

.empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.75rem;
  text-align: center;
}

.stamp {
  position: absolute;
  top: 50%;
  left: 50%;
  padding: 1px 6px;
  border: 2px solid var(--reserved);
  border-radius: 5px;
  background: var(--stamp-bg);
  color: var(--reserved);
  font: 800 0.72rem var(--font-display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  transform: translate(-50%, -50%) rotate(-10deg);
  pointer-events: none;
}

.reserved .pic img {
  filter: grayscale(0.6);
}

.head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

h2 {
  margin: 0;
  font: 750 1.08rem/1.25 var(--font-display);
  overflow-wrap: anywhere;
}

.price {
  font: 800 1.15rem var(--font-display);
  white-space: nowrap;
}

.price.free {
  color: var(--free);
  font-size: 0.95rem;
}

.facts {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.details {
  margin: 4px 0 0;
  font-size: 0.95rem;
  white-space: pre-line;
}

.take {
  margin-top: 8px;
  padding: 6px 12px;
  border: 2px solid var(--text);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}

footer {
  margin-top: 24px;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}

/* Static pages: gone, imprint, privacy. */
.page h2 {
  margin: 1.5rem 0 0.5rem;
  font-size: 1.35rem;
}

.page h3 {
  margin: 1.25rem 0 0.25rem;
  font: 750 1.05rem/1.3 var(--font-display);
}

.page p {
  margin: 0 0 0.75rem;
}

.page article + article {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 2px dashed var(--line);
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
