*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #0b0b0b;
  --sidebar-bg:  #0f0f0f;
  --panel-bg:    #0d0d0d;
  --card-bg:     #111;
  --border:      #1f3f1f;
  --border-dim:  #161f16;
  --accent:      #00e040;
  --accent-dim:  #005520;
  --text:        #b4e8b4;
  --text-dim:    #5a8a5a;
  --text-bright: #00f048;
  --link:        #00e040;
  --link-vis:    #008820;
}

body {
  font-family: 'Share Tech Mono', 'Courier New', monospace;
  font-size: 13px;
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent 0px, transparent 3px,
    rgba(0,224,64,0.018) 3px, rgba(0,224,64,0.018) 4px
  );
  pointer-events: none;
  z-index: 9999;
}

a { color: var(--link); text-decoration: none; }
a:visited { color: var(--link-vis); }
a:hover { text-decoration: underline; color: #fff; }

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 10px 0;
}

.site-header {
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--border);
  padding: 22px 28px 16px;
  display: flex;
  align-items: flex-end;
  gap: 22px;
}

.header-name {
  font-family: 'VT323', monospace;
  font-size: 58px;
  color: var(--text-bright);
  line-height: 1;
  letter-spacing: 3px;
  text-shadow: 0 0 28px rgba(0,240,72,0.45);
}

.header-sub {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.8;
  padding-bottom: 5px;
  margin-left: auto;
  text-align: right;
}
.header-sub b { color: var(--text-bright); font-weight: normal; }

.layout {
  display: flex;
  min-height: calc(100vh - 110px);
}

