/* Quiet Stanza — the shell around every page.
   The ink rail (ending in the user's wax seal), the desk's top-right streak and the
   practice nudge under it. desk.css re-fits these for the tablet and phone dock. */

/* ═══ shell + nav rail (global: NavLink anchors aren't reached by scoped CSS) ═══ */
.shell { display: grid; grid-template-columns: var(--rail-width) 1fr; height: 100vh; overflow: hidden; }
.rail {
  background: var(--ink);
  display: flex; flex-direction: column; justify-content: space-between; align-items: center;
  padding: 14px 0 12px;
  overflow-x: hidden; overflow-y: auto;
}
.rail-top, .rail-bottom { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.rail-btn {
  position: relative;
  width: 108px; min-height: 54px; border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: color-mix(in srgb, var(--paper) 70%, var(--rail-text));
  text-decoration: none;
  transition: background .12s ease, color .12s ease;
  flex-shrink: 0;
  /* sign-out is a <button>; shed its native chrome so it matches the NavLink anchors */
  background: none; border: none; cursor: pointer; padding: 6px 2px 5px; font-family: inherit;
}
.rail-btn:link, .rail-btn:visited { color: color-mix(in srgb, var(--paper) 70%, var(--rail-text)); }
.rail-btn:hover { color: var(--paper); background: color-mix(in srgb, var(--ink-soft) 65%, transparent); }
.rail-btn.active { background: var(--ink-soft); color: var(--paper); }
/* Practice is the thing to press: its candle and its name in gold, lit a little, wherever the
   writer is; on the desk itself it keeps the gold on the rail's chosen ground. */
.rail-btn.rail-practice:link, .rail-btn.rail-practice:visited,
.rail-btn.rail-practice.active, .rail-btn.rail-practice:hover { color: var(--gold); }
.rail-btn.rail-practice .rail-ico { filter: drop-shadow(0 0 4px color-mix(in srgb, var(--gold) 55%, transparent)); }
.rail-btn.rail-practice .rail-label { font-weight: 700; }

/* Two pips at the top right of their buttons. Practice carries today's standing: an empty ring
   before a sitting's time, red once it has gone by unwritten, amber with one of two written,
   green with every sitting done. Progress carries the streak as a count. */
/* Both sit on the icon's top right corner, a little over it, whatever the button's width. */
.rail-btn { --rail-ico: 22px; }
.rail-pip, .rail-count { position: absolute; box-sizing: border-box; left: calc(50% + var(--rail-ico) / 2 - 6px); }
.rail-pip { top: 2px; }
.rail-count { top: -1px; left: calc(50% + var(--rail-ico) / 2 - 8px); }
.rail-pip {
  width: 10px; height: 10px; border-radius: 50%;
  border: 1.5px solid currentColor; opacity: .8;
}
.rail-pip.is-done { background: var(--laurel); border-color: var(--laurel); opacity: 1; }
.rail-pip.is-half { background: #D29A2A; border-color: #D29A2A; opacity: 1; }
.rail-pip.is-late { background: var(--wax); border-color: var(--wax); opacity: 1; }
.rail-count {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--gold); color: var(--ink);
  font-family: var(--ui); font-size: 10.5px; font-weight: 700; line-height: 18px; text-align: center;
}
/* Within half an hour before a sitting's time, and the hour after, the candle throbs gently. */
.rail-btn.rail-practice.is-due .rail-ico { animation: rail-throb 2.6s ease-in-out infinite; }
@keyframes rail-throb {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 4px color-mix(in srgb, var(--gold) 55%, transparent)); }
  50% { transform: scale(1.14); filter: drop-shadow(0 0 9px color-mix(in srgb, var(--gold) 85%, transparent)); }
}
@media (prefers-reduced-motion: reduce) { .rail-btn.rail-practice.is-due .rail-ico { animation: none; } }
.rail-ico {
  width: 22px; height: 22px; display: block;
  fill: none; stroke: currentColor; stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round;
}
.rail-btn .fa { font-size: 16px; line-height: 1; }
.rail-label {
  font-family: var(--ui); font-size: 11px; font-weight: 600; line-height: 1.15;
  letter-spacing: 0.01em; color: inherit; text-align: center;
}
.content { overflow-y: auto; height: 100vh; }
.user-mark { position: relative; display: flex; justify-content: center; }
.user-mark-seal {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  transition: transform .15s ease;
}
.user-mark-seal .wax-seal { display: block; }
.user-mark-btn:hover .user-mark-seal { transform: rotate(-6deg) scale(1.06); }
.user-mark-btn:focus-visible { outline: 2px solid var(--paper); outline-offset: -2px; }
.user-mark-btn[aria-expanded="true"] { background: var(--ink-soft); color: var(--paper); }
.user-mark-btn[aria-expanded="true"] .user-mark-seal { transform: scale(1.06); }
/* The rail clips what overflows it, so the scrim and the card are fixed to the screen:
   beside the rail on a desktop, above the dock on a tablet or phone (desk.css). */
