/* Yash Gupta - portfolio
   One idea carries the design: work shown the way a backend engineer sees it, as a trace.
   Grey is time spent waiting or scanning; red is time doing the actual work.

   Palette: the Clause design system (docs: contract-review/app/globals.css). Red and white,
   with greys doing the structural work. The rules it runs on:
     - one accent colour, used only for links, the primary action and the "work" spans
     - borders are hairlines, not boxes; shadows only where something floats
     - green and danger exist only for true/false states in code samples, never decoration

   Why grey for waiting rather than a second hue: with one accent, a long grey bar collapsing
   into a short red one reads as dead time giving way to real work, which is the whole point
   of the traces. A second colour would compete with the accent and say less. */

:root {
  --paper: #f4f5f7;
  --surface: #ffffff;
  --ink: #15161a;
  --muted: #6e7079;
  --rule: #e7e8ec;
  --rule-strong: #d6d8de;
  --accent: #d12b20;
  --accent-hover: #c62a25;
  --accent-soft: #fdecea;
  --wait: #9ca1aa;
  --wait-2: #c7cad1;
  --good: #11724a;
  --danger: #a32718;
  --track: #eeeff2;
  --focus: #d12b20;

  --font: "Schibsted Grotesk", "Segoe UI", system-ui, sans-serif;
  --code: "JetBrains Mono", Consolas, "SFMono-Regular", monospace;

  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.3125rem;
  --step-2: 1.75rem;
  --step-3: clamp(2.25rem, 1.6rem + 2.6vw, 3.5rem);
  --step-4: clamp(3rem, 2rem + 5vw, 5.75rem);

  --measure: 68ch;
  --wide: 1120px;
  --gutter: clamp(16px, 4vw, 40px);
}

/* Clause itself is light only, on the argument that a half-converted dark mode is worse than
   none. This site already had one and removing it would be a behaviour change rather than a
   restyle, so it is kept and recoloured: the same red identity, lightened enough to stay
   readable on a dark surface. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #16171a;
    --surface: #1d1f23;
    --ink: #e8e9ec;
    --muted: #9b9ea6;
    --rule: #2e3036;
    --rule-strong: #3a3d44;
    --accent: #ff6b5e;
    --accent-hover: #ff8a7e;
    --accent-soft: #3a1f1c;
    --wait: #6e7079;
    --wait-2: #4a4d54;
    --good: #5fc79a;
    --danger: #f08b76;
    --track: #2a2c31;
    --focus: #ff8a7e;
  }
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--step-0);
  line-height: 1.55;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 2px; }

.skip {
  position: absolute; left: var(--gutter); top: -60px;
  background: var(--ink); color: var(--paper); padding: 8px 12px; z-index: 10;
}
.skip:focus { top: 12px; }

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

/* ---------- top bar ---------- */

.bar {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
  padding: 22px 0; flex-wrap: wrap;
}
.bar .home { color: var(--ink); text-decoration: none; font-weight: 700; }
.bar nav { display: flex; gap: 20px; flex-wrap: wrap; font-size: var(--step--1); }
.bar nav a { color: var(--muted); text-decoration: none; }
.bar nav a:hover, .bar nav a[aria-current="page"] { color: var(--ink); text-decoration: underline; }

/* ---------- hero ---------- */

.hero { padding: clamp(32px, 7vw, 88px) 0 clamp(40px, 6vw, 72px); }

.hero h1 {
  font-size: var(--step-4);
  line-height: 0.95;
  letter-spacing: -0.035em;
  font-weight: 800;
  margin: 0 0 20px;
}

.hero .intro { font-size: var(--step-1); line-height: 1.45; max-width: 40ch; margin: 0 0 12px; }
.hero .intro-sub { color: var(--muted); max-width: 58ch; margin: 0 0 28px; }

.links { display: flex; flex-wrap: wrap; gap: 10px 22px; align-items: center; margin: 0; padding: 0; list-style: none; }
/* The one obvious action per section, at a size you cannot miss. Solid accent rather than
   ink: it is the only element on the page allowed to be a filled red block, which is what
   makes it read as the action. */
