/* trending — a short-video meme feed where every post is a shirt that expires.
   Two voices: the FEED (posts, captions) speaks meme; the STORE (panel, bag,
   policies) speaks like a shop. The only signal color is the live red. */
:root {
  --ink: #111111;
  --ink-2: #3a3a3a;
  --mute: #737373;
  --line: #e7e5e1;
  --paper: #ffffff;
  --paper-2: #f7f6f3;
  --live: #fe2c2c;
  --top: 64px;
  --mtabs: 0px;
  --radius: 14px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  font-family: 'TikTok Sans', system-ui, -apple-system, sans-serif;
  font-optical-sizing: auto;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { overflow: hidden; background: var(--paper); }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 6px; }
.ico { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ── top bar: the month is a story progress bar ──────────────────────────── */
.topbar {
  position: fixed; inset: 0 0 auto 0; height: var(--top); z-index: 20;
  background: var(--paper); border-bottom: 1px solid var(--line); padding: 8px 24px 0;
}
.segments { display: flex; gap: 2px; height: 3px; }
.seg { flex: 1; background: var(--line); border-radius: 2px; overflow: hidden; }
.seg i { display: block; height: 100%; width: 0; background: var(--ink); }
.seg.is-today i { background: var(--live); }
.topline { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; height: calc(var(--top) - 11px); }
.brand {
  display: inline-flex; align-items: center; gap: 7px; text-decoration: none; justify-self: start;
  font-weight: 800; font-size: 21px; letter-spacing: -0.045em;
}
.brand .ico { width: 22px; height: 22px; stroke-width: 2.6; }
.countdown { margin: 0; display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.live-pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700;
  color: var(--live); letter-spacing: .01em;
}
.live-pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--live); animation: blink 1.6s steps(1) infinite; }
@keyframes blink { 50% { opacity: .25; } }
.cd-label { font-size: 13px; color: var(--mute); }
.cd-time { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.cd-time .u { font-size: 12px; font-weight: 500; color: var(--mute); margin: 0 3px 0 1px; }
.countdown.is-final .cd-time { color: var(--live); }
.countdown.is-closed .live-pill { color: var(--mute); }
.countdown.is-closed .live-pill::before { background: var(--mute); animation: none; }
.bag-btn {
  justify-self: end; position: relative; border: 0; background: none; padding: 8px;
  display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600;
}
.bag-btn .ico { width: 24px; height: 24px; }
.bag-btn b {
  position: absolute; top: 2px; left: 22px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--ink); color: #fff; font-size: 11px; line-height: 18px; text-align: center;
}
.bag-btn b:empty, .bag-btn b[data-n="0"] { display: none; }
.bag-btn.bump .ico { animation: bump .4s var(--ease); }
@keyframes bump { 35% { transform: translateY(-3px) rotate(-6deg); } }

/* ── layout ─────────────────────────────────────────────────────────────── */
.app {
  position: fixed; inset: var(--top) 0 var(--mtabs) 0;
  display: grid; grid-template-columns: 200px auto 40px 360px; justify-content: center; column-gap: 28px;
}
.rail { padding: 20px 0; display: flex; flex-direction: column; min-height: 0; }
.tab {
  display: flex; align-items: center; gap: 12px; text-align: left; border: 0; background: none;
  padding: 10px 12px; margin: 0 -12px; border-radius: 10px; font-size: 16px; font-weight: 500; color: var(--ink-2);
}
.tab:hover { background: var(--paper-2); }
.tab.is-on { font-weight: 750; color: var(--ink); }
.tab.is-on .ico { stroke-width: 2.4; }
.tab .count { margin-left: auto; font-size: 12px; color: var(--mute); font-weight: 500; }
.rail-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--mute); line-height: 1.6; }
.rail-foot nav { display: flex; flex-wrap: wrap; gap: 2px 12px; margin-bottom: 8px; }
.rail-foot a { text-decoration: none; }
.rail-foot a:hover { color: var(--ink); text-decoration: underline; }