.user-mark-scrim {
  position: fixed;
  z-index: 48;
  inset: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: default;
}
.user-mark-card {
  position: fixed;
  z-index: 50;
  left: calc(var(--rail-width) + 10px);
  bottom: 12px;
  width: min(260px, calc(100vw - var(--rail-width) - 28px));
  padding: 14px 16px 12px;
  background: var(--sheet);
  border: 1px solid var(--sheet-edge);
  border-radius: var(--radius-card);
  box-shadow: 0 10px 28px rgba(31, 40, 51, 0.14);
  text-align: left;
}
.user-mark-btn { position: relative; z-index: 51; }
.user-mark-name {
  margin: 0;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.15;
  color: var(--text-primary);
}
.user-mark-email {
  margin: 4px 0 12px;
  font-size: 12px;
  line-height: 1.35;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}
.user-mark-tally {
  margin: -6px 0 12px;
}
/* The latest wax earned, dated, under the tally it extends. */
.user-mark-tally:has(+ .user-mark-unlocked) { margin-bottom: 2px; }
.user-mark-unlocked { margin: 0 0 12px; }
.user-mark-tally,
.user-mark-unlocked {
  font-family: var(--serif);
  font-style: italic;
  font-size: 14px;
  color: var(--text-secondary);
}
.user-mark-email.is-only {
  margin-top: 0;
  font-size: 14px;
  color: var(--text-primary);
}
.user-mark-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 12px;
}
.user-mark-who { flex: 1; min-width: 0; }
.user-mark-who .user-mark-email { margin-bottom: 0; }
/* Sign out is the small door in the corner, not the card's main action. */
.user-mark-out {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin: -4px -6px 0 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
}
.user-mark-out:hover { color: var(--wax); background: color-mix(in srgb, var(--ink) 6%, transparent); }
.user-mark-out:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.user-mark-ico {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.user-mark-links {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0 -8px;
}
.user-mark-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  font-size: 13.5px;
  line-height: 1.3;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.user-mark-link .user-mark-ico { color: var(--text-secondary); }
.user-mark-link:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.user-mark-link:hover .user-mark-ico { color: var(--wax); }
.user-mark-link:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
.user-mark-form { display: grid; gap: 10px; }
.user-mark-field { display: grid; gap: 4px; }
.user-mark-field > span {
  font-family: var(--ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.user-mark-error { margin: 0; font-size: 13px; color: var(--wax); }
.user-mark-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 2px; }
/* Practice due: EcoQua yellow band (same family as the public QS header). */
.desk-nudge.qs-yellow-bar {
  position: relative;
  z-index: 5;
  background: var(--eco-yellow);
  color: var(--eco-yellow-type);
  border-bottom: 1px solid var(--eco-yellow-border);
  box-shadow: 0 2px 10px color-mix(in srgb, var(--eco-yellow-border) 45%, transparent);
  padding: 14px 28px;
  margin: 0;
  flex-shrink: 0;
}
.desk-nudge-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px 18px;
  max-width: 920px;
  margin: 0 auto;
}
.desk-nudge-line {
  margin: 0;
  flex: 1 1 12rem;
  min-width: 0;
  font-family: var(--serif);
  font-style: normal;
  font-weight: 600;
  font-size: clamp(1rem, 2.2vw, 1.15rem);
  line-height: 1.35;
  color: var(--ink);
  text-align: center;
}
.desk-nudge-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 12px;
  flex-shrink: 0;
}
.desk-nudge-go {
  border: none;
  padding: 9px 20px;
  border-radius: 999px;
  cursor: pointer;
  font-family: var(--ui);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--wax);
  background: var(--paper);
  box-shadow: 0 1px 0 color-mix(in srgb, var(--ink) 12%, transparent);
}
.desk-nudge-go:hover {
  background: color-mix(in srgb, var(--paper) 92%, white);
}
.desk-nudge-go:active {
  background: color-mix(in srgb, var(--paper) 88%, var(--sheet-edge));
}
.desk-nudge-aside {
  background: none;
  border: none;
  padding: 8px 10px;
  cursor: pointer;
  font-family: var(--ui);
  font-size: 13px;
  font-weight: 500;
  color: color-mix(in srgb, var(--eco-yellow-type) 75%, var(--ink));
  text-decoration: underline;
  text-underline-offset: 3px;
}
.desk-nudge-aside:hover { color: var(--ink); }
.desk-nudge-go:focus-visible,
.desk-nudge-aside:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
@media (max-width: 560px) {
  .desk-nudge.qs-yellow-bar { padding: 12px 16px; }
  .desk-nudge-inner { gap: 10px 12px; }
  .desk-nudge-line { flex-basis: 100%; }
  .desk-nudge-actions { width: 100%; }
}

/* Full screen, taken by the desk on a touch device: the way out, in the top corner, over
   everything (the writing screen and the finish sheet too), quiet until it is wanted. */
