/* cleoanka — monthly letters (/letters/, /letters/<YYYY-MM>/). On top of base.css: a reading
   column for the prose, then the generated ledger sections (status tiles, tables that become
   labelled rows on phones, the hand-verified claims, the follow box). Colours come only from
   the base.css tokens and the status palette (--st). */

:root { --lt-measure: 37rem; --lt-wide: 60rem; }

.vh { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.sep { display: inline-block; width: 1.3em; height: 1px; background: var(--edge); vertical-align: middle; margin: 0 .65em; }

main.letter { padding: max(calc(var(--topbar-h, 0px) + 1.5rem), clamp(6rem, 14vh, 8.5rem)) 0 0; }
.letter-article { max-width: var(--lt-wide); margin: 0 auto; padding: 0 1.25rem; }
.letter-article :where(p, li, dd, td) { overflow-wrap: break-word; }
.letter-article code { overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- head */
.letter-head { max-width: var(--lt-measure); margin-inline: auto; padding-bottom: 2.1rem; margin-bottom: 2.4rem; border-bottom: 1px solid var(--edge-soft); }
.letter-section { margin: 0 0 1.1rem; font-family: var(--mono); font-size: .76rem; letter-spacing: .04em; color: var(--faint); }
.letter-section a { color: var(--faint); border: 0; }
.letter-section a:hover { color: var(--gold); }
.letter-head h1 { font-size: clamp(2.05rem, 5.6vw, 3.3rem); line-height: 1.06; letter-spacing: -0.035em; margin: 0 0 1rem; text-wrap: balance; }
.letter-dek { margin: 0 0 1.5rem; color: var(--dim); font-size: 1.14rem; line-height: 1.55; text-wrap: pretty; }
.letter-meta { margin: 0; font-family: var(--mono); font-size: .76rem; letter-spacing: .03em; color: var(--faint); }
.letter-meta a { border: 0; }

/* ---------------------------------------------------------------- prose */
.letter-prose { max-width: var(--lt-measure); margin-inline: auto; font-size: 1.075rem; line-height: 1.72; }
.letter-prose p { margin: 1.1em 0; text-wrap: pretty; }
.letter-prose data, .lt-count data, .lt-mini data { font-variant-numeric: tabular-nums lining-nums; }
.letter-prose data { font-weight: 600; color: var(--bright); }
@media (max-width: 34rem) { .letter-prose { hyphens: auto; -webkit-hyphens: auto; } }

/* ---------------------------------------------------------------- generated sections */
.lt-block { margin-top: clamp(2.8rem, 7vh, 3.8rem); }
.lt-block > :is(h2, .lt-note, .lt-empty, .lt-warn, .lt-counts, .lt-manuals) { max-width: var(--lt-measure); margin-inline: auto; }
.lt-block > .lt-counts { max-width: 46rem; }
.lt-block > .lt-manuals { max-width: 46rem; }
.lt-block h2, .lt-follow h2 { font-size: var(--h2); line-height: 1.25; letter-spacing: -0.022em; margin: 0 0 .6rem; text-wrap: balance; }
.lt-note { max-width: var(--lt-measure); margin: .4rem 0 1.1rem; color: var(--dim); font-size: .95rem; line-height: 1.6; }
.lt-empty { margin: .4rem 0; padding: .9rem 1rem; border: 1px dashed var(--edge); border-radius: 8px; color: var(--dim); }
.lt-warn { max-width: var(--lt-measure); margin: 0 0 1.1rem; padding: .1rem 0 .1rem .8rem; border-left: 2px solid var(--gold); color: var(--text); font-size: .95rem; }

/* status tiles at month end */
.lt-counts { list-style: none; margin: .8rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; }
@media (max-width: 34rem) { .lt-counts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.lt-count { display: flex; flex-direction: column; align-items: flex-start; gap: .55rem; padding: .85rem .9rem .8rem;
  background: var(--panel); border: 1px solid var(--edge); border-top: 2px solid var(--st, var(--edge)); border-radius: 8px; }
.lt-count data { font-family: var(--display); font-size: 2rem; font-weight: 600; line-height: 1; letter-spacing: -0.03em; color: var(--bright); }
/* a long label ("Elle doğrulanır") wraps inside a narrow tile instead of pushing past it at 320 px */
.lt-count .status { max-width: 100%; white-space: normal; }
.lt-count .status::before { flex: none; }
.lt-count[data-zero] { background: transparent; border-top-color: var(--edge); }
.lt-count[data-zero] data { color: var(--faint); font-weight: 400; }
.lt-count[data-zero] .status { opacity: .75; }

/* tables: a plain table on wide screens, compact wrapped rows below 62.5rem (no sideways scrolling) */
.lt-table { width: 100%; border-collapse: collapse; font-size: .86rem; margin: .2rem 0 0; }
.lt-table th { text-align: left; font-family: var(--mono); font-size: .72rem; font-weight: 400; letter-spacing: .04em; color: var(--faint);
  background: var(--panel); padding: .55rem .5rem; border-bottom: 1px solid var(--edge); white-space: nowrap; }
.lt-table td { padding: .6rem .5rem; border-bottom: 1px solid var(--edge-soft); vertical-align: top; }
.lt-table td.num { font-family: var(--mono); font-size: .76rem; font-variant-numeric: tabular-nums; }
.lt-table :where(td.lt-date, td.lt-claim, td.lt-target, td.lt-result, td.lt-rec, td.lt-by) { white-space: nowrap; }
/* fallbacks so a longer value or runner name wraps inside its cell instead of widening the table */
.lt-table td.num { overflow-wrap: anywhere; }
.lt-table td.lt-runner code { white-space: normal; overflow-wrap: anywhere; }
.lt-table code { font-size: .74rem; white-space: nowrap; overflow-wrap: normal; }
.lt-table a { border-bottom-color: transparent; }
.lt-table a:hover { border-bottom-color: var(--bright); }
.lt-reason { width: 100%; }
.lt-steps { list-style: none; margin: 0; padding: 0; }
.lt-steps li { display: grid; gap: .3rem; }
.lt-steps li + li { margin-top: .75rem; }
.lt-why { color: var(--dim); }
.lt-reason code { white-space: normal; overflow-wrap: anywhere; }
.lt-move { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .3rem .4rem; }
.lt-arrow { color: var(--faint); }
.lt-none { display: inline-flex; align-items: center; font-family: var(--mono); font-size: .74rem; letter-spacing: .04em; line-height: 1.2;
  color: var(--faint); border: 1px dashed var(--edge); border-radius: 999px; padding: .28em .75em; white-space: nowrap; }
.lt-ok { color: var(--heal); white-space: nowrap; }
.lt-fail { color: var(--rust); white-space: nowrap; font-weight: 600; }
.lt-err { display: block; margin-top: .25rem; padding: 0; background: none; border: 0; color: var(--rust); white-space: normal !important; font-size: .72rem !important; line-height: 1.4; }
.lt-runs td.lt-result { min-width: 7.5rem; width: 9rem; }
.lt-runs tr[data-passed="no"] td { background: color-mix(in srgb, var(--rust) 6%, transparent); }
.lt-runs td.lt-result { white-space: normal; }

@media (max-width: 62.5rem) {
  .lt-table, .lt-table tbody, .lt-table tr { display: block; }
  .lt-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); }
  .lt-table tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem .9rem; padding: .8rem 0; border-bottom: 1px solid var(--edge-soft); }
  .lt-table td { display: block; padding: 0; border: 0; min-width: 0; background: none !important; }
  .lt-table :where(td.num, td.lt-runner)::before { content: attr(data-label) " "; font-family: var(--mono); font-size: .68rem; letter-spacing: .04em; color: var(--faint); }
  .lt-table td.lt-date { color: var(--faint); font-size: .84rem; }
  .lt-table td.lt-reason { flex-basis: 100%; }
  .lt-table td.lt-by { display: none; }
  .lt-table td.num, .lt-table td.lt-runner { font-size: .8rem; }
  .lt-table code { white-space: normal; overflow-wrap: anywhere; }
  .lt-runs tr[data-passed="no"] { box-shadow: inset 2px 0 0 var(--rust); padding-left: .7rem; background: color-mix(in srgb, var(--rust) 5%, transparent); }
}

