/* /ai-tutor: the tutor that has already read your work. On
   css/flashcards.css and css/feature-pages.css. Here: the desk (what the
   tutor can see beside what it says, on graphite), the same question asked
   twice, the samples an answer becomes, and a note with a passage selected. */
:root {
  --chat-bg: #1f1e1c; --chat-surface: #2c2b29; --chat-raised: #343330; --chat-rule: #474541;
  --chat-text: #edebe5; --chat-muted: #c4c0b7; --chat-lilac: #c2a8f5;
}

/* ---- the desk: what it can see, and what it says -------------------------- */
.tutor-well { align-items: stretch; }
.sees { position: relative; z-index: 1; display: flex; flex-direction: column; border-radius: var(--r-lg); min-width: 0; }
.chat-window { border-radius: var(--r-lg); min-width: 0; }
@supports (corner-shape: squircle) { .sees, .chat-window { corner-shape: squircle; border-radius: calc(var(--r-lg) * 1.6); } }
.sees-list { margin: 0; padding: 4px 20px; flex: 1; display: grid; align-content: space-evenly; }
.sees-list div { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 2px 12px; padding: 11px 0; align-items: start; }
.sees-list div + div { border-top: 1px solid var(--rule); }
.sees-list .ico { grid-row: span 2; margin-top: 2px; color: var(--ink-4); transition: color .25s var(--ease); }
.sees-list dt { font-size: 13.5px; color: var(--ink-3); }
.sees-list dd { margin: 0; display: grid; }
.sees-list strong { font-size: 15.5px; font-weight: 500; letter-spacing: -.01em; color: var(--ink-2); transition: color .25s var(--ease); }
.sees-list small { font-size: 13.5px; color: var(--ink-3); }
/* A row the answer drew on turns to ink while that answer is up. Colour only. */
.sees-list .is-read .ico { color: var(--ink); }
.sees-list .is-read strong { color: var(--ink); font-weight: 600; }
.sees .foot { min-height: 52px; font-size: 13.5px; color: var(--ink-3); }

