/* Metaphi AI site
   One serif for reading, one mono for metadata, paper and ink in both themes.
   Pages: index, research, about, careers. */

:root {
  --paper: #fcfbf8;
  --ink: #0b0b0a;
  --ink-2: #5c5852;
  --ink-3: #9a958c;
  --rule: rgba(11, 11, 10, 0.14);
  /* the screen behind the front sheet: the same palette, inverted */
  --back: #141311;
  --back-ink: #f1efe9;
  --back-ink-2: #b3ada2;
  --back-ink-3: #78736a;
  --back-rule: rgba(241, 239, 233, 0.16);
  --serif: "Newsreader", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
  --measure: 34rem;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #141311;
    --ink: #f1efe9;
    --ink-2: #b3ada2;
    --ink-3: #78736a;
    --rule: rgba(241, 239, 233, 0.16);
    --back: #fcfbf8;
    --back-ink: #0b0b0a;
    --back-ink-2: #5c5852;
    --back-ink-3: #9a958c;
    --back-rule: rgba(11, 11, 10, 0.14);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #141311;
  --ink: #f1efe9;
  --ink-2: #b3ada2;
  --ink-3: #78736a;
  --rule: rgba(241, 239, 233, 0.16);
  --back: #fcfbf8;
  --back-ink: #0b0b0a;
  --back-ink-2: #5c5852;
  --back-ink-3: #9a958c;
  --back-rule: rgba(11, 11, 10, 0.14);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-size: 18px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body.has-reveal { background: var(--back); }
a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
.wrap { width: min(100% - 3rem, 62rem); margin: 0 auto; }
.col { width: min(100% - 3rem, 36rem); margin: 0 auto; }
.skip {
  position: absolute; left: -999px; top: 0;
  padding: 0.5rem 0.75rem; background: var(--ink); color: var(--paper);
  font-family: var(--mono); font-size: 0.8rem;
}
.skip:focus { left: 1rem; top: 1rem; z-index: 10; }

/* header: the serif throughout, one size */
.site-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem 2rem;
  flex-wrap: wrap;
  padding: 1.6rem 0 0;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 1.35rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  min-height: 44px;
}
.brand .tile {
  width: 1.15rem;
  height: 1.15rem;
  background: var(--ink);
  color: var(--paper);
  display: inline-grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 500;
  line-height: 1;
  transform: translateY(-1px);
}
.site-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0 1.75rem;
  font-size: 1rem;
  color: var(--ink-2);
}
.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  border-bottom: 1px solid transparent;
}
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--ink); }
.site-nav a:hover { border-bottom-color: var(--ink); }
.theme {
  appearance: none; border: 0; background: none; padding: 0; margin: 0;
  color: var(--ink-2); cursor: pointer; display: inline-grid; place-items: center;
  width: 44px; height: 44px; margin-right: -12px;
}
.theme:hover { color: var(--ink); }
.theme svg { width: 0.95rem; height: 0.95rem; }
.theme .moon { display: none; }
:root[data-theme="dark"] .theme .sun { display: none; }
:root[data-theme="dark"] .theme .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme .sun { display: none; }
  :root:not([data-theme="light"]) .theme .moon { display: block; }
}

/* the manifesto: one size, one weight, one measure */
.essay {
  margin: clamp(4rem, 12vh, 8rem) auto 0;
  max-width: var(--measure);
  display: grid;
  gap: 1.5rem;
}
.essay p {
  margin: 0;
  font-size: 1.4rem;
  line-height: 1.42;
  font-weight: 400;
  text-wrap: pretty;
}
.essay .sig {
  margin-top: 0.75rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-2);
  border-bottom: 1px solid transparent;
  width: max-content;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.essay .sig:hover { color: var(--ink); border-bottom-color: var(--ink); }

