/* Novian Works — dark, technical, terminal-accented deck.
   Deliberately bleeding-edge CSS (the site doubles as a showcase):
   cross-document view transitions, scroll-driven animations, shape(),
   oklch/color-mix, @property, linear() easing, @starting-style, nesting.
   Everything decorative is @supports-guarded; the page works without it. */

/* ---- typed custom property: animated gradient hue ---- */
@property --brand-hue {
  syntax: "<angle>";
  inherits: false;
  initial-value: 310deg;
}

:root {
  --bg: oklch(0.16 0.02 250);
  --bg-raise: oklch(0.2 0.025 255);
  --line: oklch(0.28 0.03 255);
  --fg: oklch(0.89 0.02 250);
  --fg-dim: oklch(0.66 0.03 250);
  --accent: oklch(0.78 0.13 220);     /* cyan */
  --accent-2: oklch(0.75 0.16 310);   /* magenta — the QuotaSaga color */
  --accent-3: oklch(0.75 0.11 255);   /* blue */
  --ok: oklch(0.8 0.16 150);          /* green — log "info" */
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  /* springy easing for micro-interactions */
  --spring: linear(0, 0.3 12%, 0.72 28%, 1.06 46%, 1.01 60%, 0.99 74%, 1);
}

* { box-sizing: border-box; margin: 0; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  line-height: 1.55;
  min-height: 100svh;
  /* faint engineering grid */
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 64px 64px;
  background-position: -1px -1px;
}

/* ============================================================
   Cross-document view transitions (the slide deck mechanic)
   ============================================================ */

@view-transition { navigation: auto; }

main.slide  { view-transition-name: slide; }
.dots       { view-transition-name: dots; }
.progress   { view-transition-name: progress; }

/* direction-aware "push", set by script.js from navigation.activation
   in the pagereveal event */
html[data-nav="fwd"] {
  &::view-transition-old(slide) { animation: push-out-left 0.4s ease both; }
  &::view-transition-new(slide) { animation: push-in-right 0.4s ease both; }
}
html[data-nav="back"] {
  &::view-transition-old(slide) { animation: push-out-right 0.4s ease both; }
  &::view-transition-new(slide) { animation: push-in-left 0.4s ease both; }
}

@keyframes push-out-left  { to   { transform: translateX(-6%); opacity: 0; } }
@keyframes push-in-right  { from { transform: translateX(6%);  opacity: 0; } }
@keyframes push-out-right { to   { transform: translateX(6%);  opacity: 0; } }
@keyframes push-in-left   { from { transform: translateX(-6%); opacity: 0; } }

/* in-page view transitions: the work-page filter morph */
.card { view-transition-class: card; }
::view-transition-group(.card) { animation-duration: 0.35s; }

/* ============================================================
   Layout: one slide per page
   ============================================================ */

main.slide {
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1.5rem, 4vw, 4rem);
  position: relative;
}

.slide-inner { width: min(64rem, 100%); position: relative; }
.slide-inner.center { text-align: center; }

/* gentle first-load entrance (cross-page moves are handled by the VT) */
@supports (transition-behavior: allow-discrete) {
  .slide-inner {
    transition: opacity 0.5s ease, translate 0.5s ease;
    @starting-style { opacity: 0; translate: 0 10px; }
  }
}

/* big slide-number watermark */
.slide-num {
  position: fixed;
  right: clamp(0.5rem, 4vw, 3rem);
  top: clamp(0.5rem, 3vh, 2rem);
  font-family: var(--mono);
  font-size: clamp(3rem, 10vw, 7rem);
  font-weight: 700;
  color: color-mix(in oklab, var(--fg-dim) 18%, transparent);
  z-index: 0;
  user-select: none;
}

/* ============================================================
   shape(): per-slide backdrop panel + hero packet paths
   ============================================================ */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: color-mix(in oklab, var(--accent) 7%, transparent);
  display: none;
}

