/* Shared styles for the /videos pages (same tokens as the homepage) */
:root {
  --bg: #0e0e0f;
  --bg-2: #141415;
  --card: #19191b;
  --line: #2a2a2d;
  --text: #f1f1f1;
  --muted: #9b9ba1;
  --red: #e5242b;
  --red-hi: #ff3a41;
  --max: 1180px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; overflow-x: clip; }
body { background: var(--bg); color: var(--text); font: 16px/1.6 "Archivo", system-ui, sans-serif; -webkit-font-smoothing: antialiased; overflow-x: clip; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 24px; }
.wrap.narrow { max-width: 820px; }
.serif { font-family: "Instrument Serif", Georgia, serif; font-style: italic; font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--red); }
.eyebrow { font: 600 12px/1 "JetBrains Mono", monospace; letter-spacing: .14em; text-transform: uppercase; color: var(--red); display: inline-flex; align-items: center; gap: 10px; }
.eyebrow::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--red); }
.lead { color: var(--muted); font-size: 18px; max-width: 680px; }

/* brand */
.mark { --s: 34px; width: var(--s); height: var(--s); position: relative; flex: none; display: grid; place-items: center; font: italic 900 calc(var(--s) * .52)/1 "Archivo", sans-serif; color: #fff; }
.mark::before, .mark::after { content: ""; position: absolute; inset: 0; --c: var(--red); --w: calc(var(--s) * .07); --l: calc(var(--s) * .26);
  background: linear-gradient(var(--c) 0 0) top left / var(--l) var(--w), linear-gradient(var(--c) 0 0) top left / var(--w) var(--l),
    linear-gradient(var(--c) 0 0) top right / var(--l) var(--w), linear-gradient(var(--c) 0 0) top right / var(--w) var(--l),
    linear-gradient(var(--c) 0 0) bottom left / var(--l) var(--w), linear-gradient(var(--c) 0 0) bottom left / var(--w) var(--l),
    linear-gradient(var(--c) 0 0) bottom right / var(--l) var(--w), linear-gradient(var(--c) 0 0) bottom right / var(--w) var(--l);
  background-repeat: no-repeat; }
.mark::after { background: var(--red); width: calc(var(--s) * .07); height: calc(var(--s) * .07); border-radius: 50%; inset: calc(var(--s) * .14) auto auto calc(var(--s) * .14); }
.wordmark { font: italic 900 1em/1 "Archivo", sans-serif; text-transform: uppercase; letter-spacing: -.01em; white-space: nowrap; text-shadow: -.035em 0 rgba(229,36,43,.55), .03em 0 rgba(80,200,255,.25); }
.wordmark b { color: var(--red); font-weight: 900; }
.brand { display: flex; align-items: center; gap: 12px; font-size: 18px; }

.btn { display: inline-flex; align-items: center; gap: 10px; padding: 14px 22px; border-radius: 8px; font-weight: 700; font-size: 15px; transition: transform .15s, background .15s; }
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-hi); }

/* nav */
nav#nav { position: sticky; top: 0; z-index: 50; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); background: rgba(14,14,15,.82); border-bottom: 1px solid var(--line); }
nav#nav .wrap { display: flex; align-items: center; justify-content: space-between; height: 68px; }
nav#nav ul { display: flex; gap: 30px; list-style: none; font-size: 14px; color: var(--muted); }
nav#nav ul a:hover, nav#nav ul a.on { color: var(--text); }
nav#nav .btn { padding: 10px 18px; font-size: 14px; }
.menu-btn { display: none; background: none; border: 0; color: var(--text); cursor: pointer; }

/* shared meta */
.crumbs { font: 600 12px "JetBrains Mono", monospace; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; }
.crumbs a { color: var(--red); }
.art-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; font: 12px "JetBrains Mono", monospace; color: var(--muted); margin-top: 16px; }
.art-meta span + span::before { content: "·"; margin-right: 18px; color: var(--red); }