/* the front sheet and the screen behind it */
.front {
  position: relative;
  z-index: 1;
  background: var(--paper);
  padding-bottom: clamp(6rem, 16vh, 11rem);
}
.back {
  position: relative;
  z-index: 0;
  background: var(--back);
  color: var(--back-ink);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: clamp(3rem, 8vh, 5rem);
  padding: clamp(3rem, 8vh, 5rem) 0 2rem;
}
/* The reveal runs only where the screen behind fits the viewport. */
@media (min-width: 720px) and (min-height: 640px) {
  .front { min-height: 100dvh; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25); }
  .back { position: sticky; bottom: 0; min-height: 100dvh; }
}

/* research list */
.label {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 1.25rem;
}
.back .label { color: var(--back-ink-3); }
.list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.back .list { border-top-color: var(--back-rule); }
.row {
  display: grid;
  grid-template-columns: 6rem minmax(0, 1fr) auto;
  column-gap: 2rem;
  align-items: baseline;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--rule);
}
.back .row { border-bottom-color: var(--back-rule); }
.row .when, .row .where {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.back .row .when, .back .row .where { color: var(--back-ink-3); }
.row .what { font-size: 1.15rem; line-height: 1.35; overflow-wrap: anywhere; }
.row .what a { border-bottom: 1px solid transparent; }
.row .what a:hover { border-bottom-color: currentColor; }
.more {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-top: 0.5rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-2);
  border-bottom: 1px solid var(--rule);
}
.back .more { color: var(--back-ink-2); border-bottom-color: var(--back-rule); }
.more:hover { color: var(--ink); border-bottom-color: var(--ink); }
.back .more:hover { color: var(--back-ink); border-bottom-color: var(--back-ink); }

/* reading pages: research index, about, careers */
.page-title {
  margin: clamp(3rem, 10vh, 6rem) 0 2rem;
  font-size: 1.4rem;
  font-weight: 400;
  line-height: 1.42;
  max-width: var(--measure);
  text-wrap: pretty;
}
.prose { max-width: var(--measure); display: grid; gap: 1.25rem; }
.prose p { margin: 0; font-size: 1.15rem; line-height: 1.5; text-wrap: pretty; }
.prose h2 { margin: 1rem 0 0; font-size: 1.15rem; font-weight: 500; line-height: 1.4; }
.prose .when { font-family: var(--mono); font-size: 0.72rem; color: var(--ink-3); }
.prose a { border-bottom: 1px solid var(--rule); }
.prose a:hover { border-bottom-color: var(--ink); }

/* footer */
.site-foot {
  margin-top: clamp(3rem, 8vh, 5rem);
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  column-gap: 2rem;
  row-gap: 2rem;
  align-items: start;
}
.back .site-foot { border-top-color: var(--back-rule); }
.site-foot h3 {
  margin: 0 0 0.6rem;
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.back .site-foot h3 { color: var(--back-ink-3); }
.site-foot ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.1rem; }
.site-foot li { font-size: 1rem; line-height: 1.4; }
.site-foot li a { display: inline-flex; align-items: center; min-height: 32px; border-bottom: 1px solid transparent; }
.site-foot li a:hover { border-bottom-color: currentColor; }
.site-foot .mark {
  justify-self: end;
  text-align: right;
  font-size: 1.35rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.site-foot .fine {
  grid-column: 1 / -1;
  margin: 0;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--ink-3);
}
.back .site-foot .fine { color: var(--back-ink-3); }

@media (max-width: 720px) {
  body { font-size: 17px; }
  .site-nav { gap: 0 1.1rem; font-size: 0.95rem; }
  .essay p { font-size: 1.25rem; }
  .page-title { font-size: 1.25rem; }
  .row { grid-template-columns: minmax(0, 1fr); row-gap: 0.2rem; }
  .site-foot { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 1rem; }
  .site-foot .mark { grid-column: 1 / -1; justify-self: start; text-align: left; }
}
@media (prefers-reduced-motion: no-preference) {
  .site-nav a, .row .what a, .more, .site-foot a, .sig, .prose a {
    transition: border-color 160ms ease, color 160ms ease;
  }
}
