/* ==========================================================================
   kushpal.github.io — design system
   ========================================================================== */

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

:root {
  color-scheme: light dark;

  --bg:          #fbfaf8;
  --bg-elev:     #ffffff;
  --surface:     #f2efea;
  --text:        #14171c;
  --text-muted:  #5c6472;
  --text-faint:  #8a919d;
  --border:      #e5e1da;
  --border-firm: #d4cfc6;
  --accent:      #0f766e;
  --accent-text: #0b5f58;
  --accent-soft: rgba(15, 118, 110, 0.09);
  --shadow-sm:   0 1px 2px rgba(20, 23, 28, 0.05);
  --shadow-md:   0 6px 24px -8px rgba(20, 23, 28, 0.16);

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --measure: 68ch;
  --wrap: 1080px;
  --radius: 12px;
  --radius-lg: 18px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:          #0c0e11;
    --bg-elev:     #13161b;
    --surface:     #171b21;
    --text:        #e9ebee;
    --text-muted:  #9aa2af;
    --text-faint:  #6f7783;
    --border:      #242a32;
    --border-firm: #333a44;
    --accent:      #2dd4bf;
    --accent-text: #5eead4;
    --accent-soft: rgba(45, 212, 191, 0.11);
    --shadow-sm:   0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md:   0 8px 28px -10px rgba(0, 0, 0, 0.7);
  }
}

:root[data-theme="dark"] {
  --bg:          #0c0e11;
  --bg-elev:     #13161b;
  --surface:     #171b21;
  --text:        #e9ebee;
  --text-muted:  #9aa2af;
  --text-faint:  #6f7783;
  --border:      #242a32;
  --border-firm: #333a44;
  --accent:      #2dd4bf;
  --accent-text: #5eead4;
  --accent-soft: rgba(45, 212, 191, 0.11);
  --shadow-sm:   0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md:   0 8px 28px -10px rgba(0, 0, 0, 0.7);
}

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

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

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

h1, h2, h3, h4 {
  margin: 0 0 0.5em;
  line-height: 1.2;
  font-weight: 650;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

h1 { font-size: clamp(2rem, 1.3rem + 3vw, 3.15rem); letter-spacing: -0.035em; }
h2 { font-size: clamp(1.4rem, 1.15rem + 1.1vw, 1.85rem); }
h3 { font-size: 1.075rem; letter-spacing: -0.01em; }

p, ul, ol { margin: 0 0 1rem; }
p { max-width: var(--measure); text-wrap: pretty; }

a {
  color: var(--accent-text);
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
  text-underline-offset: 0.18em;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}
a:hover { text-decoration-color: currentColor; }

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

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 3rem 0;
}

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

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: clamp(1.15rem, 4vw, 2rem);
}

.section { padding-block: clamp(3rem, 7vw, 5.5rem); }
.section--tight { padding-block: clamp(2rem, 4vw, 3rem); }
.section + .section { padding-top: 0; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}
.section-head h2 { margin: 0; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-text);
  margin: 0 0 0.9rem;
}

.lede {
  font-size: clamp(1.05rem, 0.98rem + 0.35vw, 1.2rem);
  color: var(--text-muted);
  max-width: 60ch;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--accent);
  color: #fff;
  padding: 0.6rem 1rem;
  border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 62px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 650;
  font-size: 0.98rem;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
  margin-right: auto;
}
.brand svg { width: 26px; height: 26px; flex: none; }
.brand span { white-space: nowrap; }
.brand em {
  font-style: normal;
  color: var(--text-faint);
  font-weight: 450;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-links a {
  display: block;
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease, background-color 0.15s ease;
}
.nav-links a:hover { color: var(--text); background: var(--surface); }
.nav-links a[aria-current="page"] { color: var(--text); background: var(--accent-soft); }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}
.icon-btn:hover { color: var(--text); background: var(--surface); border-color: var(--border-firm); }
.icon-btn svg { width: 17px; height: 17px; }

.nav-toggle { display: none; }
.theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .moon { display: block; }
}

