/* /planner: the planner that is written for you. On css/flashcards.css and
   css/feature-pages.css. Here: the desk (what is on the exam beside the path
   it becomes), a topic opened to its three steps, the week planned again
   after a check, and the planner's week in the app window. */

/* ---- the desk: what's on the exam, and the path it becomes ---------------- */
.plan-well { align-items: start; }
.setup { position: relative; z-index: 1; display: grid; gap: 16px; padding: 18px; border-radius: var(--r-lg); align-content: start; }
.path-sheet { border-radius: var(--r-lg); min-width: 0; }
@supports (corner-shape: squircle) { .setup, .path-sheet { border-radius: calc(var(--r-lg) * 1.6); } }
.setup .notes-head h2 { font-size: 16.5px; }
.topics { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; min-height: 76px; align-content: flex-start; }
.topics li { display: inline-flex; align-items: center; gap: 2px; min-height: 34px; padding: 0 4px 0 12px; border-radius: var(--r-sm); background: var(--sheet); box-shadow: inset 0 0 0 1px var(--rule-2); font-size: 14.5px; font-weight: 500; letter-spacing: -.01em; }
.topics button { display: grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 8px; background: none; color: var(--ink-3); cursor: pointer; transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease); }
.topics button:hover { background: var(--hover); color: var(--ink); }
.topics svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.topic-add { display: flex; gap: 8px; }
.topic-add input { flex: 1; min-width: 0; height: 44px; padding: 0 14px; border: 1px solid var(--rule-2); border-radius: var(--r-md); background: var(--sheet); color: var(--ink); font-size: 16px; transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease); }
.topic-add input::placeholder { color: var(--ink-3); }
.topic-add input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--rail-on); }
.topic-add .btn { min-height: 44px; }
.pick { margin: 0; padding: 0; border: 0; min-width: 0; display: grid; gap: 6px; }
.pick legend { padding: 0; margin-bottom: 6px; font-size: 13.5px; color: var(--ink-3); }
.pick .seg { display: flex; }
.pick .seg button { flex: 1; justify-content: center; padding: 0 8px; }
/* The thumb is placed before it is allowed to travel, so it never slides in from the edge on load. */
.seg.is-live .seg-thumb { transition: transform var(--spring-settle-t) var(--spring-settle), width var(--spring-settle-t) var(--spring-settle); }
.setup-go { display: grid; gap: 10px; padding-top: 2px; }
.setup-go .btn { width: 100%; min-height: 48px; font-size: 15.5px; font-weight: 600; }
.setup-go .status { text-align: center; }