@supports (clip-path: shape(from 0 0, line to 100% 100%)) {
  .backdrop { display: block; }

  /* hello: a wave rolling in from the top-right */
  [data-slide="hello"] .backdrop {
    background: color-mix(in oklab, var(--accent-2) 8%, transparent);
    clip-path: shape(
      from 55% 0%,
      curve to 100% 55% with 78% 8% / 96% 30%,
      line to 100% 0%,
      close
    );
  }

  /* work: an angled shelf under the cards */
  [data-slide="work"] .backdrop {
    background: color-mix(in oklab, var(--accent) 6%, transparent);
    clip-path: shape(
      from 0% 100%,
      curve to 100% 78% with 35% 88% / 70% 70%,
      line to 100% 100%,
      close
    );
  }

  /* history: a ribbon down the left, following the timeline */
  [data-slide="history"] .backdrop {
    background: color-mix(in oklab, var(--accent-3) 7%, transparent);
    clip-path: shape(
      from 0% 0%,
      curve to 14% 50% with 22% 20%,
      smooth to 0% 100% with 4% 80%,
      close
    );
  }

  /* ask: a caret panel rising from the bottom-left */
  [data-slide="ask"] .backdrop {
    background: color-mix(in oklab, var(--accent-2) 6%, transparent);
    clip-path: shape(
      from 0% 100%,
      line to 0% 55%,
      curve to 45% 78% with 18% 52%,
      smooth to 100% 100% with 75% 95%,
      close
    );
  }

  /* contact: an envelope-flap descending from the top */
  [data-slide="contact"] .backdrop {
    background: color-mix(in oklab, var(--accent) 6%, transparent);
    clip-path: shape(
      from 0% 0%,
      curve to 50% 34% with 25% 30%,
      smooth to 100% 0% with 80% 24%,
      close
    );
  }
}

/* message packets traveling the hero on offset-path: shape() */
.hero-art { position: relative; }

/* deliberately quiet: small, dim, slow, no glow — texture, not spectacle */
.packet {
  display: none;
  position: absolute;
  inset: 0 auto auto 0;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  pointer-events: none;
}

@supports (offset-path: shape(from 0 0, line to 100% 100%)) {
  .packet { display: block; animation: travel 18s linear infinite; }

  /* command flowing left → right along the trace */
  .packet.p1 {
    offset-path: shape(
      from 0% 20%,
      curve to 100% 30% with 35% 0% / 70% 60%
    );
  }
  /* saga hop, magenta, the slow way back */
  .packet.p2 {
    background: var(--accent-2);
    animation-duration: 24s;
    animation-delay: -9s;
    offset-path: shape(
      from 100% 60%,
      curve to 0% 75% with 60% 95% / 25% 40%
    );
  }
  /* projection notify, a gentle arc underneath */
  .packet.p3 {
    background: var(--ok);
    animation-duration: 20s;
    animation-delay: -4s;
    offset-path: shape(
      from 10% 100%,
      arc to 90% 95% of 45% 25% cw
    );
  }
}

@keyframes travel {
  0%   { offset-distance: 0%;   opacity: 0; }
  10%  { opacity: 0.4; }
  90%  { opacity: 0.4; }
  100% { offset-distance: 100%; opacity: 0; }
}

/* ============================================================
   Scroll-driven animations (progress bar + reveals)
   ============================================================ */

.progress {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: 0 0;
  z-index: 20;
}

@supports (animation-timeline: scroll()) {
  .progress {
    animation: grow linear both;
    animation-timeline: scroll();
  }
  @keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }

  /* cards / timeline entries rise in as they scroll into view;
     anything already in view at load lands in its final state */
  .card, .timeline li, .shelf-item, .photos figure {
    animation: rise linear both;
    animation-timeline: view();
    animation-range: entry 0% entry 85%;
  }
  @keyframes rise {
    from { opacity: 0.2; translate: 0 24px; }
    to   { opacity: 1;   translate: 0 0; }
  }
}

/* ============================================================
   Type
   ============================================================ */

h1 {
  font-size: clamp(2.6rem, 7vw, 4.8rem);
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin: 0.4rem 0 1rem;
  text-wrap: balance;
}

h2 {
  font-size: clamp(1.9rem, 4.5vw, 3rem);
  letter-spacing: -0.015em;
  margin: 0.4rem 0 1.6rem;
  text-wrap: balance;
}

p { text-wrap: pretty; }

.prompt {
  font-family: var(--mono);
  color: var(--fg-dim);
  font-size: 0.95rem;
  .cmd { color: var(--accent); }
}

.tagline {
  font-size: clamp(1.1rem, 2.4vw, 1.45rem);
  color: var(--fg-dim);
  max-width: 42rem;
  em { color: var(--fg); font-style: normal; border-bottom: 2px solid var(--accent); }
}

