/* tinqr.dev */

:root {
  --bg: #fff;
  --text: #141414;
  --grey: #6b6b6b;
  --faint: #808080;
  --line: #ebebeb;
  --panel: #f5f5f4;
  --link-line: #cfcfcf;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --arabic: "SF Arabic", "Geeza Pro", "Noto Naskh Arabic", "Segoe UI", Tahoma, sans-serif;
  --col: 37rem;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111;
    --text: #ececec;
    --grey: #9b9b9b;
    --faint: #7c7c7c;
    --line: #262626;
    --panel: #1b1b1b;
    --link-line: #4a4a4a;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
}
img, video { display: block; max-width: 100%; }
p { margin: 0 0 1em; }
h1, h2, h3 { font-size: inherit; font-weight: 600; margin: 0; line-height: 1.35; }
a { color: inherit; text-decoration: underline; text-decoration-color: var(--link-line); text-decoration-thickness: 1px; text-underline-offset: 3px; transition: text-decoration-color .15s; }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid #3b6cff; outline-offset: 2px; border-radius: 3px; }
[lang="ar"], .ar { font-family: var(--arabic); }

.col { max-width: calc(var(--col) + 40px); margin: 0 auto; padding: 0 20px; }
.wide { max-width: calc(60rem + 40px); margin: 0 auto; padding: 0 20px; }

header.site { padding-top: 56px; }
header.site .name { font-weight: 600; text-decoration: none; }
header.site .back { color: var(--grey); text-decoration: none; }
header.site .back:hover { color: var(--text); }

main, main.col { padding-top: 44px; }
.grey { color: var(--grey); }
.small { font-size: 13px; }

