/* ============================================================
   Sachin Saini — portfolio
   Shared stylesheet for the home page and the blog article pages
   ============================================================ */

:root {
  --bg: #0a0c10;
  --surface: #10141b;
  --card: #131822;
  --text: #e9ecf2;
  --muted: #96a0b4;
  --line: rgba(255, 255, 255, 0.09);
  --accent: #45d0b6;
  --accent-ink: #062b24;
}
body.light {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --card: #ffffff;
  --text: #171a20;
  --muted: #5b6373;
  --line: rgba(18, 22, 30, 0.12);
  --accent: #0d7a68;
  --accent-ink: #ffffff;
}
* {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Archivo", sans-serif;
  -webkit-font-smoothing: antialiased;
  transition:
    background 0.45s ease,
    color 0.45s ease;
}
a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  color: var(--text);
}
button {
  font-family: "Archivo", sans-serif;
}
::selection {
  background: var(--accent);
  color: var(--accent-ink);
}
.mono {
  font-family: "JetBrains Mono", monospace;
}
.serif {
  font-family: "Instrument Serif", serif;
  font-weight: 400;
  font-style: italic;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(26px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes glowDrift {
  0% {
    transform: translate(0, 0);
  }
  50% {
    transform: translate(40px, 30px);
  }
  100% {
    transform: translate(0, 0);
  }
}
[data-reveal] {
  transition:
    opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}
body.rv [data-reveal]:not([data-reveal="in"]) {
  opacity: 0;
  transform: translateY(26px);
}
body.nomotion [data-reveal] {
  opacity: 1 !important;
  transform: none !important;
  transition: none !important;
}
body.nomotion * {
  animation: none !important;
}

/* interaction states (converted from design style-hover attributes) */
.nav-link {
  color: var(--muted);
  transition: color 0.2s;
}
.nav-link:hover {
  color: var(--text);
}
.theme-btn {
  cursor: pointer;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 999px;
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 500;
  transition: border-color 0.2s;
}
.theme-btn:hover {
  border-color: var(--accent);
}
.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 10px;
  font-weight: 600;
  transition:
    transform 0.2s,
    filter 0.2s;
}
.btn-primary:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
  color: var(--accent-ink);
}
.btn-secondary {
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  font-weight: 600;
  transition:
    border-color 0.2s,
    transform 0.2s;
}
.btn-secondary:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  color: var(--text);
}
.work-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  transition: border-color 0.25s;
}
.work-card:hover {
  border-color: color-mix(in oklab, var(--accent) 50%, var(--line));
}
.blog-card {
  border: 1px dashed var(--line);
  border-radius: 18px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 0.25s;
  width: 100%;
}
.blog-card:hover {
  border-color: var(--accent);
}

/* reader modal (home) */
.reader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 5vh 20px;
  overflow-y: auto;
}
.reader[hidden] {
  display: none;
}
.reader-backdrop {
  position: fixed;
  inset: 0;
  background: color-mix(in oklab, var(--bg) 60%, #000);
  backdrop-filter: blur(8px);
}
.reader-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 720px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 56px 56px 60px;
  margin: auto;
  animation: fadeUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.reader-close {
  position: absolute;
  top: 20px;
  right: 22px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  transition:
    border-color 0.2s,
    color 0.2s;
}
.reader-close:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.reader-body {
  font-size: 17px;
  line-height: 1.8;
  color: var(--muted);
  text-wrap: pretty;
}
.reader-body p {
  margin: 0 0 20px;
}
.reader-body ul {
  margin: 0 0 20px;
  padding-left: 22px;
}
.reader-body li {
  margin: 0 0 10px;
}
.reader-body strong {
  color: var(--text);
  font-weight: 600;
}
.reader-full {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 12px 22px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  transition:
    transform 0.2s,
    filter 0.2s;
}
.reader-full:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
  color: var(--accent-ink);
}
body.reader-open {
  overflow: hidden;
}

/* ============================================================
   Blog article pages
   ============================================================ */
.post-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 40px;
  background: color-mix(in oklab, var(--bg) 78%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.post-nav .brand {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: 0.04em;
}
.post-nav .back {
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  transition: color 0.2s;
}
.post-nav .back:hover {
  color: var(--text);
}
.wrap {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 24px;
}
header.post {
  padding: 72px 0 40px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 44px;
}
.kicker {
  font-size: 13px;
  letter-spacing: 0.14em;
  color: var(--accent);
  margin: 0 0 20px;
}
h1.post-title {
  font-size: 46px;
  line-height: 1.08;
  font-weight: 800;
  letter-spacing: -0.025em;
  margin: 0 0 26px;
  text-wrap: balance;
}
.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.chip {
  font-size: 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 12px;
  color: var(--muted);
}
.readtime {
  font-size: 13px;
  color: var(--muted);
  margin-left: auto;
}
article.body {
  font-size: 18px;
  line-height: 1.85;
  color: var(--muted);
  text-wrap: pretty;
  padding-bottom: 32px;
}
article.body p {
  margin: 0 0 24px;
}
article.body h2 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 52px 0 18px;
  line-height: 1.2;
}
article.body h3 {
  font-size: 19px;
  font-weight: 700;
  color: var(--text);
  margin: 36px 0 12px;
}
article.body ul {
  margin: 0 0 24px;
  padding-left: 22px;
}
article.body li {
  margin: 0 0 10px;
}
article.body ul.takeaways {
  list-style: none;
  padding-left: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
article.body ul.takeaways li {
  position: relative;
  padding: 14px 18px 14px 46px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  margin: 0;
}
article.body ul.takeaways li::before {
  content: "✓";
  position: absolute;
  left: 18px;
  top: 14px;
  color: var(--accent);
  font-weight: 800;
}
article.body pre.diagram {
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  line-height: 1.7;
  color: var(--accent);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px 28px;
  overflow-x: auto;
  text-align: left;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto 24px;
}
.post-foot {
  border-top: 1px solid var(--line);
  margin-top: 8px;
  padding: 40px 0 90px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
}
.post-foot .home {
  border: 1px solid var(--line);
  color: var(--text);
  padding: 12px 22px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 15px;
  transition: border-color 0.2s;
}
.post-foot .home:hover {
  border-color: var(--accent);
  color: var(--text);
}
.post-foot .cta {
  color: var(--muted);
  font-size: 14px;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
  nav {
    padding: 16px 20px !important;
  }
  .nav-links-secondary {
    display: none !important;
  }
  main {
    padding: 0 20px !important;
  }
  #home {
    grid-template-columns: 1fr !important;
    gap: 40px !important;
    padding: 56px 0 !important;
  }
  #home .hero-img {
    max-width: 320px;
    margin: 0 auto;
  }
  #home h1 {
    font-size: 44px !important;
  }
  .metrics {
    grid-template-columns: 1fr 1fr !important;
  }
  .skills-grid {
    grid-template-columns: 1fr !important;
  }
  .writing-grid {
    grid-template-columns: 1fr !important;
  }
  .exp-row {
    grid-template-columns: 1fr !important;
    gap: 6px !important;
  }
  .exp-dot {
    display: none !important;
  }
  .work-metrics {
    grid-template-columns: 1fr !important;
  }
  .contact-card {
    padding: 44px 24px !important;
  }
  .contact-card h2 {
    font-size: 32px !important;
  }
  .reader-panel {
    padding: 48px 24px 40px;
  }
  .reader-panel h2 {
    font-size: 26px !important;
  }
  h1.post-title {
    font-size: 34px;
  }
  article.body {
    font-size: 16px;
  }
  header.post {
    padding: 48px 0 32px;
  }
}
