/* TwoNav Cloudflare Edition - visual enhancements.
   Scoped additions on top of the original WebStack-Hugo theme. */
:root {
  --tn-accent: #5b8cff;
  --tn-accent-2: #7c5cff;
  --tn-radius: 14px;
  --tn-shadow: 0 10px 30px rgba(31, 45, 81, .08);
}

/* ---------- Home hero ---------- */
.tn-hero {
  position: relative;
  margin: 22px 0 26px;
  padding: 30px 32px;
  border-radius: 20px;
  color: #fff;
  background: linear-gradient(120deg, #4f7cff 0%, #6f62f5 48%, #9b5de5 100%);
  box-shadow: 0 18px 40px rgba(79, 124, 255, .24);
  overflow: hidden;
}
.tn-hero::before,
.tn-hero::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, .13);
  pointer-events: none;
}
.tn-hero::before { width: 260px; height: 260px; right: -60px; top: -130px; }
.tn-hero::after { width: 170px; height: 170px; right: 120px; bottom: -120px; }
.tn-hero > * { position: relative; z-index: 1; }
.tn-hero h1 {
  margin: 0 0 8px;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: .5px;
}
.tn-hero .tn-lead { margin: 0 0 20px; opacity: .88; font-size: 14px; }
.tn-hero-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.tn-searchbar {
  display: flex;
  align-items: center;
  flex: 1 1 340px;
  max-width: 620px;
  background: rgba(255, 255, 255, .96);
  border-radius: 999px;
  padding: 5px 8px 5px 18px;
  box-shadow: 0 8px 22px rgba(30, 45, 90, .18);
}
.tn-searchbar input {
  flex: 1;
  border: 0;
  outline: none;
  background: transparent;
  color: #303133;
  font-size: 14px;
  min-width: 0;
}
.tn-searchbar input::placeholder { color: #9aa3b2; }
.tn-searchbar button {
  border: 0;
  border-radius: 999px;
  padding: 8px 18px;
  color: #fff;
  background: var(--tn-accent);
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
}
.tn-searchbar button:hover { background: #4178ef; }
.tn-hero-actions { display: flex; gap: 10px; }
.tn-ghost-btn {
  border: 1px solid rgba(255, 255, 255, .55);
  background: rgba(255, 255, 255, .12);
  color: #fff;
  border-radius: 999px;
  padding: 9px 16px;
  cursor: pointer;
  font-size: 13px;
  backdrop-filter: blur(4px);
}
.tn-ghost-btn:hover { background: rgba(255, 255, 255, .24); }
.tn-hero-stats { display: flex; gap: 26px; margin-top: 22px; flex-wrap: wrap; }
.tn-hero-stats div { min-width: 68px; }
.tn-hero-stats b { display: block; font-size: 20px; line-height: 1.2; }
.tn-hero-stats span { font-size: 12px; opacity: .8; }

/* ---------- Category headings & cards ---------- */
.tn-cat-head { cursor: pointer; }
.tn-count {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(91, 140, 255, .12);
  color: var(--tn-accent);
  font-size: 12px;
  font-weight: 600;
  vertical-align: 2px;
}
.url-card .url-body { position: relative; }
.url-card .card {
  border: 1px solid rgba(31, 45, 81, .07) !important;
  border-radius: var(--tn-radius) !important;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.url-card .card:hover {
  transform: translateY(-4px);
  box-shadow: var(--tn-shadow);
  border-color: rgba(91, 140, 255, .35) !important;
}
.url-card .url-img img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  border-radius: 10px;
  background: #fff;
}
.url-card .url-info strong { font-weight: 600; }
.url-card .togo {
  opacity: .35;
  transition: opacity .18s ease, transform .18s ease;
}
.url-card:hover .togo { opacity: 1; transform: translateX(2px); }
.nav-pills .nav-link { border-radius: 999px !important; transition: all .16s ease; }
.nav-pills .nav-link.active { box-shadow: 0 4px 12px rgba(91, 140, 255, .25); }

/* ---------- Inline editing ---------- */
.tn-edit-btn {
  position: absolute;
  top: 10px;
  right: 44px;
  z-index: 4;
  width: 26px;
  height: 26px;
  line-height: 24px;
  text-align: center;
  border-radius: 8px;
  border: 1px solid rgba(91, 140, 255, .3);
  background: rgba(255, 255, 255, .92);
  color: var(--tn-accent);
  cursor: pointer;
  font-size: 12px;
  opacity: 0;
  transition: opacity .16s ease;
}
.url-card:hover .tn-edit-btn { opacity: 1; }
.tn-edit-btn:hover { background: var(--tn-accent); color: #fff; }
.tn-fab {
  position: fixed;
  right: 26px;
  bottom: 92px;
  z-index: 30;
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  color: #fff;
  background: linear-gradient(120deg, var(--tn-accent), var(--tn-accent-2));
  box-shadow: 0 10px 26px rgba(91, 140, 255, .38);
  cursor: pointer;
  font-size: 14px;
}
.tn-fab:hover { filter: brightness(1.06); }

.tn-modal-mask {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(18, 24, 40, .48);
  backdrop-filter: blur(3px);
}
.tn-modal-mask.show { display: flex; }
.tn-modal {
  width: min(560px, 94vw);
  max-height: 90vh;
  overflow: auto;
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 24px 60px rgba(18, 24, 40, .28);
}
.tn-modal h3 { margin: 0 0 18px; font-size: 18px; }
.tn-modal label.field { display: block; width: 100%; float: none; margin-bottom: 13px; }
.tn-modal .field > span { display: block; margin-bottom: 5px; color: #606266; font-size: 13px; }
.tn-modal input,
.tn-modal select,
.tn-modal textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid #dcdfe6;
  border-radius: 8px;
  font: inherit;
  outline: none;
}
.tn-modal input:focus,
.tn-modal select:focus,
.tn-modal textarea:focus { border-color: var(--tn-accent); }
.tn-modal .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.tn-modal .btn { border-radius: 8px; padding: 8px 16px; cursor: pointer; border: 1px solid #dcdfe6; background: #fff; }
.tn-modal .btn.primary { border-color: var(--tn-accent); background: var(--tn-accent); color: #fff; }
.tn-modal .btn.danger { border-color: #fbc4c4; color: #f56c6c; }
.tn-toast {
  position: fixed;
  left: 50%;
  top: 24px;
  z-index: 100;
  transform: translateX(-50%) translateY(-16px);
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(32, 38, 52, .92);
  color: #fff;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: all .2s ease;
}
.tn-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Article list ---------- */
.tn-article-tools {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 18px 0 24px;
}
.tn-article-tools input {
  flex: 1 1 260px;
  max-width: 380px;
  border: 1px solid #dcdfe6;
  border-radius: 999px;
  padding: 9px 16px;
  outline: none;
}
.tn-article-tools input:focus { border-color: var(--tn-accent); }
.tn-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 22px; }
.tn-chip {
  border: 1px solid #e4e7ed;
  background: #fff;
  color: #606266;
  border-radius: 999px;
  padding: 5px 14px;
  cursor: pointer;
  font-size: 13px;
}
.tn-chip.active,
.tn-chip:hover { border-color: var(--tn-accent); color: var(--tn-accent); background: rgba(91, 140, 255, .08); }
.tn-post-card {
  background: #fff;
  border: 1px solid rgba(31, 45, 81, .07);
  border-radius: var(--tn-radius);
  overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease;
  height: 100%;
}
.tn-post-card:hover { transform: translateY(-4px); box-shadow: var(--tn-shadow); }
.tn-post-cover { height: 140px; background: linear-gradient(135deg, #dbe6ff, #e9ddff); overflow: hidden; }
.tn-post-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tn-post-body { padding: 16px 18px 18px; }
.tn-post-body h3 { margin: 0 0 8px; font-size: 16px; line-height: 1.45; }
.tn-post-body p { margin: 0 0 12px; color: #909399; font-size: 13px; line-height: 1.6; min-height: 42px; }
.tn-post-meta { display: flex; justify-content: space-between; color: #a0a4ad; font-size: 12px; }
.tn-pin { color: #f56c6c; margin-left: 6px; font-size: 12px; }

/* ---------- Article reading page ---------- */
.tn-progress { position: fixed; left: 0; top: 0; height: 3px; width: 0; background: linear-gradient(90deg, var(--tn-accent), var(--tn-accent-2)); z-index: 99; }
.tn-reading { max-width: 1180px; margin: 0 auto; padding: 28px 20px 60px; display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 28px; }
.tn-reading-main { min-width: 0; }
.tn-article-title { font-size: 30px; line-height: 1.35; margin: 0 0 12px; }
.tn-article-meta { display: flex; gap: 18px; flex-wrap: wrap; color: #909399; font-size: 13px; margin-bottom: 24px; }
.tn-article-content { background: #fff; border-radius: var(--tn-radius); padding: 28px 32px; box-shadow: var(--tn-shadow); line-height: 1.85; font-size: 15px; }
.tn-article-content h2 { margin-top: 28px; padding-left: 12px; border-left: 4px solid var(--tn-accent); }
.tn-article-content h3 { margin-top: 22px; }
.tn-article-content img { max-width: 100%; height: auto; border-radius: 10px; }
.tn-article-content pre { background: #f6f8fa; padding: 14px; border-radius: 10px; overflow: auto; }
.tn-article-content blockquote { margin: 18px 0; padding: 10px 16px; border-left: 4px solid var(--tn-accent); background: rgba(91, 140, 255, .07); color: #606266; }
.tn-side-card { position: sticky; top: 90px; align-self: start; background: #fff; border-radius: var(--tn-radius); padding: 18px; box-shadow: var(--tn-shadow); }
.tn-side-card h4 { margin: 0 0 12px; font-size: 15px; }
.tn-toc a { display: block; padding: 5px 0 5px 10px; color: #606266; font-size: 13px; border-left: 2px solid #e4e7ed; }
.tn-toc a:hover { color: var(--tn-accent); border-left-color: var(--tn-accent); }
.tn-related a { display: block; padding: 8px 0; border-bottom: 1px dashed #e4e7ed; color: #4a5261; font-size: 13px; }
.tn-related a:last-child { border-bottom: 0; }
.tn-related a:hover { color: var(--tn-accent); }
.tn-article-nav { display: flex; justify-content: space-between; gap: 16px; margin-top: 20px; }
.tn-article-nav a { flex: 1; padding: 14px; background: #fff; border-radius: 12px; box-shadow: var(--tn-shadow); font-size: 13px; }
.tn-article-nav a:last-child { text-align: right; }

/* ---------- Dark mode additions ---------- */
body.tn-night .tn-hero { filter: saturate(.9) brightness(.86); }
body.tn-night .tn-modal,
body.tn-night .tn-post-card,
body.tn-night .tn-article-content,
body.tn-night .tn-side-card,
body.tn-night .tn-article-nav a,
body.tn-night .tn-searchbar { background: #252628 !important; color: #d8d8d8 !important; }
body.tn-night .tn-searchbar input { color: #e8e8e8; }
body.tn-night .tn-post-body p,
body.tn-night .tn-post-meta,
body.tn-night .tn-article-meta,
body.tn-night .tn-toc a { color: #9a9a9a !important; }
body.tn-night .tn-chip { background: #2d2e31; color: #c8c8c8; border-color: #3a3b3f; }
body.tn-night .tn-article-content blockquote,
body.tn-night .tn-article-content pre { background: #303133; }

@media (max-width: 900px) {
  .tn-hero { padding: 22px 20px; margin: 14px 0 20px; }
  .tn-hero h1 { font-size: 23px; }
  .tn-hero-stats { gap: 16px; }
  .tn-reading { grid-template-columns: 1fr; padding: 18px 14px 40px; }
  .tn-side-card { position: static; }
  .tn-article-content { padding: 20px 18px; }
  .tn-article-title { font-size: 24px; }
  .tn-fab { right: 16px; bottom: 76px; }
}