.path-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 18px 20px 12px; }
.path-head h2 { font-size: 19px; font-weight: 600; letter-spacing: -.02em; line-height: 1.25; }
.path-head span { font-size: 14px; color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* The road: one stop per topic in the order to learn them, the exam at its
   foot. The line is ink as far as the topics are held. */
.plan-path { --row: 40px; --stops: 6; --held: 0; position: relative; list-style: none; margin: 0; padding: 0 20px 6px 0; }
.plan-path::before, .plan-path::after { content: ""; position: absolute; left: 28px; top: calc(var(--row) / 2); width: 2px; border-radius: 2px; transform-origin: top; }
.plan-path::before { height: calc(var(--row) * var(--stops)); background: var(--rule-2); }
.plan-path::after { height: calc(var(--row) * var(--held)); background: var(--ink); transition: height var(--spring-glide-t) var(--spring-glide); }
.plan-path li { position: relative; display: flex; min-height: var(--row); padding-left: 56px; font-size: 15px; }
.plan-path li + li .topic { border-top: 1px solid var(--rule); }
.topic { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; }
.topic b { font-weight: 500; letter-spacing: -.01em; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stop { position: absolute; z-index: 1; left: 20px; top: 50%; width: 18px; height: 18px; margin-top: -9px; border-radius: 50%; background: var(--sheet); box-shadow: inset 0 0 0 2px var(--rule-2); display: grid; place-items: center; transition: background-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease); }
.stop svg { display: none; width: 11px; height: 11px; fill: none; stroke: var(--on-ink); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
[data-state="held"] .stop { background: var(--ink); box-shadow: none; }
[data-state="held"] .stop svg { display: block; }
[data-state="now"] .stop { box-shadow: inset 0 0 0 2px var(--ink); }
[data-state="exam"] .stop { width: 12px; height: 12px; margin: -6px 0 0 3px; border-radius: 2px; background: var(--ink); box-shadow: none; transform: rotate(45deg); }
[data-state="held"] .topic b { color: var(--ink-2); }
[data-state="exam"] .topic b { font-weight: 600; }
[data-state="out"] .topic b { color: var(--ink-3); }
[data-state="out"] .stop { box-shadow: none; background: none; border: 2px dashed var(--rule-2); }
.steps-3 { display: inline-flex; gap: 3px; flex: none; }
.steps-3 i { width: 12px; height: 2px; border-radius: 2px; background: var(--rule-2); transition: background-color .2s var(--ease); }
.steps-3 i.on { background: var(--ink); }
.topic small { margin-left: auto; flex: none; font-size: 13px; color: var(--ink-3); white-space: nowrap; }
[data-state="now"] .topic small { color: var(--ink); font-weight: 500; }

/* This week: one session a study day. The tick says it is done, and the
   path moves on. */
.week-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-top: 4px; padding: 14px 20px 6px; border-top: 1px solid var(--rule-2); font-size: 13.5px; color: var(--ink-3); }
.week { --row: 40px; list-style: none; margin: 0; padding: 0 12px 6px 20px; }
.week li { display: grid; grid-template-columns: 42px minmax(0, 1fr) 44px; align-items: center; min-height: var(--row); font-size: 15px; }
.week li + li { border-top: 1px solid var(--rule); }
.week .day { font-size: 13.5px; color: var(--ink-3); }
.week .what { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.week b { font-weight: 500; letter-spacing: -.01em; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.week small { flex: none; font-size: 13px; color: var(--ink-3); white-space: nowrap; }
.week .is-done b, .week .is-done small { color: var(--ink-3); }
.tick { justify-self: end; display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 50%; background: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.tick i { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--rule-2); transition: background-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease); }
.tick:hover i { box-shadow: inset 0 0 0 2px var(--ink-3); }
.tick svg { width: 12px; height: 12px; fill: none; stroke: var(--on-ink); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.tick[aria-pressed="true"] i { background: var(--ink); box-shadow: none; }
.tick[aria-pressed="true"] svg { opacity: 1; }
.forecast { padding: 4px 20px 14px; font-size: 14.5px; color: var(--ink-2); min-height: 3.6em; }
.forecast b { color: var(--ink); font-weight: 600; }
.forecast button { padding: 0; border: 0; background: none; color: var(--ink); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* ---- a topic, opened to its three steps ----------------------------------- */
.topic-sheet { border-radius: var(--r-lg); }
.gist { padding: 16px 20px 4px; font-size: 16.5px; line-height: 1.45; color: var(--ink); max-width: 46ch; }
.three { list-style: none; margin: 0; padding: 0 20px 8px; }
.three li { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 2px 12px; padding: 14px 0; }
.three li + li { border-top: 1px solid var(--rule); }
.three .n { grid-row: span 2; font-size: 15px; font-weight: 600; color: var(--ink-3); line-height: 1.6; }
.three h3 { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: 16.5px; font-weight: 600; letter-spacing: -.014em; }
.three h3 small { font-size: 13.5px; font-weight: 400; color: var(--ink-3); white-space: nowrap; }
.three .is-now h3 small { color: var(--ink); font-weight: 500; }
.three p { font-size: 15px; line-height: 1.5; color: var(--ink-2); }
.three .acts { grid-column: 2; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.pill { display: inline-flex; align-items: center; min-height: 32px; padding: 0 12px; border-radius: var(--r-sm); background: var(--sheet); box-shadow: inset 0 0 0 1px var(--rule-2); font-size: 14px; font-weight: 500; }

/* ---- a marked check, and the week planned again from it ------------------- */
.replan { border-radius: var(--r-lg); }
.result { display: flex; align-items: center; gap: 22px; padding: 22px 20px 20px; border-bottom: 1px solid var(--rule); }
.mark { position: relative; flex: none; padding: 10px 22px 12px; font: 400 60px/1 var(--serif); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.mark svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; transform: rotate(-3deg); }
.mark path { fill: none; stroke: var(--pen); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; stroke-dasharray: 1 1; }
.replan:not(.marked) .mark { color: var(--ink-4); }
.replan:not(.marked) .mark svg, .replan:not(.marked) .got, .marked .unmarked { display: none; }
.result p { font-size: 16px; line-height: 1.45; color: var(--ink-2); min-height: 2.9em; max-width: 30ch; }
.marked .result p { color: var(--ink); }
.queue-head { display: flex; justify-content: space-between; gap: 12px; padding: 14px 20px 4px; font-size: 13.5px; color: var(--ink-3); }
/* Each day keeps its place; the sessions are what move. */
.queue { --row: 46px; list-style: none; margin: 0; padding: 0 20px 6px; }
.queue li { position: relative; display: grid; grid-template-columns: 46px minmax(0, 1fr); align-items: center; min-height: var(--row); font-size: 15px; }
.queue li + li { border-top: 1px solid var(--rule); }
.queue .day { font-size: 13.5px; color: var(--ink-3); }
.sess { --h: 0; display: flex; align-items: center; gap: 10px; min-height: 36px; margin: 0 -10px; padding: 0 10px; border-radius: var(--r-sm); background: var(--sheet); }
.sess b { font-weight: 500; letter-spacing: -.01em; }
.sess small { margin-left: auto; font-size: 13px; color: var(--ink-3); white-space: nowrap; }
.sess.back small { color: var(--ink); font-weight: 500; }
.sess.leaving { position: absolute; left: 46px; right: 0; top: 5px; }
.sess.lifted { position: relative; z-index: 2; --h: .6; 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))); }
.replan .foot span { flex: 1 1 22ch; min-height: 2.9em; display: flex; align-items: center; }

/* ---- motion: only what was asked for, arriving ---------------------------- */
@media (prefers-reduced-motion: no-preference) {
  /* The path being written: the line draws down, and each topic lands as the
     line reaches it. Opacity for words; a spring for the stops. Everything
     is backwards-filled, so nothing is left transformed. */
  .building .plan-path::before { animation: draw-down 1.3s .1s var(--pen-ease) backwards; }
  .building .plan-path .stop { animation: land var(--spring-catch-t) calc(.16s + var(--i) * 170ms) var(--spring-catch) backwards; }
  .building .plan-path .topic { animation: ink-in .32s calc(.22s + var(--i) * 170ms) ease-out backwards; }
  .building .week-head, .building .forecast, .building .foot { animation: ink-in .3s 1.5s ease-out backwards; }
  .building .week li { animation: ink-in .3s calc(1.56s + var(--i) * 70ms) ease-out backwards; }
  .tick.pop i { animation: land var(--spring-catch-t) var(--spring-catch) backwards; }
  .marked .mark { animation: ink-in .45s ease-out backwards; }
  .marked .mark path { animation: ring-on .8s var(--pen-ease) .3s backwards, ring-dry .5s ease-out 1.1s backwards; }
}
[data-state="exam"] .stop { animation-name: none !important; }

@media (min-width: 560px) {
  .setup { padding: 22px; }
  .plan-path, .week, .queue { --row: 42px; }
}
/* Wide enough, the week lies beside the path it comes from. */
@media (min-width: 1160px) {
  .path-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr); border-top: 1px solid var(--rule-2); border-bottom: 1px solid var(--rule-2); }
  .path-body .plan-path { padding-top: 6px; }
  .path-body .plan-path::before, .path-body .plan-path::after { top: calc(6px + var(--row) / 2); }
  .week-col { border-left: 1px solid var(--rule-2); }
  .week-col .week-head { margin-top: 0; border-top: 0; }
  .path-head { padding-bottom: 16px; }
  .forecast { padding-top: 14px; }
}
@media (min-width: 960px) {
  .plan-well { grid-template-columns: minmax(320px, 4fr) minmax(0, 6fr); gap: 16px; padding: 16px; }
  /* Both sheets the same height: the way to build it sits at the foot of the first. */
  .plan-well { align-items: stretch; }
  .setup { grid-template-rows: auto auto auto auto auto 1fr; padding: 24px; gap: 20px; }
  .setup-go { align-self: end; }
  .split-plan { grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); }
  .split-plan.rev { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
}
@media (max-width: 559px) {
  .week small { display: none; }
  .plan-path .topic small { display: none; }
  .plan-path [data-state="now"] .topic small, .plan-path [data-state="exam"] .topic small { display: block; }
  .result { gap: 14px; }
  .mark { font-size: 48px; padding: 8px 16px 10px; }
}