/* The conversation, on graphite whatever the theme. */
.chat-window { display: flex; flex-direction: column; background: var(--chat-bg); color: var(--chat-text); box-shadow: 0 0 0 1px var(--chat-rule), 0 18px 44px -22px rgb(var(--shade) / calc(.4 * var(--shade-k))); overflow: hidden; }
.chat-window :focus-visible { outline-color: var(--chat-text); outline-offset: -3px; }
.chat-bar, .speaker, .source-chip, .artifact-head, .chat-nav { display: flex; align-items: center; }
.chat-bar { gap: 10px; min-height: 52px; padding: 0 12px 0 18px; border-bottom: 1px solid var(--chat-rule); }
.chat-bar h2 { font-size: 15.5px; font-weight: 600; letter-spacing: -.014em; }
.demo-label { margin-left: auto; font-size: 13px; color: var(--chat-muted); }
.playback { display: grid; place-items: center; width: 36px; height: 36px; background: transparent; border: 1px solid var(--chat-rule); border-radius: 50%; color: var(--chat-text); cursor: pointer; }
.playback:hover { background: var(--chat-raised); }
.playback .ico { width: 15px; height: 15px; stroke-width: 2.3; }
.playback svg:last-child, .playback[data-paused] svg:first-child { display: none; }
.playback[data-paused] svg:last-child { display: block; }
.chat-stage { flex: 1; padding: clamp(16px, 1.9vw, 26px); }
/* Reserve the stage's footprint while the script arrives. */
@media (scripting: enabled) { .chat-window:not(.enhanced) .chat-scene:not(:first-child) { display: none; } }
.chat-window.enhanced .chat-stage { display: grid; }
.chat-window.enhanced .chat-scene { grid-area: 1 / 1; visibility: hidden; }
.chat-window.enhanced .chat-scene.current { visibility: visible; }
.chat-window:not(.enhanced) .chat-scene + .chat-scene { margin-top: 30px; padding-top: 24px; border-top: 1px solid var(--chat-rule); }
.chat-scene { min-width: 0; font-size: 15.5px; line-height: 1.45; }
.question { width: fit-content; max-width: 87%; margin-left: auto; background: var(--chat-raised); border: 1px solid var(--chat-rule); border-radius: 15px 15px 3px 15px; padding: 10px 14px 12px; }
.source-chip { gap: 6px; margin-bottom: 5px; color: var(--chat-muted); font-size: 12.5px; }
.source-chip .ico { width: 14px; height: 14px; }
.speaker { gap: 7px; margin: 17px 0 6px; font-size: 13px; }
.speaker svg { width: 18px; height: 18px; color: var(--chat-lilac); }
.from-work { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 10px; font-size: 12.5px; color: var(--chat-muted); }
.from-work > span { flex-basis: 100%; }
.from-work ul { display: contents; list-style: none; }
.from-work li { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px 3px 6px; border: 1px solid var(--chat-rule); border-radius: 6px; color: var(--chat-text); }
.from-work .ico { width: 13px; height: 13px; }
.chat-artifact { margin: 12px 0 10px; padding: 12px 15px; background: var(--chat-surface); border: 1px solid var(--chat-rule); border-radius: 12px; }
.artifact-head { gap: 7px; font-size: 14px; }
.artifact-head .ico { width: 16px; height: 16px; }
.plan-lines { list-style: none; margin: 6px 0 0; padding: 0; }
.plan-lines li { display: grid; grid-template-columns: 50px 1fr; gap: 10px; padding: 7px 0; font-size: 14px; }
.plan-lines li + li { border-top: 1px solid var(--chat-rule); }
.plan-lines b { color: var(--chat-muted); font-variant-numeric: tabular-nums; font-size: 13px; }
.follow-up, .artifact-foot { font-size: 14px; color: var(--chat-muted); }
.artifact-save { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--chat-rule); font-size: 13px; color: var(--chat-muted); }
.chat-window .save-toggle { min-height: 36px; padding: 0 12px; border: 1px solid var(--chat-rule); border-radius: 9px; background: var(--chat-raised); color: var(--chat-text); font-size: 13.5px; font-weight: 500; cursor: pointer; }
.chat-window .save-toggle:hover { background: var(--chat-rule); }
.chat-window .saved .state, .chat-window .saved .state .ico { color: var(--chat-text); }
.measurement { display: flex; align-items: center; gap: 22px; margin: 12px 0; font-size: 29px; font-weight: 500; }
.measurement small { display: block; font-size: 12.5px; color: var(--chat-muted); }
.working { display: grid; grid-template-columns: auto 1fr; gap: 10px; padding: 13px 0 3px; font-size: 14.5px; }
.working span { color: var(--chat-muted); }
.quote-artifact blockquote { margin: 16px 0; font-size: 23px; letter-spacing: -.03em; }
.quote-artifact u { text-underline-offset: 5px; }
.chat-nav { padding: 0 15px 8px; gap: 5px; }
.chat-nav button { position: relative; flex: 1; min-height: 40px; color: var(--chat-muted); border: 0; background: transparent; font-size: 13.5px; padding: 12px 4px 6px; border-radius: 3px; cursor: pointer; }
.chat-nav button::before { content: ""; position: absolute; top: 2px; left: 3px; right: 3px; height: 2px; border-radius: 2px; background: var(--chat-rule); }
.chat-nav button[aria-pressed="true"] { font-weight: 600; color: var(--chat-text); }
.chat-nav button[aria-pressed="true"]::before { background: var(--chat-text); }
.chat-nav button:hover { color: var(--chat-text); }

/* ---- the same question, asked twice ---------------------------------------- */
.vs-quote { margin: 0; padding: 2px 0 2px 14px; border-left: 2px solid var(--ink-4); font-size: 17px; line-height: 1.45; color: var(--ink-2); }
[data-vs-col="nf"] .vs-quote { border-left-color: var(--ink); color: var(--ink); }
.vs-then { font-size: 13.5px; color: var(--ink-3); margin-bottom: -8px; }

