/* Homepage only. App pages keep their own stylesheets; Prosper still uses styles.css. */

:root {
  --paper: #ffffff;
  --ink: #161616;
  --muted: #6b6b6b;
  --rule: rgba(0, 0, 0, 0.09);
  --tile: #f6f6f5;
  --serif: "Newsreader", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --column: 880px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0e0e0e;
    --ink: #ededed;
    --muted: #9a9a9a;
    --rule: rgba(255, 255, 255, 0.1);
    --tile: #181818;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 19px/1.55 var(--serif);
  -webkit-font-smoothing: antialiased;
  /* The full-bleed section rules use 100vw, which includes the scrollbar. */
  overflow-x: clip;
}

a { color: inherit; }

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

:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  padding: 8px 12px;
  background: var(--ink);
  color: var(--paper);
  font: 500 13px var(--mono);
  z-index: 10;
}
.skip-link:focus { top: 16px; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* The ruled column: two hairlines run the full height, like a notebook margin. */
.page {
  max-width: var(--column);
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
}

/* Column rules as pseudo-elements so they can draw in on load. */
.page::before,
.page::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--rule);
  transform-origin: top;
  pointer-events: none;
}
.page::before { left: 0; }
.page::after { right: 0; }

.masthead {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

/* Same treatment as the big portrait: photo multiplied onto yellow. */
.brand-photo {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  background: #f5d88d;
  isolation: isolate;
}

.brand-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  mix-blend-mode: multiply;
  transform: scale(1.3) translateY(8%);
}

.brand-text { display: grid; line-height: 1.15; }
.brand-name { font-size: 17px; }
.brand-role { color: var(--muted); }

.nav { display: flex; align-items: center; gap: 4px; }

.nav a {
  padding: 7px 12px;
  border-radius: 99px;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 160ms ease, color 160ms ease;
}

.nav a:hover { background: var(--tile); color: var(--ink); }

.nav .nav-cta {
  margin-left: 6px;
  background: var(--ink);
  color: var(--paper);
}

.nav .nav-cta:hover { background: #c8326f; color: #fff4f8; }

.brand-role,
.nav a,
.section-label,
.facts dt,
.tile-kicker,
.tile-link,
.tile-meta,
.log-date,
.colophon {
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.01em;
}

.brand-role { font-size: 11px; }

/* Full-bleed rules between sections run past the column edges. */
.section,
.intro {
  position: relative;
  padding: 40px 24px 48px;
}

.section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 100vw;
  translate: -50% 0;
  border-top: 1px solid var(--rule);
}

.section-label {
  margin: 0 0 24px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
}

.intro { padding-top: 64px; }

.intro-head {
  display: grid;
  grid-template-columns: 1fr 320px;
  align-items: center;
  gap: 32px;
}

/* The photo has a white background, so inside the circle it is multiplied onto
   a flat colour: the white turns yellow and the photo itself is untouched. */
.portrait {
  position: relative;
  margin: 0;
  aspect-ratio: 1;
}

.portrait-disc {
  position: absolute;
  inset: 13%;
  border-radius: 50%;
  overflow: hidden;
  background: #f5d88d;
  isolation: isolate;
}

.portrait-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  mix-blend-mode: multiply;
  transform: scale(1.22) translateY(6%);
}

/* The ring runs in the gap outside the circle, so it never crosses the face. */
.portrait-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  fill: var(--muted);
  font: 500 6.4px var(--mono);
  text-transform: uppercase;
  pointer-events: none;
}

h1 {
  margin: 0;
  font-size: clamp(44px, 7vw, 64px);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.02em;
}

.lede {
  margin: 10px 0 0;
  max-width: 34ch;
  font-size: 21px;
  color: var(--muted);
}

.facts {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  margin: 40px 0 0;
  border-top: 1px dashed var(--rule);
}

.facts div {
  display: flex;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--rule);
  font-size: 16px;
}

/* The role row spans both columns, so later rows alternate from the second child. */
.facts .fact-wide { grid-column: 1 / -1; }
.facts div:nth-child(even) { padding-right: 16px; }
.facts div:nth-child(odd):not(.fact-wide) { padding-left: 16px; border-left: 1px dashed var(--rule); }
.fact-note { color: var(--muted); white-space: nowrap; }

