/* animas.city · black on white, monochrome, no external assets */

:root {
  --bg: #ffffff;
  --fg: #111111;
  --muted: #6b6b6b;
  --faint: #9a9a9a;
  --border: #e6e6e6;
  --border-dark: #c9c9c9;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas,
    "Liberation Mono", monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
}

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

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

svg.i {
  width: 1em;
  height: 1em;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  vertical-align: -0.125em;
  flex-shrink: 0;
}

svg.i.fill {
  fill: currentColor;
  stroke: none;
}

::selection {
  background: #111111;
  color: #ffffff;
}

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

/* ---- entrance animation (staggered via --d) ---- */

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.r {
  animation: rise 0.65s var(--ease) both;
  animation-delay: calc(var(--d, 0) * 75ms);
}

/* scroll-driven reveal on long pages (progressive enhancement) */
@supports (animation-timeline: view()) {
  body.article main > * {
    animation: rise 1ms linear both;
    animation-timeline: view();
    animation-range: entry 0% entry 60%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .r,
  body.article main > * {
    animation: none !important;
  }
  * {
    transition-duration: 0.01ms !important;
  }
}

/* ---- layout ---- */

.page {
  max-width: 42rem;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ---- engineering-grid backdrop ---- */

.bg-grid {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(17, 17, 17, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(17, 17, 17, 0.045) 1px, transparent 1px);
  background-size: 28px 28px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 42%, #000 30%, transparent 75%);
  mask-image: radial-gradient(ellipse 70% 60% at 50% 42%, #000 30%, transparent 75%);
}

/* ---- header ---- */

header.site {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 2.25rem 0 0;
  font-family: var(--mono);
  font-size: 0.8125rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

header.site a {
  color: var(--fg);
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0% 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size 0.25s var(--ease);
  padding-bottom: 0.2em;
}

header.site a:hover,
header.site a[aria-current] {
  background-size: 100% 1px;
}

header.site nav {
  display: flex;
  gap: 1.4rem;
}

header.site nav a {
  color: var(--muted);
}

header.site nav a:hover,
header.site nav a[aria-current] {
  color: var(--fg);
}

/* ---- typography ---- */

h1 {
  margin: 3.25rem 0 1.25rem;
  font-size: clamp(1.9rem, 5.5vw, 2.6rem);
  font-weight: 650;
  letter-spacing: -0.022em;
  line-height: 1.12;
}

h2 {
  margin: 3rem 0 0.9rem;
  font-family: var(--mono);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

h2::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

p {
  margin: 0 0 1.2rem;
}

.lede {
  font-size: 1.1875rem;
  line-height: 1.65;
}

a {
  color: var(--fg);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  text-decoration-color: var(--faint);
  transition: text-decoration-color 0.2s ease;
}

a:hover {
  text-decoration-color: var(--fg);
}

strong {
  font-weight: 600;
}

ul, ol {
  margin: 0 0 1.2rem;
  padding-left: 1.25rem;
}

li {
  margin-bottom: 0.5rem;
}

/* ---- home: business card ---- */

body.home {
  display: flex;
  flex-direction: column;
  min-height: 100svh;
}

.card {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 1.5rem 2rem;
}

.card .loc {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 1.1rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.card h1 {
  margin: 0;
  font-size: clamp(2.6rem, 9vw, 4.25rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.02;
}

.card .co {
  display: inline-flex;
  align-items: center;
  gap: 0.9rem;
  margin: 1.3rem 0 0;
  font-family: var(--mono);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--fg);
}

.card .co::before,
.card .co::after {
  content: "";
  width: 2.2rem;
  height: 1px;
  background: var(--border-dark);
}

.card .role {
  margin: 0.9rem 0 0;
  font-size: clamp(1.05rem, 2.5vw, 1.25rem);
  color: var(--fg);
}

.card .tape {
  margin: 1.4rem 0 0;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
}

.card .tape b {
  color: var(--muted);
  font-weight: 500;
}

.links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  margin-top: 2.4rem;
}

.links a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.05rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 0.8125rem;
  letter-spacing: 0.04em;
  text-decoration: none;
  color: var(--fg);
  background: var(--bg);
  transition: border-color 0.25s var(--ease), transform 0.25s var(--ease),
    box-shadow 0.25s var(--ease);
}

.links a svg.i {
  transition: transform 0.25s var(--ease);
  color: var(--muted);
}

.links a:hover {
  border-color: var(--fg);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px -8px rgba(17, 17, 17, 0.25);
}

.links a:hover svg.i {
  transform: translateX(3px);
  color: var(--fg);
}

.links a:hover svg.i.up {
  transform: translate(2px, -2px);
}

.links a.primary {
  background: var(--fg);
  border-color: var(--fg);
  color: var(--bg);
}

.links a.primary svg.i {
  color: var(--bg);
}

.card-foot {
  padding: 1.5rem;
  text-align: center;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}

/* ---- metrics grid ---- */

.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 2.5rem 0;
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
}

.metrics > div {
  padding: 1.1rem 1.2rem 1rem;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  transition: background 0.25s ease;
}

.metrics > div:hover {
  background: #fafafa;
}

.metrics .value {
  display: block;
  font-size: 1.6rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.metrics .label {
  display: block;
  margin-top: 0.3rem;
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.5;
}

@media (max-width: 560px) {
  .metrics {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ---- case study cards (/work/) ---- */

.cards {
  display: grid;
  gap: 1rem;
  margin: 2.25rem 0 0;
}

.cards a {
  position: relative;
  display: block;
  padding: 1.5rem 1.6rem 1.4rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  transition: border-color 0.3s var(--ease), transform 0.3s var(--ease),
    box-shadow 0.3s var(--ease);
}

.cards a:hover {
  border-color: var(--border-dark);
  transform: translateY(-3px);
  box-shadow: 0 14px 30px -18px rgba(17, 17, 17, 0.3);
}

.cards .top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.9rem;
}

.cards .ic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.6rem;
  height: 2.6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1.2rem;
  color: var(--fg);
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease);
}

.cards a:hover .ic {
  transform: translateY(-2px);
  border-color: var(--border-dark);
}

.cards .meta {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--faint);
}

.cards .t {
  display: block;
  font-size: 1.25rem;
  font-weight: 650;
  letter-spacing: -0.015em;
  line-height: 1.3;
}

.cards .d {
  display: block;
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.9375rem;
  line-height: 1.6;
}

.cards .go {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 1rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.25s ease;
}

.cards .go svg.i {
  transition: transform 0.3s var(--ease);
}

.cards a:hover .go {
  color: var(--fg);
}

.cards a:hover .go svg.i {
  transform: translateX(4px);
}

/* ---- article pages ---- */

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin: 3.25rem 0 0;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.kicker svg.i {
  font-size: 1.05rem;
}

.kicker + h1 {
  margin-top: 0.9rem;
}

/* facts table */

.facts {
  margin: 2rem 0;
  border-top: 1px solid var(--border);
}

.facts div {
  display: grid;
  grid-template-columns: 11rem 1fr;
  gap: 1rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9375rem;
}

.facts dt {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  padding-top: 0.2rem;
}

.facts dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 560px) {
  .facts div {
    grid-template-columns: 1fr;
    gap: 0.1rem;
  }
}

/* pipeline stages */

.stages {
  margin: 2rem 0;
  padding: 0;
  list-style: none;
  counter-reset: stage;
  border-top: 1px solid var(--border);
}

.stages li {
  counter-increment: stage;
  display: grid;
  grid-template-columns: 2.5rem 1fr;
  gap: 1rem;
  padding: 1.1rem 0;
  margin: 0;
  border-bottom: 1px solid var(--border);
}

.stages li::before {
  content: counter(stage, decimal-leading-zero);
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--faint);
  padding-top: 0.25rem;
}

