/* rayanali.ca: ink & paper. zero dependencies, system fonts. */
:root {
  --bg: #f6f4ef;
  --bg-2: #efece5;
  --ink: #161616;
  --ink-2: #3c3a36;
  --mute: #75716a;
  --line: #dcd7cc;
  --accent: #c8321e;
  --accent-ink: #fff;
  --card: #fbfaf6;
  --shadow: 0 1px 0 rgba(0,0,0,.04), 0 8px 30px rgba(0,0,0,.08);
  --side: 248px;
  --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f0f10; --bg-2: #161618; --ink: #ecebe6; --ink-2: #c9c7c1; --mute: #8e8b84;
    --line: #2a2a2d; --accent: #e5492e; --card: #141416; --shadow: 0 8px 30px rgba(0,0,0,.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f0f10; --bg-2: #161618; --ink: #ecebe6; --ink-2: #c9c7c1; --mute: #8e8b84;
  --line: #2a2a2d; --accent: #e5492e; --card: #141416; --shadow: 0 8px 30px rgba(0,0,0,.5);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--ink);
  font: 15px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  overflow: hidden;
}
a { color: inherit; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; text-decoration-thickness: 1px; transition: text-decoration-color .15s, color .15s; }
a:hover { text-decoration-color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
p { margin: 0 0 1em; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
kbd { font: 11px var(--mono); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; color: var(--ink-2); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--mute); }
.skip { position: fixed; left: 8px; top: -40px; background: var(--ink); color: var(--bg); padding: 6px 10px; z-index: 100; }
.skip:focus { top: 8px; }

/* ── shell ── */
.shell { display: flex; height: 100vh; height: 100dvh; }
.side {
  width: var(--side); flex: none; padding: 56px 28px 28px 36px;
  display: flex; flex-direction: column; gap: 28px; border-right: 1px solid var(--line);
}
.side h1 { font-size: 21px; line-height: 1.2; }
.side h1 a { text-decoration: none; }
.side .meta { font-size: 12.5px; line-height: 1.5; margin: 6px 0 0; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: baseline; gap: 10px; text-decoration: none; color: var(--mute); padding: 2px 0; font-size: 14px; }
.nav a .n { font: 10.5px var(--mono); color: var(--line); transition: color .15s; }
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); }
.nav a[aria-current="page"] .n { color: var(--accent); }
.nav a[aria-current="page"]::after { content: ""; height: 1px; flex: 1; max-width: 40px; background: var(--ink); align-self: center; }
.links { list-style: none; margin: 0; padding: 0; font-size: 13.5px; display: flex; flex-direction: column; gap: 1px; }
.links a { color: var(--ink-2); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; font-size: 12px; color: var(--mute); }
.pager { display: flex; align-items: center; gap: 12px; font-family: var(--mono); font-size: 11.5px; }
.pager button { width: 28px; height: 28px; border: 1px solid var(--line); border-radius: 50%; display: grid; place-items: center; color: var(--ink-2); transition: border-color .15s, background .15s; }
.pager button:hover { border-color: var(--ink); }
.pager button:disabled { opacity: .35; cursor: default; }
.hint { margin: 0; }
.toggles { display: flex; gap: 14px; }
.toggles button { color: var(--mute); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.toggles button:hover { color: var(--ink); }

.stage { position: relative; flex: 1; overflow-y: auto; overflow-x: hidden; outline: none; overscroll-behavior: contain; scrollbar-gutter: stable; }
.stage-inner { max-width: 820px; padding: 64px 72px 140px 64px; }
.vlabel {
  position: fixed; right: 18px; top: 50%; transform: translateY(-50%);
  writing-mode: vertical-rl; font: 10.5px var(--mono); letter-spacing: .28em; text-transform: uppercase;
  color: var(--mute); display: flex; align-items: center; gap: 12px; pointer-events: none;
}
.vlabel::before, .vlabel::after { content: ""; width: 1px; height: 48px; background: var(--line); }

/* pages */
.js .page { display: none; }
.js .page.is-active { display: block; }
.page + .page { margin-top: 96px; }
.js .page + .page { margin-top: 0; }
.eyebrow { font: 11px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--mute); margin: 0 0 18px; }
.eyebrow b { color: var(--accent); font-weight: 400; }
.page h2 { font-size: 22px; margin-bottom: 22px; }
.page h3 { font-size: 15px; }
.lede { color: var(--ink-2); }