/* photo + name on the hello slide */
.id-row {
  display: flex;
  align-items: center;
  gap: 1.4rem;
  margin: 0.4rem 0 1rem;
  h1 { margin: 0; }
}

.avatar {
  width: clamp(72px, 12vw, 104px);
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 24%;
  border: 1px solid var(--line);
  outline: 2px solid color-mix(in oklch, var(--accent) 35%, transparent);
  outline-offset: 3px;
  filter: saturate(0.92);
}

/* ============================================================
   Hero pieces
   ============================================================ */

.brand {
  margin: 1.6rem 0 1rem;
  font-family: var(--mono);
  font-size: 1.05rem;
}
.brand-mark {
  font-weight: 600;
  background: linear-gradient(90deg,
    oklch(0.75 0.16 var(--brand-hue)),
    oklch(0.78 0.13 calc(var(--brand-hue) - 90deg)));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: hue-drift 14s linear infinite;
}
@keyframes hue-drift { to { --brand-hue: 670deg; } }
.brand-sep { color: var(--fg-dim); margin: 0 0.5rem; }
.brand-sub { color: var(--fg-dim); }

.offer {
  list-style: none;
  padding: 0;
  margin: 0 0 1.8rem;
  display: grid;
  gap: 0.4rem;
  .k {
    font-family: var(--mono);
    color: var(--accent);
    display: inline-block;
    min-width: 8.5rem;
  }
}

.contact-row {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
  .slide-inner.center & { justify-content: center; }
}

.btn {
  font-family: var(--mono);
  font-size: 0.95rem;
  color: var(--fg);
  text-decoration: none;
  border: 1px solid var(--line);
  background: var(--bg-raise);
  padding: 0.6rem 1.1rem;
  border-radius: 6px;
  transition: border-color 0.15s, scale 0.25s var(--spring);
  &:hover { border-color: var(--accent); scale: 1.04; }
  &.primary { border-color: var(--accent); color: var(--accent); }
}

/* the workshop log trace, as decor */
.trace {
  font-family: var(--mono);
  font-size: clamp(0.62rem, 1.4vw, 0.8rem);
  line-height: 1.7;
  color: var(--fg);
  border-left: 2px solid var(--line);
  padding-left: 1rem;
  overflow-x: auto;
  opacity: 0.85;
  .t    { color: var(--fg-dim); }
  .lvl  { color: var(--ok); }
  .c-doc  { color: var(--accent); }
  .c-saga { color: var(--accent-2); }
  .c-user { color: var(--accent-3); }
  .c-proj { color: oklch(0.8 0.1 200); }
}

/* ============================================================
   Projects
   ============================================================ */

.chips {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.4rem;
  button {
    font-family: var(--mono);
    font-size: 0.82rem;
    color: var(--fg);
    background: var(--bg-raise);
    border: 1px solid color-mix(in oklab, var(--fg-dim) 55%, transparent);
    border-radius: 999px;
    padding: 0.4rem 1rem;
    cursor: pointer;
    box-shadow: 0 1px 0 color-mix(in oklab, var(--fg) 12%, transparent) inset,
                0 2px 6px oklch(0 0 0 / 0.35);
    transition: color 0.15s, border-color 0.15s, background 0.15s,
                scale 0.25s var(--spring);
    &:hover {
      border-color: var(--accent);
      color: var(--accent);
      background: color-mix(in oklab, var(--accent) 12%, var(--bg-raise));
      scale: 1.06;
    }
    &:active { scale: 0.97; }
    &:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
    &[aria-pressed="true"] {
      color: var(--bg);
      background: var(--accent);
      border-color: var(--accent);
      box-shadow: 0 2px 8px color-mix(in oklab, var(--accent) 35%, transparent);
    }
  }
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 1rem;
}

.card {
  --card-accent: var(--accent);
  background: linear-gradient(
    color-mix(in oklab, var(--card-accent) 8%, var(--bg-raise)),
    var(--bg-raise) 55%);
  border: 1px solid var(--line);
  border-top: 2px solid color-mix(in oklab, var(--card-accent) 65%, transparent);
  border-radius: 10px;
  padding: 1.2rem 1.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  &[hidden] { display: none; }
  h3 { font-size: 1.15rem; }
  h3 a {
    color: var(--fg);
    text-decoration: none;
    border-bottom: 1px solid var(--card-accent);
    &:hover { color: var(--card-accent); }
  }
  p { font-size: 0.95rem; color: var(--fg-dim); }
  p strong { color: var(--fg); }
}

