/* Pratham Jain — dhravya.dev-inspired design system */
:root {
  --bg: #fbfbf9;
  --ink: #15171c;
  --muted: #6b7280;
  --hairline: #ececea;
  --accent: #2f6bff;
  --accent-soft: rgba(47, 107, 255, 0.07);
  --card: #ffffff;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Hanken Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 1.0625rem;
  line-height: 1.65;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---- film grain ---- */
.grain {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
}

/* ---- custom cursor: hide native on fine pointers ---- */
@media (pointer: fine) {
  body, body a, body button, body input, body textarea, body canvas {
    cursor: none;
  }
}
.cursor-arrow, .cursor-ring {
  position: fixed;
  top: 0; left: 0;
  z-index: 100;
  pointer-events: none;
  display: none;
}
@media (pointer: fine) {
  .cursor-arrow, .cursor-ring { display: block; }
}
.cursor-arrow {
  transform: translate(-2px, -2px);
  filter: drop-shadow(0 1px 2px rgba(21, 23, 28, 0.25));
  transition: opacity 0.15s ease;
}
.cursor-ring {
  width: 38px; height: 38px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.6);
  transition: opacity 0.18s ease, transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}
body.cursor-hover .cursor-arrow { opacity: 0; }
body.cursor-hover .cursor-ring {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  animation: ring-pulse 1.6s ease-in-out infinite;
}
@keyframes ring-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(47, 107, 255, 0.25); }
  50% { box-shadow: 0 0 0 8px rgba(47, 107, 255, 0); }
}
@media (prefers-reduced-motion: reduce) {
  body.cursor-hover .cursor-ring { animation: none; }
}

/* ---- sidebar ---- */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 168px;
  border-right: 1px solid var(--hairline);
  padding: 2.5rem 0.9rem;
  background: var(--bg);
  z-index: 40;
}
.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
.nav-item svg {
  width: 20px; height: 20px;
  flex-shrink: 0;
  opacity: 0.75;
}
.nav-item:hover { background: var(--accent-soft); }
.nav-item:active { transform: scale(0.96); }
.nav-item.active { color: var(--accent); }
.nav-item.active svg { opacity: 1; }

/* ---- main column: centered like dhravya.dev, sidebar stays fixed ---- */
.content {
  margin-left: auto;
  margin-right: auto;
  max-width: 700px;
  padding: 4.5rem 2rem 5rem;
}
/* narrower desktop: dock left of the sidebar again so nothing tucks under it */
@media (max-width: 1100px) {
  .content {
    margin-left: 168px;
    margin-right: 0;
  }
}