.facts dt { width: 52px; flex: none; padding-top: 3px; color: var(--muted); }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* Tiles: each app wears its own colours, the rest stay on paper. */
.tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: minmax(210px, auto);
  grid-auto-flow: dense;
  gap: 10px;
}

.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  border-radius: 18px;
  background: var(--tile);
  border: 1px solid var(--rule);
  overflow: hidden;
  text-decoration: none;
}

.tile-kicker,
.tile-meta { opacity: 0.7; }

.tile-big {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.tile-link {
  margin-top: auto;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.tile-meta { margin-top: auto; }

.tile-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
}

.tile-feature {
  grid-column: span 2;
  grid-row: span 2;
  flex-direction: row;
  gap: 20px;
}

.tile-feature .tile-big { font-size: 30px; }

.tile-text {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.tile-feature .tile-screen {
  width: 46%;
  margin: 0 -8px -48px 0;
  align-self: flex-end;
  border-radius: 22px 22px 0 0;
  box-shadow: 0 10px 40px rgba(24, 19, 15, 0.16);
  transform: rotate(3deg);
}

/* Roseman builds privacy tech, so this tile shows the idea instead of a colour:
   parties send encrypted shares into one computation and only the result leaves. */
.tile-roseman {
  grid-row: span 2;
  background:
    radial-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1.2px) 0 0 / 14px 14px,
    #100d16;
  color: #f1edf6;
  border-color: var(--rule);
}

.roseman-head { display: flex; align-items: center; gap: 10px; }
.tile-roseman .tile-logo { width: 26px; height: 26px; }

.mpc {
  width: 100%;
  margin: 8px 0 4px;
  overflow: visible;
  font-family: var(--mono);
}

.mpc-edges path { stroke: rgba(241, 237, 246, 0.16); stroke-width: 1; fill: none; }

/* Without motion the trails are simply drawn; the motion layer turns them into a loop. */
.mpc-trail path { stroke: #ff5c9a; stroke-width: 1.5; stroke-linecap: round; fill: none; opacity: 0.55; }
.mpc-trail .mpc-out { stroke: #f1edf6; }
.mpc-orbit { fill: none; stroke: rgba(255, 92, 154, 0.45); stroke-dasharray: 3 5; transform-box: fill-box; transform-origin: center; }
.pk { opacity: 0; }
.pk circle:first-child { fill: rgba(255, 92, 154, 0.25); }
.pk circle:last-child { fill: #ff5c9a; }
.pk-out circle:first-child { fill: rgba(241, 237, 246, 0.25); }
.pk-out circle:last-child { fill: #f1edf6; }

.mpc-party rect { fill: #100d16; stroke: rgba(241, 237, 246, 0.35); }
.mpc-party text,
.mpc-result-label {
  fill: #f1edf6;
  font-size: 8.5px;
  letter-spacing: 0.06em;
  text-anchor: middle;
}

.mpc-result { fill: #f1edf6; transform-box: fill-box; transform-origin: center; }
.mpc-result-label { fill: #100d16; font-weight: 500; }

.mpc-core { fill: #c8326f; transform-box: fill-box; transform-origin: center; }
.mpc-core-label { fill: #fff; font-size: 10px; text-anchor: middle; }

.mpc-caption {
  margin: 0;
  color: rgba(241, 237, 246, 0.62);
  font: 12px/1.5 var(--mono);
}

.tile-roseman .tile-big { margin-top: auto; font-size: 26px; }

.tile-motivator { background: #ffe4d4; color: #2a1206; border-color: transparent; }
.tile-motivator .tile-link { color: #d9480f; }
.tile-beershelf {
  grid-column: span 2;
  flex-direction: row;
  background: #21170f;
  color: #f5e9d2;
  border-color: transparent;
}
.tile-beershelf .tile-big { color: #f0c56e; }

.tile-cert .tile-big { font-size: 24px; }

.tile-radar {
  grid-column: span 3;
  flex-direction: row;
  background: #16171b;
  color: #f2f2f6;
  border-color: transparent;
}

.tile-radar .tile-big { color: #bdc2ff; }

.tile-screens {
  display: flex;
  gap: 10px;
  width: 44%;
  margin-bottom: -60px;
}

.tile-screens img {
  width: 50%;
  border-radius: 14px;
  align-self: flex-start;
}

.tile-screens img:last-child { margin-top: 28px; }

.tile-huge {
  margin: auto 0 0;
  font-size: 84px;
  line-height: 0.9;
  letter-spacing: -0.04em;
}

.tile-huge span { font-size: 0.4em; color: var(--muted); letter-spacing: 0; }

.tile-news {
  grid-column: span 2;
  background: #f1eef6;
  color: #1a1622;
  border-color: transparent;
}

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

.news li {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid rgba(26, 22, 34, 0.12);
}

.news-date { padding-top: 3px; color: #c8326f; font: 500 12px var(--mono); }
.news a { font-size: 17px; line-height: 1.35; text-decoration: none; }
.news a:hover { text-decoration: underline; text-underline-offset: 3px; }


/* Projects that ended: same date column as the changelog, with an outcome tag. */
.tried { margin: 0; padding: 0; list-style: none; }

.tried li {
  display: grid;
  grid-template-columns: 170px 1fr auto;
  gap: 20px;
  padding: 16px 0;
  border-top: 1px dashed var(--rule);
}

.tried h3 { margin: 0; font-size: 22px; font-weight: 500; line-height: 1.2; }
.tried h3 a { text-decoration: none; }
.tried h3 a:hover { text-decoration: underline; text-underline-offset: 4px; }
.tried p { margin: 4px 0 0; max-width: 50ch; color: var(--muted); }

.tried-end {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  padding-top: 4px;
}

.tried-tag {
  padding: 3px 9px;
  border: 1px solid var(--rule);
  border-radius: 99px;
  color: var(--muted);
  font: 500 11.5px var(--mono);
  white-space: nowrap;
}

.spark { width: 69px; height: 40px; fill: #c8326f; }

/* One company block; the roles hang off a vertical rail so they read as one employer. */
.company {
  border: 1px solid var(--rule);
  border-radius: 18px;
  padding: 22px 22px 6px;
}

.company-head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 18px;
}

.company-head img { width: 48px; height: 48px; }

.company-head h3 { margin: 0; font-size: 26px; font-weight: 500; line-height: 1.1; }
.company-head h3 a { text-decoration: none; }
.company-head h3 a:hover { text-decoration: underline; text-underline-offset: 4px; }
.company-head p { margin: 2px 0 0; color: var(--muted); font-size: 16.5px; }

.company-count {
  margin-left: auto;
  flex: none;
  padding: 4px 10px;
  border: 1px solid var(--rule);
  border-radius: 99px;
  color: var(--muted);
  font: 500 12px var(--mono);
}

.log,
.rows {
  margin: 0;
  padding: 0;
  list-style: none;
}

.log { position: relative; margin-left: 23px; }

.log::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 24px;
  width: 1.5px;
  background: var(--rule);
  transform-origin: top;
}

.log li {
  position: relative;
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 20px;
  padding: 16px 0 16px 28px;
}

.log li::before {
  content: "";
  position: absolute;
  left: -4px;
  top: 25px;
  width: 9.5px;
  height: 9.5px;
  border-radius: 50%;
  background: var(--paper);
  border: 1.5px solid var(--muted);
}

.log-current::before { background: #c8326f !important; border-color: #c8326f !important; }

.rows li {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 20px;
  padding: 11px 0;
  border-top: 1px dashed var(--rule);
  font-size: 17px;
}

.rows strong { font-weight: 500; }

.log-date { padding-top: 5px; color: var(--muted); }

.log h4 {
  margin: 0;
  font-size: 22px;
  font-weight: 500;
  line-height: 1.2;
}

.log p { margin: 4px 0 0; max-width: 52ch; color: var(--muted); }

.log-current h4::after {
  content: "Now";
  margin-left: 10px;
  padding: 2px 8px;
  border-radius: 99px;
  background: #c8326f;
  color: #fff4f8;
  font: 500 11px var(--mono);
  vertical-align: 4px;
}

.about p { max-width: 58ch; margin: 0 0 16px; font-size: 21px; }

.footer-email {
  display: inline-block;
  font-size: clamp(26px, 5vw, 44px);
  letter-spacing: -0.02em;
  text-underline-offset: 6px;
  text-decoration-thickness: 1px;
  overflow-wrap: anywhere;
}

.footer-links { display: flex; gap: 20px; margin: 20px 0 0; font-size: 17px; }

.colophon { margin: 40px 0 0; color: var(--muted); }

@media (max-width: 720px) {
  body { font-size: 18px; }
  .masthead { padding: 10px 16px; }
  /* On phones the links become a floating tab bar at the bottom, like an iPhone app. */
  .page { padding-bottom: 72px; }
  .nav {
    position: fixed;
    left: 50%;
    bottom: max(14px, env(safe-area-inset-bottom));
    translate: -50% 0;
    z-index: 6;
    padding: 5px;
    border-radius: 99px;
    background: var(--ink);
    box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.45);
  }
  .nav a { padding: 9px 12px; color: var(--paper); opacity: 0.75; }
  .nav a:hover { background: transparent; color: var(--paper); opacity: 1; }
  .nav .nav-cta { margin-left: 2px; background: #c8326f; color: #fff4f8; opacity: 1; }
  .section, .intro { padding-inline: 16px; }
  .intro { padding-top: 32px; }
  .intro-head { grid-template-columns: 1fr; gap: 24px; }
  .portrait { order: -1; width: min(240px, 70%); margin-left: -8px; }
  .facts { grid-template-columns: 1fr; }
  .facts div:nth-child(n):not(.fact-wide) { padding-inline: 0; border-left: 0; }
  .tiles { grid-template-columns: 1fr; }
  .tile-feature, .tile-radar, .tile-news, .tile-beershelf, .tile-roseman { grid-column: auto; grid-row: auto; }
  .company { padding: 16px 16px 4px; }
  .company-head { flex-wrap: wrap; }
  .company-count { margin-left: 0; }
  .log { margin-left: 8px; }
  .log li { padding-left: 22px; }
  .tile-feature .tile-big { font-size: 26px; }
  .tile-feature .tile-screen { width: 42%; }
  .log li, .rows li { grid-template-columns: 1fr; gap: 4px; }
  .tried li { grid-template-columns: 1fr; gap: 6px; }
  .tried-end { flex-direction: row; align-items: center; justify-content: flex-start; padding-top: 4px; }
  .log li::before { top: 22px; }
  .log-date { padding-top: 0; }
}

/* Motion layer. Everything here is decoration; the page is complete without it. */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }

  @keyframes draw-down { from { transform: scaleY(0); } }
  @keyframes rise { from { opacity: 0; transform: translateY(18px); } }
  @keyframes spin { to { transform: rotate(360deg); } }
  @keyframes pulse {
    from { transform: scale(1); opacity: 0.55; }
    to { transform: scale(2.6); opacity: 0; }
  }

  .page::before,
  .page::after { animation: draw-down 1.1s cubic-bezier(0.65, 0, 0.35, 1) both; }

  /* Intro arrives in reading order. */
  .portrait,
  h1,
  .lede,
  .facts div { animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  h1 { animation-delay: 0.15s; }
  .lede { animation-delay: 0.25s; }
  .portrait { animation-delay: 0.3s; }
  .facts div:nth-child(1), .facts div:nth-child(2) { animation-delay: 0.45s; }
  .facts div:nth-child(3), .facts div:nth-child(4) { animation-delay: 0.52s; }
  .facts div:nth-child(5), .facts div:nth-child(6) { animation-delay: 0.59s; }

  /* One slow, constant turn; no speed changes on hover. */
  .portrait-ring { animation: spin 60s linear infinite; }


  /* Tiles: lift, then each app's artwork does its own small move. */
  .tile { transition: transform 260ms cubic-bezier(0.2, 0.7, 0.2, 1), box-shadow 260ms ease; }
  a.tile:hover { transform: translateY(-4px); box-shadow: 0 18px 40px -22px rgba(0, 0, 0, 0.35); }
  .tile-screen,
  .tile-screens img,
  .tile-icon { transition: transform 420ms cubic-bezier(0.2, 0.7, 0.2, 1); }
  .tile-feature:hover .tile-screen { transform: rotate(0deg) translateY(-14px); }
  .tile-radar:hover .tile-screens img:first-child { transform: rotate(-4deg) translate(-6px, -10px); }
  .tile-radar:hover .tile-screens img:last-child { transform: rotate(4deg) translate(6px, -18px); }
  a.tile:hover .tile-icon { transform: rotate(-8deg) scale(1.08); }
  .tile-link { transition: letter-spacing 260ms ease; }
  a.tile:hover .tile-link { letter-spacing: 0.04em; }

  /* One 4.5s story: shares travel in, the core computes, only the result travels out, then a rest. */
  @keyframes pk-in {
    0% { transform: translate(0, 0); opacity: 0; }
    6% { opacity: 1; }
    36% { transform: translate(var(--dx), var(--dy)); opacity: 1; }
    42%, 100% { transform: translate(var(--dx), var(--dy)); opacity: 0; }
  }
  @keyframes pk-out {
    0%, 48% { transform: translate(0, 0); opacity: 0; }
    52% { opacity: 1; }
    72% { transform: translate(var(--dx), var(--dy)); opacity: 1; }
    76%, 100% { transform: translate(var(--dx), var(--dy)); opacity: 0; }
  }
  @keyframes trail-in { 0% { stroke-dashoffset: 1; } 36% { stroke-dashoffset: 0; } 60%, 100% { stroke-dashoffset: -1; } }
  @keyframes trail-out { 0%, 48% { stroke-dashoffset: 1; } 72% { stroke-dashoffset: 0; } 90%, 100% { stroke-dashoffset: -1; } }
  @keyframes core-hit { 0%, 34% { transform: scale(1); } 42% { transform: scale(1.22); } 54%, 100% { transform: scale(1); } }
  @keyframes result-pop { 0%, 72% { transform: scale(1); fill: #f1edf6; } 78% { transform: scale(1.12); fill: #ff5c9a; } 90%, 100% { transform: scale(1); fill: #f1edf6; } }

  .mpc-trail path { stroke-dasharray: 1 1; animation: trail-in 4.5s cubic-bezier(0.45, 0, 0.55, 1) infinite; }
  .mpc-trail .mpc-out { animation-name: trail-out; }
  .pk { animation: pk-in 4.5s cubic-bezier(0.45, 0, 0.55, 1) infinite; }
  .pk-out { animation-name: pk-out; }
  .mpc-core { animation: core-hit 4.5s ease-in-out infinite; }
  .mpc-result { animation: result-pop 4.5s ease-out infinite; }
  .mpc-orbit { animation: spin 12s linear infinite; }

  /* The current role's dot breathes. */
  .log-current::after {
    content: "";
    position: absolute;
    left: -4px;
    top: 25px;
    width: 9.5px;
    height: 9.5px;
    border-radius: 50%;
    background: #c8326f;
    animation: pulse 2s ease-out infinite;
  }

  .footer-email {
    text-decoration: none;
    background: linear-gradient(currentColor, currentColor) left bottom / 0% 1px no-repeat;
    transition: background-size 400ms cubic-bezier(0.2, 0.7, 0.2, 1);
  }
  .footer-email:hover { background-size: 100% 1px; }

  /* Scroll-driven reveals where the browser supports them; otherwise content just shows. */
  @supports (animation-timeline: view()) {
    [data-reveal],
    .log li,
    .rows li,
    .tried li,
    .company-head,
    .about p {
      animation: rise linear both;
      animation-timeline: view();
      animation-range: entry 5% entry 45%;
    }

    .log::before {
      animation: draw-down linear both;
      animation-timeline: view();
      animation-range: entry 20% cover 55%;
    }
  }
}

@media (max-width: 720px) and (prefers-reduced-motion: no-preference) {
  .log-current::after { top: 22px; }
}
