/* Rahul Jha: portfolio
   One family (Archivo), using its width axis for character.
   Palette: cool canvas, slate ink, amber "running" signal, green "done". */

:root {
  --canvas: #F3F5F4;
  --surface: #FFFFFF;
  --ink: #18222D;
  --ink-2: #222E3B;
  --muted: #56616D;
  --muted-on-ink: #A9B4BE;
  --wire: #C5CED4;
  --signal: #FFB800;
  --signal-deep: #E5A500;
  --signal-soft: #FFF1CC;
  --done: #0F7A55;

  --font: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --measure: 66ch;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --section-space: clamp(4rem, 8vw, 6.5rem);
  --radius: 10px;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.125rem;
  font-stretch: 100%;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

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

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
  border-radius: 4px;
}

h1, h2, h3 { margin: 0; font-weight: 750; text-wrap: balance; }

h2 {
  font-size: clamp(1.9rem, 3.8vw, 3.1rem);
  font-stretch: 115%;
  line-height: 1.04;
  letter-spacing: -0.02em;
}

h3 {
  font-size: 1.25rem;
  font-stretch: 106%;
  line-height: 1.25;
  letter-spacing: -0.005em;
}

p { margin: 0; }

.wrap {
  width: 100%;
  max-width: 76rem;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.wrap.narrow > * { max-width: 50rem; }

.skip {
  position: absolute;
  left: -999px;
  top: 0.5rem;
  background: var(--ink);
  color: var(--canvas);
  padding: 0.5rem 1rem;
  z-index: 50;
}
.skip:focus { left: 0.5rem; }

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--canvas) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--wire);
}

.header-row {
  display: flex;
  align-items: center;
  gap: 2rem;
  min-height: 4rem;
}

.wordmark {
  font-weight: 800;
  font-stretch: 120%;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  text-decoration: none;
  margin-right: auto;
}

.nav-links {
  display: flex;
  gap: 1.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.95rem;
  font-stretch: 92%;
}

.nav-links a { text-decoration: none; color: var(--muted); }
.nav-links a:hover { color: var(--ink); }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1.35rem;
  border: 1.5px solid var(--signal);
  border-radius: 8px;
  background: var(--signal);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  font-weight: 650;
  font-stretch: 104%;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease;
}

.btn:hover { background: var(--signal-deep); border-color: var(--signal-deep); }

.btn-quiet {
  background: transparent;
  border-color: var(--ink);
}
.btn-quiet:hover { background: var(--ink); border-color: var(--ink); color: var(--canvas); }

.btn-small { padding: 0.55rem 0.95rem; font-size: 0.925rem; }

.link-button {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.18em;
  cursor: pointer;
}

/* ---------- Hero ---------- */

.hero { padding-top: clamp(3rem, 7vw, 5.5rem); }

.hero-title {
  font-size: clamp(2.5rem, 6.2vw, 5.25rem);
  font-weight: 800;
  font-stretch: 122%;
  line-height: 0.96;
  letter-spacing: -0.03em;
  max-width: 14.5em;
}

.hero-lede {
  margin-top: clamp(1.5rem, 3vw, 2.25rem);
  max-width: 38rem;
  font-size: clamp(1.125rem, 1.6vw, 1.3rem);
  line-height: 1.55;
  color: var(--muted);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
}

/* The workflow: the one animated moment on the page */

.flow-stage {
  margin: clamp(2.75rem, 5vw, 4rem) 0 0;
  padding-block: clamp(2.25rem, 4.5vw, 3.5rem);
  border-block: 1px solid var(--wire);
  background-color: var(--canvas);
  background-image: radial-gradient(circle, #CDD5DA 1px, transparent 1.2px);
  background-size: 22px 22px;
}

.flow {
  --gap: clamp(1.75rem, 3.5vw, 3.25rem);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--gap);
  margin: 0;
  padding: 0;
  list-style: none;
}

.node {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.15rem 1.25rem 1.35rem;
  background: var(--surface);
  border: 1.5px solid var(--wire);
  border-radius: var(--radius);
  transition: border-color 250ms ease, box-shadow 250ms ease;
}

/* connector wire into each node after the first */
.node + .node::before,
.node + .node::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 100%;
  width: var(--gap);
  height: 2px;
  margin-top: -1px;
  margin-right: 1.5px;
  background: var(--wire);
}

.node + .node::after {
  background: var(--signal);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 380ms ease-in-out;
}

.node[data-state="done"] + .node::after { transform: scaleX(1); }

.node-kind {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  font-stretch: 88%;
  color: var(--muted);
}

.node-kind::before {
  content: "";
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  border: 1.5px solid var(--wire);
  background: var(--surface);
  flex: none;
}