/* directory headers */
.dir-head { padding: 70px 0 40px; border-bottom: 1px solid var(--line); position: relative; overflow: hidden;
  background: radial-gradient(ellipse 50% 80% at 85% 0%, rgba(229,36,43,.16), transparent 70%); }
.dir-head h1 { font: italic 900 clamp(36px, 5.4vw, 64px)/1.02 "Archivo", sans-serif; text-transform: uppercase; letter-spacing: -.02em; margin: 16px 0 14px; }
.dir-head h1 .serif { font-size: 1.05em; }
.dir-head .ico { color: var(--red); font-style: normal; }

/* topic grid on hub */
.tgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin: 44px 0 70px; }
.tcard { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; transition: border-color .2s, transform .2s; display: flex; flex-direction: column; }
.tcard:hover { border-color: var(--red); transform: translateY(-3px); }
.tthumbs { display: grid; grid-template-columns: repeat(3, 1fr); height: 74px; }
.tthumbs img { width: 100%; height: 100%; object-fit: cover; filter: saturate(.85); }
.tbody { padding: 18px; }
.tbody .ico { color: var(--red); font-size: 18px; }
.tbody h2 { font: italic 900 20px/1.1 "Archivo", sans-serif; text-transform: uppercase; margin: 6px 0 8px; }
.tbody p { color: var(--muted); font-size: 14px; line-height: 1.45; }

