* {
  box-sizing: border-box;
}

:root {
  --color: #eeeeee;
  --background-color: #222222;
  --theme-color: #ff424d;
  --theme-color-hover: #ff6b75;
  --border-color: #444444;
  --code-bg: #181818;
  --subtle-text: #aaaaaa;
  --card-bg: rgba(255, 255, 255, 0.02);
}

html {
  font-family: 'Source Code Pro', monospace;
  color: var(--color);
  background-color: var(--background-color);
  line-height: 1.6;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a:link, a:visited {
  color: var(--theme-color);
  text-decoration: underline;
  transition: color 0.15s ease;
}

a:hover, a:active {
  color: var(--theme-color-hover);
  text-decoration: none;
}

h1, h2, h3, h4, h5, h6 {
  margin: 1em 0 0.6em 0;
  font-weight: 700;
  letter-spacing: -0.02em;
}

h1 {
  font-size: 1.85rem;
}

h2 {
  font-size: 1.4rem;
}

h3 {
  font-size: 1.15rem;
}

p {
  margin: 0.9em 0;
}

.content {
  max-width: 81ch;
  width: 100%;
  padding: 24px 20px 60px 20px;
  margin: 30px auto;
  flex: 1;
}

/* Header & Tagline */
.site-header h2 {
  margin-bottom: 0.3em;
  font-weight: 700;
}

.site-header p.tagline {
  margin-top: 0;
  margin-bottom: 1.2em;
  color: var(--subtle-text);
  font-size: 0.95rem;
}

/* Navigation Styles */
.nav-container {
  position: relative;
  margin-bottom: 2em;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 0;
}

.nav-toggle span {
  display: block;
  width: 26px;
  height: 3px;
  background-color: var(--theme-color);
  margin: 5px 0;
  transition: 0.3s;
}

.nav-menu {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
  list-style: none;
  padding: 0;
  margin: 0;
}

.nav-menu li {
  margin: 0;
  white-space: nowrap;
}

.nav-menu a {
  text-decoration: none;
  color: var(--theme-color);
}

.nav-menu a.active,
.nav-menu a.active b {
  font-weight: 700;
  color: var(--theme-color);
  text-decoration: underline;
}

.nav-menu .nav-separator {
  color: var(--color);
  opacity: 0.45;
  padding: 0 7px;
  user-select: none;
}

/* Profile Photo */
.profile-img-container {
  margin: 1.2em 0 1.5em 0;
}

.profile-img {
  width: 40%;
  min-width: 260px;
  max-width: 320px;
  height: auto;
  display: block;
}

/* Lists */
ul, ol {
  padding-left: 1.5em;
  margin: 0.8em 0;
}

li {
  margin-top: 0.45em;
  margin-bottom: 0.45em;
}

/* Fieldsets for Tools & Projects */
fieldset {
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 14px 18px;
  margin-bottom: 20px;
  background-color: var(--card-bg);
}

legend {
  padding: 0 8px;
  font-weight: 700;
  color: var(--theme-color);
  font-size: 1.05rem;
}

fieldset p {
  margin: 0.6em 0;
}

/* Code and Pre */
code {
  font-family: 'Source Code Pro', monospace;
  background-color: var(--code-bg);
  border: 1px solid #333333;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.9em;
  color: #00e676;
}

pre {
  background-color: var(--code-bg);
  border: 1px solid #2b2b2b;
  padding: 14px;
  border-radius: 4px;
  overflow-x: auto;
  font-size: 0.9em;
  line-height: 1.5;
  color: #eeeeee;
  margin: 1.2em 0;
}

pre code {
  border: none;
  padding: 0;
  background: transparent;
  color: inherit;
}

/* Code Block Container Matching User Screenshots */
.code-block-container {
  border: 1px solid #2b2b2b;
  background-color: #171717;
  border-radius: 6px;
  margin: 1.4em 0;
  overflow: hidden;
  transition: border-color 0.15s ease;
}

.code-block-container:hover {
  border-color: #383838;
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px 4px 14px;
  background: transparent;
  user-select: none;
}

.code-lang {
  font-family: 'Source Code Pro', monospace;
  font-size: 0.76rem;
  color: #888888;
  letter-spacing: 0.02em;
  line-height: 1;
}

.copy-code-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid #383838;
  border-radius: 4px;
  padding: 3px 8px;
  color: #9c9c9c;
  font-family: 'Source Code Pro', monospace;
  font-size: 0.74rem;
  line-height: 1.2;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.copy-code-btn .copy-icon {
  display: block;
  flex-shrink: 0;
  stroke: currentColor;
}

.copy-code-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.07);
  border-color: #4e4e4e;
}

.copy-code-btn.copied {
  color: #00e676;
  border-color: rgba(0, 230, 118, 0.35);
  background: rgba(0, 230, 118, 0.07);
}

.code-block-container pre {
  margin: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  padding: 6px 14px 14px 14px !important;
}

/* Interactive Mermaid Container: Zoom, Pan & Fullscreen */
.mermaid-container {
  position: relative;
  border: 1px solid #333333;
  background-color: #1a1a1a;
  border-radius: 4px;
  margin: 1.5em 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.mermaid-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  padding: 6px 10px;
  background: rgba(25, 25, 25, 0.95);
  border-bottom: 1px solid #2e2e2e;
  z-index: 10;
}

.mermaid-toolbar .m-title {
  margin-right: auto;
  font-size: 0.75rem;
  color: var(--subtle-text);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  user-select: none;
}