.node-text {
  font-size: 1.1rem;
  font-weight: 560;
  font-stretch: 98%;
  line-height: 1.35;
}

.node[data-state="running"] {
  border-color: var(--signal);
  box-shadow: 0 0 0 4px var(--signal-soft);
}
.node[data-state="running"] .node-kind::before {
  border-color: var(--signal-deep);
  background: var(--signal);
}

.node[data-state="done"] { border-color: var(--ink); }
.node[data-state="done"] .node-kind::before {
  border-color: var(--done);
  background: var(--done);
}

.node-result[data-state="done"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--canvas);
}
.node-result[data-state="done"] .node-kind { color: var(--muted-on-ink); }

.flow-caption {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  margin-top: 1.5rem;
  font-size: 0.95rem;
  color: var(--muted);
}

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

.section { padding-block: var(--section-space); }

.section-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1rem 4rem;
  align-items: end;
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
}

.section-head p {
  max-width: 34rem;
  color: var(--muted);
}

.pain-list {
  margin: 2.25rem 0 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--wire);
}

.pain-list li {
  padding: 1.1rem 0 1.1rem 2.25rem;
  border-bottom: 1px solid var(--wire);
  position: relative;
  font-size: clamp(1.1rem, 1.6vw, 1.3rem);
  line-height: 1.45;
}

/* a stalled step: amber dot that never turns green */
.pain-list li::before {
  content: "";
  position: absolute;
  left: 0.25rem;
  top: 1.65rem;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  border: 1.5px solid var(--signal-deep);
  background: var(--signal-soft);
}

/* Recipes: "when this happens / then this follows" */

.recipes { border-top: 1.5px solid var(--ink); }

.recipe {
  display: grid;
  grid-template-columns: minmax(10rem, 0.8fr) minmax(0, 1fr) minmax(0, 1.25fr);
  --col-gap: clamp(1.5rem, 4vw, 3.5rem);
  gap: 1rem var(--col-gap);
  padding-block: clamp(1.5rem, 3vw, 2.1rem);
  border-bottom: 1px solid var(--wire);
  align-items: start;
}

.recipe h3 { font-size: clamp(1.2rem, 1.8vw, 1.4rem); }

.recipe .then { position: relative; }

.recipe .then::before {
  content: "";
  position: absolute;
  top: 0.62rem;
  right: calc(100% + 0.5rem);
  width: calc(var(--col-gap) - 0.5rem);
  height: 2px;
  background: var(--signal);
}

.tag {
  display: block;
  margin-bottom: 0.2rem;
  font-size: 0.85rem;
  font-weight: 600;
  font-stretch: 88%;
  color: var(--muted);
}

.tools {
  display: grid;
  grid-template-columns: minmax(10rem, 0.8fr) minmax(0, 2.25fr);
  gap: 1rem clamp(1.5rem, 4vw, 3.5rem);
  margin-top: clamp(2.5rem, 5vw, 3.5rem);
  align-items: start;
}

.tools-title { font-size: 1.05rem; padding-top: 0.45rem; }

.tool-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0.5rem;
  list-style: none;
}

.tool-list li {
  padding: 0.35rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--wire);
  border-radius: 6px;
  font-size: 0.95rem;
  font-stretch: 95%;
}

.ph-note { grid-column: 2; font-size: 0.95rem; }
.contact .ph-note { margin-top: 1.25rem; }

/* Process: a real sequence, so it gets numbers */

.section-ink {
  background: var(--ink);
  color: var(--canvas);
}
.section-ink .section-head p { color: var(--muted-on-ink); }
.section-ink :focus-visible { outline-color: var(--signal); }

.steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 2rem clamp(1.5rem, 3vw, 2.5rem);
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.step {
  counter-increment: step;
  position: relative;
  padding-top: 4.25rem;
  border-top: 2px solid #3A4755;
}

.step::before {
  content: counter(step);
  position: absolute;
  top: 1rem;
  left: 0;
  font-size: 2.25rem;
  font-weight: 800;
  font-stretch: 125%;
  line-height: 1;
  color: var(--signal);
}

.step h3 { margin-bottom: 0.6rem; }

.step p {
  color: var(--muted-on-ink);
  font-size: 1.02rem;
  line-height: 1.6;
}

/* Work */

.cases {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2.5rem clamp(1.5rem, 3vw, 2.5rem);
}

.case {
  padding-top: 1.25rem;
  border-top: 1.5px solid var(--ink);
}

.case h3 { font-size: 1.2rem; }

.case-facts { margin: 1.25rem 0 0; }

.case-facts div + div { margin-top: 1rem; }

.case-facts dt {
  font-size: 0.85rem;
  font-weight: 600;
  font-stretch: 88%;
  color: var(--muted);
}