.feed {
  height: 100%; overflow-y: auto; scroll-snap-type: y mandatory; scrollbar-width: none; overscroll-behavior: contain;
  width: min(calc((100dvh - var(--top) - 32px) * 9 / 16), 540px);
}
.feed::-webkit-scrollbar { display: none; }

.feed-nav { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 10px; }
.feed-nav button {
  width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--paper-2);
  display: grid; place-items: center; transition: background .15s;
}
.feed-nav button:hover:not(:disabled) { background: var(--line); }
.feed-nav button:disabled { opacity: .35; cursor: default; }
.feed-nav .pos { font-size: 12px; font-weight: 600; color: var(--mute); font-variant-numeric: tabular-nums; }

/* ── a post (the meme layer) ────────────────────────────────────────────── */
.post { height: 100%; padding: 16px 0; scroll-snap-align: start; scroll-snap-stop: always; }
.stage {
  position: relative; height: 100%; border-radius: var(--radius); overflow: hidden;
  background: var(--bg); color: #fff; container-type: size;
}
.post[data-tone="light"] .stage { color: var(--ink); }

.caption {
  position: absolute; top: 6.5%; left: 8%; right: 8%; margin: 0; text-align: center;
  font-weight: 700; font-size: clamp(15px, 4.4cqw, 24px); line-height: 1.6; z-index: 2;
}
.caption span {
  background: #fff; color: #161616; padding: .1em .42em; border-radius: .3em;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.tee {
  position: absolute; left: 0; right: 12%; top: 18%; margin: 0 auto; width: min(86cqw, 51cqh);
  transform-origin: 50% 8%; animation: sway 8s ease-in-out infinite;
  opacity: 0; transition: opacity .5s var(--ease);
}
.post.is-ready .tee { opacity: 1; }
.post:nth-child(even) .tee { animation-delay: -4s; }
@keyframes sway { 0%, 100% { transform: rotate(-1.6deg); } 50% { transform: rotate(1.2deg) translateY(-3px); } }
.tee-svg { display: block; width: 100%; height: auto; filter: drop-shadow(0 18px 22px rgb(0 0 0 / .22)) drop-shadow(0 2px 3px rgb(0 0 0 / .12)); }

.meta { position: absolute; left: 5%; right: 22%; bottom: 5%; z-index: 2; font-size: clamp(13px, 3.2cqw, 15px); line-height: 1.42; text-shadow: 0 1px 2px rgb(0 0 0 / .3); }
.post[data-tone="light"] .meta { text-shadow: none; }
.meta p { margin: 0 0 3px; }
.handle { font-weight: 700; font-size: 1.05em; }
.handle small { font-weight: 400; opacity: .78; font-size: .9em; }
.meta .name { font-weight: 400; }
.meta .tags { font-weight: 700; }
.meta .sound { display: flex; gap: 7px; align-items: center; opacity: .92; overflow: hidden; white-space: nowrap; margin-top: 6px; }
.meta .sound .ico { width: 15px; height: 15px; }
.meta .sound .mq { overflow: hidden; flex: 1; min-width: 0; -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }
.meta .sound .mq span { display: inline-block; padding-left: 8%; animation: marquee 11s linear infinite; }
@keyframes marquee { from { transform: translateX(15%); } to { transform: translateX(-100%); } }

