/* =========================================================
   Kauntey Acharya: portfolio
   One stylesheet shared by index.html and notes.html
   ========================================================= */

/* ---------- Tokens ---------- */
/* Original portfolio palette: beige paper / pure black, monochrome */
:root {
  --bg:      #F5F5DC;
  --surface: rgba(0, 0, 0, .04);
  --text:    #000000;
  --muted:   rgba(0, 0, 0, .66);
  --line:    rgba(0, 0, 0, .18);
  --accent:  #000000;

  --mono:  monospace;
  --serif: monospace;

  --max: 1040px;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --label-col: 180px;
}

:root[data-ka-theme="dark"] {
  --bg:      #000000;
  --surface: rgba(255, 255, 255, .06);
  --text:    #FFFFFF;
  --muted:   rgba(255, 255, 255, .66);
  --line:    rgba(255, 255, 255, .2);
  --accent:  #FFFFFF;
  color-scheme: dark;
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.5;          /* original 1.75 minus .25 */
  -webkit-font-smoothing: antialiased;
  transition: background-color .3s ease, color .3s ease;
}
a { color: inherit; }
img { max-width: 100%; }
::selection { background: var(--text); color: var(--bg); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s ease;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar .wrap {
  display: flex; align-items: center; justify-content: space-between;
  height: 60px; gap: 1rem;
}
.brand {
  font-family: var(--mono); font-weight: 500; font-size: .95rem;
  text-decoration: none; letter-spacing: .02em;
}
.nav { display: flex; align-items: center; gap: 1.4rem; font-family: var(--mono); font-size: .82rem; }
.nav a { text-decoration: none; color: var(--muted); transition: color .2s; white-space: nowrap; }
.nav a:hover { color: var(--text); }
/* About (main page) and Notes (separate page) are underlined; the one you are on is bold */
.nav a.nav-u { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 5px; }
.nav a.nav-u[aria-current="page"] { color: var(--text); font-weight: 700; text-decoration-thickness: 2px; }
.theme-btn {
  width: 34px; height: 34px; display: grid; place-items: center;
  background: none; border: 1px solid var(--line); border-radius: 50%;
  color: var(--text); cursor: pointer; transition: border-color .2s;
}
.theme-btn:hover { border-color: var(--text); }
.theme-btn svg { width: 16px; height: 16px; }

/* ---------- Hero ---------- */
.hero { padding: clamp(5rem, 14vh, 9rem) 0 clamp(3.5rem, 8vh, 5rem); }
.status {
  display: inline-flex; align-items: center; gap: .55rem;
  font-family: var(--mono); font-size: .78rem; color: var(--muted);
  margin-bottom: 2rem;
}
.status::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: #3E9B5A; box-shadow: 0 0 0 3px color-mix(in srgb, #3E9B5A 22%, transparent);
}
.hero h1 {
  font-family: var(--serif); font-weight: 700;
  font-size: clamp(2.4rem, 6vw, 4rem);
  line-height: 1.1; letter-spacing: 0;
  margin-bottom: 1.2rem;
}
.hero .roles { font-family: var(--mono); font-size: clamp(.85rem, 1.8vw, 1rem); color: var(--muted); margin-bottom: 1.8rem; }
.hero .lede { font-size: clamp(1.1rem, 2.2vw, 1.3rem); max-width: 36em; margin-bottom: 2.2rem; }
.hero .lede em { font-style: italic; }
.nw { white-space: nowrap; }

.links { display: flex; flex-wrap: wrap; gap: .6rem 1.6rem; font-family: var(--mono); font-size: .85rem; }
.links a {
  display: inline-flex; align-items: center; gap: .45rem;
  text-decoration: none; color: var(--text);
  border-bottom: 1px solid var(--line); padding-bottom: 2px;
  transition: border-color .2s, color .2s;
}
.links a:hover { border-color: var(--accent); color: var(--accent); }
.links svg { width: 15px; height: 15px; fill: currentColor; }
.links a[hidden] { display: none; }
.hero .loc { margin-top: 2.2rem; font-family: var(--mono); font-size: .78rem; color: var(--muted); }