.sidebar {
  width: 176px;
  min-width: 176px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 16px 12px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.sidebar-nav-area {
  flex: 1;
}

.sidebar-bottom {
  margin-top: auto;
  padding-top: 12px;
}

.avatar-box {
  width: 96px;
  height: 96px;
  border: 1px solid var(--accent);
  box-shadow: 0 0 14px rgba(0,224,64,0.25), inset 0 0 10px rgba(0,224,64,0.04);
  margin: 0 auto 14px;
  overflow: hidden;
  display: block;
}
.avatar-box img { width: 100%; height: 100%; object-fit: cover; display: block; }

.sidebar-links {
  display: flex;
  flex-wrap: nowrap;
  gap: 5px;
  justify-content: flex-start;
  margin-bottom: 14px;
}
.sidebar-links a {
  display: flex; align-items: center; justify-content: center;
  width: 27px; height: 27px;
  min-width: 27px;
  border: 1px solid var(--border);
  color: var(--text-dim);
  transition: border-color 0.12s, color 0.12s, box-shadow 0.12s;
}
.sidebar-links a:hover {
  border-color: var(--accent);
  color: var(--text-bright);
  box-shadow: 0 0 7px rgba(0,224,64,0.3);
  text-decoration: none;
}
.sidebar-links a svg { display: block; fill: currentColor; }

.nav-label {
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.nav-btn {
  display: block;
  width: 100%;
  background: transparent;
  border: none;
  border-left: 2px solid transparent;
  color: var(--text-dim);
  font-family: 'Share Tech Mono', monospace;
  font-size: 13px;
  text-align: left;
  padding: 5px 8px;
  margin-bottom: 1px;
  cursor: pointer;
  transition: color 0.1s, border-color 0.1s, background 0.1s;
}
.nav-btn:hover {
  color: var(--text-bright);
  background: rgba(0,224,64,0.05);
  border-left-color: var(--accent-dim);
}
.nav-btn.active {
  color: var(--text-bright);
  border-left-color: var(--accent);
  background: rgba(0,224,64,0.08);
}
.nav-btn.active::before { content: '> '; }

.toggle-btn {
  display: block;
  width: 100%;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-family: 'Share Tech Mono', monospace;
  font-size: 11px;
  text-align: center;
  padding: 5px;
  cursor: pointer;
  margin-top: 0;
  transition: border-color 0.1s, color 0.1s;
}
.toggle-btn:hover { border-color: var(--accent); color: var(--text-bright); }

.main {
  flex: 1;
  padding: 24px 32px;
  min-width: 0;
}

.page { display: none; }
.page.active { display: block; }

.page-title {
  font-family: 'VT323', monospace;
  font-size: 32px;
  color: var(--text-bright);
  letter-spacing: 3px;
  margin-bottom: 22px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  text-shadow: 0 0 12px rgba(0,240,72,0.35);
}

.entry {
  background: var(--card-bg);
  border: 1px solid var(--border-dim);
  border-left: 3px solid var(--accent-dim);
  padding: 11px 16px;
  margin-bottom: 10px;
  transition: border-left-color 0.15s, box-shadow 0.15s;
}
.entry:hover {
  border-left-color: var(--accent);
  box-shadow: -3px 0 10px rgba(0,224,64,0.12);
}

.entry-title {
  font-family: 'VT323', monospace;
  font-size: 24px;
  color: var(--text-bright);
  line-height: 1.1;
  margin-bottom: 3px;
}
.entry-sub {
  color: var(--text-dim);
  font-size: 11px;
  margin-bottom: 7px;
  letter-spacing: 0.3px;
}
.entry-desc {
  color: #6aaa6a;
  font-size: 12px;
  line-height: 1.6;
  padding-left: 10px;
  border-left: 1px solid var(--border-dim);
  margin-top: 2px;
}

.section-rule {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0 12px;
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
.section-rule::before,
.section-rule::after {
  content: '';
  flex: 1;
  border-top: 1px solid var(--border);
}

.cert-entry {
  background: var(--card-bg);
  border: 1px solid var(--border-dim);
  border-left: 3px solid var(--accent-dim);
  padding: 11px 16px;
  margin-bottom: 10px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  transition: border-left-color 0.15s;
}
.cert-entry:hover { border-left-color: var(--accent); }

.cert-logo {
  width: 46px; height: 46px;
  border: 1px solid var(--border);
  background: #fff;
  flex-shrink: 0;
  overflow: hidden;
}
.cert-logo img { width: 100%; height: 100%; object-fit: contain; padding: 3px; display: block; }
.cert-content { flex: 1; }
.cert-title {
  font-family: 'VT323', monospace;
  font-size: 22px;
  color: var(--text-bright);
  line-height: 1.1;
  margin-bottom: 3px;
}
.cert-desc { color: var(--text-dim); font-size: 11px; margin-bottom: 5px; }

/* MISC */
.misc-head {
  font-family: 'VT323', monospace;
  font-size: 20px;
  color: var(--accent);
  border: 1px solid var(--border);
  background: rgba(0,224,64,0.04);
  padding: 5px 12px;
  margin: 20px 0 12px;
  letter-spacing: 1px;
}

.misc-item {
  background: var(--card-bg);
  border: 1px solid var(--border-dim);
  border-left: 3px solid var(--accent-dim);
  padding: 9px 14px;
  margin-bottom: 7px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  transition: border-left-color 0.15s;
}
.misc-item:hover { border-left-color: var(--accent); }

.misc-icon {
  width: 34px; height: 34px;
  border: 1px solid var(--border);
  background: #000;
  flex-shrink: 0;
  overflow: hidden;
}
.misc-icon img { width: 100%; height: 100%; object-fit: contain; display: block; }
.misc-item-content { flex: 1; }
.misc-item-title {
  font-family: 'VT323', monospace;
  font-size: 19px;
  color: var(--text-bright);
  line-height: 1.2;
}
.misc-item-sub { color: var(--text-dim); font-size: 11px; margin-top: 2px; }
.misc-item-desc { color: #6aaa6a; font-size: 11px; margin-top: 2px; }

.page-body { font-size: 14px; line-height: 1.75; }
.page-body p { margin-bottom: 14px; }

.quote {
  border-left: 2px solid var(--accent-dim);
  padding: 8px 16px;
  margin: 16px 0;
  color: var(--text-dim);
  font-style: italic;
  font-size: 13px;
}

.webring-box {
  border: 1px solid var(--border);
  border-color: #e040fb;
  padding: 10px 8px 8px;
  margin-top: 10px;
  text-align: center;
}

.webring-name {
  font-family: 'Share Tech Mono', monospace;
  font-size: 13px;
  font-weight: bold;
  letter-spacing: 1px;
  margin-bottom: 8px;
  display: block;
}
.webring-name .wt { color: #ffffff; }
.webring-name .wl { color: #e040fb; }

.webring-btns {
  display: flex;
  gap: 4px;
  justify-content: center;
}

.webring-btn {
  flex: 1;
  background: transparent;
  border: 1px solid #5b3d8a;
  color: #c084fc;
  font-family: 'Share Tech Mono', monospace;
  font-size: 10px;
  padding: 4px 2px;
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
  letter-spacing: 0.5px;
}
.webring-btn:hover {
  border-color: #e879f9;
  color: #f0abfc;
  background: rgba(168,139,250,0.08);
}

.hamburger {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 18px;
  line-height: 1;
  padding: 6px 10px;
  cursor: pointer;
  font-family: monospace;
  transition: border-color 0.1s, color 0.1s;
  flex-shrink: 0;
}
.hamburger:hover { border-color: var(--accent); color: var(--text-bright); }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 200;
}
.sidebar-overlay.open { display: block; }

.webring-mobile {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--sidebar-bg);
  border-top: 1px solid #5b3d8a;
  padding: 8px 16px;
  z-index: 100;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.webring-mobile .webring-name {
  margin-bottom: 0;
  white-space: nowrap;
}
.webring-mobile .webring-btns {
  flex: 1;
  justify-content: flex-end;
}

@media (max-width: 640px) {
  .hamburger { display: block; }

  .site-header {
    flex-wrap: wrap;
    gap: 6px;
    padding: 14px 14px 12px;
    align-items: flex-start;
  }
  .header-top-row {
    display: flex;
    align-items: center;
    width: 100%;
    justify-content: space-between;
  }
  .header-name { font-size: 38px; }
  .header-sub {
    width: 100%;
    padding-bottom: 0;
    font-size: 11px;
    margin-left: 0;
    text-align: left;
  }

  .layout { position: relative; }

  .sidebar {
    position: fixed;
    top: -100vh; left: 0; right: 0;
    width: 100%;
    height: auto;
    max-height: 80vh;
    z-index: 300;
    transition: top 0.25s ease;
    padding-bottom: 16px;
    overflow-y: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0;
  }
  .sidebar.open { top: 0; }

  .avatar-box { width: 64px; height: 64px; margin: 0 12px 0 0; flex-shrink: 0; }

  .sidebar-links { margin-bottom: 0; align-items: center; }

  .sidebar-nav-area {
    flex: 1;
    min-width: 140px;
  }

  .sidebar-bottom {
    width: 100%;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    margin-top: 8px;
  }
  .sidebar-bottom .webring-box { display: none; }

  .main { padding: 16px 14px 100px; }

  .webring-mobile { display: flex; }
}

@media (min-width: 641px) {
  .webring-mobile { display: none !important; }
  .hamburger { display: none !important; }
  .header-top-row { display: contents; }
}

body.light {
  --bg:          #efefef;
  --sidebar-bg:  #e2e2e2;
  --panel-bg:    #f8f8f8;
  --card-bg:     #f8f8f8;
  --border:      #bbb;
  --border-dim:  #ccc;
  --accent:      #0000aa;
  --accent-dim:  #7070cc;
  --text:        #222;
  --text-dim:    #666;
  --text-bright: #00008b;
  --link:        #0000cc;
  --link-vis:    #551a8b;
}
body.light::before { display: none; }
body.light .header-name { text-shadow: none; }
body.light .page-title  { text-shadow: none; }
body.light .sidebar-links a:hover { box-shadow: none; }
body.light .cert-logo { background: #fff; }
body.light .avatar-box { box-shadow: none; }
body.light .entry:hover { box-shadow: none; }

.blog-list-item {
  background: var(--card-bg);
  border: 1px solid var(--border-dim);
  border-left: 3px solid var(--accent-dim);
  padding: 11px 16px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-left-color 0.15s, box-shadow 0.15s;
}
.blog-list-item:hover {
  border-left-color: var(--accent);
  box-shadow: -3px 0 10px rgba(0,224,64,0.12);
}
.blog-list-item .entry-title { margin-bottom: 4px; }
.blog-list-item .blog-excerpt {
  color: #6aaa6a;
  font-size: 12px;
  line-height: 1.6;
  margin-top: 5px;
  display: -webkit-box;
  -line-clamp: 2;
  -box-orient: vertical;
  overflow: hidden;
}
.blog-loading {
  color: var(--text-dim);
  font-size: 12px;
  padding: 10px 0;
}