.button {
  display: inline-block; background: var(--accent); color: #fff;
  padding: 11px 20px; border-radius: 6px; text-decoration: none; font-weight: 600;
}
.button:hover { background: var(--accent-hover); color: #fff; }

/* ---------- traces: the signature element ---------- */

.traces { margin-top: clamp(40px, 6vw, 64px); display: grid; gap: 40px; }
figure { margin: 0; }

.trace { border-top: 2px solid var(--ink); padding-top: 14px; }
.trace-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px 24px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.trace-head h2 { font-size: var(--step-1); margin: 0; font-weight: 700; letter-spacing: -0.01em; }
.trace-head .result { font-size: var(--step-2); font-weight: 800; letter-spacing: -0.02em; white-space: nowrap; }
.trace-head .result small { font-size: var(--step--1); font-weight: 500; color: var(--muted); margin-left: 6px; }

.span-row {
  display: grid;
  grid-template-columns: 5.5rem 1fr 5.5rem;
  gap: 12px;
  align-items: center;
  margin: 8px 0;
}
.span-row .when { color: var(--muted); font-size: var(--step--1); }
.span-row .total { text-align: right; font-weight: 700; }

.track { position: relative; height: 30px; background: var(--track); border-radius: 3px; overflow: hidden; }
.spans { display: flex; height: 100%; transform-origin: left center; animation: grow 1.1s cubic-bezier(.2,.7,.1,1) both; }
.after .spans { animation-delay: 0.45s; }
/* No divider and no min-width: adjacent spans of the same colour must read as one
   continuous bar, and a span must never be drawn wider than the time it represents.
   Segments within a row are told apart by alternating shade, not by a rule. */
.span { height: 100%; }
.wait { background: var(--wait); }
.wait-2 { background: var(--wait-2); }
.work { background: var(--accent); }

@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.legend { display: flex; flex-wrap: wrap; gap: 6px 20px; margin: 12px 0 0 calc(5.5rem + 12px); padding: 0; list-style: none; font-size: var(--step--1); color: var(--muted); }
.legend li { display: flex; align-items: center; gap: 7px; }
.key { width: 12px; height: 12px; border-radius: 2px; display: inline-block; flex: none; }
.trace .note { font-size: var(--step--1); color: var(--muted); margin: 10px 0 0 calc(5.5rem + 12px); max-width: 70ch; }

/* ---------- sections ---------- */

.section { padding: clamp(40px, 7vw, 80px) 0; border-top: 1px solid var(--rule); }
.section > .wrap > h2, .section-title {
  font-size: var(--step-3); line-height: 1.05; letter-spacing: -0.03em; font-weight: 800; margin: 0 0 12px;
}
.section .lede { color: var(--muted); max-width: 60ch; margin: 0 0 36px; }

/* case studies: a list, each entry sized to its content */
.work-list { list-style: none; margin: 0; padding: 0; }
.work-item {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 8px 48px;
  padding: 26px 0;
  border-top: 1px solid var(--rule);
}
.work-item:last-child { border-bottom: 1px solid var(--rule); }
.work-item h3 { font-size: var(--step-2); line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 8px; }
.work-item h3 a { color: var(--ink); text-decoration: none; }
.work-item h3 a:hover { color: var(--accent); text-decoration: underline; text-decoration-thickness: 2px; }
.work-item p { margin: 0; max-width: 58ch; }
.work-item .outcome { font-weight: 600; }
.work-item .stack { color: var(--muted); font-size: var(--step--1); margin-top: 10px; }
.status {
  display: inline-block; font-size: var(--step--1); font-weight: 600; padding: 1px 9px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); margin-bottom: 10px;
}

/* experience, skills, education */
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 48px; }
.role h3 { font-size: var(--step-1); margin: 0; }
.role .meta { color: var(--muted); margin: 2px 0 14px; }
.role ul, .plain-list { margin: 0; padding-left: 1.1em; }
.role li, .plain-list li { margin: 0 0 8px; }
/* Experience spans the full width now that nothing sits beside it, so its lines need their own
   reading measure. The two-column blocks below are already narrow enough to not need one. */
#experience .role li { max-width: var(--measure); }

.skills dt { font-weight: 700; margin-top: 18px; }
.skills dt:first-child { margin-top: 0; }
.skills dd { margin: 4px 0 0; color: var(--ink); }
.skills .aside { color: var(--muted); font-size: var(--step--1); }

.contact { font-size: var(--step-1); }
.contact p { max-width: 50ch; }