/* ---- hero ---- */
.name-label {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 500;
}
h1 {
  margin: 0 0 1.25rem;
  font-size: clamp(2.25rem, 5vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.08;
}
.grad {
  background: linear-gradient(100deg, var(--accent), #8b5cf6, var(--accent));
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: grad-pan 7s linear infinite;
}
@keyframes grad-pan {
  to { background-position: 200% center; }
}
@media (prefers-reduced-motion: reduce) {
  .grad { animation: none; }
}
.intro {
  margin: 0 0 1.5rem;
  font-size: 1.1rem;
  max-width: 34rem;
}
.socials {
  display: flex;
  gap: 1.1rem;
  align-items: center;
  margin-bottom: 3rem;
}
.socials a {
  color: var(--muted);
  display: inline-flex;
  transition: color 0.15s ease, transform 0.15s ease;
}
.socials a:hover { color: var(--accent); transform: translateY(-1px); }
.socials svg { width: 21px; height: 21px; }

/* ---- link treatments ---- */
/* body links: diagonal dashed hash-mark underline */
.hash-link {
  color: inherit;
  text-decoration: none;
  background-image: repeating-linear-gradient(-60deg, currentColor 0 1.5px, transparent 1.5px 5px);
  background-size: 100% 1.5px;
  background-repeat: no-repeat;
  background-position: 0 calc(100% - 1px);
  padding-bottom: 2px;
  transition: color 0.15s ease;
}
.hash-link:hover { color: var(--accent); }
/* row links: wipe-in blue underline */
.row-link {
  position: relative;
  color: var(--ink);
  text-decoration: none;
  transition: color 0.18s ease;
}
.row-link::after {
  content: "";
  position: absolute;
  left: 0; bottom: -2px;
  height: 2px; width: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}
.row-link:hover { color: var(--accent); }
.row-link:hover::after { transform: scaleX(1); }
.row-link strong { font-weight: 700; }

/* ---- story bullets ---- */
.story {
  list-style: none;
  margin: 0 0 3.5rem;
  padding: 0;
}
.story li {
  position: relative;
  padding-left: 1.4rem;
  margin-bottom: 1rem;
}
.story li::before {
  content: "•";
  position: absolute;
  left: 0.35rem;
  color: var(--muted);
}

/* ---- sections ---- */
.section { margin-bottom: 3.5rem; }
.section-label {
  margin: 0 0 1.25rem;
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.writing-note { margin: 0; }
.stuff-list p { margin: 0 0 1rem; }
.stuff-list .dash { color: var(--muted); }
.stuff-list .muted { color: var(--muted); }
.stuff-list .sub-links { font-size: 0.95rem; }
.stuff-list .older { margin-top: 1.5rem; color: var(--muted); }

/* ---- featured project cards (home + /projects/) ---- */
.feat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 2rem; }
.feat-card {
  display: block; text-decoration: none; color: var(--ink);
  border: 1px solid var(--hairline); border-radius: 12px; padding: 20px;
  background: var(--card); transition: border-color 0.2s ease;
}
.feat-card:hover { border-color: var(--accent); }
.feat-top { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem; }
.logo-tile {
  width: 36px; height: 36px; border-radius: 8px; flex-shrink: 0;
  border: 1px solid var(--hairline); background: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1.05rem; color: var(--ink);
}
.feat-name { font-weight: 600; font-size: 16px; }
.feat-arrow { margin-left: auto; width: 16px; height: 16px; color: var(--muted); flex-shrink: 0; transition: color 0.2s ease, transform 0.2s ease; }
.feat-card:hover .feat-arrow { color: var(--accent); transform: translate(2px, -2px); }
.feat-desc { color: var(--muted); font-size: 14px; line-height: 1.625; margin: 0 0 0.75rem; }
.pill {
  display: inline-block; font-size: 11px; font-weight: 500;
  padding: 2px 10px; border-radius: 999px;
  border: 1px solid var(--hairline); color: var(--muted); background: transparent;
}
@media (max-width: 760px) {
  .feat-grid { grid-template-columns: 1fr; }
}
.contrib-card {
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  padding: 1rem 1rem 0.5rem;
  overflow-x: auto;
}
.contrib-card img {
  display: block;
  min-width: 620px;
  width: 100%;
  height: auto;
}
.caption {
  margin: 0.6rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

/* ---- guestbook ---- */
.gb-form {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  max-width: 30rem;
  margin: 1.25rem 0 2rem;
}
#gb-canvas {
  width: 100%;
  aspect-ratio: 3 / 1;
  border: 1px dashed var(--hairline);
  border-radius: 12px;
  background: var(--card);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
#gb-canvas:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}
.gb-form-row {
  display: flex;
  gap: 0.6rem;
  align-items: stretch;
}
.gb-form-row input {
  flex: 1;
  min-width: 0;
  font: inherit;
  letter-spacing: inherit;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  background: var(--card);
  color: var(--ink);
}
.gb-form-row input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}
.gb-form button {
  font: inherit;
  font-weight: 600;
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  transition: transform 0.1s ease, opacity 0.15s ease;
  white-space: nowrap;
}
.gb-form button:hover { opacity: 0.92; }
.gb-form button:active { transform: scale(0.97); }
.gb-form button:disabled { opacity: 0.55; }
.gb-btn-ghost {
  background: transparent !important;
  color: var(--muted) !important;
  border: 1px solid var(--hairline) !important;
}
.gb-status {
  margin: 0;
  min-height: 1.4em;
  font-size: 0.92rem;
  color: var(--muted);
}
.gb-wall {
  position: relative;
  margin-top: 0.5rem;
}
.gb-sig {
  position: absolute;
  cursor: default;
}
.gb-sig svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.gb-sig path {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.gb-sig:focus {
  outline: 2px dashed var(--accent);
  outline-offset: 4px;
  border-radius: 6px;
}
.gb-legacy {
  border-left: 2px solid var(--hairline);
  padding-left: 0.8rem;
  font-size: 0.9rem;
}
.gb-legacy-name { font-weight: 700; }
.gb-tip {
  position: absolute;
  transform: translate(-50%, -115%);
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  z-index: 5;
}
.gb-empty { color: var(--muted); }

/* ---- footer ---- */
.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding-top: 2rem;
  border-top: 1px solid var(--hairline);
  color: var(--muted);
  font-size: 0.95rem;
}

/* ---- mobile: bottom tab bar ---- */
@media (max-width: 760px) {
  .sidebar {
    top: auto; bottom: 0; left: 0; right: 0;
    width: auto; height: 62px;
    border-right: none;
    border-top: 1px solid var(--hairline);
    padding: 0 0.5rem;
    display: flex;
    align-items: center;
  }
  .sidebar nav {
    flex-direction: row;
    justify-content: space-around;
    width: 100%;
  }
  .nav-item {
    flex-direction: column;
    gap: 0.15rem;
    font-size: 0.68rem;
    padding: 0.4rem 0.6rem;
  }
  .nav-item svg { width: 19px; height: 19px; }
  .content {
    margin-left: 0;
    padding: 2.5rem 1.25rem 6.5rem;
  }
  h1 { font-size: 2.1rem; }
}
