/* Self-declared in place of @fontsource/iosevka's own stylesheets so we can
   add unicode-range: Iosevka's glyph set includes monochrome symbol/emoji
   codepoints (e.g. U+1F642), and without a range restriction those glyphs
   pre-empt the color-emoji fonts later in the --font-* stacks. Capping this
   to the BMP (all of normal Latin text/code) keeps real emoji (all above
   U+FFFF) out of Iosevka's claimed range so they fall through correctly. */
@font-face {
  font-family: "Iosevka";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src:
    url(https://cdn.jsdelivr.net/npm/@fontsource/iosevka@5.3.0/files/iosevka-latin-400-normal.woff2)
      format("woff2"),
    url(https://cdn.jsdelivr.net/npm/@fontsource/iosevka@5.3.0/files/iosevka-latin-400-normal.woff)
      format("woff");
  unicode-range: U+0000-FFFF;
}
@font-face {
  font-family: "Iosevka";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src:
    url(https://cdn.jsdelivr.net/npm/@fontsource/iosevka@5.3.0/files/iosevka-latin-400-italic.woff2)
      format("woff2"),
    url(https://cdn.jsdelivr.net/npm/@fontsource/iosevka@5.3.0/files/iosevka-latin-400-italic.woff)
      format("woff");
  unicode-range: U+0000-FFFF;
}
@font-face {
  font-family: "Iosevka";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src:
    url(https://cdn.jsdelivr.net/npm/@fontsource/iosevka@5.3.0/files/iosevka-latin-600-normal.woff2)
      format("woff2"),
    url(https://cdn.jsdelivr.net/npm/@fontsource/iosevka@5.3.0/files/iosevka-latin-600-normal.woff)
      format("woff");
  unicode-range: U+0000-FFFF;
}
@font-face {
  font-family: "Iosevka";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src:
    url(https://cdn.jsdelivr.net/npm/@fontsource/iosevka@5.3.0/files/iosevka-latin-700-normal.woff2)
      format("woff2"),
    url(https://cdn.jsdelivr.net/npm/@fontsource/iosevka@5.3.0/files/iosevka-latin-700-normal.woff)
      format("woff");
  unicode-range: U+0000-FFFF;
}
@font-face {
  font-family: "Iosevka";
  font-style: italic;
  font-weight: 700;
  font-display: swap;
  src:
    url(https://cdn.jsdelivr.net/npm/@fontsource/iosevka@5.3.0/files/iosevka-latin-700-italic.woff2)
      format("woff2"),
    url(https://cdn.jsdelivr.net/npm/@fontsource/iosevka@5.3.0/files/iosevka-latin-700-italic.woff)
      format("woff");
  unicode-range: U+0000-FFFF;
}

:root {
  --bg: #fbfaf7;
  --bg-alt: #f1efe9;
  --fg: #1c1c1c;
  --muted: #6b6b6b;
  --accent: #0f6b52;
  --border: #e2ded4;
  --code-bg: #f1efe9;
  --font-sans: "Iosevka", ui-monospace, SFMono-Regular, "SF Mono", Menlo,
    Consolas, "Liberation Mono", monospace, "Apple Color Emoji",
    "Segoe UI Emoji", "Noto Color Emoji";
  --font-mono: "Iosevka", ui-monospace, SFMono-Regular, "SF Mono", Menlo,
    Consolas, "Liberation Mono", monospace, "Apple Color Emoji",
    "Segoe UI Emoji", "Noto Color Emoji";
  --max-width: 680px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14161a;
    --bg-alt: #1c1f24;
    --fg: #e7e6e2;
    --muted: #9aa0a6;
    --accent: #4fd1a5;
    --border: #2a2e35;
    --code-bg: #1c1f24;
  }
}

:root[data-theme="dark"] {
  --bg: #14161a;
  --bg-alt: #1c1f24;
  --fg: #e7e6e2;
  --muted: #9aa0a6;
  --accent: #4fd1a5;
  --border: #2a2e35;
  --code-bg: #1c1f24;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0 20px;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.65;
}

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

header {
  padding: 48px 0 20px;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.site-title {
  min-width: 0;
  overflow-wrap: anywhere;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 1.05em;
  color: var(--fg);
}
.site-title:hover {
  text-decoration: none;
  color: var(--accent);
}

/* theme toggle */
.theme-toggle {
  flex-shrink: 0;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.theme-toggle-track {
  position: relative;
  display: block;
  width: 44px;
  height: 24px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-alt);
  transition: background 0.2s ease, border-color 0.2s ease;
}
.theme-toggle:hover .theme-toggle-track {
  border-color: var(--accent);
}
.theme-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s ease, background 0.25s ease;
}
.theme-toggle-thumb svg {
  position: absolute;
  width: 12px;
  height: 12px;
  fill: none;
  stroke: var(--bg);
  stroke-width: 2;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.theme-toggle-thumb .icon-sun {
  fill: var(--bg);
  opacity: 1;
  transform: rotate(0deg);
}
.theme-toggle-thumb .icon-moon {
  fill: var(--bg);
  stroke: none;
  opacity: 0;
  transform: rotate(-90deg);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle-thumb {
    transform: translateX(20px);
  }
  :root:not([data-theme="light"]) .theme-toggle-thumb .icon-sun {
    opacity: 0;
    transform: rotate(90deg);
  }
  :root:not([data-theme="light"]) .theme-toggle-thumb .icon-moon {
    opacity: 1;
    transform: rotate(0deg);
  }
}
:root[data-theme="dark"] .theme-toggle-thumb {
  transform: translateX(20px);
}
:root[data-theme="dark"] .theme-toggle-thumb .icon-sun {
  opacity: 0;
  transform: rotate(90deg);
}
:root[data-theme="dark"] .theme-toggle-thumb .icon-moon {
  opacity: 1;
  transform: rotate(0deg);
}

header nav {
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 0.9em;
}
header nav a {
  color: var(--muted);
  margin-right: 16px;
}
header nav a:hover {
  color: var(--accent);
}

hr,
.rule {
  border: none;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}

/* bio */
#bio {
  display: flex;
  gap: 20px;
  align-items: center;
  margin-bottom: 20px;
}
#bio .avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  flex-shrink: 0;
  display: block;
}
#bio #text-wrapper p {
  margin: 0;
}
#bio .contact {
  font-family: var(--font-mono);
  font-size: 0.85em;
  color: var(--muted);
  margin-top: 8px;
}
#bio .contact a {
  color: var(--muted);
}
#bio .contact a:hover {
  color: var(--accent);
}

main {
  padding: 10px 0 40px;
}

/* search */
.search-box {
  margin-bottom: 20px;
}
.search-box input {
  width: 100%;
  padding: 8px 12px;
  font-family: var(--font-mono);
  font-size: 0.9em;
  color: var(--fg);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.search-box input::placeholder {
  color: var(--muted);
}
.search-box input:focus {
  outline: none;
  border-color: var(--accent);
}

#search-empty {
  display: none;
  font-family: var(--font-mono);
  font-size: 0.9em;
  color: var(--muted);
  padding: 20px 0;
}

/* encrypted posts */
.decrypt-gate {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
  padding: 20px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.decrypt-gate p {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.9em;
}
.decrypt-gate input {
  padding: 8px 12px;
  font-family: var(--font-mono);
  font-size: 0.9em;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.decrypt-gate input:focus {
  outline: none;
  border-color: var(--accent);
}
.decrypt-gate button {
  padding: 8px 12px;
  font-family: var(--font-mono);
  font-size: 0.9em;
  color: var(--bg);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 6px;
  cursor: pointer;
}
.decrypt-error {
  color: #c0392b;
}

/* tag filter */
.tag-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 20px;
}
.tag-filter-btn,
.tag-filter-clear {
  font-family: var(--font-mono);
  font-size: 0.78em;
  color: var(--muted);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 10px;
  cursor: pointer;
}
.tag-filter-btn:hover,
.tag-filter-clear:hover {
  border-color: var(--accent);
  color: var(--fg);
}
.tag-filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
}
.tag-filter-clear {
  border-style: dashed;
}

/* post list */
ul.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
ul.post-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  align-items: center;
}
ul.post-list li:first-child {
  border-top: 1px solid var(--border);
}
.post-thumb {
  flex: 0 0 auto;
  display: block;
  width: 36px;
  height: 36px;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.post-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
ul.post-list time {
  font-family: var(--font-mono);
  color: var(--muted);
  font-size: 0.85em;
  flex: 0 0 100px;
}
ul.post-list .post-title {
  flex: 1;
}
ul.post-list .tags {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px 8px;
  font-family: var(--font-mono);
  font-size: 0.78em;
}
ul.post-list .tags .tag {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  color: var(--muted);
  cursor: pointer;
}
ul.post-list .tags .tag:hover,
ul.post-list .tags .tag.active {
  color: var(--accent);
  text-decoration: underline;
}

/* post page */
.post-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}
.post-header-thumb {
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  border-radius: 4px;
  object-fit: cover;
  border: 1px solid var(--border);
}
.post-header h1 {
  margin: 0 0 8px;
  font-size: 1.6em;
  line-height: 1.3;
}
.post-meta {
  font-family: var(--font-mono);
  font-size: 0.85em;
  color: var(--muted);
}
.post-meta .tag {
  margin-left: 10px;
}
.post-meta .tag::before {
  content: "#";
}

.content h2,
.content h3 {
  margin-top: 1.8em;
  margin-bottom: 0.6em;
  text-align: left;
}
.content p,
.content ul,
.content ol,
.content pre,
.content blockquote,
.content table {
  margin-bottom: 1.2em;
}
.content img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.2em 0;
  border-radius: 6px;
  border: 1px solid var(--border);
}
.content code {
  font-family: var(--font-mono);
  background: var(--code-bg);
  padding: 2px 5px;
  border-radius: 3px;
  font-size: 0.9em;
}
.content pre {
  background: var(--code-bg);
  padding: 14px 16px;
  border-radius: 6px;
  overflow-x: auto;
  border: 1px solid var(--border);
}
.content pre code {
  background: none;
  padding: 0;
  font-size: 0.85em;
}

.content blockquote {
  margin-left: 0;
  padding-left: 16px;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}

.content table {
  width: 100%;
  border-collapse: collapse;
}
.content th,
.content td {
  border: 1px solid var(--border);
  padding: 6px 10px;
  text-align: left;
}
.content th {
  background: var(--bg-alt);
}
/* wide tables scroll inside their own box on phones instead of pushing the
   whole page sideways (display:block is what lets overflow-x apply) */
@media (max-width: 600px) {
  .content table {
    display: block;
    overflow-x: auto;
  }
}

.mermaid {
  margin: 1.6em 0;
  text-align: center;
}

.video {
  position: relative;
  padding-bottom: 56.25%;
  margin-bottom: 1.2em;
  width: 100%;
}
.video iframe {
  position: absolute;
  inset: 0;
  height: 100%;
  width: 100%;
  border: 0;
}

footer {
  padding: 30px 0 50px;
  font-family: var(--font-mono);
  font-size: 0.8em;
  color: var(--muted);
  border-top: 1px solid var(--border);
}

@media (max-width: 480px) {
  body {
    font-size: 16px;
  }
  ul.post-list li {
    flex-direction: column;
    gap: 2px;
  }
  ul.post-list time {
    flex: none;
  }
}

/* home / presentation */
.hero-head {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 24px;
}
.hero-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  flex-shrink: 0;
  display: block;
}
.hero h1 {
  margin: 0;
  font-size: 1.9em;
  line-height: 1.2;
}
.hero-role {
  margin: 4px 0 0;
  font-family: var(--font-mono);
  color: var(--muted);
}
.hero .content > :first-child {
  margin-top: 0;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 20px;
  margin: 24px 0 0;
}
.button {
  font-family: var(--font-mono);
  font-size: 0.9em;
  padding: 8px 16px;
  color: var(--bg);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 6px;
}
.button:hover {
  text-decoration: none;
  opacity: 0.85;
}
.hero-contact {
  font-family: var(--font-mono);
  font-size: 0.85em;
  color: var(--muted);
}
.hero-contact a {
  color: var(--muted);
}
.hero-contact a:hover {
  color: var(--accent);
}
.home-section {
  margin-top: 40px;
}
.home-section h2 {
  margin: 0 0 12px;
  font-size: 1.2em;
}
.section-more {
  margin: 12px 0 0;
  font-family: var(--font-mono);
  font-size: 0.9em;
}

@media (max-width: 480px) {
  .hero-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}
