/* nehal's publish theme */

/* ===== FONTS ===== */
@import url('https://fonts.googleapis.com/css2?family=Crimson+Pro:ital,wght@0,400;0,600;1,400&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --font-text: 'Crimson Pro', Georgia, serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --font-ui: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  
  /* colors - warm paper aesthetic */
  --bg-primary: #faf8f5;
  --bg-secondary: #f3f0eb;
  --bg-tertiary: #ebe7e0;
  --text-primary: #2c2c2c;
  --text-secondary: #5a5a5a;
  --text-muted: #8a8a8a;
  --accent: #c45d3a;
  --accent-hover: #a84829;
  --accent-soft: rgba(196, 93, 58, 0.1);
  --border-color: rgba(0, 0, 0, 0.08);
  
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --radius: 6px;
  --transition: 0.2s ease;
}

/* dark theme overrides */
.theme-dark {
  --bg-primary: #1a1a1a;
  --bg-secondary: #232323;
  --bg-tertiary: #2d2d2d;
  --text-primary: #e8e6e3;
  --text-secondary: #a8a8a8;
  --text-muted: #6a6a6a;
  --accent: #e07a56;
  --accent-hover: #f08b66;
  --accent-soft: rgba(224, 122, 86, 0.15);
  --border-color: rgba(255, 255, 255, 0.08);
}

/* ===== BASE ===== */
body {
  background: var(--bg-primary) !important;
  color: var(--text-primary) !important;
  font-family: var(--font-text) !important;
  font-size: 19px !important;
  line-height: 1.7 !important;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* {
  color: inherit;
}

/* ===== LAYOUT ===== */
.published-container {
  background: var(--bg-primary) !important;
}

.site-body-left-column {
  background: transparent !important;
  border-right: 1px solid var(--border-color) !important;
}

.site-body-right-column {
  display: none !important;
}

/* ===== SIDEBAR FADE ===== */
.site-body-left-column {
  opacity: 0.4;
  transition: opacity 0.4s ease;
}

.site-body-left-column:hover,
.site-body-left-column:focus-within {
  opacity: 1;
}

@media (max-width: 1000px) {
  .site-body-left-column {
    opacity: 1;
    background: var(--bg-primary) !important;
  }
}

/* ===== SITE NAME ===== */
.site-body-left-column-site-name {
  font-family: var(--font-text) !important;
  font-size: 1.5rem !important;
  font-weight: 600 !important;
  letter-spacing: -0.02em;
  color: var(--text-primary) !important;
  text-align: center;
  padding: 1.5rem 0;
}

/* ===== NAVIGATION ===== */
.nav-view-outer .tree-item-self {
  font-family: var(--font-ui);
  font-size: 0.9rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  transition: all var(--transition);
  border: 1px solid transparent;
}

.nav-view-outer .tree-item-self:hover {
  background: transparent;
  color: var(--accent);
}

.nav-view-outer .tree-item-self.mod-active {
  background: transparent;
  font-weight: 500;
}

/* no vertical indentation-guide line on nested nav items */
.nav-view-outer {
  --nav-indentation-guide-width: 0px;
  --nav-indentation-guide-color: transparent;
}

.nav-view-outer .tree-item-children {
  border-inline-start: none;
  box-shadow: none;
}

/* kill the grey/accent left-border line Obsidian draws on EVERY nav item
   (this — not the background, shadow, or guide var — is the vertical bar) */
.nav-view-outer .tree-item-self {
  border-inline-start-color: transparent !important;
  border-left-color: transparent !important;
}

/* ===== SEARCH ===== */
.search-bar {
  background: var(--bg-secondary) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius) !important;
  font-family: var(--font-ui) !important;
}