/* stamp chips */
.chip { white-space: nowrap; text-decoration: none; border-bottom: 1px solid var(--line); padding-bottom: 1px; }
.chip:hover { border-color: var(--ink); }
.stamp {
  display: inline-grid; place-items: center; width: 15px; height: 15px; margin-right: 5px; vertical-align: -2px;
  background: var(--accent); color: var(--accent-ink); font: 600 9.5px/1 var(--sans); border-radius: 2px;
  transform: rotate(-4deg); transition: transform .2s;
}
.chip:hover .stamp { transform: rotate(4deg) scale(1.08); }

/* home */
.home-grid { display: grid; grid-template-columns: 1fr 250px; gap: 40px; align-items: start; }
.intro p { font-size: 16px; color: var(--ink-2); }
.intro p:first-child { color: var(--ink); }
.now { display: flex; gap: 10px; align-items: baseline; font-size: 14px; color: var(--ink); margin-top: 26px; }
.now .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; transform: translateY(-1px); box-shadow: 0 0 0 0 var(--accent); }
.figure { margin: 0; text-align: center; user-select: none; }
.figure canvas { width: 250px; height: 290px; display: block; cursor: grab; touch-action: pan-y; }
.figure canvas:active { cursor: grabbing; }
.figure figcaption { font: 10.5px var(--mono); letter-spacing: .12em; color: var(--mute); margin-top: 4px; text-transform: uppercase; }
.shortcuts { margin-top: 34px; display: flex; flex-wrap: wrap; gap: 8px; }
.pill { font-size: 13px; border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; text-decoration: none; color: var(--ink-2); transition: border-color .15s, color .15s; display: inline-flex; gap: 6px; align-items: center; }
.pill:hover { border-color: var(--ink); color: var(--ink); }

/* work */
.rows { display: flex; flex-direction: column; gap: 26px; }
.row-head { display: flex; justify-content: space-between; gap: 16px; align-items: baseline; }
.row-head .who { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.org { font-weight: 600; }
.orgnote { font: 11px var(--mono); color: var(--mute); }
.role { font-size: 13.5px; color: var(--mute); }
.row time { font: 11.5px var(--mono); color: var(--mute); white-space: nowrap; }
.row .body { margin: 6px 0 0; padding-left: 14px; border-left: 1px solid var(--line); color: var(--ink-2); font-size: 14.5px; }
.row .body p { margin: 0; }
.subhead { font: 11px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--mute); margin: 48px 0 14px; }
.teams { color: var(--mute); font-size: 14px; margin-top: 22px; }
.kv { display: grid; grid-template-columns: 210px 1fr; gap: 6px 18px; font-size: 14px; margin: 0; }
.kv dt { color: var(--ink); }
.kv dd { margin: 0; color: var(--ink-2); }

