/* ==========================================================================
   nilabhasaha.com — Design C: terminal / mono
   Shared stylesheet. Theme is driven by [data-theme] on <html>.
   ========================================================================== */

/* ---------- Theme tokens ------------------------------------------------ */

:root,
:root[data-theme="dark"] {
  --bg: #0e0f13;
  --bg-raise: #14161d;
  --bg-inset: #0a0b0e;
  --fg: #d6dae2;
  --fg-strong: #f2f4f8;
  --muted: #868da0;
  --faint: #5b6172;
  --accent: #6ea8fe;
  --accent-soft: rgba(110, 168, 254, 0.14);
  --green: #57d992;
  --green-soft: rgba(87, 217, 146, 0.12);
  --border: #232733;
  --border-strong: #333949;
  --selection: rgba(110, 168, 254, 0.28);
  --glow: 0 0 14px rgba(110, 168, 254, 0.18);
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

:root[data-theme="light"] {
  --bg: #f5f2ea;
  --bg-raise: #fdfbf5;
  --bg-inset: #edeade;
  --fg: #2c3038;
  --fg-strong: #16181d;
  --muted: #6b7080;
  --faint: #979dad;
  --accent: #2257c4;
  --accent-soft: rgba(34, 87, 196, 0.1);
  --green: #177245;
  --green-soft: rgba(23, 114, 69, 0.1);
  --border: #ddd7c6;
  --border-strong: #c4bda8;
  --selection: rgba(34, 87, 196, 0.18);
  --glow: none;
  --shadow: 0 6px 18px rgba(60, 55, 40, 0.1);
}

/* ---------- Base -------------------------------------------------------- */

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

::selection {
  background: var(--selection);
}

.wrap {
  width: 100%;
  max-width: 52rem;
  margin: 0 auto;
  padding: 0 1.25rem;
}

main {
  flex: 1;
  padding: 2.5rem 0 4rem;
}

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

a:hover {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

p {
  margin: 0 0 1rem;
}

h1,
h2,
h3 {
  color: var(--fg-strong);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

h1 {
  font-size: clamp(1.7rem, 5vw, 2.3rem);
  margin: 0.4rem 0 1rem;
  text-shadow: var(--glow);
}

h2 {
  font-size: 1.15rem;
  margin: 2.75rem 0 1.1rem;
  /* keep anchored headings clear of the sticky header */
  scroll-margin-top: 6.5rem;
}

h3 {
  font-size: 1rem;
  margin: 0 0 0.35rem;
}

code,
.tok {
  font-family: inherit;
}

/* "## " / "$ " marks before section headings */
.h-mark {
  color: var(--green);
  font-weight: 700;
  margin-right: 0.55em;
  user-select: none;
}

/* Box-drawing hairline separators */
.rule {
  border: 0;
  height: 1.2em;
  margin: 0.5rem 0 0;
  overflow: hidden;
  color: var(--border-strong);
  white-space: nowrap;
  font-size: 0.85rem;
  line-height: 1.2em;
  user-select: none;
}

.rule::before {
  content: "────────────────────────────────────────────────────────────"
    "────────────────────────────────────────────────────────────";
}

.muted {
  color: var(--muted);
}

.comment {
  color: var(--faint);
}

/* ---------- Header / nav ------------------------------------------------ */

.site-header {
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem 1.5rem;
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
}

.brand {
  font-weight: 700;
  color: var(--fg-strong);
  white-space: nowrap;
}

.brand:hover {
  text-decoration: none;
}

.brand .u {
  color: var(--green);
}

.brand .h {
  color: var(--green);
}

.brand .p {
  color: var(--muted);
  font-weight: 400;
}

.site-nav {
  margin-left: auto;
}

.site-nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.1rem;
  margin: 0;
  padding: 0;
}

.site-nav a {
  color: var(--muted);
  padding: 0.15rem 0.1rem;
  white-space: nowrap;
}

.site-nav a:hover {
  color: var(--fg-strong);
  text-decoration: none;
}

.site-nav a[aria-current="page"] {
  color: var(--fg-strong);
}

.site-nav a[aria-current="page"]::before {
  content: "> ";
  color: var(--green);
  font-weight: 700;
}

/* Theme toggle */
.theme-toggle {
  font: inherit;
  font-size: 0.85rem;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  padding: 0.25rem 0.6rem;
  cursor: pointer;
  white-space: nowrap;
}

.theme-toggle:hover {
  color: var(--fg-strong);
  border-color: var(--accent);
}

.theme-toggle .lbl-dark,
.theme-toggle .lbl-light {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .lbl-dark {
  display: inline;
}

:root[data-theme="light"] .theme-toggle .lbl-light {
  display: inline;
}

/* ---------- Terminal motifs -------------------------------------------- */

.term-line {
  color: var(--muted);
  margin: 0 0 0.25rem;
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

.prompt {
  color: var(--green);
  font-weight: 500;
}

.prompt .at,
.prompt .colon {
  color: var(--muted);
  font-weight: 400;
}

.prompt .path {
  color: var(--accent);
}

.cmd {
  color: var(--fg-strong);
}

.cursor {
  display: inline-block;
  width: 0.6em;
  height: 1.05em;
  margin-left: 0.15em;
  background: var(--green);
  vertical-align: text-bottom;
  animation: blink 1.1s steps(1, end) infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .cursor {
    animation: none;
  }
  html {
    scroll-behavior: auto;
  }
}

/* Page title block used on subpages */
.page-head {
  margin-bottom: 2.25rem;
}

.page-head .lede {
  color: var(--muted);
  max-width: 42rem;
  margin-top: 0.25rem;
}

/* ---------- Hero (index) ------------------------------------------------ */

.hero {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  margin-bottom: 1.5rem;
}

.hero-text {
  flex: 1;
  min-width: 0;
}

.avatar {
  flex-shrink: 0;
  width: 208px;
  height: 208px;
  object-fit: cover;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--bg-raise);
  box-shadow: var(--shadow);
}

/* Profile card: photo, obfuscated email, links */
.profile-card {
  flex-shrink: 0;
  width: 240px;
  padding: 1rem;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--bg-raise);
  box-shadow: var(--shadow);
  text-align: center;
}

.profile-card .avatar {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  border-color: var(--border);
  box-shadow: none;
}

.pc-head {
  margin: 1rem 0 0.2rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
}

.pc-email {
  margin: 0 0 0.15rem;
  font-size: 0.85rem;
  color: var(--fg-strong);
  overflow-wrap: anywhere;
}

.pc-note {
  margin: 0;
  font-size: 0.78rem;
  color: var(--faint);
}

.profile-card .pc-links {
  justify-content: center;
  margin-top: 0.15rem;
}

.role-line {
  color: var(--muted);
  margin: 0 0 1.25rem;
}

.role-line .sep {
  color: var(--faint);
  margin: 0 0.4em;
}

/* Contact row */
.contact-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 1.25rem 0 0;
  padding: 0;
  list-style: none;
}

.contact-row a {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  font-size: 0.88rem;
  color: var(--fg);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  padding: 0.3rem 0.7rem;
  background: var(--bg-raise);
}

.contact-row a:hover {
  text-decoration: none;
  border-color: var(--accent);
  color: var(--accent);
}

.contact-row svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
  flex-shrink: 0;
}