@media (max-width: 720px) {
  .nav-toggle { display: inline-grid; }
  .nav-links {
    position: absolute;
    inset: 100% 0 auto;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0.5rem clamp(1.15rem, 4vw, 2rem) 1rem;
    background: var(--bg-elev);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-md);
  }
  .nav-links[hidden] { display: none; }
  .nav-links a { padding: 0.7rem 0.75rem; font-size: 0.95rem; }
}

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

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.62rem 1.1rem;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 550;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 15px; height: 15px; flex: none; }

.btn--primary {
  background: var(--accent);
  color: #fff;
}
:root[data-theme="dark"] .btn--primary,
:root:not([data-theme="light"]) .btn--primary { color: #06211f; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .btn--primary { color: #fff; }
}
.btn--primary:hover { background: color-mix(in srgb, var(--accent) 86%, #000); }

.btn--ghost {
  background: transparent;
  border-color: var(--border-firm);
  color: var(--text);
}
.btn--ghost:hover { background: var(--surface); }

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1.75rem;
}

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

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
  padding-block: clamp(3rem, 8vw, 6rem);
}
.hero h1 { margin-bottom: 0.6rem; }
.hero .role {
  font-size: 1.05rem;
  color: var(--text);
  font-weight: 550;
  margin-bottom: 0.85rem;
}
.hero .role .at { color: var(--text-faint); font-weight: 400; }

.portrait {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  aspect-ratio: 4 / 5;
}
.portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 22%;
}

@media (max-width: 800px) {
  .hero { grid-template-columns: 1fr; gap: 2rem; }
  .portrait { max-width: 240px; aspect-ratio: 1; border-radius: var(--radius); }
}

/* --- Stat strip ----------------------------------------------------------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.stats > div {
  background: var(--bg-elev);
  padding: 1.15rem 1.25rem;
}
.stats dt {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 0.3rem;
}
.stats dd {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.015em;
}
.stats dd small { display: block; font-size: 0.8rem; font-weight: 400; color: var(--text-muted); letter-spacing: 0; }

/* --- Cards ---------------------------------------------------------------- */

.grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr));
}
.grid--two { grid-template-columns: repeat(auto-fill, minmax(min(100%, 400px), 1fr)); }

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}
.card:hover {
  border-color: var(--border-firm);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.card__media {
  aspect-ratio: 16 / 9;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}
.card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.card:hover .card__media img { transform: scale(1.03); }

/* Drawn cover art in place of a photograph. */
.card__media--art {
  display: grid;
  place-items: stretch;
  background:
    radial-gradient(130% 130% at 12% -10%, var(--accent-soft), transparent 62%),
    var(--surface);
}
.card__media--art svg {
  width: 100%;
  height: 100%;
  color: var(--accent);
  transition: transform 0.45s cubic-bezier(0.2, 0.7, 0.3, 1);
}
.card:hover .card__media--art svg { transform: scale(1.035); }
.art-line { stroke: currentColor; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.art-fill { fill: currentColor; }
.art-rule { stroke: var(--text-faint); fill: none; opacity: 0.42; }
.art-track { fill: var(--border-firm); opacity: 0.55; }

.card__body {
  padding: 1.15rem 1.25rem 1.35rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.card__body h3 { margin-bottom: 0.4rem; }
.card__body p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0 0 1rem;
  max-width: none;
}
.card__body .tags { margin-top: auto; }

/* Whole-card link: title anchor stretches over the card. */
.card a.stretch { text-decoration: none; color: inherit; }
.card a.stretch::after { content: ""; position: absolute; inset: 0; }
.card a.stretch:hover { color: var(--accent-text); }

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.03em;
  padding: 0.2rem 0.5rem;
  border-radius: 5px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  white-space: nowrap;
}
.tag--accent {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 28%, transparent);
  color: var(--accent-text);
}

/* --- Timeline (experience / education) ------------------------------------ */

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