/* projects */
.projects { display: flex; flex-direction: column; }
.proj { padding: 20px 0; border-top: 1px solid var(--line); }
.proj:last-child { border-bottom: 1px solid var(--line); }
.proj header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.proj h3 { font-size: 16px; }
.tag { font: 11px var(--mono); color: var(--accent); }
.proj p { margin: 6px 0 10px; color: var(--ink-2); font-size: 14.5px; }
.proj .foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; align-items: center; }
.stack { font: 11.5px var(--mono); color: var(--mute); }
.acts { display: flex; gap: 14px; font-size: 13px; align-items: center; }
.act {
  display: inline-flex; align-items: center; gap: 7px; font-size: 13px; padding: 4px 11px 4px 9px;
  background: var(--ink); color: var(--bg); border-radius: 999px; transition: transform .15s, background .15s;
}
.act:hover { background: var(--accent); color: #fff; transform: translateY(-1px); }
.act svg { width: 10px; height: 10px; }
.ext::after { content: " ↗"; font-size: 11px; color: var(--mute); }

/* github */
.gh-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); margin-bottom: 22px; }
.gh-stat { background: var(--bg); padding: 12px 14px; }
.gh-stat b { display: block; font-size: 20px; font-weight: 600; letter-spacing: -.02em; }
.gh-stat span { font: 10.5px var(--mono); color: var(--mute); text-transform: uppercase; letter-spacing: .1em; }
.gh-graph-wrap { overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.gh-graph { display: block; color: var(--ink); }
.gh-graph rect { transition: opacity .1s; }
.gh-graph .lvl4 { fill: var(--accent); }
.gh-graph text { font: 9px var(--mono); fill: var(--mute); }
.gh-graph rect:hover { stroke: var(--ink); stroke-width: 1; }
.gh-legend { display: flex; justify-content: space-between; font: 10.5px var(--mono); color: var(--mute); margin: 6px 0 30px; }
.gh-cols { display: grid; grid-template-columns: 1.15fr 1fr; gap: 36px; }
.gh-cols h3 { font: 11px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--mute); font-weight: 400; margin-bottom: 10px; }
.gh-list { list-style: none; margin: 0; padding: 0; font-size: 13.5px; display: flex; flex-direction: column; gap: 10px; }
.gh-list li { display: flex; flex-direction: column; }
.gh-list .t { color: var(--ink); }
.gh-list .d { color: var(--mute); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.gh-list .m { font: 10.5px var(--mono); color: var(--mute); }
.gh-status { font-size: 13px; }
.skeleton { height: 110px; border-radius: 4px; background: linear-gradient(90deg, var(--bg-2), var(--bg), var(--bg-2)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* photos */
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.photos figure { margin: 0; }
.photos img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; display: block; border-radius: 3px; background: var(--bg-2); }
.photos figcaption { font: 11px var(--mono); color: var(--mute); margin-top: 6px; }

/* tooltip + hover preview */
.tip { position: fixed; z-index: 60; pointer-events: none; background: var(--ink); color: var(--bg); font: 11.5px var(--mono); padding: 5px 8px; border-radius: 4px; white-space: nowrap; }
.peek { position: fixed; z-index: 55; pointer-events: none; width: 300px; border-radius: 6px; overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--line); background: var(--card); opacity: 0; transform: translateY(6px) scale(.98); transition: opacity .15s, transform .15s; }
.peek.on { opacity: 1; transform: none; }
.peek img { display: block; width: 100%; height: auto; }

/* dialogs */
dialog { border: 1px solid var(--line); background: var(--card); color: var(--ink); padding: 0; border-radius: 10px; box-shadow: var(--shadow); max-width: calc(100vw - 32px); }
dialog::backdrop { background: rgba(10,10,10,.45); backdrop-filter: blur(2px); }
.win { width: min(1040px, calc(100vw - 32px)); }
.win-bar { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 13px; }
.win-bar .url { flex: 1; font: 12px var(--mono); color: var(--mute); background: var(--bg-2); padding: 4px 10px; border-radius: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.win-bar .close { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 16px; }
.win-bar .close:hover { background: var(--bg-2); }
.win-body { position: relative; }
.win-body iframe { display: block; width: 100%; height: min(72vh, 760px); border: 0; background: #fff; }
.win-body .loading { position: absolute; inset: 0; display: grid; place-items: center; font: 12px var(--mono); color: var(--mute); pointer-events: none; }
.win-note { padding: 10px 14px; font-size: 12.5px; color: var(--mute); border-top: 1px solid var(--line); margin: 0; }
.shot { display: grid; grid-template-columns: 1.5fr 1fr; }
.shot img { width: 100%; height: auto; display: block; border-right: 1px solid var(--line); }
.shot .side-panel { padding: 22px; display: flex; flex-direction: column; gap: 14px; font-size: 14px; }
.shot ol { margin: 0; padding-left: 18px; color: var(--ink-2); display: flex; flex-direction: column; gap: 8px; }
.launch { align-self: flex-start; }

/* flow demo */
.flow { padding: 26px 26px 22px; }
.flow h3 { font-size: 15px; margin-bottom: 18px; }
.flow-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 0; position: relative; }
.flow-steps li { position: relative; }
.flow-steps button { width: 100%; text-align: left; padding: 16px 10px 0 0; font: 12px var(--mono); color: var(--mute); position: relative; }
.flow-steps button::before { content: ""; position: absolute; left: 0; right: 0; top: 4px; height: 2px; background: var(--line); }
.flow-steps button::after { content: ""; position: absolute; left: 0; top: 0; width: 10px; height: 10px; border-radius: 50%; background: var(--card); border: 2px solid var(--line); transition: border-color .2s, background .2s; }
.flow-steps button .i { display: block; font-size: 10px; letter-spacing: .1em; }
.flow-steps button .l { display: block; font: 600 14px var(--sans); color: var(--mute); margin-top: 2px; transition: color .2s; }
.flow-steps li.done button::before, .flow-steps li.on button::before { background: var(--ink); }
.flow-steps li.done button::after { border-color: var(--ink); background: var(--ink); }
.flow-steps li.on button::after { border-color: var(--accent); background: var(--accent); }
.flow-steps li.on button .l, .flow-steps li.done button .l { color: var(--ink); }
.flow-detail { min-height: 70px; margin: 22px 0 16px; font-size: 15px; color: var(--ink-2); border-left: 2px solid var(--accent); padding: 2px 0 2px 14px; }
.flow-ctl { display: flex; gap: 10px; align-items: center; }
.btn { font-size: 13px; padding: 5px 13px; border: 1px solid var(--line); border-radius: 999px; transition: border-color .15s; }
.btn:hover { border-color: var(--ink); }

/* palette */
.palette { width: min(520px, calc(100vw - 32px)); margin-top: 14vh; }
.palette input { width: 100%; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--ink); font: 15px var(--sans); padding: 14px 16px; outline: none; }
.palette ul { list-style: none; margin: 0; padding: 6px; max-height: 50vh; overflow-y: auto; }
.palette li { padding: 8px 10px; border-radius: 6px; font-size: 14px; display: flex; justify-content: space-between; cursor: pointer; }
.palette li small { font: 11px var(--mono); color: var(--mute); }
.palette li[aria-selected="true"] { background: var(--bg-2); }
.palette li[aria-selected="true"]::before { content: ""; width: 3px; margin: -2px 8px -2px -6px; background: var(--accent); border-radius: 2px; }
.palette li span { flex: 1; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--ink); color: var(--bg); font-size: 13px; padding: 7px 14px; border-radius: 999px; z-index: 90; }

