/* Contubernales Reader, Paleography (paleo.js). Colors come from app.css; pictures of the manuscript keep their own. */
.pl { --pl-ok: #3d7a4f; --pl-bad: #a5432f; max-width: 1080px; margin: 0 auto; }
:root[data-theme="night"] .pl { --pl-ok: #7fbf8e; --pl-bad: #e08a74; }
@media (prefers-color-scheme: dark) { :root[data-theme="auto"] .pl { --pl-ok: #7fbf8e; --pl-bad: #e08a74; } }
.pl h1 { font: 500 34px/1.1 var(--text); margin: 6px 0 10px; letter-spacing: .005em; }
.pl-kick { font: 600 12px/1 var(--ui); letter-spacing: .14em; text-transform: uppercase; color: var(--gold-ink); }
.pl-hint { color: var(--muted); font-size: 14.5px; }
.pl i { font-style: italic; }
.pl-q { color: var(--gold-ink); font-weight: 600; font-size: .7em; margin-left: 1px; }

/* home */
.pl-head { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 28px; align-items: center; margin: 18px 0 26px; }
.pl-head p { font-size: 17px; margin: 0 0 18px; max-width: 30em; }
.pl-head .btn { margin: 0 8px 8px 0; }
.pl-hero { width: 100%; border-radius: 14px; display: block; box-shadow: 0 1px 0 var(--line); }
@media (max-width: 760px) { .pl-head { grid-template-columns: minmax(0, 1fr); gap: 16px; } .pl h1 { font-size: 30px; } }
.pl-steps { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); counter-reset: s; }
.pl-steps a { display: flex; align-items: center; gap: 14px; padding: 14px 4px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.pl-steps a:hover b { color: var(--gold-ink); }
.pl-steps a > i { flex: none; width: 30px; height: 30px; border-radius: 999px; display: grid; place-items: center; font: 600 14px/1 var(--ui); font-style: normal;
  background: var(--bg-2); color: var(--muted); }
.pl-steps a > span { flex: 1; min-width: 0; }
.pl-steps b { display: block; font: 500 20px/1.2 var(--text); }
.pl-steps small { color: var(--muted); font-size: 13.5px; font-style: italic; font-family: var(--text); }
.pl-done { font: 600 12px/1 var(--ui); font-style: normal; padding: 6px 10px; border-radius: 999px; background: rgba(182, 152, 105, .18); color: var(--gold-ink); }
.pl-pages .pcard img { aspect-ratio: 3 / 4; object-position: top; }
.pl-pages { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.pl-pages .pcard b { font-size: 17px; }
.pl-src { color: var(--muted); font-size: 13px; margin: 26px 0 8px; max-width: 46em; }
.pcard img.pl-cardtext { object-position: center 30%; }

/* lesson bar */
.pl-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pl-dots { display: flex; gap: 8px; }
.pl-dots a { width: 12px; height: 12px; border-radius: 999px; background: var(--line); }
.pl-dots a.fin { background: var(--gold); opacity: .55; }
.pl-dots a.on { background: var(--gold); opacity: 1; box-shadow: 0 0 0 3px rgba(182, 152, 105, .3); }
.pl-lh { margin: 18px 0 8px; max-width: 40em; }
.pl-lh p { font-size: 17px; margin: 0 0 8px; }

/* lesson 1: the page */
.pl-pagina { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; margin-top: 14px; }
@media (max-width: 900px) { .pl-pagina { grid-template-columns: minmax(0, 1fr); } }
.pl-fig { position: relative; line-height: 0; border-radius: 6px; overflow: hidden; background: var(--bg-2); }
.pl-fig img { width: 100%; max-width: 100%; height: auto; display: block; user-select: none; -webkit-user-select: none; }
.pl-spot { position: absolute; border: 2px dashed rgba(25, 38, 72, .55); border-radius: 6px; background: rgba(248, 243, 228, .08); cursor: pointer; padding: 0; }
.pl-spot:hover, .pl-spot:focus-visible { background: rgba(182, 152, 105, .22); border-color: var(--gold-ink); }
.pl-spot.seen { border-style: solid; border-color: rgba(138, 107, 58, .65); }
.pl-spot.on { background: rgba(182, 152, 105, .28); border-color: var(--gold-ink); border-width: 3px; }
.pl-note { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; position: sticky; top: 76px; }
.pl-note b { font: 500 22px/1.2 var(--text); display: block; margin-bottom: 6px; }
.pl-note p { margin: 0 0 12px; }
.pl-count { color: var(--muted); font-size: 13.5px; }

/* lessons 2-5: words to read */
.pl-g { margin: 26px 0 8px; }
.pl-g h2 { font: 500 22px/1.2 var(--text); margin: 0 0 4px; }
.pl-g > p { margin: 0 0 12px; color: var(--muted); max-width: 40em; }
.pl-ws { display: flex; flex-wrap: wrap; gap: 12px; }
.pl-w { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 8px 6px; border-radius: 12px; background: var(--card);
  border: 1px solid var(--line); cursor: pointer; max-width: 100%; }
.pl-w:hover { border-color: var(--gold); }
.pl-wimg { display: block; height: 60px; width: auto; max-width: 100%; object-fit: contain; border-radius: 4px; }
.pl-rd { font: 400 19px/1.2 var(--text); min-height: 23px; color: var(--ink); visibility: hidden; }
.pl-w::after { content: "tap"; font: 600 10.5px/1 var(--ui); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-top: -26px; }
.pl-w.open .pl-rd { visibility: visible; }
.pl-w.open::after { content: none; }
.pl-w.open { border-color: var(--gold); }
.pl-end { display: flex; gap: 12px; flex-wrap: wrap; margin: 30px 0 10px; }

/* practice and Notae */
.pl-drill { max-width: 560px; }
.pl-step { color: var(--muted); font-size: 14px; margin: 16px 0 10px; }
.pl-qimg { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px; display: grid; place-items: center; min-height: 140px; margin-top: 10px; }
.pl-big { display: block; height: 100px; width: auto; max-width: 100%; object-fit: contain; border-radius: 4px; }
.pl-ask { font: 500 20px/1.3 var(--text); margin: 16px 0 10px; }
.pl-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 420px) { .pl-opts { grid-template-columns: 1fr; } }
.pl-opt { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 8px 14px; border-radius: 12px; background: var(--card); border: 1.5px solid var(--line);
  font: 400 21px/1.15 var(--text); color: var(--ink); text-align: left; cursor: pointer; }
.pl-opt i { font: 600 12px/1 var(--ui); font-style: normal; color: var(--muted); width: 14px; flex: none; }
.pl-opt:hover:not([disabled]) { border-color: var(--gold); }
.pl-opt.right { border-color: var(--pl-ok); box-shadow: inset 0 0 0 1.5px var(--pl-ok); }
.pl-opt.wrong { border-color: var(--pl-bad); box-shadow: inset 0 0 0 1.5px var(--pl-bad); opacity: .85; }
.pl-opt[disabled] { cursor: default; }
.pl-fb { min-height: 64px; margin-top: 14px; color: var(--muted); }
.pl-full { font: 400 26px/1.2 var(--text); color: var(--ink); margin: 0 0 4px; }
.pl-where { font-size: 14px; margin: 0 0 12px; }
.pl-time { height: 4px; background: var(--bg-2); border-radius: 999px; overflow: hidden; margin: 14px 0 4px; }
.pl-time i { display: block; height: 100%; width: 100%; background: var(--gold); }
.pl-intro { padding: 10px 0; }
.pl-intro p { font-size: 17px; }
.pl-score { font: 600 20px/1 var(--ui); color: var(--gold-ink); }

/* a page, line by line */
.pl-pnav { display: flex; align-items: center; gap: 2px; }
.pl-pnav b { font: 500 18px/1 var(--text); padding: 0 6px; }
.pl-reader { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; align-items: start; margin-top: 14px; max-width: 1180px; }
@media (max-width: 900px) { .pl-reader { grid-template-columns: minmax(0, 1fr); gap: 16px; } }
.pl-pcol { position: sticky; top: 70px; }
@media (max-width: 900px) { .pl-pcol { position: static; } }
.pl-ln { position: absolute; padding: 0; border: 0; border-radius: 3px; background: transparent; cursor: pointer; }
.pl-ln:hover { background: rgba(182, 152, 105, .18); }
.pl-ln.on { background: rgba(182, 152, 105, .22); box-shadow: 0 0 0 2px var(--gold-ink); }
.pl-ph h1 { font-size: 28px; margin: 0 0 2px; }
.pl-ph p { margin: 0 0 10px; }
.pl-try { display: inline-flex; align-items: center; gap: 8px; font-size: 14.5px; color: var(--muted); cursor: pointer; margin-bottom: 12px; }
.pl-try input { width: 18px; height: 18px; accent-color: var(--gold-ink); }
.pl-strip { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin-bottom: 16px; scroll-margin: 80px; }
.pl-sline { overflow-x: auto; overscroll-behavior-x: contain; border-radius: 6px; background: var(--bg-2); }
.pl-sline > div { background-repeat: no-repeat; margin: 0 auto; }
.pl-sread { display: flex; align-items: baseline; gap: 10px; margin: 10px 2px 8px; flex-wrap: wrap; }
.pl-sread .n, .pl-text .n { font: 600 12px/1 var(--ui); color: var(--gold-ink); flex: none; }
.pl-sread .t { font: 400 21px/1.3 var(--text); flex: 1; min-width: 0; }
.pl-sread .btn { display: none; }
.pl-reader.try .pl-strip:not(.shown) .pl-sread .t { visibility: hidden; }
.pl-reader.try .pl-strip:not(.shown) .pl-sread .btn { display: inline-flex; }
.pl-snav { display: flex; justify-content: space-between; gap: 8px; }
.pl-text { list-style: none; margin: 0; padding: 0; font: 400 18.5px/1.45 var(--text); }
.pl-text li { display: grid; grid-template-columns: 28px 1fr; gap: 6px; padding: 3px 6px; border-radius: 6px; }
.pl-text li[data-n] { cursor: pointer; }
.pl-text li[data-n]:hover { background: var(--bg-2); }
.pl-text li.on { background: var(--hl, rgba(182, 152, 105, .2)); }
.pl-text .n { padding-top: 7px; text-align: right; }
.pl-text li.rub .t { color: #a33a2a; }
:root[data-theme="night"] .pl-text li.rub .t { color: #e08a74; }
@media (prefers-color-scheme: dark) { :root[data-theme="auto"] .pl-text li.rub .t { color: #e08a74; } }
.pl-text .pl-pic { display: block; font-style: italic; color: var(--muted); font-size: 15.5px; padding: 10px 6px 10px 40px; }
.pl-reader.try .pl-text li:not(.seen) .t { filter: blur(5px); transition: filter .2s; }
.pl-fig.pl-pagefig { box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }

/* zoom */
.pl-zf { touch-action: pan-y; }
.pl-pan { position: absolute; inset: 0; transform-origin: 0 0; will-change: transform; }
.pl-pan.anim { transition: transform .35s ease; }
.pl-zf.zoomed { cursor: grab; }
.pl-zf.zoomed:active { cursor: grabbing; }
.pl-zoom { position: absolute; right: 10px; bottom: 10px; display: flex; flex-direction: column; gap: 6px; line-height: 1; z-index: 3; }
.pl-zoom button { width: 40px; height: 40px; border-radius: 999px; background: rgba(25, 38, 72, .82); color: #f8f3e4; font: 500 22px/1 var(--ui);
  display: grid; place-items: center; box-shadow: 0 1px 4px rgba(0, 0, 0, .25); }
.pl-zoom button:hover { background: rgba(25, 38, 72, .95); }
.pl-zhint { color: var(--muted); font-size: 13px; margin: 8px 2px 0; }
.pl-pan img { width: 100%; height: 100%; }

/* Cappelli's drawings sit on paper in every theme */
.pl-capimg { display: inline-grid; place-items: center; background: #fbf8f2; border-radius: 8px; padding: 6px 8px; min-width: 44px; min-height: 44px; max-width: 100%; }
.pl-capimg img { display: block; max-width: 100%; height: auto; }
.pl-w .pl-capimg { min-height: 60px; }
.pl-capimg.pl-big { padding: 14px 18px; min-height: 100px; }
.pl-g h2.pl-word { font-style: italic; font-size: 26px; }
.pl-capcard { display: flex; align-items: center; gap: 16px; margin: 26px 0 0; padding: 14px 16px; border-radius: 14px; background: var(--card);
  border: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.pl-capcard:hover { border-color: var(--gold); }
.pl-capcard > span:nth-child(2) { flex: 1; min-width: 0; }
.pl-capcard b { display: block; font: 500 21px/1.2 var(--text); }
.pl-capcard small { color: var(--muted); font-size: 14px; }
.pl-mcard img { aspect-ratio: 3 / 4; object-position: top; }
.pl-free, .pl-lock { position: absolute; top: 10px; right: 10px; font: 600 11.5px/1 var(--ui); font-style: normal; letter-spacing: .04em;
  padding: 6px 9px; border-radius: 999px; }
.pl-free { background: rgba(182, 152, 105, .92); color: #192648; }
.pl-lock { background: rgba(25, 38, 72, .88); color: #f8f3e4; }
.pl-pcard.locked img { filter: grayscale(.5) brightness(.9); }
.pl-howto { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px 20px; margin: 16px 0 6px; max-width: 46em; }
.pl-howto h2 { font: 500 21px/1.2 var(--text); margin: 0 0 6px; }
.pl-howto ul { margin: 0; padding-left: 20px; }
.pl-howto li { margin: 6px 0; }
.pl-gate { border: 1.5px solid var(--gold); border-radius: 14px; padding: 14px 18px; margin: 16px 0; max-width: 46em; }
.pl-gate p { margin: 0 0 10px; }

/* the dictionary */
.pl-search { display: flex; gap: 8px; max-width: 520px; margin: 10px 0 12px; }
.pl-search input { flex: 1; min-width: 0; height: 44px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink);
  padding: 0 14px; font: 400 19px/1 var(--text); }
.pl-search input:focus { outline: none; border-color: var(--gold); }
.pl-abc { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 14px; }
.pl-abc a { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 8px; background: var(--bg-2); color: var(--ink);
  text-decoration: none; font: 500 16px/1 var(--text); }
.pl-abc a:hover { background: var(--gold); color: #192648; }
.pl-capgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.pl-capgrid.small { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.pl-ce { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 6px; border-radius: 12px; background: var(--card);
  border: 1px solid var(--line); color: var(--ink); cursor: pointer; min-width: 0; }
.pl-ce:hover { border-color: var(--gold); }
.pl-ce .pl-capimg { width: 100%; min-height: 70px; }
.pl-ce b { font: 400 17px/1.15 var(--text); text-align: center; overflow-wrap: anywhere; }
.pl-ce small { color: var(--muted); font-size: 12px; }
.pl-kinds { margin: 24px 0 0; max-width: 46em; }
.pl-kinds summary { cursor: pointer; font: 500 18px/1.3 var(--text); }
.pl-kinds li { margin: 6px 0; }
.pl-sheet { position: fixed; inset: 0; z-index: 60; background: rgba(10, 14, 26, .55); display: grid; place-items: center; padding: 16px; }
.pl-sheet-in { position: relative; background: var(--bg); color: var(--ink); border-radius: 18px; padding: 22px 20px 18px; width: min(560px, 100%);
  max-height: calc(100vh - 32px); overflow: auto; box-shadow: 0 10px 40px rgba(0, 0, 0, .35); }
.pl-sheet-in h2 { font: 500 28px/1.2 var(--text); margin: 12px 0 4px; }
.pl-sheet-in h3 { font: 500 18px/1.2 var(--text); margin: 18px 0 8px; }
.pl-sheet-in p { margin: 0; color: var(--muted); }
.pl-x { position: absolute; top: 8px; right: 8px; }
.pl-capbig { padding: 18px 24px; min-height: 120px; display: grid; }
.pl-capimg.pl-big { display: inline-grid; height: auto; width: auto; max-width: 100%; object-fit: initial; }
.pl-capimg.pl-big img { max-height: 180px; width: auto; }

.pl .pcards.pl-pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 190px)); }
@media (max-width: 500px) { .pl .pcards.pl-pages { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Cappelli at a size you can read on a phone: every drawing drawn to one height, the preview as wide as the sheet */
.pl-ce .pl-capimg img { height: 64px; width: auto; max-width: 100%; object-fit: contain; }
.pl-capgrid.small .pl-ce .pl-capimg img { height: 52px; }
.pl-capbig { place-items: center; }
.pl-capbig img { width: 100%; height: auto; max-height: 40vh; min-height: 120px; object-fit: contain; }
@media (max-width: 600px) { .pl-capgrid { grid-template-columns: repeat(2, 1fr); } .pl-ce .pl-capimg img { height: 72px; } }
