/* ============================================================
   Rajat Pawar — personal site
   One stylesheet. No build step. Edit and refresh.
   ============================================================ */

/* ---------- Tokens ---------- */

:root {
  /* Type */
  --font-serif: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino,
    Georgia, serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto,
    system-ui, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    monospace;

  /* Measure */
  --measure: 40rem;
  --gutter: 1.5rem;

  /* Light palette */
  --bg: #fdfcfa;
  --bg-sunk: #f4f2ee;
  --text: #1b1a17;
  --text-muted: #6d6a63;
  --text-faint: #a4a099;
  --accent: #b2502b;
  --rule: rgba(27, 26, 23, 0.1);
  --rule-soft: rgba(27, 26, 23, 0.06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131211;
    --bg-sunk: #1b1a18;
    --text: #e9e6e0;
    --text-muted: #9c9891;
    --text-faint: #6b6862;
    --accent: #e39b6f;
    --rule: rgba(233, 230, 224, 0.12);
    --rule-soft: rgba(233, 230, 224, 0.07);
  }
}

/* ---------- Reset ---------- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

::selection {
  background: var(--accent);
  color: var(--bg);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- Layout ---------- */

.wrap {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

main {
  padding-bottom: 6rem;
}

/* ---------- Masthead ---------- */

.masthead {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  padding: 2.5rem 0 0;
}

.masthead__name {
  font-family: var(--font-serif);
  font-size: 1.125rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 0;
}

.masthead__name a {
  color: inherit;
  text-decoration: none;
}

.masthead__name a:hover {
  color: var(--accent);
}

.masthead__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  font-size: 0.875rem;
}

.masthead__nav a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.18s ease;
}

.masthead__nav a:hover {
  color: var(--accent);
}

/* ---------- Intro ---------- */

.intro {
  padding: 5rem 0 4.5rem;
}

.intro h1 {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 6vw, 2.75rem);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0 0 1.25rem;
  text-wrap: balance;
}

.intro p {
  font-size: 1.125rem;
  color: var(--text-muted);
  margin: 0 0 1rem;
  max-width: 34rem;
}

.intro p:last-child {
  margin-bottom: 0;
}

/* ---------- Sections ---------- */

.section {
  padding: 3rem 0;
  border-top: 1px solid var(--rule);
}

.section__label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 0 0 1.75rem;
}

.section p {
  margin: 0 0 1.1rem;
  max-width: 34rem;
}

.section p:last-child {
  margin-bottom: 0;
}

/* ---------- Lists (writing + projects) ---------- */

.list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.list > li + li {
  margin-top: 0.25rem;
  border-top: 1px solid var(--rule-soft);
}

.entry {
  display: block;
  padding: 0.9rem 0;
  text-decoration: none;
  color: inherit;
}

.entry:hover .entry__title {
  color: var(--accent);
}

.entry__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.entry__title {
  font-weight: 500;
  transition: color 0.18s ease;
}

.entry__meta {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

.entry__desc {
  margin: 0.2rem 0 0;
  font-size: 0.9375rem;
  color: var(--text-muted);
  max-width: 34rem;
}

/* ---------- Inline links ---------- */

.section p a,
.prose a,
.more {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent);
  transition: text-decoration-color 0.18s ease;
}

.section p a:hover,
.prose a:hover,
.more:hover {
  text-decoration-color: var(--accent);
}

.more {
  display: inline-block;
  margin-top: 1.5rem;
  font-size: 0.9375rem;
}

/* ---------- Article (blog post) ---------- */

.post-header {
  padding: 4.5rem 0 2.5rem;
  border-bottom: 1px solid var(--rule);
}

.post-header h1 {
  font-family: var(--font-serif);
  font-size: clamp(1.875rem, 5vw, 2.375rem);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0 0 0.75rem;
  text-wrap: balance;
}

.post-header time {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-faint);
}

.prose {
  padding: 2.5rem 0 0;
}

.prose > * {
  max-width: 34rem;
}

.prose p {
  margin: 0 0 1.4rem;
}

.prose h2 {
  font-family: var(--font-serif);
  font-size: 1.375rem;
  font-weight: 500;
  line-height: 1.3;
  margin: 2.75rem 0 1rem;
}

.prose h3 {
  font-size: 1.0625rem;
  font-weight: 600;
  margin: 2rem 0 0.75rem;
}

.prose ul,
.prose ol {
  margin: 0 0 1.4rem;
  padding-left: 1.25rem;
}

.prose li {
  margin-bottom: 0.4rem;
}

.prose blockquote {
  margin: 1.75rem 0;
  padding-left: 1.25rem;
  border-left: 2px solid var(--rule);
  color: var(--text-muted);
  font-style: italic;
}

.prose code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--bg-sunk);
  padding: 0.15em 0.35em;
  border-radius: 3px;
}

.prose pre {
  max-width: 100%;
  background: var(--bg-sunk);
  padding: 1rem 1.1rem;
  border-radius: 6px;
  overflow-x: auto;
  margin: 0 0 1.4rem;
  font-size: 0.875rem;
  line-height: 1.6;
}

.prose pre code {
  background: none;
  padding: 0;
  font-size: inherit;
}

.prose hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 2.75rem 0;
}

/* ---------- Entrance ---------- */

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.rise {
  animation: rise 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.rise-2 {
  animation-delay: 0.08s;
}

/* ---------- Small screens ---------- */

@media (max-width: 34rem) {
  .intro {
    padding: 3.5rem 0 3rem;
  }

  .entry__head {
    flex-direction: column;
    gap: 0.15rem;
  }
}