/* ---------- Sections ---------- */
.section {
  display: grid; grid-template-columns: var(--label-col) 1fr; gap: 2rem;
  padding: 4rem 0; border-top: 1px solid var(--line);
}
.section-label {
  font-family: var(--mono); font-size: .78rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: .1em;
  position: sticky; top: 84px; align-self: start;
}
.section-label span { display: block; color: var(--text); margin-bottom: .2rem; }
.section-body > p { max-width: 38em; margin-bottom: 1.1em; }
.section-body > p:last-child { margin-bottom: 0; }

/* ---------- Generic list rows ---------- */
.rows { list-style: none; }
.row { padding: 1.6rem 0; border-bottom: 1px solid var(--line); }
.row:first-child { padding-top: 0; }
.row:last-child { border-bottom: 0; padding-bottom: 0; }
.row-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.row h3 { font-size: 1.1rem; font-weight: 700; line-height: 1.35; }
.row h3 a { text-decoration: none; }
.row h3 a:hover { color: var(--accent); }
.row .when { font-family: var(--mono); font-size: .78rem; color: var(--muted); white-space: nowrap; }
.row .org { font-family: var(--mono); font-size: .82rem; color: var(--muted); margin: .15rem 0 .6rem; }
.row p { max-width: 40em; }
.row ul.points { margin: .5rem 0 0 1.1rem; max-width: 40em; }
.row ul.points li { margin-bottom: .25rem; }

.tags { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .8rem; list-style: none; }
.tags li {
  font-family: var(--mono); font-size: .7rem; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px; padding: .1rem .6rem;
}
.row-links { display: flex; flex-wrap: wrap; gap: 1.2rem; margin-top: .9rem; font-family: var(--mono); font-size: .8rem; }
.row-links a { text-decoration: none; color: var(--text); border-bottom: 1px solid var(--line); }
.row-links a:hover { border-color: var(--text); }
.row-links a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Skills ---------- */
.skill-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.4rem 2.2rem; }
@media (max-width: 820px) { .skill-groups { grid-template-columns: 1fr; } }
.skill-group h3 { font-family: var(--mono); font-size: .78rem; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin-bottom: .35rem; }
.skill-group p { font-size: 1rem; }

/* ---------- Publications ---------- */
.pub .authors { font-size: .95rem; color: var(--muted); margin: .3rem 0 .15rem; }
.pub .authors strong { color: var(--text); font-weight: 600; }
.pub .venue { font-size: .9rem; }
.pub .venue a { text-decoration: none; border-bottom: 1px solid var(--line); }
.pub .venue a:hover { border-color: var(--text); }
.pub .venue i { font-style: normal; color: var(--text); }
}

/* ---------- Blog teaser + blog page ---------- */
.post-list { list-style: none; }
.post-item { display: grid; grid-template-columns: 7.5rem 1fr; gap: 1rem; padding: 1.1rem 0; border-bottom: 1px solid var(--line); }
.post-item:last-child { border-bottom: 0; }
.post-item time { font-family: var(--mono); font-size: .78rem; color: var(--muted); padding-top: .25rem; }
.post-item a { text-decoration: none; font-weight: 600; font-size: 1.08rem; }
.post-item a:hover { color: var(--accent); }
.post-item p { color: var(--muted); font-size: .98rem; margin-top: .15rem; }
.more-link { display: inline-block; margin-top: 1.4rem; font-family: var(--mono); font-size: .82rem; color: var(--accent); text-decoration: none; }
.more-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.empty { color: var(--muted); font-style: italic; }

.page-head { padding: 4.5rem 0 2.5rem; }
.page-head h1 { font-size: clamp(2.2rem, 5vw, 3.2rem); line-height: 1.1; letter-spacing: -.015em; font-weight: 600; }
.page-head p { color: var(--muted); margin-top: .6rem; max-width: 34em; }