/* ---- the stage's sheet: the path, and the week ahead -----------------------
   The stage itself (the panel, the steps, the loose sheets and their flight)
   is in css/feature-pages.css. */
.stage-sheet .plan-path { --row: 38px; }
[data-state="blank"] .stop { background: none; box-shadow: none; border: 2px dashed var(--rule-2); }
[data-state="blank"] .topic > * { opacity: 0; }
.plan-path .topic > * { transition: opacity .3s var(--ease); }
[data-state="fading"] .stop { box-shadow: inset 0 0 0 2px var(--ink); }
[data-state="fading"] .topic small { color: var(--ink); font-weight: 500; }
/* The days keep their places; the sessions are what move. */
.stage-week { --row: 36px; display: grid; grid-template-columns: 42px minmax(0, 1fr); padding: 0 20px 14px; }
.stage-week ol { list-style: none; margin: 0; padding: 0; }
.stage-week li { display: flex; align-items: center; gap: 10px; height: var(--row); font-size: 15px; }
.stage-week li + li { border-top: 1px solid var(--rule); }
.days li { font-size: 13.5px; color: var(--ink-3); }
.week-items { min-height: calc(var(--row) * 5); }
.week-items b { font-weight: 500; letter-spacing: -.01em; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.week-items small { margin-left: auto; flex: none; font-size: 13px; color: var(--ink-3); white-space: nowrap; }
.week-items .is-new small { color: var(--ink); font-weight: 500; }
@media (prefers-reduced-motion: no-preference) {
  .stage-sheet .plan-path::after { transition: height var(--spring-glide-t) var(--spring-glide); }
  .landed .stop { animation: land var(--spring-catch-t) var(--spring-catch) backwards; }
}