footer { padding: 36px 0 56px; color: var(--muted); font-size: var(--step--1); border-top: 1px solid var(--rule); }

/* ---------- case study pages ---------- */

.case-hero { padding: clamp(28px, 6vw, 72px) 0 32px; }
.case-hero h1 { font-size: var(--step-3); line-height: 1.05; letter-spacing: -0.03em; font-weight: 800; margin: 0 0 16px; max-width: 22ch; }
.case-hero .summary { font-size: var(--step-1); line-height: 1.45; max-width: 52ch; margin: 0; }

.facts { display: flex; flex-wrap: wrap; gap: 14px 40px; margin: 28px 0 0; padding: 18px 0 0; border-top: 2px solid var(--ink); }
.facts div { min-width: 9rem; }
.facts dt { color: var(--muted); font-size: var(--step--1); }
.facts dd { margin: 2px 0 0; font-weight: 700; }

.prose { padding-bottom: 24px; }
.prose > :not(.figure):not(.next) { max-width: var(--measure); }
.prose h2 { font-size: var(--step-2); letter-spacing: -0.02em; line-height: 1.2; margin: 48px 0 12px; }
.prose h3 { font-size: var(--step-1); margin: 32px 0 8px; }
.prose p, .prose li { margin: 0 0 14px; }
.prose ul, .prose ol { padding-left: 1.2em; }
.prose strong { font-weight: 700; }
/* Accent, not --wait: the waiting grey is deliberately quiet and would vanish as a 3px rule. */
.prose .aside {
  border-left: 3px solid var(--accent); padding: 4px 0 4px 16px; color: var(--muted); margin: 24px 0;
}

.prose code, .prose pre { font-family: var(--code); font-size: 0.9em; }
.prose :not(pre) > code { background: var(--track); padding: 1px 5px; border-radius: 3px; }
.prose pre {
  background: var(--surface); border: 1px solid var(--rule); border-radius: 6px;
  padding: 16px 18px; overflow-x: auto; line-height: 1.5; margin: 0 0 18px;
}
/* Good is green, not the accent. The accent is red now, so marking both the right and the
   wrong line in it would make a before/after code sample unreadable. */
.prose pre .bad { color: var(--danger); }
.prose pre .good { color: var(--good); }

.prose table { border-collapse: collapse; width: 100%; margin: 8px 0 22px; font-size: var(--step--1); }
.table-scroll { overflow-x: auto; }
.prose th, .prose td { text-align: left; padding: 8px 12px 8px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.prose th { font-weight: 700; border-bottom: 2px solid var(--ink); }
.prose td.num, .prose th.num { text-align: right; white-space: nowrap; }

.figure { margin: 28px 0 32px; max-width: var(--wide); }
.figure .scroll { overflow-x: auto; }
.figure svg { width: 100%; min-width: 720px; height: auto; display: block; }
.figure figcaption { color: var(--muted); font-size: var(--step--1); margin-top: 10px; max-width: 70ch; }
.diagram .box { fill: var(--surface); stroke: var(--ink); stroke-width: 1.5; }
.diagram .box-accent { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1.5; }
.diagram .label { fill: var(--ink); font-family: var(--font); font-size: 15px; font-weight: 700; }
.diagram .sub { fill: var(--muted); font-family: var(--font); font-size: 13px; }
.diagram .line { stroke: var(--ink); stroke-width: 1.5; fill: none; }
.diagram .line-wait { stroke: var(--wait); stroke-width: 2; fill: none; stroke-dasharray: 6 5; }
.diagram .arrowhead { fill: var(--ink); }
.diagram .arrowhead-wait { fill: var(--wait); }
.diagram .group { fill: none; stroke: var(--rule); stroke-width: 1.5; stroke-dasharray: 3 4; }

.next { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; padding: 32px 0 8px; border-top: 1px solid var(--rule); margin-top: 32px; }
.next a { font-weight: 600; }

/* ---------- responsive ---------- */

@media (max-width: 760px) {
  .work-item, .two-col { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .two-col { gap: 40px; }
  .span-row { grid-template-columns: 3.4rem 1fr 4.2rem; gap: 8px; }
  .legend, .trace .note { margin-left: 0; }
  .trace-head .result { white-space: normal; }
}

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

@media print {
  .bar nav, .skip, .button { display: none; }
  body { background: #fff; }
  .spans { animation: none; }
}