/* ---- what an answer becomes: the samples ----------------------------------- */
.sample-sheet { border-radius: var(--r-lg); }
.planner-list { list-style: none; margin: 0; padding: 4px 20px; }
.planner-list li { display: flex; align-items: center; padding: 11px 0; gap: 16px; font-size: 15px; }
.planner-list li + li { border-top: 1px solid var(--rule); }
.planner-list .day { width: 40px; color: var(--ink-3); font-size: 13.5px; }
.planner-list div { border-left: 2px solid var(--ink-4); padding-left: 12px; display: grid; }
.planner-list strong { font-weight: 500; letter-spacing: -.01em; }
.planner-list small, .recall-card small, .memory-lines small { font-size: 13.5px; color: var(--ink-3); }
.planner-list .suggested div { border-left-style: dashed; border-left-color: var(--ink-2); }
.saved .suggested div { border-left-style: solid; border-left-color: var(--ink); }
.note-quote { margin: 18px 20px 0; padding-left: 12px; border-left: 2px solid var(--ink-4); font-size: 16.5px; line-height: 1.45; }
.recall-card { --h: .35; margin: 18px 20px 20px; padding: 16px 18px; border-radius: var(--r-md); background: var(--sheet); box-shadow: 0 0 0 1px var(--rule), 0 calc(1px + 18px * var(--h)) calc(2px + 40px * var(--h)) calc(-2px - 12px * var(--h)) rgb(var(--shade) / calc((.07 + .12 * var(--h)) * var(--shade-k))), 0 calc(1px + 3px * var(--h)) calc(2px + 6px * var(--h)) rgb(var(--shade) / calc((.04 + .03 * var(--h)) * var(--shade-k))); }
.sample-sheet summary { cursor: pointer; list-style: none; }
.sample-sheet summary::-webkit-details-marker { display: none; }
.recall-card summary strong { display: block; margin: 5px 0 12px; font-size: 19px; font-weight: 500; letter-spacing: -.015em; line-height: 1.3; }
.disclosure { display: inline-flex; align-items: center; gap: 5px; font-size: 14px; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; }
.disclosure::after { content: "+"; text-decoration: none; }
details[open] > summary .disclosure::after { content: "−"; }
.recall-card p, .follow-card p { font-size: 15px; line-height: 1.5; color: var(--ink-2); margin-top: 10px; }
.exam-work, .memory-lines { padding: 18px 20px; }
.exam-work p { font-size: 15.5px; }
.exam-work .handoff { display: flex; align-items: center; gap: 6px; margin-bottom: 12px; font-size: 13.5px; color: var(--ink-3); }
.handoff .ico { width: 14px; height: 14px; }
.exam-work .marked-line, .memory-lines blockquote { margin: 10px 0; font-size: clamp(20px, 2.1vw, 27px); letter-spacing: -.025em; }
.sample-sheet del { text-decoration-color: var(--ink-3); text-decoration-thickness: 2px; }
.sample-sheet ins { text-underline-offset: 4px; }
.follow-card { margin: 0 20px 18px; padding-top: 14px; border-top: 1px solid var(--rule); }
.follow-card summary { font-weight: 500; font-size: 15.5px; }
.follow-card .disclosure { display: flex; margin-top: 3px; font-weight: 400; }
.memory-lines blockquote { margin: 3px 0 14px; }

/* ---- motion: the conversation arriving ------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
  .animated .chat-nav button[aria-pressed="true"]::before { background: var(--chat-rule); }
  .animated .chat-nav button[aria-pressed="true"]::after { content: ""; position: absolute; top: 2px; left: 3px; right: 3px; height: 2px; background: var(--chat-text); transform-origin: left; animation: scene-progress var(--scene-time) linear both; }
  @keyframes scene-progress { from { transform: scaleX(0); } to { transform: scaleX(1); } }
  .animated .current .question { animation: chat-arrive var(--spring-glide-t) var(--spring-glide) backwards; }
  .animated .current .speaker, .animated .current .from-work { animation: ink-in .28s var(--read-at) ease backwards; }
  .animated .current .from-work li { animation: ink-in .3s calc(var(--read-at) + 160ms) ease-out backwards; }
  .animated .current .from-work li:nth-child(2) { animation-delay: calc(var(--read-at) + 300ms); }
  .animated .current .from-work li:nth-child(3) { animation-delay: calc(var(--read-at) + 440ms); }
  .animated .current .ink-word { animation: ink-in .2s var(--ink-delay) ease-out backwards; }
  .animated .current .chat-artifact { animation: chat-arrive var(--spring-glide-t) var(--card-at) var(--spring-glide) backwards; }
  .animated .current .plan-lines li { animation: ink-in .35s calc(var(--card-at) + 100ms) ease-out backwards; }
  .animated .current .plan-lines li:nth-child(2) { animation-delay: calc(var(--card-at) + 340ms); }
  .animated .current .plan-lines li:nth-child(3) { animation-delay: calc(var(--card-at) + 580ms); }
  .animated .current .follow-up { animation: ink-in .4s var(--follow-at) ease-out backwards; }
  @keyframes chat-arrive { from { opacity: 0; transform: translateY(9px); } }
}

@media (min-width: 960px) {
  .tutor-well { grid-template-columns: minmax(300px, 4fr) minmax(0, 6fr); gap: 16px; padding: 16px; }
  .split-s { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
  .split-s.rev { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
  .chat-stage { min-height: 470px; }
}
@media (max-width: 959px) {
  /* What it says first on a phone; what it can see under it. */
  .tutor-well .chat-window { order: -1; }
}
@media (max-width: 559px) {
  .question { max-width: 96%; }
  .sees-list { padding: 4px 16px; }
  .chat-scene { font-size: 15px; }
}
@media (pointer: coarse) { .chat-window .save-toggle { min-height: 44px; } .playback { width: 44px; height: 44px; } }