.m-btn {
  background: #282828;
  border: 1px solid #444444;
  color: #eeeeee;
  font-family: 'Source Code Pro', monospace;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 3px;
  cursor: pointer;
  line-height: 1;
  transition: all 0.15s ease;
  user-select: none;
}

.m-btn:hover {
  background: #383838;
  border-color: var(--theme-color);
  color: var(--theme-color);
}

.m-btn:active {
  transform: scale(0.95);
}

.mermaid-viewport {
  position: relative;
  width: 100%;
  min-height: 220px;
  max-height: 520px;
  overflow: hidden;
  cursor: grab;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #181818;
}

.mermaid-viewport.grabbing {
  cursor: grabbing !important;
}

.mermaid-content {
  display: flex;
  align-items: center;
  justify-content: center;
  transform-origin: center center;
  user-select: none;
  width: 100%;
}

.mermaid-content svg {
  max-width: none !important;
  height: auto;
  display: block;
}

.mermaid-hint {
  padding: 4px 10px;
  font-size: 0.72rem;
  color: #777777;
  text-align: right;
  border-top: 1px solid #222222;
  background: #151515;
  user-select: none;
}

/* Fullscreen Mode for Mermaid */
.mermaid-container.is-fullscreen {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 99999 !important;
  margin: 0 !important;
  border-radius: 0 !important;
  background-color: rgba(18, 18, 18, 0.98) !important;
  backdrop-filter: blur(10px) !important;
}

.mermaid-container.is-fullscreen .mermaid-viewport {
  max-height: none !important;
  flex: 1 !important;
  height: calc(100vh - 75px) !important;
}

.mermaid-container.is-fullscreen .mermaid-toolbar {
  padding: 10px 18px;
  border-bottom: 1px solid #383838;
}

/* Markdown Elements */
blockquote {
  border-left: 3px solid var(--theme-color);
  margin: 1.2em 0;
  padding: 0.5em 1.2em;
  background: rgba(255, 66, 77, 0.05);
  color: #dddddd;
}

blockquote p {
  margin: 0.3em 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
  font-size: 0.92rem;
}

table th, table td {
  border: 1px solid var(--border-color);
  padding: 8px 12px;
  text-align: left;
}

table th {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--theme-color);
}

hr {
  border: 0;
  border-top: 1px solid var(--border-color);
  margin: 2em 0;
}

img {
  max-width: 100%;
  height: auto;
}

/* Badges & Tags */
.badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 0.78rem;
  border-radius: 3px;
  border: 1px solid var(--border-color);
  background-color: #2b2b2b;
  color: #ccc;
  margin-right: 6px;
  margin-bottom: 4px;
}

/* Blog List & Post Meta */
.post-list {
  list-style: none;
  padding: 0;
  margin: 1.5em 0;
}

.post-item {
  margin-bottom: 2em;
  padding-bottom: 1.5em;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.post-item:last-child {
  border-bottom: none;
}

.post-title {
  margin: 0 0 0.4em 0;
  font-size: 1.25rem;
}

.post-meta {
  font-size: 0.82rem;
  color: var(--subtle-text);
  margin-bottom: 0.6em;
}

.post-meta span {
  margin-right: 12px;
}

.back-link {
  display: inline-block;
  margin-bottom: 1.5em;
  font-size: 0.9rem;
}

/* Loading & Error States */
.loading {
  color: var(--subtle-text);
  font-style: italic;
  padding: 2em 0;
}

.error-msg {
  border: 1px solid #d32f2f;
  background: rgba(211, 47, 47, 0.1);
  padding: 16px;
  border-radius: 4px;
}

/* Footer - exactly matching the close-up photo */
footer {
  text-align: center;
  margin-top: 5em;
  margin-bottom: 2.5em;
}

footer small {
  font-size: 0.85rem;
  color: var(--color);
  letter-spacing: 0.02em;
}

footer small a {
  color: var(--theme-color);
  text-decoration: underline;
}

footer small a:hover {
  text-decoration: none;
}

/* Responsive Navigation for Mobile */
@media screen and (max-width: 680px) {
  .nav-toggle {
    display: block;
  }

  .nav-menu {
    display: none;
    flex-direction: column;
    align-items: flex-start;
    padding: 10px 0;
    width: 100%;
  }

  .nav-menu.active {
    display: flex;
  }

  .nav-menu li {
    padding: 8px 0;
    width: 100%;
  }

  .nav-menu li:not(.nav-separator) {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  .nav-menu li:last-child {
    border-bottom: none;
  }

  .nav-menu .nav-separator {
    display: none;
  }

  .nav-toggle.active span:nth-child(1) {
    transform: rotate(-45deg) translate(-5px, 6px);
  }

  .nav-toggle.active span:nth-child(2) {
    opacity: 0;
  }

  .nav-toggle.active span:nth-child(3) {
    transform: rotate(45deg) translate(-5px, -6px);
  }

  .profile-img {
    width: 100%;
    max-width: 320px;
  }
}

/* Suppress any Mermaid error bomb popups */
svg[aria-roledescription="error"] {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  width: 0 !important;
}

/* Bottom-Right Visitor Counter (Plain Consolas Text: 000001, 000002...) */
.visitor-counter {
  position: fixed;
  bottom: 12px;
  right: 18px;
  z-index: 9999;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  color: #777777;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  margin: 0;
  user-select: none;
  cursor: default;
  line-height: 1;
  opacity: 0.8;
  transition: opacity 0.2s ease, color 0.2s ease;
}

.visitor-counter:hover {
  opacity: 1;
  color: var(--color);
}

@media screen and (max-width: 680px) {
  .visitor-counter {
    bottom: 8px;
    right: 12px;
    font-size: 0.72rem;
  }
}