/* cut transition */
.cut-layer { position: fixed; z-index: 40; pointer-events: none; overflow: hidden; }
.cut-half { position: absolute; inset: 0; background: var(--bg); will-change: transform, opacity; }
.cut-half .stage-inner { will-change: transform; }
.slash { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.slash .ink { stroke: var(--ink); stroke-width: 3; stroke-linecap: round; fill: none; }
.slash .edge { stroke: var(--accent); stroke-width: 1; fill: none; }

/* pet */
.pet-layer { position: fixed; left: 0; bottom: 0; width: 0; height: 0; z-index: 45; }
.pet { position: absolute; left: 0; bottom: 0; width: 78px; height: 60px; will-change: transform; touch-action: manipulation; }
.pet canvas { width: 100%; height: 100%; image-rendering: pixelated; image-rendering: crisp-edges; display: block; pointer-events: none; }
.pet:focus-visible { outline-offset: -4px; }
.ghost { position: absolute; left: 0; bottom: 0; width: 78px; height: 60px; image-rendering: pixelated; pointer-events: none; }
.zzz { position: absolute; left: 0; bottom: 0; font: 600 11px var(--mono); color: var(--mute); pointer-events: none; }
.no-pet .pet-layer { display: none; }

/* mobile */
@media (max-width: 820px) {
  body { font-size: 14.5px; }
  .shell { flex-direction: column; }
  .side { width: auto; padding: 16px 18px 10px; border-right: 0; border-bottom: 1px solid var(--line); gap: 10px; display: grid; grid-template-columns: 1fr auto; align-items: center; }
  .side h1 { font-size: 18px; }
  .side .meta { display: none; }
  .nav { grid-column: 1 / -1; flex-direction: row; gap: 16px; overflow-x: auto; scrollbar-width: none; }
  .nav a::after { display: none; }
  .links, .hint, .toggles { display: none; }
  .side-foot { margin: 0; grid-row: 1; grid-column: 2; }
  .stage-inner { padding: 28px 22px 130px; }
  .vlabel { display: none; }
  .home-grid { grid-template-columns: 1fr; }
  .figure { margin-top: 18px; }
  .figure canvas { width: 170px; height: 190px; margin: 0 auto; }
  .kv { grid-template-columns: 1fr; gap: 0; }
  .kv dd { margin-bottom: 10px; }
  .gh-stats { grid-template-columns: repeat(2, 1fr); }
  .gh-cols { grid-template-columns: 1fr; }
  .shot { grid-template-columns: 1fr; }
  .shot img { border-right: 0; border-bottom: 1px solid var(--line); }
  .flow-steps { grid-auto-flow: row; }
  .flow-steps button { padding: 0 0 12px 22px; }
  .flow-steps button::before { left: 4px; right: auto; top: 10px; bottom: -4px; width: 2px; height: auto; }
  .row-head { flex-direction: column; gap: 0; }
  .pet, .ghost { width: 52px; height: 40px; }
  .mobile-links { display: flex !important; }
}
.mobile-links { display: none; flex-wrap: wrap; gap: 8px; margin-top: 22px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
@media print {
  body { overflow: visible; }
  .side, .pet-layer, .vlabel { display: none; }
  .js .page { display: block; }
  .stage { overflow: visible; }
}
.row .body .try { margin-top: 10px; }
.page h2:focus { outline: none; }
