/*
 * singhlabs site styles.
 * Light mode is a "print": Prussian-blue ink on white paper.
 * Dark mode is the cyanotype itself: white lines on a deep blue field.
 * One typeface (Archivo); its width axis is the expressive element.
 */

/* Tokens */

:root {
  --paper: #f7f9fc;
  --ink: #12307a;
  --ink-soft: #4a5f99;
  --rule: #c9d5ee;
  --focus: #12307a;
  --selection: #d6e1f7;

  --measure: 64ch;
  --page: 70rem;
  --gutter: clamp(1rem, 4vw, 3rem);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #173a8c;
    --ink: #f4f7ff;
    --ink-soft: #bccbef;
    --rule: rgba(244, 247, 255, 0.26);
    --focus: #f5d547;
    --selection: #2c55b5;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --paper: #173a8c;
  --ink: #f4f7ff;
  --ink-soft: #bccbef;
  --rule: rgba(244, 247, 255, 0.26);
  --focus: #f5d547;
  --selection: #2c55b5;
  color-scheme: dark;
}

/* Base */

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Archivo", system-ui, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.55;
  font-variation-settings: "wdth" 100;
}

::selection {
  background: var(--selection);
}

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

a:hover {
  text-decoration-thickness: 2px;
}

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

.page {
  max-width: var(--page);
  margin: 0 auto;
  padding: clamp(2.5rem, 8vw, 6rem) var(--gutter) 3rem;
}

/* Hero */

.wordmark {
  margin: 0;
  font-size: clamp(2.6rem, 12.4vw, 9.75rem);
  font-weight: 800;
  line-height: 0.9;
  letter-spacing: -0.01em;
  font-variation-settings: "wdth" 125;
  animation: widen 1100ms cubic-bezier(0.2, 0.7, 0.1, 1) 120ms both;
}

@keyframes widen {
  from {
    font-variation-settings: "wdth" 62;
    letter-spacing: 0.02em;
  }
  to {
    font-variation-settings: "wdth" 125;
    letter-spacing: -0.01em;
  }
}

.lede {
  max-width: 22ch;
  margin: clamp(1.5rem, 4vw, 2.5rem) 0 0;
  font-size: clamp(1.6rem, 4.2vw, 2.75rem);
  font-weight: 500;
  line-height: 1.12;
  font-variation-settings: "wdth" 100;
}

.intro {
  max-width: var(--measure);
  margin: 1.25rem 0 0;
  color: var(--ink-soft);
}

/* Projects */

.projects {
  margin-top: clamp(3.5rem, 9vw, 6rem);
}

.projects h2,
.contact h2 {
  margin: 0 0 1rem;
  font-size: 1.0625rem;
  font-weight: 600;
  font-variation-settings: "wdth" 100;
}

.index {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 2px solid var(--ink);
}

.index li,
.index-head {
  display: grid;
  grid-template-columns: minmax(11rem, 1.1fr) minmax(0, 2.4fr) 7rem 6.5rem;
  gap: 1.5rem;
  align-items: baseline;
}

.index-head {
  padding: 0.6rem 0;
  color: var(--ink-soft);
  font-size: 0.875rem;
  font-variation-settings: "wdth" 87;
}

.index li {
  padding: 1.1rem 0;
  border-top: 1px solid var(--rule);
}

.index-head + .index li:first-child {
  border-top: 0;
}

.project-name {
  font-weight: 650;
  font-variation-settings: "wdth" 87;
  overflow-wrap: anywhere;
}

.project-what {
  max-width: 46ch;
}

.project-lang,
.project-updated {
  color: var(--ink-soft);
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
  font-variation-settings: "wdth" 87;
}

/* Contact */

.contact {
  margin-top: clamp(3.5rem, 9vw, 6rem);
  max-width: var(--measure);
}

.contact p {
  margin: 0;
}

.email {
  display: inline-block;
  margin-top: 0.75rem;
  font-size: clamp(1.35rem, 5.4vw, 2.5rem);
  font-weight: 600;
  line-height: 1.15;
  font-variation-settings: "wdth" 112;
  overflow-wrap: anywhere;
}

.elsewhere {
  margin-top: 1.5rem;
  color: var(--ink-soft);
}

/* Footer */

.footer {
  margin-top: clamp(4rem, 10vw, 7rem);
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  color: var(--ink-soft);
  font-size: 0.875rem;
}

/* Small screens: each project stacks into name, description, meta */

@media (max-width: 44rem) {
  .index-head {
    display: none;
  }

  .index li {
    grid-template-columns: 1fr auto;
    gap: 0.25rem 1rem;
  }

  .project-name {
    grid-column: 1;
  }

  .project-updated {
    grid-column: 2;
    grid-row: 1;
  }

  .project-what {
    grid-column: 1 / -1;
  }

  .project-lang {
    grid-column: 1 / -1;
  }
}

/* Reduced motion: show the final wordmark without the widening */

@media (prefers-reduced-motion: reduce) {
  .wordmark {
    animation: none;
  }
}
