/* Computing Life — Signal redesign */

:root {
  --font-display: "IBM Plex Sans", "Noto Sans SC", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", "Noto Sans SC", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --font-cjk: "Noto Sans SC", "IBM Plex Sans", sans-serif;

  --r-card: 8px;
  --r-chip: 5px;
  --r-btn: 6px;
  --maxw-prose: 680px;
  --maxw-feed: 960px;
  --maxw-wide: 1140px;

  --paper: #f8f9fb;
  --paper-2: #eef0f4;
  --paper-3: #e5e8ee;
  --ink: #14161c;
  --ink-soft: #545b67;
  --ink-faint: #878e9c;
  --rule: #e1e4ea;
  --rule-soft: #edeff3;
  --accent: #2547e0;
  --accent-ink: #1f3bc4;
  --accent-wash: #e3e7fb;
  --shadow-soft: 0 1px 2px rgba(20,22,30,.04), 0 8px 30px rgba(20,22,30,.05);
  --shadow-lift: 0 2px 6px rgba(20,22,30,.07), 0 18px 50px rgba(20,22,30,.09);
}

[data-theme="dark"] {
  --paper: #0d0f14;
  --paper-2: #161922;
  --paper-3: #1d212b;
  --ink: #e7e9ef;
  --ink-soft: #9aa2b1;
  --ink-faint: #6a7280;
  --rule: #242936;
  --rule-soft: #191d27;
  --accent: #8298ff;
  --accent-ink: #93a5ff;
  --accent-wash: #171b2e;
  --shadow-soft: 0 1px 2px rgba(0,0,0,.3), 0 10px 34px rgba(0,0,0,.4);
  --shadow-lift: 0 2px 8px rgba(0,0,0,.4), 0 22px 60px rgba(0,0,0,.5);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.72;
  font-feature-settings: "kern" 1, "liga" 1, "onum" 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color .45s ease, color .45s ease;
}
::selection { background: var(--accent); color: #fff; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
img, video, iframe { max-width: 100%; }
svg { display: block; }

.skip-link { position: fixed; left: 16px; top: 12px; z-index: 100; transform: translateY(-160%); background: var(--accent); color: #fff; padding: 8px 12px; border-radius: var(--r-btn); font-family: var(--font-mono); font-size: 12px; }
.skip-link:focus { transform: none; }
.site { min-height: 100vh; display: flex; flex-direction: column; }
.wrap { width: 100%; max-width: var(--maxw-wide); margin: 0 auto; padding: 0 40px; }
.wrap.prose { max-width: calc(var(--maxw-prose) + 80px); }

.masthead { border-bottom: 1px solid var(--rule); background: color-mix(in srgb, var(--paper) 86%, transparent); position: sticky; top: 0; z-index: 40; backdrop-filter: saturate(1.1) blur(10px); }
.masthead-inner { display: flex; align-items: center; gap: 24px; padding-top: 15px; padding-bottom: 15px; }
.brand, .f-brand { display: flex; align-items: center; gap: 13px; flex: 0 0 auto; color: var(--ink); }
.brand:hover { text-decoration: none; }
.seal { width: 38px; height: 38px; flex: 0 0 auto; border-radius: 9px; border: 1.5px solid var(--accent); color: var(--accent); display: grid; place-items: center; position: relative; transition: background .25s, color .25s; overflow: hidden; }
.seal svg { width: 32px; height: 32px; }
.seal svg > rect:first-child { fill: var(--accent-wash); }
.duck-face { fill: #fff7cf; }
.duck-bill { fill: #d99a24; }
.duck-eye { fill: var(--ink); }
.duck-water { fill: var(--accent); opacity: .78; }
.brand:hover .seal, .f-brand:hover .seal { background: var(--accent-wash); }
.seal::after { content: ""; position: absolute; inset: 4px; border-radius: 5px; border: 1px solid color-mix(in oklab, var(--accent) 30%, transparent); pointer-events: none; }
.wordmark { display: flex; flex-direction: column; line-height: 1; }
.wordmark .ttl, .f-brand .ttl { font-family: var(--font-display); font-weight: 600; font-size: 19px; letter-spacing: -.3px; color: var(--ink); }
.wordmark .ttl em, .f-brand em { font-style: normal; color: var(--accent-ink); }
.wordmark .sub { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-faint); margin-top: 5px; }

.nav { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.navlink { font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .04em; color: var(--ink-soft); padding: 8px 11px; border-radius: var(--r-btn); white-space: nowrap; transition: color .18s, background .18s; display: inline-flex; align-items: center; gap: 5px; }
.navlink:hover { color: var(--ink); background: var(--paper-2); text-decoration: none; }
.navlink.active { color: var(--accent-ink); }
.ext { font-size: 10px; opacity: .55; }
.nav-sep { width: 1px; height: 22px; background: var(--rule); margin: 0 8px; flex: 0 0 auto; }
.icon-btn { min-width: 44px; min-height: 44px; display: grid; place-items: center; border-radius: var(--r-btn); border: 1px solid var(--rule); background: var(--paper-2); color: var(--ink-soft); cursor: pointer; transition: all .18s; }
.icon-btn:hover { color: var(--ink); border-color: var(--ink-faint); text-decoration: none; }
.icon-btn svg { width: 17px; height: 17px; }
#theme-toggle { position: relative; overflow: hidden; }
#theme-toggle::before, #theme-toggle::after { content: ""; position: absolute; left: 50%; top: 50%; transition: all .18s; }
#theme-toggle::before { width: 16px; height: 16px; border-radius: 50%; background: currentColor; transform: translate(-50%, -50%); }
#theme-toggle::after { width: 16px; height: 16px; border-radius: 50%; background: var(--paper-2); transform: translate(calc(-50% + 5px), calc(-50% - 1px)); }
[data-theme="dark"] #theme-toggle::before { width: 10px; height: 10px; border: 1.5px solid currentColor; background: transparent; }
[data-theme="dark"] #theme-toggle::after { width: 2px; height: 2px; border-radius: 50%; background: transparent; transform: translate(-50%, -50%); box-shadow: 0 -9px 0 currentColor, 0 9px 0 currentColor, 9px 0 0 currentColor, -9px 0 0 currentColor, 6px 6px 0 currentColor, -6px 6px 0 currentColor, 6px -6px 0 currentColor, -6px -6px 0 currentColor; }
.langswitch { display: inline-flex; border: 1px solid var(--rule); border-radius: var(--r-btn); overflow: hidden; background: var(--paper-2); }
.langswitch a { font-family: var(--font-mono); font-size: 11px; letter-spacing: .04em; padding: 10px 11px; color: var(--ink-faint); transition: all .18s; }
.langswitch a:hover { color: var(--ink); text-decoration: none; background: var(--paper-3); }
.langswitch a.on { background: var(--accent); color: #fff; }
.nav-toggle { display: none; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 0; }
.nav-toggle span { width: 16px; height: 1.5px; background: currentColor; display: block; margin: 0; }

.lede { padding: 64px 0 44px; border-bottom: 1px solid var(--rule); max-width: 780px; }
.lede-compact { padding: 34px 0 26px; max-width: var(--maxw-feed); }
.kicker, .lede .kicker, .arch-head .kicker, .article-head .cat-line { font-family: var(--font-mono); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-ink); margin: 0 0 18px; display: flex; align-items: center; gap: 10px; }
.kicker::before, .lede .kicker::before, .arch-head .kicker::before, .article-head .cat-line::before { content: ""; width: 22px; height: 1.5px; background: var(--accent); display: inline-block; flex: 0 0 auto; }
.lede h1 { font-family: var(--font-display); font-weight: 600; font-size: clamp(32px, 4.8vw, 50px); line-height: 1.08; letter-spacing: -1.2px; margin: 0 0 20px; color: var(--ink); }
.lede-compact h1 { font-size: clamp(24px, 3vw, 34px); line-height: 1.18; letter-spacing: -.7px; margin-bottom: 12px; max-width: 760px; }
.lede h1 em { font-style: normal; color: var(--accent-ink); }
.lede p { font-size: 18px; color: var(--ink-soft); margin: 0; max-width: 62ch; line-height: 1.6; }
.lede-compact p { font-size: 16.5px; max-width: 72ch; line-height: 1.55; }
.feedhead { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; margin: 42px 0 4px; max-width: var(--maxw-feed); }
.lede-compact + .feedhead { margin-top: 28px; }
.feedhead h2 { font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-faint); font-weight: 500; margin: 0; }
.posts { list-style: none; margin: 0; padding: 0; max-width: var(--maxw-feed); }
.post { display: grid; grid-template-columns: 32px 132px 1fr; gap: 26px; padding: 39px 0; border-bottom: 1px solid var(--rule); align-items: start; }
.post:hover .post-title a { color: var(--accent-ink); }
.post-idx { font-family: var(--font-mono); font-size: 12px; color: var(--ink-faint); padding-top: 9px; }
.post-meta { font-family: var(--font-mono); font-size: 12px; color: var(--ink-faint); line-height: 1.5; padding-top: 8px; }
.post-meta .date { color: var(--ink-soft); display: block; }
.post-meta .cat { display: inline-block; margin-top: 8px; color: var(--accent-ink); letter-spacing: .03em; }
.post-title { font-family: var(--font-display); font-weight: 600; font-size: 25px; line-height: 1.25; letter-spacing: -.5px; margin: 0 0 10px; }
.post-title a { color: var(--ink); transition: color .18s; }
.post-title a:hover { text-decoration: none; }
.post-summary { color: var(--ink-soft); font-size: 16.5px; line-height: 1.6; margin: 0 0 14px; max-width: 66ch; }
.post-summary p { margin: 0; }
.post-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-family: var(--font-mono); font-size: 11px; letter-spacing: .02em; color: var(--ink-soft); padding: 3px 8px; border: 1px solid var(--rule); border-radius: var(--r-chip); background: var(--paper-2); transition: all .15s; }
.tag:hover { border-color: var(--accent); color: var(--accent-ink); text-decoration: none; }
.tag::before { content: "#"; opacity: .45; }
.bilingual-flag, .mini-flag { font-family: var(--font-mono); font-size: 10px; letter-spacing: .06em; color: var(--accent-ink); white-space: nowrap; border: 1px solid color-mix(in oklab, var(--accent) 35%, transparent); border-radius: var(--r-chip); padding: 2px 6px; background: var(--accent-wash); }

.reading { display: grid; grid-template-columns: 1fr; gap: 0; }
.article-head { padding: 56px 0 0; }
.crumb { font-family: var(--font-mono); font-size: 12px; letter-spacing: .04em; color: var(--ink-faint); margin-bottom: 22px; display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }
.crumb a { color: var(--accent-ink); }
.article-head h1 { font-family: var(--font-display); font-weight: 600; font-size: clamp(31px, 4.4vw, 44px); line-height: 1.12; letter-spacing: -1px; margin: 0 0 22px; color: var(--ink); text-wrap: balance; }
.byline { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-soft); padding-bottom: 26px; border-bottom: 1px solid var(--rule); }
.byline .dot { color: var(--rule); }
.lang-toggle-row { display: flex; align-items: center; gap: 12px; margin: 24px 0 0; font-family: var(--font-mono); font-size: 12px; color: var(--ink-faint); flex-wrap: wrap; }
.prose-body { font-size: 18.5px; line-height: 1.78; color: var(--ink); padding: 36px 0 10px; overflow-wrap: break-word; }
.prose-body.cjk { font-family: var(--font-cjk); line-height: 1.95; }
.prose-body p { margin: 0 0 1.45em; }
.prose-body h1, .prose-body h2, .prose-body h3, .prose-body h4 { font-family: var(--font-display); font-weight: 600; color: var(--ink); letter-spacing: -.4px; line-height: 1.25; }
.prose-body h2 { font-size: 25px; margin: 2em 0 .7em; padding-top: .3em; }
.prose-body h3 { font-size: 19px; margin: 1.6em 0 .5em; }
.prose-body strong { font-weight: 700; color: var(--ink); }
.prose-body a { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: color-mix(in oklab, var(--accent) 45%, transparent); }
.prose-body ul, .prose-body ol { margin: 0 0 1.45em; padding-left: 1.4em; }
.prose-body li { margin: 0 0 .6em; padding-left: .3em; }
.prose-body li::marker { color: var(--accent); font-family: var(--font-mono); font-size: .85em; }
.prose-body blockquote { margin: 1.8em 0; padding: 4px 0 4px 26px; border-left: 2px solid var(--accent); color: var(--ink-soft); font-size: 1.02em; }
.prose-body code { font-family: var(--font-mono); font-size: .82em; background: var(--paper-2); border: 1px solid var(--rule); border-radius: 5px; padding: 1px 6px; color: var(--accent-ink); white-space: normal; }
.prose-body pre { background: var(--paper-2); border: 1px solid var(--rule); border-radius: var(--r-card); padding: 18px 20px; overflow-x: auto; font-family: var(--font-mono); font-size: 14px; line-height: 1.6; margin: 1.6em 0; }
.prose-body pre code { background: none; border: none; padding: 0; color: var(--ink); white-space: pre; }
.prose-body table { display: block; width: max-content; max-width: 100%; overflow-x: auto; border-collapse: collapse; margin: 1.6em 0; font-size: .92em; }
.prose-body th, .prose-body td { border: 1px solid var(--rule); padding: .55em .7em; text-align: left; }
.prose-body th { background: var(--paper-2); font-weight: 600; }
.prose-body img { border-radius: var(--r-card); height: auto; }
.article-foot { margin-top: 46px; padding-top: 26px; border-top: 1px solid var(--rule); }
.prevnext { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 34px 0; }
.prevnext a { display: block; padding: 18px 20px; border: 1px solid var(--rule); border-radius: var(--r-card); background: var(--paper); transition: all .18s; }
.prevnext a:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-soft); }
.prevnext .lbl { font-family: var(--font-mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-faint); }
.prevnext .t { font-family: var(--font-display); font-weight: 600; font-size: 17px; color: var(--ink); margin-top: 8px; line-height: 1.3; letter-spacing: -.3px; display: block; }
.prevnext .next { text-align: right; }
.comments { margin-top: 40px; }
.comments h2 { font-family: var(--font-mono); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-faint); }
.progress { position: fixed; top: 0; left: 0; height: 2px; background: var(--accent); z-index: 60; width: 0; transition: width .1s linear; }