/* claims still verified by hand */
.lt-manuals { list-style: none; margin: 0; padding: 0; display: grid; gap: .7rem; }
.lt-manual { background: var(--panel); border: 1px solid var(--edge); border-left: 2px solid var(--st-manual); border-radius: 8px; padding: .9rem 1rem; }
.lt-manual p { margin: .3rem 0; }
.lt-mid { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.lt-mid a { border: 0; }
.lt-sentence { color: var(--bright); }
.lt-cond { color: var(--dim); font-size: .93rem; }
.lt-k { font-family: var(--mono); font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); margin-right: .35rem; }

/* follow */
.lt-follow { margin: clamp(2.8rem, 7vh, 3.8rem) auto 0; padding: 1.2rem 1.25rem; background: var(--panel); border: 1px solid var(--edge); border-radius: 8px; max-width: var(--lt-measure); }
.lt-follow ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.lt-follow li a { font-weight: 600; }
.lt-follow li span { display: block; color: var(--dim); font-size: .95rem; }
.lt-follow .lt-note { margin: .9rem 0 0; font-size: .9rem; }

/* pager */
main.letter > .pager { max-width: var(--lt-measure); margin: 3.2rem auto 0; padding: 0 1.25rem; font-family: var(--mono); font-size: .8rem; }

/* ---------------------------------------------------------------- index */
.letters-index .letter-head { text-align: center; } /* centred like the other index pages */
.lt-list { list-style: none; margin: 0 auto; padding: 0; max-width: 46rem; }
/* the index's header and follow box share the list's left edge */
.letters-index .letter-head, .letters-index .lt-follow { max-width: 46rem; }
.lt-item { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); gap: 1.6rem; padding: 1.9rem 0; border-bottom: 1px solid var(--edge-soft); }
.lt-item:first-child { padding-top: .4rem; }
.lt-item-date { margin: .45rem 0 0; font-family: var(--mono); font-size: .76rem; color: var(--faint); font-variant-numeric: tabular-nums; }
.lt-item h2 { font-size: clamp(1.3rem, 2.6vw, 1.5rem); line-height: 1.25; margin: 0 0 .4rem; letter-spacing: -0.02em; }
.lt-item h2 a { color: var(--bright); border: 0; }
.lt-item h2 a:hover { color: var(--gold); }
.lt-item-sum { margin: 0 0 .8rem; color: var(--dim); }
.lt-mini { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .45rem .9rem; }
.lt-mini li { display: inline-flex; align-items: center; gap: .4rem; font-family: var(--mono); font-size: .8rem; color: var(--bright); }
@media (max-width: 34rem) {
  .lt-item { grid-template-columns: 1fr; gap: .2rem; padding: 1.5rem 0; }
  .lt-item-date { margin: 0; }
}