.actions { position: absolute; right: 3%; bottom: 5%; z-index: 3; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.act {
  border: 0; background: none; padding: 0; display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 600; color: inherit; text-shadow: 0 1px 2px rgb(0 0 0 / .25);
}
.post[data-tone="light"] .act { text-shadow: none; }
.act i {
  width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-style: normal;
  background: rgb(0 0 0 / .2); transition: transform .15s var(--ease), background .15s;
}
.post[data-tone="light"] .act i { background: rgb(255 255 255 / .6); }
.act:hover i { background: rgb(0 0 0 / .32); }
.post[data-tone="light"] .act:hover i { background: rgb(255 255 255 / .85); }
.act:active i { transform: scale(.88); }
.act .ico { width: 24px; height: 24px; stroke-width: 2; }
.act.cop i { background: #fff; color: #161616; }
.disc {
  width: 42px; height: 42px; border-radius: 50%; margin-top: 2px; background: #161616 center / 62% no-repeat;
  border: 7px solid #2a2a2a; animation: spin 6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.scrub { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgb(255 255 255 / .28); z-index: 2; }
.scrub i { display: block; height: 100%; background: #fff; }
.post[data-tone="light"] .scrub { background: rgb(0 0 0 / .12); }
.post[data-tone="light"] .scrub i { background: var(--ink); }

/* expired posts */
.post.is-expired .tee { animation: none; filter: grayscale(1) contrast(.92); }
.post.is-expired .stage { background: color-mix(in srgb, var(--bg) 30%, #a3a3a3); }
.stamp {
  position: absolute; top: 44%; left: 50%; z-index: 4; transform: translate(-50%, -50%) rotate(-14deg);
  border: 5px solid var(--live); color: var(--live); background: rgb(255 255 255 / .94);
  padding: 6px 18px 4px; border-radius: 8px; text-align: center; font-weight: 900; line-height: 1;
}
.stamp b { display: block; font-size: clamp(34px, 13cqw, 60px); letter-spacing: .03em; }
.stamp small { font-size: 12px; font-weight: 700; letter-spacing: .1em; }
.post.is-expired .act.cop { display: none; }

/* text posts (empty states, how-it-works) */
.card {
  height: 100%; border-radius: var(--radius); background: var(--paper-2);
  display: flex; flex-direction: column; justify-content: center; padding: 10%; gap: 14px;
}
.card h2 { margin: 0; font-size: clamp(26px, 7cqw, 36px); line-height: 1.08; letter-spacing: -0.035em; font-weight: 800; }
.card p { margin: 0; color: var(--ink-2); font-size: 16px; line-height: 1.55; }
.steps { margin: 6px 0 0; padding: 0; list-style: none; counter-reset: s; display: grid; gap: 14px; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 28px 1fr; gap: 10px; font-size: 16px; line-height: 1.5; color: var(--ink-2); }
.steps li::before { content: counter(s); font-weight: 800; color: var(--live); font-variant-numeric: tabular-nums; }
.card .foot { font-size: 13px; color: var(--mute); margin-top: 8px; }
.card .foot a { color: var(--ink-2); }

/* ── the store layer: side panel (desktop) / sheet (phone) ──────────────── */
.panel { padding: 16px 4px 32px 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.detail { display: flex; flex-direction: column; gap: 18px; padding-bottom: 8px; }
.crumb { margin: 4px 0 -12px; font-size: 13px; color: var(--mute); }
.title-row { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.title-row h1 { margin: 0; font-size: 26px; letter-spacing: -0.035em; line-height: 1.12; font-weight: 750; }
.price { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.sub { margin: -10px 0 0; color: var(--mute); font-size: 14px; display: flex; align-items: center; gap: 8px; }
.sub .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--live); flex: none; }
.sub.is-gone .dot { background: var(--mute); }
.size-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: -8px; font-size: 14px; font-weight: 650; }
.linkish { border: 0; background: none; padding: 0; font-size: 13px; color: var(--mute); text-decoration: underline; text-underline-offset: 3px; }
.linkish:hover { color: var(--ink); }
.sizes { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.size {
  height: 48px; border-radius: 10px; border: 1px solid var(--line); background: var(--paper);
  font-weight: 600; font-size: 14px; line-height: 1.1; transition: border-color .12s;
}
.size:hover { border-color: var(--ink); }
.size[aria-pressed="true"] { border: 2px solid var(--ink); font-weight: 750; }
.size small { display: block; font-size: 10px; font-weight: 500; color: var(--mute); }
.primary {
  height: 54px; border: 0; border-radius: 12px; font-weight: 650; font-size: 16px;
  background: var(--ink); color: #fff; transition: background .15s, transform .1s;
}
.primary:hover:not(:disabled) { background: #2b2b2b; }
.primary:active:not(:disabled) { transform: scale(.99); }
.primary:disabled { background: var(--paper-2); color: var(--mute); cursor: not-allowed; }
.primary.is-nudge { animation: nudge .35s; }
@keyframes nudge { 25%, 75% { transform: translateX(-4px); } 50% { transform: translateX(4px); } }
.assure { list-style: none; margin: -6px 0 0; padding: 0; display: grid; gap: 6px; font-size: 13px; color: var(--ink-2); }
.assure li { display: flex; gap: 8px; align-items: center; }
.assure .ico { width: 16px; height: 16px; color: var(--mute); }

.comment { display: grid; grid-template-columns: 36px 1fr; gap: 12px; padding: 16px 0 0; border-top: 1px solid var(--line); }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; }
.avatar .ico { width: 18px; height: 18px; stroke-width: 2.6; }
.who { font-size: 13px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; color: var(--mute); }
.who b { color: var(--ink); font-weight: 700; }
.badge { font-size: 11px; font-weight: 600; color: var(--live); }
.comment p { margin: 4px 0 0; font-size: 14.5px; line-height: 1.55; color: var(--ink-2); }
.comment .src { display: inline-block; margin-top: 6px; font-size: 13px; color: var(--mute); text-underline-offset: 3px; }
.comment .src:hover { color: var(--ink); }

.acc { border-top: 1px solid var(--line); }
.acc:last-of-type { border-bottom: 1px solid var(--line); }
.acc summary {
  list-style: none; cursor: pointer; padding: 14px 0; font-size: 14px; font-weight: 650;
  display: flex; justify-content: space-between; align-items: center;
}
.acc summary::-webkit-details-marker { display: none; }
.acc summary::after { content: '+'; font-weight: 400; font-size: 20px; line-height: 1; color: var(--mute); transition: transform .2s var(--ease); }
.acc[open] summary::after { transform: rotate(45deg); }
.acc .acc-body { padding: 0 0 16px; font-size: 14px; line-height: 1.6; color: var(--ink-2); }
.acc ul { margin: 0; padding-left: 18px; }
.acc table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.acc th { font-weight: 600; color: var(--mute); font-size: 12px; }
.acc th, .acc td { padding: 7px 4px; border-bottom: 1px solid var(--line); text-align: center; }
.acc th:first-child, .acc td:first-child { text-align: left; }
.acc a { color: var(--ink); }

.more h3 { margin: 6px 0 10px; font-size: 14px; font-weight: 650; }
.more-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.more-grid button {
  aspect-ratio: 3 / 4; border: 0; border-radius: 8px; background: var(--bg); padding: 4px; position: relative;
  outline-offset: 2px; transition: transform .15s var(--ease);
}
.more-grid button:hover { transform: translateY(-2px); }
.more-grid button[aria-current="true"] { outline: 2px solid var(--ink); }
.more-grid .tee-svg { filter: none; margin-top: 18%; }

/* bag */
.bag h2 { margin: 0 0 2px; font-size: 22px; letter-spacing: -0.03em; font-weight: 750; }
.bag .sub { margin: 0 0 6px; }
.bag-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.bag-item { display: grid; grid-template-columns: 60px 1fr auto; gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.bag-thumb { width: 60px; height: 72px; border-radius: 8px; background: var(--bg); padding: 4px; display: grid; align-items: center; }
.bag-thumb .tee-svg { filter: none; }
.bag-item b { display: block; font-size: 14.5px; font-weight: 650; }
.bag-item small { color: var(--mute); font-size: 13px; }
.qty { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; }
.qty button { width: 30px; height: 30px; border: 0; background: none; font-size: 16px; color: var(--ink-2); border-radius: 50%; }
.qty button:hover { background: var(--paper-2); }
.qty span { min-width: 16px; text-align: center; font-weight: 650; font-size: 14px; font-variant-numeric: tabular-nums; }
.totals { margin: 14px 0; display: grid; gap: 8px; font-size: 14px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.totals div { display: flex; justify-content: space-between; }
.totals .grand { font-weight: 700; font-size: 17px; color: var(--ink); padding-top: 10px; border-top: 1px solid var(--line); }
.bag .primary { width: 100%; }
.fine { font-size: 12px; color: var(--mute); line-height: 1.55; margin: 12px 0 0; }
.fine a { color: var(--ink-2); }
.empty { padding: 28px 0 8px; text-align: center; color: var(--mute); font-size: 14px; }
.empty .ico { width: 36px; height: 36px; stroke-width: 1.3; margin-bottom: 8px; }

/* ── bottom sheet ───────────────────────────────────────────────────────── */
.sheet-scrim { position: fixed; inset: 0; background: rgb(17 17 17 / .4); z-index: 30; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 31; max-height: 88dvh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--paper); border-radius: 18px 18px 0 0; padding: 10px 20px calc(24px + env(safe-area-inset-bottom));
  animation: up .28s var(--ease); box-shadow: 0 -8px 40px rgb(0 0 0 / .12);
}
@media (min-width: 900px) {
  .sheet { left: auto; right: 24px; top: calc(var(--top) + 12px); bottom: auto; width: 400px; max-height: calc(100dvh - var(--top) - 36px); border-radius: 16px; padding-top: 22px; box-shadow: 0 12px 48px rgb(0 0 0 / .16); }
  .sheet-grab { display: none; }
}
@keyframes up { from { transform: translateY(24px); opacity: 0; } }
.sheet-grab { width: 36px; height: 4px; border-radius: 2px; background: var(--line); margin: 0 auto 12px; }
.sheet-x { position: absolute; top: 14px; right: 14px; border: 0; background: var(--paper-2); width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; }
.sheet-x .ico { width: 16px; height: 16px; stroke-width: 2.2; }
.sheet .detail { padding-top: 6px; }
.sheet .title-row { padding-right: 40px; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--mtabs) + 24px); transform: translate(-50%, 16px);
  background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 10px; font-weight: 550; font-size: 14px;
  opacity: 0; pointer-events: none; transition: .25s var(--ease); z-index: 40; white-space: nowrap;
  display: flex; gap: 12px; align-items: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button { border: 0; background: none; color: #fff; font-weight: 700; padding: 0; text-decoration: underline; text-underline-offset: 3px; }

.mobile-tabs { display: none; }

/* ── phone ──────────────────────────────────────────────────────────────── */
@media (max-width: 899px) {
  :root { --top: 86px; --mtabs: 58px; --radius: 0px; }
  .app { display: block; }
  .rail, .panel, .feed-nav { display: none; }
  .feed { width: 100%; }
  .post { padding: 0; }
  .topbar { padding: 8px 16px 0; }
  .topline { grid-template-columns: 1fr auto; grid-template-rows: 40px 30px; }
  .countdown { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; }
  .countdown .cd-time { margin-left: auto; font-size: 18px; }
  .mobile-tabs {
    display: grid; grid-template-columns: repeat(3, 1fr); position: fixed; inset: auto 0 0 0;
    height: calc(var(--mtabs) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    z-index: 20; background: var(--paper); border-top: 1px solid var(--line);
  }
  .mobile-tabs .tab { flex-direction: column; justify-content: center; gap: 2px; margin: 0; border-radius: 0; font-size: 11px; color: var(--mute); }
  .mobile-tabs .tab .ico { width: 22px; height: 22px; }
  .mobile-tabs .tab.is-on { color: var(--ink); }
  .mobile-tabs .tab:hover { background: none; }
  .card { border-radius: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .tee, .disc, .meta .sound .mq span, .live-pill::before { animation: none; }
}