.arch-head { padding: 56px 0 26px; border-bottom: 1px solid var(--rule); }
.arch-head h1 { font-family: var(--font-display); font-weight: 600; font-size: clamp(28px,3.8vw,42px); margin: 0; letter-spacing: -1px; }
.arch-head p:not(.kicker) { color: var(--ink-soft); margin: 13px 0 0; max-width: 58ch; font-size: 16px; }
.arch-filters, .tag-cloud-page { display: flex; gap: 7px; flex-wrap: wrap; padding: 24px 0; border-bottom: 1px solid var(--rule); }
.filter-chip { font-family: var(--font-mono); font-size: 12px; letter-spacing: .02em; padding: 7px 13px; border-radius: var(--r-chip); border: 1px solid var(--rule); background: var(--paper-2); color: var(--ink-soft); transition: all .15s; }
.filter-chip:hover { border-color: var(--ink-faint); color: var(--ink); text-decoration: none; }
.filter-chip.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.filter-chip span { color: var(--ink-faint); margin-left: 4px; }
.year-group { padding: 28px 0; border-bottom: 1px solid var(--rule); display: grid; grid-template-columns: 120px 1fr; gap: 32px; }
.yr { font-family: var(--font-mono); font-size: 34px; font-weight: 300; color: var(--ink-faint); line-height: 1; position: sticky; top: 96px; }
.year-list { list-style: none; margin: 0; padding: 0; }
.arch-item { display: flex; align-items: baseline; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--rule-soft); }
.arch-item:last-child { border-bottom: none; }
.arch-date { font-family: var(--font-mono); font-size: 12px; color: var(--ink-faint); flex: 0 0 52px; }
.arch-t { font-family: var(--font-display); font-weight: 500; font-size: 17px; color: var(--ink); flex: 1; line-height: 1.35; transition: color .18s; letter-spacing: -.3px; }
.arch-item:hover .arch-t { color: var(--accent-ink); text-decoration: none; }
.arch-cat { font-family: var(--font-mono); font-size: 11px; color: var(--accent-ink); letter-spacing: .03em; }