/* ===== PAGE TITLE ===== */
.extra-title {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.extra-title-text {
  font-family: var(--font-text) !important;
  font-size: 2.5rem !important;
  font-weight: 600 !important;
  line-height: 1.2 !important;
  letter-spacing: -0.02em;
  color: var(--text-primary) !important;
}

/* Page date */
.page-date {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--text-muted) !important;
  margin-top: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ===== TYPOGRAPHY ===== */
.markdown-rendered {
  font-family: var(--font-text) !important;
  font-size: 1.15rem !important;
  line-height: 1.8 !important;
}

.markdown-rendered h1,
.markdown-rendered h2,
.markdown-rendered h3,
.markdown-rendered h4,
.markdown-rendered h5,
.markdown-rendered h6 {
  font-family: var(--font-text) !important;
  font-weight: 600 !important;
  line-height: 1.3 !important;
  letter-spacing: -0.02em;
  margin: 2rem 0 1rem !important;
  color: var(--text-primary) !important;
}

.markdown-rendered h1 { font-size: 2rem !important; }
.markdown-rendered h2 { font-size: 1.6rem !important; }
.markdown-rendered h3 { font-size: 1.35rem !important; }
.markdown-rendered h4 { font-size: 1.15rem !important; }

.markdown-rendered p {
  margin-bottom: 1.5rem !important;
}

/* ===== LINKS ===== */
.markdown-rendered a,
.markdown-rendered .internal-link {
  color: var(--accent) !important;
  text-decoration: none !important;
  border-bottom: 1px solid transparent;
  transition: all var(--transition);
}

.markdown-rendered a:hover,
.markdown-rendered .internal-link:hover {
  color: var(--accent-hover) !important;
  border-bottom-color: var(--accent-hover);
}

/* Remove wiki-link brackets */
.internal-link::before,
.internal-link::after {
  display: none !important;
}

/* ===== CODE ===== */
.markdown-rendered code {
  font-family: var(--font-mono) !important;
  font-size: 0.85em !important;
  background: var(--bg-secondary) !important;
  padding: 0.2em 0.4em !important;
  border-radius: 4px !important;
  border: 1px solid var(--border-color);
}

.markdown-rendered pre {
  background: var(--bg-secondary) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius) !important;
  padding: 1rem !important;
  overflow-x: auto;
}

.markdown-rendered pre code {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
}

/* ===== BLOCKQUOTES ===== */
.markdown-rendered blockquote {
  border-left: 3px solid var(--accent) !important;
  background: var(--bg-secondary) !important;
  padding: 1rem 1.5rem !important;
  margin: 1.5rem 0 !important;
  border-radius: 0 var(--radius) var(--radius) 0 !important;
  font-style: italic;
}

/* ===== CALLOUTS ===== */
.callout {
  background: var(--bg-secondary) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius) !important;
  margin: 1.5rem 0 !important;
}

.callout-title {
  font-family: var(--font-ui) !important;
  font-weight: 500 !important;
}

/* ===== IMAGES ===== */
.markdown-rendered img {
  border-radius: var(--radius);
  max-width: 100%;
  height: auto;
}

.image-embed {
  display: flex;
  justify-content: center;
  margin: 1.5rem 0;
}

/* ===== TABLES ===== */
.markdown-rendered table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.95rem;
}

.markdown-rendered th,
.markdown-rendered td {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  text-align: left;
}

.markdown-rendered th {
  background: var(--bg-secondary);
  font-weight: 600;
}

.markdown-rendered tr:nth-child(even) {
  background: var(--bg-secondary);
}

/* ===== TAGS ===== */
.tag {
  font-family: var(--font-ui) !important;
  font-size: 0.8rem !important;
  background: var(--accent-soft) !important;
  color: var(--accent) !important;
  padding: 0.25rem 0.5rem !important;
  border-radius: 4px !important;
  text-decoration: none !important;
}

.tag:hover {
  background: var(--accent) !important;
  color: var(--bg-primary) !important;
}

/* ===== BACKLINKS ===== */
.backlinks {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
}

.published-section-header {
  font-family: var(--font-text) !important;
  font-size: 1.2rem !important;
  font-weight: 600 !important;
  margin-bottom: 1rem;
}

/* ===== GRAPH ===== */
.graph-view-container {
  background: var(--bg-secondary) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius) !important;
}

/* ===== MOBILE HEADER ===== */
.site-header {
  background: var(--bg-primary) !important;
  border-bottom: 1px solid var(--border-color);
}

.site-header-text {
  font-family: var(--font-text) !important;
  font-weight: 500 !important;
}