/* home */
.intro p { margin-bottom: .9em; }
.group { margin-top: 56px; }
.group > h2 { font-weight: 400; color: var(--grey); margin-bottom: 16px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { margin: 0 0 18px; }
.list .t { font-weight: 500; }
.list .y { color: var(--faint); font-variant-numeric: tabular-nums; }
.list .d { display: block; color: var(--grey); }
.list a.row { display: block; text-decoration: none; border-radius: 6px; margin: -4px -8px; padding: 4px 8px; transition: background-color .15s; }
.list a.row:hover { background: var(--panel); }
.list a.row .t { text-decoration: underline; text-decoration-color: var(--link-line); text-underline-offset: 3px; text-decoration-thickness: 1px; }
.list a.row:hover .t { text-decoration-color: currentColor; }
.after { color: var(--grey); }

footer.site { margin-top: 72px; margin-bottom: 56px; color: var(--faint); font-size: 13px; }

/* project pages */
.title h1 { font-size: 24px; letter-spacing: -.01em; }
.title p { color: var(--grey); margin: 4px 0 0; }
.title .when { color: var(--faint); font-size: 13px; margin-top: 6px; font-variant-numeric: tabular-nums; }
.prose { margin-top: 40px; }
.prose h2 { margin: 48px 0 8px; }
.prose ul { padding-left: 1.2em; margin: 0 0 1em; }
.prose li { margin-bottom: .35em; }
figure { margin: 40px 0; }
figcaption { color: var(--grey); font-size: 13px; margin-top: 10px; }

/* Tally player */
.player { margin: 40px 0 8px; }
.player .stage { background: var(--panel); border-radius: 14px; padding: 40px 20px; display: grid; place-items: center; }
.player .screen { width: min(300px, 72vw); aspect-ratio: 9 / 16; border-radius: 22px; overflow: hidden; background: #f4f1ea; }
.player .screen video, .player .screen img { width: 100%; height: 100%; object-fit: cover; }
.player .screen img { object-position: top; }
.player .controls { display: flex; justify-content: space-between; align-items: baseline; gap: 12px 24px; flex-wrap: wrap; margin-top: 14px; }
.tabs { display: flex; gap: 4px 16px; flex-wrap: wrap; }
.tabs button { font: inherit; color: var(--grey); background: none; border: 0; padding: 2px 0; cursor: pointer; border-bottom: 1px solid transparent; transition: color .15s, border-color .15s; }
.tabs button:hover { color: var(--text); }
.tabs button[aria-pressed="true"] { color: var(--text); border-bottom-color: var(--text); }
.player figcaption { min-height: 2.9em; }

/* the decision log */
.log, .prose ul.log { list-style: none; padding: 0; margin: 16px 0 0; border-top: 1px solid var(--line); }
.log li { display: grid; grid-template-columns: 5em 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.log .d { color: var(--faint); font-variant-numeric: tabular-nums; }
.log li.pause span + span { color: var(--grey); }

/* before / after text */
.compare { width: 100%; border-collapse: collapse; margin: 20px 0 8px; }
.compare th { text-align: left; font-weight: 400; color: var(--grey); font-size: 13px; padding: 0 0 8px; }
.compare td { vertical-align: top; padding: 12px 16px 12px 0; border-top: 1px solid var(--line); width: 50%; }
.compare td [lang="ar"] { display: block; font-size: 18px; line-height: 1.5; direction: rtl; text-align: right; }
.compare td .gl { display: block; color: var(--grey); font-size: 13px; margin-top: 4px; }

.num { font-variant-numeric: tabular-nums; white-space: nowrap; }

header.site.me { display: flex; align-items: center; gap: 14px; line-height: 1.4; }
.photo { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; background: var(--panel); }

/* project pages: real artifacts */
.shots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; background: var(--panel); border-radius: 14px; padding: 20px; }
.shots img { width: 100%; height: auto; border-radius: 12px; }
.shots figcaption { grid-column: 1 / -1; margin-top: 2px; }

.wide-fig .scroll { overflow-x: auto; background: var(--panel); border-radius: 12px; padding: 16px; }
.wide-fig .scroll img { min-width: 640px; width: 100%; height: auto; border-radius: 6px; }

pre.note { margin: 0; background: var(--panel); border-radius: 12px; padding: 18px 20px; overflow-x: auto; font: 13px/1.6 ui-monospace, "SF Mono", Menlo, Consolas, monospace; color: var(--text); }

ul.said { list-style: none; padding: 0; margin: 12px 0 1.2em; border-left: 2px solid var(--line); }
ul.said li { padding: 2px 0 2px 16px; margin: 0 0 6px; }

.msgs { display: grid; gap: 10px; }
.msgs figcaption { margin-top: 0; }   /* the grid's gap already spaces it */
.msgs .m { margin: 0; background: var(--panel); border-radius: 14px; padding: 14px 16px; line-height: 1.75; }
.msgs .m[dir="rtl"] { font-family: var(--arabic); font-size: 17px; }
.msgs .k { display: block; font: 12px/1.4 var(--font); color: var(--grey); margin-bottom: 2px; }
.msgs .m[dir="rtl"] .k { text-align: right; }
mark { color: inherit; border-radius: 4px; padding: 1px 3px; }
mark.a { background: #e4f7a1; }
mark.s { background: #ffd9e6; }
mark.c { background: #d6e6ff; }
mark.b { background: #ffe9b8; }
@media (prefers-color-scheme: dark) {
  mark.a { background: #4a5a12; }
  mark.s { background: #5c2a3c; }
  mark.c { background: #22385c; }
  mark.b { background: #5c4614; }
}
@media (max-width: 640px) {
  /* screens scroll sideways; the caption stays under them, like on desktop */
  .shots { grid-auto-flow: column; grid-template-columns: none; grid-auto-columns: 62vw; overflow-x: auto; scroll-snap-type: x mandatory; padding: 20px; }
  .shots img { grid-row: 1; scroll-snap-align: center; }
  .shots figcaption { grid-row: 2; grid-column: 1; width: calc(100vw - 80px); position: sticky; left: 0; }
}

/* real screens */
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; background: var(--panel); border-radius: 14px; padding: 20px; }
.pair div { display: grid; gap: 8px; justify-items: center; }
.pair img { width: 100%; max-width: 240px; height: auto; border-radius: 12px; }
.pair span { font-size: 13px; color: var(--grey); }
.pair figcaption { grid-column: 1 / -1; margin-top: -2px; }
.row4 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; background: var(--panel); border-radius: 14px; padding: 20px; }
.row4.six { grid-template-columns: repeat(3, 1fr); }
.row4 img { width: 100%; height: auto; border-radius: 10px; }
.row4 figcaption { grid-column: 1 / -1; margin-top: 2px; }

@media (max-width: 640px) { .row4 { grid-template-columns: 1fr 1fr; } .row4.six { grid-template-columns: 1fr 1fr 1fr; } }
img.framed { width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--line); }
.wide-fig img.framed { display: block; }

/* home: an app icon beside each job */
.list .co, .list a.row.co { display: grid; grid-template-columns: 40px 1fr; gap: 14px; align-items: start; }
.list div.co { margin: -4px -8px; padding: 4px 8px; }
.co .ic { width: 40px; height: 40px; border-radius: 10px; margin-top: 3px; outline: 1px solid rgba(0,0,0,.07); outline-offset: -1px; }
.co .ic.mono { display: grid; place-items: center; background: var(--panel); color: var(--grey); font-weight: 600; outline: 0; }

/* home: selected work, a small picture beside each line */
.work .cards { display: grid; gap: 22px; }
.work a { display: grid; grid-template-columns: 168px 1fr; gap: 18px; align-items: center; text-decoration: none; }
.work img { width: 100%; height: auto; aspect-ratio: 4 / 3; border-radius: 10px; background: var(--panel); transition: transform .25s ease; }
.work a:hover img { transform: translateY(-2px); }
.work .t { font-weight: 500; text-decoration: underline; text-decoration-color: var(--link-line); text-underline-offset: 3px; text-decoration-thickness: 1px; }
.work a:hover .t { text-decoration-color: currentColor; }
.work .y { color: var(--faint); font-variant-numeric: tabular-nums; }
.work .d { display: block; color: var(--grey); }
@media (max-width: 520px) { .work a { grid-template-columns: 120px 1fr; gap: 14px; } }
@media (prefers-reduced-motion: reduce) { .work img { transition: none; } }

/* project pages: the shot at the top */
figure.hero { margin: 32px 0 0; }
figure.hero img { width: 100%; height: auto; aspect-ratio: 4 / 3; border-radius: 14px; background: var(--panel); }

/* layout fixes, 17 Oct */
.pair { align-items: end; }
.wide-fig.narrow img.framed { max-width: 340px; margin: 0 auto; border: 0; }
@media (max-width: 420px) { .tabs { gap: 2px 12px; font-size: 15px; } }

/* click a screen to see it larger */
img.zoomable { cursor: zoom-in; }
dialog.zoom { padding: 0; border: 0; background: transparent; width: 100vw; height: 100vh; max-width: 100vw; max-height: 100vh; overflow: hidden; }
dialog.zoom::backdrop { background: rgba(0, 0, 0, .88); }
dialog.zoom img { position: absolute; inset: 0; margin: auto; max-width: calc(100vw - 32px); max-height: calc(100vh - 32px); width: auto; height: auto; border-radius: 12px; cursor: zoom-out; }
dialog.zoom .close { position: fixed; top: 14px; right: 16px; z-index: 1; font: inherit; font-size: 14px; color: #fff; background: rgba(24, 24, 24, .92); border: 1px solid rgba(255, 255, 255, .28); border-radius: 999px; padding: 6px 14px; cursor: pointer; box-shadow: 0 2px 10px rgba(0, 0, 0, .4); }
dialog.zoom .nav { display: none; position: fixed; top: 50%; transform: translateY(-50%); z-index: 1; width: 44px; height: 44px; font: 28px/1 var(--font); color: #fff; background: rgba(24, 24, 24, .92); border: 1px solid rgba(255, 255, 255, .28); border-radius: 50%; cursor: pointer; padding: 0 0 4px; }
dialog.zoom .prev { left: 16px; }
dialog.zoom .next { right: 16px; }
dialog.zoom .count { position: fixed; bottom: 14px; left: 0; right: 0; margin: 0; text-align: center; font-size: 13px; color: rgba(255, 255, 255, .75); pointer-events: none; }
dialog.zoom.many .nav { display: block; }
dialog.zoom img { touch-action: pan-y pinch-zoom; user-select: none; -webkit-user-drag: none; }
@media (max-width: 640px) {
  dialog.zoom img { max-height: calc(100vh - 120px); }
  dialog.zoom .nav { top: auto; bottom: 8px; transform: none; width: 40px; height: 40px; }
}

/* Fliki: the map and the graph */
.kb { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 24px; background: var(--panel); border-radius: 14px; padding: 20px; font-size: 14px; }
.kb figcaption { margin-top: 6px; }
.kb h3 { font-weight: 600; margin: 0 0 6px; font-size: 14px; }
.kb ul { list-style: none; margin: 0; padding: 0; }
.kb li { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; border-bottom: 1px solid var(--line); color: var(--grey); }
.kb li span:last-child { color: var(--faint); font-variant-numeric: tabular-nums; }
.kb li.sub { padding-left: 14px; font-size: 13px; position: relative; }
.kb li.sub::before { content: ""; position: absolute; left: 3px; top: 0; bottom: 50%; width: 7px; border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); }
@media (max-width: 520px) { .kb { grid-template-columns: 1fr; } }

.graph { background: var(--panel); border-radius: 14px; padding: 20px; }
.graph svg { display: block; width: 100%; height: auto; touch-action: manipulation; }
.graph .links path { fill: none; stroke: var(--text); stroke-opacity: .03; stroke-width: 1; transition: stroke-opacity .3s ease-out, stroke .3s ease-out; }
.graph circle { fill: #9a9a9a; transition: opacity .3s ease-out, fill .3s ease-out; }
.graph svg { cursor: pointer; }
.graph circle.flash { fill: var(--text); }
.graph svg.focus circle { opacity: .14; }
.graph svg.focus .links path { stroke-opacity: .012; }
.graph svg.focus circle.near { opacity: 1; }
.graph svg.focus circle.on { opacity: 1; fill: #8b5cf6; }
.graph svg.focus .links path.lit { stroke: #8b5cf6; stroke-opacity: .8; stroke-width: 1.6; }
.graph .trail line { stroke: #8b5cf6; stroke-width: 2; stroke-dasharray: 5 6; }
.graph .kinds text { fill: var(--grey); font: 20px var(--font); }
.graph .kinds tspan.n { fill: var(--faint); }
.graph .kinds text.centre { fill: var(--text); }
.graph svg.focus .kinds text { opacity: .35; }
.graph .tag { fill: var(--text); font: 600 26px var(--font); pointer-events: none; paint-order: stroke; stroke: var(--panel); stroke-width: 7px; stroke-linejoin: round; }
.graph .ctl { margin-top: 12px; }
.graph figcaption { margin-top: 14px; }
.graph .qa { display: none; margin-top: 14px; }
.graph .qa.on { display: block; }
.graph .steps { margin: 8px 0 0; padding: 0 0 0 1.4em; font-size: 14px; line-height: 1.6; color: var(--faint); }
.graph .steps li { opacity: .45; transition: opacity .4s, color .4s; }
.graph .steps li.on { opacity: 1; color: var(--text); }
.graph .steps li::marker { color: var(--faint); }
.graph .q { margin: 0; font-size: 15px; font-weight: 600; color: var(--text); }
.graph .q:not(:empty)::before { content: 'Question: '; font-weight: 400; color: var(--grey); }
.graph .step { margin: 8px 0 0; font-size: 14px; color: var(--grey); }
.graph .walk { font: inherit; font-size: 14px; color: var(--text); background: none; border: 1px solid var(--line); border-radius: 999px; padding: 5px 14px; cursor: pointer; }
.graph .walk:hover { border-color: var(--grey); }
.graph .walk:disabled { opacity: .5; cursor: default; }
@media (max-width: 520px) { .graph { padding: 12px 8px; } .graph .ctl, .graph figcaption { padding: 0 8px; } }
@media (prefers-reduced-motion: reduce) { .graph line, .graph circle { transition: none; } }

/* small month-by-month bars */
.bars { display: grid; grid-template-columns: repeat(7, 1fr); align-items: end; gap: 8px; height: 150px; margin: 20px 0 6px; }
.bars div { display: grid; grid-template-rows: auto 1fr auto; height: 100%; text-align: center; font-size: 12px; color: var(--grey); font-variant-numeric: tabular-nums; }
.bars b { align-self: end; background: var(--text); border-radius: 4px 4px 0 0; min-height: 2px; }
.bars div.v1 b { background: #8b5cf6; }

/* MaxAB: the real prototypes, playing */
.pair video { width: 100%; max-width: 240px; height: auto; border-radius: 12px; }


/* home: the cards behind "the small model" and "the knowledge base" (js/peeks.js) */
.peek { position: absolute; z-index: 5; width: min(420px, calc(100vw - 32px)); padding: 14px; border-radius: 16px; background: var(--bg); box-shadow: 0 1px 2px rgba(0,0,0,.06), 0 8px 28px rgba(0,0,0,.10); opacity: 0; transform: translateY(4px); transition: opacity .18s, transform .18s; pointer-events: none; }
.peek.on { opacity: 1; transform: none; }
.peek .m, .peek .nt { margin: 0; background: var(--panel); border-radius: 12px; padding: 12px 14px; font-size: 14px; line-height: 1.7; }
.peek .nt { font-size: 13.5px; line-height: 1.55; padding: 10px 12px; }
.peek .nt-h { display: flex; align-items: center; gap: 7px; font-size: 12px; line-height: 18px; color: var(--grey); margin-bottom: 6px; }
.peek .nt-ic { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 5px; background: var(--text); }
.peek .nt-ic svg { width: 12px; height: 12px; fill: none; stroke: var(--bg); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.peek .nt-t { margin-left: auto; }
.peek mark { background: transparent; color: inherit; border-radius: 4px; padding: 0 2px; transition: background-color .25s; }
.peek.lit-a mark.a, .peek.lit mark.a, .peek .f b.a { background: #e4f7a1; }
.peek.lit-s mark.s, .peek.lit mark.s, .peek .f b.s { background: #ffd9e6; }
.peek.lit-c mark.c, .peek.lit mark.c, .peek .f b.c { background: #d6e6ff; }
.peek.lit-b mark.b, .peek.lit mark.b, .peek .f b.b { background: #ffe9b8; }
.peek .kind { font-size: 12px; color: var(--grey); margin: 12px 2px 6px; opacity: 0; transition: opacity .25s; }
.peek .f { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; margin: 0 2px; }
.peek .f span { opacity: 0; transition: opacity .2s; }
.peek .f b { visibility: hidden; }
.peek.slots .f span, .peek.done .f span { opacity: 1; }
.peek .f b.in, .peek.done .f b { visibility: visible; }
.peek .f span { display: block; font-size: 12px; color: var(--grey); line-height: 1.4; }
.peek .f b { display: inline-block; font-weight: 600; font-size: 15px; border-radius: 4px; padding: 0 3px; margin-left: -3px; }
.peek .by { font-size: 12px; color: var(--faint); margin: 12px 2px 0; opacity: 0; transition: opacity .3s .2s; }
.peek.slots .kind, .peek.done .kind, .peek.done .by { opacity: 1; }
.pk-fly { position: absolute; z-index: 6; pointer-events: none; font-weight: 600; font-size: 15px; border-radius: 4px; padding: 0 3px; transform-origin: 0 0; will-change: transform; opacity: 0; transition: transform .44s cubic-bezier(.2,.7,.2,1), opacity .12s; }
.pk-fly.go { transform: none !important; opacity: 1; }
/* the same card in the Talea page */
.talea-live .peek.inline { position: relative; z-index: auto; width: auto; padding: 20px; border-radius: 14px; background: var(--panel); box-shadow: none; transition: height .3s ease; overflow: hidden; }
.talea-live .peek .m, .talea-live .peek .nt { background: var(--bg); font-size: 16px; line-height: 1.75; padding: 14px 16px; }
@media (prefers-color-scheme: dark) { .talea-live .peek .m, .talea-live .peek .nt { background: #232323; } }
.talea-live .peek > * { transition: opacity .3s; }
.talea-live .replay { font: inherit; color: var(--faint); background: none; border: 0; padding: 0; cursor: pointer; }
.talea-live figcaption { min-height: 1.6em; }   /* room for Replay before it shows, so nothing moves */
.talea-live .replay:hover { color: var(--grey); }
.talea-live .replay:disabled { opacity: .4; cursor: default; }
.talea-live .replay::before { content: '↻ '; }
.talea-live .peek.fade > * { opacity: 0 !important; }

.peek.fq .q { font-size: 14px; font-weight: 600; margin: 0 2px 8px; }
.peek.fq svg { display: block; width: 100%; height: auto; background: var(--panel); border-radius: 12px; }
.peek.fq svg text { fill: var(--grey); font: 17px var(--font); }
.peek.fq path { fill: none; stroke: var(--text); stroke-opacity: .022; stroke-width: 1; transition: stroke-opacity .3s, stroke .3s; }
.peek.fq path.on { stroke: #8b5cf6; stroke-opacity: .95; stroke-width: 2.5; }
.peek.fq path.trail { stroke: #8b5cf6; stroke-opacity: .95; stroke-width: 2; stroke-dasharray: 4 5; }
.peek.fq circle { fill: var(--text); fill-opacity: .2; transition: fill-opacity .3s, fill .3s; }
.peek.fq circle.on { fill: #8b5cf6; fill-opacity: 1; }
.peek.fq .step { font-size: 13px; color: var(--grey); margin: 8px 2px 0; min-height: 1.4em; }
.peek.fq.done .step { color: var(--text); }
@media (prefers-color-scheme: dark) {
  .peek { background: #1b1b1b; box-shadow: 0 0 0 1px #262626, 0 8px 28px rgba(0,0,0,.5); }
  .peek .m, .peek .nt, .peek.fq svg { background: #232323; }
  .peek.lit-a mark.a, .peek.lit mark.a, .peek .f b.a { background: #4a5a12; }
  .peek.lit-s mark.s, .peek.lit mark.s, .peek .f b.s { background: #5c2a3c; }
  .peek.lit-c mark.c, .peek.lit mark.c, .peek .f b.c { background: #22385c; }
  .peek.lit-b mark.b, .peek.lit mark.b, .peek .f b.b { background: #5c4614; }
}

/* a panel that ends with its caption: as much room under the caption as above it */
.shots:has(> figcaption:last-child), .row4:has(> figcaption:last-child), .pair:has(> figcaption:last-child), .kb:has(> figcaption:last-child) { padding-bottom: 14px; }
/* the cards end on a line of small text: trim its leading off the bottom padding, so it matches the top */
.peek { padding-bottom: 11px; }
.talea-live .peek.inline { padding-bottom: 17px; }
.peek.fq { padding-top: 11px; }   /* it starts on a line of text too */