/* each project gets its own hue */
.cards .card:nth-child(1) { --card-accent: oklch(0.78 0.13 220); }  /* FCQRS — cyan */
.cards .card:nth-child(2) { --card-accent: oklch(0.75 0.16 310); }  /* workshops — magenta */
.cards .card:nth-child(3) { --card-accent: oklch(0.8 0.14 75);  }  /* 3dpack — amber */
.cards .card:nth-child(4) { --card-accent: oklch(0.72 0.15 280); }  /* yolex — violet */
.cards .card:nth-child(5) { --card-accent: oklch(0.78 0.15 150); }  /* nemorize — green */
.cards .card:nth-child(6) { --card-accent: oklch(0.76 0.13 15);  }  /* focument — rose */

.card-kind { font-family: var(--mono); font-size: 0.78rem; color: var(--card-accent); }
.card-links {
  margin-top: auto;
  a {
    font-family: var(--mono);
    font-size: 0.85rem;
    color: var(--card-accent);
    text-decoration: none;
    margin-right: 1rem;
    &:hover { text-decoration: underline; }
  }
}

/* ============================================================
   History
   ============================================================ */

.bio {
  max-width: 46rem;
  color: var(--fg-dim);
  margin-bottom: 2rem;
  font-size: 1.05rem;
  em { color: var(--fg); font-style: normal; }
}
.ph { font-family: var(--mono); color: var(--accent-2); }

.timeline {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 1.1rem;
  max-width: 46rem;
  li {
    display: grid;
    grid-template-columns: 5.5rem 1fr;
    gap: 1rem;
    border-left: 2px solid var(--line);
    padding-left: 1.2rem;
    position: relative;
    &::before {
      content: "";
      position: absolute;
      left: -5px;
      top: 0.5em;
      width: 8px; height: 8px;
      border-radius: 50%;
      background: var(--accent);
    }
  }
  .when { font-family: var(--mono); color: var(--fg-dim); font-size: 0.9rem; padding-top: 0.1rem; }
  p { color: var(--fg-dim); font-size: 0.95rem; }
}

/* ---- notable work: course/book covers + field photos ---- */
.shelf-prompt { margin-top: 3rem; }
.shelf-title { margin-bottom: 1.4rem; }

.shelf {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: 1.1rem;
  max-width: 60rem;
}

.shelf-item {
  text-decoration: none;
  color: inherit;
  figure { margin: 0; }
  img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
    border: 1px solid var(--line);
    transition: translate 0.25s var(--spring), box-shadow 0.25s ease, border-color 0.25s ease;
  }
  figcaption {
    margin-top: 0.55rem;
    font-size: 0.78rem;
    line-height: 1.4;
    color: var(--fg);
    span { display: block; font-family: var(--mono); color: var(--fg-dim); font-size: 0.7rem; margin-top: 0.15rem; }
  }
  &:hover img {
    translate: 0 -4px;
    border-color: color-mix(in oklch, var(--accent) 55%, var(--line));
    box-shadow: 0 10px 28px oklch(0 0 0 / 0.45);
  }
}

.photos {
  display: grid;
  gap: 1.6rem;
  max-width: 60rem;
  margin-top: 2rem;
  figure { margin: 0; }
  img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 10px;
    border: 1px solid var(--line);
  }
  figcaption {
    margin-top: 0.6rem;
    font-size: 0.85rem;
    color: var(--fg-dim);
    max-width: 46rem;
    span { font-family: var(--mono); font-size: 0.72rem; opacity: 0.75; margin-left: 0.4rem; }
  }
}

/* ============================================================
   Contact
   ============================================================ */

.big-cta {
  margin-bottom: 1rem;
  a {
    display: inline-flex;
    align-items: center;
    gap: 0.45em;
    font-family: var(--sans);
    font-weight: 650;
    letter-spacing: -0.02em;
    color: var(--accent);
    font-size: clamp(1.4rem, 4.5vw, 2.8rem);
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 0.18em;
    text-decoration-color: color-mix(in oklab, var(--accent) 45%, transparent);
    &:hover { color: var(--fg); text-decoration-color: var(--fg); }
  }
  .mail-icon { width: 0.95em; height: 0.95em; flex: none; }
}
.closing { color: var(--fg-dim); max-width: 34rem; margin: 0 auto 2rem; }
.fineprint { font-family: var(--mono); font-size: 0.8rem; color: var(--fg-dim); margin-top: 3rem; }