.case-facts dd {
  margin: 0.15rem 0 0;
  font-size: 1.02rem;
  line-height: 1.5;
}

.quote {
  margin: clamp(3.5rem, 7vw, 5.5rem) 0 0;
  max-width: 50rem;
}

.quote blockquote { margin: 0; }

.quote blockquote p {
  font-size: clamp(1.4rem, 2.6vw, 2rem);
  font-weight: 500;
  font-stretch: 108%;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.quote figcaption {
  margin-top: 1rem;
  color: var(--muted);
  font-size: 1rem;
}

/* About */

.about {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.4fr);
  gap: 2.5rem clamp(2rem, 6vw, 5rem);
  align-items: start;
}

.portrait {
  aspect-ratio: 4 / 5;
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.about-text h2 { margin-bottom: 1.5rem; }

.about-text p { max-width: var(--measure); }
.about-text p + p { margin-top: 1.1rem; }

/* FAQ */

.faq {
  margin-top: 2.25rem;
  border-top: 1px solid var(--wire);
}

.faq details { border-bottom: 1px solid var(--wire); }

.faq summary {
  position: relative;
  padding: 1.15rem 2.5rem 1.15rem 0;
  font-size: clamp(1.1rem, 1.6vw, 1.25rem);
  font-weight: 620;
  font-stretch: 102%;
  cursor: pointer;
  list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }

.faq summary::before,
.faq summary::after {
  content: "";
  position: absolute;
  right: 0.35rem;
  top: 50%;
  width: 0.9rem;
  height: 2px;
  background: var(--ink);
  transition: transform 200ms ease;
}
.faq summary::after { transform: rotate(90deg); }
.faq details[open] summary::after { transform: rotate(0deg); }

.faq details p {
  padding: 0 0 1.35rem;
  max-width: var(--measure);
  color: var(--muted);
}

/* Contact */

.contact {
  background: var(--surface);
  border-top: 1px solid var(--wire);
}

.contact p:not(.ph-note) {
  margin-top: 1.25rem;
  max-width: 38rem;
  font-size: clamp(1.125rem, 1.6vw, 1.3rem);
  color: var(--muted);
}

/* Footer */

.site-footer {
  border-top: 1px solid var(--wire);
  padding-block: 2rem 5rem;
  font-size: 0.95rem;
  color: var(--muted);
}

.footer-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
}

/* ---------- Draft placeholders ---------- */

.ph {
  background: var(--signal-soft);
  outline: 1.5px dashed var(--signal-deep);
  outline-offset: 1px;
  border-radius: 3px;
  color: var(--ink);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.ph-group {
  outline: 1.5px dashed var(--signal-deep);
  border-radius: 8px;
}

.ph-box {
  display: grid;
  place-items: center;
  text-align: center;
  border: 1.5px dashed var(--signal-deep);
  background: var(--signal-soft);
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.4;
}

.draft-bar {
  position: fixed;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  z-index: 30;
  width: max-content;
  max-width: calc(100% - 2rem);
  padding: 0.6rem 1rem;
  border-radius: 8px;
  background: var(--ink);
  color: var(--canvas);
  font-size: 0.875rem;
  line-height: 1.4;
  box-shadow: 0 6px 24px rgba(24, 34, 45, 0.25);
}

html:not([data-draft]) .draft-bar { display: none; }

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

@media (max-width: 1000px) {
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cases { grid-template-columns: minmax(0, 1fr); max-width: 40rem; }
}

@media (max-width: 860px) {
  .nav-links { display: none; }

  .flow {
    grid-template-columns: minmax(0, 1fr);
    max-width: 28rem;
  }

  .node + .node::before,
  .node + .node::after {
    top: auto;
    right: auto;
    bottom: 100%;
    left: 1.55rem;
    width: 2px;
    height: var(--gap);
    margin: 0 0 1.5px;
  }

  .node + .node::after { transform: scaleY(0); transform-origin: center top; }
  .node[data-state="done"] + .node::after { transform: scaleY(1); }

  .section-head { grid-template-columns: minmax(0, 1fr); }

  .recipe { grid-template-columns: minmax(0, 1fr); gap: 0.75rem; }
  .recipe .then { padding-left: 1.25rem; }
  .recipe .then::before {
    top: 0.25rem;
    bottom: 0.25rem;
    right: auto;
    left: 0;
    width: 2px;
    height: auto;
  }

  .tools { grid-template-columns: minmax(0, 1fr); }
  .ph-note { grid-column: 1; }

  .about { grid-template-columns: minmax(0, 1fr); }
  .portrait { max-width: 18rem; }
}

@media (max-width: 560px) {
  .steps { grid-template-columns: minmax(0, 1fr); }
  .hero-actions .btn { flex: 1 1 100%; }
  .header-row { gap: 1rem; }
}

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