.timeline > li {
  position: relative;
  padding: 0 0 2.25rem 1.75rem;
  border-left: 1px solid var(--border);
}
.timeline > li:last-child { padding-bottom: 0; border-left-color: transparent; }
.timeline > li::before {
  content: "";
  position: absolute;
  left: -4.5px;
  top: 0.55rem;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--border-firm);
}
.timeline > li.is-current::before {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.timeline h3 { margin-bottom: 0.15rem; font-size: 1.05rem; }
.timeline .org { font-weight: 550; color: var(--text); }
.timeline .meta {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--text-faint);
  margin: 0 0 0.7rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.8rem;
}
.timeline ul {
  list-style: none;
  margin: 0.6rem 0 0;
  padding: 0;
}
.timeline ul li {
  position: relative;
  padding-left: 1.1rem;
  font-size: 0.92rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  max-width: var(--measure);
}
.timeline ul li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.68em;
  width: 5px;
  height: 1px;
  background: var(--border-firm);
}

/* --- Skills / definition rows --------------------------------------------- */

.rows {
  border-top: 1px solid var(--border);
  margin: 0;
}
.rows > div {
  display: grid;
  grid-template-columns: minmax(120px, 200px) 1fr;
  gap: 0.5rem 1.5rem;
  padding: 0.95rem 0;
  border-bottom: 1px solid var(--border);
}
.rows dt {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding-top: 0.2rem;
}
.rows dd { margin: 0; }
@media (max-width: 620px) {
  .rows > div { grid-template-columns: 1fr; gap: 0.4rem; }
}

/* --- Press ---------------------------------------------------------------- */

.press {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.press a {
  display: inline-block;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elev);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}
.press a:hover {
  color: var(--accent-text);
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
  background: var(--accent-soft);
}

/* --- Callout / note ------------------------------------------------------- */

.note {
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--bg-elev);
  padding: 1.15rem 1.35rem;
}
.note p:last-child { margin-bottom: 0; }

/* --- Footer --------------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--border);
  margin-top: clamp(3rem, 8vw, 6rem);
  padding-block: 2.5rem;
  background: var(--bg-elev);
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  align-items: center;
  justify-content: space-between;
}
.footer-inner p { margin: 0; font-size: 0.85rem; color: var(--text-faint); }

.social {
  display: flex;
  gap: 0.4rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.social a {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text-muted);
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}
.social a:hover {
  color: var(--accent-text);
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
  background: var(--accent-soft);
}
.social svg { width: 17px; height: 17px; }

/* --- Utilities ------------------------------------------------------------ */

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.center { text-align: center; }
.center p { margin-inline: auto; }
.stack > * + * { margin-top: 1rem; }

/* --- Contact line (résumé header) ----------------------------------------- */

.contact-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.4rem;
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 0;
  font-size: 0.88rem;
}
.contact-row li {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text-muted);
}
.contact-row svg { width: 15px; height: 15px; flex: none; color: var(--accent); }
.contact-row a { color: var(--text-muted); text-decoration-color: var(--border-firm); }
.contact-row a:hover { color: var(--accent-text); }

/* --- Print ---------------------------------------------------------------- */

@media print {
  /* !important, because the dark-theme blocks below :root out-specify a plain
     :root selector here. Custom properties do honour it. */
  :root {
    --bg: #fff !important;
    --bg-elev: #fff !important;
    --surface: #fff !important;
    --text: #111 !important;
    --text-muted: #333 !important;
    --text-faint: #555 !important;
    --border: #ccc !important;
    --border-firm: #999 !important;
    --accent: #0f766e !important;
    --accent-text: #0f766e !important;
    --accent-soft: transparent !important;
    --shadow-sm: none !important;
    --shadow-md: none !important;
  }

  .site-header,
  .site-footer,
  .skip-link,
  .no-print { display: none !important; }

  body { font-size: 10pt; line-height: 1.45; }
  .wrap { max-width: none; padding-inline: 0; }
  .section { padding-block: 0 0.75rem; }
  .section + .section { padding-top: 0; }
  .section-head { margin-bottom: 0.75rem; }

  h1 { font-size: 20pt; }
  h2 { font-size: 12pt; }
  h3 { font-size: 10.5pt; }
  p { max-width: none; }

  .timeline > li { break-inside: avoid; padding-bottom: 0.9rem; }
  .timeline > li::before { box-shadow: none; }
  .rows > div { break-inside: avoid; padding-block: 0.4rem; }
  .card, .note, .stats { break-inside: avoid; box-shadow: none; }

  a { text-decoration: none; color: inherit; }
  .contact-row { margin-bottom: 1rem; }
}