.filter-bar { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1.5rem; }
.filter-bar button {
  font-family: var(--mono); font-size: .75rem; color: var(--muted);
  background: none; border: 1px solid var(--line); border-radius: 999px;
  padding: .2rem .75rem; cursor: pointer;
}
.filter-bar button:hover { color: var(--text); border-color: var(--text); }
.filter-bar button[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }

/* article */
.article { max-width: 42rem; margin: 0 auto; padding: 3.5rem 0 4rem; }
.article .back { font-family: var(--mono); font-size: .8rem; color: var(--muted); text-decoration: none; }
.article .back:hover { color: var(--text); }
.article header { margin: 2rem 0 2.5rem; }
.article h1 { font-size: clamp(2rem, 5vw, 2.8rem); line-height: 1.15; letter-spacing: -.015em; font-weight: 600; }
.article .meta { font-family: var(--mono); font-size: .8rem; color: var(--muted); margin-top: .8rem; }
.prose > * + * { margin-top: 1.1em; }
.prose h2 { font-size: 1.5rem; margin-top: 2.2em; line-height: 1.3; }
.prose h3 { font-size: 1.2rem; margin-top: 1.8em; }
.prose a { color: var(--accent); text-underline-offset: 3px; }
.prose ul, .prose ol { padding-left: 1.3rem; }
.prose li + li { margin-top: .3em; }
.prose blockquote { border-left: 2px solid var(--accent); padding-left: 1rem; color: var(--muted); font-style: italic; }
.prose code { font-family: var(--mono); font-size: .86em; background: var(--surface); padding: .1em .35em; border-radius: 3px; }
.prose pre { background: var(--surface); border: 1px solid var(--line); padding: 1rem 1.1rem; overflow-x: auto; border-radius: 4px; line-height: 1.5; }
.prose pre code { background: none; padding: 0; font-size: .85rem; }
.prose img { display: block; margin: 1.6em auto; border-radius: 4px; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.5em 0; }
.prose table { border-collapse: collapse; width: 100%; font-size: .95rem; display: block; overflow-x: auto; }
.prose th, .prose td { border-bottom: 1px solid var(--line); padding: .45rem .6rem; text-align: left; }
.prose .katex-display { overflow-x: auto; overflow-y: hidden; padding: .3rem 0; }
.prose math[display="block"] { font-size: 1.15em; padding: .4rem 0; }
.prose math { font-family: "Latin Modern Math", "STIX Two Math", "Cambria Math", serif; }