.footer { margin-top: auto; border-top: 1px solid var(--rule); background: var(--paper-2); padding: 46px 0 40px; }
.footer-inner { display: flex; gap: 48px; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; }
.footer-about { max-width: 380px; }
.f-meta, .footer address { font-family: var(--font-mono); font-size: 12px; color: var(--ink-faint); line-height: 1.8; max-width: 42ch; font-style: normal; }
.f-links { display: flex; gap: 44px; flex-wrap: wrap; }
.f-col h5 { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-faint); margin: 0 0 12px; }
.f-col a { display: block; font-family: var(--font-mono); font-size: 13px; color: var(--ink-soft); margin-bottom: 9px; }
.f-col a:hover { color: var(--accent-ink); }
.pager { display: flex; justify-content: center; align-items: center; gap: 8px; padding: 44px 0; font-family: var(--font-mono); max-width: var(--maxw-feed); }
.pager a, .pager .cur { font-size: 13px; width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--rule); border-radius: var(--r-btn); background: var(--paper); color: var(--ink-soft); transition: all .18s; }
.pager a:hover { border-color: var(--accent); color: var(--accent-ink); text-decoration: none; }
.pager .cur { background: var(--accent); color: #fff; border-color: var(--accent); }
.pager-total { font-size: 12px; color: var(--ink-faint); }

/* Kit embeds are content-owned. The theme only prevents layout overflow. */
.prose-body .formkit-form, .prose-body [data-uid] { max-width: 100% !important; margin: 2rem 0 !important; }

@media (min-width: 1100px) {
  .reading { grid-template-columns: 1fr minmax(0, var(--maxw-prose)) 1fr; }
  .reading > .prose-col { grid-column: 2; }
  .article-head-col { grid-column: 2; }
}

@media (max-width: 980px) {
  .masthead-inner { gap: 12px; }
  .nav-toggle { display: flex; min-width: 38px; min-height: 38px; margin: 6px 4px 6px auto; }
  .nav { display: none; position: absolute; left: 20px; right: 20px; top: calc(100% + 8px); flex-direction: column; align-items: stretch; gap: 6px; padding: 14px; border: 1px solid var(--rule); border-radius: var(--r-card); background: var(--paper); box-shadow: var(--shadow-lift); }
  .nav.open { display: flex; }
  .nav-sep { display: none; }
  .nav .navlink, .nav .icon-btn, .nav .langswitch { width: 100%; justify-content: center; }
  .langswitch a { flex: 1; text-align: center; }
}

@media (max-width: 760px) {
  body { font-size: 17px; }
  .wrap { padding: 0 20px; }
  .wordmark .sub { display: none; }
  .lede { padding: 44px 0 34px; }
  .lede-compact { padding: 28px 0 22px; }
  .lede-compact h1 { font-size: clamp(22px, 7vw, 30px); }
  .lede-compact p { font-size: 15.5px; }
  .feedhead { align-items: flex-start; flex-direction: column; gap: 7px; }
  .post { grid-template-columns: 1fr; gap: 8px; padding: 30px 0; }
  .post-idx { display: none; }
  .post-meta { display: flex; gap: 14px; padding-top: 0; flex-wrap: wrap; }
  .post-meta .date { display: inline; }
  .post-meta .cat { margin-top: 0; }
  .article-head { padding-top: 42px; }
  .prose-body { font-size: 17px; line-height: 1.75; }
  .prose-body.cjk { line-height: 1.9; }
  .year-group { grid-template-columns: 1fr; gap: 8px; }
  .yr { position: static; font-size: 24px; }
  .arch-item { flex-wrap: wrap; gap: 8px 12px; }
  .arch-date { flex-basis: auto; }
  .arch-t { flex-basis: 100%; order: 2; }
  .prevnext { grid-template-columns: 1fr; }
  .prevnext .next { text-align: left; }
  .footer-inner, .f-links { gap: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