/* News / highlights list, styled like a tail of a log file */
.log-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-raise);
  overflow: hidden;
}

.log-list li {
  display: flex;
  gap: 1rem;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border);
}

.log-list li:last-child {
  border-bottom: 0;
}

.log-list .stamp {
  color: var(--green);
  flex-shrink: 0;
  font-size: 0.85rem;
  padding-top: 0.1em;
}

/* ---------- Cards (projects) ------------------------------------------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-raise);
  padding: 1.1rem 1.2rem 1rem;
  transition: border-color 120ms ease;
}

.card:hover {
  border-color: var(--border-strong);
}

.card h3 {
  font-size: 0.98rem;
}

.card h3 .dot-slash {
  color: var(--green);
  margin-right: 0.15em;
}

.card p {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 0.25rem 0 0.9rem;
  flex: 1;
}

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.card-link {
  font-size: 0.85rem;
  white-space: nowrap;
}

/* Bracketed tag tokens: [crypto] [systems] */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.55rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tag {
  font-size: 0.78rem;
  color: var(--green);
  background: var(--green-soft);
  border-radius: 3px;
  padding: 0.05rem 0.35rem;
}

.tag::before {
  content: "[";
  color: var(--faint);
}

.tag::after {
  content: "]";
  color: var(--faint);
}

/* ---------- Quick links (jump to a section) ------------------------------ */

.quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.5rem 0 0.5rem;
}

.quick-links a {
  display: inline-block;
  font-size: 0.85rem;
  color: var(--fg);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  padding: 0.25rem 0.7rem;
  background: var(--bg-raise);
  white-space: nowrap;
}

.quick-links a::before {
  content: "# ";
  color: var(--green);
}

.quick-links a:hover {
  text-decoration: none;
  border-color: var(--accent);
  color: var(--accent);
}

/* ---------- Entry lists (notes, achievements) --------------------------- */

.section-note {
  color: var(--faint);
  font-size: 0.85rem;
  margin: -0.6rem 0 1.1rem;
}

.entry-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-raise);
  overflow: hidden;
}

.entry-list > li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2rem 1rem;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--border);
}

.entry-list > li:last-child {
  border-bottom: 0;
}

.entry-main {
  flex: 1;
  min-width: 240px;
}

.entry-title {
  color: var(--fg-strong);
  font-weight: 500;
  display: block;
}

.entry-desc {
  color: var(--muted);
  font-size: 0.86rem;
  display: block;
  margin-top: 0.1rem;
}

.entry-link {
  font-size: 0.83rem;
  white-space: nowrap;
}

.entry-link::before {
  content: "[";
  color: var(--faint);
}

.entry-link::after {
  content: "]";
  color: var(--faint);
}

.entry-year {
  color: var(--green);
  font-size: 0.85rem;
  flex-shrink: 0;
  /* wide enough for multi-year stamps like [2024, 2025] so titles align */
  min-width: 7.4em;
}

/* ---------- Footer ------------------------------------------------------ */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.4rem 0 1.8rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.5rem;
  justify-content: center;
}

.exit-line {
  color: var(--faint);
}

/* ---------- Responsive -------------------------------------------------- */

@media (max-width: 720px) {
  body {
    font-size: 14.5px;
  }

  .header-inner {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
  }

  .site-nav {
    margin-left: 0;
    order: 3;
    width: 100%;
  }

  .site-nav ul {
    gap: 0.15rem 0.9rem;
  }

  .theme-toggle {
    margin-left: auto;
  }

  .hero {
    flex-direction: column-reverse;
    gap: 1.25rem;
  }

  .profile-card {
    margin: 0 auto;
  }

  main {
    padding-top: 2rem;
  }
}