/* ---------- Contact ---------- */
.contact-big { font-size: 1.1rem; max-width: 34em; margin-bottom: 1.2rem; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--line); padding: 2rem 0 5.5rem; font-family: var(--mono); font-size: .75rem; color: var(--muted); }
.footer .wrap { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.footer a { text-decoration: none; }
.footer a:hover { color: var(--text); }

/* ---------- Reveal ---------- */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .7s ease, transform .7s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ---------- Chat widget ---------- */
.chat-toggle {
  position: fixed; right: 20px; bottom: 20px; z-index: 60;
  height: 44px; padding: 0 1rem 0 .85rem; border-radius: 999px;
  display: inline-flex; align-items: center; gap: .5rem;
  background: var(--text); color: var(--bg); border: 0; cursor: pointer;
  font-family: var(--mono); font-size: .8rem;
  box-shadow: 0 6px 20px rgba(0,0,0,.15);
  transition: transform .2s ease;
}
.chat-toggle:hover { transform: translateY(-2px); }
.chat-toggle svg { width: 17px; height: 17px; }
.chat-toggle[hidden] { display: none; }

.chat {
  position: fixed; right: 20px; bottom: 20px; z-index: 61;
  width: 370px; height: min(540px, calc(100vh - 40px));
  display: flex; flex-direction: column;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 16px 48px rgba(0,0,0,.18);
  opacity: 0; transform: translateY(12px) scale(.98); pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}
.chat.open { opacity: 1; transform: none; pointer-events: auto; }
/* Resize grip in the top-left corner (the panel is anchored bottom-right) */
.chat-resize {
  position: absolute; left: 0; top: 0; width: 18px; height: 18px; cursor: nwse-resize; z-index: 2;
  border-top-left-radius: 10px; touch-action: none;
  background: linear-gradient(135deg, var(--muted) 0 1.5px, transparent 1.5px 5px, var(--muted) 5px 6.5px, transparent 6.5px) no-repeat 5px 5px / 9px 9px;
  opacity: .45; transition: opacity .15s;
}
.chat-resize:hover, .chat.resizing .chat-resize { opacity: 1; }
.chat.resizing { transition: none; user-select: none; }
.chat-head { padding-left: 1.4rem; }
.bk-tz { display: grid; gap: .25rem; margin-bottom: .6rem; }
.bk-tz select.bk-in { padding: .35rem .5rem; }
.bk-when { margin: .4rem 0; line-height: 1.45; }
.bk-when small, .bk-sub { color: var(--muted); font-size: .78rem; }
.chat-head { display: flex; justify-content: space-between; align-items: center; padding: .8rem 1rem; border-bottom: 1px solid var(--line); }
.chat-head strong { font-family: var(--mono); font-size: .85rem; font-weight: 500; }
.chat-close { background: none; border: 0; color: var(--muted); font-size: 1.4rem; line-height: 1; cursor: pointer; padding: .2rem .4rem; }
.chat-close:hover { color: var(--text); }
.chat-log { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: .6rem; }
.msg { max-width: 88%; padding: .6rem .8rem; border-radius: 10px; font-size: .92rem; line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; }
.msg.bot { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 2px; }
.msg.user { align-self: flex-end; background: var(--text); color: var(--bg); border-bottom-right-radius: 2px; font-family: var(--mono); font-size: .82rem; }
.msg a { color: var(--accent); }
.msg.typing { display: inline-flex; align-items: center; gap: .3rem; color: var(--muted); font-family: var(--mono); font-size: .78rem; }
.msg.typing .typing-label { margin-right: .15rem; }
.msg.typing .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .3; animation: ka-typing 1s infinite ease-in-out; }
.msg.typing .dot:nth-child(3) { animation-delay: .15s; }
.msg.typing .dot:nth-child(4) { animation-delay: .3s; }
@keyframes ka-typing { 0%, 100% { opacity: .3; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-2px); } }
@media (prefers-reduced-motion: reduce) { .msg.typing .dot { animation: none; opacity: .6; } }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.chips button {
  font-family: var(--mono); font-size: .72rem; color: var(--text);
  background: none; border: 1px solid var(--line); border-radius: 999px;
  padding: .25rem .65rem; cursor: pointer;
}
.chips button:hover { border-color: var(--text); }
.chat-form { display: flex; gap: .4rem; padding: .7rem; border-top: 1px solid var(--line); }
.chat-form input {
  flex: 1; min-width: 0; font: inherit; font-family: var(--mono); font-size: .82rem;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 6px; padding: .55rem .7rem; outline: none;
}
.chat-form input:focus { border-color: var(--text); }
.chat-form button { background: var(--text); color: var(--bg); border: 0; border-radius: 6px; padding: 0 .8rem; cursor: pointer; font-family: var(--mono); font-size: .8rem; }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  body { font-size: 15px; }
  .section { grid-template-columns: 1fr; gap: 1.2rem; padding: 3rem 0; }
  .section-label { position: static; }
  .nav .hide-sm { display: none; }
  .post-item { grid-template-columns: 1fr; gap: .1rem; }
}
@media (max-width: 480px) {
  .nav { gap: 1rem; }
  .chat { right: 10px; left: 10px; bottom: 10px; width: auto !important; height: min(78vh, 560px) !important; }
  .chat-resize { display: none; }
  .chat-toggle span { display: none; }
  .chat-toggle { padding: 0; width: 44px; justify-content: center; }
}