.qs-fs-exit {
  position: fixed;
  top: max(8px, env(safe-area-inset-top, 0px));
  right: max(8px, env(safe-area-inset-right, 0px));
  z-index: 1200;
  display: inline-flex; align-items: center; gap: 7px;
  min-height: 36px; min-width: 36px; padding: 0 12px;
  border: 1px solid rgba(243, 234, 219, .35);
  border-radius: 999px;
  background: rgba(31, 40, 51, .62);
  color: #F3EADB;
  font-family: var(--ui); font-size: 12px; font-weight: 600; letter-spacing: .01em;
  cursor: pointer;
  opacity: .78;
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.qs-fs-exit[hidden] { display: none; }
.qs-fs-exit:hover, .qs-fs-exit:focus-visible { opacity: 1; }
.qs-fs-exit:focus-visible { outline: 2px solid var(--wax); outline-offset: 2px; }
.qs-fs-exit svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
/* On a phone, the mark alone: a round button a thumb can find. */
@media (max-width: 599px) {
  .qs-fs-exit { padding: 0; width: 38px; height: 38px; justify-content: center; }
  .qs-fs-exit-label { display: none; }
}

/* The menu tucked away on the desk: the rail (or the dock) goes, the page takes its room, and
   a round handle in the top corner brings it back. With the menu out, the same handle puts it
   away again. Not while the pen is down or a book is full screen: those have the screen. */
/* (the dock layout is one column already: only the wide rail gives back its column) */
@media (min-width: 1200px) { .shell.nav-tucked { grid-template-columns: 0 1fr; } }
.shell.nav-tucked .rail { display: none; }
.nav-handle {
  position: fixed;
  top: max(8px, env(safe-area-inset-top, 0px));
  left: max(8px, env(safe-area-inset-left, 0px));
  z-index: 1150;
  display: grid; place-items: center;
  width: 38px; height: 38px; padding: 0;
  border: 1px solid rgba(243, 234, 219, .35);
  border-radius: 50%;
  background: rgba(31, 40, 51, .62);
  color: #F3EADB;
  cursor: pointer;
  opacity: .78;
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.nav-handle:hover, .nav-handle:focus-visible { opacity: 1; }
.nav-handle:focus-visible { outline: 2px solid var(--wax); outline-offset: 2px; }
.nav-handle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.nav-handle .rail-pip { top: -2px; right: -2px; left: auto; }
/* With the rail out on a wide screen, the handle sits just past it, not over Practice. */
@media (min-width: 1200px) { .nav-handle:not(.is-tucked) { left: calc(var(--rail-width) + 8px); } }
html.writing-focus .nav-handle, html.journal-immersive .nav-handle { display: none; }

/* The seal's card opens on the seal itself, large, and the eight waxes to press it in. */
.user-mark-press {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  margin: 0 0 12px; padding-bottom: 12px;
  border-bottom: 1px solid var(--sheet-edge);
}
.user-mark-seal-btn {
  padding: 2px; border: none; border-radius: 50%; background: none; cursor: pointer; line-height: 0;
}
.user-mark-seal-btn:hover .user-mark-big { transform: rotate(-5deg); }
.user-mark-seal-btn:focus-visible { outline: 2px solid var(--wax); outline-offset: 2px; }
.user-mark-big { transition: transform .2s ease; }
/* The card's head: the Quiet Stanza band in EcoQua yellow, edge to edge across the card. */
.user-mark-band {
  margin: -14px -16px 12px;
  padding: 7px 16px 6px;
  border-radius: var(--radius-card) var(--radius-card) 0 0;
  background: var(--eco-yellow);
  color: var(--eco-yellow-type);
  border-bottom: 1px solid var(--eco-yellow-border);
  font-family: var(--ui);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .2em;
  text-transform: uppercase;
  text-align: center;
}
.user-mark-big { filter: drop-shadow(0 3px 5px rgba(43, 42, 36, .28)); animation: seal-press .45s cubic-bezier(.2, .9, .3, 1.2) both; }
@keyframes seal-press { from { transform: scale(.7) rotate(-14deg); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .user-mark-big { animation: none; } }
.user-mark-waxes { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.user-mark-wax {
  width: 22px; height: 22px; padding: 0; border-radius: 50%; cursor: pointer;
  border: 2px solid var(--sheet);
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--wax-c) 55%, white), var(--wax-c) 62%, color-mix(in srgb, var(--wax-c) 70%, black));
  box-shadow: 0 0 0 1px var(--sheet-edge);
}
.user-mark-wax.is-on { box-shadow: 0 0 0 2px var(--ink); }
/* A wax not yet in hand: there to see, greyed, and saying in words how it comes. */
.user-mark-wax.is-locked { cursor: default; filter: grayscale(.85); opacity: .45; }
.user-mark-wax-note {
  margin: 0; max-width: 240px;
  font-size: 12px; line-height: 1.35; text-align: center;
  color: var(--text-secondary);
}
.user-mark-wax:focus-visible { outline: 2px solid var(--wax); outline-offset: 2px; }
@media (pointer: coarse) { .user-mark-wax { width: 30px; height: 30px; } }
/* Settings carries the seal too, beside its title. */
.settings-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.settings-seal { flex: none; filter: drop-shadow(0 3px 5px rgba(43, 42, 36, .25)); }