.stages .stage-name {
  font-weight: 600;
}

.stages p {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.9375rem;
  line-height: 1.6;
}

/* prev / next */

.next {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.9375rem;
}

.next .k {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}

/* ---- footer ---- */

footer.site {
  margin-top: 4.5rem;
  padding: 1.75rem 0 2.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--faint);
}

footer.site a {
  color: var(--muted);
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0% 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size 0.25s var(--ease);
  padding-bottom: 0.15em;
}

footer.site a:hover {
  background-size: 100% 1px;
}

/* ---- mobile refinements ---- */

/* Never let a wide token (long word, URL, code) force horizontal scroll. */
body {
  overflow-wrap: break-word;
}

@media (max-width: 640px) {
  body {
    font-size: 1rem;
    line-height: 1.65;
  }

  .page {
    padding: 0 1.15rem;
  }

  /* Header: keep name and nav on one row, but let them wrap gracefully
     and tighten the spacing so short screens aren't dominated by chrome. */
  header.site {
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    padding-top: 1.75rem;
  }

  header.site nav {
    gap: 1.1rem;
  }

  h1 {
    margin: 2.25rem 0 1rem;
  }

  h2 {
    margin: 2.4rem 0 0.8rem;
  }

  .lede {
    font-size: 1.125rem;
  }

  /* Home business card */
  .card {
    padding: 2.5rem 1.25rem 1.75rem;
  }

  .card .co {
    gap: 0.6rem;
    letter-spacing: 0.16em;
  }

  .card .co::before,
  .card .co::after {
    width: 1.4rem;
  }

  .links {
    gap: 0.5rem;
    margin-top: 2rem;
  }

  /* Comfortable tap targets on the pill links (>=44px tall). */
  .links a {
    padding: 0.7rem 1.1rem;
  }

  .cards a {
    padding: 1.3rem 1.3rem 1.2rem;
  }

  footer.site {
    margin-top: 3.25rem;
    padding: 1.5rem 0 2.25rem;
  }
}

/* Very narrow phones: stack the home CTAs full-width so they never crowd. */
@media (max-width: 400px) {
  .card .co::before,
  .card .co::after {
    display: none;
  }

  .links {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    max-width: 20rem;
  }

  .links a {
    justify-content: center;
  }
}