/* ===== SELECTION ===== */
::selection {
  background: var(--accent-soft) !important;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ===== LISTS ===== */
.markdown-rendered ul,
.markdown-rendered ol {
  margin: 1rem 0 1.5rem;
  padding-left: 1.5rem;
}

.markdown-rendered li {
  margin-bottom: 0.5rem;
}

/* ===== HORIZONTAL RULE ===== */
.markdown-rendered hr {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 2rem 0;
}

/* ===== SMOOTH TRANSITIONS ===== */
.tree-item-self,
.tag,
a,
.internal-link,
button {
  transition: all var(--transition);
}

/* ===== HEALTH PAGE (fitbit air stats) ===== */
#health-dashboard {
  margin-top: 1.5rem;
  font-style: normal;
}

.health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
  margin: 0 0 0.75rem;
}

.health-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow-sm);
}

.health-card-wide {
  grid-column: 1 / -1;
}

.health-label {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.health-value {
  font-family: var(--font-mono);
  font-size: 1.7rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.1;
}

.health-unit {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-left: 0.2rem;
}

.health-spark {
  width: 100%;
  height: 28px;
  margin-top: 0.6rem;
  display: block;
}

.health-spark polyline {
  stroke: var(--accent);
  stroke-width: 1.5;
  fill: none;
}

.health-spark circle {
  fill: var(--accent);
}

.health-sub {
  font-family: var(--font-ui);
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
}

.health-footnote {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.health-error {
  font-family: var(--font-ui);
  color: var(--text-muted);
  font-style: italic;
}

.health-retry {
  color: var(--accent) !important;
  cursor: pointer;
}

/* heartbeat ecg */
.health-ecg {
  width: 100%;
  height: 80px;
  margin-top: 0.6rem;
  display: block;
  border-radius: 4px;
  background-image:
    repeating-linear-gradient(to right, var(--accent-soft) 0 1px, transparent 1px 26px),
    repeating-linear-gradient(to bottom, var(--accent-soft) 0 1px, transparent 1px 16px);
}

.health-ecg polyline {
  stroke: var(--accent);
  stroke-width: 1.6;
  fill: none;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.health-ecg-dot {
  fill: var(--accent);
}

.health-ecg-ping {
  fill: var(--accent);
  transform-box: fill-box;
  transform-origin: center;
  animation: health-ping 1.6s ease-out infinite;
}

@keyframes health-ping {
  0% {
    transform: scale(1);
    opacity: 0.7;
  }
  100% {
    transform: scale(3.2);
    opacity: 0;
  }
}

/* the heart beats at the wearer's actual bpm (animation-duration set inline) */
.health-heart {
  display: inline-block;
  margin-right: 0.4rem;
  color: var(--accent);
  transform-origin: center;
  animation: health-beat 1s ease-in-out infinite;
}

@keyframes health-beat {
  0%, 100% { transform: scale(1); }
  12% { transform: scale(1.28); }
  24% { transform: scale(1); }
  38% { transform: scale(1.18); }
  52% { transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .health-heart,
  .health-ecg-ping {
    animation: none;
  }
}

/* toolbar: on-demand refresh */
.health-toolbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.75rem;
  margin: 0 0 0.6rem;
}

.health-updated {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.health-refresh {
  font-family: var(--font-ui);
  font-size: 0.78rem;
  color: var(--accent) !important;
  cursor: pointer;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  transition: all var(--transition);
  user-select: none;
}

.health-refresh:hover {
  background: var(--accent-soft);
  border-color: var(--accent-soft);
}

.health-refresh.busy {
  animation: health-busy 0.9s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes health-busy {
  from { opacity: 1; }
  to { opacity: 0.45; }
}

/* heartbeat range pills */
.health-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.35rem;
}

.health-label-row .health-label {
  margin-bottom: 0;
}

.health-range {
  display: flex;
  gap: 0.3rem;
}

.health-range a {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  padding: 0.12rem 0.55rem;
  border-radius: 999px;
  color: var(--text-muted) !important;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition);
  user-select: none;
}

.health-range a:hover {
  color: var(--accent) !important;
}

.health-range a.on {
  color: var(--accent) !important;
  background: var(--accent-soft);
  border-color: var(--accent-soft);
}

/* ecg axes */
.health-ecg-wrap {
  display: flex;
  gap: 0.45rem;
  margin-top: 0.6rem;
}

.health-ecg-y {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  text-align: right;
  min-width: 2.1rem;
  padding-bottom: 1.15rem;
}

.health-ecg-main {
  flex: 1;
  min-width: 0;
}

.health-ecg-wrap .health-ecg {
  margin-top: 0;
}

.health-ecg-x {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}