/* timeline */
.tl-head { display: flex; justify-content: space-between; align-items: end; gap: 20px; flex-wrap: wrap; margin-bottom: 10px; }
.tl-head h2 { font: italic 900 32px/1 "Archivo", sans-serif; text-transform: uppercase; }
.tl-sort { font: 600 12px "JetBrains Mono", monospace; letter-spacing: .1em; text-transform: uppercase; color: var(--red); margin-left: 10px; vertical-align: middle; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--bg-2); color: var(--muted); border-radius: 999px; padding: 8px 14px; font: 500 13px "Archivo", sans-serif; cursor: pointer; }
.chip:hover { color: var(--text); }
.chip.on { background: var(--red); border-color: var(--red); color: #fff; }
.year { padding: 34px 0 10px; }
.ylabel { display: flex; align-items: baseline; gap: 14px; border-bottom: 1px solid var(--line); padding-bottom: 12px; margin-bottom: 20px; position: sticky; top: 68px; background: var(--bg); z-index: 2; padding-top: 10px; }
.ylabel span { font: italic 900 34px/1 "Archivo", sans-serif; color: var(--red); }
.ylabel small { font: 12px "JetBrains Mono", monospace; color: var(--muted); }
.vgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px 16px; }
.vcard { display: block; }
.vcard .th { position: relative; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.vcard .th img { aspect-ratio: 16/9; object-fit: cover; width: 100%; transition: transform .4s; }
.vcard:hover .th img { transform: scale(1.05); }
.vcard:hover h3 { color: #fff; text-decoration: underline; text-decoration-color: var(--red); text-underline-offset: 3px; }
.dur { position: absolute; right: 7px; bottom: 7px; background: rgba(0,0,0,.82); font: 600 11px "JetBrains Mono", monospace; padding: 3px 6px; border-radius: 5px; }
.badge-art { position: absolute; left: 7px; top: 7px; background: var(--red); color: #fff; font: 600 10px "JetBrains Mono", monospace; letter-spacing: .08em; text-transform: uppercase; padding: 4px 7px; border-radius: 5px; }
.vmeta { display: flex; gap: 10px; flex-wrap: wrap; font: 11px "JetBrains Mono", monospace; color: var(--muted); margin-top: 10px; }
.vmeta .tp { color: var(--red); }
.vcard h3 { font-size: 15px; line-height: 1.35; font-weight: 600; margin-top: 5px; color: #e4e4e6; }

/* article */
.art-head { padding: 50px 0 34px; background: radial-gradient(ellipse 60% 100% at 90% 0%, rgba(229,36,43,.14), transparent 70%); }
.art-head h1 { font: 800 clamp(28px, 4vw, 44px)/1.12 "Archivo", sans-serif; letter-spacing: -.02em; margin-top: 16px; }
.article { padding-bottom: 80px; }
.embed { position: relative; aspect-ratio: 16/9; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: #000; }
.embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.prose { margin-top: 40px; font-size: 18px; line-height: 1.75; color: #d9d9dc; }
.prose > * + * { margin-top: 1.1em; }
.prose .dek { font: italic 400 26px/1.35 "Instrument Serif", serif; color: var(--text); }
.prose h2 { font: italic 900 24px/1.15 "Archivo", sans-serif; text-transform: uppercase; color: var(--text); margin-top: 2em; }
.prose h2::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--red); margin-right: 12px; vertical-align: middle; }
.prose a, aside.links a { color: var(--text); text-decoration: underline; text-decoration-color: var(--red); text-underline-offset: 3px; }
.prose b, .prose strong { color: var(--text); }
.prose aside { border: 1px solid var(--line); border-radius: 14px; padding: 22px 24px; font-size: 16px; line-height: 1.6; margin-top: 2em; }
.prose aside.deep { background: var(--card); }
.prose aside.tips { background: linear-gradient(135deg, rgba(229,36,43,.1), transparent 60%), var(--card); }
.prose aside h3, aside.links h3 { font: 600 12px "JetBrains Mono", monospace; letter-spacing: .14em; text-transform: uppercase; color: var(--red); margin-bottom: 12px; }
.prose aside ul { list-style: none; display: grid; gap: 10px; }
.prose aside li { padding-left: 18px; position: relative; }
.prose aside li::before { content: "›"; position: absolute; left: 0; color: var(--red); font-weight: 700; }
.prose aside.chapters ol { list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 20px; }
.prose aside.chapters li { padding: 0; }
.prose aside.chapters li::before { content: none; }
.prose aside.chapters a { text-decoration: none; display: flex; gap: 12px; padding: 5px 0; color: #d0d0d3; }
.prose aside.chapters a:hover { color: var(--text); }
.prose aside.chapters a span { font: 600 12px/1.9 "JetBrains Mono", monospace; color: var(--red); min-width: 42px; }
@media (max-width: 720px) { .prose aside.chapters ol { grid-template-columns: 1fr; } }
aside.links { margin-top: 32px; border: 1px dashed var(--line); border-radius: 14px; padding: 22px 24px; }
aside.links ul { list-style: none; display: grid; gap: 10px; }
aside.links li { display: flex; justify-content: space-between; gap: 16px; font-size: 15px; }
aside.links li small { font: 11px "JetBrains Mono", monospace; color: var(--muted); white-space: nowrap; }
aside.links li.code { font: 600 13px "JetBrains Mono", monospace; color: var(--red); }
aside.links h3 + ul + h3, aside.links ul + h3 { margin-top: 22px; }
aside.links details { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 16px; }
aside.links summary { cursor: pointer; font: 600 12px "JetBrains Mono", monospace; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }
aside.links summary:hover { color: var(--text); }
aside.links .note { font-size: 12px; color: var(--muted); margin-top: 14px; }
.watch { margin-top: 30px; }
.pn { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 44px; }
.pn a { border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; font-weight: 600; font-size: 15px; line-height: 1.35; transition: border-color .2s; }
.pn a:hover { border-color: var(--red); }
.pn a small { display: block; font: 11px "JetBrains Mono", monospace; color: var(--muted); margin-bottom: 6px; }
.pn .next { text-align: right; }

/* footer */
footer { border-top: 1px solid var(--line); padding: 30px 0; background: var(--bg-2); margin-top: 60px; }
footer .copy { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; font: 12px "JetBrains Mono", monospace; color: var(--muted); }
footer a:hover { color: var(--red); }

@media (max-width: 1000px) {
  .tgrid { grid-template-columns: repeat(2, 1fr); }
  .vgrid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 720px) {
  .wrap { padding: 0 16px; }
  nav#nav ul, nav#nav .nav-cta { display: none; }
  .menu-btn { display: block; }
  nav#nav.open ul { display: flex; flex-direction: column; position: absolute; top: 68px; left: 0; right: 0; background: var(--bg); padding: 20px 16px; border-bottom: 1px solid var(--line); gap: 18px; font-size: 17px; }
  .brand { font-size: 16px; }
  .tgrid { grid-template-columns: 1fr; }
  .vgrid { grid-template-columns: 1fr 1fr; gap: 18px 12px; }
  .vcard h3 { font-size: 13.5px; }
  .prose { font-size: 17px; }
  .pn { grid-template-columns: 1fr; }
  .pn .next { text-align: left; }
}

/* language switch (nav) */
.nav-end { display: flex; align-items: center; gap: 12px; }
.flags { display: flex; align-items: center; gap: 2px; }
.flags a { display: grid; place-items: center; padding: 6px 5px; border-radius: 6px; opacity: .5; transition: opacity .2s, background .2s; }
.flags a:hover { opacity: 1; background: var(--bg-2); }
.flags a.on { opacity: 1; box-shadow: inset 0 -2px 0 var(--red); }
.flags svg { display: block; width: 22px; height: 15px; border-radius: 2px; box-shadow: 0 0 0 1px rgba(255,255,255,.18); }
html:lang(zh-CN) :is(h1, h2, h3, h4, .serif, .dek, .tagline) { font-style: normal; letter-spacing: 0; }

/* timeline of years */
.yrail { position: sticky; top: 68px; z-index: 5; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; margin-top: 18px; padding: 12px 0 10px; background: var(--bg); border-bottom: 1px solid var(--line); }
.yrail.fits .yarrow { display: none; }
.yarrow { width: 38px; height: 38px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg-2); color: var(--text); font-size: 18px; cursor: pointer; transition: border-color .2s, opacity .2s; }
.yarrow:hover:not(:disabled) { border-color: var(--red); }
.yarrow:disabled { opacity: .3; cursor: default; }
.ytrack { position: relative; display: flex; overflow-x: auto; scroll-behavior: smooth; scrollbar-width: none; cursor: grab; user-select: none;
  mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent); -webkit-mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent); }
.ytrack::-webkit-scrollbar { display: none; }
.ytrack.drag { cursor: grabbing; scroll-behavior: auto; }
.ytrack.drag a { pointer-events: none; }
.yitem { position: relative; flex: 0 0 158px; padding: 26px 6px 4px; text-align: center; color: var(--muted); -webkit-user-drag: none; }
.yitem:first-child { margin-left: auto; }
.yitem:last-child { margin-right: auto; }
.yitem::before { content: ""; position: absolute; top: 9px; left: 0; right: 0; border-top: 2px solid var(--line); }
.yitem:first-child::before { left: 50%; }
.yitem:last-child::before { right: 50%; }
.yitem::after { content: ""; position: absolute; top: 4px; left: 50%; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: var(--bg); border: 2px solid #55555b; transition: .2s; }
.yitem b { display: block; font: italic 900 26px/1.1 "Archivo", sans-serif; transition: color .2s; }
.yitem small { display: block; font: 11px "JetBrains Mono", monospace; margin-top: 3px; white-space: nowrap; }
.yitem:hover b { color: var(--text); }
.yitem:hover::after { border-color: var(--red); }
.yitem.on { color: var(--text); }
.yitem.on b { color: var(--red); }
.yitem.on::after { background: var(--red); border-color: var(--red); box-shadow: 0 0 0 4px rgba(229,36,43,.2), 0 0 16px 3px rgba(229,36,43,.5); }
.yitem.off { opacity: .3; pointer-events: none; }
#timeline .year { padding-top: 20px; }
#timeline .ylabel { position: static; }
@media (max-width: 720px) {
  .yarrow { display: none; }
  .yrail { grid-template-columns: minmax(0, 1fr); padding: 10px 0 8px; }
  .yitem { flex-basis: 92px; }
  .yitem b { font-size: 21px; }
}

/* Chinese pages: Bilibili / Douyin box (YouTube is blocked in mainland China) */
.cn-box { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin: 18px 0 0; padding: 14px 18px; border: 1px solid var(--line); border-left: 3px solid var(--red); border-radius: 10px; background: var(--bg-2); font-size: 15px; }
.cn-box a { color: var(--red); font-weight: 600; }
.cn-box .dy { font: 13px "JetBrains Mono", monospace; color: var(--muted); }

/* blog */
.bgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px; margin-top: 30px; }
.bcard { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--bg-2); transition: border-color .2s, transform .2s; }
.bcard:hover { border-color: var(--red); transform: translateY(-3px); }
.bimg { aspect-ratio: 16 / 9; background: var(--card); }
.bimg img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bbody { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.bbody .vmeta { margin-top: 0; }
.bbody h2 { font: 800 21px/1.2 "Archivo", sans-serif; }
.bbody p { color: var(--muted); font-size: 15px; }
.bbody .more { margin-top: auto; font: 600 12px "JetBrains Mono", monospace; letter-spacing: .08em; color: var(--red); }
.blang { color: var(--red); }
.bempty { margin-top: 30px; padding: 40px 20px; text-align: center; border: 1px dashed var(--line); border-radius: 14px; color: var(--muted); }
.bcover { margin: 0 0 10px; }
.bcover img, .prose figure img { width: 100%; height: auto; border-radius: 12px; display: block; }
.prose figure { margin: 1.6em 0; }
.prose figcaption { font: 12px "JetBrains Mono", monospace; color: var(--muted); margin-top: 8px; }
.prose blockquote { border-left: 3px solid var(--red); padding-left: 18px; color: var(--text); font-style: italic; }
@media (max-width: 1000px) { .bgrid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 720px) { .bgrid { grid-template-columns: 1fr; } }

/* share buttons (assets/share.js) */
.share { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 36px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
.share-label { display: inline-flex; align-items: center; gap: 8px; font: 600 12px "JetBrains Mono", monospace; letter-spacing: .12em; text-transform: uppercase; color: var(--red); margin-right: 6px; }
.share svg { width: 16px; height: 16px; flex: none; }
.share a, .share button { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--text); font: 600 13px "Archivo", sans-serif; cursor: pointer; transition: border-color .15s, color .15s; }
.share a:hover, .share button:hover { border-color: var(--red); color: var(--red); }
.share .share-copy.ok { border-color: #2fbf71; color: #2fbf71; }
.share [hidden] { display: none; }
@media (max-width: 720px) { .share { padding: 14px; } .share-label { width: 100%; margin-bottom: 2px; } }

/* phone nav: brand + 3 flags + menu button must fit in 343px */
@media (max-width: 720px) { .nav-end { gap: 6px; } .flags a { padding: 6px 2px; } }
/* between phone and wide desktop the menu items wrapped onto 3-4 lines: use the ☰ menu up to 1100px */
@media (max-width: 1180px) {
  nav#nav ul { display: none; }
  .menu-btn { display: block; }
  .nav-cta { white-space: nowrap; }
  nav#nav.open ul { display: flex; flex-direction: column; position: absolute; top: 68px; left: 0; right: 0; background: var(--bg); padding: 20px 32px; border-bottom: 1px solid var(--line); gap: 18px; font-size: 17px; }
}
@media (max-width: 720px) { nav#nav.open ul { padding: 20px 16px; } }

/* short looping product clip inside an article (muted, plays like a GIF) */
.prose figure.clip { max-width: 320px; margin: 1.8em auto; }
.prose figure.clip video { display: block; width: 100%; height: auto; aspect-ratio: 9 / 16; border-radius: 14px; background: var(--bg-2); border: 1px solid var(--line); }
.prose figure.clip figcaption { margin-top: 10px; font: 12px "JetBrains Mono", monospace; color: var(--muted); text-align: center; }