/* the two model-tier start buttons in the terminal gate */
.term-starts {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
  margin: 0.4rem 0;
  span {
    display: block;
    font-size: 0.68rem;
    opacity: 0.75;
    font-weight: normal;
    margin-top: 0.1rem;
  }
}

/* QR for the projected deck — dark modules on a light card so any phone
   camera reads it across a room (inverted QRs scan unreliably) */
.qr {
  margin: 2.2rem auto 0;
  width: fit-content;
  img {
    display: block;
    padding: 8px;
    background: oklch(0.97 0.005 250);
    border-radius: 10px;
  }
  figcaption {
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--fg-dim);
    margin-top: 0.5rem;
    text-align: center;
  }
}

/* ============================================================
   "ask novian" — the local-assistant terminal
   ============================================================ */

.term {
  font-family: var(--mono);
  background: oklch(0.13 0.015 250);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  margin-top: 0.5rem;
  box-shadow: 0 10px 30px oklch(0 0 0 / 0.35);
}

.term-head {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.9rem;
  background: var(--bg-raise);
  border-bottom: 1px solid var(--line);
  .td { width: 11px; height: 11px; border-radius: 50%; }
  .td.r { background: oklch(0.65 0.19 25); }
  .td.y { background: oklch(0.8 0.15 90); }
  .td.g { background: oklch(0.72 0.17 150); }
  .term-title { margin-left: 0.6rem; font-size: 0.78rem; color: var(--fg-dim); }
}

.term-body {
  height: min(20rem, 45svh);
  overflow-y: auto;
  padding: 1rem 1.1rem;
  font-size: 0.88rem;
  line-height: 1.65;
}

.term-line {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin-bottom: 0.45rem;
  &.sys { color: var(--fg-dim); }
  &.you { color: var(--accent); }
  &.ai  { color: var(--fg); }
}

.term-gate {
  display: grid;
  gap: 0.9rem;
  justify-items: start;
  .sys { color: var(--fg-dim); margin: 0; }
  .sys.small { font-size: 0.78rem; max-width: 36rem; }
}

.term-suggest {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  button {
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--fg);
    text-align: left;
    background: var(--bg-raise);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 0.35rem 0.7rem;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
    &::before { content: "> "; color: var(--accent-2); }
    &:hover { border-color: var(--accent); color: var(--accent); }
  }
}

.term-input {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 1.1rem;
  border-top: 1px solid var(--line);
  background: var(--bg-raise);
  .term-caret { color: var(--accent); }
  input {
    flex: 1;
    font-family: var(--mono);
    font-size: 0.9rem;
    color: var(--fg);
    background: transparent;
    border: none;
    outline: none;
    &::placeholder { color: color-mix(in oklab, var(--fg-dim) 70%, transparent); }
    &:disabled { opacity: 0.55; }
  }
}

/* ============================================================
   Deck chrome: dots + pager
   ============================================================ */

.dots {
  position: fixed;
  right: 1.1rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  z-index: 10;
  a {
    width: 10px; height: 10px;
    border-radius: 50%;
    border: 1px solid var(--fg-dim);
    transition: background 0.15s, border-color 0.15s, scale 0.25s var(--spring);
    &:hover { border-color: var(--accent); scale: 1.3; }
    &[aria-current="page"] { background: var(--accent); border-color: var(--accent); }
  }
}

.pager {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  margin-top: 2.5rem;
  font-family: var(--mono);
  font-size: 0.88rem;
  .slide-inner.center & { justify-content: center; }
  a {
    color: var(--fg-dim);
    text-decoration: none;
    &:hover { color: var(--accent); }
  }
  .where { color: var(--fg-dim); }
  .where b { color: var(--accent); font-weight: 600; }
}

@media (max-width: 640px) {
  .dots { right: 0.5rem; }
  .slide-num { font-size: 2.6rem; }
  .timeline li { grid-template-columns: 1fr; gap: 0.1rem; }
}

/* ============================================================
   Reduced motion: keep it calm
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) { animation: none !important; }
  .packet { display: none !important; }
  .brand-mark { animation: none; }
  .card, .timeline li, .shelf-item, .photos figure { animation: none; opacity: 1; translate: none; }
  .btn, .chips button, .dots a { transition: none; }
}