/* ---------- Scrollbars: thin, quiet, and theme-aware ---------- */
html { scrollbar-color: var(--line) transparent; }
.chat-log, .prose pre, .prose table, .prose .katex-display {
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.chat-log { scrollbar-gutter: stable; }
::-webkit-scrollbar { width: 8px; height: 8px; }
.chat-log::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.chat-log::-webkit-scrollbar-thumb { border-width: 1px; }
::-webkit-scrollbar-thumb:hover { background-color: var(--muted); }
::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
::-webkit-scrollbar-corner { background: transparent; }

/* ---------- Chat: booking mode ---------- */
.msg.bk { max-width: 100%; width: 100%; white-space: normal; }
.bk-q { margin: 0 0 .6rem; }
.bk-q:last-child { margin-bottom: 0; }
.bk-row { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .6rem; }
.bk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); gap: .35rem; margin-bottom: .6rem; }
.bk-chip {
  font-family: var(--mono); font-size: .74rem; color: var(--text);
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px;
  padding: .3rem .5rem; cursor: pointer;
}
.bk-chip:hover:not(:disabled) { border-color: var(--text); }
.bk-chip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.bk-actions { display: flex; gap: .4rem; justify-content: flex-end; margin-top: .4rem; }
.bk-primary, .bk-ghost, .bk-link {
  font-family: var(--mono); font-size: .78rem; border-radius: 6px; padding: .4rem .75rem; cursor: pointer;
}
.bk-primary { background: var(--text); color: var(--bg); border: 1px solid var(--text); }
.bk-ghost { background: none; color: var(--text); border: 1px solid var(--line); }
.bk-link { background: none; border: 0; padding: 0; color: var(--text); text-decoration: underline; text-underline-offset: 3px; margin-top: .3rem; }
.bk button:disabled { opacity: .45; cursor: default; }
.bk-l { display: block; font-family: var(--mono); font-size: .7rem; color: var(--muted); margin: .45rem 0 .2rem; }
.bk-in {
  width: 100%; font-family: var(--mono); font-size: .8rem; color: var(--text);
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: .45rem .55rem; outline: none;
}
.bk-in:focus { border-color: var(--text); }
.bk-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.bk-err { color: #b4541a; font-size: .74rem; min-height: 1em; margin: .35rem 0 0; }
.bk-ts { margin-top: .5rem; }
.bk-ts:empty { display: none; }
.bk-note { font-size: .7rem; color: var(--muted); margin: .4rem 0 0; }
.bk-note a { color: inherit; }
.bk-mail { border: 1px dashed var(--line); border-radius: 6px; padding: .55rem .65rem; background: var(--bg); font-size: .85rem; }
.bk-mail small { display: block; color: var(--muted); font-family: var(--mono); font-size: .68rem; margin-bottom: .2rem; }
.bk-ok { color: #2f7d46; }
:root[data-ka-theme="dark"] .bk-ok { color: #6cc58a; }
:root[data-ka-theme="dark"] .bk-err { color: #e2a35a; }
.bk-bar {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  padding: .45rem .8rem; border-top: 1px solid var(--line);
  font-family: var(--mono); font-size: .72rem; color: var(--muted);
}
.bk-bar[hidden] { display: none; }
.bk-cancel { font-family: var(--mono); font-size: .72rem; background: none; color: var(--text); border: 1px solid var(--line); border-radius: 999px; padding: .2rem .7rem; cursor: pointer; }
.bk-cancel:hover { border-color: var(--text); }
.chat-form input:disabled { opacity: .55; cursor: not-allowed; }
.chat-form button:disabled { opacity: .4; cursor: not-allowed; }

/* ---------- Konzi: the tour guide ----------
   Konzi's blue stays the same in both themes and is a little see-through at rest;
   the speech bubble follows the theme. Positions are set by assets/konzi.js. */
:root { --konzi: #5C9DF2; --konzi-size: 60px; }
.konzi { position: fixed; left: 0; top: 0; width: 0; height: 0; z-index: 55; }
.konzi-head, .konzi-bub, .konzi-say { position: fixed; left: 0; top: 0; will-change: transform; }
.konzi-head {
  width: var(--konzi-size); height: var(--konzi-size); padding: 0; border: 0; background: none;
  border-radius: 50%; cursor: grab; touch-action: none; -webkit-tap-highlight-color: transparent;
  filter: drop-shadow(0 6px 14px rgba(0,0,0,.18));
}
.konzi.dragging .konzi-head { cursor: grabbing; }
.konzi-head svg { width: 100%; height: 100%; display: block; overflow: visible; pointer-events: none; }
.konzi-head:focus-visible { outline: 2px solid var(--konzi); outline-offset: 4px; }
.konzi-bub { border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle at 35% 30%, #93C0F8 0%, var(--konzi) 55%, #3F86E6 100%); }
.konzi-b1 { width: calc(var(--konzi-size) * .2); height: calc(var(--konzi-size) * .2); }
.konzi-b2 { width: calc(var(--konzi-size) * .13); height: calc(var(--konzi-size) * .13); }
.konzi-head, .konzi-bub { opacity: .75; transition: opacity .25s ease; }
.konzi.talking .konzi-head, .konzi.talking .konzi-bub,
.konzi.dragging .konzi-head, .konzi.dragging .konzi-bub,
.konzi-head:hover, .konzi-head:focus-visible { opacity: 1; }
.kz-v, .kz-cheeks, .kz-zzz { transition: opacity .15s; }
.kz-mouth { transition: d .22s ease; }
.kz-zzz { opacity: 0; }
.kz-zzz text { font-family: var(--mono); font-weight: 700; fill: var(--konzi); }

.konzi-say {
  width: min(300px, calc(100vw - 24px));
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 36px rgba(0,0,0,.16);
  padding: .75rem .9rem .8rem;
  opacity: 0; transition: opacity .2s ease;
}
.konzi-say.on { opacity: 1; }
.konzi-say-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: .25rem; }
.konzi-name { font-family: var(--mono); font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--konzi); }
.konzi-x { background: none; border: 0; color: var(--muted); font-size: 1.2rem; line-height: 1; cursor: pointer; padding: 0 .2rem; }
.konzi-x:hover { color: var(--text); }
.konzi-text { font-family: var(--mono); font-size: .84rem; line-height: 1.5; margin: 0; min-height: 2.6em; }
.konzi-acts { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .65rem; }
.konzi-acts:empty { display: none; }
.konzi-btn {
  font-family: var(--mono); font-size: .75rem; line-height: 1; padding: .5rem .7rem; border-radius: 999px;
  border: 1px solid var(--line); background: transparent; color: var(--text); cursor: pointer; text-decoration: none;
}
.konzi-btn:hover { border-color: var(--text); }
.konzi-btn.primary { background: var(--konzi); border-color: var(--konzi); color: #0B1A33; font-weight: 700; }
.konzi-btn.quiet { border-color: transparent; color: var(--muted); margin-left: auto; padding-inline: .3rem; }
.konzi-btn.quiet:hover { color: var(--text); }
.konzi-btn:focus-visible { outline: 2px solid var(--konzi); outline-offset: 2px; }

@media (max-width: 760px) { :root { --konzi-size: 50px; } }
@media print { .konzi { display: none; } }

/* ---------- Note pages: tags, ending, older/newer ---------- */
.article .meta a { color: inherit; text-underline-offset: 3px; }
.article .meta a:hover { color: var(--text); }
.note-end { margin-top: 3.5rem; padding-top: 1.6rem; border-top: 1px solid var(--line); }
.note-follow { color: var(--muted); font-size: .95rem; }
.note-follow a { color: var(--text); text-underline-offset: 3px; }
.note-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1.8rem; }
.note-nav a { display: block; text-decoration: none; padding: .9rem 1rem; border: 1px solid var(--line); border-radius: 4px; font-weight: 600; line-height: 1.35; }
.note-nav a:hover { border-color: var(--text); }
.note-nav span { display: block; font-family: var(--mono); font-size: .75rem; font-weight: 400; color: var(--muted); margin-bottom: .3rem; }
.note-nav .note-older { text-align: right; }
@media (max-width: 560px) { .note-nav { grid-template-columns: 1fr; } .note-nav .note-older { text-align: left; } }
.feed-link { font-family: var(--mono); font-size: .8rem; }
.feed-link a { color: var(--text); text-underline-offset: 3px; }
